Feature: Historical sync of tokens before the fork
Opened this issue · 3 comments
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?
https://viem.sh/docs/actions/public/getFilterLogs.html we can use this to get the events which are Transfer
right?
@b4s36t4, yes but maybe https://viem.sh/docs/actions/public/getLogs.html#getlogs will be better
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.