How is AAVE variable interest rate implemented?
- Aave Protocol
- Borrow rate Aave
Guys I have a question of how AAVE variable interest rate is implemented.
If I borrowed USDC at 10% interest rate, and it became 15% while I'm still having debt, how is this 15% interest rate affected to my position? (asking for algorithm)
I found out that variable interest rate is updated whenever people borrow or deposit, but can't find how changed interest rate is charged to my borrowing position.
On user interaction with Aave protocol, the reserve's index is updated according to the new rate, this where normalized debt of the reserve is calculated. For individual position, the normalized debt is multiplied with
scaledBalance of user.
Refer 👇🏻 https://github.com/aave/aave-v3-core/blob/e46341caf815edc268893f4f9398035f242375d9/contracts/protocol/libraries/logic/ReserveLogic.sol#L73 https://github.com/aave/aave-v3-core/blob/e46341caf815edc268893f4f9398035f242375d9/contracts/protocol/tokenization/VariableDebtToken.sol#L78
The interest rate on loans is determined by the market supply and demand for a given asset. When a user borrows an asset, the interest rate is set at the going market rate at the time of the loan. As more users borrow the same asset, the interest rate will increase, and as users pay back their loans and the supply of the borrowed asset decreases, the interest rate will decrease. In Aave, borrowers and lenders can also participate in flash loans, which are short-term loans that are repaid and closed in the same transaction. The interest rate for flash loans is also determined by supply and demand in the market.
The variable interest rate on AAVE is implemented through a mechanism called the "Variable Borrowing Rate (VBR)." The VBR is determined by the supply and demand of a particular token on the platform.
When the supply of a token is high and the demand is low, the interest rate for borrowing that token will be lower. Conversely, when the supply of a token is low and the demand is high, the interest rate for borrowing that token will be higher. This mechanism helps to ensure that the interest rates on AAVE are always aligned with the market conditions for each token.
The VBR is calculated by taking into account several factors such as the supply and demand of the token, the stability fee, the liquidation penalty and the flash loan fee. The VBR is also influenced by the overall market conditions and the platform's risk management parameters.
The interest rate of the token can be checked on the platform or in real-time using the aave.interests() function in the Aave smart contract.