Skip to main content
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 klend 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.

Initialize a reserve farm via SDK

The klend initFarmsForReserve 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.
For full args / accounts shapes, see the auto-generated source at 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

For a step-by-step claiming walkthrough, see Claim user 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-rewards instruction
  • 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