From 4944ab0629ad851a1f6b86f1556bccad76b61681 Mon Sep 17 00:00:00 2001 From: MASDXI Date: Wed, 26 Feb 2025 12:22:45 +0700 Subject: [PATCH] =?UTF-8?q?refactor:=20=F0=9F=92=A1=20handle=20burn=20and?= =?UTF-8?q?=20re-mint?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tokens/ERC721/extensions/ERC721EpochBase.sol | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/contracts/tokens/ERC721/extensions/ERC721EpochBase.sol b/contracts/tokens/ERC721/extensions/ERC721EpochBase.sol index 354051e..94c6323 100644 --- a/contracts/tokens/ERC721/extensions/ERC721EpochBase.sol +++ b/contracts/tokens/ERC721/extensions/ERC721EpochBase.sol @@ -234,11 +234,15 @@ abstract contract ERC721EpochBase is Context, ERC165, IERC721, IERC721Errors, IE uint256 tokenPointer = _tokenPointers[tokenId]; address from = _ownerOf(tokenId); // if the tokenId is not exist before minting it - if (tokenPointer == 0) { - tokenPointer = pointer; - _tokenPointers[tokenId] = pointer; + if (to == address(0)) { + _tokenPointers[tokenId] = 0; } else { - pointer = tokenPointer; + if (tokenPointer == 0) { + tokenPointer = pointer; + _tokenPointers[tokenId] = pointer; + } else { + pointer = tokenPointer; + } } uint256 epoch = _getEpoch(pointer);