LendingPool utilization rate is incorrectly calculated due to incorrect total supply value returned by DebtToken.
LendingPool utilization rate is calculated based on reserve.totalLiquidity and reserve.totalUsage.
ReserveLibrary.sol::updateInterestRatesAndLiquidity()
reserve.totalLiquidity is updated when user deposits into LendingPool, and the value is in underlying asset units.
ReserveLibrary.sol::updateInterestRatesAndLiquidity()
reserve.totalUsage is updated when DebtToken tokens are minted or burned (when user borrows or repays).
Essentially, reserve.totalUsage is the value returned by DebtToken's totalSupply().
DebtToken overrides ERC20's _update(), and the store value is scaled and divided by reserve usage index.
totalSupply() is also overriden, it firstly calls ERC20's totalSupply() to get the store value, then divides the value by reserve usage index.
That mean, the value returned by totalSupply() is non-scaled supply value / usageIndex0 / usageIndex1, the value is scaled by twice.
calculateUtilizationRate() does not do any conversion, it adds reserve.totalLiquidity to reserve.totalUsage directly, this is obviously wrong as reserve.totalLiquidity is non-scaled.
ReserveLibrary.sol::calculateUtilizationRate()
LendingPool utilization rate is used for calculating borrow rate, incorrect utilization rate leads to incorrect borrow rate and borrower pays incorrect interests.
Manual Review
totalSuppy() should return non-scaled value.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.