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

idea: slight refactor to balance_changes table? #201

Open
joel-u410 opened this issue Dec 12, 2024 · 1 comment
Open

idea: slight refactor to balance_changes table? #201

joel-u410 opened this issue Dec 12, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@joel-u410
Copy link
Contributor

I was thinking the balance_changes table might be improved by doing the following:

  • Rename the amount column to balance
  • Introduce a new amount column which records the change in balance in that block for address/token.
    • The value could be computed in the crawler by querying each balance also at block N - 1 and storing the difference.

This can be computed in the database from the balance_changes table too, as long as it's 100% complete -- but this could provide a nice way to internally check the data integrity, as well as providing a convenient way to correlate a transaction with its effect on the balance.

The balances view would also be updated to query from the balance column (but can still be named amount there, so it doesn't require any API changes in the webserver).

If you agree that this would be worth the added cost of doubling the balance RPC queries in the crawler, I can send a PR that makes this change.

@Fraccaman
Copy link
Member

Fraccaman commented Dec 13, 2024

interesting idea! I think we could try to do this but we would like to avoid changes to the table if not needed. Ill label this as enhancement and lets target to have it in v2!

@Fraccaman Fraccaman added the enhancement New feature or request label Dec 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants