Skip to content

Commit

Permalink
I refactor afterTokenTransfer hook.
Browse files Browse the repository at this point in the history
  • Loading branch information
SweetmanTech committed Aug 6, 2023
1 parent f6addb2 commit cf4b016
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
17 changes: 6 additions & 11 deletions src/ERC721ACH.sol
Original file line number Diff line number Diff line change
Expand Up @@ -83,19 +83,14 @@ contract ERC721ACH is IERC721ACH, ERC721AC {
uint256 quantity
) internal virtual override {
super._afterTokenTransfers(from, to, startTokenId, quantity);
IAfterTokenTransfersHook afterTokenTransfersHook = IAfterTokenTransfersHook(
hooks[HookType.AfterTokenTransfers]
);
IAfterTokenTransfersHook hook = IAfterTokenTransfersHook(
hooks[HookType.AfterTokenTransfers]
);
if (
address(afterTokenTransfersHook) != address(0) &&
afterTokenTransfersHook.useAfterTokenTransfersHook(
from,
to,
startTokenId,
quantity
)
address(hook) != address(0) &&
hook.useAfterTokenTransfersHook(from, to, startTokenId, quantity)
) {
afterTokenTransfersHook.afterTokenTransfersOverrideHook(
hook.afterTokenTransfersOverrideHook(
from,
to,
startTokenId,
Expand Down
1 change: 0 additions & 1 deletion test/hooks/BeforeTokenTransfers.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ contract BeforeTokenTransfersHookTest is DSTest {
address public constant DEFAULT_BUYER_ADDRESS = address(0xBABE);
ERC721ACHMock erc721Mock;
BeforeTokenTransfersHookMock hookMock;

IERC721ACH.HookType constant BeforeTokenTransfers =
IERC721ACH.HookType.BeforeTokenTransfers;

Expand Down

0 comments on commit cf4b016

Please sign in to comment.