Repay Fixed Rate
Repay fixed-rate debt using any input token, with automatic BT acquisition via AMM swap (pre-expiry) or BT+CT minting (post-expiry).
Last updated
Repay fixed-rate debt using any input token, with automatic BT acquisition via AMM swap (pre-expiry) or BT+CT minting (post-expiry).
Key references: ActionBorrow.repay.
Goal: Repay debt using an input token; router converts to BT as needed.
Preconditions:
Existing borrow: else "AB: no borrow".
tokensToRepay must be ≤ current debt: else "AB: repay too much".
Input token approval to router.
Expiry handling:
Pre-expiry: Input token → FW (mint) → BT (AMM swap via FiraMarket). Repay, refund excess BT.
Post-expiry: Input token → FW (mint to CT contract) → CT.mintBC produces BT + CT. Only BT is used for repayment. CT is minted but NOT burned — it stays in the router with zero economic value.
Views
Lending: getUserPosition (pre/post), position(id, user).
Market: isExpired().
FW: previewDeposit, bcIndexStored() for estimation on expired paths.
Events
Lending: EventsLib.Repay (assets, shares), possibly EventsLib.AccrueInterest.
Router/Misc: MintFwFromToken, MintBcFromFw when conversions occur.
Last updated