Description

Similar to the ERC-712 metadata extension, this extension enables associating a unique URI per token id.

Interface

Querying a token URI

/**
 * @dev Returns the Uniform Resource Identifier (URI) for `id` token.
 */
function tokenURI(uint256 id) external view returns (string memory);

Event

/**
 * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.
 */
event URI(uint256 indexed id, string value);

Implementation

Setting a token URI

/**
 * @dev Sets `_tokenURI` as the token URI for the tokens of type `id`.
 *
 */
function _setTokenURI(uint256 id, string memory _tokenURI)

Setting token URIs for a batch

/**
 * @dev [Batched] version of {_setTokenURI}.
 *
 */
function _setBatchTokenURI(uint256[] memory ids, string[] memory tokenURIs)

Deleting a token URI

/**
 * @dev Deletes the tokenURI for the tokens of type `id`.
 *
 * Requirements:
 *  - A token URI must be set.
 *
 *  Possible improvement:
 *  - The URI can only be deleted if all tokens of type `id` have been burned.
 */
function _deleteTokenURI(uint256 id)