Browse Source

ERC20: optimized gas costs in `_spendAllowance` (#5271)

Maxim Tiron 11 months ago
parent
commit
a4dc928a93
1 changed files with 1 additions and 1 deletions
  1. 1 1
      contracts/token/ERC20/ERC20.sol

+ 1 - 1
contracts/token/ERC20/ERC20.sol

@@ -300,7 +300,7 @@ abstract contract ERC20 is Context, IERC20, IERC20Metadata, IERC20Errors {
      */
     function _spendAllowance(address owner, address spender, uint256 value) internal virtual {
         uint256 currentAllowance = allowance(owner, spender);
-        if (currentAllowance != type(uint256).max) {
+        if (currentAllowance < type(uint256).max) {
             if (currentAllowance < value) {
                 revert ERC20InsufficientAllowance(spender, currentAllowance, value);
             }