Interest Model

Interest Rate Calculations

Definitions:

  • u is the capital utilization rate of a certain token

  • Compound Supply Rate: the real-time supply rate on the money market

  • Compound Borrow Rate: the real-time borrow rate on the money market

  • Compound Supply Rate Weight: the weight parameter of the Compound Supply Rate

  • Compound Borrow Rate Weight: the weight parameter of the Compound Borrow Rate

  • Compound Supply Ratio: the percentage of capital deployed on money market

Borrow Rate Model

BorrowAPR=CompoundSupplyRateWeights×CompoundSupplyRate+CompoundBorrowRateWeights×CompoundBorrowRate()+RateCurveConstant÷(1u)Borrow APR= Compound Supply Rate Weights \times Compound Supply Rate + Compound Borrow Rate Weights \times Compound Borrow Rate () + RateCurve Constant\div(1-u)

When uu >0.98,

RateCurveConstant÷(1u)=RateCurveConstant÷(10.98)=RateCurveConstant×50Rate Curve Constant\div(1-u) = Rate Curve Constant \div(1-0.98)= RateCurveConstant\times50

For assets that are not available on Compound or other money markets, Compound Supply Rate Weights=0, Compound Borrow Rate Weights=0,

In summary, there are two factors that decided the Borrow APR, the prevailing market rate that is available in the market and the capital utilization rate in the DeFiner protocol. Also, it's a non-linear model. The borrowing interest can adapt quickly if the utilization of the pool approaches a relatively high level.

Based on different parameter sets, we have three different strategies: Conservative Mode, Moderate Model, and Aggressive Model.

Parameters

Conservative Model

Moderate Model

Aggressive Model

Compound Supply

Rate Weight

0.1

0.3

0.9

Compound Borrow

Rate Weight

0.9

0.7

0.1

_RateCurveConstant

3

6

10

Below is how the borrow interest rate curve varies at different capital utilization levels based on three strategies.

Interest Model

Pseudocode:

Code:

Deposit Rate Model

DepositRate=CompoundSupplyRatio×CompoundSupplyRate+BorrowRate×uDeposit Rate= CompoundSupplyRatio\times CompoundSupplyRate +BorrowRate\times u

For assets that are not available on Compound or other money markets, Compound Supply Rate Weights=0, Compound Borrow Rate Weights=0

PseudoCode

Code:

Interest Accounting System

Definitions:

  • Deposit principle: the crypto assets that users deposited

  • Deposit interest: interest that the depositor earned

  • Deposit storage interest: the interest that depositor accrued

  • Deposit accrual interest: the deposit interest that has not accrued

  • Deposit Interest per block: interest that user earned for every block

  • BlocksPerYear: annual expected blocks of the blockchain

Formular:

DepositInterestRatePerBlock=BorrowAPR÷BlocksPerYearDeposit Interest Rate Per Block = BorrowAPR\div BlocksPerYear

DepositInterestPerBlock=(DepositPrinciple+DepositStorageInterest)×DepositInterestRatePerBlockDeposit Interest Per Block = (Deposit Principle+Deposit Storage Interest) \times Deposit Interest Rate Per Block

DepositInterest(blockt)=DepositInterest(blockt1))+DepositInterestPerBlockDepositInterest(block_t)=DepositInterest(block_t -_1))+DepositInterestPerBlock

BorrowAPR will be updated in the contract if there were any users who have deposits of the token performs a transaction

The interest earned between the last transaction block of the user and the latest transaction block will be accrued if the user performed a transaction and will be added to the Deposit Storage Interest.

Last updated