Core Interactions

Technical reference for all Lotus core interactions including supply, withdraw, borrow, repay, collateral management, and the shouldAccrueInterest tradeoff.

Lotus exposes six core operations: supply, withdraw, borrow, repay, supply collateral, and withdraw collateral. Each operates on a specific market and tranche, and most trigger interest accrual. Rounding and accrual scope details are in Reference → Contract API.

Lender Flow

spinner

For more on free supply, see the glossary.

Borrower Flow

spinner

Every core operation is scoped to a specific market and tranche, ensuring risk isolation at the protocol level.

Lending

Lenders supply the market's loan token into a specific tranche to earn yield. Supplied liquidity can also be used by borrowers in more senior tranches (lower index).

Supply

  • Specify either assets or shares (the other is set to 0).

  • Supplying accrues interest for all tranches up to and including your tranche, so supplier balances used in the operation are up to date.

  • Optional: pass callback data for advanced, atomic strategies.

Withdraw

  • Specify either assets or shares (the other is set to 0).

  • Choose a gas/accuracy tradeoff via shouldAccrueInterest:

    • true: accrue interest for all tranches up to and including your tranche (most accurate; higher gas).

    • false: skip accrual (cheaper); share price may be slightly stale so you may receive fewer assets than in fully accrued state.

Note: Available withdrawal is bounded by the tranche’s current free supply, which reflects liquidity sharing across tranches.


Borrowing

Borrowers post collateral into a specific tranche and borrow the market's loan token against it. Each tranche has its own collateral token, oracle, and liquidation loan-to-value (LLTV).

Borrow

  • Specify either assets or shares (the other set to 0).

  • Interest accrues only for the specified tranche.

  • Constraints: requested borrow must be ≤ the tranche's free supply, and the position must remain healthy under that tranche's oracle and LLTV.

Repay

  • Specify either assets or shares (the other set to 0).

  • Accrues interest only for the specified tranche.

  • Optional: pass callback data for atomic strategies (e.g., refinance).


Collateral Management

Supply Collateral

  • Increases borrowing capacity in the specified tranche.

  • Does not accrue interest.

Withdraw Collateral

  • Reduces borrowing capacity in the specified tranche.

  • Accrues interest only for the specified tranche and must leave the position healthy after withdrawal.


The shouldAccrueInterest Tradeoff

The shouldAccrueInterest parameter on withdraw() controls whether Lotus accrues interest across all tranches up to the target tranche before computing the withdrawal.

  • true: distributes pending interest before burning shares, giving the most accurate share-to-asset conversion. Higher gas.

  • false: skips accrual and uses stale state. Cheaper, but the lender receives slightly fewer assets because undistributed interest is not yet reflected in the share price.

Use true for large or infrequent withdrawals. Use false when a recent operation has already triggered accrual. If significant time has passed since the last accrual, true is the safer default. See Reference → Contract API for the full signature.

See Also

Last updated