Skip to main content

Protocol Math

Guide

The math behind every position.

Five formulas drive everything visible on the dashboard. Knowing them lets you predict your borrowing power, your APY, and exactly when liquidation gets close — without leaving the math to the UI.

5Core formulas — exchange rate, utilization, rates, collateral, health
Per-blockBorrow rate accrues every block on-chain
≥ 1Health factor threshold for liquidation eligibility
Exchange rate

Every rToken (Rheofi's interest-bearing token) has an exchange rate that determines how many underlying tokens one rToken is worth. The exchange rate increases over time as interest accrues:

exchangeRate=totalCash+totalBorrowstotalReservestotalSupply of rTokens\text{exchangeRate} = \frac{\text{totalCash} + \text{totalBorrows} - \text{totalReserves}}{\text{totalSupply of rTokens}}

When you supply assets, you receive rTokens based on the current exchange rate. When you redeem, you receive more underlying tokens than you originally deposited — that delta is the interest you earned.

Utilization rate

Utilization rate measures how much of supplied liquidity is currently being borrowed:

U=totalBorrowstotalCash+totalBorrowstotalReservesU = \frac{\text{totalBorrows}}{\text{totalCash} + \text{totalBorrows} - \text{totalReserves}}

Higher utilization → greater borrowing demand → higher interest rates.

Interest rate calculations

Rheofi uses a jump rate model for most markets. The borrow rate is calculated per block:

  • When UUkinkU \leq U_{\text{kink}}: borrowRate=U×multiplier+baseRate\text{borrowRate} = U \times \text{multiplier} + \text{baseRate}
  • When U>UkinkU > U_{\text{kink}}: borrowRate=Ukink×multiplier+(UUkink)×jumpMultiplier+baseRate\text{borrowRate} = U_{\text{kink}} \times \text{multiplier} + (U - U_{\text{kink}}) \times \text{jumpMultiplier} + \text{baseRate}

The supply rate is derived from the borrow rate:

supplyRate=U×borrowRate×(1reserveFactor)\text{supplyRate} = U \times \text{borrowRate} \times (1 - \text{reserveFactor})
Collateral factor

Each asset has a collateral factor (between 0 and 1) that determines how much borrowing power it provides:

borrowingPower=(suppliedValuei×collateralFactori)\text{borrowingPower} = \sum (\text{suppliedValue}_i \times \text{collateralFactor}_i)

A collateral factor of 0.75 means: for every 100ofcollateralsupplied,youcanborrowupto100 of collateral supplied, you can borrow up to 75.

Health factor

The health factor determines whether a position is at risk of liquidation:

healthFactor=(collateralValuei×liquidationThresholdi)totalBorrowValue\text{healthFactor} = \frac{\sum (\text{collateralValue}_i \times \text{liquidationThreshold}_i)}{\text{totalBorrowValue}}

A health factor below 1 means the position is under-collateralized and eligible for liquidation. Maintain a value well above 1 to absorb price volatility without getting liquidated.