OpenZeppelin’s ERC 721 URIStorage extension allows you to decouple the tokenURI from the tokenId.

The extension enables this by storing each tokenURI on chain, instead of generating the tokenURIs dynamically by concatenating the baseURI + tokenId.

This is more costly because this requires more on-chain storage.

OpenZeppelin Version 4.5 URIStorage:
https://docs.openzeppelin.com/contracts/4.x/api/token/erc721#ERC721URIStorage

Using ERC721 URIStorage extension to create NFTs (from one of my previous videos)
https://github.com/robertipk/NFT_Metadata_IPFS/blob/master/contracts/nft.sol
https://youtu.be/qtvtu0KXqm8

Similar Posts:

Leave a comment