Core Contracts

Regnum Aurum Acquisition Corp
HardhatReal World AssetsNFT
77,280 USDC
View results
Submission Details
Severity: medium
Valid

[H-07] Wrong arithmetic operation to obtain totalSupply() of DebtToken

Summary

The totalSupply() function performs a division of the scaled supply by the usage index but it should instead perform a multiplication.

Vulnerability Details

Performing the division to obtain the "non-scaled" version, aka the version that takes into account the current index, will result in unexpected outcomes.
As shown in every other function of the contract, the design by which the balances of the token are handled by the _update() function and the "index-based" design in general, the way to take into account the current index with respect to the old is to multiply the previously "scaled" balances by the current index.

Location

Impact

Any function/contract relying on the totalSupply of the DebtToken will be impacted negatively due to receiving and updating their internal state based on erroneous information.

Tools Used

Manual review.

Recommendations

Simply switch rayDiv() for rayMul().

return scaledSupply.rayMul(ILendingPool(_reservePool).getNormalizedDebt());

Updates

Lead Judging Commences

inallhonesty Lead Judge 7 months ago
Submission Judgement Published
Validated
Assigned finding tags:

DebtToken::totalSupply incorrectly uses rayDiv instead of rayMul, severely under-reporting total debt and causing lending protocol accounting errors

inallhonesty Lead Judge 7 months ago
Submission Judgement Published
Validated
Assigned finding tags:

DebtToken::totalSupply incorrectly uses rayDiv instead of rayMul, severely under-reporting total debt and causing lending protocol accounting errors

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.

Give us feedback!