diff --git a/.gitignore b/.gitignore index 2c65d74..8ab5a15 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,5 @@ target/ .vscode .idea *.log + +substreams/ethereum-template/Cargo.lock diff --git a/substreams/ethereum-balancer/src/modules.rs b/substreams/ethereum-balancer/src/modules.rs index b1747b1..af6db11 100644 --- a/substreams/ethereum-balancer/src/modules.rs +++ b/substreams/ethereum-balancer/src/modules.rs @@ -15,7 +15,7 @@ use tycho_substreams::{ const VAULT_ADDRESS: &[u8] = &hex!("BA12222222228d8Ba445958a75a0704d566BF2C8"); #[substreams::handlers::map] -pub fn map_pools_created(block: eth::v2::Block) -> Result { +pub fn map_components(block: eth::v2::Block) -> Result { // Gather contract changes by indexing `PoolCreated` events and analysing the `Create` call // We store these as a hashmap by tx hash since we need to agg by tx hash later Ok(BlockTransactionProtocolComponents { @@ -47,7 +47,7 @@ pub fn map_pools_created(block: eth::v2::Block) -> Result Result { @@ -133,7 +133,7 @@ pub fn map_balance_deltas( /// It's significant to include both the `pool_id` and the `token_id` for each balance delta as the /// store key to ensure that there's a unique balance being tallied for each. #[substreams::handlers::store] -pub fn store_balance_changes(deltas: BlockBalanceDeltas, store: StoreAddBigInt) { +pub fn store_balances(deltas: BlockBalanceDeltas, store: StoreAddBigInt) { tycho_substreams::balances::store_balance_changes(deltas, store); } @@ -144,7 +144,7 @@ pub fn store_balance_changes(deltas: BlockBalanceDeltas, store: StoreAddBigInt) /// At the very end, the map can easily be sorted by index to ensure the final /// `BlockContractChanges` is ordered by transactions properly. #[substreams::handlers::map] -pub fn map_changes( +pub fn map_protocol_changes( block: eth::v2::Block, grouped_components: BlockTransactionProtocolComponents, deltas: BlockBalanceDeltas, diff --git a/substreams/ethereum-balancer/substreams.yaml b/substreams/ethereum-balancer/substreams.yaml index 06f2ee7..9597334 100644 --- a/substreams/ethereum-balancer/substreams.yaml +++ b/substreams/ethereum-balancer/substreams.yaml @@ -9,7 +9,7 @@ binaries: file: ../target/wasm32-unknown-unknown/release/ethereum_balancer.wasm modules: - - name: map_pools_created + - name: map_components kind: map initialBlock: 12369300 inputs: @@ -17,40 +17,40 @@ modules: output: type: proto:tycho.evm.v1.GroupedTransactionProtocolComponents - - name: store_pools_created + - name: store_components kind: store initialBlock: 12369300 updatePolicy: add valueType: int64 inputs: - - map: map_pools_created + - map: map_components - - name: map_balance_deltas + - name: map_relative_balances kind: map initialBlock: 12369300 # An arbitrary block that should change based on your requirements inputs: - source: sf.ethereum.type.v2.Block - - store: store_pools_created + - store: store_components output: type: proto:tycho.evm.v1.BalanceDeltas - - name: store_balance_changes + - name: store_balances kind: store initialBlock: 12369300 updatePolicy: add valueType: bigint inputs: - - map: map_balance_deltas + - map: map_relative_balances - name: map_changes kind: map initialBlock: 12369300 inputs: - source: sf.ethereum.type.v2.Block - - map: map_pools_created - - map: map_balance_deltas - - store: store_pools_created - - store: store_balance_changes + - map: map_components + - map: map_relative_balances + - store: store_components + - store: store_balances mode: deltas # This is the key property that simplifies `BalanceChange` handling output: type: proto:tycho.evm.v1.BlockContractChanges