-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9f827ea
commit a36a3ab
Showing
8 changed files
with
117 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
mod maps; | ||
mod sinks; | ||
mod abi; | ||
mod pb; | ||
mod pb; | ||
mod store; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
use substreams::scalar::BigInt; | ||
use substreams::store::{StoreAdd, StoreAddBigInt}; | ||
use crate::pb::erc20::types::v1::{BalanceChanges}; | ||
use substreams::store::StoreNew; | ||
|
||
#[substreams::handlers::store] | ||
pub fn store_valid_balance_changes(balance_changes: BalanceChanges, store: StoreAddBigInt) { | ||
let mut type0_counter : u64 = 0; | ||
let mut type1_counter : u64 = 0; | ||
let mut type2_counter : u64 = 0; | ||
let mut total_counter : u64 = 0; | ||
|
||
for change in balance_changes.balance_changes { | ||
match change.change_type { | ||
1 => { | ||
type1_counter += 1; | ||
total_counter += 1; | ||
}, | ||
2 => { | ||
type2_counter += 1; | ||
total_counter += 1; | ||
}, | ||
_ => { | ||
type0_counter += 1; | ||
total_counter += 1; | ||
}, | ||
} | ||
} | ||
|
||
store.add(0, "type1", BigInt::from(type1_counter)); | ||
store.add(0, "type2", BigInt::from(type2_counter)); | ||
store.add(0, "type0", BigInt::from(type0_counter)); | ||
store.add(0, "total", BigInt::from(total_counter)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters