I understand that for OpenSea to read our metadata JSON file, we need the function below.
function uri(uint256 _tokenid) override public pure returns (string memory) {
return string(
abi.encodePacked(
"https://ipfs.io/ipfs/bafybeihjjkwdrxxjnuwevlqtqmh3iegcadc32sio4wmo7bv2gbf34qs34a/",
Strings.toString(_tokenid),".json"
)
);
}
But what if my contract gives the option of setting a new URI for each token id like below?
function setTokenURI(uint256 tokenId, string memory tokenURI) public onlyOwner {
ERC1155URIStorage._setURI(tokenId, tokenURI);
}
The IPFS URL would have been changed. Thus, how do I change the uri function
so that I can accommodate the update of the token URI?