I'm trying to override the _afterTokenTransfer hook method in ERC721 token contract, but unfortunately it seems that the method is not available because I get a compilation error (I'm using version @4.4.2).
This is my code:
function _afterTokenTransfer(address from, address to, uint256 tokenId)
internal
virtual
override
{
super._afterTokenTransfer(address from, address to, uint256 tokenId);
_approve(from, tokenId);
_pause();
}
And this is the error:
CompilerError: solc returned the following errors:
TypeError: Function has override specified but does not override anything.
Is this because the method is not implemented in this version?
Am I missing something?
I have a similar issue. I suspect it's a version issue. Looking at the OpenZeppelin github, some versions of ERC721.sol don't have a definition for the _afterTokenTransfer function, including maybe the latest ones included in my project (building with the React Truffle Box). I don't really understand how to pull in a good version, but will update you if I figure that out.
Hi @mattlandau. I found the "solution". In version 4.4.2 _afterTokenTransfer hook was not implemented in ERC721.sol. With the latest version 4.5.0-rc.0 the issue is solved. I suppose in the next weeks the stable 4.5.0 version will be available and everything will work as expected