ERC1155URIStorage
Inherits: IERC1155URIStorage
Title: ERC1155URIStorage
Author: Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC1155/extensions/ERC1155URIStorage.sol)
Stateless Diamond facet for ERC-1155 per-token URIs with an optional base URI.
Owns ONLY its own selectors: the admin setters setURI and setBaseURI (new) and uri(uint256), which
REPLACES the base ERC1155 variant to read per-token URI storage. It does NOT inherit the ERC1155 facet;
that would re-export the base surface and collide with the standalone ERC1155 facet in a diamond. The
ERC-1155 base surface comes from a separately cut ERC1155 facet, and DeployERC1155URIStorage composes
both with a mixed Add/Replace cut. The setters are gated on DEFAULT_ADMIN_ROLE. Pure delegator.
Notes:
- lattice-version: 0.5.0
- lattice-source: OpenZeppelin v5.6.1
Functions
uri
Returns the URI for token type tokenId: the base URI followed by the per-token URI when one is
set, otherwise the ERC-1155 URI template.
Replaces the base ERC1155 uri (0x0e89341c).
function uri(uint256 tokenId) public view virtual returns (string memory);Parameters
| Name | Type | Description |
|---|---|---|
| tokenId | uint256 |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | string |
setURI
Sets tokenURI as the per-token URI of tokenId and emits URI(uri(tokenId), tokenId).
An empty tokenURI clears the entry, so uri(tokenId) falls back to the ERC-1155 URI template.
function setURI(uint256 tokenId, string calldata tokenURI) public virtual;Parameters
| Name | Type | Description |
|---|---|---|
| tokenId | uint256 | |
| tokenURI | string |
setBaseURI
Sets the prefix that uri(tokenId) prepends to every non-empty per-token URI.
Emits no event, as in OpenZeppelin: URI is per id, and a base change touches every id.
function setBaseURI(string calldata baseURI) public virtual;Parameters
| Name | Type | Description |
|---|---|---|
| baseURI | string |
exportSelectors
ERC-8153 selector export: this facet's cuttable selectors, tightly packed (4 bytes each).
Excludes exportSelectors() itself (0x0ef22643) - it is never cut into a diamond. Order matches
forge inspect ERC1155URIStorage methodIdentifiers (alphabetical by signature); kept in exact parity
by ExportSelectorsParityTest. Chunks:
setBaseURI(string) 0x55f804b3
setURI(uint256,string) 0x862440e2
uri(uint256) 0x0e89341c
function exportSelectors() external pure virtual returns (bytes memory selectors);Returns
| Name | Type | Description |
|---|---|---|
| selectors | bytes |