Aquarius Documentation
  • Aquarius Loan Documentation
  • Getting Started
    • Networks
    • Protocol Math
      • aToken and Underlying Decimals
      • Interpreting Exchange Rates
      • Calculating Accrued Interest
      • Calculating the APY Using Rate Per Block
    • Gas Costs
  • ATokens
    • Mint
    • Redeem
    • Redeem Underlying
    • Borrow
    • Repay Borrow
    • Repay Borrow Behalf
    • Transfer
    • Liquidate Borrow
    • Key Events
    • Error Codes
    • Failure Info
    • Exchange Rate
    • Get Cash
    • Total Borrow
    • Borrow Balance
    • Borrow Rate
    • Total Supply
    • Underlying Balance
    • Supply Rate
    • Total Reserves
    • Reserve Factor
  • Comptroller
    • Enter Markets
    • Exit Market
    • Get Assets In
    • Collateral Factor
    • Get Account Liquidity
    • Close Factor
    • Liquidation Incentive
    • Key Events
    • Error Codes
    • Failure Info
    • ARS Distribution Speeds
    • Claim ARS
    • Market Metadata
  • Governance
    • Delegate
    • Delegate By Signature
    • Get Current Votes
    • Get Prior Votes
    • Key Events
    • Governor Bravo
    • Quorum Votes
    • Proposal Threshold
    • Proposal Max Operations
    • Voting Delay
    • Voting Period
    • Propose
    • Queue
    • Execute
    • Cancel
    • Get Actions
    • Get Receipt
    • State
    • Cast Vote
    • Cast Vote With Reason
    • Cast Vote By Signature
    • Timelock
    • Pause Guardian
  • Reward Vesting and Staking
    • Reward Vesting
    • ARS Staking
    • Explainer Video
  • LP Staking
    • LP Utility
    • LP Staking Options
    • Zapping LP
    • Maintaining Eligibility Status
    • Explainer Video
  • API
    • ATokenService
      • GET: /atoken
    • MarketHistoryService
      • GET: /market_history/graph
    • ProposalService
      • GET: /proposals
      • GET: /proposals/:id
      • GET: /proposals/statistics
    • VoterService
      • GET: /voters/accounts
      • GET: /voters/accounts/:address
      • GET: /voters/history/:address
      • GET: /voters/:proposalId
    • GovernanceService
      • GET: /governance/aquarius
      • GET: /governance/proposals
      • GET: /governance/proposal_vote_receipts
      • GET: /governance/accounts
    • Shared Data Types
  • Aquarius.js
    • Aquarius Constructor
    • API Methods
      • Account
      • aToken
      • Market History
      • Governance
    • aToken Methods
      • Supply
      • Redeem
      • Borrow
      • Repay Borrow
    • ARS Methods
      • To Checksum Address
      • Get ARS Balance
      • Get ARS Accrued
      • Claim ARS
      • Delegate
      • Delegate By Sig
      • Create Delegate Signature
    • Comptroller Methods
      • Enter Markets
      • Exit Market
    • Ethereum Methods
      • Read
      • Trx
      • Get Balance
    • Governance Methods
      • Cast Vote
      • Cast Vote By Sig
      • Create Vote Signature
    • Price Feed Methods
      • Get Price
    • Utility Methods
      • Get Address
      • Get ABI
      • Get Network Name With Chain ID
  • Security
    • Formal Verification
    • Bug Bounty Program
  • Terms of Service
Powered by GitBook
On this page
  1. Getting Started
  2. Protocol Math

Calculating Accrued Interest

PreviousInterpreting Exchange RatesNextCalculating the APY Using Rate Per Block

Last updated 1 year ago

Interest rates for each market update on any block in which the ratio of borrowed assets to supplied assets in the market has changed. The amount interest rates are changed depends on the interest rate model smart contract implemented for the market, and the amount of change in the ratio of borrowed assets to supplied assets in the market.

See the interest rate data visualization notebook on to visualize which interest rate model is currently applied to each market.

Historical interest rates can be retrieved from the .

Interest accrues to all suppliers and borrowers in a market when any Ethereum address interacts with the market’s aToken contract, calling one of these functions: mint, redeem, borrow, or repay. Successful execution of one of these functions triggers the accrueInterest method, which causes interest to be added to the underlying balance of every supplier and borrower in the market. Interest accrues for the current block, as well as each prior block in which the accrueInterest method was not triggered (no user interacted with the aToken contract). Interest aquariuss only during blocks in which the aToken contract has one of the aforementioned methods invoked.

Here is an example of supply interest accrual:

Alice supplies 1 ETH to the Aquarius protocol. At the time of supply, the supplyRatePerBlock is 37893605 Wei, or 0.000000000037893605 ETH per block. No one interacts with the cEther contract for 3 Ethereum blocks. On the subsequent 4th block, Bob borrows some ETH. Alice’s underlying balance is now 1.000000000151574420 ETH (which is 37893605 Wei times 4 blocks, plus the original 1 ETH). Alice’s underlying ETH balance in subsequent blocks will have interest accrued based on the new value of 1.000000000151574420 ETH instead of the initial 1 ETH. Note that the supplyRatePerBlock value may change at any time.

Observable
MarketHistoryService API