Core Contracts

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

swapTaxes & nftRoyalties are initialized at 20% instead of intended 2%

Summary

The Swap Tax and NFT Royalty Fees are supposd to be initialized at 2% total according to the comments. However, the implementation is set at 20%.

Vulnerability Details

The implementation sets these fees at 20% instead of 2% as stated in the comments

// Buy/Sell Swap Tax (2% total)
feeTypes[6] = FeeType({
>> // @audit-issue These percentages are wrongly set
veRAACShare: 500, // 0.5%
burnShare: 500, // 0.5%
repairShare: 1000, // 1.0%
treasuryShare: 0
});
// NFT Royalty Fees (2% total)
feeTypes[7] = FeeType({
>> // @audit-issue These percentages are wrongly set
veRAACShare: 500, // 0.5%
burnShare: 0,
repairShare: 1000, // 1.0%
treasuryShare: 500 // 0.5%
});

As seen above, the percentages are wrongly set. For example, using basis points set at 10000 representing 100%, 0.5% should be represented by 50 bps not 500 as used above.

During fee distribution, the shares are computed based on the fee type basis points as shown here:

for (uint8 i = 0; i < 8; i++) {
uint256 feeAmount = _getFeeAmountByType(i);
if (feeAmount == 0) continue;
FeeType memory feeType = feeTypes[i];
totalCollected += feeAmount;
uint256 weight = (feeAmount * BASIS_POINTS) / totalFees;
// @audit-info Share allocation based on set basis points
>> shares[0] += (weight * feeType.veRAACShare) / BASIS_POINTS;
>> shares[1] += (weight * feeType.burnShare) / BASIS_POINTS;
>> shares[2] += (weight * feeType.repairShare) / BASIS_POINTS;
>> shares[3] += (weight * feeType.treasuryShare) / BASIS_POINTS;
}
if (totalCollected != totalFees) revert InvalidFeeAmount();
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;
>> uint256 remainder = totalFees - (shares[0] + shares[1] + shares[2] + shares[3]);
// @audit-info Add the rest to treasury
>> if (remainder > 0) shares[3] += remainder;

Impact

If it the intention of the protocol is to allocate a very small portion of Swap taxes and Royalty fees to other entities and the rest to treasury, this will not work as required.

Tools Used

Manual Review

Recommendations

Adjust the basis points as follows:

// Buy/Sell Swap Tax (2% total)
feeTypes[6] = FeeType({
- veRAACShare: 500, // 0.5%
- burnShare: 500, // 0.5%
- repairShare: 1000, // 1.0%
- treasuryShare: 0
+ veRAACShare: 50, // 0.5%
+ burnShare: 50, // 0.5%
+ repairShare: 100, // 1.0%
+ treasuryShare: 0
});
// NFT Royalty Fees (2% total)
feeTypes[7] = FeeType({
- veRAACShare: 500, // 0.5%
- burnShare: 0,
- repairShare: 1000, // 1.0%
- treasuryShare: 500 // 0.5%
+ veRAACShare: 50, // 0.5%
+ burnShare: 0,
+ repairShare: 100, // 1.0%
+ treasuryShare: 50 // 0.5%
});
Updates

Lead Judging Commences

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

Fee shares for fee type 6 and 7 inside FeeCollector do not total up to the expected 10000 basis points, this leads to update problems, moreover they are 10x the specifications

Support

FAQs

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