bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 75쪽 중 69쪽
DEFAULT_RECENT_SLOT_DURATION_MS,
PROGRAM_ID,
MarketWithAddress,
} from '@kamino-finance/klend-sdk';
import { LendingMarket, Reserve } from '@kamino-finance/klend-sdk/dist/@codegen/klend/accounts';
import { address } from '@solana/kit';
// ... rpc setup, adminSigner ...
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 reserve = await Reserve.fetch(rpc, reserveAddress);
if (!reserve) throw new Error('Reserve not found');
const newConfig = { ...reserve.config };
newConfig.debtTermSeconds = 2_592_000n; // 30 days
newConfig.debtMaturityTimestamp = 0n; // 0 = per-borrow rolling term
newConfig.hostFixedInterestRateBps = 500; // 5%
newConfig.earlyRepayRemainingInterestPct = 50; // 50% penalty on remaining interest
const updateIxs = await kaminoManager.updateReserveIxs(
adminSigner,
marketWithAddress,
reserveAddress,
newConfig,
);
// submit each chunk in order
```
### Market-level rollover and liquidation flags
```typescript theme={null}
const newLendingMarket = { ...marketState };
newLendingMarket.fixedTermRolloverWindowDurationSeconds = 172_800n; // 48 hours
newLendingMarket.openTermRolloverWindowDurationSeconds = 0n;
newLendingMarket.obligationBorrowMigrationToFixedExecutionEnabled = 0;
newLendingMarket.obligationBorrowRolloverConfigurationEnabled = 1;
newLendingMarket.minPartialRolloverValue = 100_000n;
newLendingMarket.termBasedFullLiquidationDurationSecs = 86_400n; // 24h after maturity
newLendingMarket.matureReserveDebtLiquidationEnabled = 1;
newLendingMarket.obligationBorrowDebtTermLiquidationEnabled = 1;
const ixs = kaminoManager.updateLendingMarketIxs(adminSigner, marketWithAddress, newLendingMarket);
// submit each ix in order
```
### User-side rollover
The user-facing rollover instruction (`rolloverFixedTermBorrow`) is part of the on-chain klend program. The current public klend-sdk does not yet expose a dedicated TypeScript helper for it; until it ships, end-user apps integrate the rollover via the Kamino webapp or by building the instruction manually from the program IDL.
</Tab>
<Tab title="API">
<Info>
**Configuring fixed-rate parameters is not available via the REST API.** The fields live on `ReserveConfig` and `LendingMarket` and are set through the **SDK** or **Kamino CLI**.
</Info>
To configure fixed rate reserves and rollover behavior, use the **SDK** or **Kamino CLI** tabs.
For reading reserve maturity and debt term state, see [Read market data](/docs/curators/markets/market-data).
</Tab>
<Tab title="Kamino CLI">
## Configure a fixed rate reserve via CLI
Fixed-rate parameters are part of the standard reserve config JSON. Apply via `update-reserve-config`.
### Reserve config
```bash theme={null}
yarn kamino-manager download-reserve-config \
--reserve <RESERVE_ADDRESS> \
--output ./configs/<RESERVE>.json
```
Edit the JSON:
```jsonc theme={null}
{
"debt_term_seconds": 2592000,
"debt_maturity_timestamp": 0,
"host_fixed_interest_rate_bps": 500,
"early_repay_remaining_interest_pct": 50
}
```
Apply:
```bash theme={null}
yarn kamino-manager update-reserve-config \
--reserve <RESERVE_ADDRESS> \
--reserve-config-path ./configs/<RESERVE>.json \
--mode multisig \
--multisig <SQUADS_MULTISIG_PUBKEY>
```
### Market-level rollover and liquidation flags
```bash theme={null}
yarn kamino-manager download-lending-market-config \
--lending-market <MARKET_ADDRESS>
```
Edit `./configs/<MARKET>/market-<MARKET>.json`:
```jsonc theme={null}
{
"fixed_term_rollover_window_duration_seconds": 172800,
"open_term_rollover_window_duration_seconds": 0,
"obligation_borrow_migration_to_fixed_execution_enabled": 0,
"obligation_borrow_rollover_configuration_enabled": 1,
"min_partial_rollover_value": "100000",
"term_based_full_liquidation_duration_secs": 86400,
"mature_reserve_debt_liquidation_enabled": 1,
"obligation_borrow_debt_term_liquidation_enabled": 1
}
```
Apply via `update-lending-market-from-config`.
</Tab>
</Tabs>
## Open-term vs. fixed-rate
| Mode | Configuration |
| - | - |
| Open-term (default) | `debt_term_seconds = 0`, `debt_maturity_timestamp = 0`, `host_fixed_interest_rate_bps = 0` |
| Per-borrow rolling fixed term | `debt_term_seconds > 0`, `debt_maturity_timestamp = 0`. Every borrow matures `debt_term_seconds` after origination |
| Cohort fixed term | `debt_term_seconds > 0`, `debt_maturity_timestamp > 0`. All debt matures at the absolute timestamp |
Mixing fixed and open on the same reserve isn't supported. To run both, deploy two reserves for the same mint.
## How interest accrues
Total borrow rate = `borrow_rate_curve value at current utilization` + `host_fixed_interest_rate_bps`.
For a fixed-rate reserve, the `borrow_rate_curve` is configured as a **flat curve** (both endpoints set to the same rate), so the base rate is constant regardless of utilization. With `host_fixed_interest_rate_bps` at its default of `0`, the borrower pays exactly the flat curve rate. Set a non-zero `host_fixed_interest_rate_bps` only when you intentionally want a protocol-side spread on top of the lender-facing rate. See [Reserve Configuration](/docs/curators/markets/fixed-rates/reserve-configuration#what-pins-a-fixed-rate-reserve) for full details on configuring the flat curve.
## Maturity and what happens at it
When a borrow reaches its `debt_maturity_timestamp` (per-borrow or cohort):
| Outcome | Trigger |
| - | - |
| Repay in full | The borrower repays. The position closes |
| Roll over | The borrower rolls into a new fixed term — same reserve, different reserve, or migrates to open-term. Subject to market-level rollover flags |
| Liquidation as mature debt | If `mature_reserve_debt_liquidation_enabled = 1` and `obligation_borrow_debt_term_liquidation_enabled = 1`, mature debt becomes liquidatable |
| Forced full liquidation | After `term_based_full_liquidation_duration_secs` past maturity, the position is eligible for full (close-factor-bypassing) liquidation |
## The rollover modes
| Mode | Source | Destination | Constraints |
| - | - | - | - |
| Fixed → Fixed | A fixed rate reserve | Another (or same) fixed rate reserve | Allowed only inside `fixed_term_rollover_window_duration_seconds` of original maturity |
| Fixed → Open | A fixed rate reserve | An open-term reserve for the same mint | Allowed only inside `open_term_rollover_window_duration_seconds` of original maturity |
| Open → Fixed | An open-term reserve | A fixed rate reserve for the same mint | Allowed any time, gated by `obligation_borrow_migration_to_fixed_execution_enabled` |
Rollover preserves the principal but resets accrual: the new term starts fresh. Penalties from the prior term do not carry over.
## Early-repay penalty
The early-repay penalty applies during the **first term only**. Once a loan rolls over into a subsequent term, the borrower can repay at any time without penalty.
```
penalty = early_repay_remaining_interest_pct% × (interest that would have accrued from now to maturity)
```
| `early_repay_remaining_interest_pct` | Effect |
| - | - |
| `0` | No penalty. Borrowers can repay any time at no extra cost |
| `50` | 50% of remaining interest is owed at repay during the first term. Mild discouragement of early exit |
| `100` | Full first term's interest is locked in. The borrower owes the same regardless of repay time |
<Note>
If the borrower borrows additional principal on an already-active fixed-term position, the borrow timestamp is reset for the entire position. Effectively, the new top-up creates a new fixed term covering the combined balance. After a rollover, the penalty no longer applies.
</Note>
## Curator workflow: launching a fixed rate reserve
<Steps>
<Step title="Decide the (rate, term) matrix">
Pick the durations and rates you want to offer (e.g., 30/60/90 days at 4%/5%/6%). Each combination is a separate reserve.
</Step>
<Step title="Configure each reserve">
Set `debt_term_seconds`, `host_fixed_interest_rate_bps`, `early_repay_remaining_interest_pct`. Choose risk parameters (LTV, threshold, IR curve) appropriate for the duration.
</Step>
<Step title="Set market-level rollover windows">
Decide the rollover window — how far before maturity borrowers can roll. Common settings: 24–72 hours.
</Step>
<Step title="Enable mature-debt liquidation">
Set `mature_reserve_debt_liquidation_enabled = 1` and `obligation_borrow_debt_term_liquidation_enabled = 1`. Choose `term_based_full_liquidation_duration_secs` (typically 12–48 hours after maturity).
</Step>
<Step title="Test on staging">
Take a fixed-term borrow on staging, fast-forward time using a test scenario, exercise rollover, exercise repay, exercise mature-debt liquidation. Confirm the lifecycle works before mainnet.
</Step>
</Steps>
## Common errors
| Error | Cause |
| - | - |
| `BorrowRolloverExecutionDisabled` | Market-level rollover window is `0`. Set `fixed_term_rollover_window_duration_seconds` (or `open_term_rollover_window_duration_seconds`) to a positive value |
| `RolloverWindowNotOpen` | Borrower tried to roll outside the configured window before maturity |
| `MatureDebtLiquidationDisabled` | The position is mature but liquidation flags are off. Either enable the liquidation flags or repay |
| Sub-\$2 obligations stuck near maturity | A known edge case where dust positions interact poorly with the close-factor cap. Set `min_full_liquidation_value_threshold` low enough that mature dust positions can be fully liquidated |
## Reference
* [Reserve config reference](/docs/curators/markets/reserve-parameters) — fixed-rate reserve fields
* [Market config reference](/docs/curators/markets/market-config-reference) — rollover and term-liquidation flags
* [Borrow orders](/docs/curators/markets/borrow-orders) — peer-to-peer matching for fixed-rate liquidity
* [Liquidations](/docs/curators/markets/liquidations) — base liquidation mechanics
# Fixed Rates
Source: https://kamino.com/docs/curators/markets/fixed-rates/index
Creating and configuring fixed-rate reserves and the market-level settings that govern them
Fixed-rate reserves are a distinct reserve type within a Kamino lending market. Each fixed-rate reserve has a constant borrow rate and a fixed term (e.g. `USDC 5.5% 3M`) and exists alongside the floating-rate reserve for the same debt token. This section is for **market managers** — the curators who create reserves, set rates and terms, configure rollover and liquidation windows, and decide when fixed-rate features go live on a market.
For the allocator-side view (curators allocating capital into fixed-rate reserves), see [Fixed Rates (Vaults)](/docs/curators/vaults/fixed-rates).
## Read in this order
<CardGroup>
<Card title="Reserve Configuration" icon="sliders" href="/docs/curators/markets/fixed-rates/reserve-configuration">
Anatomy of a fixed-rate reserve, the four fields that pin rate and term, and how to create one via CLI.
</Card>
<Card title="Market Settings" icon="toggle-on" href="/docs/curators/markets/fixed-rates/market-settings">
Feature flags, rollover windows, the post-maturity liquidation throttle, and the recommended enablement sequence.
</Card>
<Card title="Lifecycle Operations" icon="timeline" href="/docs/curators/markets/fixed-rates/lifecycle-operations">
Updating an existing reserve, what can and cannot be changed, soft and hard sunsetting, and operational notes.
</Card>
<Card title="Risk Considerations" icon="shield" href="/docs/curators/markets/fixed-rates/risk">
Risks specific to running fixed-rate reserves and how to set parameters that mitigate them.
</Card>
</CardGroup>
# Lifecycle Operations
Source: https://kamino.com/docs/curators/markets/fixed-rates/lifecycle-operations
Updating an existing fixed-rate reserve, what can and cannot be changed, and sunsetting patterns
This page covers operating an existing fixed-rate reserve over its lifecycle: making parameter changes, what's mutable vs. immutable, and how to wind a reserve down when it's no longer needed.
## Updating an existing fixed-rate reserve
The general reserve-update flow at [Reserve Management](/docs/curators/markets/reserve-management) applies — download config, edit, preview, apply. A few constraints are specific to fixed-rate reserves:
| Change | Constraint |
| - | - |
| Lower the borrow rate | Allowed. Affects only new borrows; existing borrows keep their original rate. |
| Raise the borrow rate | Allowed. Same — affects only new borrows. |
| Shorten `debt_term_seconds` | **Blocked** if the reserve has any active borrows. Existing commitments are protected from retroactive shortening. |
| Lengthen `debt_term_seconds` | Allowed. Affects only new borrows. |
| Set `debt_maturity_timestamp` to the past | Blocked — must not be in the past at update time. |
| Move `debt_maturity_timestamp` later | Allowed. Reserve sunset extends. |
| Move `debt_maturity_timestamp` earlier | Allowed, but only to a future timestamp. Existing borrows past the new maturity become liquidatable when the maturity arrives. |
| Change `early_repay_remaining_interest_pct` | Allowed. Penalty for new borrows uses the new value. |
| Change `host_fixed_interest_rate_bps` | Allowed. Affects new borrow accrual. |
<Warning>
**Existing borrows keep the rate they were originated at.** If you change the rate or term on a reserve, current positions are unaffected — the change applies only to new borrows. This means a "USDC 5.5% 3M" reserve can simultaneously hold borrows at 5.5%, 5.0%, and 6.0% if the rate has been changed over time. Plan rate adjustments around expected position turnover.
</Warning>
## Sunsetting a fixed-rate reserve
Two patterns:
### Soft sunset — gradual wind-down
Set `debt_maturity_timestamp` to a future date. New borrows are blocked from that moment; existing borrows continue running. As they hit their per-borrow term ends, they roll, repay, or get protocol-liquidated. Once the reserve maturity hits and `mature_reserve_debt_liquidation_enabled` is on, any remaining debt becomes fully liquidatable with no throttle.
This is the normal path. It gives existing borrowers fair notice and lets the reserve unwind through normal maturity flow.
### Hard sunset — immediate stop
Set the reserve `status` to `Inactive` (1) — blocks all new operations. Existing debt remains and must wind down through normal repayment, rollover (if pointed elsewhere), or liquidation paths.
Use this only when the reserve must stop serving new borrowers immediately for risk reasons. Hard sunset is a circuit breaker — reach for it only when there's an active reason to halt activity, because it prevents borrowers from rolling within the reserve.
## Operational notes
* **Lock time.** Reserve config updates typically have a \~4-hour lock between commitment and on-chain effect. Plan parameter changes around testing windows.
* **Simulate first.** Always use `--mode inspect` before `--mode execute`. The simulation will surface invalid parameter combinations (e.g. attempts to shorten an active reserve's term) before they hit the chain.
* **Rate changes don't affect existing borrows.** This is a feature, not a bug — borrowers locked in a rate keep that rate. Adjust rates expecting the change to flow through over time as positions turn over.
* **Rollover-in-elevation-groups is unsupported.** Borrowers using elevation modes (eMode) on the market cannot have their fixed-term positions rolled over. If your market makes heavy use of eMode, expect those positions to require manual repayment at maturity.
* **The withdrawal queue requires the kvault program to be on a recent version.** Vaults integrating with your market need their kvault upgraded before they can interact with FR reserves correctly. Coordinate the rollout with vault curators.
* **Penalty interest accrues to protocol fees on the debt reserve**, not to the lender side. The early-repay penalty design protects lenders by discouraging premature exits but doesn't directly compensate them.
## What's next
<Card title="Risk Considerations" icon="shield" href="/docs/curators/markets/fixed-rates/risk">
Risks specific to running fixed-rate reserves and how to set parameters that mitigate them.
</Card>
# Market Settings
Source: https://kamino.com/docs/curators/markets/fixed-rates/market-settings
Feature flags, rollover windows, and the post-maturity liquidation throttle
Fixed-rate reserves require several **market-level** flags and parameters to be set before borrowers can place orders, fills can execute, withdrawal tickets can be issued, and rollovers can run. These live on the `LendingMarket` account and apply to every reserve in the market.
## Feature flags — turn capabilities on
Every flag defaults to **off** at market init. You enable each one explicitly when the market is ready for that capability.
| Flag | Effect when enabled |
| - | - |
| `borrow_order_creation_enabled` | Borrowers can place new borrow orders |
| `borrow_order_execution_enabled` | Permissionless fillers (and fill bots) can execute borrow orders |
| `withdraw_ticket_issuance_enabled` | Lenders and vaults can submit withdrawal tickets |
| `withdraw_ticket_redemption_enabled` | Queued tickets can be redeemed |
| `withdraw_ticket_cancellation_enabled` | Tickets can be cancelled before fill |
| `mature_reserve_debt_liquidation_enabled` | Liquidation triggers when a reserve passes its `debt_maturity_timestamp` |
| `obligation_borrow_debt_term_liquidation_enabled` | Liquidation triggers when a per-borrow term ends |
| `obligation_borrow_rollover_configuration_enabled` | Borrowers can opt into rollover on their existing borrows |
| `obligation_borrow_migration_to_fixed_execution_enabled` | Allows rollover from open-term to fixed-term |
### Recommended enablement sequence
When standing up fixed rates on a market:
1. Create the fixed-rate reserves (with terms and rates set, but features still off).
2. Enable `borrow_order_creation_enabled` and `borrow_order_execution_enabled` together.
3. Enable `withdraw_ticket_issuance_enabled` + `withdraw_ticket_redemption_enabled` + `withdraw_ticket_cancellation_enabled` together.
4. Enable `obligation_borrow_rollover_configuration_enabled` and the rollover window durations (below) before the first borrow's maturity arrives.
5. Enable `mature_reserve_debt_liquidation_enabled` and `obligation_borrow_debt_term_liquidation_enabled` last — these activate the protocol-enforced liquidation paths.
<Note>
Borrower interactions with a fixed-rate reserve fall back to standard floating behaviour if the matching feature flags aren't on. In practice, leaving rollover or liquidation flags off means borrowers must repay manually at maturity, and matured loans cannot be force-closed — keep this in mind during a phased rollout.
</Note>
## Rate-grid sizing parameters
| Parameter | Default | Meaning |
| - | - | - |
| `min_borrow_order_fill_value` | `2` | Minimum value of any partial fill, and the minimum stump value left after a partial fill. Anti-dust. Adjust upward to discourage thin orders. |
| `min_withdraw_queued_liquidity_value` | `2` | Minimum value for any withdrawal ticket and any partial-fill remainder. Same anti-dust function for the queue side. |
Both values are denominated in the market's quote currency scaling (effectively dollars for a USD-quote market). For most markets the default `2` is the right floor; only raise these if you're seeing dust attacks against the queue or the order book.
## Rollover windows
Rollover is a **pre-expiration** operation. The market defines two distinct windows, each governing one rollover mode:
| Parameter | Effect |
| - | - |
| `fixed_term_rollover_window_duration_seconds` | The window before a fixed-term borrow's mat프로젝트로 돌아가기