duneanalytics / duneanalytics/spellbook
[BUG] Incorrect token address for curve trades on metapool
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.5k
- Forks
- 1.4k
- Avg merge
- 3d 16h
- Merged PRs (30d)
- 22
Description
Description
In curve metapool when the buy token(j) index is 0 the token sold is added to underlying liquidity pool and the token amount for sold token(i) reflected in the TokenExchangeUnderlying event is the amount of lp tokens that were minted when the sold token was added to liqudity pool instead of token sold amount of the actual underlying token.
Current behavior
Expected behavior
The token_sold_address should be either the LP token, or token_sold_amount_raw should be the real amount of underlying tokens that were sold.
https://etherscan.io/tx/0x9f03f9982741b2f2f44c3776c26cc894acb6473f37cf2dc6b5c488f08bb3e953#eventlog
Impacted model(s)
dex.trades
Possible solution
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with dbt_subprojects/dex/models/trades/ethereum/platforms/curve_ethereum_base_trades.sql around lines 24-49, then inspect the linked transaction’s TokenExchangeUnderlying event and compare it with the Dune query. Verify how buy-token index 0 is handled in Curve metapool trades and confirm that index.trades reports either the LP token address or the actual underlying token amount consistently.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- sql
- Domain
- data-engineering
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100