Skip to content
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

Merged

Conversation

cool-mestorf
Copy link
Contributor

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

  • Added Tests
  • Added Documentation
  • Breaking changes

Action::Call(action) => action.from,
Action::Create(action) => action.from,
Action::Suicide(action) => action.address,
Action::Reward(action) => action.author,
Copy link
Member

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved in 9bad7a5

@sslivkoff
Copy link
Member

other than that one comment lgtm

@sslivkoff
Copy link
Member

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];
Copy link
Member

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved in 55aa899

@sslivkoff
Copy link
Member

awesome! great feature

@sslivkoff sslivkoff merged commit 6e9ec88 into paradigmxyz:main Nov 15, 2023
3 checks passed
@cool-mestorf cool-mestorf deleted the feat/filter-ercs-by-from-to-addr branch November 17, 2023 01:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants