Core Contracts

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

Wrong logic in `burn` function in RAACToken contract prevents from burning entire amount if `feeCollector == 0`.

Summary

The burn function in RAACToken contract is defined as follows:

function burn(uint256 amount) external {
uint256 taxAmount = amount.percentMul(burnTaxRate);
_burn(msg.sender, amount - taxAmount);
if (taxAmount > 0 && feeCollector != address(0)) {
_transfer(msg.sender, feeCollector, taxAmount);
}
}

A taxAmount is calculated, and then a burn of amount - taxAmount is executed. If conditions are met (taxAmount > 0 and feeCollector != address(0), then the part of the tax for the fee collector is sent.

The problem arises because in the case where taxAmount > 0 but feeCollector == address(0), the taxAmount amount of tokens is neither burn nor sent to the fee collector. This means any user that wants to burn amount of token won't be able to burn this whole amount.

Impact

The impact of this issue is medium as it leads to wrong burning amount computation when taxAmount > 0 but feeCollector == 0.

Tools Used

Manuel review.

Recommendations

Make sure to correctly handle the specific case we described to make sure the full amount is burned:

function burn(uint256 amount) external {
uint256 taxAmount = amount.percentMul(burnTaxRate);
if (taxAmount > 0 && feeCollector != address(0)) {
_burn(msg.sender, amount - taxAmount);
_transfer(msg.sender, feeCollector, taxAmount);
} else {
_burn(msg.sender, amount);
}
}
Updates

Lead Judging Commences

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

RAACToken::burn incorrectly deducts tax amount but doesn't burn or transfer it when feeCollector is address(0), preventing complete token burns

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

RAACToken::burn incorrectly deducts tax amount but doesn't burn or transfer it when feeCollector is address(0), preventing complete token burns

Support

FAQs

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

Give us feedback!