The DebtToken.totalSupply() function is using division (rayDiv) instead of multiplication, causing incorrect results which is used by different critical functions like mint, burn.
Consider the state of system: index = 10 and no tokens minted yet (totalSupply = 0).
A user borrows 100 tokens by calling borrow() with amount=100
This triggers DebtToken.mint() with amount=100
Inside mint(), the system updates user balance and _totalSupply by amount / index = 100 / 10 = 10.
Note: DebtToken.mint() > _mint() > _update > super._update(amount/index)
So now, super.totalSupply = 10.
DebtToken.mint returns totalSupply() which is 1. (This is where wrong calculation happens)
totalSupply() = super.totalSupply / index = 10 / 10 = 1.
Borrow function updates reserve’s totalUsage to newSupply = 1
The real amount borrowed was 100, but reserve.totalUsage is incorrectly set to 1 instead of 100.
Since totalUsage affects utilization rate and interest rates, this miscalculation breaks the borrowing and lending logic.
Incorrect reserve state: reserve.totalUsage is updated with a scaled value, leading to wrong reserve’s actual debt, utilization rates and interest rates
Manual code review
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.