Artifact

An Artifact element represents one or more non-fungible tokens (NFTs) on a universe chain. Artifacts standardize NFTs within the protocol, making them programmable on both universe chains and the Previous chain.

Before an artifact can be incorporated into objects, it must first be registered in the Element Registry. During registration, essential details such as the token standard, contract address, ID range, and associated materials must be provided.

Representation

The Artifact structure is defined as follows:

struct Value {
    uint64 token;
    uint64 id;
    uint128 amount;
}

Fields

TypeFieldDesc
uint64tokenThe identifier of the non-fungible token contract.
uint64id The ID of the non-fungible fungible token.
uint128amountThe amount of the non-fungible token, or 1 if not applicable.

The higher 8 bits of the token field are used to indicate the token standard. The lower 56 bits of the token field are an index to identify a specific token among all tokens registered under the same standard.

Token Standards

Currently supported standards for non-fungible tokens include:

Standard TypeStandard ValueDescription
TOKEN_STD_7213ERC-721-like token.
TOKEN_STD_11554ERC-1155-like tokens.

Additional token standards can be registered by users, allowing for future token types to be supported.

Encoding

Artifact can be encoded as a uint256 or a bytes32::

uint256 encoded1 = (uint256(token) << 192) | (uint256(id) << 128) | uint256(amount);
bytes32 encoded2 = bytes32((uint256(token) << 192) | (uint256(id) << 128) | uint256(amount));

Limitations

The id field is constrained to 64 bits, limiting the maximum ID value. In ERC-721 and ERC-1155 standards, the token ID is typically represented as a uint256, which allows for larger ID values compared to the protocol's 64-bit limit.

Additionally, the amount field is limited to 128 bits. This creates a constraint on the maximum token amount that can be represented, whereas the ERC-1155 and ERC-721 standards use a uint256 for amounts, providing a larger range for representing token quantities.