Core Contracts

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

Rounding Errors in `_calculateDistribution()` May Cause Funds to Become Unreachable

In _calculateDistribution(uint256 totalFees), the function calculates fee shares using integer division:

shares[0] = (totalFees * shares[0]) / BASIS_POINTS;
shares[1] = (totalFees * shares[1]) / BASIS_POINTS;
shares[2] = (totalFees * shares[2]) / BASIS_POINTS;
shares[3] = (totalFees * shares[3]) / BASIS_POINTS;

Since Solidity rounds down in integer division, a small remainder may be left unallocated. If this remainder is not explicitly handled, some collected fees will never be distributed, leading to permanent fund loss.

Impact

  • The contract fails to distribute 100% of collected fees, small portions of tokens remain locked inside the contract with no way to recover them. Over time, significant amounts of funds may accumulate as "dust", leading to lost protocol revenue.

Mitigation

Ensure the entire totalFees is accounted for by allocating the remainder to the treasury:

uint256 distributedSum = shares[0] + shares[1] + shares[2] + shares[3];
uint256 remainder = totalFees - distributedSum;
shares[3] += remainder; // Assign remainder to the treasury
Updates

Lead Judging Commences

inallhonesty Lead Judge 3 months ago
Submission Judgement Published
Invalidated
Reason: Too generic

Support

FAQs

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