axelarnetwork/axelar-examples

Use ERC20._spendAllowance in CustomToken

SKYBITDev3 opened this issue · 0 comments

Can the code

function _spendAllowance(address sender, address spender, uint256 amount) internal override (ERC20, InterchainTokenStandard) {
uint256 _allowance = allowance(sender, spender);
if (_allowance != UINT256_MAX) {
_approve(sender, spender, _allowance - amount);
}
}

be replaced by

function _spendAllowance(address sender, address spender, uint256 amount) internal override (ERC20, InterchainTokenStandard) {
    ERC20._spendAllowance(sender, spender, amount);
 } 

?

Or was there a reason not to use the built-in _spendAllowance in ERC20?