Core Contracts

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

The `RToken.calculateDustAmount()` Function Doesn't Account for Assets Deposited into the `curveVault`

Summary

The RToken.calculateDustAmount() function fails to consider the assets deposited into the curveVault. As a result, the calculated excess amount is lower than it should be (often resulting in a value of 0), which leads to the actual excess amount being locked.

Vulnerability Details

The RToken.calculateDustAmount() function does not take into account the assets deposited into the curveVault.

During the minting and burning of RToken (specifically during the deposit() and withdraw() processes of the LendingPool), the rebalancing process deposits some underlying assets into the curveVault. These amounts are still for RToken holders.

When calculating the excess amount of underlying assets (defined as the difference between the actual balance of underlying assets and the corresponding underlying amount for the total supply of RToken, adjusted for the exchange rate index), it is essential to account for the assets deposited into the curveVault.

However, the current implementation does not reflect this, resulting in the excess amount being underestimated and causing some (or nearly all) of the actual excess amount to be locked.

function calculateDustAmount() public view returns (uint256) {
// Calculate the actual balance of the underlying asset held by this contract
uint256 contractBalance = IERC20(_assetAddress).balanceOf(address(this)).rayDiv(ILendingPool(_reservePool).getNormalizedIncome());
// Calculate the total real obligations to the token holders
uint256 currentTotalSupply = totalSupply();
// Calculate the total real balance equivalent to the total supply
uint256 totalRealBalance = currentTotalSupply.rayMul(ILendingPool(_reservePool).getNormalizedIncome());
// All balance, that is not tied to rToken are dust (can be donated or is the rest of exponential vs linear)
return contractBalance <= totalRealBalance ? 0 : contractBalance - totalRealBalance;
}

Impact

Some underlying assets may be locked.

Tools Used

Manual review

Recommendations

Account for the deposited amount into the curveVault.

Updates

Lead Judging Commences

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

RToken dust calculation structurally impossible with outstanding loans or funds deposited in the vault

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

RToken dust calculation structurally impossible with outstanding loans or funds deposited in the vault

Support

FAQs

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

Give us feedback!