bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 75쪽 중 68쪽
rest of the market continues normally.
Use when: a specific reserve's oracle is misbehaving and you want to halt that reserve while replacing the oracle config.
### Reserve-level emergency mode
`emergency_mode: 1` on the reserve. Stricter than `blockPriceUsage`. Halts the reserve at the program level — operations targeting the reserve revert.
### Pause price-triggered liquidations
`price_triggered_liquidation_disabled: 1` on the market. Blocks every liquidation triggered by oracle price movement, including obligation orders that fire on price conditions. Standard liquidations driven by manual triggers (e.g., obligation orders with `Always` condition) still work.
Use when: an oracle is misbehaving market-wide and you want to prevent cascading liquidations on bad prices.
### Market-wide emergency mode
`emergency_mode: 1` on the market. The strongest reversible switch. Restricts most operations market-wide. Use only when the market needs to be brought to a near-complete stop.
Pair with `emergency_council` to delegate emergency-only powers to a fast multisig.
### Permanent freeze: immutable
`immutable: 1` on the market. Once flipped to `1`, the program rejects every owner-initiated config change. Existing positions continue with current parameters; no flag, threshold, cap, or oracle can be modified by anyone.
Use when:
* The market is being archived
* You're providing a trust-minimization commitment to depositors
* A migration to a new market is complete and you want the old market frozen
<Warning>
`immutable: 1` is irreversible. The program has no path to undo it. Confirm twice on a multisig review before signing.
</Warning>
## Socialize loss (last-resort)
If a position becomes truly unrecoverable — debt exceeds collateral, even the bad-debt liquidation bonus can't make liquidators whole — the curator can call `socialize-loss` to spread the loss across the affected reserve's depositors.
The mechanics:
1. The `lending_market_owner` (or `emergency_council` if configured) calls `socialize-loss` for the affected obligation.
2. The unrecoverable debt is written off.
3. Each depositor's claim on the reserve is reduced proportionally to their share of total deposits.
This is depositor-affecting and irreversible. Use only when:
* The position is genuinely unrecoverable
* Standard liquidation paths (including bad-debt liquidation) have been exhausted
* The reserve has a credible plan for handling the impact (curator-funded backfill, treasury, etc.)
## Configuring the emergency council
`emergency_council: <MULTISIG_PUBKEY>` on the market. Setting an `emergency_council` distinct from the main `lending_market_owner` lets you keep ordinary operations on a slow timelocked multisig while keeping incident response on a fast one.
Recommended setup:
| Authority | Multisig | Timelock | Powers |
| - | - | - | - |
| `lending_market_owner` | 3-of-5 multisig | 12 hours | Standard config updates, parameter changes |
| `emergency_council` | 2-of-3 multisig | 0 or 1 hour | Emergency mode, socialize-loss, fast pauses |
## Operational playbook
A rough decision tree for incident response:
| Situation | First action |
| - | - |
| Suspicious borrow activity | `borrow_disabled: 1` |
| One reserve's oracle looks wrong | That reserve's `blockPriceUsage: 1` |
| Multiple oracles misbehaving | `price_triggered_liquidation_disabled: 1` |
| Smart-contract level issue or partner-asset issue | `emergency_mode: 1` (market-wide) |
| Position underwater past liquidator economics | First: confirm liquidators have tried. Then: `socialize-loss` |
| Winding down a deprecated market | Eventually: `immutable: 1` |
Always fix the root cause before re-enabling. Pausing then immediately unpausing without addressing the issue achieves nothing.
## Reference
* [Market config reference](/docs/curators/markets/market-config-reference) — every emergency-related field
* [Reserve config reference](/docs/curators/markets/reserve-parameters) — `emergency_mode`, `blockPriceUsage`
* [Updating reserves](/docs/curators/markets/reserve-management) — the standard reserve update flow
* [Liquidations](/docs/curators/markets/liquidations) — bad debt and liquidator economics
# Emergency Council
Source: https://kamino.com/docs/curators/markets/emergency-council
The market-level authority for one-way, risk-reducing emergency actions, and exactly what it can and cannot do
The emergency council is a market-level authority stored on `LendingMarket.emergency_council`. It is intentionally limited to one-way, risk-reducing actions: the council can enable circuit breakers or set limits to zero, but it cannot restore normal operation, relax risk parameters, or change ownership and admin settings.
The market owner sets or rotates the council via `UpdateLendingMarketMode::UpdateEmergencyCouncil`. Pairing a fast emergency-council multisig with a slower, timelocked `lending_market_owner` keeps incident response quick while routine changes stay deliberate.
<Note>
Every council power is one-way. The council can only tighten (enable a breaker, zero a limit), never loosen. Only the `lending_market_owner` can reverse an emergency action.
</Note>
## Market-level actions
When signing `update_lending_market`, the emergency council can:
* Enable global emergency mode: `UpdateEmergencyMode = true`.
* Disable all new borrowing at the market level: `UpdateBorrowingDisabled = true`.
* Disable price-triggered liquidations: `UpdatePriceTriggeredLiquidationDisabled = true`.
It cannot set any of those flags back to `false`. Only the lending market owner can do that.
Global emergency mode is broad: most user-facing instructions are guarded by `emergency_mode_disabled`, including refreshes, deposits, withdrawals, borrows, repays, liquidations, flash loans, obligation orders, rollover and fill flows, and queued-withdrawal flows.
## Reserve-level actions
When signing `update_reserve_config`, the emergency council can only make the following restrictive config changes:
| Mode | Allowed value | Effect |
| - | - | - |
| `UpdateBorrowLimit` | `0` | Blocks new borrows from the reserve. |
| `UpdateDepositLimit` | `0` | Blocks new deposits into the reserve. |
| `UpdateLoanToValuePct` | `0` | Disables using the reserve as collateral for borrowing. |
| `UpdateBlockPriceUsage` | `1` | Marks the reserve price as unusable. |
| `UpdateReserveEmergencyMode` | `1` | Enables reserve emergency mode. |
| `UpdateDisableUsageAsCollateralOutsideEmode` | `1` | Disables use as collateral outside e-mode. |
For all other reserve config modes, or for the opposite values above, the emergency council is not authorized. The lending market owner remains the fallback authority for normal reserve config changes, while global-admin-only reserve modes still require the global admin.
Reserve emergency mode blocks most user operations involving that reserve. Refreshing a reserve in emergency mode does not update the oracle price and clears the saved price status instead. The reserve-level flag can still be enabled even if the market has been made immutable; disabling it requires the normal owner path.
## Not emergency council powers
The emergency council cannot:
* Change the lending market owner, emergency council, global admin, proposer authority, or permissioning authority.
* Disable global or reserve emergency mode after it was enabled.
* Raise borrow, deposit, or LTV limits, or re-enable price usage or collateral usage.
* Execute owner-only operations such as `socialize_loss`.
* Bypass global-admin-only reserve config ownership for protocol fees, take rates, flash-loan fees, fixed-interest host fees, order execution fees, or cToken blocking.
<Warning>
Enabling emergency mode or zeroing a limit has effects the council cannot undo. Confirm the action on a multisig review before signing; reversing it requires the `lending_market_owner`.
</Warning>
## Code references
* Market allowlist: `programs/klend/src/handlers/handler_update_lending_market.rs`
* Reserve allowlist: `programs/klend/src/lending_market/lending_operations.rs`
* Reserve emergency mode behavior: `programs/klend/src/state/reserve.rs`, `programs/klend/src/lending_market/lending_checks.rs`
* Global emergency mode guard: `programs/klend/src/utils/constraints.rs`, `programs/klend/src/lib.rs`
## Reference
* [Emergency controls](/docs/curators/markets/emergency-controls) — the operational switches and incident playbook
* [Market config reference](/docs/curators/markets/market-config-reference) — every market-level field
* [Reserve parameters](/docs/curators/markets/reserve-parameters) — reserve config fields
# Farms & Rewards
Source: https://kamino.com/docs/curators/markets/farms-and-rewards
Initialize collateral and debt farms on reserves, fund emissions, claim rewards
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](https://github.com/Kamino-Finance/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
```rust theme={null}
struct Reserve {
// ...
farm_collateral: Pubkey, // Pubkey::default() if no farm
farm_debt: Pubkey,
// ...
}
```
| 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 |
Each farm can distribute multiple reward tokens simultaneously, with independent emission rates and start/end times.
<Tabs>
<Tab title="SDK">
## 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.
```typescript theme={null}
import { initFarmsForReserve } from '@kamino-finance/klend-sdk/dist/@codegen/klend/instructions';
import { PROGRAM_ID } from '@kamino-finance/klend-sdk';
// Build args and accounts per the instruction's signature, then:
const ix = initFarmsForReserve(
{ mode: 0 }, // 0 = collateral, 1 = debt
accounts,
PROGRAM_ID,
);
// Sign with the curator's wallet and submit
```
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](https://github.com/Kamino-Finance/farms-sdk) repository.
### Read farm state
```typescript theme={null}
import { createSolanaRpc, address } from '@solana/kit';
import { KaminoMarket, getMedianSlotDurationInMsFromLastEpochs } from '@kamino-finance/klend-sdk';
import { FarmState } from '@kamino-finance/farms-sdk';
const rpc = createSolanaRpc('https://api.mainnet-beta.solana.com');
const slotDuration = await getMedianSlotDurationInMsFromLastEpochs();
const market = await KaminoMarket.load(rpc, address('<MARKET_ADDRESS>'), slotDuration);
for (const reserve of market!.getReserves()) {
const collFarm = reserve.getCollateralFarmAddress();
const debtFarm = reserve.getDebtFarmAddress();
if (collFarm) {
const farmState = await FarmState.fetch(rpc, collFarm);
console.log(`${reserve.symbol} collateral farm:`, farmState);
}
if (debtFarm) {
const farmState = await FarmState.fetch(rpc, debtFarm);
console.log(`${reserve.symbol} debt farm:`, farmState);
}
}
```
### Claim rewards
```typescript theme={null}
import { Farms } from '@kamino-finance/farms-sdk';
const farms = new Farms(rpc);
const claimIxs = await farms.claimForUserForFarmAllRewardsIx(
payer, // TransactionSigner
address('<USER_WALLET>'),
address('<FARM_ADDRESS>'),
false, // isDelegated
);
// Bundle into a transaction and submit
```
For a step-by-step claiming walkthrough, see [Claim user rewards](/docs/build/tutorials/borrow/claim-user-rewards).
</Tab>
<Tab title="API">
The Kamino API exposes farm and reward data as REST endpoints:
| Endpoint | Returns |
| - | - |
| `GET /klend/rewards` | All active reward programs across reserves on klend |
| `GET /klend/users/{pubkey}/rewards` | Per-user claimable rewards across reserves |
```bash theme={null}
curl https://api.kamino.finance/klend/rewards
curl https://api.kamino.finance/klend/users/<USER_WALLET>/rewards
```
<Info>
**Farm initialization, funding, and emission configuration is not available via the REST API.** Farms are initialized through the **SDK** or via klend's `initFarmsForReserve` instruction. Emissions are configured through the KFarms admin tooling.
</Info>
For computing farm APYs from on-chain state, see [Calculate reserve reward APY](/docs/build/tutorials/borrow/calculate-reserve-reward-apy).
</Tab>
<Tab title="Kamino CLI">
## Read farm state via CLI
The kamino-manager CLI exposes a read-side query for farm APYs:
```bash theme={null}
yarn kamino-manager get-reserve-farms-apy \
--reserve <RESERVE_ADDRESS>
```
For farm initialization, funding, and emission configuration, use the KFarms admin tooling — see the [farms-sdk](https://github.com/Kamino-Finance/farms-sdk) repository for the canonical command set.
</Tab>
</Tabs>
## Initialization workflow
<Steps>
<Step title="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.
</Step>
<Step title="Generate the farm state keypair">
Each farm is its own on-chain account. Generate a fresh keypair to use as the farm address.
</Step>
<Step title="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.
</Step>
<Step title="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.
</Step>
<Step title="Fund the farm">
Transfer the reward tokens to the farm's reward vault. Without funding, emissions accrue notionally but cannot be claimed.
</Step>
</Steps>
## 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:
| 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) |
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:
| 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 |
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](https://github.com/Kamino-Finance/kfarms) — the program source
* [farms-sdk](https://github.com/Kamino-Finance/farms-sdk) — TypeScript helpers for farm administration
* [Reserve reward APY tutorial](/docs/build/tutorials/borrow/calculate-reserve-reward-apy)
* [Claim user rewards](/docs/build/tutorials/borrow/claim-user-rewards)
* [Read market data → Rewards](/docs/curators/markets/market-data#rewards-data)
# Fixed Rate Reserves
Source: https://kamino.com/docs/curators/markets/fixed-rate-reserves
Reserves with a host fixed rate, debt maturity, rollover windows, and early-repay penalties
A fixed rate reserve locks borrowers into a predictable rate for a defined duration. The reserve's `borrow_rate_curve` is configured as a flat curve at the target rate, so borrowers pay the same rate regardless of utilization. At maturity, the borrower must repay, roll over, or face liquidation.
Each (rate, term) combination lives on its own reserve. A market that offers, say, 4%/30-day, 5%/60-day, and 6%/90-day USDC borrows would have three USDC fixed rate reserves — one per (rate, term) pair — each with its own debt maturity.
## Reserve-level configuration
The fixed-rate mechanics are controlled by these `ReserveConfig` fields:
| Field | What it does |
| - | - |
| `debt_term_seconds` | Duration of the fixed term, in seconds. `0` = open-term reserve. Setting any positive value makes every borrow on this reserve a fixed-term borrow |
| `debt_maturity_timestamp` | Optional absolute Unix timestamp when *all* debt on this reserve matures simultaneously. `0` = each borrow rolls forward `debt_term_seconds` from origination |
| `host_fixed_interest_rate_bps` | Optional additional spread (bps) layered on top of the flat borrow rate curve, accruing 100% to the protocol. Default `0` |
| `early_repay_remaining_interest_pct` | Penalty for repaying during the first term, expressed as percent (0–100) of the *remaining* interest to maturity. After rollover, no penalty applies |
## Market-level rollover settings
| Field | What it does |
| - | - |
| `fixed_term_rollover_window_duration_seconds` | Window before maturity allowing fixed→fixed rollover. `0` disables |
| `open_term_rollover_window_duration_seconds` | Window before maturity allowing fixed→open rollover. `0` disables |
| `obligation_borrow_migration_to_fixed_execution_enabled` | If `1`, allows open→fixed migration anytime |
| `obligation_borrow_rollover_configuration_enabled` | If `1`, allows borrowers to pre-configure rollover behavior |
| `min_partial_rollover_value` | Minimum size for a partial rollover. `0` requires full rollovers only |
| `term_based_full_liquidation_duration_secs` | Time after maturity before full (close-factor-bypassing) liquidation is available |
| `mature_reserve_debt_liquidation_enabled` | Master switch for mature-debt liquidation flow |
| `obligation_borrow_debt_term_liquidation_enabled` | Per-feature switch for the term-based liquidation path |
<Tabs>
<Tab title="SDK">
## Configure a fixed rate reserve via SDK
Reserve-level fields are set via `kaminoManager.updateReserveIxs` (or at creation via `addAssetToMarketIxs`). Market-level rollover and liquidation flags are set via `updateLendingMarketIxs`.
### Reserve config
```typescript theme={null}
import {
KaminoManager,프로젝트로 돌아가기