OpenZeppelin Contracts Wizard Functions

The wizard found at this link, generates the following functions:

function _beforeTokenTransfer(address from, address to, uint256 tokenId)
     internal
     whenNotPaused
     override(ERC721Upgradeable, ERC721EnumerableUpgradeable)
 {
     super._beforeTokenTransfer(from, to, tokenId);
 }

 function supportsInterface(bytes4 interfaceId)
     public
    view
     override(ERC721Upgradeable, ERC721EnumerableUpgradeable)
     returns (bool)
 {
     return super.supportsInterface(interfaceId);
}

Are these overriding functions required in my solidity contract if importing both ERC721Upgradeable and ERC721EnumerableUpgradeable modules? I did not include these overriding functions, while I am importing both modules, and everything appears to work properly. Could it create issues on some occasions?

Thank you. J


If you want to re-write these functions, I think you need these function.

There’s several options for how to proceed with it that will be useful in different circumstances. “Copy to Clipboard” as well as the standard “Download” will work well with local development workflows (such as using Hardhat or Truffle), whereas “Open in Remix” will be ideal for anyone working on Remix IDE.

Hi @Skyge Please ignore my previous questions, for I have found the answer. Thank you.

1 Like

_beforeTokenTransfer is necessary because you enabled Pausable, so it adds the whenNotPaused modifier to transfers.

supportsInterface is necessary for Solidity. If you remove it you will see the contract doesn't compile.