Interest Rate Model

Novel interest rate model on the Algofi Lending V2.

How borrow interest rate is calculated (basic)

The Algofi protocol uses a non-linear interest rate model to ensure smooth market dynamics and sufficient liquidity at all times.
As the Borrow Utilization increases within a given market, the borrow rate increases in response to this demand.
After the Borrow Utilization surpasses a certain level called Optimal Utilization, the borrow rate begins to increase more quickly to encourage a return to the equilibrium level. As a result, markets tend to borrow less than or equal to their Optimal Utilization.
The Optimal Utilization discourages borrowing above a certain fraction of the market which keeps the protocol safe and liquid and ensures lenders have sufficient assets to redeem.

How borrow interest rate is calculated (advanced)

The minimum amount of interest a borrower pays in a given market is called the Base Interest Rate.
The interest rate borrowers pay also depends on a parameter called Optimal Utilization. The utilization of a market, Borrow Utilization, is the ratio of borrowed capital over supplied capital. For example, if a market has $100 USDC in supply and $50 is borrowed, then the Borrow Utilization = 50%.
If Borrow Utilization is less than Optimal Utilization, then the borrow interest increases as a function of Borrow Utilization like so:
Borrow Interest Rate = Base Interest Rate + (Borrow Utilization / Optimal Utilization) * Slope Under Utilized
The term Slope Under Utilized measures how much the Borrow Interest Rate increases as the Borrow Utilization increases. If Optimal Utilization is 80% and Slope Under Utilized is 4%, then a 10% increase in Borrow Utilization would result in 0.50% increase in the Borrow Interest Rate.
If Borrow Utilization is greater than Optimal Utilization the protocol adds an additional term that carries a higher penalty (Slope Over Utilized) to disincentivize Borrow Utilization over Optimal Utilization. In sum, the borrow interest rate sums the Base Interest Rate and
Borrow Interest Rate = Base Interest Rate + Borrow Utilization * Base Interest Slop + (Borrow Utilization - Optimal Utilization)**2 * Quadratic Amplification Factor

An example borrow rate curve

With the following parameters:
Base Interest Rate
Optimal Utilization
Base Interest Slope
Quadratic Amplification Factor
The borrow interest rate curve as a function of Borrow Utilization is:
The non-linear borrow rate "turns on" when the borrow utilization exceeds 50%. With the specified model parameters a maximum borrow interest rate of 60% can be achieved.

How supply interest rate is calculated

Suppliers earn their share of interest paid by borrowers. This is calculated mathematically as
Supply Interest Rate = Borrow Utilization * Borrow Interest Rate * (1 - Reserve Factor)
Here Reserve Factor is the fraction of interest that the protocol accrues.