Market-level enablement
A typical
min_borrow_order_fill_value is large enough to make fills economically meaningful (e.g., $50–$1,000 equivalent). Set it to filter out dust orders that would crowd the orderbook.
- SDK
- API
- Kamino CLI
Enable borrow orders via SDK
Curator-side: flip the market flags viaupdateLendingMarketIxs. End-user-side: place orders via the setBorrowOrder instruction; lenders fill via fillBorrowOrder.Curator: enable on the market
Borrower: place an order
The SDK exposes the rawsetBorrowOrder instruction builder via the codegen module. Build the instruction with the order parameters and submit it from the borrower’s wallet.Lender: fill an order
klend-sdk/src/@codegen/klend/instructions/setBorrowOrder.ts and fillBorrowOrder.ts.The order itself
A borrow order is stored on the borrower’s obligation account. Each order specifies:
Hard limit: each obligation can hold one open borrow order at a time. This is a deliberate business-logic constraint enforced by the program; it keeps the orderbook clean and the matching logic simple.
The matching flow
The borrower callsset-borrow-order on their obligation, specifying the parameters above. At this stage no target reserve is named: the order is a pure expression of “what I’m willing to take” — max rate, min term, expiry, size.
A lender (or filler bot, or vault) finds the order, picks a fixed-term reserve whose debt_term_seconds and current borrow rate sit inside the order’s min_debt_term_seconds and max_borrow_rate_bps bounds, and calls fill-borrow-order referencing the borrower’s obligation, the chosen reserve, and the amount to fill. The program verifies expiry, term, rate, and fill-size constraints; on success, principal flows from the reserve to the borrower’s debt position with the matched fixed term.
The order’s remaining_debt_amount decreases by the filled size. When it reaches zero, the order closes. The borrower can also cancel the order at any time, and the order is automatically void after fillable_until_timestamp passes.
Three liquidity flows that fill orders
Cancelling an order
A borrower can cancel their open order at any time (subject to no in-flight partial fill). Cancellation closes the order without affecting the borrows that have already been filled — those positions persist as normal fixed-term debt.Interaction with obligation ownership transfer
When a borrower has an open borrow order, transferring obligation ownership has a constraint: the order’s debt destination is tied to the original owner’s authority. If the new owner accepts the obligation while an order is open, the order becomes unfillable. Recommended flow: cancel any open borrow orders before initiating an obligation transfer. See Obligation ownership transfer.Off-chain infrastructure
Borrow orders are useful in proportion to the off-chain matching infrastructure around them. A typical setup:- Order indexer: an off-chain service watches
set-borrow-orderevents and maintains an orderbook view per reserve - Filler bot: a service that detects fillable orders and submits
fill-borrow-ordertransactions - UI: the borrower’s UI shows the orderbook and lets them place / cancel orders
Common errors
Reference
- Market config reference —
borrow_order_*flags andmin_borrow_order_fill_value - Fixed rate reserves — the underlying lending mechanics
- Obligation ownership transfer — interaction with open orders