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

StatusMeaningWho moves itFunction
openCollateral is locked, terms are named, no lender yetBorrowercreateListing
activeA lender funded the loan; the term clock startedLenderfillListing
repaidBorrower paid principal + interest before or at maturityBorrowerrepay
defaultedLoan matured unpaid; lender claimed the collateralLenderclaimCollateral
cancelledBorrower withdrew an unfilled listingBorrowercancelListing

The two paths a listing can take

text
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 — fillListing requires status == open, and it flips straight to active. 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 — fillListing reverts if the caller is the borrower.
  • repay only works while active, and only the borrower can call it. It always transfers loanAmount + interestOwed(id) to the lender, in full — there is no partial repayment.
  • claimCollateral only works while active, only the lender can call it, and only once now >= startTime + duration. Calling it a second early does nothing but revert; there is no way to claim before maturity, ever.
  • cancelListing only works while open, and only the borrower can call it. Once a lender has filled a listing, cancellation is no longer possible — the only exits are repay or waiting for the lender to claimCollateral after 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.

Next steps