Smart contracts

Function reference

Every function and event on LendrMarket — signature, access, and effect.

State-changing functions

FunctionCallerPreconditionEffect
createListing(collateralToken, collateralAmount, loanToken, loanAmount, aprBps, duration) → idAnyoneallowedCollateral(collateralToken) and loanToken is the market's loan assetPulls collateral from caller into the market; creates a listing with status = open
cancelListing(id)The listing's borrowerstatus == openReturns collateralAmount to the borrower; sets status = cancelled
fillListing(id)Anyone except the borrowerstatus == openPulls loanAmount from caller, sends it to the borrower; sets lender, startTime = now, status = active
repay(id)The listing's borrowerstatus == activePulls loanAmount + interestOwed(id), sends it to the lender; returns collateral to the borrower; sets status = repaid
claimCollateral(id)The listing's lenderstatus == active and now >= startTime + durationSends collateralAmount to the lender; sets status = defaulted

Read-only functions

FunctionReturns
interestOwed(id)uint256 — the exact amount repay would currently require in interest
listingCount()uint256 — the number of listings ever created, i.e. the highest valid id
getListing(id)The full MarketListing struct for that id
allowedCollateral(token)bool — whether token is in this deployment's collateral allow-list

Events

EventIndexed fieldsEmitted by
ListingCreated(id, borrower, collateralToken, loanToken, collateralAmount, loanAmount, aprBps, duration)id, borrowercreateListing

There's only one event

fillListing, repay, cancelListing, and claimCollateral don't emit anything of their own in this ABI. An indexer or UI tracking a listing's later lifecycle has to read getListing(id).status directly rather than subscribing to a dedicated event for each transition — which is exactly what the app's own polling does.