# Interest Rate Model

## Configurable Rate Models

Nomial lets you define a rate model for each inventory pool. You can choose from existing model implemenations or make your own.

A Nomial pool defines it's interest rate model by referencing an instance of an inventory pool params contract (an interface defined in [IInventoryPoolParams01.sol](https://github.com/nomial-io/nomial-contracts-v1/blob/main/src/interfaces/IInventoryPoolParams01.sol)).

Nomial includes two implementations of interest rate models already. They are:

* [**OwnableParams01.sol**](https://github.com/nomial-io/nomial-contracts-v1/blob/main/src/OwnableParams01.sol)**:** allows an owner to set interest rates. For V1 deployments, the owner is [InventoryPoolDefaultAccessManager01.sol](https://github.com/nomial-io/nomial-contracts-v1/blob/main/src/owners/InventoryPoolDefaultAccessManager01.sol), which requires an admin address with majority validator sign-off to update interest rate. This allows interest rate updates to happen off-chain using a model dictated by validators.
* [**UtilizationBasedRateParams01.sol**](https://github.com/nomial-io/nomial-contracts-v1/blob/main/src/UtilizationBasedRateParams01.sol)**:** This models Aave V3’s two-slope utilization based rate behavior. See an example of a two-slope interest rate on the [Aave USDC pool page](https://app.aave.com/reserve-overview/?underlyingAsset=0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48\&marketName=proto_mainnet_v3).

## Borrow Rate vs Liquidity Provider Yield

A borrower must pay any accrued interest when paying back a pool.&#x20;

A Liquidity Provider (LP) supplies assets to a pool and earns their share of the accrued interest. When a pool is not fully utilized, a borrower pays a higher interest rate than the yield rate earned by LP's.

For example, if an LP supplies 100 USDC but a borrower borrows 50 USDC at 10% APR[^1], the LP earns 5% APY[^2] since only half of the supply is utilized.

The following sections provide more precise definitions of utilization, borrow rates, LP yield, and how they interact.

## Utilization

Let:

* **B** = total borrowed amount
* **L** = total liquidity *available* (i.e. supplied – borrowed)

Then the pool’s **utilization** is:

$$
U = \frac{B}{B + L}, \quad 0 \le U \le 1
$$

* If nobody’s borrowing, B=0 ⇒ U=0.
* If the pool is “dry” (all funds borrowed), L=0 ⇒ U=1.

## Borrow Rate

As an example, Nomial's [UtilizationBasedRateParams01](https://github.com/nomial-io/nomial-contracts-v1/blob/main/src/UtilizationBasedRateParams01.sol) contract defines a variable borrow rate that increases with utilization. Defined as r<sub>borrow</sub>(U), the formula is:

$$
r\_\mathrm{borrow}(U) = r\_\mathrm{base} + k \times U
$$

* r<sub>base</sub> = the "floor" rate (e.g., 2% APY). At U = 0, this is the borrow rate.
* k = the variable rate which is multiplied by utilization (U) to get the additional rate on top of the base rate. For example, if r<sub>base</sub> is 0.02, k = 0.18, and utilization is 1, then the borrow rate is 0.2 (i.e., 20%).

## LP Yield Rate

The resulting yield for the LP is described by the following formula:

$$
r\_{\mathrm{supply}}(U) = r\_{\mathrm{borrow}}(U) \times U
$$

Why? Because borrowers pay r<sub>borrow</sub> on what they borrow, which may only be a portion of the pool.

## Takeaways

* If utilization is less than 100%, LP's earn less percent yield than borrowers pay in interest rate percent.
* Use existing interest rate models or create your own by implementing the IInventoryPoolParams01 interface.

[^1]: Annual Percentage Rate, typically used for loans and credit cards, indicating the total annual cost of borrowing, including interest and fees.

[^2]: APY (Annual Percentage Yield) is used for savings accounts and investments, showing the annual return including the effects of compounding interest.
