Stable borrowing

The variable borrow rate has a per transaction resolution: it changes with each user interaction (borrow, deposit, withdraw, repayments or liquidations). This can result in significant volatility in the borrowing rate.

To address this, and offer users a less volatile and more stable rate, stable borrowing was introduced. From tradfi markets, it is clear that there exists a segment of users that are willing to pay a premium for predictability; which is why fixed-income debt instruments, swap rate agreements and the like exist.

The stable rate provides predictability for the borrower; however, it comes at a premium, as the interest rates are higher than the variable rate.

Not all assets offer stable rates: assets that are most exposed to liquidity risk do not offer stable rates.

Can I borrow using stable and variable rate at the same time for one asset?

Stable rate

Users who engage in stable borrowing will enjoy a fixed interest rate for the duration of their loan, with one caveat - see rebalancing condition below.

However, the stable rate for new loans varies on each interaction. Opening stable debt positions at different periods would likely result in different stable interest rates; due to differing liquidity state of the reserve pool. Ignoring rebalancing, these rates remain fixed for the lifetime of the position.

The stable rate for new loans varies on each interaction.

Example:

  • Alice and Bob take on stable loans at different points in time

  • They enjoy stable rates of 4% and 6% respectively

  • Different rates consequence of the differing liquidity state of the asset at that time.

  • For the duration of their loans, their respective rates remains fixed.

  • However, in extreme liquidity conditions, their stable rates can be rebalanced to a higher rate; hence the nomenclature of stable rate, not fixed.

Stable rate model

  • premium is a markup decided by Aave

The model adds an additional premium in the event that the stableToTotalDebt exceeds the optimal ratio of stableToTotalDebt as in the system.

  • additionalPremium is similarly set like baseStableBorrowRate

Visual aid

To better understand the model and how it is implemented, we dissect calculateInterestRates on DefaultReserveInterestRateStrategy

In the picture above, the portions of calculateInterestRates that are pertinent to stable rate calculation have been extracted and illustrated. Feel free to compare with the code excerpt below.

The following variables have their values set by Aave:

  • _baseStableRateOffset

  • slope1 and slope2 for both variable and stable instances

  • OPTIMAL_USAGE_RATIO

  • MAX_EXCESS_USAGE_RATIO

  • OPTIMAL_STABLE_TO_TOTAL_DEBT_RATIO

  • MAX_EXCESS_STABLE_TO_TOTAL_DEBT_RATIO

For a walkthrough on their values, please see the section on DefaultReserveInterestRateStrategy.

Caveat: Rebalancing

If the protocol is in dire need of liquidity (e.g. prolonged liquidity shortage) and the supply APY is not sufficient to attract liquidity providers, to plug the liquidity shortage, some stable rate loans might undergo a procedure called rebalancing.

If a user’s loan was taken at a stable rate that is deemed too low for the current market conditions, the protocol might decide to move the stable rate to the current (higher) one. This is known as rebalancing.

Rebalancing addresses the issue of stable borrowers enjoying an extremely discounted rate, in times of high utilization or low liquidity.

Rebalancing allows the protocol to provide a more competitive supply rate for depositors. Eventually, as the market situation normalizes, the user will be rebalanced back down to a more appropriate stable rate.

Rebalancing condition

  • Treat existing stable debt as variable

  • Given totalVariableDebt = (variable debt + stable debt), what would be the liquidity rate?

Maximum size per stable borrow

Users will be able to borrow only a portion of the total available liquidity.

Aave enacts a max stable borrow limit for each stable borrow transaction. In each borrow transaction, if the borrow is a stable one, a check is conducted like so:

validateBorrow()
vars.availableLiquidity = IERC20(params.asset).balanceOf(params.reserveCache.aTokenAddress);

//calculate the max available loan size in stable rate mode as a percentage of the
//available liquidity
uint256 maxLoanSizeStable = vars.availableLiquidity.percentMul(params.maxStableLoanPercent);

require(params.amount <= maxLoanSizeStable, Errors.AMOUNT_BIGGER_THAN_MAX_LOAN_SIZE_STABLE);
}

This ensures that the borrow amount set by the user is less than equal to maxLoanSizeStable, where maxLoanSizeStable is 25% of the deposited borrowable asset.

maxStableLoanPercent = maxStableRateBorrowSizePercent (0.25e4)
// deposits are held on their respective aToken contract
availableLiquidity = total amt of borrowable asset deposited

maxLoanSizeStable = availableLiquidity * maxStableLoanPercent
		  = availableLiquidity * 0.25e4

If user wished to borrow DAI

  • DAI deposited into aDAI contract = 1000 DAI

  • availableLiquidity = 1000 DAI

  • maxLoanSizeStable = 250 DAI

Implementation

We've talked about how the stable rate is determined on the whole, as the a reflection of the system state. We've also mentioned that user's lock-in the stable rate upon borrowing, less rebalancing conditions.

Question you might have, is how does interest accrue for users, along with other implementation questions.

Global stable rate

Each asset in Aave has its configuration data contained within a struct ReserveData. This can be accessed via an internal mapping _reserves.

Held in storage, each ReserveData, contains a variable currentStableBorrowRate.

  • This is the stable rate enjoyed by incoming stable borrows, regardless of user.

  • This global value is determined by the Utilization model we described above.

User's stable rate

Upon taking up a stable loan, the rate enjoyed by the user is stored in _userState[address].additionalData, as defined on the stableDebtToken contract.

We offered a constrained explanation here, following which you can see the StableDebtToken section for specific code details.

Incentive to rebalance

The rebalanceStableBorrowRate function is a public function that can be called by anyone, targeting some specified wallet address.

But unlike liquidations, there is no incentive to do so. Aave will provide an agent that will periodically monitor all the stable rates positions and rebalance the ones that will be deemed necessary.

From Aave v1 whitepaper:

Last updated