# Interest Rate Model

The interest rate model in Folks Finance is designed to dynamically balance supply and demand, ensuring competitive rates for both borrowers and depositors. This model is crucial for maintaining the stability and efficiency of the lending protocol.

**Key Concepts**

**Utilization Ratio (U):**The utilization ratio measures how much of the available pool of assets has been borrowed compared to the total deposited.

Formula: $U = \frac{\text{Total Borrowed}}{\text{Total Deposited}}$

**Variable and Stable Interest Rates:****Variable Interest Rate:**This rate fluctuates according to the utilization ratio.**Stable Interest Rate:**This rate is fixed at the time of borrowing but can be rebalanced to ensure the protocol’s stability.

**Interest Rate Calculations**

**Variable Borrow Interest Rate**$i_{vb}$**:**The variable interest rate depends on the utilization ratio and is calculated using the following formulas:

If $U_t < U_{Opt}$ : $i_{vb}(t) = R_{v0} + \frac{U_t}{U_{Opt}} \times R_{v1}$

If $U_t \geq U_{Opt}$ : $i_{vb}(t) = R_{v0} + R_{v1} + \frac{U_t - U_{Opt}}{1 - U_{Opt}} \times R_{v2}$

**Stable Borrow Interest Rate**$i_{sb}$**:**The stable interest rate is calculated similarly but includes additional parameters to handle the ratio of stable borrows:

If $U_t \leq U_{Opt}$ : $i_{sb}(t) = R_{v1} + R_{s0} \left(\frac{U_t}{U_{Opt}}\right) \times R_{s1}$

If $U_t > U_{Opt}$ : $i_{sb}(t) = (R_{v1} + R_{s0}) + R_{s1} + \frac{U_t - U_{Opt}}{1 - U_{Opt}} \times R_{s2}$

**Rebalancing Stable Rates:**To maintain protocol stability, stable rates may need rebalancing under specific conditions:

**Rebalancing Down:**When the current stable rate exceeds the pool’s current stable rate by a defined margin.**Rebalancing Up:**When the utilization ratio and deposit interest rate meet certain thresholds.

**Deposit Interest Rate**

**Calculation:**The deposit interest rate, earned by depositors, is derived from the interest paid by borrowers.

Formula: $i_d(t) = U_t \times i_b(t) \times (1 - RR)$

$i_b(t)$ is the overall borrow interest rate, which is a weighted average of variable and stable borrow rates.

( RR ) is the retention rate, representing the protocol's fee.

**Borrow Interest Amount**$O_{sb}$**:**The stable borrow interest amount is the sum of the stable borrowed amounts multiplied by their respective interest rates.

Formula: $O_{sb}(t) = \sum B_i \times i_{sb}(i)$

**Collateral and Borrow Limits**

**Collateral Factor (CF):**The collateral factor determines how much a user can borrow against their collateral, expressed as a percentage.

Example: USDC might have a CF of 80%, meaning $10 of USDC allows borrowing up to $8 in value.

**Borrow Amount Calculation:**The borrowable amount (BA) is calculated based on the user's collateral balance, the price of the collateral, and the collateral factor.

Formula: $BA(t) = \sum (A_{t_i} \times P_i \times CF_i)$

**Borrow Factor (BF):**The borrow factor adjusts the effective borrowed amount to account for asset volatility.

Example: ALGO might have a BF of 110%, meaning $10 borrowed is effectively $11 due to its volatility.

Last updated