# Interest Rate Model

### Purpose

The Interest Rate Model is a fundamental component in decentralized finance (DeFi) protocols, particularly for lending and borrowing platforms. It is designed to dynamically adjust the interest rates based on the utilization of the asset pool, thereby ensuring an efficient allocation of capital and maintaining the stability of the protocol.

### How It Works

The Interest Rate Model uses a set of parameters defined in the `IRMParams` struct, which includes the base rate, kink rate, slope1, and slope2. These parameters allow the model to create a piecewise linear interest rate curve that adjusts based on the utilization ratio of the asset pool.

1. **Base Rate**: The minimum interest rate applied regardless of utilization.
2. **Kink Rate**: The utilization ratio threshold at which the interest rate curve changes its slope.
3. **Slope1**: The interest rate increases per unit of utilization before reaching the kink rate.
4. **Slope2**: The interest rate increases per unit of utilization after exceeding the kink rate.

By combining these parameters, the model calculates the appropriate interest rate to apply at any given utilization level, ensuring a balanced and efficient lending and borrowing environment.

The interest rate *R* follows the model:

$$
R=Base+U \cdot Slope1\ (U\<KinkRate)
$$

$$
R=Base+KinkRate \cdot Slope1+(U-KinkRate) \cdot Slope2\ (U≥KinkRate)
$$

where *U* is the utilization ratio of the lending pool.


---

# 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.predy.finance/predy-v6/dev/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.
