Provide Liquidity

Provide liquidity to the BT/FW market using dual-sided, single-sided, or keep-CT strategies and receive LP tokens.

Key references: ActionAddRemoveLiqV3.addLiquidityDualTokenAndBt, addLiquidityDualFwAndBt, addLiquiditySingleToken, addLiquiditySingleBt, addLiquiditySingleFw, addLiquiditySingleTokenKeepCt, addLiquiditySingleFwKeepCt.

Details

  • Goal: Provide liquidity to BT/FW market and receive LP.

  • Preconditions:

    • Approvals for all inputs (tokenIn, BT, and/or FW).

    • Set minLpOut and approximation params when single-sided.

  • Additional entrypoints:

    • addLiquiditySingleBt — BT only, swaps portion to FW.

    • addLiquiditySingleFw — FW only, swaps portion to BT.

    • addLiquiditySingleFwKeepCt — FW + keep CT variant.

Views and events

Views

  • Market: readTokens(), isExpired(), readState(router), observe(secondsAgos).

  • LP: balanceOf(user), totalSupply() (derive proportional share of totalBt/totalFw).

Events

  • Router: AddLiquidityDualTokenAndBt, AddLiquidityDualFwAndBt, AddLiquiditySingleBt, AddLiquiditySingleFw, AddLiquiditySingleToken, AddLiquiditySingleTokenKeepCt, AddLiquiditySingleFwKeepCt.

  • Market: Mint, Swap (during balancing), UpdateImpliedRate.

Reward share (LP)

  • Suggested formula: lpBalance / totalSupply() over the epoch (TWAP).

  • Functions to call:

    • IERC20(market).balanceOf(user), IERC20(market).totalSupply()

    • FiraMarket.readState(router)totalBt, totalFw, totalLp (for underlying attribution)

Last updated