Core Contracts

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

Incorrect burn tax calculation when fee collector is not set leads to protocol loss

Summary

The RAACToken::burn() function incorrectly calculates the burn amount when no fee collector is set, resulting in fewer tokens being burned than intended and potential protocol losses.

Vulnerability Details

In the RAACToken::burn() function, when a user burns tokens, a burn tax is applied. However, the implementation has a critical flaw in how it handles the case when no fee collector is set:

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

The function always subtracts the tax amount from the burn amount, even when there is no fee collector to receive it. This means that when feeCollector is address(0):

  1. The tax amount is calculated

  2. The tax amount is subtracted from the burn amount

  3. But the tax amount is never transferred or burned since the fee collector check fails

Proof of Concept

  1. User wants to burn 1000 tokens with a 5% burn tax rate (burnTaxRate = 500)

  2. taxAmount = 1000 * 5% = 50 tokens

  3. With fee collector set:

    • Burns 950 tokens

    • Transfers 50 tokens to fee collector

  4. Without fee collector:

    • Burns only 950 tokens

    • The 50 token tax is neither burned nor transferred

    • Result: Only 950 tokens are removed from circulation instead of 1000

Impact

When no fee collector is set, the protocol burns fewer tokens than intended. This impacts the token economics and could lead to losses for the protocol.

Recommendations

Burn the Full Amount When No Fee Collector

function burn(uint256 amount) external {
uint256 taxAmount = amount.percentMul(burnTaxRate);
+ if (feeCollector == address(0)) {
+ _burn(msg.sender, amount);
+ } else {
_burn(msg.sender, amount - taxAmount);
_transfer(msg.sender, feeCollector, taxAmount);
+ }
}
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!