Interest Rate Model

The Interest Rate Model (IRM) is a critical component of the Gearbox Protocol that determines the cost of borrowing for Credit Accounts. In Gearbox V3, the protocol primarily utilizes a Two-Point Linear Interest Rate Model (IRM::LINEAR), designed to provide more stable rates and prevent sudden interest spikes during large liquidity fluctuations.

Pool and IRM Interaction

The PoolV3 contract acts as the primary consumer of the IRM. It does not store interest rate logic internally but instead queries the IRM whenever the pool's state changes.

Triggering Rate Updates

The pool triggers a rate recalculation via the IRM's calcBorrowRate function during any operation that affects the pool's utilization:

  • Lending Operations: deposit, mint, withdraw, and redeem.

  • Borrowing Operations: lendCreditAccount (when a user opens or increases debt) and repayCreditAccount (when debt is repaid or an account is liquidated).

Optimal Borrowing Check

A unique feature of the V3 IRM is the checkOptimalBorrowing flag.

When a Credit Manager attempts to borrow funds via lendCreditAccount, it passes true to this flag.

If the IRM is configured with isBorrowingMoreU2Forbidden = true, the call will revert if the new borrowing would push the pool's utilization beyond the U_2 (steep region) threshold. This ensures a liquidity buffer remains available for lenders to withdraw.

The Two-Point Linear Model

Unlike traditional models that use a single "kink," Gearbox V3 introduces an intermediate region to smooth the transition between low utilization and the "liquidity crunch" (steep) region.

Region
Range
Slope
Description

Obtuse

$0 \to U_1$

$R_{slope1}$

Low utilization; rates grow slowly.

Intermediate

$U_1 \to U_2$

$R_{slope2}$

Normal operation; provides a buffer before the steep curve.

Steep

$U_2 \to 100%$

$R_{slope3}$

Emergency region; rates increase aggressively to encourage repayment.

Fetching Core Parameters

Users and integrators can fetch the parameters influencing their interest rates through multiple layers.

1. Direct Contract Queries

You can call the IRM contract directly using the ILinearInterestRateModelV3 interface:

  • getModelParameters(): Returns the fixed configuration ($U_1, U_2, R_{base}, R_{slope1}, R_{slope2}, R_{slope3}$) in basis points (1/100th of a percent).

  • isBorrowingMoreU2Forbidden(): Returns whether the pool blocks borrowing above $U_2$.

  • calcBorrowRate(expected, available, check): Returns the current borrow rate in RAY ($10^{27}$) based on hypothetical liquidity levels.

2. High-Level Pool State

The PoolV3 provides the results of the IRM's calculation:

  • baseInterestRate(): Returns the current annual interest rate (in RAY) currently applied to all borrowers.

  • supplyRate(): Returns the annual rate earned by LPs, which is the baseInterestRate scaled by utilization, plus quota revenue.

Security and Risk Considerations

  • Utilization Manipulation: Because the rate is calculated based on availableLiquidity, large atomic withdrawals can spike the interest rate. The $U_1 \to U_2$ intermediate slope is specifically designed to mitigate the impact of these "jumps."

  • Immutable Parameters: In the standard deployment, IRM parameters are set at construction. However, the PoolV3 allows the CONFIGURATOR to swap the entire IRM contract via setInterestRateModel if market conditions shift significantly.

chevron-rightSourceshashtag

Last updated