-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Overview
Currently LendingVault.interest_rate_bps is a hardcoded static value (30 bps). This should be replaced with a utilization-based rate curve that adjusts dynamically based on supply/demand, following the industry standard model used by Aave, Compound, and Kamino.
Background
The core metric is utilization rate:
utilization = total_borrowed / total_supplied
As more SOL is borrowed from the vault, rates increase to:
- Incentivize LPs to supply more liquidity
- Discourage excessive borrowing above optimal utilization
Implementation: Kink Rate Model
Replace interest_rate_bps: u16 with curve parameters in LendingVault:
pub base_rate_bps: u16, // min borrow rate at 0% utilization (e.g. 200 = 2%)
pub slope1_bps: u16, // rate added linearly up to kink (e.g. 800 = 8%)
pub slope2_bps: u16, // rate added steeply above kink (e.g. 9000 = 90%)
pub kink_bps: u16, // optimal utilization target (e.g. 8000 = 80%)
pub reserve_factor_bps: u16, // protocol cut of interest (e.g. 1000 = 10%)Add two methods to LendingVault:
borrow_rate_bps() -> u16— what borrowers paysupply_rate_bps() -> u16— what LPs earn (derived from borrow rate)
Curve behaviour:
utilization: 0% 80% (kink) 100%
borrow rate: 2% ──────────── 10% ────────────── 100%
└──── slope1 ──┘└───── slope2 ──────┘
Supply APY:
supply_rate = borrow_rate × utilization × (1 - reserve_factor)
Changes Required
state/lending_vault.rs— replaceinterest_rate_bpswith curve params, addborrow_rate_bps()andsupply_rate_bps()methodsinstructions/initialize_lending_vault.rs— accept curve params as instruction args instead of hardcoded rateinstructions/supply.rs— uselending_vault.supply_rate_bps()for interest accrualinstructions/withdraw.rs— sameinstructions/update_vault_params.rs— new authority-only instruction to update curve params post-deploytests/lending_vault.ts— add tests verifying rate changes at different utilization levels
Default Parameters
| Param | Value | Meaning |
|---|---|---|
base_rate_bps |
200 | 2% minimum borrow rate |
slope1_bps |
800 | +8% up to kink = 10% at 80% utilization |
slope2_bps |
9000 | +90% above kink = up to 100% at 100% utilization |
kink_bps |
8000 | 80% optimal utilization target |
reserve_factor_bps |
1000 | 10% protocol cut from interest earned |
Acceptance Criteria
-
borrow_rate_bps()returnsbase_rateat 0% utilization -
borrow_rate_bps()returnsbase_rate + slope1at exactlykinkutilization -
borrow_rate_bps()returns near max rate at 100% utilization -
supply_rate_bps()is always lower thanborrow_rate_bps()(due to reserve factor) - Authority can update curve params via
update_vault_params - All existing lending vault tests still pass
- New tests cover rate calculation at 0%, 50%, 80% (kink), and 100% utilization
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request