Core Contracts

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

Incorrect Calculation of `amountScaled` in `RToken::burn` Function

Summary

Initializing amountScaled by Multiplying by index instead of dividing by it can lead to incorrect calculations.

Vulnerability Details

In the RToken::burn function, scaledAmount represents the amount of RToken that should be burned. It is intended to be calculated by dividing amount by reserve.liquidityIndex. However, in the current implementation, this calculation is incorrectly performed by multiplying amount by reserve.liquidityIndex (see here).

Additionally, following the same approach in the mint function, the burn function needs to define a variable called balanceIncrease and account for its effect on amountScaled.

Impact

This results in incorrect calculations.

Tools Used

Manual review

Recommendations

To correctly compute amountScaled when accounting for index and balanceIncrease, it should be calculated as follows:

uint256 amountScaled = (amount + balanceIncrease).rayDiv(index);

This way, amountScaled should be burned instead of the original amount.

Updates

Lead Judging Commences

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

RToken::burn incorrectly calculates amountScaled using rayMul instead of rayDiv, causing incorrect token burn amounts and breaking the interest accrual mechanism

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

RToken::burn incorrectly calculates amountScaled using rayMul instead of rayDiv, causing incorrect token burn amounts and breaking the interest accrual mechanism

Support

FAQs

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

Give us feedback!