Skip to main content
The Kamino Lending program provides a comprehensive set of instructions for managing lending markets, reserves, obligations, and liquidity operations on Solana.

Program IDs

  • Production: KLend2g3cP87fffoy8q1mQqGKjrxjC8boSyAYavgmjD
  • Staging: SLendK7ySfcEzyaFqy93gDnD3RtrpXJcnRwb6zFHJSh

Instruction Categories

Lending Market Instructions

Manage lending market configuration and ownership.
InstructionDescription
init_lending_marketInitialize a new lending market
update_lending_marketUpdate lending market configuration
update_lending_market_ownerTransfer lending market ownership

Reserve Instructions

Manage reserve configuration, initialization, and maintenance.
InstructionDescription
init_reserveInitialize a new reserve
seed_deposit_on_init_reserveInitial deposit to reserve (prevents empty reserve)
init_farms_for_reserveInitialize farming rewards for a reserve
update_reserve_configUpdate reserve configuration
refresh_reserveRefresh reserve state and interest rates
refresh_reserves_batchRefresh multiple reserves in one transaction
redeem_feesRedeem accumulated fees from reserve
withdraw_protocol_feeWithdraw protocol fees
socialize_lossSocialize bad debt (deprecated)
socialize_loss_v2Socialize bad debt (current version)

Obligation Instructions

Manage user obligations (positions).
InstructionDescription
init_obligationInitialize a new obligation
init_user_metadataInitialize user metadata account
init_obligation_farms_for_reserveInitialize farming for an obligation
refresh_obligationRefresh obligation state
refresh_obligation_farms_for_reserveRefresh obligation farming state
request_elevation_groupRequest elevation group membership
set_obligation_orderSet obligation order (limit order for collateral)

Liquidity Instructions

Deposit, borrow, and repay operations.
InstructionDescription
deposit_reserve_liquidityDeposit liquidity into a reserve
deposit_reserve_liquidity_and_obligation_collateralDeposit and use as collateral in one step (deprecated, use v2)
deposit_reserve_liquidity_and_obligation_collateral_v2Deposit and use as collateral (current version)
borrow_obligation_liquidityBorrow liquidity from a reserve (deprecated, use v2)
borrow_obligation_liquidity_v2Borrow liquidity from a reserve (current version)
set_borrow_orderCreate or update a borrow order (limit order)
fill_borrow_orderFill an existing borrow order
repay_obligation_liquidityRepay borrowed liquidity (deprecated, use v2)
repay_obligation_liquidity_v2Repay borrowed liquidity (current version)
flash_borrow_reserve_liquidityFlash borrow liquidity
flash_repay_reserve_liquidityFlash repay borrowed liquidity

Collateral Instructions

Manage collateral deposits and withdrawals.
InstructionDescription
redeem_reserve_collateralRedeem collateral tokens for liquidity
deposit_obligation_collateralDeposit collateral to an obligation (deprecated, use v2)
deposit_obligation_collateral_v2Deposit collateral to an obligation (current version)
withdraw_obligation_collateralWithdraw collateral from an obligation (deprecated, use v2)
withdraw_obligation_collateral_v2Withdraw collateral from an obligation (current version)
withdraw_obligation_collateral_and_redeem_reserve_collateralWithdraw and redeem in one step (deprecated, use v2)
withdraw_obligation_collateral_and_redeem_reserve_collateral_v2Withdraw and redeem (current version)
enqueue_to_withdrawQueue a withdrawal for later processing
withdraw_queued_liquidityProcess queued withdrawal
recover_invalid_ticket_collateralRecover collateral from invalid withdraw ticket

Liquidation Instructions

Liquidate unhealthy positions.
InstructionDescription
liquidate_obligation_and_redeem_reserve_collateralLiquidate an unhealthy obligation (deprecated, use v2)
liquidate_obligation_and_redeem_reserve_collateral_v2Liquidate an unhealthy obligation (current version)
mark_obligation_for_deleveragingMark obligation for automatic deleveraging

Combined Operations

Atomic multi-step operations for convenience.
InstructionDescription
deposit_and_withdrawDeposit liquidity and withdraw collateral atomically
repay_and_withdraw_and_redeemRepay debt, withdraw collateral, and redeem atomically

Referral Instructions

Manage referral system for fee sharing. See Referral System for details.
InstructionDescription
init_referrer_state_and_short_urlInitialize referrer account with short URL
delete_referrer_state_and_short_urlDelete referrer account
init_referrer_token_stateInitialize referrer token state
withdraw_referrer_feesWithdraw accumulated referral fees

Global Config Instructions

Manage global protocol configuration.
InstructionDescription
init_global_configInitialize global configuration
update_global_configUpdate global configuration parameters
update_global_config_adminUpdate global config admin authority

Versioning

Many instructions have deprecated v1 variants and current v2 variants. The v2 variants include support for farming rewards and improved account structure.Always use v2 variants for new integrations:
  • deposit_obligation_collateral_v2 instead of deposit_obligation_collateral
  • withdraw_obligation_collateral_v2 instead of withdraw_obligation_collateral
  • borrow_obligation_liquidity_v2 instead of borrow_obligation_liquidity
  • repay_obligation_liquidity_v2 instead of repay_obligation_liquidity
  • deposit_reserve_liquidity_and_obligation_collateral_v2 instead of v1
  • withdraw_obligation_collateral_and_redeem_reserve_collateral_v2 instead of v1
  • liquidate_obligation_and_redeem_reserve_collateral_v2 instead of v1
  • socialize_loss_v2 instead of socialize_loss
The v1 instructions are deprecated since version 1.8.0 and may be removed in future versions.

Emergency Mode

Most instructions are disabled when the lending market is in emergency mode. Only administrative and refresh operations are allowed during emergency mode.
Instructions with the #[access_control(emergency_mode_disabled)] attribute will fail if the lending market’s emergency mode is enabled. Always check the market state before submitting transactions.

Build docs developers (and LLMs) love