Get started
How it works
The full listing lifecycle: the states a loan moves through and what triggers each transition.
Every loan on Lendr is a MarketListing — a single struct that starts life the moment a borrower calls createListing and ends in exactly one of three terminal states. There is no partial state: a listing is always fully unfunded, fully funded, or fully settled.
The five states
| Status | Meaning | Who moves it | Function |
|---|---|---|---|
open | Collateral is locked, terms are named, no lender yet | Borrower | createListing |
active | A lender funded the loan; the term clock started | Lender | fillListing |
repaid | Borrower paid principal + interest before or at maturity | Borrower | repay |
defaulted | Loan matured unpaid; lender claimed the collateral | Lender | claimCollateral |
cancelled | Borrower withdrew an unfilled listing | Borrower | cancelListing |
The two paths a listing can take
open ──fillListing──▶ active ──repay────────────▶ repaid (borrower keeps collateral)
open ──cancelListing─▶ cancelled (never funded)
active ──claimCollateral──▶ defaulted (lender keeps collateral, only after maturity)open and active are the only non-terminal states. repaid, defaulted, and cancelled never transition further — a listing's id is not reused or refunded into a new state once it lands there.
What has to be true at each step
- A listing can only be filled once —
fillListingrequiresstatus == open, and it flips straight toactive. There is no partial fill and no order book depth per listing; size is exactly what the borrower asked for. - The borrower cannot fill their own listing —
fillListingreverts if the caller is the borrower. repayonly works whileactive, and only the borrower can call it. It always transfersloanAmount + interestOwed(id)to the lender, in full — there is no partial repayment.claimCollateralonly works whileactive, only the lender can call it, and only oncenow >= startTime + duration. Calling it a second early does nothing but revert; there is no way to claim before maturity, ever.cancelListingonly works whileopen, and only the borrower can call it. Once a lender has filled a listing, cancellation is no longer possible — the only exits arerepayor waiting for the lender toclaimCollateralafter maturity.
"Matured", not "liquidated"
Lendr has no price-triggered liquidation. Collateral value is never checked by the contract, before or during the loan. The only clock that matters is startTime + duration. A loan can be deep underwater in USD terms the entire time it's active and nothing happens on-chain until either the borrower repays or the term ends.
