This repository has been archived by the owner on Apr 28, 2024. It is now read-only.
mstpr-brainbot - When the new rate model is set the latest interest is not accrued according to the previous rate model #122
Labels
Disagree With (non-)Duplication
The sponsor disputed the duplication state of this issue
Disagree With Severity
The sponsor disputed the severity of this issue
Non-Reward
This issue will not receive a payout
Will Fix
The sponsor confirmed this issue will be fixed
mstpr-brainbot
medium
When the new rate model is set the latest interest is not accrued according to the previous rate model
Summary
When the new rate model is set the latest interest is not accrued according to the previous rate model which would create an unfair situation for the users.
Vulnerability Detail
Whenever there is a change in the interest rate, the interest first accrues from the latest block to the current block for actions such as repay, borrow, deposit, and redeem. However, when a new rate model is set, the most recent interest does not accrue. Instead, it will accrue based on the current rate model, leading to an unfair and inconsistent interest accrual for users.
As seen here:
https://github.com/sherlock-audit/2023-10-aloe/blob/main/aloe-ii/core/src/Lender.sol#L59-L64
When the new rate model is set the previous interest is not accrued.
Impact
Unfair accrual of the interest. If the new rate model is significantly different and there are many waiting interest to be accrued this can make the previous interest accrue in the rate model which can make the dripping of the interest unfair for th e lenders and borrowers.
Code Snippet
https://github.com/sherlock-audit/2023-10-aloe/blob/main/aloe-ii/core/src/Factory.sol#L282-L318
https://github.com/sherlock-audit/2023-10-aloe/blob/main/aloe-ii/core/src/Lender.sol#L59-L64
Tool used
Manual Review
Recommendation
Accrue the interest before the rate model update via accrueInterest() or the same flywheel with the repay-borrow-deposit-redeem functions (_load() and _save())
The text was updated successfully, but these errors were encountered: