Skip to main content

Documentation Index

Fetch the complete documentation index at: https://kamino.com/docs/llms.txt

Use this file to discover all available pages before exploring further.

Auto-deleverage is a softer alternative to immediate liquidation. When a position crosses an unhealthy threshold, the curator (or an off-chain bot) marks it for deleveraging: the borrower receives a grace period to self-deleverage, and only after the grace period elapses does liquidation become available — at a ramped bonus that grows over time. This is a niche feature most curators leave disabled. Standard Liquidations (immediate, threshold-triggered) are sufficient for most markets. Enable auto-deleverage when you specifically want a borrower-friendly margin-call window before liquidations open up.

When this is useful

Curator profileRecommendation
Public market with retail borrowersOptional. The grace period is borrower-friendly but adds operational complexity
Institutional / fixed-term marketSkip. Institutional borrowers prefer immediate, predictable liquidation behavior
Stable-only / eMode-heavy marketSkip. Correlated-asset liquidations are small and fast
Newly-listed volatile assetOptional. If enabled, use a shorter margin_call_period (e.g., 4 hours)

Market-level enablement

FieldWhat it does
autodeleverage_enabledMaster switch. 1 enables auto-deleverage on the market
individual_autodeleverage_margin_call_period_secsDefault grace period (seconds) between when a position is margin-called and when liquidation opens up. 86400 = 24 hours
insolvency_risk_unhealthy_ltv_pctLTV at which a position is considered to be in insolvency risk territory and may be marked for auto-deleverage. Default 100

Reserve-level config

FieldWhat it does
autodeleverage_enabledPer-reserve enablement. Both market and reserve must be 1 for auto-deleverage to apply to positions involving this reserve
deleveraging_margin_call_period_secsPer-reserve override for the margin-call period. 0 falls back to the market-level value
deleveraging_threshold_decrease_bps_per_dayThe position’s effective liquidation threshold drops by this many bps per day after margin call. Allows liquidators in over time
deleveraging_bonus_increase_bps_per_dayLiquidator bonus rises by this many bps per day after margin call. Compounds the incentive over time
min_deleveraging_bonus_bpsFloor on the deleveraging-specific bonus

Configure auto-deleverage via SDK

Auto-deleverage is enabled through standard market and reserve config updates.

Enable on the market

import {
  KaminoManager,
  DEFAULT_RECENT_SLOT_DURATION_MS,
  PROGRAM_ID,
  MarketWithAddress,
} from '@kamino-finance/klend-sdk';
import { LendingMarket } from '@kamino-finance/klend-sdk/dist/@codegen/klend/accounts';
import { address } from '@solana/kit';

const kaminoManager = new KaminoManager(rpc, DEFAULT_RECENT_SLOT_DURATION_MS, PROGRAM_ID);

const marketState = await LendingMarket.fetch(rpc, marketAddress);
if (!marketState) throw new Error('Market not found');
const marketWithAddress: MarketWithAddress = { address: marketAddress, state: marketState };

const newLendingMarket = { ...marketState };
newLendingMarket.autodeleverageEnabled = 1;
newLendingMarket.individualAutodeleverageMarginCallPeriodSecs = 86_400n;  // 24 hours
newLendingMarket.insolvencyRiskUnhealthyLtvPct = 100;

const ixs = kaminoManager.updateLendingMarketIxs(adminSigner, marketWithAddress, newLendingMarket);
// submit each ix in order

Enable on a reserve

import { Reserve } from '@kamino-finance/klend-sdk/dist/@codegen/klend/accounts';

const reserve = await Reserve.fetch(rpc, reserveAddress);
if (!reserve) throw new Error('Reserve not found');

const newConfig = { ...reserve.config };
newConfig.autodeleverageEnabled = 1;
newConfig.deleveragingMarginCallPeriodSecs = 0n;          // 0 = use market default
newConfig.deleveragingThresholdDecreaseBpsPerDay = 24n;    // 0.24% per day
newConfig.deleveragingBonusIncreaseBpsPerDay = 100n;       // 1% per day
newConfig.minDeleveragingBonusBps = 0;

const updateIxs = await kaminoManager.updateReserveIxs(
  adminSigner,
  marketWithAddress,
  reserveAddress,
  newConfig,
);
// submit each chunk in order

Marking a position for deleveraging

The markObligationForDeleveraging instruction is exposed via the SDK codegen. An off-chain monitor (or any wallet) can submit it once a position breaches insolvency_risk_unhealthy_ltv_pct.
import { markObligationForDeleveraging } 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 = markObligationForDeleveraging(args, accounts, PROGRAM_ID);
// Sign with the marker's wallet and submit
For full args / accounts shapes, see klend-sdk/src/@codegen/klend/instructions/markObligationForDeleveraging.ts.

The lifecycle

When a position’s LTV crosses insolvency_risk_unhealthy_ltv_pct, an off-chain monitor (anyone, typically a bot) calls mark-obligation-for-deleveraging. The position is now margin-called and the program records a timestamp. Standard liquidation is gated by the auto-deleverage state from this point forward. For deleveraging_margin_call_period_secs (or the market default if the reserve doesn’t override), the borrower has a grace window to repay or add collateral. Once grace ends, the deleveraging state begins to ramp: the effective liquidation threshold drops by deleveraging_threshold_decrease_bps_per_day and the liquidator bonus rises by deleveraging_bonus_increase_bps_per_day. Each elapsed day makes the position progressively easier to liquidate and progressively more profitable to clear, until a liquidator finally executes.

Tuning the ramp

Two reserve-level fields shape how aggressively the deleveraging state ramps after grace ends.
FieldHigher value means
deleveraging_threshold_decrease_bps_per_dayLiquidation threshold drops faster, opening up the position to liquidators sooner
deleveraging_bonus_increase_bps_per_dayLiquidator bonus grows faster, paying executors more for clearing the position
Reference settings:
Risk profilethreshold_decreasebonus_increasemargin_call_period
Borrower-friendly12 bps/day50 bps/day48 hours
Standard24 bps/day100 bps/day24 hours
Aggressive (volatile asset)50 bps/day200 bps/day4 hours

Off-chain infrastructure

Auto-deleverage is useful in proportion to the off-chain monitoring around it. A typical setup:
  • Position monitor: an off-chain service watches insolvency_risk_unhealthy_ltv_pct breaches and submits mark-obligation-for-deleveraging
  • Borrower notification: when a position is marked, notify the borrower (email / push / wallet message) so they can react inside the grace window
  • Liquidator coordination: standard liquidator infrastructure picks up margin-called positions once the grace window expires
For curator markets, you either rely on Kamino’s existing infrastructure (for whitelisted markets) or run your own.

Reference