Documentation Index
Fetch the complete documentation index at: https://mintlify.com/kamino-finance/klend/llms.txt
Use this file to discover all available pages before exploring further.
Overview
A lending market is the top-level organizational unit in Kamino Lending. Each market has its own configuration, reserves, and administrative controls. This guide covers market initialization, configuration updates, and ownership management.Initializing a Lending Market
Use theinit_lending_market instruction to create a new lending market.
Instruction Parameters
quote_currency: 32-byte UTF-8 string identifying the quote currency (e.g., “USD”)
Accounts Required
handler_init_lending_market.rs:8 for implementation.
Initial Configuration
When initialized, a market is created with default values:- Version: Current program version
- Emergency Mode: Disabled (0)
- Liquidation Close Factor: 20% (configurable)
- Max Liquidatable Value: 500,000 USD (configurable)
- Global Borrow Limit: Unlimited by default
- Referral Fee: 0 bps (disabled)
state/lending_market.rs:216-262 for all default values.
Updating Market Configuration
Use theupdate_lending_market instruction to modify market parameters.
Update Modes
TheUpdateLendingMarketMode enum defines all configurable parameters. Key modes include:
state/mod.rs:217-253 for the complete list.
Common Configuration Updates
Emergency Mode
Disable all borrowing and enable liquidations:- Market owner
- Emergency council (to enable only)
handler_update_lending_market.rs:308-314 for authorization logic.
Global Borrow Limits
Set maximum total borrowed value across all reserves:handler_update_lending_market.rs:57-59.
Liquidation Parameters
Close Factor - Maximum portion of debt that can be liquidated at once:handler_update_lending_market.rs:47-50.
Max Liquidatable Value - Maximum USD value that can be liquidated in one transaction:
handler_update_lending_market.rs:52-56.
Insolvency Risk LTV - LTV threshold for close-to-insolvency positions:
handler_update_lending_market.rs:71-75.
Elevation Groups
Elevation groups enable isolated lending markets with specific debt assets:handler_update_lending_market.rs:237-276):
- ID must be 1-32
- LTV < liquidation threshold < 100%
- Max liquidation bonus ≤ 10,000 bps
- Must specify debt reserve and max collateral count
- Liquidation threshold + (threshold × bonus) ≤ 100%
Referral Fees
Enable protocol-wide referral fee sharing:handler_update_lending_market.rs:86-93.
Managing Market Ownership
Ownership Model
Kamino Lending uses a two-step ownership transfer:- Current owner updates
lending_market_owner_cachedto the new owner address - New owner calls
update_lending_market_ownerto accept ownership
Transfer Process
Step 1: Propose new ownerhandler_update_lending_market_owner.rs:5-16.
Market Owner Responsibilities
The market owner has full control over:- Adding and configuring reserves
- Updating market-wide parameters
- Setting emergency mode
- Transferring ownership
- Making the market immutable
Emergency Council
The emergency council can only:- Enable emergency mode (cannot disable)
- No other permissions
Immutable Markets
Set the immutable flag to prevent most configuration changes:handler_update_lending_market.rs:33-36):
- Most
update_lending_marketoperations - Most
update_reserve_configoperations - Ownership transfers
- Global admin can still update certain parameters
- Emergency council can still enable emergency mode
Best Practices
- Test on Devnet: Always test configuration changes on devnet before applying to mainnet
- Gradual Limits: Start with conservative limits and adjust based on usage
- Monitor Closely: Watch for limit hits and utilization after changes
- Document Changes: Keep a record of all configuration updates
- Use Multisig: Consider using a multisig wallet as market owner for production
- Emergency Council: Set a separate emergency council for additional security
- Immutability: Only set immutable flag after thorough testing and when configuration is final
Related Instructions
- Reserve Configuration - Configure individual reserves
- Monitoring - Track market health and metrics