Just use https://github.com/Vectorized/solady/blob/main/src/tokens/ERC721.sol
ERC721OZOptimized adds ERC721A-style data hitchhiking on to OpenZeppelin's ERC721 implementation.
ERC721OZOptimized limits token ids to uint64s (down from uint256s). Other than that, ERC721OZOptimized is functionally equivalent to OZ's implementation, but contains new functions to:
- Show you per-address mint and burn stats:
_numberMinted(address owner)
_numberBurned(address owner)
- Give you access to a uint64 of free address-level data:
_setAddressExtraData(address owner, uint64 extraData)
_getAddressExtraData(address owner)
:
- Give you access to a uint96 of free token-level data:
_setTokenExtraData(uint tokenId, uint96 extraData)
_getTokenExtraData(uint tokenId)
Other things you could do: add unchecked
in various places. Add callbacks to set user / address data to save gas on double writes (like ERC721A). Test performance.
It doesn't implement supportsInterface
, you must do that yourself in another facet