# Interest rate model

There are a number of interest rates used to determine the interest paid on borrowings and interest received on deposits. There are also interest indexes which are used to track the accrued interest.

### Borrow interests rates

To differentiate the variable parameters from the stable ones, we are going to use the subscript $$s$$​ for stable and $$v$$​ for variable.\
The variable borrow interest rate $$i\_{vb\_t}$$ and stable borrow interest rates $$i\_{sb\_t}$$ are calculated based on the optimal utilisation ratio $$U\_{opt}$$ and optimal stable to total debt ratio $$0\_{ratio}$$​ set by the protocol.

If $$U\_t < U\_{Opt}$$

$$
i\_{vb\_{t}}=R\_{v0}+ \frac{U\_t}{U\_{Opt}}\*R\_{v1}
$$

If $$U\_t \geqslant	 U\_{opt}$$

$$
i\_{vb\_t}=R\_{v0}+R\_{v1}+\frac{U\_t-U\_{opt}}{1-U\_{opt}}\* R\_{v2}
$$

If $$U\_t \leqslant U\_{opt}$$

$$
i\_{sb\_t}=(R\_{v1}+R\_{s0})+\frac{U\_t}{U\_{Opt}}\*R\_{s1 }
$$

If $$U\_t > U\_{opt}$$

$$
i\_{sb\_t}=(R\_{v1}+R\_{s0})+R\_{s1}+ \frac{U\_t- U\_{Opt}}{1 -U\_{Opt}}\*R\_{s2}
$$

If $$Ratio > 0\_{ratio}$$, an excess is added to the stable borrow interest rate:

$$
i\_{sb\_t}+=R\_{s3}\*\frac{ratio-0\_{ratio}}{1-0\_{ratio}}
$$

The overall borrow interest rate $$i\_{b\_t}$$ factors in all variable and stable rate borrows and is calculated by taking the weighted average of the total variable and stable borrowed amounts and their respective interest rates.

$$
i\_{b\_t}=\frac{TotalVariableBorrowAmount*i\_{vb\_t}+\sum{B\_i*i\_{sb\_i}}}{TotalDebt}
$$

Where:

* $$i\_{vb\_t}$$is the variable borrow amount,
* $$B\_i$$ is the stable borrow amount,
* $$i\_{sb\_i}$$is the stable borrow rate,
* the subscript $$i$$ represents each stable borrow taken on the protocol.

### Deposit interests rates

The deposit interest rate $$i\_{d\_t}$$ is directly dependent on the overall borrow interest rate $$i\_{b\_t}$$. The borrow interest is divided between the depositors, excluding what is retained by the protocol.

$$
i\_{d\_t}= U\_t*i\_{b\_t}*(1-RR)
$$

Where:

* $$RR$$ is the retention rate i.e. the interest kept by the protocol as revenue.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.folks.finance/architecture/interest-rate-model.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
