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.
| Instruction | Description |
|---|
| init_lending_market | Initialize a new lending market |
| update_lending_market | Update lending market configuration |
| update_lending_market_owner | Transfer lending market ownership |
Reserve Instructions
Manage reserve configuration, initialization, and maintenance.
| Instruction | Description |
|---|
| init_reserve | Initialize a new reserve |
| seed_deposit_on_init_reserve | Initial deposit to reserve (prevents empty reserve) |
| init_farms_for_reserve | Initialize farming rewards for a reserve |
| update_reserve_config | Update reserve configuration |
| refresh_reserve | Refresh reserve state and interest rates |
| refresh_reserves_batch | Refresh multiple reserves in one transaction |
| redeem_fees | Redeem accumulated fees from reserve |
| withdraw_protocol_fee | Withdraw protocol fees |
| socialize_loss | Socialize bad debt (deprecated) |
| socialize_loss_v2 | Socialize bad debt (current version) |
Obligation Instructions
Manage user obligations (positions).
| Instruction | Description |
|---|
| init_obligation | Initialize a new obligation |
| init_user_metadata | Initialize user metadata account |
| init_obligation_farms_for_reserve | Initialize farming for an obligation |
| refresh_obligation | Refresh obligation state |
| refresh_obligation_farms_for_reserve | Refresh obligation farming state |
| request_elevation_group | Request elevation group membership |
| set_obligation_order | Set obligation order (limit order for collateral) |
Liquidity Instructions
Deposit, borrow, and repay operations.
| Instruction | Description |
|---|
| deposit_reserve_liquidity | Deposit liquidity into a reserve |
| deposit_reserve_liquidity_and_obligation_collateral | Deposit and use as collateral in one step (deprecated, use v2) |
| deposit_reserve_liquidity_and_obligation_collateral_v2 | Deposit and use as collateral (current version) |
| borrow_obligation_liquidity | Borrow liquidity from a reserve (deprecated, use v2) |
| borrow_obligation_liquidity_v2 | Borrow liquidity from a reserve (current version) |
| set_borrow_order | Create or update a borrow order (limit order) |
| fill_borrow_order | Fill an existing borrow order |
| repay_obligation_liquidity | Repay borrowed liquidity (deprecated, use v2) |
| repay_obligation_liquidity_v2 | Repay borrowed liquidity (current version) |
| flash_borrow_reserve_liquidity | Flash borrow liquidity |
| flash_repay_reserve_liquidity | Flash repay borrowed liquidity |
Collateral Instructions
Manage collateral deposits and withdrawals.
| Instruction | Description |
|---|
| redeem_reserve_collateral | Redeem collateral tokens for liquidity |
| deposit_obligation_collateral | Deposit collateral to an obligation (deprecated, use v2) |
| deposit_obligation_collateral_v2 | Deposit collateral to an obligation (current version) |
| withdraw_obligation_collateral | Withdraw collateral from an obligation (deprecated, use v2) |
| withdraw_obligation_collateral_v2 | Withdraw collateral from an obligation (current version) |
| withdraw_obligation_collateral_and_redeem_reserve_collateral | Withdraw and redeem in one step (deprecated, use v2) |
| withdraw_obligation_collateral_and_redeem_reserve_collateral_v2 | Withdraw and redeem (current version) |
| enqueue_to_withdraw | Queue a withdrawal for later processing |
| withdraw_queued_liquidity | Process queued withdrawal |
| recover_invalid_ticket_collateral | Recover collateral from invalid withdraw ticket |
Liquidation Instructions
Liquidate unhealthy positions.
| Instruction | Description |
|---|
| liquidate_obligation_and_redeem_reserve_collateral | Liquidate an unhealthy obligation (deprecated, use v2) |
| liquidate_obligation_and_redeem_reserve_collateral_v2 | Liquidate an unhealthy obligation (current version) |
| mark_obligation_for_deleveraging | Mark obligation for automatic deleveraging |
Combined Operations
Atomic multi-step operations for convenience.
| Instruction | Description |
|---|
| deposit_and_withdraw | Deposit liquidity and withdraw collateral atomically |
| repay_and_withdraw_and_redeem | Repay debt, withdraw collateral, and redeem atomically |
Referral Instructions
Manage referral system for fee sharing. See Referral System for details.
| Instruction | Description |
|---|
| init_referrer_state_and_short_url | Initialize referrer account with short URL |
| delete_referrer_state_and_short_url | Delete referrer account |
| init_referrer_token_state | Initialize referrer token state |
| withdraw_referrer_fees | Withdraw accumulated referral fees |
Global Config Instructions
Manage global protocol configuration.
| Instruction | Description |
|---|
| init_global_config | Initialize global configuration |
| update_global_config | Update global configuration parameters |
| update_global_config_admin | Update 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.