Comment on page

# InterestRateCalculator

## Interest Rate Model

Taker’s interest rate algorithm is calibrated to manage liquidity risk and optimise utilisation. The borrow interest rates are derived from the Utilisation Rate
$U$
.
$U$
is an indicator of the availability of capital within the pool. The interest rate model manages liquidity risk in the protocol through user incentives to support liquidity:
• When capital is available: low interest rates to encourage borrowing.
• When capital is scarce: high interest rates to encourage repayments of debt and additional supplying.

## Borrow Interest Rate

Liquidity risk materialises when utilisation is high, and this becomes more problematic as
$U$
gets closer to 100%. To tailor the model to this constraint, the interest rate curve is split in two parts around an optimal utilisation rate
$U_{optimal}$
. Before
$U_{optimal}$
the slope is small, after it begins rising sharply.
The interest rate
$R_t$
follows the model:
$if \hspace{1mm} U_{t} \leq U_{optimal}: \hspace{1cm} R_t = R_0 + \frac{U_t}{U_{optimal}} R_{slope1}$
$if \hspace{1mm} U > U_{optimal}: \hspace{1cm} R_t = R_0 + R_{slope1} + \frac{U_t-U_{optimal}}{1-U_{optimal}}R_{slope2}$
• $U$
, the utilisation ratio
• $U_{optimal}$
, the optimal utilisation ratio
• $R_t$
, the borrow interest Rate
• $R_0$
, the base borrow interest rate
• $R_{slope1}$
, the rate slope 1
• $R_{slope2}$
, the rate slope 2

## Supply Interest rate

The borrow interest rates paid are distributed as yield for Token holders who have supplied to the protocol, excluding a share of yields sent to the ecosystem reserve defined by the reserve factor. This interest rate is generated on the asset that is borrowed out then shared among all the liquidity providers. The supply APY is:
$S_t = U R_t(1-F)$
• $U$
, the utilisation ratio
• $R_t$
, the borrow interest rate
• $F$
, the reserve factor

## Model Parameters

bluechip
growth
Parameters
Value
Optimal Utilisation ratio
75%
Base Borrow Rate
10%
Rate Slope 1
8%
Rate Slope 2
100%
Reserve Factor
10%
Parameters
Value
Optimal Utilisation ratio
60%
Base Borrow Rate
15%
Rate Slope 1
15%
Rate Slope 2
150%
Reserve Factor
10%

## implement

Calculate deposit and borrowing rates using the total deposit amount, total borrowing amount, and reserve factor.
function calculateInterestRates(
uint256 totalLiquidity,
uint256 totalDebt,
uint256 reserveFactor
) external view override returns (uint256 depositRate, uint256 borrowRate)

#### call params

Name
Type
Description
totalLiquidity
uint256
the total liquidity in ETH.
taotalDebt
uint256
the total debt in ETH.
reserveFactor
uint256
reserve factor. It represents the proportion of interest earned on loans that is retained by the protocol as a reserve.

Name
Type
Description
depositRate
uint256
deposit rate
borrowRate
uint256
borrowing rate