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

Arbitrum RWA user balances #6608

Merged
merged 34 commits into from
Sep 6, 2024
Merged

Conversation

darvinrio
Copy link
Contributor

@darvinrio darvinrio commented Aug 26, 2024

Thank you for contributing to Spellbook 🪄

Update!

Please build spells in the proper subproject directory. For more information, please see the main readme, which also links to a GH discussion with the option to ask questions.

Contribution type

Please check the type of contribution this pull request is for:

  • New spell(s)
  • Adding to existing spell lineage
  • Bug fix

Note: You can safely discard any section below which doesn't apply based on selection above


For new spell(s)

If you are building new spell(s), please provide the following information:

  • Spell name(s): rwa_arbitrum.*
  • Description: Track RWA asset balances of User
  • Who are the new spell(s) for? PYOR team and community
  • How will the new spell(s) be used downstream? Build holder analysis metrics
  • Implementation details: [Information on how the spell(s) are implemented]
  • Test instructions: [How to test the new spell(s)]
  • Related issue(s): [Link to related issues, if any]

Additional information

Please provide any additional information that might help us review your pull request:

  • [Any additional information]

Thank you for your contribution!

@darvinrio darvinrio changed the title Feat/rwa tvl Arbitrum RWA TVL Aug 26, 2024
@darvinrio darvinrio marked this pull request as draft August 26, 2024 09:20
@dune-eng
Copy link

Workflow run id 10557142434 approved.

@dune-eng
Copy link

Workflow run id 10557142866 approved.

@dune-eng
Copy link

Workflow run id 10557142876 approved.

@dune-eng
Copy link

Workflow run id 10557181060 approved.

@dune-eng
Copy link

Workflow run id 10557181516 approved.

@dune-eng
Copy link

Workflow run id 10557181498 approved.

@darvinrio darvinrio changed the title Arbitrum RWA TVL Arbitrum RWA user balances Aug 26, 2024
@dune-eng
Copy link

Workflow run id 10557373793 approved.

@dune-eng
Copy link

Workflow run id 10557373916 approved.

@dune-eng
Copy link

Workflow run id 10557589410 approved.

@dune-eng
Copy link

Workflow run id 10557589229 approved.

@dune-eng
Copy link

Workflow run id 10557683664 approved.

@dune-eng
Copy link

Workflow run id 10557683842 approved.

@dune-eng
Copy link

Workflow run id 10558008065 approved.

@dune-eng
Copy link

Workflow run id 10558008317 approved.

@dune-eng
Copy link

Workflow run id 10614254821 approved.

@dune-eng
Copy link

Workflow run id 10614254983 approved.

@0xRobin
Copy link
Collaborator

0xRobin commented Aug 29, 2024

hey @darvinrio, from a quick look at this PR it doesn't look like you would need to build this out in spellbook to build queries for RWA balances on Arbitrum.

Can you try leveraging the existing tokens_arbitrum.balances_daily model?
If this isn't suited for what you're trying to do, please expand a bit on you're use case and we will try to find the best way to support.

@darvinrio
Copy link
Contributor Author

hey @0xRobin.
we want to do analytics on top of the holders table.
we are looking at metrics like:

  • Weekly Active Holders
  • Holder Retentions Corhorts
  • Decentralization indexes

We want to do this for a list of 36 assets and ~10 governance tokens. (we expect the list to grow).
We want it refreshed daily. We will be using APIs to feed this into our front end.
We were unable to materialize this on the Dune's Largest Tier.
That is why we went this route. Moreover, we saw the open request to build an incremental version.

My understanding is that the underlying source table has made the balanceOf() call every time there is a transfer. (Not sure where I read this, it was in some discussion)
Hence we went with a simple incremental model.

@0xRobin
Copy link
Collaborator

0xRobin commented Aug 29, 2024

Thanks for the context, that's super insightful.
It is true that currently the existing balances tables are not very performant due to the forward fill included in the view.

So basically you're in search of a daily materialized table of balances for a specific token set?
It should be possible to do this with Dune queries but this requires using the daily_agg_base table (which is materialized), filtering the addresses on this table and only then replicating the forward fill and enrichment logic. Happy to help get this set up if you want to give some example queries that you're currently unable to run on the high tier.

Not saying this is what you must do, we can still discuss the inclusion into spellbook, I'll bring this up internally next week.

@darvinrio
Copy link
Contributor Author

we couldn't find the daily_agg_base on the frontend.
image

all of those we found were views, which is why we chose to explore the spellbook route.

to be honest, we would love to utilize the spellbook, as we will be

  1. getting analytics streamlined for ourselves
  2. empowering the community with a dataset and macro that could be useful.

me and my team have prior experience in building dbt models internally.

@jeff-dude jeff-dude added the in review Assignee is currently reviewing the PR label Aug 29, 2024
@darvinrio
Copy link
Contributor Author

bumping this @0xRobin @jeff-dude

@darvinrio
Copy link
Contributor Author

we are currently planning on using a materialized view, till we can get the dune table up and running.
can we however, move this up the priority ?

@0xRobin
Copy link
Collaborator

0xRobin commented Sep 4, 2024

@darvinrio I will refactor this a bit today so it can be re-used easily by others that want to materialize certain balances, and then we can try to get this merged asap.

@darvinrio
Copy link
Contributor Author

got it @0xRobin .

you can also share me your specs, and i can get it changed accordingly.

@0xRobin
Copy link
Collaborator

0xRobin commented Sep 4, 2024

ok I'm happy with the changes in the macro @darvinrio, I made some naming changes as well to the models to be consistent with the rest of spellbook.

Can you give my changes a review from your side?

@0xRobin 0xRobin self-requested a review September 4, 2024 11:54
@darvinrio
Copy link
Contributor Author

@0xRobin this looks good to me.
thanks for the patch on the incremental.
🫡

@0xRobin 0xRobin added ready-for-merging and removed in review Assignee is currently reviewing the PR WIP work in progress labels Sep 5, 2024
@jeff-dude jeff-dude merged commit 86db50a into duneanalytics:main Sep 6, 2024
2 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Sep 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants