Searchโ€ฆ
Interest accrual
How the protocol tracks the accrual of interest.
The borrow interest index
IbtI_{b_t}
and deposit interest index
IdtI_{d_t}
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 = 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)
Where:
  • โ€‹
    ฮฑdtฮฑ_{d_t}
    represents the interest rate
    idti_{d_t}
    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}
  • โ€‹
    โˆ†tโˆ†t
    represents the time interval between the latest psc (
    tโˆ’1t-1
    ) and the current time
    tt
    , in seconds.

Borrow interest index:

Ibt=Ibtโˆ’1โˆ—(1+ฮตโˆ—ฮฑbtโˆ’1โˆ—โˆ†t)I_{b_t}=I_{b_{t-1}} * (1+ ฮต * ฮฑ_{b_{t-1}} * โˆ†t)
Because of the limitation in the precision of on-chain calculation,
IbtI_{b_t}
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.
Copy link
On this page