From 4f039c8e203f5f6725dd5e047aa9a4c68d80d511 Mon Sep 17 00:00:00 2001 From: Bulalu Date: Fri, 4 Aug 2023 19:16:45 +0300 Subject: [PATCH 1/2] =?UTF-8?q?calling=20super.tokentansfer=20before=20hoo?= =?UTF-8?q?k=20logic=20=F0=9F=90=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ERC721ACH.sol | 3 +++ test/utils/ERC721ACHMock.sol | 2 ++ 2 files changed, 5 insertions(+) diff --git a/src/ERC721ACH.sol b/src/ERC721ACH.sol index a95b534..7f07565 100644 --- a/src/ERC721ACH.sol +++ b/src/ERC721ACH.sol @@ -55,6 +55,7 @@ contract ERC721ACH is ERC721AC, IERC721ACH { uint256 startTokenId, uint256 quantity ) internal virtual override { + super._beforeTokenTransfers(from, to, startTokenId, quantity); IBeforeTokenTransfersHook beforeTokenTransfersHook = IBeforeTokenTransfersHook(hooks[HookType.BeforeTokenTransfers]); if ( address(beforeTokenTransfersHook) != address(0) && @@ -78,6 +79,8 @@ contract ERC721ACH is ERC721AC, IERC721ACH { uint256 startTokenId, uint256 quantity ) internal virtual override { + + super._afterTokenTransfers(from, to, startTokenId, quantity); IAfterTokenTransfersHook afterTokenTransfersHook = IAfterTokenTransfersHook(hooks[HookType.AfterTokenTransfers]); if ( address(afterTokenTransfersHook) != address(0) && diff --git a/test/utils/ERC721ACHMock.sol b/test/utils/ERC721ACHMock.sol index bfc6fe6..09984f3 100644 --- a/test/utils/ERC721ACHMock.sol +++ b/test/utils/ERC721ACHMock.sol @@ -7,6 +7,8 @@ contract ERC721ACHMock is ERC721ACH { bool public hooksEnabled; address public owner; + error Access_OnlyOwner(); + constructor(address _owner) ERC721ACH("ERC-721ACH Mock", "MOCK") { owner = _owner; } From ced89ed9bffef2034cd8bfa08d3e1597a1a3c15a Mon Sep 17 00:00:00 2001 From: Bulalu Date: Sat, 5 Aug 2023 02:35:31 +0300 Subject: [PATCH 2/2] =?UTF-8?q?removed=20duplication=20on=20calling=20supe?= =?UTF-8?q?r=20tokentransfer=20hook=20=F0=9F=A4=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ERC721ACH.sol | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/ERC721ACH.sol b/src/ERC721ACH.sol index 7f07565..cbae07a 100644 --- a/src/ERC721ACH.sol +++ b/src/ERC721ACH.sol @@ -67,9 +67,7 @@ contract ERC721ACH is ERC721AC, IERC721ACH { startTokenId, quantity ); - } else { - super._beforeTokenTransfers(from, to, startTokenId, quantity); - } + } } /// TODO @@ -92,9 +90,7 @@ contract ERC721ACH is ERC721AC, IERC721ACH { startTokenId, quantity ); - } else { - super._afterTokenTransfers(from, to, startTokenId, quantity); - } + } }