Hi everyone. I'm new to Solidity.
I wanted to create a contract inheriting from ERC721Enumerable, and I wrote the code as TokenA.
However, OpenZeppelin Contracts Wizard shows as TokenB.
Why does the wizard's code use multiple inheritance? I don't see the benefit.
// My code
contract TokenA is ERC721Enumerable {
constructor() ERC721("MyToken", "MTK") {}
}
// Wizard code
contract TokenB is ERC721, ERC721Enumerable {
constructor() ERC721("MyToken", "MTK") {}
function _beforeTokenTransfer(address from, address to, uint256 tokenId)
internal
override(ERC721, ERC721Enumerable)
{
super._beforeTokenTransfer(from, to, tokenId);
}
function supportsInterface(bytes4 interfaceId)
public
view
override(ERC721, ERC721Enumerable)
returns (bool)
{
return super.supportsInterface(interfaceId);
}
}