-
Notifications
You must be signed in to change notification settings - Fork 106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
filter erc transfers and traces by from/to addresses #123
filter erc transfers and traces by from/to addresses #123
Conversation
crates/freeze/src/datasets/traces.rs
Outdated
Action::Call(action) => action.from, | ||
Action::Create(action) => action.from, | ||
Action::Suicide(action) => action.address, | ||
Action::Reward(action) => action.author, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Action::Reward(action) => action.author,
should be to in the to filter not the from filter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resolved in 9bad7a5
other than that one comment lgtm |
actually I just realized something. for erc20 / erc721 transfers, the from_address / to_address are topic1 and topic2 of the log. so they can just be provided as filters to the log request. that will fetch less data and be more simple+efficient overall |
@@ -37,7 +37,28 @@ impl CollectByBlock for Erc20Transfers { | |||
let topics = [Some(ValueOrArray::Value(Some(*EVENT_ERC20_TRANSFER))), None, None, None]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
from_address and to_address are indexed for erc20 and erc721 addresses in topic1 and topic2. so they can go as items in this filter. it will fetch less data and be simpler than filtering
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resolved in 55aa899
awesome! great feature |
Motivation
Solves #97.
Solution
For traces, take from/to according to appropriate trace type and compare with given parameters. For ERC transfers, compare appropriate indexed log with given parameters.
PR Checklist