From 1b37c21da58f6379cfe09c0140cf56d67b19a0bc Mon Sep 17 00:00:00 2001 From: Francisco Giordano Date: Thu, 20 May 2021 11:40:18 -0300 Subject: [PATCH] reserve unchecked for when guarded by explicit require (#2685) --- contracts/token/ERC20/ERC20.sol | 2 +- contracts/token/ERC777/ERC777.sol | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/contracts/token/ERC20/ERC20.sol b/contracts/token/ERC20/ERC20.sol index 74fbdde04..862581f63 100644 --- a/contracts/token/ERC20/ERC20.sol +++ b/contracts/token/ERC20/ERC20.sol @@ -267,8 +267,8 @@ contract ERC20 is Context, IERC20, IERC20Metadata { require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); unchecked { _balances[account] = accountBalance - amount; - _totalSupply -= amount; } + _totalSupply -= amount; emit Transfer(account, address(0), amount); } diff --git a/contracts/token/ERC777/ERC777.sol b/contracts/token/ERC777/ERC777.sol index 1743cbdcd..1666ec671 100644 --- a/contracts/token/ERC777/ERC777.sol +++ b/contracts/token/ERC777/ERC777.sol @@ -421,8 +421,8 @@ contract ERC777 is Context, IERC777, IERC20 { require(fromBalance >= amount, "ERC777: burn amount exceeds balance"); unchecked { _balances[from] = fromBalance - amount; - _totalSupply -= amount; } + _totalSupply -= amount; emit Burned(operator, from, amount, data, operatorData); emit Transfer(from, address(0), amount);