Solidity API
IliadDCA
ERC721 Digital Certificate of Authenticity (DCA) contract with primary and backup URIs and failover capabilities.
State variables
| Name | Type | Description |
|---|---|---|
switchDate | uint256 | UNIX timestamp when the DCA switches to the backup URI. |
primaryBaseURI | string | Base URI before the switch date. |
backupBaseURI | string | Base URI after the switch date. |
_tokenIdCounter | uint256 | Sequential counter for new token IDs. |
_tokenPath | uint256→string | Custom path segment for each token’s metadata. |
_tokenLocked | uint256→bool | Lock status per token; locked tokens cannot transfer. |
baseContractURI | string | Primary contract-level metadata URI. |
backupContractURI | string | Fallback contract-level metadata URI. |
Events
| Event | Parameters | Description |
|---|---|---|
Minted | to: address, tokenId: uint256, tokenPath: string | Emitted when a new DCA token is minted. |
BaseURISet | newBaseURI: string | Emitted when the primary base URI is updated. |
BackupURISet | newBackupBaseURI: string | Emitted when the backup base URI is updated. |
ContractURISet | newURI: string | Emitted when the primary contract URI is set. |
BackupContractURISet | newBackupURI: string | Emitted when the backup contract URI is set. |
SwitchDateUpdated | newSwitchDate: uint256 | Emitted when the failover switch date changes. |
TokenBurned | tokenId: uint256 | Emitted when a token is burned. |
Locked | tokenId: uint256 | Emitted when a token is locked. |
Unlocked | tokenId: uint256 | Emitted 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
| Name | Type | Description |
|---|---|---|
| initialBaseURI | string | The initial primary base URI for token metadata. |
| initialBackupBaseURI | string | The initial backup base URI used after switch date. |
| initialSwitchDate | uint256 | UNIX timestamp at which the contract will begin using the backup URI. |
Returns
| Type | Description |
|---|---|
— | — |
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
| Name | Type | Description |
|---|---|---|
| to | address | Recipient address of the minted token. |
| tokenPath | string | Path segment appended to the active base URI for this token. |
Returns
| Type | Description |
|---|---|
— | — |
Mutability:
nonpayable
lockToken
function lockToken(uint256 tokenId) external
Locks a token to prevent transfers until it is explicitly unlocked by the owner.
Parameters
| Name | Type | Description |
|---|---|---|
| tokenId | uint256 | The ID of the token to lock. |
Returns
| Type | Description |
|---|---|
— | — |
Mutability:
nonpayable
unlockToken
function unlockToken(uint256 tokenId) external
Unlocks a previously locked token, re-enabling transfers.
Parameters
| Name | Type | Description |
|---|---|---|
| tokenId | uint256 | The ID of the token to unlock. |
Returns
| Type | Description |
|---|---|
— | — |
Mutability:
nonpayable
isLocked
function isLocked(uint256 tokenId) external view returns (bool)
Check if a specific token is currently locked.
Parameters
| Name | Type | Description |
|---|---|---|
| tokenId | uint256 | Token ID to check lock status. |
Return Values
| Name | Type | Description |
|---|---|---|
| [0] | bool | Boolean indicating locked (true) or unlocked (false) state. |
Returns
| Type | Description |
|---|---|
— | — |
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
| Name | Type | Description |
|---|---|---|
| to | address | Address receiving the token. |
| tokenId | uint256 | The ID of the token being transferred. |
| auth | address | Address initiating the transfer (owner or approved). |
Return Values
| Name | Type | Description |
|---|---|---|
| [0] | address | The address authorized to receive the token (from parent). |
Returns
| Type | Description |
|---|---|
— | — |
Mutability:
nonpayable
burn
function burn(uint256 tokenId) external
Burns (permanently destroys) a token and clears its custom path.
Parameters
| Name | Type | Description |
|---|---|---|
| tokenId | uint256 | The ID of the token to burn. |
Returns
| Type | Description |
|---|---|
— | — |
Mutability:
nonpayable
setPrimaryBaseURI
function setPrimaryBaseURI(string newPrimaryBaseURI) external
Updates the primary base URI used for token metadata.
Parameters
| Name | Type | Description |
|---|---|---|
| newPrimaryBaseURI | string | The new primary base URI string. |
Returns
| Type | Description |
|---|---|
— | — |
Mutability:
nonpayable
setBackupBaseURI
function setBackupBaseURI(string newBackupBaseURI) external
Updates the backup base URI used after the switch date.
Parameters
| Name | Type | Description |
|---|---|---|
| newBackupBaseURI | string | The new backup base URI string. |
Returns
| Type | Description |
|---|---|
— | — |
Mutability:
nonpayable
setSwitchDate
function setSwitchDate(uint256 newSwitchDate) external
Sets a new timestamp at which the backup URI becomes active.
Parameters
| Name | Type | Description |
|---|---|---|
| newSwitchDate | uint256 | UNIX timestamp (must be in the future). |
Returns
| Type | Description |
|---|---|
— | — |
Mutability:
nonpayable
getPrimaryBaseURI
function getPrimaryBaseURI() external view returns (string)
Returns the current primary base URI for tokens.
Return Values
| Name | Type | Description |
|---|---|---|
| [0] | string | The primary base URI string. |
Returns
| Type | Description |
|---|---|
— | — |
Mutability:
view
getBackupBaseURI
function getBackupBaseURI() external view returns (string)
Returns the current backup base URI for tokens.
Return Values
| Name | Type | Description |
|---|---|---|
| [0] | string | The backup base URI string. |
Returns
| Type | Description |
|---|---|
— | — |
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
| Name | Type | Description |
|---|---|---|
| [0] | string | The contract metadata URI. |
Returns
| Type | Description |
|---|---|
— | — |
Mutability:
view
setContractURI
function setContractURI(string newURI) external
Sets or updates the primary contract-level metadata URI.
Parameters
| Name | Type | Description |
|---|---|---|
| newURI | string | The new primary contract metadata URI string. |
Returns
| Type | Description |
|---|---|
— | — |
Mutability:
nonpayable
setBackupContractURI
function setBackupContractURI(string newBackupURI) external
Sets or updates the backup contract-level metadata URI.
Parameters
| Name | Type | Description |
|---|---|---|
| newBackupURI | string | The new backup contract metadata URI string. |
Returns
| Type | Description |
|---|---|
— | — |
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
| Name | Type | Description |
|---|---|---|
| tokenId | uint256 | The ID of the token whose URI is requested. |
Return Values
| Name | Type | Description |
|---|---|---|
| [0] | string | The assembled token URI string. |
Returns
| Type | Description |
|---|---|
— | — |
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
| Name | Type | Description |
|---|---|---|
| newImplementation | address | The address of the new implementation contract. |
Returns
| Type | Description |
|---|---|
— | — |
Mutability:
nonpayable