ActionSwapBT
ActionSwapBTV3 provides entry points for swapping tokens or FW to/from Bond Tokens via the Fira Market AMM.
Functions
swapExactTokenForBt— User token → FW (mint) → FW sent to market → swap for BTswapExactFwForBt— FW → BT via market swapswapExactBtForToken— BT → FW (market swap) → redeem to user tokenswapExactBtForFw— BT → FW via market swap
Swap amount calculation
The FW→BT direction uses MarketApproxBtOutLibV2.approxSwapExactFwForBtV2 with binary search and an off-chain hint (guessOffchain). This is needed because the market only supports exact-output BT swaps (swapFwForExactBt), so the approximation library finds the BT amount that uses exactly the available FW.
On-chain fallback
If guessOffchain == 0 and no limit orders are present, the facet delegates to ActionSimple which uses MarketApproxLibOnchain for a closed-form approximation instead.
Last updated