Rhea Finance
  • Introduction
  • RHEA Finance White Paper
  • Genesis
  • Tokenomics
  • Governance
  • Community
  • Team
  • Getting Started
    • Setup Wallet
    • Using the Rainbow Bridge
    • Using the Platform
    • Buy REF Token
    • Staying Safe
  • RHEA Finance
    • Overview
      • Auto Router
      • Multi-chain Router
      • Pooling
      • Staking
      • RHEA V2 & DCL Pools
      • Aggregator Bridge
    • Guides
      • Lending & Borrowing
        • Audits & Risks
        • Supplying
        • Borrowing
        • APY
        • Health Factor
        • LP as Collateral
        • How Lending & Borrowing works
          • Health Factor
          • Interest Rate Model
          • Liquidations
          • Oracle
        • Step by Step Guide
      • Trade
        • Swap
        • Limit Orders
      • Liquidity Management
        • Classic Pools
        • Stable & Rated Pools
        • RHEA v2 Pools
      • Farming
      • Staking
      • Aggregator Bridge
      • RHEA Point System
  • SECURITY
    • Contracts
    • Guardians
    • Oracles
    • Audits
    • Bug Bounty
  • DEVELOPERS
    • CLI Trading
    • CLI Farming
    • RHEA SDK
  • SUPPORT
    • FAQ
    • Help
Powered by GitBook
On this page

Was this helpful?

  1. RHEA Finance
  2. Guides
  3. Lending & Borrowing
  4. How Lending & Borrowing works

Interest Rate Model

PreviousHealth FactorNextLiquidations

Last updated 27 days ago

Was this helpful?

The platform uses a compounding interest model similar to .

Each asset defines interest rate configuration with the following values:

  • target_utilization - the utilization rate targeted by the model, e.g. 80% borrowed comparing to the total supplied.

  • target_utilization_r - the constant to use as a base for computing compounding APR at the target utilization.

  • max_utilization_r - the constant to use as a base for computing compounding APR at the 100% utilization.

  • reserve_ratio - the percentage of the acquired interest reserved for the platform.

Based on these values we define 3 points of utilization: 0%, target utilization and 100%. For each of these points we have the r constant: 1.0, target_utilization_r and max_utilization_r respectively.

To compute the APR, we can use the following formula:

1 + APR = r ** MS_PER_YEAR, where MS_PER_YEAR is the number of milliseconds in a year equal to 31536000000.

Based on the current supplied, reserved and borrowed balances, the current utilization is defined using the following formula:

utilization = borrowed / (supplied + reserved)

To compute the current APR, we need to find the current r constant based on the linear interpolation between utilization points:

  • if utilization <= target_utilization, r = target_utilization_r * (utilization / target_utilization)

  • if utilization > target_utilization, r = target_utilization_r + (max_utilization_r - target_utilization_r) * (utilization - target_utilization) / (1 - target_utilization)

To calculate the amount of interest acquired for the duration of t milliseconds, we can use the following formula:

interest = (r ** t) * borrowed

The interest are distributed to reserved and supplied, based on reserve_ratio, so the new values are: reserved_interest = interest * reserve_ratio new_reserved = reserved + reserved_interest new_supplied = supplied + (interest - reserved_interest) new_borrowed = borrowed + interest

Aave