Skip to content

Commit

Permalink
Use traces to extract the input for settlement::Observer (#3233)
Browse files Browse the repository at this point in the history
# Description
Implements first part of
#3177

# Changes

- [ ] Uses `trace_transaction` function to get traces and extract the
calldata of `settle` call

## How to test
Existing tests show that no regression bugs were introduced.

Final e2e test should cover this part of the code. Although by manually
testing the `trace_transaction` I am pretty sure the code is correct.
<!--
## Related Issues

Fixes #
-->
  • Loading branch information
sunce86 authored Jan 15, 2025
1 parent 01f35f8 commit 2725d5c
Show file tree
Hide file tree
Showing 5 changed files with 347 additions and 34 deletions.
11 changes: 9 additions & 2 deletions crates/autopilot/src/domain/eth/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -312,15 +312,20 @@ pub struct TradeEvent {
pub order_uid: domain::OrderUid,
}

/// A trace of a Call type of action.
#[derive(Debug, Clone, Default)]
pub struct TraceCall {
pub to: Address,
pub input: Calldata,
}

/// Any type of on-chain transaction.
#[derive(Debug, Clone, Default)]
pub struct Transaction {
/// The hash of the transaction.
pub hash: TxId,
/// The address of the sender of the transaction.
pub from: Address,
/// The call data of the transaction.
pub input: Calldata,
/// The block number of the block that contains the transaction.
pub block: BlockNo,
/// The timestamp of the block that contains the transaction.
Expand All @@ -329,4 +334,6 @@ pub struct Transaction {
pub gas: Gas,
/// The effective gas price of the transaction.
pub gas_price: EffectiveGasPrice,
/// Traces of all Calls contained in the transaction.
pub trace_calls: Vec<TraceCall>,
}
Loading

0 comments on commit 2725d5c

Please sign in to comment.