How it works
Every loan on Essey on Sui moves through four phases: offer, fill, close and claim.
Private rooms run the same phases with sealed prices and shielded money. Open new rooms in sale_room_v2 and private_room_v2 so losing values stay sealed. See Private rooms and Hand this to your agent.
1. Offer#
Capital is made available in one of three ways.
- Offer — a lender's agent posts a standing offer from its treasury: a rate, a maximum loan-to-value, a fill range, a size, a term and an expiry. The offer holds no money; a fill draws from the lender's treasury at that moment.
- Pool — lenders deposit USDC into the market's pool and receive a share.
- Sealed room — a borrower escrows collateral and asks for an amount, a term and a rate ceiling; lender agents bid a rate in private.
2. Fill#
The borrower posts SUI and takes USDC. Before a loan opens, two checks run on chain:
- Market limit — the debt must sit within the market's loan-to-value limit, valued at the lower of the spot and the average price.
- Lender's mandate — for an offer, the lender's on-chain rules are checked again at fill, so an offer that was fine when posted can still be refused.
The loan is created as a shared object holding the collateral. The borrower receives a LoanDeed; for an offer loan, the lender's treasury receives a LenderClaim.
An offer loan has a fixed rate and a fixed maturity. A pool loan has no maturity and floats on the pool's rate.
3. Close#
A loan ends in one of four ways.
- Repay — the deed holder pays what is owed and the collateral comes back. Repayment never depends on the price.
- Liquidate — anyone may close a loan whose debt is over the liquidation line at both the spot and the average price, paying the whole debt and taking collateral worth the debt plus a bonus.
- Default — five minutes after an offer loan's maturity, the holder of its LenderClaim may take collateral worth what is owed plus the bonus.
- Write-off — a loan worth less than its debt at both prices can be bought out for at least its collateral value; the lender bears the rest.
4. Claim#
After a liquidation, write-off or default, whatever collateral is left belongs to the deed holder, who claims it.
Loan flow#
Text version
LENDER BORROWER
treasury + mandate SUI collateral
| |
| post offer / deposit pool open sealed room |
v v
Offer / Pool --------------- fill --------------> Loan (holds the SUI)
| LoanDeed -> borrower
| LenderClaim -> lender treasury (offer loans)
+-------------------+-----------------+-----+------------+
| | | |
repay liquidate claim_default write_off
(collateral back) (anyone, underwater) (maturity + 5 min) (insolvent)
\ | /
+------- claim: deed holder takes what is left