Gloop
WebsiteTwitterDiscord
  • gLoop Litepaper v2
    • Introduction
    • The Two Tokens
    • Roadmap
  • PRODUCTS
    • GM Index
      • Providing/Removing Liquidity
      • Fees and Reflection
      • Deposit/Withdrawal Examples
    • GM Lend/Borrow
      • Lending USDC
      • Depositing Collateral Assets
      • Withdrawing Assets
      • Borrowing USDC
      • Repaying Debt
      • gLooping GM Assets
      • Position Management
        • Withdrawing Assets
        • Health Factor and Liquidations
      • Lending/Borrowing GMI (Coming Soon)
      • Frequently Asked Questions (FAQs)
    • GLOOP Staking (Coming Soon)
  • GM Points (COMING SOON)
  • Technical
    • Gloop Protocol Parameters
    • Gloop Parameters
    • Contracts
      • GM Lending and Looping
        • GM Lending Pool
        • GM Price Oracle
        • GM Vaults
        • GM Interest Rate Model
        • GM Incentives
      • GMI
        • GM Index
        • GMI USDC Zap
        • Token Banks
        • Token Oracles
        • Fees
  • FREQUENTLY ASKED QUESTIONS (FAQs)
    • GM Index (GMI)
    • GM Lending/Looping
    • GLOOP Staking (Coming Soon)
  • GLoop Ecosystem
    • Tokenomics
  • Security and Risk
    • Risks
    • Audits
  • Social
    • Socials
Powered by GitBook
On this page
  • getBorrowRate
  • utilizationRate
  • getCurrentBorrowAPY
  • getCurrentBorrowAPY
  1. Technical
  2. Contracts
  3. GM Lending and Looping

GM Interest Rate Model

PreviousGM VaultsNextGM Incentives

Last updated 7 days ago

The Lending Pool has an associated Interest Rate Model contract, which informs the interest rate attributed to the lending and borrowing of assets. On day one, USDC is the only asset that can be lent and borrowed. The initial Model establishes four key variables, which differ between assets. The values of these variables are subject to change in the future:

  • vertexUtilization = 70e16 (70%)

  • minRate = 10e16 / secondsInOneYear (10% per annum)

  • vertexRate = 25e16 / secondsInOneYear (25% per annum)

  • maxRate = 40e16 / secondsInOneYear (40% per annum)

Note: secondsInOneYear = 60 * 60 * 24 * (365 + (1/4)) // (accounting for leap years)

The Gloop Interest Rate Model follows a typical DeFi interest rate chart/curve (see image below), where utilization directly determines rates. Borrowers of USDC pay interest in USDC, based on the below borrow rate model. This interest paid turns into interest earned by the lenders of USDC. The Interest Rate steadily increases as the Utilization Rate increases. This model includes a utilization rate “kink” -- above this point, the interest rate increases more rapidly. Interest accrues every second.

The functions:

getBorrowRate

function getBorrowRate(uint256 cash, uint256 borrows) public view returns (uint256)

Calculates and returns the current borrow interest rate per second like so:

uint256 utilization = utilizationRate(cash, borrows);
        if (utilization == vertexUtilization) {
            return vertexRate;
        } else if (utilization < vertexUtilization) {
            return
                minRate + ((utilization * (vertexRate - minRate)) / 1e18)) / (vertexUtilization);
        } else {
            return
                vertexRate +
                (((utilization - vertexUtilization) * ((maxRate - vertexRate)) / 1e18) / ( 1e18 - vertexUtilization);
        }

Parameters:

Name
Type
Description

cash

uint256

The total amount of immediately available tokens (liquidity) for the asset

borrows

uint256

The total amount of outstanding borrows for the asset

Returns:

Name
Type
Description

unnamed

uint256

The borrow rate per block, as a percentage, scaled by 1e18

utilizationRate

function utilizationRate(uint256 cash, uint256 borrows) public pure returns (uint256)

Calculates and returns the current asset utilization rate. The function reverts if the utilization Rate is above 1e18:

utilizationRate = borrows / (cash + borrows)

Parameters:

Name
Type
Description

cash

uint256

The total amount of immediately available tokens (liquidity) for the asset

borrows

uint256

The total amount of outstanding borrows for the asset

Returns:

Name
Type
Description

utilization

uint256

The current utilization rate of the asset

getCurrentBorrowAPY

function getCurrentBorrowAPY(uint256 availableLiquidity, uint256 borrows) external view returns (uint256)

Calculates and returns the current borrow APY.

uint256 borrowRate = getBorrowRate(availableLiquidity, borrows);

uint256 interestAccumulator = (1e18 + borrowRate).rpow(secondsInOneYear, 1e18);

return interestAccumulator - 1e18;

Parameters:

Name
Type
Description

availableLiquidity

uint256

The total amount of available asset liquidity in the Lending Pool.

borrows

uint256

The total amount of outstanding borrows for the asset

Returns:

Name
Type
Description

unnamed

uint256

The asset's borrow APY

getCurrentBorrowAPY

function getCurrentBorrowAPY(uint256 availableLiquidity, uint256 borrows) external view returns (uint256)

Calculates the current borrow APY, where blockDelta is the number of Arbitrum blocks in one year = 31,536,000 seconds per year * 4 = 126,144,000 blocks per year:

Parameters:

Name
Type
Description

availableLiquidity

uint256

The total amount of immediately available liquidity for the asset

borrows

uint256

The total amount of outstanding borrows for the asset

Returns:

Name
Type
Description

unnamed

uint256

The current borrow APY

BorrowAPY=(1+interestRate/1e18)blockDelta−1e18Borrow APY = (1 + interestRate/1e18)^{blockDelta} - 1e18BorrowAPY=(1+interestRate/1e18)blockDelta−1e18
Image by via
Guantlet
Medium