ERC1155URIStorageUpgradeable
Inherits: Initializable, ERC1155Upgradeable
ERC-1155 token with storage based token URI management. Inspired by the {ERC721URIStorage} extension
State Variables
ERC1155URIStorageStorageLocation
bytes32 private constant ERC1155URIStorageStorageLocation =
0x89fc852226e759c7c636cf34d732f0198fc56a54876b2374a52beb7b0c558600;
Functions
_getERC1155URIStorageStorage
function _getERC1155URIStorageStorage() private pure returns (ERC1155URIStorageStorage storage $);
__ERC1155URIStorage_init
function __ERC1155URIStorage_init() internal onlyInitializing;
__ERC1155URIStorage_init_unchained
function __ERC1155URIStorage_init_unchained() internal onlyInitializing;
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_baseURI
and_tokenURIs[tokenId]
(keep in mind that_baseURI
is 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;
Structs
ERC1155URIStorageStorage
Note: storage-location: erc7201:openzeppelin.storage.ERC1155URIStorage
struct ERC1155URIStorageStorage {
string _baseURI;
mapping(uint256 tokenId => string) _tokenURIs;
}