diff --git a/contracts/token/ERC20/ERC20.sol b/contracts/token/ERC20/ERC20.sol index 7701cbd74..dc963af88 100644 --- a/contracts/token/ERC20/ERC20.sol +++ b/contracts/token/ERC20/ERC20.sol @@ -180,7 +180,7 @@ contract ERC20 is Context, IERC20, IERC20Metadata { */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { address owner = _msgSender(); - _approve(owner, spender, _allowances[owner][spender] + addedValue); + _approve(owner, spender, allowance(owner, spender) + addedValue); return true; } @@ -200,7 +200,7 @@ contract ERC20 is Context, IERC20, IERC20Metadata { */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { address owner = _msgSender(); - uint256 currentAllowance = _allowances[owner][spender]; + uint256 currentAllowance = allowance(owner, spender); require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); unchecked { _approve(owner, spender, currentAllowance - subtractedValue);