The RAACToken
contract has an issue in its burn
function where the fee collector receives an excessive amount of fees being paid almost twice. This occurs due to the way the _burn
function interacts with the _update
function, causing fees to be deducted and transferred multiple times.
In the burn
function, the fee is calculated and sent to the fee collector using the _transfer
function:
However, when _burn(msg.sender, amount - taxAmount);
is called, it triggers the overridden _update
function:
Since _burn
internally calls _update
, and _update
also applies fees again, the fee collector receives additional tokens, resulting in an overpayment.
Set up foundry in hardhat
The fee collector receives almost twice the intended amount in fees.
Users burning tokens experience excessive taxation.
Incorrect token accounting, leading to financial discrepancies.
Manual code review
Foundry (Setup Guide)
To prevent duplicate fee deductions, replace the burn
function with the following implementation:
This ensures that _update
does not apply the fee calculation a second time, eliminating the overpayment issue.
This is by design, sponsor's words: Yes, burnt amount, done by whitelisted contract or not always occur the tax. The feeCollector is intended to always be whitelisted and the address(0) is included in the _transfer as a bypass of the tax amount, so upon burn->_burn->_update it would have not applied (and would also do another burn...). For this reason, to always apply such tax, the burn function include the calculation (the 2 lines that applies) and a direct transfer to feeCollector a little bit later. This is done purposefully
This is by design, sponsor's words: Yes, burnt amount, done by whitelisted contract or not always occur the tax. The feeCollector is intended to always be whitelisted and the address(0) is included in the _transfer as a bypass of the tax amount, so upon burn->_burn->_update it would have not applied (and would also do another burn...). For this reason, to always apply such tax, the burn function include the calculation (the 2 lines that applies) and a direct transfer to feeCollector a little bit later. This is done purposefully
This is by design, sponsor's words: Yes, burnt amount, done by whitelisted contract or not always occur the tax. The feeCollector is intended to always be whitelisted and the address(0) is included in the _transfer as a bypass of the tax amount, so upon burn->_burn->_update it would have not applied (and would also do another burn...). For this reason, to always apply such tax, the burn function include the calculation (the 2 lines that applies) and a direct transfer to feeCollector a little bit later. This is done purposefully
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.