BTB
/

Kamino Lend

Lendingwebsite
Peer-to-pool lending and borrowing on Solana (klend program). An agent can deposit liquidity to earn interest, deposit collateral, borrow against it, repay, withdraw, and use flash loans. Kamino also exposes a REST API for market data and transaction builders.

What you can do

supplyDeposit liquidity into a reserve to earn interestdeposit_reserve_liquidity(amount) on the klend program, or the Kamino API transaction builder under /ktx/klend/deposit
borrowBorrow against deposited collateralinit_user_metadata and init_obligation once per wallet and market; deposit collateral; refresh_reserve(s) and refresh_obligation; then borrow_obligation_liquidity_v2(amount) in the same transaction
repayRepay borrowed liquidityrefresh the reserve, then repay_obligation_liquidity_v2(amount); or repay_and_withdraw_and_redeem for repay plus collateral release
withdrawWithdraw supplied liquidityredeem_reserve_collateral(ctoken_amount) after refresh_reserve
flash-loanBorrow and repay in one transactionflash_borrow_reserve_liquidity(amount), other instructions, then flash_repay_reserve_liquidity(amount, borrow_index) in the same transaction
Borrowing can be liquidated when LTV passes the reserve limit. Liquidators can repay debt and take collateral at a discount. Watch health (LTV) and keep a margin.
Oracle and price moves: collateral and debt values depend on oracle prices. A bad or stale price can trigger liquidations or block withdrawals.
Interest rates are variable and change with utilization. Supplied liquidity can be temporarily unavailable to withdraw when a reserve is highly utilized.
Smart contract risk: the program is an upgradeable Solana program maintained by Kamino. Audits reduce risk but do not remove it.

Contracts

Read any function, or build a write and sign it. Amounts are in base units (1 USDC = 1000000).
klend lending program (mainnet)pool on solanaKLend2g3cP87fffoy8q1mQqGKjrxjC8boSyAYavgmjD
write deposit_reserve_liquidity(liquidity_amount: u64)
Supply liquidity to a reserve and receive cTokens (collateral tokens). Amount is in base units of the reserve's liquidity mint. Lending market and reserve accounts are required.
write redeem_reserve_collateral(collateral_amount: u64)
Burn cTokens to withdraw the matching liquidity from a reserve. Amount is in cToken base units.
write init_user_metadata(user_lookup_table: Pubkey)
Create the user metadata account once per wallet. Pass an address lookup table pubkey (used to shrink transactions). Needed before obligations are opened.
write init_obligation(args: InitObligationArgs)
Create an obligation (borrow and collateral account) for a wallet in a lending market. Required before depositing collateral or borrowing.
write refresh_reserve()
Update a reserve's interest and oracle price. Send in the same transaction before borrow, withdraw or liquidation instructions.
write refresh_reserves_batch(skip_price_updates: bool)
Refresh several reserves in one instruction (reserve accounts passed as remaining accounts). Use before refresh_obligation.
write refresh_obligation()
Recompute an obligation's deposited value, borrowed value and LTV from its refreshed reserves. Required before borrow, withdraw or liquidate.
write deposit_obligation_collateral_v2(collateral_amount: u64)
Deposit cTokens as collateral into an obligation. Amount in cToken base units.
write withdraw_obligation_collateral_v2(collateral_amount: u64)
Withdraw collateral from an obligation. Fails if the obligation would exceed its allowed LTV. Refresh reserves and obligation first.
write borrow_obligation_liquidity_v2(liquidity_amount: u64)
Borrow liquidity against collateral in an obligation. Amount in base units of the reserve's liquidity mint. Refresh reserves and obligation first.
write repay_obligation_liquidity_v2(liquidity_amount: u64)
Repay borrowed liquidity. Amount in base units; accrued interest is included in the debt.
write deposit_reserve_liquidity_and_obligation_collateral_v2(liquidity_amount: u64)
Combined call: supply liquidity to a reserve and deposit the received cTokens as obligation collateral in one instruction.
write withdraw_obligation_collateral_and_redeem_reserve_collateral_v2(collateral_amount: u64)
Combined call: withdraw collateral from an obligation and redeem the cTokens for liquidity in one instruction.
write repay_and_withdraw_and_redeem(repay_amount: u64, withdraw_collateral_amount: u64)
Combined call: repay debt, then withdraw collateral and redeem it. Amounts in base units.
write flash_borrow_reserve_liquidity(liquidity_amount: u64)
Start a flash loan. Must be paired with flash_repay_reserve_liquidity later in the same transaction.
write flash_repay_reserve_liquidity(liquidity_amount: u64, borrow_instruction_index: u8)
Repay a flash loan in the same transaction. borrow_instruction_index is the index of the matching flash_borrow instruction in the transaction.
write liquidate_obligation_and_redeem_reserve_collateral_v2(liquidity_amount: u64, min_received_liquidity_amount: u64, max_allowed_ltv_override_percent: u64)
Liquidate an unhealthy obligation: repay part of its debt and receive discounted collateral. Used by liquidators; refresh reserves and obligation first.