We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ad0a391 commit 3c08359Copy full SHA for 3c08359
substreams/crates/tycho-substreams/src/models.rs
@@ -515,6 +515,22 @@ impl InterimContractChange {
515
self.code.clear();
516
self.code.extend_from_slice(code);
517
}
518
+
519
+ pub fn upsert_token_balance(&mut self, token: &[u8], balance: &[u8]) {
520
+ self.token_balances
521
+ .entry(token.to_vec())
522
+ .and_modify(|b| {
523
+ b.clear();
524
+ b.extend_from_slice(balance);
525
+ })
526
+ .or_insert_with(|| balance.to_vec());
527
+ }
528
529
+ pub fn upsert_token_balances(&mut self, balances: &HashMap<Vec<u8>, Vec<u8>>) {
530
+ for (token, balance) in balances.iter() {
531
+ self.upsert_token_balance(token, balance);
532
533
534
535
536
impl From<InterimContractChange> for Option<ContractChange> {
0 commit comments