The RAACToken burn function calculates taxAmount base on burnTaxRate and burns only amount - taxAmount from the caller's balance. Now if feeCollector != address(0) it transfers the fee. How about when the feeCollector == address(0) a valid configuration set by the setFeeCollector() function that becomes an issue because the fee collector is neither transferred nor burnt, leaving it in the user's position.
This bug stems from feeCollector == address(0) causing the conditional transfer to be skiped if (taxAmount > 0 && feeCollector != address(0)) { _transfer(msg.sender, feeCollector, taxAmount) leaving it with no alternative handling of the taxAmount.
Example:
If user calls burn(1000) with burnTaxRate() = 50(0.5%)
taxAmount = 1000 * 0.005 = 5
amount - taxAmount = 995 is burnt.
if(feeCollector != address(0)), 5 tokens are transferred to feeCollector` reducing user's balance by the full 1,000 tokens burnt.
if(feeCollector == address(0), only 995 tokens are burnt, and the user retains 5 tokens, which will go contrary to the user's expectation of burning 1,000 tokens.
Users retain tokens they intended to burn, leading to inflated token supply and potential financial discrepancies in systems relying on accurate burn accounting.
This flaw could propagate errors, such as misaligned balances and improper revenue tracking.
Manual review
Modify the full logic to ensure that the full amount is burnt regardless of feeCollector status.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.