Introduction to Kamino Lending
Kamino Lending (KLend) is an open source lending protocol smart contract built for the Solana blockchain. It enables decentralized lending and borrowing of digital assets with advanced features for risk management and capital efficiency.What is Kamino Lending?
Kamino Lending provides a permissionless platform where users can:- Supply liquidity to earn interest on deposited assets
- Borrow assets against collateral with dynamic interest rates
- Execute flash loans for arbitrage and liquidations
- Participate in liquidations to maintain protocol solvency
- Earn referral rewards through the integrated referral system
Key features
Multiple reserves
Support for numerous token reserves within a single lending market, each with independent configurations
Flash loans
Uncollateralized loans that must be repaid within the same transaction, enabling advanced DeFi strategies
Liquidation system
Automated liquidation mechanism to protect lenders when borrowers become undercollateralized
Elevation groups
Advanced risk isolation feature allowing up to 32 elevation groups for segregated borrowing pools
Referral system
Built-in referral tracking and fee distribution for protocol integrators
Borrow orders
Automated order execution system for conditional borrowing and lending operations
Deployments
Kamino Lending is deployed using the following program IDs:The staging deployment on mainnet uses the
staging feature flag during compilation, which sets a different program ID for testing purposes.Core concepts
Lending markets
A lending market is the top-level account that governs a collection of reserves. Each market has:- A market owner who controls configuration
- Emergency controls for risk management
- Global borrow limits and risk parameters
- Elevation group configurations
- Referral fee settings
src/state/lending_market.rs:29 for the complete data structure.
Reserves
A reserve represents a single asset pool within a lending market. Each reserve manages:- Liquidity: The underlying tokens available for borrowing
- Collateral: Interest-bearing cTokens minted to depositors
- Configuration: Interest rate curves, LTV ratios, fees, and limits
- Farms: Optional reward programs for depositors and borrowers
src/state/reserve.rs:61 for implementation details.
Obligations
An obligation represents a user’s position across the lending market. Each obligation tracks:- Up to 8 collateral deposits from different reserves
- Up to 5 borrows from different reserves
- Health metrics (LTV, borrow value, collateral value)
- Referrer attribution
- Elevation group membership
src/state/obligation.rs:28.
Architecture
The protocol is built using the Anchor framework (v0.29.0) and follows these design principles:- Zero-copy deserialization for large account structures
- Fixed-point math for precise interest calculations
- Oracle integration with Pyth and Scope for price feeds
- CPI-based interactions with farms and other protocols
The program is licensed under BUSL-1.1 and has been audited by OtterSec, Offside Labs, Certora, and Sec3.
Get started
Quickstart
Build your first integration with Kamino Lending
Program Reference
Explore all program instructions and account structures