Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

ERC721URIStorage

Inherits: IERC4906, ERC721

ERC-721 token with storage based token URI management.

State Variables

ERC4906_INTERFACE_ID

bytes4 private constant ERC4906_INTERFACE_ID = bytes4(0x49064906);

_tokenURIs

mapping(uint256 tokenId => string) private _tokenURIs;

Functions

supportsInterface

Query if a contract implements an interface

Interface identification is specified in ERC-165. This function uses less than 30,000 gas.

function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721, IERC165) returns (bool);

Parameters

NameTypeDescription
interfaceIdbytes4

Returns

NameTypeDescription
<none>booltrue if the contract implements interfaceID and interfaceID is not 0xffffffff, false otherwise

tokenURI

A distinct Uniform Resource Identifier (URI) for a given asset.

Throws if _tokenId is not a valid NFT. URIs are defined in RFC 3986. The URI may point to a JSON file that conforms to the "ERC721 Metadata JSON Schema".

function tokenURI(uint256 tokenId) public view virtual override returns (string memory);

_setTokenURI

Sets _tokenURI as the tokenURI of tokenId. Emits {IERC4906-MetadataUpdate}.

function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal virtual;