Skip to content

Commit

Permalink
add feature request #3084
Browse files Browse the repository at this point in the history
  • Loading branch information
0xclaudeshannon committed Jan 6, 2022
1 parent d746056 commit 6de0be4
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions contracts/token/ERC20/ERC20.sol
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,11 @@ contract ERC20 is Context, IERC20, IERC20Metadata {
uint256 amount
) public virtual override returns (bool) {
uint256 currentAllowance = _allowances[sender][_msgSender()];
require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
unchecked {
_approve(sender, _msgSender(), currentAllowance - amount);
if (currentAllowance != 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) {
require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
unchecked {
_approve(sender, _msgSender(), currentAllowance - amount);
}
}

_transfer(sender, recipient, amount);
Expand Down

0 comments on commit 6de0be4

Please sign in to comment.