LogoLogo
V2 DocsV2 dApp
English 🇬🇧
English 🇬🇧
  • Welcome to Folks Finance official documentation!
  • Getting started
  • HOW TO
    • Deposit
    • Lock & Earn
    • fStaking
    • Withdraw
    • Borrow
    • Rebalance
    • Repay
    • Rewards aggregator
    • Algo Liquid Governance
      • Algo Liquid Governance - G3
  • User profile
    • Dashboard
    • History
    • Notifier
  • Developer
    • Contracts
    • Official SDKs
  • Protocol architecture
    • Overview
      • Liquidity pool dynamics
      • Interest rates model
      • Interest accrual
      • Deposit
      • Withdraw
      • Borrow
      • Slippage
      • Liquidation
      • Algo Liquid Governance
      • Incentive system
      • fStaking
      • Token types
  • Security
    • Audits
    • Bug bounty
  • Support
    • FAQ
    • Glossary
    • Fees
  • helpful guides
    • Creating a My Algo Wallet
    • Buying Algo using FIAT - CEXs guide
    • Buying Algo with FIAT - Pera wallet/MyAlgo wallet guide
    • Allowing pop-up
    • Folks Finance's Testnet
  • Community
    • What can I do with gALGO?
    • Aeneas liquidity program
    • Contact
    • Community treasury
    • FOLKS
  • Legal
    • Privacy Policy
    • Terms & Conditions
    • Disclaimer
Powered by GitBook
On this page

Was this helpful?

  1. Protocol architecture
  2. Overview

Interest accrual

How the protocol tracks the accrual of interest.

PreviousInterest rates modelNextDeposit

Last updated 2 years ago

Was this helpful?

The IbtI_{b_t}Ibt​​ and IdtI_{d_t}Idt​​ have been designed to simplify the calculation of interest-earning and interest-paying, even in multiple deposits or borrows, and avoid custom calculations for each user.

At the beginning t0=0t_0 = 0t0​=0 the indexes are both set at value 1.

The following formulas have been designed to calculate the growth of the interest indexes, which considers the interests accrued, throughout the period from protocol beginning to the latest protocol state change.

The protocol state change (psc) is the result of a change in the stability of the pool, which is due to protocol operations, i.e., deposit, redeem, borrow, repay borrow etc.

Deposit interest index:

Idt=Idt−1∗(1+αdt−1∗∆t)I_{d_t}=I_{d_{t-1}} * (1+ α_{d_{t-1}} * ∆t)Idt​​=Idt−1​​∗(1+αdt−1​​∗∆t)

Where:

  • αdtα_{d_t}αdt​​ represents the interest rate idti_{d_t}idt​​ converted from annual percentage rate (APR) to second percentage rate:

adt=idt365∗24∗60∗60a_{d_t}=\frac{i_{d_t}}{365*24*60*60}adt​​=365∗24∗60∗60idt​​​
  • ∆t∆t∆t represents the time interval between the latest psc (t−1t-1t−1) and the current time ttt, in seconds.

Borrow interest index:

Ibt=Ibt−1∗(1+ε∗αbt−1∗∆t)I_{b_t}=I_{b_{t-1}} * (1+ ε * α_{b_{t-1}} * ∆t)Ibt​​=Ibt−1​​∗(1+ε∗αbt−1​​∗∆t)

Because of the limitation in the precision of on-chain calculation, IbtI_{b_t}Ibt​​ uses a multiplier ε which is set as a number equal or slightly higher than 1. This ensures that the interest is not eroded by the limitation of on-chain math.

borrow interest index
deposit interest index