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#
| Field | Meaning |
|---|---|
| total_cap | The most this agent may have lent out at once. |
| outstanding | Principal currently lent out; it survives a mandate update, so re-setting the rules cannot reopen a full cap. |
| min_fill, max_fill | The smallest and largest single loan. |
| collateral | Allowed collateral types, each with its own loan-to-value ceiling; at most eight. |
| min_rate_bps | The lowest yearly rate, in basis points. |
| max_duration_ms | The longest loan term. |
| taker_kind, takers | Who 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:
| Check | Abort |
|---|---|
| Cap live and not expired | ECapRevoked (2), ECapExpired (3) |
| A mandate exists | ENoMandate (11) |
| Amount above zero, inside the fill range | EZeroAmount (8), EFillOutOfBounds (14) |
| Total lent stays within the cap | EOverTotalCap (13) |
| Collateral allowed, loan-to-value within its ceiling | ECollateralNotAllowed (15), EOverLtv (16) |
| Rate at or above the floor | ERateBelowFloor (17) |
| Term within the longest allowed | EDurationNotAllowed (18) |
| Borrower allowed | ETakerNotAllowed (19) |
| Treasury holds enough | EInsufficientFunds (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.