Skip to content

[BUG] Incorrect token address for curve trades on metapool #8376

@arijitAD

Description

@arijitAD

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

Image `tokens_sold : 2308540548419464479212` is the number of lp token minted and not the actual amount of token sold. Actual token sold amount is `2316461131 USDC` Image https://app.blocksec.com/explorer/tx/eth/0x9f03f9982741b2f2f44c3776c26cc894acb6473f37cf2dc6b5c488f08bb3e953 Dune Query: https://dune.com/queries/5303926 Spellbook: https://github.com/duneanalytics/spellbook/blob/ca7d2804ce820b6c43064111e8710362c337e0c8/dbt_subprojects/dex/models/trades/ethereum/platforms/curve_ethereum_base_trades.sql#L24-L49

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions