Summary
In RAACToken.sol contract
Vulnerability Details
In RAACToken.sol contract in _update function in comment section mention that -> // Skip tax for whitelisted addresses or when fee collector disabled
function _update(
address from,
address to,
uint256 amount
) internal virtual override {
uint256 baseTax = swapTaxRate + burnTaxRate;
if (baseTax == 0 || from == address(0) || to == address(0) || whitelistAddress[from] || whitelistAddress[to] || feeCollector == address(0)) {
super._update(from, to, amount);
return;
}
uint256 totalTax = amount.percentMul(baseTax);
uint256 burnAmount = totalTax * burnTaxRate / baseTax;
super._update(from, feeCollector, totalTax - burnAmount);
super._update(from, address(0), burnAmount);
super._update(from, to, amount - totalTax);
}
In burn function you can observe there is no cheking that msg.sender is whitelisted or not ?
function burn(uint256 amount) external {
uint256 taxAmount = amount.percentMul(burnTaxRate);
_burn(msg.sender, amount - taxAmount);
if (taxAmount > 0 && feeCollector != address(0)) {
_transfer(msg.sender, feeCollector, taxAmount);
}
}
So In conclusion there is no special discount for whitelisted user of burning tax { as mention in comment section }.
Impact
whitelisted user will incorrectly be charged a burn tax according comment section of _update function.
Tools Used
Manual Review
Recommendations
In RAACToken.sol contract In burn function modify according below things...
function burn(uint256 amount) external {
@>> uint256 taxAmount = 0;
@>> if (!whitelistAddress[msg.sender]) {
taxAmount = amount.percentMul(burnTaxRate);
}
_burn(msg.sender, amount - taxAmount);
if (taxAmount > 0 && feeCollector != address(0)) {
_transfer(msg.sender, feeCollector, taxAmount);
}
}