ERC1155URIStorage
Inherits: ERC1155
ERC-1155 token with storage based token URI management. Inspired by the {ERC721URIStorage} extension
State Variables
_baseURI
string private _baseURI = "";
_tokenURIs
mapping(uint256 tokenId => string) private _tokenURIs;
Functions
uri
*See {IERC1155MetadataURI-uri}.
This implementation returns the concatenation of the _baseURI
and the token-specific uri if the latter is set
This enables the following behaviors:
- if
_tokenURIs[tokenId]is set, then the result is the concatenation of_baseURIand_tokenURIs[tokenId](keep in mind that_baseURIis empty per default); - if
_tokenURIs[tokenId]is NOT set then we fallback tosuper.uri()which in most cases will containERC1155._uri; - if
_tokenURIs[tokenId]is NOT set, and if the parents do not have a uri value set, then the result is empty.*
function uri(uint256 tokenId) public view virtual override returns (string memory);
_setURI
Sets tokenURI as the tokenURI of tokenId.
function _setURI(uint256 tokenId, string memory tokenURI) internal virtual;
_setBaseURI
Sets baseURI as the _baseURI for all tokens
function _setBaseURI(string memory baseURI) internal virtual;