In the RAACToken contract, the burn function subtracts a tax amount from the tokens to be burned and then transfers this tax to the fee collector if one is set. However, when the fee collector is set to the zero address (i.e., fee collection is disabled), the tax amount is not deducted from the caller’s balance, resulting in an incomplete burn where the caller’s balance is only reduced by the net amount.
The current implementation of the burn function is as follows:
In this implementation:
If the feeCollector address is not zero, the function burns amount - taxAmount tokens from the caller’s balance and then transfers taxAmount tokens from the caller to the fee collector. This results in a total deduction of amount tokens.
However, if feeCollector is set to the zero address, the conditional block does not execute, and only amount - taxAmount tokens are burned. Consequently, the caller’s balance is reduced by less than the intended amount.
This behavior is problematic because the burn function should always remove the full amount from the caller’s balance, regardless of whether the fee collector is set. When fee collection is disabled (i.e., feeCollector == address(0)), the tax portion should still be burned to maintain consistent token economics.
Inconsistent Token Accounting:
Users calling burn when the fee collector is unset will have their balance reduced by only amount - taxAmount, leaving them with a higher balance than expected.
Manual code review
Consistent Burn Behavior:
Modify the burn function to ensure that the caller’s balance is always reduced by the full amount, regardless of whether the fee collector is set. For instance:
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.