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

enrich liquidity spell using macros/spells #52

Closed
mendesfabio opened this issue Dec 7, 2023 · 2 comments
Closed

enrich liquidity spell using macros/spells #52

mendesfabio opened this issue Dec 7, 2023 · 2 comments
Assignees

Comments

@mendesfabio
Copy link
Member

mendesfabio commented Dec 7, 2023

First of all, read the comments of #44. Goal here is to abstract some complexity of the liquidity spell by leveraging macros and spells to enrich the pool balance changes (of any type i.e. Swap, Join, Exit, etc) with labels and pricing.

Ideally we would only have create a spell that outputs pool, token, delta (still TBD) and the macros will do all the work to transform into daily data, calculate or estimate USD liquidity, add pool symbols, etc.

@mendesfabio
Copy link
Member Author

BTW this is what inspired me to create this issue:

https://github.com/duneanalytics/spellbook/blob/main/macros/models/_sector/dex/enrich_dex_trades.sql

@viniabussafi viniabussafi self-assigned this May 9, 2024
@viniabussafi
Copy link
Member

viniabussafi commented May 13, 2024

Considerations:
It has not been as easy as initially thought due to a few blockers:

  1. The liquidity spell as-is takes pricing information a few CTEs before the last SELECT statement, in order to allow for the estimation of liquidity on weighted pools using pricing assets, which is more relevant in chains with less swap volume and, therefore, less pricing data on the dex.prices table (especially avax, gnosis and zkevm), and also protects us from wrong pricing feeds. Breaking this down in several macros would be a bit trickier, bus still doable. I am at the moment investigating how effective that would be.
  2. With that peculiarity of the liquidity spell, it's not so easy to settle in a single spell-enhancing macro, as adjustments would have to be made to the protocol_fees and bpt_prices spells in order to allow this integration, which also makes me question the effectiveness of this.

My idea is to work on this until our standup tomorrow and bring a definitve perspective on whether we keep thing as they are, making minor adjustments, such as making the spells be incrementally refreshed or go on a full-on rebuild of them

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