RateModel contract computes the borrow rate per second for a given pool utilization. It is called by every LendingPool during update_state() to determine how much interest has accrued since the last update.
Testnet address: CCJAUPCU6EIFQK6GTAAYLW3Y4YETJAAUPAGBPFGQ2OUJPSW3WWHUCL2Z
Functions
get_utilisation_ratio
Returns: Utilization in WAD (0 = 0%, 10¹⁸ = 100%)
Edge case: If both
liquidity_wad and borrows_wad are zero, returns 0 (empty pool, 0% utilization).
get_borrow_rate_per_sec
Returns: Borrow rate per ledger second in WAD. Multiply by
SECS_PER_YEAR to get the annual rate.
Rate Curve Behavior
The polynomial curve produces the following behavior:
The
util^32 and util^64 terms are nearly zero at low utilization but dominate at high utilization, creating a sharp increase in rates as the pool approaches full capacity. This is intentional — high rates at high utilization attract new deposits and incentivize repayments.
Exponentiation
Theutil^32 and util^64 terms are computed via rpow_wad(util, n), which uses repeated squaring (exponentiation by squaring) in WAD arithmetic:
Constants
Error Codes
Calling Pattern
LendingPools call the RateModel on everyupdate_state():
Related
- Math Reference — full formula derivation
- Lending Pools —
update_state()integration - Interest Rate Model — user-facing explanation of the curve shape

