ITokenURIFacetBase

ITokenURIFacetBase

Version 2 of the token URI implementation. This implementation combines various strategies and lets the user select the most appropriate one. Mode 99 forces the defaultURI. This could be used for pre reveal images. Mode 0 stores individual tokenID segments per tokenID, which are combined with the mode0BaseTokenURI to create the final tokenURI. Mode 1 uses the baseURI and an index, but is overriden if there is a tokenURI set. Mode 2 uses the ROJI metadata generator, but is overriden if there is a tokenURI set.

mode0BaseTokenURI

function mode0BaseTokenURI() external view returns (string)

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

Name
Type
Description

[0]

string

string The base token URI which is used to create the final tokenURI.

setMode0BaseTokenURI

function setMode0BaseTokenURI(string baseTokenURI_, bool refresh) external

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

Name
Type
Description

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

Name
Type
Description

[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

Name
Type
Description

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

Name
Type
Description

[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

Name
Type
Description

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

Name
Type
Description

[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

Name
Type
Description

tokenURI_

string

The new default token URI.

refresh

bool

True to trigger a metadata refresh.

setTokenURIMode

Sets the mode.

Parameters

Name
Type
Description

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

Name
Type
Description

[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

Name
Type
Description

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?