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
Each farm can distribute multiple reward tokens simultaneously, with independent emission rates and start/end times.
- 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
1
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.
2
Generate the farm state keypair
Each farm is its own on-chain account. Generate a fresh keypair to use as the farm address.
3
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.
4
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.
5
Fund the farm
Transfer the reward tokens to the farm’s reward vault. Without funding, emissions accrue notionally but cannot be claimed.
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:
Most curators operate the farm via Squads multisig once it’s live. The KFarms admin authority should match the operational posture of the market itself.
When to use a debt farm
Debt farms (rewards for borrowers) are less common than collateral farms but valuable in specific scenarios:
Debt farms have the same mechanical structure as collateral farms (emission rates, reward mints, claim flow); only the underlying weight (borrow balances vs deposit balances) changes.
Reference
- KFarms repository — the program source
- farms-sdk — TypeScript helpers for farm administration
- Reserve reward APY tutorial
- Claim user rewards
- Read market data → Rewards