# AdaptiveCurve IRM

## Overview

In Morpho Blue, the interest borrowers pay is defined by an external interest rate model (IRM) that can be chosen at market creation among a governance-defined collection.

The AdaptiveCurveIRM is the first IRM that will be available for Morpho Blue markets. It fundamentally differs from the ones used in traditional lending pools for two main reasons:

- Unlike current lending pools’ IRMs which can be updated, the AdaptiveCurveIRM is immutable. It must therefore adapt autonomously to market conditions, such as changes in interest rates on other venues.
- In Morpho Blue, the supply is not used as collateral. There is no need to keep markets very liquid to allow liquidations at any time. Removing this systemic risk enables more aggressive target utilization of the capital and lower penalties for illiquidity, enabling more efficient markets.

The AdaptiveCurveIRM is designed to adjust utilization to the target utilization, which is set at 90%. There are two time horizons at play: In the short term, we don't want utilization to get too low, or too high and cause liquidity problems. In the medium and long term, we want the rate level to adapt to changing market dynamics.

To achieve this, the AdaptiveCurveIRM adjusts user incentives through the action of two different mechanisms:

- The Curve Mechanism
- The Adaptive Mechanism

## The Curve Mechanism

This mechanism is similar to the interest rate curve used in traditional lending pools.

The curve is characterized by two parameters:

- $r_{90\%}$, which is the target rate at utilization target $u_{target}=90\%$.
- $c=4$, a fixed parameter that determines the steepness of the curve above and below the utilization target.

At each interaction, utilization will change, resulting in a discontinuous change in the rate determined by the curve.

For example:

- if utilization is 90%, the rate is $r_{90\%}$
- if utilization is 100%, the rate is 4*$r_{90\%}$ (APR)

The aim of the Curve Mechanism is to manage short-term utilization changes.

## The Adaptive Mechanism

This mechanism continuously shifts the curve to adjust to market conditions over time.

Note that the rate follows the shift of the curve. This means that the rate is continuously evolving over time, even when there is no interaction.

The shifting of the curve is done by continuously changing the value of $r_{90\%}$ over time:

- When the utilization is above the target utilization, $r_{90\%}$ continuously shifts upwards.
- When the utilization is below the target utilization, $r_{90\%}$ continuously shifts downwards.

The speed at which $r_{90\%}$ moves is updated at each interaction: the farther we are from the target, the faster $r_{90\%}$, hence the curve, shifts.

For example, if the utilization remains at 100% for 5 days, $r_{90\%}$ will progressively double. This is the maximum speed at which $r_{90\%}$ can move.

The values of some constants are hardcoded into the code deployed on Ethereum, such as `TARGET_UTILIZATION`

, `INITIAL_RATE_AT_TARGET`

, etc.

## Formal description

We define:

- Utilzation ($u$)

$u(t)$ is the ratio of total borrow over total supply at time $t$.

The utilization target is constant: $u_{target}=0.9$

- Error ($e$):

$\forall t,$

$e(u)=\begin{cases} \frac{u(t)-u_{target}}{1-u_{target}}&\text{if } u(t)>u_{target} \\ \frac{u(t)-u_{target}}{u_{target}}&\text{if } u(t)\le u_{target} \end{cases}$It can be seen as the difference between the utilization and the target, divided by a normalization factor. The normalization is here to make the distance between $u_{target}$ and $u=1$ equals to the distance between $u_{target}$ and $u=0$.

- Curve:

with $k_d=4$

- History of interactions ($\mathcal{H})$:

Noting $t_i$ the time at which the $i^{th}$ interaction occurred,

$\forall t,$

$\mathcal{H}(t)=\{0\}+\{t_i\}_{t_i< t}$- Last interaction ($\text{last}$):

$\forall t,$

$\text{last(t)} = max(\mathcal{H}(t))$- Speed factor ($\text{speed})$:

- Rate at target ($r_T)$

$r_T(0)$ is set to an arbitrary value

Then,

$\forall t >0, r_T(t)=r_{T}(\text{last(t)})*\text{speed}(t)$At any time $t$, the borrow rate $r$ is given by the formula:

$r(t) = r_{T}(t)* \text{curve(u(t))}$