Core Contracts

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

The `DebtToken.balanceOf()` Function Unnecessarily Multiplies the Usage Index

Summary

The DebtToken.balanceOf() function unnecessarily multiplies the usage index, resulting in inflated balances.

Vulnerability Details

The DebtToken.balanceOf() function incorrectly multiplies the usage index of the LendingPool with super.balanceOf(account). It should simply return super.balanceOf(account).

When minting, the mint amount represents the actual debt amount in the units of the underlying reserve token. Therefore, super.balanceOf(account) accurately reflects the actual debt amount in those units, making the usage index unnecessary.

As a result, balanceOf() returns an incorrect value that is unreasonably greater than it should be.

function balanceOf(address account) public view override(ERC20, IERC20) returns (uint256) {
uint256 scaledBalance = super.balanceOf(account);
225 return scaledBalance.rayMul(ILendingPool(_reservePool).getNormalizedDebt());
}

Impact

balanceOf() returns an incorrect value that is unreasonably greater than it should be.

Tools Used

Manual review

Recommendations

Do not multiply by the usage index.

function balanceOf(address account) public view override(ERC20, IERC20) returns (uint256) {
uint256 scaledBalance = super.balanceOf(account);
- return scaledBalance.rayMul(ILendingPool(_reservePool).getNormalizedDebt());
+ return scaledBalance;
}
Updates

Lead Judging Commences

inallhonesty Lead Judge 7 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

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

Give us feedback!