Hello,
For ERC-20, if I override the transfer and transferFrom functions so that it burns a certain pct of the token being transferred, will this cause errors when users try to interact with other contracts that expect to receive a certain amount?
e.g. if a user tries to do a swap of 100 TOKEN for 1 ETH, but my override causes 1% to be burnt and uniswap only receives 99 TOKEN
Here is some example code with only the relevant pieces left in:
function transfer(address to, uint256 amount) public override returns (bool) {
// performing some other logic up here, which is not relevant
bool _success = super.transfer(to, _txBurn(amount));
// and more logic down here, which also isn't relevant
return _success;
}
function transferFrom(address from, address to, uint256 amount) public override returns (bool) {
// performing some other logic up here, which is not relevant
bool _success = super.transferFrom(msg.sender, to, _txBurn(amount));
// and more logic down here, which also isn't relevant
return _success;
}
function _txBurn(uint256 amount) internal returns (uint256) {
uint256 burnAmount = amount.div(100);
if (burnAmount > 0) {
_burn(msg.sender, burnAmount);
return amount.sub(burnAmount);
} else {
return amount;
}
}