ERC721ATokenURIFacet
ERC721ATokenURIFacet
Implements the facet for managing token URIs for ERC 721 tokens, based on our ERC721A implementation. This is designed to be extensible in the future.
_mode0TokenURI
tokenURI
Returns the Uniform Resource Identifier (URI) for tokenId
token. Throws URIQueryForNonexistentToken
if tokenId
does not exist.
Parameters
tokenId
uint256
uint256 ID of the token to query.
Return Values
[0]
string
string URI of given token.
mode0BaseTokenURI
Returns the mode0BaseTokenURI which is used to construct the tokenURI
for mode 0 and overrides for other modes execpt 99. See setMode0BaseTokenURI
for details.
Return Values
[0]
string
string The base token URI which is used to create the final tokenURI
.
setMode0BaseTokenURI
Sets the baseTokenURI. When mode 0 is active or others are overriden, this is used as the base for the tokenURI. The tokenURI
is then composed of [mode0BaseTokenURI] + [string stored via setTokenURI
] Requires ROLE_ACCESS_CONTROL_ADMIN
membership.
Parameters
baseTokenURI_
string
The new baseTokenURI, which must end with a forward slash. Example: 'ipfs://' with the tokenURIs set as an IPFS hash.
refresh
bool
True to trigger a metadata refresh.
mode1BaseTokenURI
Returns the baseTokenURI which is used to construct the tokenURI
for mode 1. See setMode1BaseTokenURI
for details.
Return Values
[0]
string
string The baseTokenURI.
setMode1BaseTokenURI
Sets the baseTokenURI for mode 1 The {tokenURI} for mode 1 is composed of [mode1BaseTokenURI] + [tokenId] + '.json'. Requires ROLE_ACCESS_CONTROL_ADMIN
membership.
Parameters
baseTokenURI_
string
The new baseTokenURI for mode 1, which must end with a forward slash. Example: https://myserver.com/metadata/
refresh
bool
True to trigger a metadata refresh.
mode2BaseTokenURI
Returns the baseTokenURI which is used to construct the tokenURI
for mode 2. See setMode2BaseTokenURI
for details.
Return Values
[0]
string
string The baseTokenURI.
setMode2BaseTokenURI
Sets the baseTokenURI for mode 2. The {tokenURI} for mode 2 is composed by [mode2BaseTokenURI] + [thisContractsAddress] + '/' + [chainId] + '/' + [tokenId] + '.json'. Requires ROLE_ACCESS_CONTROL_ADMIN
membership.
Parameters
baseTokenURI_
string
The new baseTokenURI for mode 2, which must end with a forward slash. Example: https://meta.roji.io/
refresh
bool
True to trigger a metadata refresh.
defaultTokenURI
Returns the defaultTokenURI. Used when no other tokenURI is set or mode 99 is active.
Return Values
[0]
string
string The default token URI.
setDefaultTokenURI
Sets the setDefaultTokenURI. This should be a fully qualified URL or empy string or data URL. Requires ROLE_ACCESS_CONTROL_ADMIN
membership.
Parameters
tokenURI_
string
The new default token URI.
refresh
bool
True to trigger a metadata refresh.
setTokenURIMode
Sets the mode.
Parameters
mode
uint256
The new mode. Valid modes are 0, 1, 2 and 99. Other values will resolve to mode 0
refresh
bool
True to trigger a metadata refresh.
tokenURIMode
Returns the active tokenURI mode.
Return Values
[0]
uint256
uint256 The tokenURIMode.
setTokenURI
_Sets a specific tokenURI_
for tokenId
. This is the default for mode 0 and overrides mode 1 and 2
Requires ROLE_ADMIN_MINTING
membership._
Parameters
tokenId
uint256
The id of the token to set the URI for.
tokenURI_
string
The new token URI.
refresh
bool
True to trigger a metadata refresh.
Was this helpful?