Docs/Getting started

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#

Loan lifecycleStatic diagram · Open full size ↗
Loan lifecycleCapital enters through an offer, the pool or a sealed room; a fill checks the market LTV and the lender mandate; the loan closes by repay, liquidation, default or write-off.CAPITAL: THREE WAYS INCLOSE: FOUR WAYSfillborrowsettleopensOfferlender treasury + mandateholds no moneyshared objectPoollenders deposit USDCand get a PoolShareshared objectv2 sealed roomprivate_room_v2losing rate stays sealedv2Borrowerposts SUI, takes USDCoff-chainFill: checked on chainmarket LTV at lower of spot and EMAlender’s mandate, checked againRefusednothing movesLoanholds the SUI collateraloffer: fixed rate · pool: floatsshared objectLoanDeedto the borrowerowned objectLenderClaimto the lender treasuryoffer loans onlyowned objectRepaydeed holder payscollateral backno price usedLiquidateanyone, once overthe line at spotand at EMADefaultoffer loan, maturity+ 5 min: claim holdertakes owed + bonusWrite-offworth < debt atboth prices; lenderbears the restClaimdeed holder takes what is leftLEGENDOn-chain shared objectOn-chain owned objectSealed / privateMove moduleRefused by the chainCall / transactionUSDC movesSUI movesRefusal (abort)
Scroll sideways to see the whole diagram.
Offer, pool, or a v2 sealed room. A fill checks the market and the mandate. Close by repay, liquidation, default or write-off. A v2 room records only the winning rate.Source: docs/how-it-works.md · docs/concepts/loans.md · docs/concepts/offers.md · docs/concepts/pool.md · docs/concepts/sealed-rooms.md
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