Core Contracts

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

Incorrect returns of scaledTotalSupply(); and scaledBalanceOf();

Summary

The functions scaledTotalSupply() and scaledBalanceOf() from IDebtToken contract are expecting to returns the scaled total supply and scaled balance of the user. Thats not happening.

Vulnerability Details

mint() function from DebtToken contract returns:

uint256 amountToMint = amount + balanceIncrease;
return (scaledBalance == 0, amountToMint, totalSupply());

amount variable is in underlying asset units

// Mint DebtTokens to the user (scaled amount)
(bool isFirstMint, uint256 amountMinted, uint256 newTotalSupply) = IDebtToken(reserve.reserveDebtTokenAddress).mint(msg.sender, msg.sender, amount, reserve.usageIndex);

In LendingPool contract calling mint() function from DebtToken is expecting amount in scaled units passing the values to IDebtToken contract.

Impact

The name of the functions in IDebtToken - scaledBalanceOf and scaledTotalSupply make sense to the caller to receive the scaled balance and scaled total supply. He will receive wrong values.

Recommendations

To fix the issue in contract DebtToken.sol in function mint() the variable uint256 amountToMint should be change from:

uint256 amountToMint = amount + balanceIncrease;

to:

uint256 amountToMint = amountScaled + balanceIncrease;
Updates

Lead Judging Commences

inallhonesty Lead Judge 4 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
Assigned finding tags:

DebtToken::mint incorrectly mints amountToMint (unscaled) instead of amountScaled (scaled), deviating from Aave's pattern and causing incorrect debt tracking

Just a variable naming issue

inallhonesty Lead Judge 4 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
Assigned finding tags:

DebtToken::mint incorrectly mints amountToMint (unscaled) instead of amountScaled (scaled), deviating from Aave's pattern and causing incorrect debt tracking

Just a variable naming issue

Support

FAQs

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