Trade BT/CT
Mint BT+CT from tokens by splitting FW, and redeem BT+CT back to tokens with different handling pre- and post-expiry.
Last updated
Mint BT+CT from tokens by splitting FW, and redeem BT+CT back to tokens with different handling pre- and post-expiry.
Key references: IPActionMiscV3.mintBcFromToken, mintBcFromFw, redeemBcToToken, redeemBcToFw.
Goal: Split FW into BT + CT and later unwind back to base token.
Preconditions:
Approvals for tokenIn to Router.
Set minBcOut / minTokenOut thresholds.
Minting: mintBcFromToken / mintBcFromFw — always produces equal BT + CT, both pre- and post-expiry. Post-expiry uses frozen postExpiry.firstBCIndex for the conversion rate.
Redemption pre-expiry: Both BT and CT must be provided. CT.redeemBC() burns both and returns FW. No AMM swap involved.
Redemption post-expiry: Only BT is required. CT.redeemBC() burns BT only; CT is NOT burned. FW returned at the current bcIndex, and any post-expiry yield accrual goes to the treasury.
Views
CT (IBCToken): bcIndexStored(), bcIndexCurrent(); FW(), BT(); isExpired(), balanceOf(user).
BT (IBondToken): balanceOf(user), FW(), CT(), expiry(), isExpired().
FW: previewDeposit, previewRedeem.
Events
Router: MintBcFromToken, MintBcFromFw, RedeemBcToToken, RedeemBcToFw.
CT: Mint, Burn, RedeemInterest.
Suggested formula: userCt / totalCt over the epoch (TWAP).
Functions to call:
IBCToken(CT).balanceOf(user), IERC20(CT).totalSupply()
Exclude expired CT. Post-expiry CT is minted but never burned, inflating totalSupply() — consider filtering by excluding known router/contract addresses.
Suggested formula: userBt / totalBt where:
userBt = IBondToken(BT).balanceOf(user) - getUserPosition(marketParamsBT, user).borrowAssets
totalBt = IERC20(BT).totalSupply() - IBondToken(BT).balanceOf(market) - IBondToken(BT).balanceOf(lendingMarket)
Over the epoch (TWAP).
Last updated