Skip to content

Port calc_withdraw_one_coin and calc_add_liquidity to V2 and NG variants #91

@sunce86

Description

@sunce86

Background

calc_withdraw_one_coin and calc_add_liquidity are currently only implemented for StableSwapV1 (PR #66), motivated by meta pool exchange_underlying simulation against 3pool/sBTC bases. Other variants miss this math.

Use case

Solvers that need LP token to single underlying coin (yield strategy unwind, meta pool unwrap, direct LP burn routing).

Coverage gap

Registry scan across chains 1, 8453, 42161:

Variant Pools blocked Reason
StableSwapV2 154 48 meta pools with FRAX/USDC or 2CRV base, 106 direct V2 pools (Eth+Arb+Base)
StableSwapNG 730 direct LP burn for the dominant pool family (548 Eth, 107 Arb, 75 Base)
StableSwapALend 2 low priority
StableSwapV0 1 low priority

Tasks

  • Port get_y_d, calc_withdraw_one_coin, calc_add_liquidity to core::stableswap_v2 and swap::stableswap_v2
  • Same for stableswap_ng (different fee model: dynamic fee, oracle rates)
  • Wei exact regression test against on chain reference for one pool per variant
  • Wire through Pool enum dispatchers
  • Update docs/integration.md with V2 and NG meta unwrap examples

Out of scope

V0 and ALend variants (combined: 3 pools, low ROI).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions