Skip to main content
The 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 the pool’s current utilization ratio in WAD format.
Parameters: 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 the per-second borrow rate in WAD format. Formula:
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

The util^32 and util^64 terms are computed via rpow_wad(util, n), which uses repeated squaring (exponentiation by squaring) in WAD arithmetic:
This preserves WAD scale at each step.

Constants


Error Codes


Calling Pattern

LendingPools call the RateModel on every update_state():