When this is useful
Market-level enablement
Reserve-level config
- SDK
- API
- Kamino CLI
Configure auto-deleverage via SDK
Auto-deleverage is enabled through standard market and reserve config updates.Enable on the market
Enable on a reserve
Marking a position for deleveraging
ThemarkObligationForDeleveraging 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.klend-sdk/src/@codegen/klend/instructions/markObligationForDeleveraging.ts.The lifecycle
When a position’s LTV crossesinsolvency_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.
Reference settings:
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_pctbreaches and submitsmark-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
Reference
- Liquidations — base liquidation mechanics
- Reserve config reference —
autodeleverage_enabled,deleveraging_*fields - Market config reference —
autodeleverage_enabled,individual_autodeleverage_margin_call_period_secs,insolvency_risk_unhealthy_ltv_pct