Each reserve in a market can run two independent farms — one for depositors (collateral side) and one for borrowers (debt side). Farms distribute reward emissions over time to position holders, denominated in any token. They’re the curator’s primary lever for attracting deposits or driving borrow demand. Farms are managed by the kfarms program. The klendDocumentation Index
Fetch the complete documentation index at: https://kamino.com/docs/llms.txt
Use this file to discover all available pages before exploring further.
Reserve account holds two Pubkey fields — farm_collateral and farm_debt — that link the reserve to its farm accounts on kfarms. Once linked, klend automatically updates the farm whenever a depositor or borrower’s balance changes.
Two farms per reserve
| Farm | Who earns | Use case |
|---|---|---|
| Collateral farm | Depositors / suppliers | Attract liquidity to a reserve. Most common |
| Debt farm | Borrowers | Subsidize borrowing. Used to bootstrap utilization or reward leveraged-yield strategies |
- SDK
- API
- Kamino CLI
Initialize a reserve farm via SDK
The klendinitFarmsForReserve instruction creates a kfarms FarmState account and links it to the reserve’s farm_collateral or farm_debt slot. The instruction is exposed in the SDK codegen.klend-sdk/src/@codegen/klend/instructions/initFarmsForReserve.ts.After the farm is created, configure emission rates and reward mints via the kfarms admin tooling — see the farms-sdk repository.Read farm state
Claim rewards
Initialization workflow
Decide collateral side, debt side, or both
Most markets initialize the collateral farm only. Initialize the debt farm only if you plan to incentivize borrowers.
Generate the farm state keypair
Each farm is its own on-chain account. Generate a fresh keypair to use as the farm address.
Call init-farms-for-reserve
The klend program initializes the farm via CPI to kfarms and stores the farm address on the reserve. After this, klend automatically refreshes the farm on every deposit / withdraw / borrow / repay touching the reserve.
Configure emissions
Use kfarms admin tooling to set reward tokens, emission rates, and start/end timestamps. The standard pattern is one reward mint per active campaign; multiple mints can run in parallel.
How emissions accrue
Once a farm is active and funded:- klend auto-refreshes the farm on every position-changing operation (deposit, withdraw, borrow, repay)
- Each user’s pending rewards accumulate proportionally to their share of the farm’s total weight (collateral side: their share of total deposits; debt side: their share of total borrows)
- Rewards are claimable at any time via the kfarms
claim-rewardsinstruction - Emission rates are tokens-per-unit-time set on the kfarms
FarmState
Operating a farm
Common adjustments after launch:| Action | How |
|---|---|
| Add a new reward token | Add the mint to the farm’s reward set via kfarms admin instructions |
| Change emission rate | Update the rate via kfarms; the change applies prospectively |
| End a campaign | Set the campaign’s end timestamp via kfarms; emissions stop accruing after that point |
| Top up reward funds | Transfer more tokens to the farm’s reward vault |
| Drain unused rewards | Use kfarms admin to withdraw remaining unclaimed funds (subject to kfarms admin rules) |
When to use a debt farm
Debt farms (rewards for borrowers) are less common than collateral farms but valuable in specific scenarios:| Scenario | Why a debt farm makes sense |
|---|---|
| Bootstrapping a new fixed-term reserve | Subsidize borrowers until natural demand develops |
| Yield-leverage strategies (looping) | Rewards on the debt side compound the strategy’s effective APY |
| Cross-incentive program | Reward both depositors (collateral) and borrowers (debt) on the same reserve to drive utilization toward a target |
Reference
- kfarms repository — the program source
- farms-sdk — TypeScript helpers for farm administration
- Reserve reward APY tutorial
- Claim user rewards
- Read market data → Rewards