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

Feature: Historical sync of tokens before the fork #57

Open
jxom opened this issue Sep 14, 2023 · 3 comments
Open

Feature: Historical sync of tokens before the fork #57

jxom opened this issue Sep 14, 2023 · 3 comments
Labels
D: Intermediate Difficulty: Intermediate P: Medium Priority: Medium T: Feature Type: Feature

Comments

@jxom
Copy link
Member

jxom commented Sep 14, 2023

The Request

The ability to (already) see all of an account's ERC20 tokens when a forked instance has been set up.

Problem

Right now, when we set up a forked instance of an Anvil node, and import an account that holds ERC20 balances, we cannot see those tokens in the ERC20 token list until we import them.

Solution

As a user, when I spin up a forked instance and import my account (which has some ERC20 tokens) into Rivet, then I would expect to see them already in my token list instead of importing each one.

Notes

Should we just do pagination on eth_getLogs (viem's getLogs action) on the RPC Provider? Or should we use an external indexer to find all Transfer events against an account address?

@jxom jxom added P: Medium Priority: Medium D: Intermediate Difficulty: Intermediate T: Feature Type: Feature labels Sep 14, 2023
@b4s36t4
Copy link
Contributor

b4s36t4 commented Sep 14, 2023

https://viem.sh/docs/actions/public/getFilterLogs.html we can use this to get the events which are Transfer right?

@jxom
Copy link
Member Author

jxom commented Sep 14, 2023

@b4s36t4, yes but maybe https://viem.sh/docs/actions/public/getLogs.html#getlogs will be better

@b4s36t4
Copy link
Contributor

b4s36t4 commented Sep 15, 2023

Yep, I think we can scope the events in getlogs too. So pagination or using external indexer? like etherscan? These providers do have indexed all ERC20 tokens for a specific address.

https://docs.etherscan.io/api-endpoints/accounts#get-a-list-of-erc20-token-transfer-events-by-address

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
D: Intermediate Difficulty: Intermediate P: Medium Priority: Medium T: Feature Type: Feature
Projects
None yet
Development

No branches or pull requests

2 participants