ActionAddRemoveLiq

ActionAddRemoveLiqV3 supports 10 liquidity operation variants — dual-sided, single-sided, and keep-CT strategies for providing and removing liquidity.

circle-info

Source: src/fira_bonding/router/ActionAddRemoveLiqV3.sol

Add liquidity variants

Function
Input
Strategy

addLiquidityDualTokenAndBt

Token + BT

Mint FW from token, add with BT

addLiquidityDualFwAndBt

FW + BT

Direct dual-sided add

addLiquiditySingleToken

Token only

Mint FW, swap portion to BT, add both

addLiquiditySingleBt

BT only

Swap portion to FW, add both

addLiquiditySingleFw

FW only

Swap portion to BT, add both

addLiquiditySingleTokenKeepCt

Token only

Mint FW, mint BT+CT, use BT for LP, keep CT

addLiquiditySingleFwKeepCt

FW only

Same keep-CT strategy

Keep-CT strategy

Instead of swapping FW to BT, the router mints BT+CT from FW. BT goes to the market for liquidity, CT goes to the user. This way the user gets LP exposure plus floating yield from CT simultaneously.

Remove liquidity variants

Function
Output

removeLiquidityDualFwAndBt

FW + BT separately

removeLiquidityDualTokenAndBt

Token (from FW redeem) + BT

removeLiquiditySingleBt

BT only (FW swapped to BT)

removeLiquiditySingleFw

FW only (BT swapped to FW, or redeemed via CT post-expiry)

removeLiquiditySingleToken

Token (everything converted)

Post-expiry removal

Since the market doesn't allow swaps post-expiry, single-FW removal sends BT to the CT contract and redeems via CT.redeemBC().

Core mechanics

All add operations ultimately call FiraMarket.mint(receiver, netFwUsed, netBtUsed). Single-sided adds use approximation libraries to calculate how much to swap before depositing both sides. All remove operations call FiraMarket.burn.

Last updated