Solidity API

IliadDCA

ERC721 Digital Certificate of Authenticity (DCA) contract with primary and backup URIs and failover capabilities.

State variables

NameTypeDescription
switchDateuint256UNIX timestamp when the DCA switches to the backup URI.
primaryBaseURIstringBase URI before the switch date.
backupBaseURIstringBase URI after the switch date.
_tokenIdCounteruint256Sequential counter for new token IDs.
_tokenPathuint256→stringCustom path segment for each token’s metadata.
_tokenLockeduint256→boolLock status per token; locked tokens cannot transfer.
baseContractURIstringPrimary contract-level metadata URI.
backupContractURIstringFallback contract-level metadata URI.

Events

EventParametersDescription
Mintedto: address, tokenId: uint256, tokenPath: stringEmitted when a new DCA token is minted.
BaseURISetnewBaseURI: stringEmitted when the primary base URI is updated.
BackupURISetnewBackupBaseURI: stringEmitted when the backup base URI is updated.
ContractURISetnewURI: stringEmitted when the primary contract URI is set.
BackupContractURISetnewBackupURI: stringEmitted when the backup contract URI is set.
SwitchDateUpdatednewSwitchDate: uint256Emitted when the failover switch date changes.
TokenBurnedtokenId: uint256Emitted when a token is burned.
LockedtokenId: uint256Emitted when a token is locked.
UnlockedtokenId: uint256Emitted when a token is unlocked.

Functions

initialize

function initialize(string initialBaseURI, string initialBackupBaseURI, uint256 initialSwitchDate) public

Initializes the DCA contract with primary and backup URIs and a switch date.

Parameters

NameTypeDescription
initialBaseURIstringThe initial primary base URI for token metadata.
initialBackupBaseURIstringThe initial backup base URI used after switch date.
initialSwitchDateuint256UNIX timestamp at which the contract will begin using the backup URI.

Returns

TypeDescription

Mutability: nonpayable

mint

function mint(address to, string tokenPath) external

Mints a new DCA token to the given address with a custom URI path.

Parameters

NameTypeDescription
toaddressRecipient address of the minted token.
tokenPathstringPath segment appended to the active base URI for this token.

Returns

TypeDescription

Mutability: nonpayable

lockToken

function lockToken(uint256 tokenId) external

Locks a token to prevent transfers until it is explicitly unlocked by the owner.

Parameters

NameTypeDescription
tokenIduint256The ID of the token to lock.

Returns

TypeDescription

Mutability: nonpayable

unlockToken

function unlockToken(uint256 tokenId) external

Unlocks a previously locked token, re-enabling transfers.

Parameters

NameTypeDescription
tokenIduint256The ID of the token to unlock.

Returns

TypeDescription

Mutability: nonpayable

isLocked

function isLocked(uint256 tokenId) external view returns (bool)

Check if a specific token is currently locked.

Parameters

NameTypeDescription
tokenIduint256Token ID to check lock status.

Return Values

NameTypeDescription
[0]boolBoolean indicating locked (true) or unlocked (false) state.

Returns

TypeDescription

Mutability: view

_update

function _update(address to, uint256 tokenId, address auth) internal virtual returns (address)

[internal] Enforces lock state on token transfers.

_Overrides ERC721Upgradeable’s update to revert if the token is locked.

Parameters

NameTypeDescription
toaddressAddress receiving the token.
tokenIduint256The ID of the token being transferred.
authaddressAddress initiating the transfer (owner or approved).

Return Values

NameTypeDescription
[0]addressThe address authorized to receive the token (from parent).

Returns

TypeDescription

Mutability: nonpayable

burn

function burn(uint256 tokenId) external

Burns (permanently destroys) a token and clears its custom path.

Parameters

NameTypeDescription
tokenIduint256The ID of the token to burn.

Returns

TypeDescription

Mutability: nonpayable

setPrimaryBaseURI

function setPrimaryBaseURI(string newPrimaryBaseURI) external

Updates the primary base URI used for token metadata.

Parameters

NameTypeDescription
newPrimaryBaseURIstringThe new primary base URI string.

Returns

TypeDescription

Mutability: nonpayable

setBackupBaseURI

function setBackupBaseURI(string newBackupBaseURI) external

Updates the backup base URI used after the switch date.

Parameters

NameTypeDescription
newBackupBaseURIstringThe new backup base URI string.

Returns

TypeDescription

Mutability: nonpayable

setSwitchDate

function setSwitchDate(uint256 newSwitchDate) external

Sets a new timestamp at which the backup URI becomes active.

Parameters

NameTypeDescription
newSwitchDateuint256UNIX timestamp (must be in the future).

Returns

TypeDescription

Mutability: nonpayable

getPrimaryBaseURI

function getPrimaryBaseURI() external view returns (string)

Returns the current primary base URI for tokens.

Return Values

NameTypeDescription
[0]stringThe primary base URI string.

Returns

TypeDescription

Mutability: view

getBackupBaseURI

function getBackupBaseURI() external view returns (string)

Returns the current backup base URI for tokens.

Return Values

NameTypeDescription
[0]stringThe backup base URI string.

Returns

TypeDescription

Mutability: view

contractURI

function contractURI() public view returns (string)

Returns the active contract-level metadata URI.

If baseContractURI is non-empty, returns that; otherwise returns backupContractURI.

Return Values

NameTypeDescription
[0]stringThe contract metadata URI.

Returns

TypeDescription

Mutability: view

setContractURI

function setContractURI(string newURI) external

Sets or updates the primary contract-level metadata URI.

Parameters

NameTypeDescription
newURIstringThe new primary contract metadata URI string.

Returns

TypeDescription

Mutability: nonpayable

setBackupContractURI

function setBackupContractURI(string newBackupURI) external

Sets or updates the backup contract-level metadata URI.

Parameters

NameTypeDescription
newBackupURIstringThe new backup contract metadata URI string.

Returns

TypeDescription

Mutability: nonpayable

tokenURI

function tokenURI(uint256 tokenId) public view returns (string)

Returns the full token URI for a given token ID, switching between primary and backup URIs based on the current timestamp.

Parameters

NameTypeDescription
tokenIduint256The ID of the token whose URI is requested.

Return Values

NameTypeDescription
[0]stringThe assembled token URI string.

Returns

TypeDescription

Mutability: view

_authorizeUpgrade

function _authorizeUpgrade(address newImplementation) internal

[internal] Authorizes a UUPS upgrade to a new implementation.

Overrides UUPSUpgradeable authorization and restricts upgrades to the contract owner.

Parameters

NameTypeDescription
newImplementationaddressThe address of the new implementation contract.

Returns

TypeDescription

Mutability: nonpayable

Was this page helpful?