Set

Sets are the objects from which other objects are created.

All set objects originate from a special object called the Set of Sets, which is governed by the Set Registry contract. The Set of Sets itself is considered to have been created from its own structure.

Each set adheres to the Kind of Set, which defines the structure, interactions, and asset computations of set objects.

During the early stages of the universe, several original sets, including the Set of Sets, were created. From that point onward, more objects were either directly or indirectly created from these sets.

Creation

Set objects are created unpon registration, they are initialized as follows:

id

For original sets, the id field is predefined by constants in the protocol:

uint64 constant ID_SET_OF_SPACE     = 0;
uint64 constant ID_SET_OF_SET       = 1;
uint64 constant ID_SET_OF_KIND      = 2;
uint64 constant ID_SET_OF_RELATION  = 3;
uint64 constant ID_SET_OF_TRANSFORM = 4;

For emergent sets, created dynamically later, their IDs are allocated from a specific range:

uint64 constant ID_SET_EMERGENT_MIN = 17;
uint64 constant ID_SET_EMERGENT_MAX = type(uint56).max;

The ID is constrained to values no greater than 2^56 - 1 to ensure that the upper 8 bits of the uint64 remain unset. This applies to all meta objects, allowing combination with an 8-bit category value to form an efficient uint64 identifier.

meta

The meta field is initialized in the following manner, applicable to both original and emergent sets.

meta.flags      = 0;
meta.rev        = 1;
meta.kindRev    = latestKindOfSet();    // The latest revision of the Kind of Set
meta.setRev     = latestSetOfSet();     // The latest revision of the Set of Sets
meta.kind       = ID_KIND_OF_SET;
meta.set        = ID_SET_OF_SET;

Since the kind and set objects always point to their latest revisions, the revision numbers for these fields might be incremented for later-created sets.

elems

According to the Kind of Set, a set object is composed of two elements:

ElementAliasMutableDescription
elems[0]lawNThe address of the set contract.
elems[1]lineageYThe material hash of data shared by all objects.

All elements should be provided upon registration, the law element cannot be changed once it is set.

law

The law element is the address of the set contract. For Ethereum-based chains, it can be encoded as bytes32 from an address:

bytes32 law = bytes32(uint160(addr));

linage

The linage element is the material hash representing the shared data for all objects from this set.

This data is typically utilized in the kind contract, and its format—both content type and structure—should conform to what the kind contract expects. The exact design is at the user’s discretion.

For example, in a typical scenario, the material might be required in JSON format and include 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): Additional fields specific to the set.

Operations

Interoperations are not applicable to set objects, but all unary operations are supported and listed below:

OperationFields Affected
transferowner
updatemeta.rev, elems.linage
upgrademeta.rev, meta.kindRev, meta.setRev
touchmeta.rev