Core Contracts

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

Inconsistent handling of default tax rates in constructor vs _setTaxRate()

Summary

In the constructor, if initialSwapTaxRate or initialBurnTaxRate is set to 0, the contract forces a default value (100 for swap tax and 50 for burn tax). However, in _setTaxRate(), the function allows setting both tax rates to 0. This creates an inconsistency where the tax rate cannot be initially set to 0, but can later be changed to 0.

Vulnerability Details

constructor(
address initialOwner,
uint256 initialSwapTaxRate,
uint256 initialBurnTaxRate
) ERC20("RAAC Token", "RAAC") Ownable(initialOwner) {
if (initialOwner == address(0)) revert InvalidAddress();
feeCollector = initialOwner;
if (initialSwapTaxRate > MAX_TAX_RATE) revert SwapTaxRateExceedsLimit();
@> swapTaxRate = initialSwapTaxRate == 0 ? 100 : initialSwapTaxRate; // default to 1% if 0
emit SwapTaxRateUpdated(swapTaxRate);
if (initialBurnTaxRate > MAX_TAX_RATE) revert BurnTaxRateExceedsLimit();
@> burnTaxRate = initialBurnTaxRate == 0 ? 50 : initialBurnTaxRate; // default to 0.5% if 0
emit BurnTaxRateUpdated(burnTaxRate);
}
function _setTaxRate(uint256 newRate, bool isSwapTax) private {
if (newRate > MAX_TAX_RATE) revert TaxRateExceedsLimit();
uint256 currentRate = isSwapTax ? swapTaxRate : burnTaxRate;
@> if (currentRate != 0) {
uint256 maxChange = currentRate.percentMul(taxRateIncrementLimit);
// Check if the new rate is too high (newRate > currentRate + maxChange) or too low (newRate < currentRate && currentRate - newRate > maxChange) by more than the allowed increment
bool isTooHighOrTooLow = newRate > currentRate + maxChange || newRate < currentRate && currentRate - newRate > maxChange;
if (isTooHighOrTooLow) {
revert TaxRateChangeExceedsAllowedIncrement();
}
}
if (isSwapTax) {
@> swapTaxRate = newRate;
emit SwapTaxRateUpdated(newRate);
} else {
@> burnTaxRate = newRate;
emit BurnTaxRateUpdated(newRate);
}
}

As seen above, the constructor enforces a minimum swap tax of 1% and a burn tax of 0.5% if 0 is provided.

However, _setTaxRate() allows setting these values to 0, meaning the tax can be removed later.

Impact

Inconsistency in tax logic: There's no technical vulnerability, but the logic is not uniform across the contract.

Tools Used

manual

Recommendations

Maintain the consistency in tax logic.

Allow setting 0 in the constructor or Disallow 0 in _setTaxRate()

Updates

Lead Judging Commences

inallhonesty Lead Judge 4 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
inallhonesty Lead Judge 4 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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