RAACToken
is a ERC20 that can take taxes on token transfers. However, in case burning tokens, the amount of tax taken is less than expected.
The function RAACToken::burn()
allows caller to burn tokens and send tax to fee collector. The burn()
function will take amount.percentMul(burnTaxRate)
as tax and send it to fee collector by calling _transfer(msg.sender, feeCollector, taxAmount)
. Here, _transfer()
calls _update()
with amount = taxAmount
. The function _update()
will handle tax logic once more. This causes the full amount taxAmount
is not sent to fee collector as expected because there will be a portion of the amount is burnt
Run the test and console shows:
FeeCollector
receives less tax than expected
Manual
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.