Kamino 백서

Kamino

원문

bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 75쪽 중 72쪽

ending-market-owner` | Multisig ownership transfer is not strictly enforced by the program. It is the production prerequisite Kamino recommends before any external user touches the market. ## Where the work happens | Surface | Use it for | | - | - | | `kamino-manager` CLI | All market and reserve creation, configuration, and updates | | [Squads](https://squads.so) | Multisig proposal creation, signing, execution | | Solana Explorer | Verifying transactions, inspecting account state | | `manage.kamino.com` | Vault-side curator UI (for vaults sitting on top of your market) | | `app.kamino.com` | Public-facing UI for users (markets surface here only after listing in Kamino's resources file) | ## Continue <CardGroup> <Card title="Quickstart" icon="rocket" href="/docs/curators/markets/quickstart"> Stand up a working market on staging in \~10 minutes. </Card> <Card title="Create a market" icon="circle-plus" href="/docs/curators/markets/creating-a-market"> The single CLI command and what it does on-chain. </Card> </CardGroup> # Liquidations Source: https://kamino.com/docs/curators/markets/liquidations Configure liquidation thresholds, close factors, bonuses, and bad-debt handling When a borrower's health crosses `liquidationThresholdPct`, their position becomes liquidatable. klend exposes a set of curator-tunable parameters governing how aggressively liquidations happen and how much liquidators earn for clearing positions. This page covers the market-level and reserve-level fields that shape liquidator behavior. For threshold setting and IR curve choices, see [Risk parameters](/docs/curators/markets/risk-parameters). For the auto-deleverage (margin call) mechanism, see [Auto-deleverage](/docs/curators/markets/auto-deleverage). ## The liquidation flow at a glance When a borrower's LTV crosses `liquidationThresholdPct`, the position becomes liquidatable. Any wallet can call `liquidate-obligation-and-redeem-reserve-collateral` against it. In a single instruction, the liquidator repays up to `close_factor × debt`, seizes collateral of equal value plus the configured bonus, and the obligation is restored at or above the liquidation threshold. Liquidations are permissionless: the program holds the safety net, an open market of liquidators races to act on it. ## Close factor and value caps (market-level) Tunables on `LendingMarket`: ```jsonc theme={null} { "liquidation_max_debt_close_factor_pct": 25, "max_liquidatable_debt_market_value_at_once": "<u64>", "min_full_liquidation_value_threshold": "<u64>", "min_value_skip_liquidation_ltv_checks": "<u64>", "min_value_skip_liquidation_bf_checks": "<u64>" } ``` | Field | What it does | | - | - | | `liquidation_max_debt_close_factor_pct` | Maximum portion of debt a liquidator can repay in a single liquidation, in percent. Default `25` means a borrower's position can be liquidated by 25% per round. Lower values protect borrowers from one-shot wipeout; higher values let liquidators clear damaged positions faster | | `max_liquidatable_debt_market_value_at_once` | Hard ceiling on market-value liquidated per liquidation (in the market's quote currency, scaled). Throttles whale liquidations to prevent a single liquidator from clearing too much at once | | `min_full_liquidation_value_threshold` | Below this debt market value, the close-factor cap is bypassed and the entire position can be liquidated. Used to cleanly clear dust positions where partial liquidation is uneconomical | | `min_value_skip_liquidation_ltv_checks` | Below this market value, the program skips the LTV health check during liquidation. Allows a liquidator to clear a dust position regardless of whether it's underwater on standard checks | | `min_value_skip_liquidation_bf_checks` | Same idea for the borrow-factor check | ### Tuning the close factor Default close factor of 25% is sized so a borrower has multiple rounds to add collateral or repay before being fully wiped out. Each liquidation round drives the position back toward health; if the market continues moving against them, subsequent rounds re-engage. Reasons to deviate: | Setting | Use case | | - | - | | `15-25%` | Default. Borrower-protective | | `30-50%` | Faster cleanup of unhealthy positions; appropriate for high-volatility assets where multi-round liquidation creates more risk than it prevents | | `100%` | Single-round full liquidation. Use only for fixed-term reserves at maturity, or in incident response | ## Liquidation bonus (reserve-level) Liquidator incentive lives on each reserve: ```jsonc theme={null} { "minLiquidationBonusBps": 500, "maxLiquidationBonusBps": 1000, "badDebtLiquidationBonusBps": 99, "protocolLiquidationFeePct": 0 } ``` | Field | What it does | | - | - | | `minLiquidationBonusBps` | Floor on the bonus a liquidator earns. Applied when a position is just past Liquidation LTV | | `maxLiquidationBonusBps` | Cap on the bonus. The bonus scales with the LTV breach depth but cannot exceed this value | | `badDebtLiquidationBonusBps` | Near-insolvency bonus applied when LTV reaches 99% or higher. Set low (\~1%) because near-insolvent positions cannot sustain a large bonus without creating bad debt | | `protocolLiquidationFeePct` | Percentage (0–100) of liquidation proceeds that route to protocol fees; the liquidator receives the remainder | Reference values: | Asset class | min | max | bad debt | | - | - | - | - | | Stablecoins (in eMode) | 100 (1%) | 200 (2%) | 99 (≈1%) | | Major liquid (SOL, BTC, ETH) | 300–500 (3–5%) | 700–1000 (7–10%) | 99 | | Long-tail | 500–800 | 1500–2500 | 99 | The on-chain bonus is calculated in three steps (all values in bps, where 10,000 bps = 100%): 1. **Floor**: `bonus = max(minLiquidationBonusBps, currentLTV_bps - liquidationLTV_bps)`. The bonus is at least the min, and grows with the depth of the LTV breach. 2. **Cap**: `bonus = min(bonus, maxLiquidationBonusBps)`. The bonus cannot exceed the reserve's max. 3. **Solvency cap**: `bonus = min(bonus, 10000 - currentLTV_bps)`. Near 100% LTV, the bonus is reduced so that the liquidation does not push the position into bad debt. When LTV exceeds the market's insolvency-risk threshold (typically \~95%), the close factor increases to 100% to allow full liquidation. When LTV reaches 99% or higher, the bonus switches to `badDebtLiquidationBonusBps`, enabling full liquidation at a minimal bonus to maximize recovery before insolvency; the solvency cap above still applies. ## Pausing liquidations ```jsonc theme={null} { "price_triggered_liquidation_disabled": 0 } ``` | Value | Effect | | - | - | | `0` | Default. Liquidations triggered by price movement are allowed | | `1` | All price-triggered liquidations are blocked. Use during oracle incidents to prevent cascading liquidations on bad prices | This is a market-level kill switch. Combine with `borrow_disabled` for full incident-mode posture. See [Emergency controls](/docs/curators/markets/emergency-controls). ## Liquidations on mature fixed-term debt ```jsonc theme={null} { "mature_reserve_debt_liquidation_enabled": 1, "obligation_borrow_debt_term_liquidation_enabled": 1, "term_based_full_liquidation_duration_secs": 0 } ``` These flags govern liquidation of fixed-term positions. See [Fixed rate reserves](/docs/curators/markets/fixed-rate-reserves) for details. ## Bad debt and socialized loss If a position can't be liquidated cleanly — collateral falls below debt and even the bad-debt bonus doesn't cover the gap — the curator (or `emergency_council`) can call `socialize-loss` to spread the loss across the affected reserve's depositors. This is an irreversible, depositor-affecting action. Use it only when: * The position is genuinely unrecoverable * All standard liquidation paths have been exhausted * The affected reserve has a credible loss-recovery plan (insurance, treasury backfill, etc.) `socialize-loss` is callable by the `lending_market_owner` or, if configured, the `emergency_council`. See [Emergency controls](/docs/curators/markets/emergency-controls). ## Reference * [Reserve config reference](/docs/curators/markets/reserve-parameters) — every reserve-level liquidation field * [Market config reference](/docs/curators/markets/market-config-reference) — every market-level liquidation field * [Risk parameters](/docs/curators/markets/risk-parameters) — choosing LTV, threshold, IR curve * [Auto-deleverage](/docs/curators/markets/auto-deleverage) — margin-call grace window (advanced) * [Emergency controls](/docs/curators/markets/emergency-controls) — pausing the market, socialize-loss # Market Config Reference Source: https://kamino.com/docs/curators/markets/market-config-reference Every editable field on the LendingMarket account This is the canonical reference for `LendingMarket` — the on-chain struct that holds market-level settings. Field names below use snake\_case as they appear in the JSON returned by `download-lending-market-config` (which mirrors the on-chain Rust struct directly). For guidance on which fields to set, see [Market settings](/docs/curators/markets/market-settings) and the topic-specific guides linked below. ## Identity and naming | Field | Type | Description | | - | - | - | | `version` | u64 | Program version, fixed at init | | `bump_seed` | u64 | PDA bump seed. Set at init | | `name` | UTF-8 string (≤32 bytes) | Human-readable market name. Editable via `update-lending-market-name` or full config update | | `quote_currency` | UTF-8 string (≤32 bytes) | Reference unit prices are denominated in. Almost always `"USD"` | ## Ownership | Field | Type | Description | | - | - | - | | `lending_market_owner` | Pubkey | Active market owner. Authorized for all updates | | `lending_market_owner_cached` | Pubkey | Staging slot for ownership transfer. The current owner sets it; only that pubkey can finalize the swap via `update-lending-market-owner` | | `emergency_council` | Pubkey | Optional separate authority for emergency-only handlers (e.g., `socialize_loss`) | | `proposer_authority` | Pubkey | Authority that can propose certain config updates without holding full owner privileges | | `immutable` | u8 (bool) | If `1`, all owner-side updates are permanently disabled. **Irreversible.** | ## Feature flags | Field | Type | Description | | - | - | - | | `borrow_disabled` | u8 (bool) | If `1`, new borrows are rejected market-wide. Existing positions continue | | `emergency_mode` | u8 (bool) | If `1`, market-wide emergency mode | | `autodeleverage_enabled` | u8 (bool) | If `1`, enables auto-deleverage market-wide. Per-reserve flag must also be set | | `price_triggered_liquidation_disabled` | u8 (bool) | If `1`, blocks all price-triggered liquidations | | `mature_reserve_debt_liquidation_enabled` | u8 (bool) | If `1`, allows liquidations of mature fixed-term debt | | `obligation_borrow_debt_term_liquidation_enabled` | u8 (bool) | If `1`, enables term-based liquidation flow specifically | ## Withdrawal queue | Field | Type | Description | | - | - | - | | `withdraw_ticket_issuance_enabled` | u8 (bool) | If `1`, users can call `enqueue-to-withdraw` | | `withdraw_ticket_redemption_enabled` | u8 (bool) | If `1`, users can call `withdraw-queued-liquidity` | | `withdraw_ticket_cancellation_enabled` | u8 (bool) | If `1`, users can call `cancel-withdraw-ticket` | | `min_withdraw_queued_liquidity_value` | u64 | Minimum USD value (scaled fraction) for a single ticket. Below this, `enqueue-to-withdraw` reverts | See [Withdrawal queue](/docs/curators/markets/withdrawal-queue). ## Borrow orders | Field | Type | Description | | - | - | - | | `borrow_order_creation_enabled` | u8 (bool) | If `1`, users can call `set-borrow-order` | | `borrow_order_execution_enabled` | u8 (bool) | If `1`, lenders can call `fill-borrow-order` | | `min_borrow_order_fill_value` | u64 | Minimum USD value (scaled fraction) for a single fill | See [Borrow orders](/docs/curators/markets/borrow-orders). ## Obligation orders | Field | Type | Description | | - | - | - | | `obligation_order_creation_enabled` | u8 (bool) | If `1`, users can call `set-obligation-order` | | `obligation_order_execution_enabled` | u8 (bool) | If `1`, executors can call `fill-obligation-order` | See [Obligation orders](/docs/curators/markets/obligation-orders). ## Fixed-term rollover | Field | Type | Description | | - | - | - | | `fixed_term_rollover_window_duration_seconds` | u64 | Window before maturity allowing fixed→fixed rollover. `0` disables | | `open_term_rollover_window_duration_seconds` | u64 | Window before maturity allowing fixed→open rollover. `0` disables | | `obligation_borrow_migration_to_fixed_execution_enabled` | u8 (bool) | If `1`, allows open→fixed migration anytime | | `obligation_borrow_rollover_configuration_enabled` | u8 (bool) | If `1`, allows borrowers to pre-configure rollover behavior | | `min_partial_rollover_value` | u64 | Minimum USD value for a partial rollover. `0` requires full rollovers only | | `term_based_full_liquidation_duration_secs` | u64 | Time after maturity before full (close-factor-bypassing) liquidation is available. `0` disables | See [Fixed rate reserves](/docs/curators/markets/fixed-rate-reserves). ## Liquidation tunables | Field | Type | Description | | - | - | - | | `liquidation_max_debt_close_factor_pct` | u8 (0–100) | Maximum portion of debt liquidatable per round | | `max_liquidatable_debt_market_value_at_once` | u64 | Hard ceiling on market value liquidated per liquidation | | `min_full_liquidation_value_threshold` | u64 | Below this debt market value, the close-factor cap is bypassed | | `insolvency_risk_unhealthy_ltv_pct` | u8 (0–100) | LTV threshold for the insolvency-risk auto-deleverage path | | `min_value_skip_liquidation_ltv_checks` | u64 | Below this market value, skip LTV health checks during liquidation | | `min_value_skip_liquidation_bf_checks` | u64 | Below this market value, skip borrow-factor health checks | | `individual_autodeleverage_margin_call_period_secs` | u64 | Default grace period (seconds) between margin call and forced liquidation | See [Liquidations](/docs/curators/markets/liquidations) and [Auto-deleverage](/docs/curators/markets/auto-deleverage). ## Elevation groups ```jsonc theme={null} "elevation_groups": [ { "id": 1, "ltv_pct": 90, "liquidation_threshold_pct": 92, "max_liquidation_bonus_bps": 200, "allow_new_loans": 1, "max_reserves_as_collateral": 8, "debt_reserve": "<DEBT_RESERVE_PUBKEY>" } // ... up to 32 entries ] ``` | Field | Type | Description | | - | - | - | | `id` | u8 (1–32) | Group identifier. `0` is the "no group" sentinel | | `ltv_pct` | u8 (0–100) | Group LTV; replaces per-reserve LTV for in-group positions | | `liquidation_threshold_pct` | u8 (0–100) | Group liquidation threshold | | `max_liquidation_bonus_bps` | u16 | Cap on liquidator bonus inside the group | | `allow_new_loans` | u8 (bool) | `0` blocks new borrows in the group; existing positions persist | | `max_reserves_as_collateral` | u8 | Maximum distinct collateral reserves a group-position may hold | | `debt_reserve` | Pubkey | Single permitted debt asset for the group | See [Elevation groups](/docs/curators/markets/elevation-groups). ## Position thresholds | Field | Type | Description | | - | - | - | | `min_initial_deposit_amount` | u64 | Minimum amount required for a brand-new deposit to a reserve | | `min_net_value_in_obligation_sf` | u128 (scaled fraction) | Minimum USD value an obligation must hold after any operation | | `global_allowed_borrow_value` | u64 | Maximum total borrow value across all users on the market | ## Fees | Field | Type | Description | | - | - | - | | `referral_fee_bps` | u16 | Referral fee in basis points, shared with registered referrers | ## Oracle policy | Field | Type | Description | | - | - | - | | `price_refresh_trigger_to_max_age_pct` | u8 (0–100) | Percentage of `maxAgePriceSeconds` at which off-chain bots refresh proactively. `0` = on-demand only | ## Runtime / read-only These fields are program-managed and not user-editable: | Field | Type | Description | | - | - | - | | `version` | u64 | Program version | | `bump_seed` | u64 | PDA bump | | `reserved0`, `reserved1`, `padding1`, `padding2`, `elevation_group_padding` | varies | Struct alignment / future-use slots | ## Reading the live config ```bash theme={null} yarn kamino-manager download-lending-market-config \ --lending-market <MARKET_ADDRESS> ``` For market + every reserve in one call: ```bash theme={null} yarn kamino-manager download-lending-market-config-and-all-reserves-configs \ --lending-market <MARKET_ADDRESS> ``` ## Reference * [Market settings](/docs/curators/markets/market-settings) — the workflow for editing these fields * [Reserve config reference](/docs/curators/markets/reserve-parameters) — per-reserve fields * [CLI command index](/docs/curators/markets/cli-command-index) — all market-related commands # Read Market Data Source: https://kamino.com/docs/curators/markets/market-data Query market state, reserve metrics, historical data, and rewards via API and SDK Market state is readable through three channels: the REST API (best for dashboards and monitoring), the TypeScript SDK (best for integrations that compute derived values on-chain), and direct Solana RPC reads (for the lowest-level access). Most curators use the API for monitoring and the SDK for any integration that needs to react to market state. ## Channels at a glance | Channel | Best for | Endpoint / package | | - | - | - | | REST API | Dashboards, alerts, integrations that need historical data | `https://api.kamino.finance` | | TypeScript SDK | Apps computing live APYs, building transactions, reacting to state | `@kamino-finance/klend-sdk` | | Direct RPC | Lowest-latency access, minimal dependencies | Solana RPC + the program's account decoders | ## List all markets <CodeGroup> ```typescript SDK theme={null} // SDK loads individual markets by address; the API is the place to enumerate const response = await fetch('https://api.kamino.finance/v2/kamino-market'); const markets = await response.json(); ``` ```bash curl theme={null} curl https://api.kamino.finance/v2/kamino-market ``` </CodeGroup> Returns the full set of klend markets the API knows about, with addresses and basic metadata. ## Market-wide TVL and totals <CodeGroup> ```typescript SDK theme={null} import { createSolanaRpc, address } from '@solana/kit'; import { KaminoMarket, getMedianSlotDurationInMsFromLastEpochs } from '@kamino-finance/klend-sdk'; const rpc = createSolanaRpc('https://api.mainnet-beta.solana.com'); const slotDuration = await getMedianSlotDurationInMsFromLastEpochs(); const market = await KaminoMarket.load(rpc, address('<MARKET_ADDRESS>'), slotDuration); console.log({ depositTVL: market!.getTotalDepositTVL().toString(), borrowTVL: market!.getTotalBorrowTVL().toString(), }); ``` ```bash curl theme={null} curl https://api.kamino.finance/kamino-market/<MARKET_ADDRESS>/reserves/metrics ``` </CodeGroup> ## Per-reserve metrics <CodeGroup> ```typescript SDK theme={null} import { createSolanaRpc, address } from '@solana/kit'; import { KaminoMarket, getMedianSlotDurationInMsFromLastEpochs } from '@kamino-finance/klend-sdk'; const rpc = createSolanaRpc('https://api.mainnet-beta.solana.com'); const slotDuration = await getMedianSlotDurationInMsFromLastEpochs(); const market = await KaminoMarket.load(rpc, address('<MARKET_ADDRESS>'), slotDuration); const slot = await rpc.getSlot().send(); for (const reserve of market!.getReserves()) { console.log(`Reserve ${reserve.symbol}:`); console.log(` Deposit TVL: ${reserve.getDepositTvl().toFixed(2)}`); console.log(` Borrow TVL: ${reserve.getBorrowTvl().toFixed(2)}`); console.log(` Borrow APY: ${reserve.totalBorrowAPY(slot)}%`); console.log(` Supply APY: ${reserve.totalSupplyAPY(slot)}%`); console.log(` Utilization: ${reserve.calculateUtilizationRatio()}%`); } ``` ```typescript API theme={null}
프로젝트로 돌아가기