Skip to content

Commit

Permalink
Merge pull request #12 from defientco/updated-tokentransfer
Browse files Browse the repository at this point in the history
calling super.tokentansfer before hook logic 🐞
  • Loading branch information
SweetmanTech authored Aug 5, 2023
2 parents c3b7f7f + ced89ed commit f72dcc9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/ERC721ACH.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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) &&
Expand All @@ -66,9 +67,7 @@ contract ERC721ACH is ERC721AC, IERC721ACH {
startTokenId,
quantity
);
} else {
super._beforeTokenTransfers(from, to, startTokenId, quantity);
}
}
}

/// TODO
Expand All @@ -78,6 +77,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) &&
Expand All @@ -89,9 +90,7 @@ contract ERC721ACH is ERC721AC, IERC721ACH {
startTokenId,
quantity
);
} else {
super._afterTokenTransfers(from, to, startTokenId, quantity);
}
}
}


Expand Down
2 changes: 2 additions & 0 deletions test/utils/ERC721ACHMock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit f72dcc9

Please sign in to comment.