Core Contracts

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

calculateDustAmount Underestimates Contract Balance, Misrepresenting Available Funds

Summary

The calculateDustAmount function in RToken.sol mistakenly divides the contract balance by the liquidity index, leading to an underestimated token balance.

Vulnerability Details

The incorrect calculation is found here:

https://github.com/Cyfrin/2025-02-raac/blob/89ccb062e2b175374d40d824263a4c0b601bcb7f/contracts/core/tokens/RToken.sol#L319

uint256 contractBalance = IERC20(_assetAddress).balanceOf(address(this)).rayDiv(ILendingPool(_reservePool).getNormalizedIncome());

Since the contract balance is already a raw value, dividing by the normalized income reduces its value unnecessarily.

Impact

This miscalculation may cause incorrect surplus fund calculations, preventing proper fund management and could lead to unclaimed tokens sitting in the contract.

Tools Used

  • Manual code review

Recommendations

Remove the unnecessary division and use the raw balance directly.

Updates

Lead Judging Commences

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

RToken::calculateDustAmount incorrectly applies liquidity index, severely under-reporting dust amounts and permanently trapping crvUSD in contract

Support

FAQs

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