ActionBorrow

ActionBorrow integrates with the lending market for fixed-rate borrowing and repayment in a single transaction.

circle-info

Source: src/fira_bonding/router/ActionBorrow.sol

Functions

supplyAndBorrowSingleToken

Supply collateral → borrow BT → swap BT to FW → redeem FW to desired token. All in one transaction.

borrowSingleToken

Same flow but assumes collateral is already supplied.

repay

Converts input token to BT and repays the lending market:

  • Pre-expiry: Input token → FW (mint) → BT (AMM swap) → repay. Refunds excess BT.

  • Post-expiry: Input token → FW (mint) → BT+CT (via CT.mintBC) → repay with BT. CT is minted but has zero value post-expiry.

Key details

  • The borrow position is owned by msg.sender, but the router is the token receiver — BT is held transiently and swapped immediately.

  • tokensToRepay must be ≤ current debt, otherwise reverts with "AB: repay too much".

  • Requires the user to have authorized the router on the LendingMarket (setAuthorization(router, true)).

Last updated