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

Build Tokens Table #934

Open
MSilb7 opened this issue Oct 29, 2024 · 3 comments
Open

Build Tokens Table #934

MSilb7 opened this issue Oct 29, 2024 · 3 comments
Assignees

Comments

@MSilb7
Copy link
Contributor

MSilb7 commented Oct 29, 2024

Pre-Reqs:

  • Raw logs, or token transfer tables

Steps:

  1. Get list of ERC20/721/1155 tokens from either 1) logs (filter to token transfer events) or 2) token transfer pipelines
  2. Call the token contract using an RPC, and read values for relevant fields (i.e. name, symbol, decimals) - also assign a field for token standard
    i. Note: We also need to pull the mint/burn address for interop, but need to check what function this is.
  3. Build a tokens data table with the schema: blockchain | contract_address |symbol | name | decimals (if available) | token standard | ... [other columns]

Other Notes:

  • For table sizing, we may want to only select tokens once they've reached some total transfer volume (i.e. don't pull until a token has been transferred 10 times)
  • If tokens have upgradable/changeable storage values, we want to catch those (i.e. we need to see if the mint/burn changes for interop). So we may need some workflow where we regularly re-check tokens? And also we'd need to store the changelog table for each tokens (i.e. first run on date X get values, 1, 2, 3 - no changes until the pull on date Y, when we saw values 1, 2, 4).
  • If we want to build a historical token supply data source, we can call each token whenever it's transferred and pull totalSupply
  • Tokens must contain certain functions, per the standards (see ERC20), but tokens may contain any number of extra functions. There may be ~more that we want to try to pull if available?

Use cases:

  • Any token-based query or data model. Right now we pull from external APIs which are super cumbersome, we should have this data in our own database.
  • (If we call token supply) Total

Next steps:

  • Interop / SuperchainERC20 upgrade monitoring
  • Token prices data source
  • Token Supply
@dioptx dioptx self-assigned this Nov 1, 2024
@MSilb7
Copy link
Contributor Author

MSilb7 commented Nov 8, 2024

cc @chuxinh on the prereq tables

Also TBD if we use the goldsky pipelines or build our own

@MSilb7
Copy link
Contributor Author

MSilb7 commented Dec 12, 2024

Dependency on first having #1134 .

We can also pull tokens from Defillama APIs that indicate underlying pool tokens.

Steps are still the same:

  1. Identify a token contract
  2. Read the functions we want (symbol, name, decimals, mint/burn if superchainerc20)
  3. Have some way to identify if it's a proxy being updated, so we can re-pull / update info.

@MSilb7
Copy link
Contributor Author

MSilb7 commented Dec 12, 2024

Can share utilies with #1158

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

No branches or pull requests

2 participants