From 6d5a73815de843267c75f9134c4c11243fa895d8 Mon Sep 17 00:00:00 2001 From: sunhurts <66348679+sunhurts@users.noreply.github.com> Date: Fri, 14 Aug 2020 20:29:20 +0530 Subject: [PATCH] Fix ERC20Snapshot#_beforeTokenTransfer (#2328) --- contracts/token/ERC20/ERC20Snapshot.sol | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/contracts/token/ERC20/ERC20Snapshot.sol b/contracts/token/ERC20/ERC20Snapshot.sol index cc25d618e..0f8e7b6f5 100644 --- a/contracts/token/ERC20/ERC20Snapshot.sol +++ b/contracts/token/ERC20/ERC20Snapshot.sol @@ -110,8 +110,12 @@ abstract contract ERC20Snapshot is ERC20 { function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual override { super._beforeTokenTransfer(from, to, amount); - if (from == address(0) || to == address(0)) { - // mint or burn + if (from == address(0)) { + // mint + _updateAccountSnapshot(to); + _updateTotalSupplySnapshot(); + } else if (to == address(0)) { + // burn _updateAccountSnapshot(from); _updateTotalSupplySnapshot(); } else {