Core Contracts

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

Premature State Deletion in FeeCollector

Summary

distributeCollectedFees deletes collectedFees before token transfers. If a transfer fails (e.g., non-reverting token), fees are lost permanently.

Vulnerability Details

The current implementation is a problem#distributeCollectedFees

function distributeCollectedFees() external override nonReentrant whenNotPaused {
uint256 totalFees = _calculateTotalFees();
uint256[4] memory shares = _calculateDistribution(totalFees);
// State deleted before transfers
delete collectedFees;
// Transfers happen after state deletion
_processDistributions(totalFees, shares);
emit FeeDistributed(shares[0], shares[1], shares[2], shares[3]);
}

Impact

  1. Fee accounting becomes corrupted if transfers fail

  2. Protocol revenue is permanently lost

  3. veRAAC holders miss rewards

  4. Treasury receives incorrect amounts

  5. Protocol metrics become inaccurate

Tools Used

Manual Review

Recommendations

We should delete collectedFees only after confirming all transfers succeeded (For example, using a temporary variable and update state post-transfers). By using this pattern, we safely stores fee state in memory, completes all transfers and updates state only after confirmed success

function distributeCollectedFees() external override nonReentrant whenNotPaused {
// Store current fees in memory
CollectedFees memory feesToDistribute = collectedFees;
uint256 totalFees = _calculateTotalFees();
uint256[4] memory shares = _calculateDistribution(totalFees);
// Process all transfers first
_processDistributions(totalFees, shares); // Reverts on failure
// Only after successful transfers, clear the state
delete collectedFees; // Safe to delete post-transfer
emit FeeDistributed(shares[0], shares[1], shares[2], shares[3]);
}
Updates

Lead Judging Commences

inallhonesty Lead Judge 4 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

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