Documentation Index
Fetch the complete documentation index at: https://docs.monolith.market/llms.txt
Use this file to discover all available pages before exploring further.
Lens Contract
Lens is a stateless, view-only helper that simulates interest accrual and redemption outcomes without mutating protocol state. It is useful for UI previews and off-chain integrations that need fresh values without paying gas for accrueInterest().
Contract source
Functions
previewRedeem
amountIn Coin against borrower’s collateral on _lender, using current state plus pending interest.
Parameters:
_lender: Lender instance to queryborrower: Borrower to redeem against (must be in redeemable mode)amountIn: Desired amount of Coin to redeem
coinIn: Amount of Coin that would actually be consumed (capped by the borrower’s debt and by their collateral value at the current price)amountOut: Amount of collateral the redeemer would receive, in collateral token decimals
(0, 0) when any of the following hold:
amountInis zeroborroweris not redeemable (isRedeemable(borrower) == false)borrowerhas no collateral- The oracle does not allow liquidations (stale/invalid price or reduce-only)
borrowerhas no debt- The computed
amountOutis zero or exceeds the borrower’s collateral balance
getDebtOf
borrower’s current debt on _lender, including interest that has accrued since the last accrueInterest() call. In contrast, Lender.getDebtOf reflects only already-accrued state.
Parameters:
_lender: Lender instance to queryborrower: Borrower address
- Current debt amount (18 decimals), synchronized with
InterestModel.calculateInterest. Zero if the borrower has no shares in the appropriate (paid or free) debt pool.
- For redeemable borrowers, debt is computed from
freeDebtSharesagainsttotalFreeDebt(free debt does not accrue interest). - For non-redeemable borrowers, debt is computed from
paidDebtSharesagainst a syncedtotalPaidDebtthat includes pending interest via atry/catchcall toInterestModel.calculateInterest. If the interest math would overflow, the function falls back to the unsynced value rather than reverting.

