From 9f75d4720244d6c47961a71bca11df2648bceb1a Mon Sep 17 00:00:00 2001 From: Zizou <111426680+zizou0x@users.noreply.github.com> Date: Wed, 30 Oct 2024 15:46:08 +0700 Subject: [PATCH] fix(sfrax): update `aggregate_balances_changes` usage to the new interface (#101) Co-authored-by: zizou <111426680+flopell@users.noreply.github.com> --- substreams/ethereum-sfrax/src/modules.rs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/substreams/ethereum-sfrax/src/modules.rs b/substreams/ethereum-sfrax/src/modules.rs index 4c7be00..3812e10 100644 --- a/substreams/ethereum-sfrax/src/modules.rs +++ b/substreams/ethereum-sfrax/src/modules.rs @@ -214,11 +214,17 @@ pub fn map_protocol_changes( aggregate_balances_changes(balance_store, deltas) .into_iter() .for_each(|(_, (tx, balances))| { - transaction_contract + let tx_change = transaction_contract .entry(tx.index) - .or_insert_with(|| TransactionChanges::new(&tx)) - .balance_changes - .extend(balances.into_values()); + .or_insert_with(|| TransactionChanges::new(&tx)); + + balances + .into_values() + .for_each(|token_bc_map| { + tx_change + .balance_changes + .extend(token_bc_map.into_values()); + }); }); extract_contract_changes(