Docs/Core concepts

Lend mandate

A LendMandate is the set of lending rules an owner gives one lender agent. It lives in the treasury, keyed by the agent's cap, and only the owner can set it.

Fields#

FieldMeaning
total_capThe most this agent may have lent out at once.
outstandingPrincipal currently lent out; it survives a mandate update, so re-setting the rules cannot reopen a full cap.
min_fill, max_fillThe smallest and largest single loan.
collateralAllowed collateral types, each with its own loan-to-value ceiling; at most eight.
min_rate_bpsThe lowest yearly rate, in basis points.
max_duration_msThe longest loan term.
taker_kind, takersWho may borrow: anyone (0), a list of up to 64 addresses (1), or only through a sealed room (2).

A collateral ceiling can never be set above the market's own limit for that collateral. Setting it to zero removes the collateral.

Checked twice#

The mandate is checked when an offer is posted, and again on every fill, so tightening the rules takes effect on offers that are already out.

At fill, in this order:

CheckAbort
Cap live and not expiredECapRevoked (2), ECapExpired (3)
A mandate existsENoMandate (11)
Amount above zero, inside the fill rangeEZeroAmount (8), EFillOutOfBounds (14)
Total lent stays within the capEOverTotalCap (13)
Collateral allowed, loan-to-value within its ceilingECollateralNotAllowed (15), EOverLtv (16)
Rate at or above the floorERateBelowFloor (17)
Term within the longest allowedEDurationNotAllowed (18)
Borrower allowedETakerNotAllowed (19)
Treasury holds enoughEInsufficientFunds (9)

The loan-to-value used here is computed by the protocol at the live price, never passed in by a caller.

How a hosted lender's mandate is set#

The hosted lender form becomes a mandate with a total budget, a loan range, a rate floor, one SUI loan-to-value ceiling, the longest of the chosen terms, and borrowers open to anyone. The terms offered are 1, 7 and 30 days. The update is one transaction that sets the mandate and the SUI ceiling together.