Set
Sets are objects from which other objects are minted.
Each set is created from a special set called the Set of Sets, governed by the Set Registry, a core contract of the protocol. All sets adhere to the Kind of Set, which defines the required elements that a set object must contain.
Several sets are established during the protocol’s deployment. All other objects—whether set objects or non-set objects—are created directly or indirectly from these original sets.
ID
The IDs of original sets are predefined by the protocol.
#![allow(unused)] fn main() { ID_SET_OF_SPACE = 0; ID_SET_OF_SET = 1; ID_SET_OF_KIND = 2; ID_SET_OF_RELATION = 3; ID_SET_OF_TRANSFORM = 4; }
The Ids of emergent sets are allocated by the Set Registry upon registration.
#![allow(unused)] fn main() { ID_EMERGENT_SETS_BEGIN = 17; }
State Meta
When a set is registered in the set registry, its initial metadata is defined as follows:
#![allow(unused)] fn main() { meta.flags = 0; meta.rev = 1; meta.kind_rev = latest_kind_rev(); meta.set_rev = latest_set_rev(); meta.kind_id = ID_KIND_OF_SET; meta.set_id = ID_SET_OF_SET; }
State Elements
According to the Kind of Set, a set object consists of two key elements: impl
and data
.
Element | Name | Type | Description |
---|---|---|---|
elems[0] | impl | Bytes32 | The address of the contract implementation on the universe chain. |
elems[1] | data | Bytes32 | The hash of the data material stored on the Previous chain. |
The impl
element cannot be changed once it is set.
impl
The impl
element refers to the set contract on the universe chain. For Ethereum-based chains, it is encoded as a bytes32
from an Ethereum address:
#![allow(unused)] fn main() { elems[0] = bytes32(uint160(address)) }
data
The data
element is a hash of a JSON material that includes fields such as:
- name: The name of the set.
- description: A brief description of the set.
- image (optional): A URL or reference to an image representing the set.
- ... (optional): Other fields defined by the set.
This material can be accessed and read by the kind contract on the Previous chain.
Operations
Set objects primarily serve as collections of other objects. Operations involving positioning or object-to-object relationships are not supported for sets.
Operation | Modifies | Supported |
---|---|---|
transfer | owner | Yes |
update | meta.rev , elems[1] | Yes |
upgrade | meta.rev , meta.kind_rev , meta.set_rev | Yes |
touch | meta.rev | Yes |
relate/unrelate | n/a | No |
move | n/a | No |
enter/leave | n/a | No |
jump/drop | n/a | No |