VarlaInterestRateStrategy
ℹ Source
contracts/VarlaInterestRateStrategy.sol — inherits AccessManaged How It Works
The interest rate follows a standard DeFi kinked curve:
text
Rate
│ ╱ slope2 (steep)
│ ╱
│ ╱
│ • ← optimal utilization (kink)
│ ╱ slope1 (gentle)
│ ╱
│ ╱
└──────────────── Utilization When utilization is below the optimal ratio, the rate equals base + slope1 × (utilization / optimal). Above optimal, the additional utilization is penalized by slope2.
Rate Parameters
solidity
struct InterestRateParams {
uint16 optimalUsageRatio; // In BPS (e.g. 8000 = 80%)
uint16 baseVariableBorrowRate; // In BPS (e.g. 100 = 1%)
uint16 variableRateSlope1; // In BPS — gentle slope
uint16 variableRateSlope2; // In BPS — steep slope
} | Parameter | Constraint |
|---|---|
optimalUsageRatio | Must be between 100 (1%) and 9900 (99%) |
base + slope1 + slope2 | Must not exceed MAX_BORROW_RATE (100,000 BPS = 1000%) |
Key Function
solidity
function calculateInterestRate(
uint256 totalLiquidity,
uint256 totalBorrowed
) external view returns (uint256 borrowRate) Called by VarlaPool during interest accrual. Returns the annualized borrow rate in WAD (18 decimals).
Admin Functions
| Function | Description |
|---|---|
setPool(address) | One-time setter — links this strategy to its pool. Reverts if already set. |
setRateParams(InterestRateParams) | Update rate parameters. Access restricted. |
View Getters
| Function | Returns |
|---|---|
getOptimalUsageRatio() | Current optimal utilization in BPS |
getBaseVariableBorrowRate() | Base rate in BPS |
getVariableRateSlope1() | Slope 1 in BPS |
getVariableRateSlope2() | Slope 2 in BPS |
getMaxVariableBorrowRate() | base + slope1 + slope2 in BPS |
getRateParams() | Full InterestRateParams struct |
Events
solidity
event RateParamsUpdated(
uint16 optimalUsageRatio,
uint16 baseVariableBorrowRate,
uint16 variableRateSlope1,
uint16 variableRateSlope2
);
event PoolSet(address pool); ✦ Key Takeaways
- Standard kinked rate model — gentle slope below optimal, steep slope above
- All parameters in basis points (BPS), rate output in WAD
- Pool address is set once and cannot be changed
- Rate params updatable by risk manager role via AccessManaged