Every Protocol Periphery
Every Protocol enables intuitive, collaborative, secure, and rewarding onchain co-creation.
Every Protocol introduces the Object Token (or simply, object) — a next-gen token with structure, semantics, and interoperability. Each object has a kind, is minted from a set, and is composed of elements. Objects can interact with one another through relations defined at the kind level. Every aspect of an object can be created or developed by anyone, unlocking true onchain collaboration.
This repository hosts periphery contracts of the Every Protocol.
License
Every Protocol Periphery is licensed under the MIT License (MIT), See LICENSE.
Contents
Constraints
State Variables
MAX_KIND_ELEMENTS
uint256 constant MAX_KIND_ELEMENTS = 16
MAX_KIND_RELATIONS
uint256 constant MAX_KIND_RELATIONS = 16
MAX_RELATION_ADJACENCIES
uint256 constant MAX_RELATION_ADJACENCIES = 16
IdScheme
State Variables
SYSTEM_OBJECT_MAX
0~16 are reserved for system objects
uint64 constant SYSTEM_OBJECT_MAX = 16
PLAIN_OBJECT_UNSPECIFIED
uint64 constant PLAIN_OBJECT_UNSPECIFIED = 0
PLAIN_OBJECT_MIN
uint64 constant PLAIN_OBJECT_MIN = 1
PLAIN_OBJECT_USER_MIN
uint64 constant PLAIN_OBJECT_USER_MIN = 1
PLAIN_OBJECT_MAX
uint64 constant PLAIN_OBJECT_MAX = 0xFFFFFFFF_FFFFFFFE
PLAIN_OBJECT_ANY
uint64 constant PLAIN_OBJECT_ANY = 0xFFFFFFFF_FFFFFFFF
SEMANTIC_OBJECT_MIN
uint64 constant SEMANTIC_OBJECT_MIN = 1
SEMANTIC_OBJECT_SYSTEM_MAX
uint64 constant SEMANTIC_OBJECT_SYSTEM_MAX = 16
SEMANTIC_OBJECT_USER_MIN
uint64 constant SEMANTIC_OBJECT_USER_MIN = 17
SEMANTIC_OBJECT_MAX
uint64 constant SEMANTIC_OBJECT_MAX = 0x0000FFFF_FFFFFFFE
KindIds
State Variables
SET
uint64 constant SET = 1
KIND
uint64 constant KIND = 2
RELATION
uint64 constant RELATION = 3
VALUE
uint64 constant VALUE = 4
UNIQUE
uint64 constant UNIQUE = 5
USER_START
uint64 constant USER_START = 17
SetIds
State Variables
SET
uint64 constant SET = 1
KIND
uint64 constant KIND = 2
RELATION
uint64 constant RELATION = 3
VALUE
uint64 constant VALUE = 4
UNIQUE
uint64 constant UNIQUE = 5
USER_START
uint64 constant USER_START = 17
RelationIds
State Variables
USER_START
uint64 constant USER_START = 17
ValueIds
State Variables
NATIVE
uint64 constant NATIVE = 0
USER_START
uint64 constant USER_START = 17
UniqueIds
State Variables
USER_START
uint64 constant USER_START = 17
Revisions
State Variables
UNSPECIFIED
uint32 constant UNSPECIFIED = 0
LATEST
uint32 constant LATEST = 0
INITIAL
uint32 constant INITIAL = 1
Contents
MySet
Inherits: SetSolo, SetRegistryHook, SetRegistryAdmin
State Variables
_idAllocator
ObjectIdAuto.Storage internal _idAllocator
Functions
constructor
constructor(address setRegistry, uint64 kindId, uint32 kindRev) SetRegistryHook(setRegistry);
create
function create(address to, uint64 id0, bytes calldata data)
external
override
returns (uint64 id, Descriptor memory od);
update
function update(uint64 id, bytes calldata data) external override returns (Descriptor memory od);
supportsInterface
function supportsInterface(bytes4 interfaceId) external pure override(SetSolo, SetRegistryHook) returns (bool);
_objectURI
function _objectURI() internal view virtual override returns (string memory);
Errors
KindRevNotSpecified
error KindRevNotSpecified();
MySet1155
Inherits: ERC1155Compatible, SetRegistryHook, SetRegistryAdmin
State Variables
_idAllocator
ObjectIdAuto.Storage internal _idAllocator
Functions
constructor
constructor(address setRegistry, uint64 kindId, uint32 kindRev) SetRegistryHook(setRegistry);
create
function create(address to, uint64 id0, bytes calldata data)
external
override
returns (uint64 id, Descriptor memory od);
update
function update(uint64 id, bytes calldata data) external override returns (Descriptor memory od);
supportsInterface
function supportsInterface(bytes4 interfaceId)
external
pure
virtual
override(ERC1155Compatible, SetRegistryHook)
returns (bool);
_supportsInterface
function _supportsInterface(bytes4 interfaceId) internal pure virtual override returns (bool);
_objectURI
function _objectURI() internal view virtual override returns (string memory);
_tokenURI
function _tokenURI(uint64 id, uint32 rev) internal view virtual override returns (string memory);
_contractURI
function _contractURI() internal view virtual override returns (string memory);
Errors
KindRevNotSpecified
error KindRevNotSpecified();
MySet1155Minter
Inherits: MySet1155, ObjectMinterHook, ObjectMinterAdmin
Functions
constructor
constructor(address setRegistry, address objectMinter, uint64 kindId, uint32 kindRev)
MySet1155(setRegistry, kindId, kindRev)
ObjectMinterHook(objectMinter);
supportsInterface
function supportsInterface(bytes4 interfaceId) external pure override(MySet1155, ObjectMinterHook) returns (bool);
_mint
function _mint(address operator, address to, uint64 id0, uint256 context, bytes memory data)
internal
virtual
override
returns (uint64 id);
Contents
Contents
- IElementRegistry
- IKindRegistry
- IObjectAuthorization
- IObjectInteraction
- IObjectMinter
- IOmniRegistry
- IRelationRegistry
- ISetRegistry
- IUniqueRegistry
- IValueRegistry
IElementRegistry
Inherits: IValueRegistry, IUniqueRegistry
Element registration and management
IKindRegistry
Interface for managing and registering object kinds
Functions
kindRegister
Registers a new kind
function kindRegister(bytes32 code, bytes32 data, uint8[] memory elemSpec, uint64[] memory rels)
external
returns (uint64 id, Descriptor memory desc);
Parameters
| Name | Type | Description |
|---|---|---|
code | bytes32 | Code hash of the kind |
data | bytes32 | Data hash of the kind |
elemSpec | uint8[] | Element type layout for objects of this kind |
rels | uint64[] | Supported relation IDs |
Returns
| Name | Type | Description |
|---|---|---|
id | uint64 | New kind ID |
desc | Descriptor | Descriptor after registration |
kindUpdate
Updates code and/or data of an existing kind
function kindUpdate(uint64 id, bytes32 code, bytes32 data) external returns (Descriptor memory desc);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | Kind ID |
code | bytes32 | New code hash (0 = skip) |
data | bytes32 | New data hash (0 = skip) |
Returns
| Name | Type | Description |
|---|---|---|
desc | Descriptor | Updated descriptor |
kindUpdate
Updates supported relations of an existing kind
function kindUpdate(uint64 id, uint64[] memory rels) external returns (Descriptor memory desc);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | Kind ID |
rels | uint64[] | Updated relation list |
Returns
| Name | Type | Description |
|---|---|---|
desc | Descriptor | Updated descriptor |
kindUpdate
Updates code, data, and relations of an existing kind
function kindUpdate(uint64 id, bytes32 code, bytes32 data, uint64[] memory rels)
external
returns (Descriptor memory desc);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | Kind ID |
code | bytes32 | New code hash (0 = skip) |
data | bytes32 | New data hash (0 = skip) |
rels | uint64[] | Updated relation list |
Returns
| Name | Type | Description |
|---|---|---|
desc | Descriptor | Updated descriptor |
kindUpgrade
Upgrades kind/set revision of an existing kind
function kindUpgrade(uint64 id, uint32 kindRev, uint32 setRev) external returns (Descriptor memory desc);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | Kind ID |
kindRev | uint32 | New kind revision (0 = skip) |
setRev | uint32 | New set revision (0 = skip) |
Returns
| Name | Type | Description |
|---|---|---|
desc | Descriptor | Descriptor after upgrade |
kindTouch
Touches a kind (bumps revision with no content changes)
function kindTouch(uint64 id) external returns (Descriptor memory desc);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | Kind ID |
Returns
| Name | Type | Description |
|---|---|---|
desc | Descriptor | Descriptor after touch |
kindTransfer
Transfers ownership of a kind
function kindTransfer(uint64 id, address to) external returns (address from);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | Kind ID |
to | address | New owner address |
Returns
| Name | Type | Description |
|---|---|---|
from | address | Previous owner address |
kindRevision
Resolves and validates a specific revision
function kindRevision(uint64 id, uint32 rev0) external view returns (uint32 rev);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | Kind ID |
rev0 | uint32 | Revision to check (0 = latest) |
Returns
| Name | Type | Description |
|---|---|---|
rev | uint32 | Valid revision number (0 if not found) |
kindDescriptor
Returns the descriptor at a given revision
function kindDescriptor(uint64 id, uint32 rev0) external view returns (Descriptor memory desc);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | Kind ID |
rev0 | uint32 | Revision to query (0 = latest) |
Returns
| Name | Type | Description |
|---|---|---|
desc | Descriptor | Descriptor at that revision |
kindSnapshot
Returns descriptor and elements at a specific revision
function kindSnapshot(uint64 id, uint32 rev0) external view returns (Descriptor memory desc, bytes32[] memory elems);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | Kind ID |
rev0 | uint32 | Revision to query (0 = latest) |
Returns
| Name | Type | Description |
|---|---|---|
desc | Descriptor | Descriptor at the revision |
elems | bytes32[] | Element hashes of the kind at the revision |
kindOwner
Returns the current owner of a kind
function kindOwner(uint64 id) external view returns (address owner);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | Kind ID |
Returns
| Name | Type | Description |
|---|---|---|
owner | address | Owner address |
kindSota
Returns the latest descriptor and current owner of a kind
function kindSota(uint64 id) external view returns (Descriptor memory desc, address owner);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | Kind ID |
Returns
| Name | Type | Description |
|---|---|---|
desc | Descriptor | Latest descriptor |
owner | address | Current owner address |
kindStatus
Checks whether all specified kinds are active (rev > 0)
function kindStatus(uint64[] memory ids) external view returns (bool active);
Parameters
| Name | Type | Description |
|---|---|---|
ids | uint64[] | List of kind IDs |
Returns
| Name | Type | Description |
|---|---|---|
active | bool | True if all specified kinds exist and are active |
kindAdmit
Checks whether a kind at a given revision admits a specific relation
function kindAdmit(uint64 kind, uint32 rev, uint64 rel) external view returns (bool admit, uint32 relRev);
Parameters
| Name | Type | Description |
|---|---|---|
kind | uint64 | Kind ID |
rev | uint32 | Kind revision (0 = latest) |
rel | uint64 | Relation ID to check |
Returns
| Name | Type | Description |
|---|---|---|
admit | bool | Whether the relation is admitted |
relRev | uint32 | Specific relation revision admitted (0 = latest) |
Events
KindRegistered
Emitted when a new kind is registered
event KindRegistered(
uint64 id, Descriptor desc, bytes32 code, bytes32 data, uint8[] elemSpec, uint64[] rels, address owner
);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | Kind ID |
desc | Descriptor | Descriptor after registration |
code | bytes32 | Code hash associated with the kind |
data | bytes32 | Data hash associated with the kind |
elemSpec | uint8[] | Element type layout for objects of this kind |
rels | uint64[] | Supported relation IDs |
owner | address | Owner address of the kind |
KindUpdated
Emitted when a kind is updated
event KindUpdated(uint64 id, Descriptor desc, bytes32 code, bytes32 data, uint64[] rels);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | Kind ID |
desc | Descriptor | Updated descriptor |
code | bytes32 | Updated code hash |
data | bytes32 | Updated data hash |
rels | uint64[] | Updated supported relations |
KindUpgraded
Emitted when a kind is upgraded
event KindUpgraded(uint64 id, Descriptor desc);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | Kind ID |
desc | Descriptor | Descriptor after upgrade |
KindTouched
Emitted when a kind is touched (revision bump only)
event KindTouched(uint64 id, Descriptor desc);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | Kind ID |
desc | Descriptor | Descriptor after touch |
KindTransferred
Emitted when kind ownership is transferred
event KindTransferred(uint64 id, Descriptor desc, address from, address to);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | Kind ID |
desc | Descriptor | Descriptor after the transfer |
from | address | Previous owner |
to | address | New owner |
IObjectAuthorization
Handles fine-grained authorization for object relations.
Grants control who can initiate (from) or accept (to) object-to-object relations,
scoped by direction, relation ID, kind, and set.
Functions
grantFrom
Issues a grant to allow initiating relations from a tail object
function grantFrom(uint128 tail, RelationGrant memory grant) external;
Parameters
| Name | Type | Description |
|---|---|---|
tail | uint128 | Tail object ID |
grant | RelationGrant | Grant details |
revokeFrom
Revokes a previously issued from grant
function revokeFrom(uint128 tail, uint32 grantId) external;
Parameters
| Name | Type | Description |
|---|---|---|
tail | uint128 | Tail object ID |
grantId | uint32 | Grant ID to revoke |
grantTo
Issues a grant to allow accepting relations to a head object
function grantTo(uint128 head, RelationGrant memory grant) external;
Parameters
| Name | Type | Description |
|---|---|---|
head | uint128 | Head object ID |
grant | RelationGrant | Grant details |
revokeTo
Revokes a previously issued to grant
function revokeTo(uint128 head, uint32 grantId) external;
Parameters
| Name | Type | Description |
|---|---|---|
head | uint128 | Head object ID |
grantId | uint32 | Grant ID to revoke |
allowFrom
Checks whether a sender is authorized to initiate a relation from a tail object
function allowFrom(uint32 grantId, address sender, uint128 tail, uint64 rel, uint64 headKind, uint64 headSet)
external
view
returns (bool allowed);
Parameters
| Name | Type | Description |
|---|---|---|
grantId | uint32 | Grant ID to check |
sender | address | Address attempting the action |
tail | uint128 | Tail object ID |
rel | uint64 | Relation ID |
headKind | uint64 | Kind ID of the target (head) object |
headSet | uint64 | Set ID of the target (head) object |
Returns
| Name | Type | Description |
|---|---|---|
allowed | bool | True if authorized |
allowTo
Checks whether a sender is authorized to accept a relation to a head object
function allowTo(uint32 grantId, address sender, uint128 head, uint64 rel, uint64 tailKind, uint64 tailSet)
external
view
returns (bool allowed);
Parameters
| Name | Type | Description |
|---|---|---|
grantId | uint32 | Grant ID to check |
sender | address | Address attempting the action |
head | uint128 | Head object ID |
rel | uint64 | Relation ID |
tailKind | uint64 | Kind ID of the source (tail) object |
tailSet | uint64 | Set ID of the source (tail) object |
Returns
| Name | Type | Description |
|---|---|---|
allowed | bool | True if authorized |
Events
GrantFrom
Emitted when a grant is issued to authorize initiating a relation from a tail object
event GrantFrom(uint128 tail, RelationGrant grant);
Parameters
| Name | Type | Description |
|---|---|---|
tail | uint128 | Tail object ID (initiator) |
grant | RelationGrant | Grant definition |
RevokeFrom
Emitted when a grant from a tail object is revoked
event RevokeFrom(uint128 tail, uint32 grantId);
Parameters
| Name | Type | Description |
|---|---|---|
tail | uint128 | Tail object ID (initiator) |
grantId | uint32 | ID of the revoked grant |
GrantTo
Emitted when a grant is issued to authorize accepting a relation to a head object
event GrantTo(uint128 head, RelationGrant grant);
Parameters
| Name | Type | Description |
|---|---|---|
head | uint128 | Head object ID (receiver) |
grant | RelationGrant | Grant definition |
RevokeTo
Emitted when a grant to a head object is revoked
event RevokeTo(uint128 head, uint32 grantId);
Parameters
| Name | Type | Description |
|---|---|---|
head | uint128 | Head object ID (receiver) |
grantId | uint32 | ID of the revoked grant |
IObjectInteraction
Handles object interactions via directed relations (arcs).
Encodings:
- SID : {uint64 set | uint64 id} → uint128
- Node : {uint64 data | uint32 _ | uint32 grant | uint64 set | uint64 id} → uint256
- Arc : {uint64 data | uint64 rel | uint64 set | uint64 id} → uint256
Functions
relate
Links a tail object to a head object through a relation
function relate(uint256 tail, uint64 rel, uint256 head) external;
Parameters
| Name | Type | Description |
|---|---|---|
tail | uint256 | Encoded tail node |
rel | uint64 | Relation ID |
head | uint256 | Encoded head node |
unrelate
Unlinks a tail object from a head object
function unrelate(uint256 tail, uint64 rel, uint256 head) external;
Parameters
| Name | Type | Description |
|---|---|---|
tail | uint256 | Encoded tail node |
rel | uint64 | Relation ID |
head | uint256 | Encoded head node |
Events
Related
Emitted when a tail is linked to a head through a relation
event Related(uint128 head, Descriptor desc, uint256 arc);
Parameters
| Name | Type | Description |
|---|---|---|
head | uint128 | Encoded SID of the head object |
desc | Descriptor | Descriptor of the head after the relation |
arc | uint256 | Encoded incoming arc |
Related
Emitted when multiple tails are linked to a head
event Related(uint128 head, Descriptor desc, uint256[] arcs);
Parameters
| Name | Type | Description |
|---|---|---|
head | uint128 | Encoded SID of the head object |
desc | Descriptor | Descriptor of the head after the relations |
arcs | uint256[] | Array of encoded incoming arcs |
Unrelated
Emitted when a tail is unlinked from a head
event Unrelated(uint128 head, Descriptor desc, uint256 arc);
Parameters
| Name | Type | Description |
|---|---|---|
head | uint128 | Encoded SID of the head object |
desc | Descriptor | Descriptor of the head after unlinking |
arc | uint256 | Encoded incoming arc |
Unrelated
Emitted when multiple tails are unlinked from a head
event Unrelated(uint128 head, Descriptor desc, uint256[] arcs);
Parameters
| Name | Type | Description |
|---|---|---|
head | uint128 | Encoded SID of the head object |
desc | Descriptor | Descriptor of the head after unlinking |
arcs | uint256[] | Array of encoded incoming arcs |
IObjectMinter
Interface for minting objects with configurable policies
Functions
mint
Mint an object (public permission)
function mint(address to, address set, uint64 id) external payable;
Parameters
| Name | Type | Description |
|---|---|---|
to | address | The recipient address |
set | address | The set address |
id | uint64 | The object ID to mint |
mint
Mint an object with additional data
function mint(address to, address set, uint64 id, bytes memory data) external payable;
Parameters
| Name | Type | Description |
|---|---|---|
to | address | The recipient address |
set | address | The set address |
id | uint64 | The object ID to mint |
data | bytes | Additional mint data |
mint
Mint an object with allowlist proof
function mint(address to, address set, uint64 id, bytes memory auth, uint32 policy) external payable;
Parameters
| Name | Type | Description |
|---|---|---|
to | address | The recipient address |
set | address | The set address |
id | uint64 | The object ID to mint |
auth | bytes | ABI-encoded authorization data (see IMintAuthArgument) |
policy | uint32 | The policy index being used |
mint
Mint an object with allowlist proof and additional data
function mint(address to, address set, uint64 id, bytes memory data, bytes memory auth, uint32 policy)
external
payable;
Parameters
| Name | Type | Description |
|---|---|---|
to | address | The recipient address |
set | address | The set address |
id | uint64 | The object ID to mint |
data | bytes | Additional mint data |
auth | bytes | ABI-encoded authorization data (see IMintAuthArgument) |
policy | uint32 | The policy index being used |
mintPolicyAdd
Add a new mint policy (callable only by set contracts)
function mintPolicyAdd(MintPolicy memory policy) external returns (uint32 index);
Parameters
| Name | Type | Description |
|---|---|---|
policy | MintPolicy | The policy details to add |
Returns
| Name | Type | Description |
|---|---|---|
index | uint32 | The assigned policy index |
mintPolicyDisable
Disable a mint policy (callable only by set contracts)
function mintPolicyDisable(uint32 index) external;
Parameters
| Name | Type | Description |
|---|---|---|
index | uint32 | The policy index to disable |
mintPolicyEnable
Enable a mint policy (callable only by set contracts)
function mintPolicyEnable(uint32 index) external;
Parameters
| Name | Type | Description |
|---|---|---|
index | uint32 | The policy index to enable |
mintPolicyCount
Get number of mint policies for a set
function mintPolicyCount(address set) external view returns (uint256 count);
Parameters
| Name | Type | Description |
|---|---|---|
set | address | The set address to query |
Returns
| Name | Type | Description |
|---|---|---|
count | uint256 | Number of policies |
mintPolicyGet
Get mint policy by index
function mintPolicyGet(address set, uint32 index) external view returns (MintPolicy memory policy);
Parameters
| Name | Type | Description |
|---|---|---|
set | address | The set address |
index | uint32 | Policy index |
Returns
| Name | Type | Description |
|---|---|---|
policy | MintPolicy | The mint policy details |
mintPolicySearch
Search for applicable mint policy with permission mask
function mintPolicySearch(address set, uint64 id, uint8 mask) external view returns (MintPolicy memory policy);
Parameters
| Name | Type | Description |
|---|---|---|
set | address | The set address |
id | uint64 | The object ID to check |
mask | uint8 | Bitmask indicating which MintPermissionType values are included. Each bit corresponds to a permission type (e.g., bit 0 = Public, bit 1 = Allowlist, etc.). |
Returns
| Name | Type | Description |
|---|---|---|
policy | MintPolicy | The first matching mint policy |
mintPolicySearch
Search for applicable mint policy with offset and permission mask
function mintPolicySearch(address set, uint64 id, uint8 mask, uint32 offset)
external
view
returns (MintPolicy memory policy);
Parameters
| Name | Type | Description |
|---|---|---|
set | address | The set address |
id | uint64 | The object ID to check |
mask | uint8 | Bitmask indicating which MintPermissionType values are included. Each bit corresponds to a permission type (e.g., bit 0 = Public, bit 1 = Allowlist, etc.). |
offset | uint32 | Starting policy index to search from |
Returns
| Name | Type | Description |
|---|---|---|
policy | MintPolicy | The first matching mint policy |
Events
MintPolicyEnabled
Emitted when a mint policy is enabled
event MintPolicyEnabled(address set, MintPolicy policy);
Parameters
| Name | Type | Description |
|---|---|---|
set | address | The set address the policy applies to |
policy | MintPolicy | The enabled policy details |
MintPolicyDisabled
Emitted when a mint policy is disabled
event MintPolicyDisabled(address set, MintPolicy policy);
Parameters
| Name | Type | Description |
|---|---|---|
set | address | The set address the policy applies to |
policy | MintPolicy | The disabled policy details |
ObjectMinted
Emitted when an object is successfully minted
event ObjectMinted(
address set,
uint64 id,
address operator,
address to,
address currency,
uint96 payment,
address fundsRecipient,
uint96 funds,
address feeRecipient,
uint96 fee
);
Parameters
| Name | Type | Description |
|---|---|---|
set | address | The address of the set contract the object is minted from |
id | uint64 | The ID of the minted object within the set |
operator | address | The address that initiated the mint (usually msg.sender) |
to | address | The recipient address receiving the minted object |
currency | address | The address of the payment token (native or ERC20) |
payment | uint96 | The total payment (includes both fee and funds) |
fundsRecipient | address | The address receiving the creator or project revenue |
funds | uint96 | The amount sent to the fundsRecipient |
feeRecipient | address | The address receiving the protocol fee |
fee | uint96 | The amount sent to the feeRecipient |
IOmniRegistry
Inherits: IRelationRegistry, IObjectAuthorization, IObjectInteraction
Interface for object interactions
IRelationRegistry
Interface for registering and managing relations
Functions
relationRegister
Registers a new relation
function relationRegister(address code, bytes32 data, RelationRule memory rule, Adjacency[] memory adjs)
external
returns (uint64 id, Descriptor memory desc);
Parameters
| Name | Type | Description |
|---|---|---|
code | address | Optional logic contract address |
data | bytes32 | Hash of the relation’s associated data |
rule | RelationRule | Rule defining the behavior and constraints of the relation |
adjs | Adjacency[] | Array of tail kind admissibility and degree limits |
Returns
| Name | Type | Description |
|---|---|---|
id | uint64 | New relation ID |
desc | Descriptor | Descriptor after registration |
relationUpdate
Updates the data hash of a relation
function relationUpdate(uint64 id, bytes32 data) external returns (Descriptor memory desc);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | Relation ID |
data | bytes32 | New data hash |
Returns
| Name | Type | Description |
|---|---|---|
desc | Descriptor | Updated descriptor |
relationUpdate
Updates the data hash and adjacency configuration of a relation
function relationUpdate(uint64 id, bytes32 data, Adjacency[] memory adjs) external returns (Descriptor memory desc);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | Relation ID |
data | bytes32 | New data hash |
adjs | Adjacency[] | New array of adjacency rules |
Returns
| Name | Type | Description |
|---|---|---|
desc | Descriptor | Updated descriptor |
relationUpgrade
Upgrades the kind or set revision of a relation
function relationUpgrade(uint64 id, uint32 kindRev, uint32 setRev) external returns (Descriptor memory desc);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | Relation ID |
kindRev | uint32 | New kind revision (0 = no change) |
setRev | uint32 | New set revision (0 = no change) |
Returns
| Name | Type | Description |
|---|---|---|
desc | Descriptor | Descriptor after upgrade |
relationTouch
Touches a relation (bumps revision without modifying content)
function relationTouch(uint64 id) external returns (Descriptor memory desc);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | Relation ID |
Returns
| Name | Type | Description |
|---|---|---|
desc | Descriptor | Descriptor after touch |
relationTransfer
Transfers ownership of a relation to a new address
function relationTransfer(uint64 id, address to) external returns (address from);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | Relation ID |
to | address | New owner address |
Returns
| Name | Type | Description |
|---|---|---|
from | address | Previous owner address |
relationRevision
Resolves and validates a revision number
function relationRevision(uint64 id, uint32 rev0) external view returns (uint32 rev);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | Relation ID |
rev0 | uint32 | Requested revision (0 = latest) |
Returns
| Name | Type | Description |
|---|---|---|
rev | uint32 | Validated revision (0 if not found) |
relationDescriptor
Returns descriptor of a relation at a specific revision
function relationDescriptor(uint64 id, uint32 rev0) external view returns (Descriptor memory desc);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | Relation ID |
rev0 | uint32 | Revision to query (0 = latest) |
Returns
| Name | Type | Description |
|---|---|---|
desc | Descriptor | Descriptor at the specified revision |
relationSnapshot
Returns descriptor and packed elements at a specific revision
function relationSnapshot(uint64 id, uint32 rev0)
external
view
returns (Descriptor memory desc, bytes32[] memory elems);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | Relation ID |
rev0 | uint32 | Revision to query (0 = latest) |
Returns
| Name | Type | Description |
|---|---|---|
desc | Descriptor | Descriptor at the revision |
elems | bytes32[] | Elements at the revision |
relationOwner
Gets the current owner of a relation
function relationOwner(uint64 id) external view returns (address owner);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | Relation ID |
Returns
| Name | Type | Description |
|---|---|---|
owner | address | Address of the current owner |
relationSota
Returns the latest descriptor and current owner of a relation
function relationSota(uint64 id) external view returns (Descriptor memory desc, address owner);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | Relation ID |
Returns
| Name | Type | Description |
|---|---|---|
desc | Descriptor | Latest descriptor |
owner | address | Current owner |
relationStatus
Checks whether all specified relations are active (rev > 0)
function relationStatus(uint64[] memory ids) external view returns (bool active);
Parameters
| Name | Type | Description |
|---|---|---|
ids | uint64[] | Array of relation IDs |
Returns
| Name | Type | Description |
|---|---|---|
active | bool | True if all are valid and active |
relationRule
Returns the rule definition for a relation
function relationRule(uint64 id) external view returns (RelationRule memory rule);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | Relation ID |
Returns
| Name | Type | Description |
|---|---|---|
rule | RelationRule | Possession and linkage rule for the relation |
relationAdmit
Checks if a relation admits a specific kind as tail
function relationAdmit(uint64 id, uint32 rev, uint64 kind)
external
view
returns (bool admit, uint48 effKind, uint16 effDegs, uint48 totalKind, uint16 totalDegs);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | Relation ID |
rev | uint32 | Revision to check |
kind | uint64 | Tail kind ID to evaluate |
Returns
| Name | Type | Description |
|---|---|---|
admit | bool | Whether the kind is admitted |
effKind | uint48 | Matched kind (0 = wildcard match) |
effDegs | uint16 | Degree bounds for the matched kind |
totalKind | uint48 | Special marker for total-kind (2^48-1 if defined) |
totalDegs | uint16 | Degree bounds for the total-kind |
Events
RelationRegistered
Emitted when a new relation is registered
event RelationRegistered(
uint64 id, Descriptor desc, address code, bytes32 data, RelationRule rule, Adjacency[] adjs, address owner
);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | ID of the relation |
desc | Descriptor | Descriptor of the relation |
code | address | Optional logic contract address |
data | bytes32 | Hash of the associated metadata or logic |
rule | RelationRule | Relation rule defining interaction logic |
adjs | Adjacency[] | List of admitted tail kinds and degree constraints |
owner | address | Address of the relation's owner |
RelationUpdated
Emitted when a relation is updated
event RelationUpdated(uint64 id, Descriptor desc, bytes32 data);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | ID of the relation |
desc | Descriptor | Updated descriptor |
data | bytes32 | New data hash |
RelationUpdated
Emitted when a relation is updated
event RelationUpdated(uint64 id, Descriptor desc, bytes32 data, Adjacency[] adjs);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | ID of the relation |
desc | Descriptor | Updated descriptor |
data | bytes32 | New data hash |
adjs | Adjacency[] | List of admitted tail kinds and degree constraints |
RelationUpgraded
Emitted when a relation is upgraded (kind/set revision bumped)
event RelationUpgraded(uint64 id, Descriptor desc);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | ID of the relation |
desc | Descriptor | Descriptor after upgrade |
RelationTouched
Emitted when a relation is touched (revision incremented without content change)
event RelationTouched(uint64 id, Descriptor desc);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | ID of the relation |
desc | Descriptor | Descriptor after touch |
RelationTransferred
Emitted when ownership of a relation is transferred
event RelationTransferred(uint64 id, Descriptor desc, address from, address to);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | ID of the relation |
desc | Descriptor | Descriptor after the transfer |
from | address | Previous owner |
to | address | New owner |
ISetRegistry
Interface for registering and managing sets
Functions
setRegister
Registers a new set
function setRegister(bytes32 data) external returns (uint64 id, Descriptor memory desc);
Parameters
| Name | Type | Description |
|---|---|---|
data | bytes32 | Hash of external content (e.g. metadata or schema) |
Returns
| Name | Type | Description |
|---|---|---|
id | uint64 | ID of the new set |
desc | Descriptor | Descriptor after registration |
setUpdate
Updates the data hash of an existing set
function setUpdate(bytes32 data) external returns (uint64 id, Descriptor memory desc);
Parameters
| Name | Type | Description |
|---|---|---|
data | bytes32 | New data hash |
Returns
| Name | Type | Description |
|---|---|---|
id | uint64 | ID of the updated set |
desc | Descriptor | Updated descriptor |
setUpgrade
Upgrades the kind or set revision
function setUpgrade(uint32 kindRev, uint32 setRev) external returns (uint64 id, Descriptor memory desc);
Parameters
| Name | Type | Description |
|---|---|---|
kindRev | uint32 | New kind revision (0 to skip) |
setRev | uint32 | New set revision (0 to skip) |
Returns
| Name | Type | Description |
|---|---|---|
id | uint64 | ID of the set |
desc | Descriptor | Descriptor after upgrade |
setTouch
Touches a set (increments revision without any changes)
function setTouch() external returns (uint64 id, Descriptor memory desc);
Returns
| Name | Type | Description |
|---|---|---|
id | uint64 | ID of the set |
desc | Descriptor | Descriptor after touch |
setURI
Returns the URI template for objects in the given set
The returned template includes {id} and {rev} placeholders,
which clients should replace with the object ID and revision number
to construct the full object URI off-chain.
function setURI(uint64 id) external view returns (string memory uri);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | Set ID |
Returns
| Name | Type | Description |
|---|---|---|
uri | string | Template URI string for objects in the specified set |
setURI
Returns the fully resolved URI for a specific object in a set
Substitutes {id} and {rev} in the set’s URI template using the
provided object ID and revision.
function setURI(uint64 id, uint64 objId, uint32 objRev) external view returns (string memory uri);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | Set ID |
objId | uint64 | Object ID (within the set) |
objRev | uint32 | Object revision number |
Returns
| Name | Type | Description |
|---|---|---|
uri | string | Fully resolved URI string for the specified object revision |
setRevision
Resolves and validates a specific revision
function setRevision(uint64 id, uint32 rev0) external view returns (uint32 rev);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | Set ID |
rev0 | uint32 | Requested revision (0 = latest) |
Returns
| Name | Type | Description |
|---|---|---|
rev | uint32 | Validated revision (0 if not found) |
setDescriptor
Returns the descriptor at a given revision
function setDescriptor(uint64 id, uint32 rev0) external view returns (Descriptor memory desc);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | Set ID |
rev0 | uint32 | Revision to query (0 = latest) |
Returns
| Name | Type | Description |
|---|---|---|
desc | Descriptor | Descriptor of the set at the specified revision |
setSnapshot
Returns descriptor and elements of a set at a specific revision
function setSnapshot(uint64 id, uint32 rev0) external view returns (Descriptor memory desc, bytes32[] memory elems);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | Set ID |
rev0 | uint32 | Revision to query (0 = latest) |
Returns
| Name | Type | Description |
|---|---|---|
desc | Descriptor | Descriptor at the revision |
elems | bytes32[] | Packed element list |
setOwner
Returns the current owner of a set
function setOwner(uint64 id) external view returns (address owner);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | Set ID |
Returns
| Name | Type | Description |
|---|---|---|
owner | address | Owner address |
setSota
Returns the latest descriptor and current owner
function setSota(uint64 id) external view returns (Descriptor memory desc, address owner);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | Set ID |
Returns
| Name | Type | Description |
|---|---|---|
desc | Descriptor | Latest descriptor |
owner | address | Current owner |
setStatus
Checks whether all provided set IDs are active
function setStatus(uint64[] memory ids) external view returns (bool active);
Parameters
| Name | Type | Description |
|---|---|---|
ids | uint64[] | List of set IDs |
Returns
| Name | Type | Description |
|---|---|---|
active | bool | True if all sets have a revision > 0 |
setContract
Returns the contract address associated with a set
function setContract(uint64 id) external view returns (address code);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | Set ID |
Returns
| Name | Type | Description |
|---|---|---|
code | address | Address of the deployed contract |
Events
SetRegistered
Emitted when a new set is registered
event SetRegistered(uint64 id, Descriptor desc, address code, bytes32 data, address owner);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | ID of the new set |
desc | Descriptor | Set descriptor after registration |
code | address | Address of the associated set contract |
data | bytes32 | Hash of the associated matter (external content) |
owner | address | Owner address of the set |
SetUpdated
Emitted when a set is updated
event SetUpdated(uint64 id, Descriptor desc, bytes32 data);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | ID of the set |
desc | Descriptor | Updated descriptor |
data | bytes32 | New data hash |
SetUpgraded
Emitted when a set is upgraded
event SetUpgraded(uint64 id, Descriptor desc);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | ID of the set |
desc | Descriptor | Descriptor after upgrade |
SetTouched
Emitted when a set is touched (revision bumped without content change)
event SetTouched(uint64 id, Descriptor desc);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | ID of the set |
desc | Descriptor | Descriptor after touch |
IUniqueRegistry
Interface for registering and managing uniques
Functions
uniqueRegister
Registers a new unique token
function uniqueRegister(address code, bytes32 data, TokenStandard std, uint8 decimals, string memory symbol)
external
returns (uint64 id, Descriptor memory desc);
Parameters
| Name | Type | Description |
|---|---|---|
code | address | Address of the token contract |
data | bytes32 | Hash of the associated matter |
std | TokenStandard | Token standard (e.g. ERC721) |
decimals | uint8 | Number of decimals |
symbol | string | Display symbol (max 30 characters) |
Returns
| Name | Type | Description |
|---|---|---|
id | uint64 | ID of the new unique |
desc | Descriptor | Descriptor after registration |
uniqueUpdate
Updates the data hash of a unique
function uniqueUpdate(uint64 id, bytes32 data) external returns (Descriptor memory desc);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | Unique ID |
data | bytes32 | New data hash |
Returns
| Name | Type | Description |
|---|---|---|
desc | Descriptor | Updated descriptor |
uniqueUpdate
Updates the data hash and symbol of a unique
function uniqueUpdate(uint64 id, bytes32 data, string memory symbol) external returns (Descriptor memory desc);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | Unique ID |
data | bytes32 | New data hash |
symbol | string | New display symbol (max 30 characters) |
Returns
| Name | Type | Description |
|---|---|---|
desc | Descriptor | Updated descriptor |
uniqueUpgrade
Upgrades the kind and/or set revision of a unique
function uniqueUpgrade(uint64 id, uint32 kindRev, uint32 setRev) external returns (Descriptor memory desc);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | Unique ID |
kindRev | uint32 | New kind revision (0 = no change) |
setRev | uint32 | New set revision (0 = no change) |
Returns
| Name | Type | Description |
|---|---|---|
desc | Descriptor | Descriptor after upgrade |
uniqueTouch
Bumps the revision of a unique with no content change
function uniqueTouch(uint64 id) external returns (Descriptor memory desc);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | Unique ID |
Returns
| Name | Type | Description |
|---|---|---|
desc | Descriptor | Descriptor after touch |
uniqueTransfer
Transfers ownership of a unique token
function uniqueTransfer(uint64 id, address to) external returns (address from);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | Unique ID |
to | address | Address of the new owner |
Returns
| Name | Type | Description |
|---|---|---|
from | address | Address of the previous owner |
uniqueRevision
Resolves and validates a revision
function uniqueRevision(uint64 id, uint32 rev0) external view returns (uint32 rev);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | Unique ID |
rev0 | uint32 | Requested revision (0 = latest) |
Returns
| Name | Type | Description |
|---|---|---|
rev | uint32 | Resolved revision (0 = not found) |
uniqueDescriptor
Returns the descriptor at a given revision
function uniqueDescriptor(uint64 id, uint32 rev0) external view returns (Descriptor memory desc);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | Unique ID |
rev0 | uint32 | Revision to query (0 = latest) |
Returns
| Name | Type | Description |
|---|---|---|
desc | Descriptor | Descriptor at the specified revision |
uniqueSnapshot
Returns descriptor and elements at a specific revision
function uniqueSnapshot(uint64 id, uint32 rev0)
external
view
returns (Descriptor memory desc, bytes32[] memory elems);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | Unique ID |
rev0 | uint32 | Revision to query (0 = latest) |
Returns
| Name | Type | Description |
|---|---|---|
desc | Descriptor | Descriptor at the revision |
elems | bytes32[] | Elements at the revision |
uniqueOwner
Returns the current owner of a unique
function uniqueOwner(uint64 id) external view returns (address owner);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | Unique ID |
Returns
| Name | Type | Description |
|---|---|---|
owner | address | Address of the current owner |
uniqueSota
Returns the latest descriptor and current owner
function uniqueSota(uint64 id) external view returns (Descriptor memory desc, address owner);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | Unique ID |
Returns
| Name | Type | Description |
|---|---|---|
desc | Descriptor | Latest descriptor |
owner | address | Address of the current owner |
uniqueStatus
Checks whether all given uniques are active (revision > 0)
function uniqueStatus(uint64[] memory ids) external view returns (bool active);
Parameters
| Name | Type | Description |
|---|---|---|
ids | uint64[] | List of unique IDs |
Returns
| Name | Type | Description |
|---|---|---|
active | bool | True if all exist and are active |
Events
UniqueRegistered
Emitted when a new unique is registered
event UniqueRegistered(uint64 id, Descriptor desc, address code, bytes32 data, TokenSpec spec, address owner);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | Unique ID |
desc | Descriptor | Descriptor of the unique |
code | address | Token contract address |
data | bytes32 | Hash of the underlying asset (e.g., image, model, metadata) |
spec | TokenSpec | Token specification (standard, decimals, and symbol) |
owner | address | Address of the initial owner |
UniqueUpdated
Emitted when a unique is updated
event UniqueUpdated(uint64 id, Descriptor desc, bytes32 data, TokenSpec spec);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | Unique ID |
desc | Descriptor | Updated descriptor (same ID, new revision) |
data | bytes32 | New data hash representing the updated asset |
spec | TokenSpec | Updated or unchanged token specification |
UniqueUpgraded
Emitted when a unique is upgraded to a new revision
event UniqueUpgraded(uint64 id, Descriptor desc);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | Unique ID |
desc | Descriptor | Descriptor after the upgrade (revised kind/set refs) |
UniqueTouched
Emitted when a unique is touched (revision bumped with no content change)
event UniqueTouched(uint64 id, Descriptor desc);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | Unique ID |
desc | Descriptor | Descriptor after touch (updated revision only) |
UniqueTransferred
Emitted when ownership of a unique is transferred
event UniqueTransferred(uint64 id, Descriptor desc, address from, address to);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | Unique ID |
desc | Descriptor | Descriptor after the transfer |
from | address | Previous owner's address |
to | address | New owner's address |
IValueRegistry
Interface for registering and managing values
Functions
valueRegister
Registers a new value token
function valueRegister(address code, bytes32 data, TokenStandard std, uint8 decimals, string memory symbol)
external
returns (uint64 id, Descriptor memory desc);
Parameters
| Name | Type | Description |
|---|---|---|
code | address | Token contract address |
data | bytes32 | Hash of the underlying matter or metadata |
std | TokenStandard | Token standard (e.g. ERC20) |
decimals | uint8 | Token's decimal precision |
symbol | string | Display symbol (max 30 characters) |
Returns
| Name | Type | Description |
|---|---|---|
id | uint64 | New value ID |
desc | Descriptor | Descriptor after registration |
valueUpdate
Updates the data hash of an existing value
function valueUpdate(uint64 id, bytes32 data) external returns (Descriptor memory desc);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | Value ID |
data | bytes32 | New data hash |
Returns
| Name | Type | Description |
|---|---|---|
desc | Descriptor | Updated descriptor (revision bumped) |
valueUpdate
Updates the data hash and symbol of an existing value
function valueUpdate(uint64 id, bytes32 data, string memory symbol) external returns (Descriptor memory desc);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | Value ID |
data | bytes32 | New data hash |
symbol | string | New display symbol |
Returns
| Name | Type | Description |
|---|---|---|
desc | Descriptor | Updated descriptor |
valueUpgrade
Upgrades the kind/set revision of a value
function valueUpgrade(uint64 id, uint32 kindRev0, uint32 setRev0) external returns (Descriptor memory desc);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | Value ID |
kindRev0 | uint32 | New kind revision (0 = no change) |
setRev0 | uint32 | New set revision (0 = no change) |
Returns
| Name | Type | Description |
|---|---|---|
desc | Descriptor | Descriptor after upgrade |
valueTouch
Touches a value, bumping its revision without changing its content
function valueTouch(uint64 id) external returns (Descriptor memory desc);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | Value ID |
Returns
| Name | Type | Description |
|---|---|---|
desc | Descriptor | Descriptor after touch |
valueTransfer
Transfers ownership of a value to a new address
function valueTransfer(uint64 id, address to) external returns (address from);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | Value ID |
to | address | Address to transfer ownership to |
Returns
| Name | Type | Description |
|---|---|---|
from | address | Address of the previous owner |
valueRevision
Resolves and validates a revision of a value
function valueRevision(uint64 id, uint32 rev0) external view returns (uint32 rev);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | Value ID |
rev0 | uint32 | Requested revision (0 = latest) |
Returns
| Name | Type | Description |
|---|---|---|
rev | uint32 | Validated revision (0 = not found) |
valueDescriptor
Returns the descriptor of a value at a specific revision
function valueDescriptor(uint64 id, uint32 rev0) external view returns (Descriptor memory desc);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | Value ID |
rev0 | uint32 | Revision to query (0 = latest) |
Returns
| Name | Type | Description |
|---|---|---|
desc | Descriptor | Descriptor at the given revision |
valueSnapshot
Returns descriptor and elements of a value at a specific revision
function valueSnapshot(uint64 id, uint32 rev0)
external
view
returns (Descriptor memory desc, bytes32[] memory elems);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | Value ID |
rev0 | uint32 | Revision to query (0 = latest) |
Returns
| Name | Type | Description |
|---|---|---|
desc | Descriptor | Descriptor at the given revision |
elems | bytes32[] | Element values at the given revision |
valueOwner
Returns the current owner of a value
function valueOwner(uint64 id) external view returns (address owner);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | Value ID |
Returns
| Name | Type | Description |
|---|---|---|
owner | address | Current owner's address |
valueSota
Returns the latest descriptor and current owner of a value
function valueSota(uint64 id) external view returns (Descriptor memory desc, address owner);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | Value ID |
Returns
| Name | Type | Description |
|---|---|---|
desc | Descriptor | Latest descriptor |
owner | address | Current owner's address |
valueStatus
Checks whether all specified values are active (revision > 0)
function valueStatus(uint64[] memory ids) external view returns (bool active);
Parameters
| Name | Type | Description |
|---|---|---|
ids | uint64[] | Array of value IDs |
Returns
| Name | Type | Description |
|---|---|---|
active | bool | True if all values exist and are active |
Events
ValueRegistered
Emitted when a new value is registered
event ValueRegistered(uint64 id, Descriptor desc, address code, bytes32 data, TokenSpec spec, address owner);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | ID of the newly registered value |
desc | Descriptor | Descriptor of the value |
code | address | Token contract address |
data | bytes32 | Hash of the underlying asset or metadata |
spec | TokenSpec | Token specification (standard, decimals, symbol) |
owner | address | Address of the initial owner |
ValueUpdated
Emitted when a value is updated
event ValueUpdated(uint64 id, Descriptor desc, bytes32 data, TokenSpec spec);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | ID of the value |
desc | Descriptor | Updated descriptor (with bumped revision) |
data | bytes32 | New hash of the asset or metadata |
spec | TokenSpec | Updated or unchanged token specification |
ValueUpgraded
Emitted when a value is upgraded (revision of kind/set updated)
event ValueUpgraded(uint64 id, Descriptor desc);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | ID of the value |
desc | Descriptor | Descriptor after upgrade |
ValueTouched
Emitted when a value is touched (revision bump only, no content change)
event ValueTouched(uint64 id, Descriptor desc);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | ID of the value |
desc | Descriptor | Descriptor after touch |
ValueTransferred
Emitted when ownership of a value is transferred
event ValueTransferred(uint64 id, Descriptor desc, address from, address to);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | ID of the value |
desc | Descriptor | Descriptor after the transfer |
from | address | Previous owner address |
to | address | New owner address |
Contents
IERC1155
Inherits: IERC165
Required interface of an ERC-1155 compliant contract, as defined in the https://eips.ethereum.org/EIPS/eip-1155[ERC].
Functions
balanceOf
Returns the value of tokens of token type id owned by account.
function balanceOf(address account, uint256 id) external view returns (uint256);
balanceOfBatch
xref:ROOT:erc1155.adoc#batch-operations[Batched] version of balanceOf. Requirements:
accountsandidsmust have the same length.
function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)
external
view
returns (uint256[] memory);
setApprovalForAll
Grants or revokes permission to operator to transfer the caller's tokens, according to approved,
Emits an ApprovalForAll event.
Requirements:
operatorcannot be the zero address.
function setApprovalForAll(address operator, bool approved) external;
isApprovedForAll
Returns true if operator is approved to transfer account's tokens.
See setApprovalForAll.
function isApprovedForAll(address account, address operator) external view returns (bool);
safeTransferFrom
Transfers a value amount of tokens of type id from from to to.
WARNING: This function can potentially allow a reentrancy attack when transferring tokens
to an untrusted contract, when invoking {IERC1155Receiver-onERC1155Received} on the receiver.
Ensure to follow the checks-effects-interactions pattern and consider employing
reentrancy guards when interacting with untrusted contracts.
Emits a TransferSingle event.
Requirements:
tocannot be the zero address.- If the caller is not
from, it must have been approved to spendfrom's tokens via setApprovalForAll. frommust have a balance of tokens of typeidof at leastvalueamount.- If
torefers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the acceptance magic value.
function safeTransferFrom(address from, address to, uint256 id, uint256 value, bytes calldata data) external;
safeBatchTransferFrom
xref:ROOT:erc1155.adoc#batch-operations[Batched] version of safeTransferFrom. WARNING: This function can potentially allow a reentrancy attack when transferring tokens to an untrusted contract, when invoking {IERC1155Receiver-onERC1155BatchReceived} on the receiver. Ensure to follow the checks-effects-interactions pattern and consider employing reentrancy guards when interacting with untrusted contracts. Emits either a TransferSingle or a TransferBatch event, depending on the length of the array arguments. Requirements:
idsandvaluesmust have the same length.- If
torefers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the acceptance magic value.
function safeBatchTransferFrom(
address from,
address to,
uint256[] calldata ids,
uint256[] calldata values,
bytes calldata data
) external;
Events
TransferSingle
Emitted when value amount of tokens of type id are transferred from from to to by operator.
event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);
TransferBatch
Equivalent to multiple TransferSingle events, where operator, from and to are the same for all
transfers.
event TransferBatch(
address indexed operator, address indexed from, address indexed to, uint256[] ids, uint256[] values
);
ApprovalForAll
Emitted when account grants or revokes permission to operator to transfer their tokens, according to
approved.
event ApprovalForAll(address indexed account, address indexed operator, bool approved);
URI
Emitted when the URI for token type id changes to value, if it is a non-programmatic URI.
If an URI event was emitted for id, the standard
https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that value will equal the value
returned by IERC1155MetadataURI-uri.
event URI(string value, uint256 indexed id);
IERC1155MetadataURI
Inherits: IERC1155
Interface of the optional ERC1155MetadataExtension interface, as defined in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[ERC].
Functions
uri
Returns the URI for token type id.
If the \{id\} substring is present in the URI, it must be replaced by
clients with the actual token type ID.
function uri(uint256 id) external view returns (string memory);
IERC165
Interface of the ERC-165 standard, as defined in the https://eips.ethereum.org/EIPS/eip-165[ERC]. Implementers can declare support of contract interfaces, which can then be queried by others ({ERC165Checker}). For an implementation, see {ERC165}.
Functions
supportsInterface
Returns true if this contract implements the interface defined by
interfaceId. See the corresponding
https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]
to learn more about how these ids are created.
This function call must use less than 30 000 gas.
function supportsInterface(bytes4 interfaceId) external view returns (bool);
IERC20
Interface of the ERC-20 standard as defined in the ERC.
Functions
totalSupply
Returns the value of tokens in existence.
function totalSupply() external view returns (uint256);
balanceOf
Returns the value of tokens owned by account.
function balanceOf(address account) external view returns (uint256);
transfer
Moves a value amount of tokens from the caller's account to to.
Returns a boolean value indicating whether the operation succeeded.
Emits a Transfer event.
function transfer(address to, uint256 value) external returns (bool);
allowance
Returns the remaining number of tokens that spender will be
allowed to spend on behalf of owner through transferFrom. This is
zero by default.
This value changes when approve or transferFrom are called.
function allowance(address owner, address spender) external view returns (uint256);
approve
Sets a value amount of tokens as the allowance of spender over the
caller's tokens.
Returns a boolean value indicating whether the operation succeeded.
IMPORTANT: Beware that changing an allowance with this method brings the risk
that someone may use both the old and the new allowance by unfortunate
transaction ordering. One possible solution to mitigate this race
condition is to first reduce the spender's allowance to 0 and set the
desired value afterwards:
https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
Emits an Approval event.
function approve(address spender, uint256 value) external returns (bool);
transferFrom
Moves a value amount of tokens from from to to using the
allowance mechanism. value is then deducted from the caller's
allowance.
Returns a boolean value indicating whether the operation succeeded.
Emits a Transfer event.
function transferFrom(address from, address to, uint256 value) external returns (bool);
Events
Transfer
Emitted when value tokens are moved from one account (from) to
another (to).
Note that value may be zero.
event Transfer(address indexed from, address indexed to, uint256 value);
Approval
Emitted when the allowance of a spender for an owner is set by
a call to approve. value is the new allowance.
event Approval(address indexed owner, address indexed spender, uint256 value);
IERC20Metadata
Inherits: IERC20
Interface for the optional metadata functions from the ERC-20 standard.
Functions
name
Returns the name of the token.
function name() external view returns (string memory);
symbol
Returns the symbol of the token.
function symbol() external view returns (string memory);
decimals
Returns the decimals places of the token.
function decimals() external view returns (uint8);
IERC7572
ERC-7572 standard interface for exposing contract-level metadata via contractURI()
See https://eips.ethereum.org/EIPS/eip-7572
Functions
contractURI
Returns a URI pointing to contract-level metadata
The metadata should conform to a standard like OpenSea's contract-level metadata schema
function contractURI() external view returns (string memory uri_);
Returns
| Name | Type | Description |
|---|---|---|
uri_ | string | The contract metadata URI as a string |
Events
ContractURIUpdated
Emitted when the contract URI is updated
event ContractURIUpdated();
Contents
IInteroperable
Inherits: IERC165
Interface for set contracts that support object-level interoperability
Enables a set to respond to interactions involving its objects. These hooks are called before the action is finalized. Returning the expected value is required for the operation to proceed.
Functions
onObjectRelate
Hook called before an object from this set is linked to another object
function onObjectRelate(uint64 id, uint64 rel, uint64 data, uint64 tailSet, uint64 tailId, uint64 tailKind)
external
returns (Descriptor memory od);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | Object ID from this set (acts as the head) |
rel | uint64 | Relation ID |
data | uint64 | Encoded relation-specific data (optional, uint64) |
tailSet | uint64 | Set ID of the tail object |
tailId | uint64 | Object ID of the tail |
tailKind | uint64 | Kind ID of the tail object |
Returns
| Name | Type | Description |
|---|---|---|
od | Descriptor | Updated descriptor of the head object |
onObjectUnrelate
Hook called before an object from this set is unlinked from another object
function onObjectUnrelate(uint64 id, uint64 rel, uint64 data, uint64 tailSet, uint64 tailId, uint64 tailKind)
external
returns (Descriptor memory od);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | Object ID from this set (acts as the head) |
rel | uint64 | Relation ID |
data | uint64 | Encoded relation-specific data (optional, uint64) |
tailSet | uint64 | Set ID of the tail object |
tailId | uint64 | Object ID of the tail |
tailKind | uint64 | Kind ID of the tail object |
Returns
| Name | Type | Description |
|---|---|---|
od | Descriptor | Updated descriptor of the head object |
onObjectTransfer
Hook called before ownership of an object from this set is transferred as part of a relation or unrelation
function onObjectTransfer(uint64 id, address from, address to) external returns (bytes4 selector);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | Object ID being transferred |
from | address | Current owner address |
to | address | New owner address |
Returns
| Name | Type | Description |
|---|---|---|
selector | bytes4 | Must return onObjectTransfer.selector to confirm and proceed |
IObjectMinterHook
Inherits: IERC165
Interface for set contracts that support minting via ObjectMinter
Functions
onObjectMint
Called by ObjectMinter after payment is collected and before minting is finalized
- If
id0is 0, the contract must assign and return a new object ID. - If
id0is non-zero, the contract must validate and return the same ID. The call must returnonObjectMint.selectorto signal success.
function onObjectMint(address operator, address to, uint64 id0, uint256 context, bytes memory data)
external
returns (bytes4 selector, uint64 id);
Parameters
| Name | Type | Description |
|---|---|---|
operator | address | Caller who initiated the mint (typically msg.sender) |
to | address | Recipient of the minted object |
id0 | uint64 | Requested object ID (0 = auto-assign) |
context | uint256 | Packed 256-bit context for custom mint logic (see MintingContext) |
data | bytes | Arbitrary input payload for extensible logic |
Returns
| Name | Type | Description |
|---|---|---|
selector | bytes4 | Must return onObjectMint.selector to proceed |
id | uint64 | Final resolved object ID to be minted |
ISet
Inherits: IERC165
Core interface for set contracts
Functions
create
Create (mint) a new object
function create(address to, uint64 id0, bytes calldata data) external returns (uint64 id, Descriptor memory od);
Parameters
| Name | Type | Description |
|---|---|---|
to | address | Initial owner of the object |
id0 | uint64 | Requested object ID (0 = auto-assign) |
data | bytes | Encoded creation parameters |
Returns
| Name | Type | Description |
|---|---|---|
id | uint64 | Final resolved object ID |
od | Descriptor | Descriptor of the newly created object |
update
Update an existing object
function update(uint64 id, bytes calldata data) external returns (Descriptor memory od);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | Object ID to update |
data | bytes | Encoded update parameters |
Returns
| Name | Type | Description |
|---|---|---|
od | Descriptor | Descriptor after the update |
upgrade
Upgrade an object to a new kind or set revision
function upgrade(uint64 id, uint32 kindRev0, uint32 setRev0) external returns (Descriptor memory od);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | Object ID |
kindRev0 | uint32 | New kind revision (0 = no change) |
setRev0 | uint32 | New set revision (0 = no change) |
Returns
| Name | Type | Description |
|---|---|---|
od | Descriptor | Descriptor after upgrade |
touch
Touch an object to increment revision without content change
function touch(uint64 id) external returns (Descriptor memory od);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | Object ID |
Returns
| Name | Type | Description |
|---|---|---|
od | Descriptor | Descriptor after touch |
transfer
Transfer ownership of an object
function transfer(uint64 id, address to) external;
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | Object ID |
to | address | Address of the new owner |
owner
Get current owner of an object
function owner(uint64 id) external view returns (address owner_);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | Object ID |
Returns
| Name | Type | Description |
|---|---|---|
owner_ | address | Current owner address |
descriptor
Get descriptor at a specific revision
function descriptor(uint64 id, uint32 rev0) external view returns (Descriptor memory od);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | Object ID |
rev0 | uint32 | Revision number (0 = latest) |
Returns
| Name | Type | Description |
|---|---|---|
od | Descriptor | Descriptor at that revision |
snapshot
Get descriptor and elements at a specific revision
function snapshot(uint64 id, uint32 rev0) external view returns (Descriptor memory od, bytes32[] memory elems);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | Object ID |
rev0 | uint32 | Revision number to query (0 = latest) |
Returns
| Name | Type | Description |
|---|---|---|
od | Descriptor | Descriptor at the specified revision |
elems | bytes32[] | Elements at the specified revision |
uri
Get URI template for metadata
Client should replace {id} and {rev} placeholders
function uri() external view returns (string memory uri_);
Returns
| Name | Type | Description |
|---|---|---|
uri_ | string | URI template string |
Events
Created
Emitted when a new object is created
event Created(uint64 id, Descriptor od, bytes32[] elems, address owner);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | Object ID |
od | Descriptor | Object descriptor |
elems | bytes32[] | Elements of the object |
owner | address | Initial owner |
Updated
Emitted when an object is updated
event Updated(uint64 id, Descriptor od, bytes32[] elems);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | Object ID |
od | Descriptor | Updated descriptor |
elems | bytes32[] | Updated elements |
Upgraded
Emitted when an object is upgraded
event Upgraded(uint64 id, Descriptor od);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | Object ID |
od | Descriptor | Descriptor after upgrade |
Touched
Emitted when an object is touched (bumped without content change)
event Touched(uint64 id, Descriptor od);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | Object ID |
od | Descriptor | Latest descriptor |
Destroyed
Emitted when an object is destroyed
event Destroyed(uint64 id, Descriptor od);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | Object ID |
od | Descriptor | Descriptor before destruction |
Transferred
Emitted when ownership is transferred
event Transferred(uint64 id, Descriptor od, address from, address to);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | Object ID |
od | Descriptor | Descriptor after the transfer |
from | address | Previous owner |
to | address | New owner |
ISetRegistryHook
Inherits: IERC165
Interface for set contracts that respond to set lifecycle events.
These hooks are invoked by the SetRegistry before the respective action is finalized. The set must return the expected selector for the operation to proceed.
Functions
onSetRegister
Called before a set is registered.
function onSetRegister(uint64 set, Descriptor memory od) external returns (bytes4 selector);
Parameters
| Name | Type | Description |
|---|---|---|
set | uint64 | Set ID being registered. |
od | Descriptor | Initial descriptor of the set. |
Returns
| Name | Type | Description |
|---|---|---|
selector | bytes4 | Must return onSetRegister.selector to confirm the action. |
onSetUpdate
Called before a set is updated.
function onSetUpdate(uint64 set, Descriptor memory od) external returns (bytes4 selector);
Parameters
| Name | Type | Description |
|---|---|---|
set | uint64 | Set ID being updated. |
od | Descriptor | Updated descriptor of the set. |
Returns
| Name | Type | Description |
|---|---|---|
selector | bytes4 | Must return onSetUpdate.selector to confirm the action. |
onSetUpgrade
Called before a set is upgraded.
function onSetUpgrade(uint64 set, Descriptor memory od) external returns (bytes4 selector);
Parameters
| Name | Type | Description |
|---|---|---|
set | uint64 | Set ID being upgraded. |
od | Descriptor | Descriptor of the set after the upgrade. |
Returns
| Name | Type | Description |
|---|---|---|
selector | bytes4 | Must return onSetUpgrade.selector to confirm the action. |
onSetTouch
Called before a set is touched (bumped revision with no content change).
function onSetTouch(uint64 set, Descriptor memory od) external returns (bytes4 selector);
Parameters
| Name | Type | Description |
|---|---|---|
set | uint64 | Set ID being touched. |
od | Descriptor | Descriptor of the set after the touch. |
Returns
| Name | Type | Description |
|---|---|---|
selector | bytes4 | Must return onSetTouch.selector to confirm the action. |
ISoke
Interface for accessing the core registry contracts
Functions
setRegistry
Returns the address of the Set Registry contract
function setRegistry() external view returns (address setr);
Returns
| Name | Type | Description |
|---|---|---|
setr | address | Address of the Set Registry |
omniRegistry
Returns the address of the Omni Registry contract
function omniRegistry() external view returns (address omnir);
Returns
| Name | Type | Description |
|---|---|---|
omnir | address | Address of the Omni Registry |
kindRegistry
Returns the address of the Kind Registry contract
function kindRegistry() external view returns (address kindr);
Returns
| Name | Type | Description |
|---|---|---|
kindr | address | Address of the Kind Registry |
elementRegistry
Returns the address of the Element Registry contract
function elementRegistry() external view returns (address elemr);
Returns
| Name | Type | Description |
|---|---|---|
elemr | address | Address of the Element Registry |
Contents
- ObjectIdUnexpected
- ObjectIdMissing
- ObjectIdTaken
- ObjectIdAuto
- ObjectIdManual
- Counter48
- Counter64
- Packing
- Semver
- Snapshots
ObjectIdUnexpected
error ObjectIdUnexpected();
ObjectIdMissing
error ObjectIdMissing();
ObjectIdTaken
error ObjectIdTaken();
ObjectIdAuto
Functions
allocate
function allocate(Storage storage self, uint64 id0) internal returns (uint64 id);
Structs
Storage
struct Storage {
uint64 used;
}
ObjectIdManual
Functions
allocate
function allocate(Storage storage self, uint64 id0) internal returns (uint64 id);
Structs
Storage
struct Storage {
mapping(uint64 => bool) used;
}
Counter48
Counter for objects with IDs from 1 to type(uint48).max inclusive
State Variables
MIN_ID
uint48 constant MIN_ID = 1
MAX_ID
uint48 constant MAX_ID = type(uint48).max - 1
Functions
initialize
function initialize(Counter storage counter, uint48 initial) internal;
increase
function increase(Counter storage counter) internal returns (uint48 previous);
decrease
function decrease(Counter storage counter) internal returns (uint48 previous);
current
function current(Counter storage counter) internal view returns (uint48);
Errors
Overflow
error Overflow();
Underflow
error Underflow();
InvalidInitial
error InvalidInitial();
Structs
Counter
struct Counter {
uint48 value;
}
Counter64
Counter for objects with IDs from 1 to type(uint64).max inclusive
State Variables
MIN_ID
uint64 constant MIN_ID = 1
MAX_ID
uint64 constant MAX_ID = type(uint64).max - 1
Functions
initialize
function initialize(Counter storage counter, uint64 initial) internal;
increment
function increment(Counter storage counter) internal returns (uint64 previous);
decrement
function decrement(Counter storage counter) internal returns (uint64 previous);
current
function current(Counter storage counter) internal view returns (uint64);
Errors
Overflow
error Overflow();
Underflow
error Underflow();
InvalidInitial
error InvalidInitial();
Structs
Counter
struct Counter {
uint64 value;
}
Packing
Functions
pack_uint8x16
Packs up to 16 uint8 values into a single bytes32. Unfilled slots are set to 0.
function pack_uint8x16(uint8[] memory array) internal pure returns (bytes32 packed);
unpack_uint8x16
Unpacks a bytes32 into uint8 values, stopping at the first zero
function unpack_uint8x16(bytes32 packed) internal pure returns (uint8[] memory array);
pack_uint64x4
Packs up to 4 uint64 values into a bytes32. Fills missing slots with 0.
function pack_uint64x4(uint64[] memory array) internal pure returns (bytes32 packed);
unpack_uint64x4
Unpacks a bytes32 into up to 4 uint64s, skipping zero values
function unpack_uint64x4(bytes32 packed) internal pure returns (uint64[] memory array);
pack_uint64x16
Packs up to 16 uint64s into 4 bytes32 values. Fills missing slots with 0.
function pack_uint64x16(uint64[] memory array)
internal
pure
returns (bytes32 p0, bytes32 p1, bytes32 p2, bytes32 p3);
unpack_uint64x16
Unpacks 4 bytes32 values into an array of up to 16 uint64s, skipping zero values
function unpack_uint64x16(bytes32 p0, bytes32 p1, bytes32 p2, bytes32 p3)
internal
pure
returns (uint64[] memory array);
_pack4
function _pack4(uint64[] memory a, uint256 offset) private pure returns (bytes32 out);
_unpack4
function _unpack4(bytes32 b, uint64[] memory a, uint256 offset) private pure returns (uint256 newOffset);
Semver
Functions
pack
function pack(uint8 storage_, uint8 major, uint8 minor, uint8 patch) internal pure returns (uint32 semver);
unpack
function unpack(uint32 semver) internal pure returns (uint8 storage_, uint8 major, uint8 minor, uint8 patch);
Snapshots
Library for storing object revisions
Functions
semver
function semver() external pure returns (uint32 version);
create
function create(Storage storage $, uint64 id, Descriptor memory desc, bytes32[] memory elems, address owner)
external;
update
function update(Storage storage $, uint64 id, bytes32[] memory elems) external returns (Descriptor memory);
upgrade
function upgrade(Storage storage $, uint64 id, uint32 kindRev, uint32 setRev, uint256 count)
external
returns (Descriptor memory);
touch
function touch(Storage storage $, uint64 id, uint256 count) external returns (Descriptor memory);
transfer
function transfer(Storage storage $, uint64 id, address to) external returns (address from);
ownerOf
function ownerOf(Storage storage $, uint64 id) external view returns (address);
revisionOf
function revisionOf(Storage storage $, uint64 id) external view returns (uint32);
revisionAt
function revisionAt(Storage storage $, uint64 id, uint32 rev0) external view returns (uint32);
descriptorAt
function descriptorAt(Storage storage $, uint64 id, uint32 rev0) external view returns (Descriptor memory);
elementsAt
function elementsAt(Storage storage $, uint64 id, uint32 rev0, uint256 num)
external
view
returns (bytes32[] memory);
elementAt
function elementAt(Storage storage $, uint64 id, uint32 rev0, uint256 index) external view returns (bytes32);
sotaOf
function sotaOf(Storage storage $, uint64 id) external view returns (Descriptor memory desc, address owner);
snapshotAt
function snapshotAt(Storage storage $, uint64 id, uint32 rev0, uint256 num)
external
view
returns (Descriptor memory, bytes32[] memory);
statusOf
function statusOf(Storage storage $, uint64[] memory ids) external view returns (bool);
_requireStatus
function _requireStatus(Storage storage $, uint64 id) private view returns (Status memory);
_requireRevision
function _requireRevision(Storage storage $, uint64 id, uint32 rev0) private view returns (uint32);
_validateDescriptor
function _validateDescriptor(Descriptor memory desc) private pure;
_makeRevisionKey
function _makeRevisionKey(uint64 id, uint32 rev) private pure returns (uint256);
Errors
InvalidId
error InvalidId();
InvalidOwner
error InvalidOwner();
InvalidKindId
error InvalidKindId();
InvalidSetId
error InvalidSetId();
InvalidRevision
error InvalidRevision();
InvalidKindRevision
error InvalidKindRevision();
InvalidSetRevision
error InvalidSetRevision();
InvalidElements
error InvalidElements();
InvalidFieldIndex
error InvalidFieldIndex();
RecordExists
error RecordExists(uint64 id);
RecordNotExist
error RecordNotExist(uint64 id);
RecordNotActive
error RecordNotActive(uint64 id);
RevisionNotExist
error RevisionNotExist(uint64 id, uint32 rev);
Unauthorized
error Unauthorized(uint64 id, address visitor);
Structs
Status
Object record tracking ownership and latest revision
struct Status {
address owner;
uint32 latest;
}
Revision
Revision record containing descriptor and elements
struct Revision {
Descriptor desc;
bytes32[16] elems;
}
Storage
struct Storage {
mapping(uint256 => Status) sota; // state of the art
mapping(uint256 => Revision) revisions; // revisions
}
Contents
- Descriptor
- Info
- MatterHash
- ValueRef
- ValueRefLib
- UniqueRef
- UniqueRefLib
- ObjectRef
- ObjectRefLib
- MatterSpec
- MatterContent
- MintPolicy
- MintPolicyStatus
- MintPermissionType
- MintPermissionData
- MintPermissionLib
- MintContext
- MintContextLib
- Adjacency
- SID
- Node
- Arc
- RelationInitiator
- RelationGrant
- RelationTerminator
- RelationOwnerShift
- RelationRule
- RelationRuleLib
- AdjacencyLib
- RelationLib
- TokenStandard
- TokenType
- TokenSpec
- TokenSpecLib
Descriptor
struct Descriptor {
uint32 traits;
uint32 rev;
uint32 kindRev;
uint32 setRev;
uint64 kindId;
uint64 setId;
}
Info
type Info is bytes32
MatterHash
type MatterHash is bytes32
ValueRef
struct ValueRef {
uint16 rev;
uint48 tok;
uint64 _reserved;
uint128 amount;
}
ValueRefLib
Functions
pack
function pack(uint48 tok, uint16 rev, uint128 amount) internal pure returns (bytes32);
pack
function pack(ValueRef memory ref) internal pure returns (bytes32);
unpack
function unpack(bytes32 packed) internal pure returns (ValueRef memory ref);
UniqueRef
struct UniqueRef {
uint16 rev;
uint48 tok;
uint64 id;
uint128 amount;
}
UniqueRefLib
Functions
pack
function pack(uint48 tok, uint16 rev, uint64 id, uint128 amount) internal pure returns (bytes32);
pack
function pack(UniqueRef memory ref) internal pure returns (bytes32);
unpack
function unpack(bytes32 packed) internal pure returns (UniqueRef memory ref);
ObjectRef
struct ObjectRef {
uint64 set;
uint64 id;
uint128 _reserved;
}
ObjectRefLib
Functions
pack
function pack(uint64 set, uint64 id) internal pure returns (bytes32);
pack
function pack(ObjectRef memory ref) internal pure returns (bytes32);
unpack
function unpack(bytes32 packed) internal pure returns (ObjectRef memory ref);
MatterSpec
struct MatterSpec {
uint8 form;
bytes31 mime;
}
MatterContent
struct MatterContent {
uint8 form;
bytes31 mime;
bytes blob;
}
MintPolicy
Defines the access and payment rules for minting objects
struct MintPolicy {
// -- Protocol-controlled fields --
uint32 index; // Unique policy index (assigned by system)
MintPolicyStatus status;
// -- User-configured fields --
MintPermissionType perm; // Type of permission required
uint16 limit; // Max mints per address
uint32 tag; // Arbitrary user tag passed back during callbacks
address recipient; // Where funds are sent (e.g., creator)
address currency; // Payment token (zero = native)
uint96 price; // Price per mint
uint64 idStart; // Start object ID (inclusive)
uint64 idEnd; // End object ID (exclusive)
uint64 saleStart; // Mint start timestamp
uint64 saleEnd; // Mint end timestamp (exclusive)
bytes32 data; // Permission data (e.g. Merkle root)
}
MintPolicyStatus
Indicates the current status of a mint policy
enum MintPolicyStatus {
None, // Uninitialized
Enabled, // Active
Disabled // Exists but cannot be used
}
MintPermissionType
Access modes used to restrict who can mint
enum MintPermissionType {
Public, // Open to all, no proof required
Allowlist, // Merkle proof of address required
AllowTable // Merkle proof of (address, price, limit) required
}
MintPermissionData
Encoded permission data tied to a policy
For Public: must be bytes32(0)
For Allowlist / AllowTable: must be a Merkle root
type MintPermissionData is bytes32
MintPermissionLib
Encodes, decodes, and verifies mint auth data for each permission type.
Functions
allowList_Encode
function allowList_Encode(bytes32[] memory proof) internal pure returns (bytes memory auth);
allowList_Decode
function allowList_Decode(bytes memory auth) internal pure returns (bytes32[] memory proof);
allowList_Leaf
function allowList_Leaf(address user) internal pure returns (bytes32);
allowTable_Encode
function allowTable_Encode(uint96 price, uint16 limit, bytes32[] memory proof)
internal
pure
returns (bytes memory auth);
allowTable_Decode
function allowTable_Decode(bytes memory auth)
internal
pure
returns (uint96 price, uint16 limit, bytes32[] memory proof);
allowTable_Leaf
function allowTable_Leaf(address user, uint96 price, uint16 limit) internal pure returns (bytes32);
MintContext
Struct representing packed minting context
Layout (MSB → LSB): [uint64 _reserved | uint64 idStart | uint64 idEnd | uint32 policy | uint32 tag]
struct MintContext {
uint64 _reserved; // bits 192–255 (reserved for future use)
uint64 idStart; // bits 128–191 (inclusive object ID start)
uint64 idEnd; // bits 64–127 (exclusive object ID end)
uint32 policy; // bits 32–63 (policy index)
uint32 tag; // bits 0–31 (user-defined tag for callback)
}
MintContextLib
Utility library for packing/unpacking MintContext into a uint256 word
Functions
pack
Packs a MintContext struct into a single uint256
function pack(MintContext memory ctx) internal pure returns (uint256 packed);
Parameters
| Name | Type | Description |
|---|---|---|
ctx | MintContext | The MintContext struct |
Returns
| Name | Type | Description |
|---|---|---|
packed | uint256 | The packed uint256 representation |
pack
Packs individual context fields into a uint256 (with _reserved = 0)
function pack(uint32 policy, uint32 tag, uint64 idStart, uint64 idEnd) internal pure returns (uint256 packed);
Parameters
| Name | Type | Description |
|---|---|---|
policy | uint32 | Policy index |
tag | uint32 | Custom user tag |
idStart | uint64 | Inclusive object ID start |
idEnd | uint64 | Exclusive object ID end |
Returns
| Name | Type | Description |
|---|---|---|
packed | uint256 | The packed uint256 representation |
unpack
Unpacks a packed uint256 into a MintContext struct
function unpack(uint256 packed) internal pure returns (MintContext memory ctx);
Parameters
| Name | Type | Description |
|---|---|---|
packed | uint256 | The packed uint256 |
Returns
| Name | Type | Description |
|---|---|---|
ctx | MintContext | The unpacked MintContext struct |
Adjacency
Represents a constraint on the acceptable number of objects by kind in a relation. A maximum of 16 adjacencies can be specified per relation.
Adjacencies are typically specified in a row, with kinds ordered in ascending order.
struct Adjacency {
uint16 degs;
uint48 kind;
}
Properties
| Name | Type | Description |
|---|---|---|
degs | uint16 | Encodes minimum and maximum degree constraints. minDeg = (degs & 0x8000) >> 15, maxDeg = degs & 0x7FFF |
kind | uint48 | Kind ID of the related object. 0 = any other kind, 0xFFFFFFFFFFFF = total, [1, 2^48 - 2] = specific kind ID |
SID
struct SID {
uint64 set;
uint64 id;
}
Node
struct Node {
uint64 data;
uint32 _reserved;
uint32 grant;
uint64 set;
uint64 id;
}
Arc
struct Arc {
uint64 data;
uint64 rel;
uint64 set;
uint64 id;
}
RelationInitiator
Defines who is authorized to initiate a relation
enum RelationInitiator {
Owner, // The owner of the object
Holder, // A holder of a specific token (Value, Unique, or Object)
Preset, // A specified address
Eligible, // An address that passes a verifiction
Anyone // Any address
}
RelationGrant
Describes a granted permission to initiate a relation
struct RelationGrant {
uint32 id; // grant id
uint8 status; // 0 = not exist, 1 = active, 2 = revoked
RelationInitiator initiator; // The type of authorization
uint16 reserved; // Reserved for alignment and future use
uint64 rel; // Optional filter: applies to relatios with a specific relation id (0 = no restriction)
uint64 kind; // Optional filter: applies to peers with a specific kind id (0 = no restriction)
uint64 set; // Optional filter: applies to peers with a specific set id (0 = no restriction)
bytes32 extra; // Encoded RelationInitiatorData, see variants below
}
RelationTerminator
Defines who is allowed to call unrelate()
enum RelationTerminator {
TailOwner, // Only the current tail owner
HeadOwner, // Only the current head owner
Either, // Either tail or head owner
Neither, // Anyone except tail and head owner
Anyone, // Absolutely anyone
Nobody // No one (permanent link)
}
RelationOwnerShift
Defines how ownership of the tail object changes during relate/unrelate
enum RelationOwnerShift {
// No change
Retain,
// Immediate transfers (used during relate or unrelate from HoldPending)
TransferToTailOwner,
TransferToHeadOwner,
TransferToCaller,
TransferToPreset,
TransferToBurned,
TransferToResolved,
TransferToIntended,
// Temporary custody by protocol (used during relate)
HoldForTailOwner,
HoldForHeadOwner,
HoldForCaller,
HoldForPreset,
HoldForBurned,
HoldForResolved,
HoldPending
}
RelationRule
Defines relation lifecycle rules: who can relate/unrelate and how ownership shifts
struct RelationRule {
uint8 version; // Version of the rule format
RelationOwnerShift relateShift; // Ownership change after relate
RelationTerminator terminator; // Defines who is allowed to unrelate
RelationOwnerShift unrelateShift; // Ownership change after unrelate
uint64 unrelateDelay; // delay before unrelate is allowed (0 = immediate)
bytes20 extra; // Optional: preset address or contract address to resolve beneficiaries
}
RelationRuleLib
Functions
pack
function pack(RelationRule memory r) internal pure returns (bytes32);
unpack
function unpack(bytes32 b) internal pure returns (RelationRule memory r);
AdjacencyLib
Functions
encode
Pack one Adjacency into 64 bits: [degs:16 | kind:48]
function encode(Adjacency memory a) private pure returns (uint64);
packQuad
Packs up to 4 adjacencies (starting at offset) into a bytes32.
Missing slots are treated as zero.
function packQuad(Adjacency[] memory adjs, uint256 offset) internal pure returns (bytes32 out);
RelationLib
Structs
RelationInitiatorDataPreset
Data for Delegate-based authorization
struct RelationInitiatorDataPreset {
uint96 padding;
address delegateAddr; // Authorized address allowed to initiate the relation
}
RelationInitiatorDataEligible
Data for Verified-based authorization
struct RelationInitiatorDataEligible {
uint96 padding;
address contractAddr; // Address of the rule-verifying contract
}
RelationInitiatorDataHolder
Data for Holder-based authorization
struct RelationInitiatorDataHolder {
TokenType tokenType; // Value, Unique, or Object
uint8 padding;
uint48 tokenSet; // The set ID of the token
uint64 tokenId; // The token ID of uniques or objects, 0 for values
uint128 tokenAmount; // The requried amount of values, 1 for uniques or objects
}
TokenStandard
enum TokenStandard {
None,
Native,
ERC20,
ERC721,
ERC1155
}
TokenType
enum TokenType {
None,
Fungible,
Opaque,
Object
}
TokenSpec
struct TokenSpec {
TokenStandard std;
uint8 decimals;
bytes30 symbol; // left-padded
}
TokenSpecLib
Functions
pack
function pack(TokenStandard std, uint8 decimals, bytes30 symbol) internal pure returns (bytes32);
unpack
function unpack(bytes32 t) internal pure returns (TokenSpec memory);
toBytes30
function toBytes30(string memory s) internal pure returns (bytes30 out);
toString
function toString(bytes30 symbol) internal pure returns (string memory);
Contents
- ERC1155Compatible
- Interoperable
- ObjectMinterAdmin
- ObjectMinterHook
- SetContext
- SetRegistryAdmin
- SetRegistryHook
- SetSolo
ERC1155Compatible
Inherits: SetSolo, IERC1155, IERC1155MetadataURI, IERC7572
A minimal ERC-1155 wrapper for object tokens in a Set, where each object has a quantity of exactly 1.
Extends SetSolo and conforms to IERC1155, IERC1155MetadataURI, and IERC7572.
State Variables
_approvals
mapping(address => mapping(address => bool)) internal _approvals
Functions
balanceOf
Returns the value of tokens of token type id owned by account.
function balanceOf(address account, uint256 id) external view override returns (uint256);
balanceOfBatch
xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}. Requirements:
accountsandidsmust have the same length.
function balanceOfBatch(address[] memory accounts, uint256[] memory ids) public view returns (uint256[] memory);
setApprovalForAll
Grants or revokes permission to operator to transfer the caller's tokens, according to approved,
Emits an {ApprovalForAll} event.
Requirements:
operatorcannot be the zero address.
function setApprovalForAll(address operator, bool approved) public;
isApprovedForAll
Returns true if operator is approved to transfer account's tokens.
See {setApprovalForAll}.
function isApprovedForAll(address account, address operator) public view returns (bool);
safeTransferFrom
Transfers a value amount of tokens of type id from from to to.
WARNING: This function can potentially allow a reentrancy attack when transferring tokens
to an untrusted contract, when invoking {IERC1155Receiver-onERC1155Received} on the receiver.
Ensure to follow the checks-effects-interactions pattern and consider employing
reentrancy guards when interacting with untrusted contracts.
Emits a {TransferSingle} event.
Requirements:
tocannot be the zero address.- If the caller is not
from, it must have been approved to spendfrom's tokens via {setApprovalForAll}. frommust have a balance of tokens of typeidof at leastvalueamount.- If
torefers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the acceptance magic value.
function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes memory data) public;
safeBatchTransferFrom
xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}. WARNING: This function can potentially allow a reentrancy attack when transferring tokens to an untrusted contract, when invoking {IERC1155Receiver-onERC1155BatchReceived} on the receiver. Ensure to follow the checks-effects-interactions pattern and consider employing reentrancy guards when interacting with untrusted contracts. Emits either a {TransferSingle} or a {TransferBatch} event, depending on the length of the array arguments. Requirements:
idsandvaluesmust have the same length.- If
torefers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the acceptance magic value.
function safeBatchTransferFrom(
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) public;
uri
Returns the URI for token type id.
If the \{id\} substring is present in the URI, it must be replaced by
clients with the actual token type ID.
function uri(uint256 id) public view override returns (string memory);
contractURI
Returns a URI pointing to contract-level metadata
The metadata should conform to a standard like OpenSea's contract-level metadata schema
function contractURI() external view override returns (string memory);
Returns
| Name | Type | Description |
|---|---|---|
<none> | string | uri_ The contract metadata URI as a string |
supportsInterface
Returns true if this contract implements the interface defined by
interfaceId. See the corresponding
https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]
to learn more about how these ids are created.
This function call must use less than 30 000 gas.
function supportsInterface(bytes4 interfaceId) external pure virtual override(IERC165, SetSolo) returns (bool);
_safeTransferFrom
function _safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes memory data) internal;
_safeBatchTransferFrom
function _safeBatchTransferFrom(
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) internal;
_setApprovalForAll
function _setApprovalForAll(address owner, address operator, bool approved) internal;
_balanceOf
function _balanceOf(address account, uint256 id) internal view returns (uint256);
_postCreate
function _postCreate(address owner, uint64 id, Descriptor memory od, bytes32[] memory elems)
internal
virtual
override;
_postUpgrade
function _postUpgrade(uint64 id, Descriptor memory od, uint32 kindRev, uint32 setRev) internal virtual override;
_postUpdate
function _postUpdate(uint64 id, Descriptor memory od, bytes32[] memory elems) internal virtual override;
_postTouch
function _postTouch(uint64 id, Descriptor memory od) internal virtual override;
_postTransfer
function _postTransfer(uint64 id, Descriptor memory od, address from, address to) internal virtual override;
_supportsInterface
function _supportsInterface(bytes4 interfaceId) internal pure virtual override returns (bool);
_tokenURI
function _tokenURI(uint64 id, uint32 rev) internal view virtual returns (string memory);
_contractURI
function _contractURI() internal view virtual returns (string memory);
Errors
InvalidTransferAmount
error InvalidTransferAmount();
TransferFromIncorrectOwner
error TransferFromIncorrectOwner();
LengthMismatch
error LengthMismatch();
ZeroAddress
error ZeroAddress();
SelfApproval
error SelfApproval();
NotOwnerNorApproved
error NotOwnerNorApproved();
Interoperable
Inherits: IInteroperable
Base contract to enable object-level interoperability via the OmniRegistry.
Implements the IInteroperable interface and restricts callbacks to only the configured OmniRegistry.
Functions
onlyOmniRegistry
Restricts execution to only the configured OmniRegistry.
modifier onlyOmniRegistry() ;
onObjectRelate
Hook called before an object from this set is linked to another object
function onObjectRelate(uint64 id, uint64 rel, uint64 data, uint64 tailSet, uint64 tailId, uint64 tailKind)
external
override
onlyOmniRegistry
returns (Descriptor memory od);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | Object ID from this set (acts as the head) |
rel | uint64 | Relation ID |
data | uint64 | Encoded relation-specific data (optional, uint64) |
tailSet | uint64 | Set ID of the tail object |
tailId | uint64 | Object ID of the tail |
tailKind | uint64 | Kind ID of the tail object |
Returns
| Name | Type | Description |
|---|---|---|
od | Descriptor | Updated descriptor of the head object |
onObjectUnrelate
Hook called before an object from this set is unlinked from another object
function onObjectUnrelate(uint64 id, uint64 rel, uint64 data, uint64 tailSet, uint64 tailId, uint64 tailKind)
external
override
onlyOmniRegistry
returns (Descriptor memory od);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | Object ID from this set (acts as the head) |
rel | uint64 | Relation ID |
data | uint64 | Encoded relation-specific data (optional, uint64) |
tailSet | uint64 | Set ID of the tail object |
tailId | uint64 | Object ID of the tail |
tailKind | uint64 | Kind ID of the tail object |
Returns
| Name | Type | Description |
|---|---|---|
od | Descriptor | Updated descriptor of the head object |
onObjectTransfer
Hook called before ownership of an object from this set is transferred as part of a relation or unrelation
function onObjectTransfer(uint64 id, address from, address to)
external
override
onlyOmniRegistry
returns (bytes4 selector);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | Object ID being transferred |
from | address | Current owner address |
to | address | New owner address |
Returns
| Name | Type | Description |
|---|---|---|
selector | bytes4 | Must return onObjectTransfer.selector to confirm and proceed |
supportsInterface
Returns true if this contract implements the interface defined by
interfaceId. See the corresponding
https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]
to learn more about how these ids are created.
This function call must use less than 30 000 gas.
function supportsInterface(bytes4 interfaceId) external pure virtual override returns (bool);
Errors
CallerNotOmniRegistry
error CallerNotOmniRegistry();
ObjectMinterAdmin
Provides helper functions for managing minting policies via an external ObjectMinter.
Designed to be inherited by set contracts. Assumes SetContext is properly configured.
All functions apply to the calling set and must be protected by access control.
Functions
addMintPolicy
Adds a new minting policy for this set.
Only callable by the set owner or an authorized admin.
function addMintPolicy(MintPolicy memory policy) external returns (uint32 index);
Parameters
| Name | Type | Description |
|---|---|---|
policy | MintPolicy | The minting policy to add. |
Returns
| Name | Type | Description |
|---|---|---|
index | uint32 | The index of the newly added policy. |
disableMintPolicy
Disables an existing minting policy for this set.
Only callable by the set owner or an authorized admin.
function disableMintPolicy(uint32 index) external;
Parameters
| Name | Type | Description |
|---|---|---|
index | uint32 | The index of the policy to disable. |
enableMintPolicy
Enables a previously disabled minting policy for this set.
Only callable by the set owner or an authorized admin.
function enableMintPolicy(uint32 index) external;
Parameters
| Name | Type | Description |
|---|---|---|
index | uint32 | The index of the policy to enable. |
_objectMinter
function _objectMinter() private view returns (IObjectMinter);
ObjectMinterHook
Inherits: IObjectMinterHook
Base contract for integrating with an external ObjectMinter.
Implements the IObjectMinterHook interface and enforces that only the configured ObjectMinter
can trigger the minting logic. Inheriting contracts must implement _mint(...).
Functions
constructor
Initializes the contract with the configured ObjectMinter address.
constructor(address minter) ;
Parameters
| Name | Type | Description |
|---|---|---|
minter | address | The address of the ObjectMinter. |
onlyObjectMinter
Restricts function to be called only by the configured ObjectMinter.
modifier onlyObjectMinter() ;
onObjectMint
Called by ObjectMinter after payment is collected and before minting is finalized
- If
id0is 0, the contract must assign and return a new object ID. - If
id0is non-zero, the contract must validate and return the same ID. The call must returnonObjectMint.selectorto signal success.
function onObjectMint(address operator, address to, uint64 id0, uint256 context, bytes memory data)
external
override
onlyObjectMinter
returns (bytes4 supported, uint64 id);
Parameters
| Name | Type | Description |
|---|---|---|
operator | address | Caller who initiated the mint (typically msg.sender) |
to | address | Recipient of the minted object |
id0 | uint64 | Requested object ID (0 = auto-assign) |
context | uint256 | Packed 256-bit context for custom mint logic (see MintingContext) |
data | bytes | Arbitrary input payload for extensible logic |
Returns
| Name | Type | Description |
|---|---|---|
supported | bytes4 | selector Must return onObjectMint.selector to proceed |
id | uint64 | Final resolved object ID to be minted |
supportsInterface
Returns true if this contract implements the interface defined by
interfaceId. See the corresponding
https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]
to learn more about how these ids are created.
This function call must use less than 30 000 gas.
function supportsInterface(bytes4 interfaceId) external pure virtual override returns (bool supported);
_mint
Performs the actual minting logic.
Must be implemented by the inheriting contract. The function should resolve and return a valid object ID.
function _mint(address operator, address to, uint64 id0, uint256 context, bytes memory data)
internal
virtual
returns (uint64 id);
Parameters
| Name | Type | Description |
|---|---|---|
operator | address | The address that initiated the mint (typically msg.sender). |
to | address | The recipient address of the newly minted object. |
id0 | uint64 | Requested object ID (0 = assign automatically). |
context | uint256 | Packed context data for the minting operation. |
data | bytes | Arbitrary user-defined input passed through the mint call. |
Returns
| Name | Type | Description |
|---|---|---|
id | uint64 | The resolved and finalized object ID to be minted. |
Errors
CallerNotObjectMinter
error CallerNotObjectMinter();
SetContext
Library for managing the execution context of a set contract.
Stores contextual metadata—such as set ID, registry addresses, and revision numbers— in a dedicated ERC-7201 storage slot. Designed to support modular, pluggable set features.
State Variables
LOCATION
keccak256(abi.encode(uint256(keccak256("every.storage.SetContext")) - 1)) & ~bytes32(uint256(0xff))
bytes32 private constant LOCATION = 0x9a9ae33f5929d69d85755390eef01c6883da9e8043b3c1e288ad073bd8ad3600
Functions
ctx
Internal accessor for storage struct.
function ctx() internal pure returns (SetContextStorage storage $);
setSetRegistry
Sets the address of the SetRegistry.
function setSetRegistry(address setRegistry) internal;
setSetId
Sets the ID of the current set.
function setSetId(uint64 setId) internal;
setSetRev
Sets the revision of the current set.
function setSetRev(uint32 setRev) internal;
setKindRegistry
Sets the address of the KindRegistry.
function setKindRegistry(address setRegistry) internal;
setKindId
Sets the kind ID of the current object.
function setKindId(uint64 kindId) internal;
setKindRev
Sets the kind revision of the current object.
function setKindRev(uint32 kindRev) internal;
setOmniRegistry
Sets the address of the OmniRegistry.
function setOmniRegistry(address omniRegistry) internal;
setObjectMinter
Sets the address of the ObjectMinter.
function setObjectMinter(address objectMinter) internal;
getSetRegistry
Gets the address of the SetRegistry.
function getSetRegistry() internal view returns (address);
getSetId
Gets the ID of the current set.
function getSetId() internal view returns (uint64);
getSetRev
Gets the revision of the current set.
function getSetRev() internal view returns (uint32);
getOmniRegistry
Gets the address of the OmniRegistry.
function getOmniRegistry() internal view returns (address);
getKindRegistry
Gets the address of the KindRegistry.
function getKindRegistry() internal view returns (address);
getKindId
Gets the kind ID of the current object.
function getKindId() internal view returns (uint64);
getKindRev
Gets the kind revision of the current object.
function getKindRev() internal view returns (uint32);
getObjectMinter
Gets the address of the ObjectMinter.
function getObjectMinter() internal view returns (address);
Structs
SetContextStorage
Note: storage-location: erc7201:every.storage.SetContext
struct SetContextStorage {
// --- Slot 0 ---
address setRegistry;
uint64 setId;
uint32 setRev;
// --- Slot 1 ---
address omniRegistry;
uint96 _reserved0;
// --- Slot 2 ---
address kindRegistry;
uint64 kindId;
uint32 kindRev;
// --- Slot 3 ---
address elemRegistry;
uint96 _reserved1;
// --- Slot 4 ---
address objectMinter;
uint96 _reserved2;
}
SetRegistryAdmin
Helper for managing privileged registration and upgrade operations with the SetRegistry.
Intended to be inherited by set contracts. Assumes SetContext is correctly configured.
All methods act on the calling contract’s associated set and must be access-controlled.
Functions
registerSet
Registers the calling contract as a new set in the SetRegistry.
function registerSet(bytes32 data) external returns (uint64 id, Descriptor memory od);
Parameters
| Name | Type | Description |
|---|---|---|
data | bytes32 | Content hash (e.g., metadata or schema reference). |
Returns
| Name | Type | Description |
|---|---|---|
id | uint64 | Newly assigned set ID. |
od | Descriptor | Descriptor of the registered set. |
updateSet
Updates the content hash of the set represented by the calling contract.
function updateSet(bytes32 data) external returns (uint64 id, Descriptor memory od);
Parameters
| Name | Type | Description |
|---|---|---|
data | bytes32 | New content hash. |
Returns
| Name | Type | Description |
|---|---|---|
id | uint64 | Set ID. |
od | Descriptor | Updated descriptor of the set. |
upgradeSet
Upgrades the kind or set revision of the calling contract’s set.
Pass 0 to skip updating either kindRev or setRev.
function upgradeSet(uint32 kindRev0, uint32 setRev0) external returns (uint64 id, Descriptor memory od);
Parameters
| Name | Type | Description |
|---|---|---|
kindRev0 | uint32 | New kind revision (0 = no change). |
setRev0 | uint32 | New set revision (0 = no change). |
Returns
| Name | Type | Description |
|---|---|---|
id | uint64 | Set ID. |
od | Descriptor | Descriptor after the upgrade. |
touchSet
Increments the revision of the calling contract’s set without changing content.
function touchSet() external returns (uint64 id, Descriptor memory od);
Returns
| Name | Type | Description |
|---|---|---|
id | uint64 | Set ID. |
od | Descriptor | Descriptor after the touch operation. |
_setRegistry
function _setRegistry() private view returns (ISetRegistry);
SetRegistryHook
Inherits: ISetRegistryHook
Base implementation of ISetRegistryHook for handling set lifecycle callbacks.
Updates the SetContext during set registration, upgrades, and touches. Intended to be inherited by set contracts to handle automatic context tracking.
Functions
constructor
Constructs the hook and sets the SetRegistry address in context.
constructor(address setRegistry) ;
Parameters
| Name | Type | Description |
|---|---|---|
setRegistry | address | Address of the SetRegistry contract. |
onlySetRegistry
Restricts access to only the configured SetRegistry.
modifier onlySetRegistry() ;
onSetRegister
Called before a set is registered.
function onSetRegister(uint64 set, Descriptor memory od)
external
virtual
override
onlySetRegistry
returns (bytes4);
Parameters
| Name | Type | Description |
|---|---|---|
set | uint64 | Set ID being registered. |
od | Descriptor | Initial descriptor of the set. |
Returns
| Name | Type | Description |
|---|---|---|
<none> | bytes4 | selector Must return onSetRegister.selector to confirm the action. |
onSetUpdate
Called before a set is updated.
function onSetUpdate(uint64 set, Descriptor memory od) external virtual override onlySetRegistry returns (bytes4);
Parameters
| Name | Type | Description |
|---|---|---|
set | uint64 | Set ID being updated. |
od | Descriptor | Updated descriptor of the set. |
Returns
| Name | Type | Description |
|---|---|---|
<none> | bytes4 | selector Must return onSetUpdate.selector to confirm the action. |
onSetUpgrade
Called before a set is upgraded.
function onSetUpgrade(uint64 set, Descriptor memory od) external virtual override onlySetRegistry returns (bytes4);
Parameters
| Name | Type | Description |
|---|---|---|
set | uint64 | Set ID being upgraded. |
od | Descriptor | Descriptor of the set after the upgrade. |
Returns
| Name | Type | Description |
|---|---|---|
<none> | bytes4 | selector Must return onSetUpgrade.selector to confirm the action. |
onSetTouch
Called before a set is touched (bumped revision with no content change).
function onSetTouch(uint64 set, Descriptor memory od) external virtual override onlySetRegistry returns (bytes4);
Parameters
| Name | Type | Description |
|---|---|---|
set | uint64 | Set ID being touched. |
od | Descriptor | Descriptor of the set after the touch. |
Returns
| Name | Type | Description |
|---|---|---|
<none> | bytes4 | selector Must return onSetTouch.selector to confirm the action. |
supportsInterface
Returns true if this contract implements the interface defined by
interfaceId. See the corresponding
https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]
to learn more about how these ids are created.
This function call must use less than 30 000 gas.
function supportsInterface(bytes4 interfaceId) external pure virtual override returns (bool supported);
Errors
CallerNotSetRegistry
error CallerNotSetRegistry();
SetSolo
Inherits: ISet
Minimal standalone implementation of the ISet interface for managing object tokens.
Handles object storage, ownership, versioning, and upgrade logic. Intended to be extended by full set contracts.
State Variables
ID_MAX
uint64 private constant ID_MAX = type(uint64).max - 1
_objects
mapping(uint64 => ObjectData) internal _objects
Functions
onlyObjectOwner
Restricts function to the current object owner.
modifier onlyObjectOwner(uint64 id) ;
create
Create (mint) a new object
function create(address to, uint64 id0, bytes calldata data)
external
virtual
returns (uint64 id, Descriptor memory od);
Parameters
| Name | Type | Description |
|---|---|---|
to | address | Initial owner of the object |
id0 | uint64 | Requested object ID (0 = auto-assign) |
data | bytes | Encoded creation parameters |
Returns
| Name | Type | Description |
|---|---|---|
id | uint64 | Final resolved object ID |
od | Descriptor | Descriptor of the newly created object |
update
Update an existing object
function update(uint64 id, bytes calldata data) external virtual returns (Descriptor memory od);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | Object ID to update |
data | bytes | Encoded update parameters |
Returns
| Name | Type | Description |
|---|---|---|
od | Descriptor | Descriptor after the update |
upgrade
Upgrade an object to a new kind or set revision
function upgrade(uint64 id, uint32 kindRev0, uint32 setRev0)
external
virtual
override
onlyObjectOwner(id)
returns (Descriptor memory desc);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | Object ID |
kindRev0 | uint32 | New kind revision (0 = no change) |
setRev0 | uint32 | New set revision (0 = no change) |
Returns
| Name | Type | Description |
|---|---|---|
desc | Descriptor | od Descriptor after upgrade |
touch
Touch an object to increment revision without content change
function touch(uint64 id) external virtual override onlyObjectOwner(id) returns (Descriptor memory od);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | Object ID |
Returns
| Name | Type | Description |
|---|---|---|
od | Descriptor | Descriptor after touch |
transfer
Transfer ownership of an object
function transfer(uint64 id, address to) external virtual override onlyObjectOwner(id);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | Object ID |
to | address | Address of the new owner |
uri
Get URI template for metadata
Client should replace {id} and {rev} placeholders
function uri() external view override returns (string memory uri_);
Returns
| Name | Type | Description |
|---|---|---|
uri_ | string | URI template string |
owner
Get current owner of an object
function owner(uint64 id) external view override returns (address owner_);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | Object ID |
Returns
| Name | Type | Description |
|---|---|---|
owner_ | address | Current owner address |
descriptor
Get descriptor at a specific revision
function descriptor(uint64 id, uint32 rev0) external view override returns (Descriptor memory od);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | Object ID |
rev0 | uint32 | Revision number (0 = latest) |
Returns
| Name | Type | Description |
|---|---|---|
od | Descriptor | Descriptor at that revision |
snapshot
Get descriptor and elements at a specific revision
function snapshot(uint64 id, uint32 rev0)
external
view
override
returns (Descriptor memory od, bytes32[] memory elems);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint64 | Object ID |
rev0 | uint32 | Revision number to query (0 = latest) |
Returns
| Name | Type | Description |
|---|---|---|
od | Descriptor | Descriptor at the specified revision |
elems | bytes32[] | Elements at the specified revision |
supportsInterface
Returns true if this contract implements the interface defined by
interfaceId. See the corresponding
https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]
to learn more about how these ids are created.
This function call must use less than 30 000 gas.
function supportsInterface(bytes4 interfaceId) external pure virtual override returns (bool);
_supportsInterface
function _supportsInterface(bytes4 interfaceId) internal pure virtual returns (bool);
_create
function _create(address to, uint64 id, Descriptor memory od, bytes32[] memory elems)
internal
returns (Descriptor memory);
_create0
function _create0(address to, uint64 id, Descriptor memory od) internal returns (Descriptor memory);
_create1
function _create1(address to, uint64 id, Descriptor memory od, bytes32 elem0) internal returns (Descriptor memory);
_create2
function _create2(address to, uint64 id, Descriptor memory od, bytes32 elem0, bytes32 elem1)
internal
returns (Descriptor memory);
_update
function _update(uint64 id, bytes32[] memory elems) internal returns (Descriptor memory);
_upgrade
function _upgrade(uint64 id, uint32 kindRev0, uint32 setRev0) internal returns (Descriptor memory);
_touch
function _touch(uint64 id) internal returns (Descriptor memory);
_transfer
function _transfer(uint64 id, address to) internal returns (address from);
_owner
function _owner(uint64 id) internal view returns (address);
_descriptor
function _descriptor(uint64 id, uint32 rev0) internal view returns (Descriptor memory);
_snapshot
function _snapshot(uint64 id, uint32 rev0) internal view returns (Descriptor memory od, bytes32[] memory elems);
_postCreate
function _postCreate(address to, uint64 id, Descriptor memory od, bytes32[] memory elems) internal virtual;
_postUpgrade
function _postUpgrade(uint64 id, Descriptor memory od, uint32 kindRev0, uint32 setRev0) internal virtual;
_postUpdate
function _postUpdate(uint64 id, Descriptor memory od, bytes32[] memory elems) internal virtual;
_postTouch
function _postTouch(uint64 id, Descriptor memory od) internal virtual;
_postTransfer
function _postTransfer(uint64 id, Descriptor memory od, address from, address to) internal virtual;
_onUpgradeKind
function _onUpgradeKind(uint64 kindId, uint32 kindRev0) internal view virtual returns (uint32);
_onUpgradeSet
function _onUpgradeSet(uint64 setId, uint32 setRev0) internal view virtual returns (uint32);
_objectURI
function _objectURI() internal view virtual returns (string memory);
Errors
CallerNotObjectOwner
error CallerNotObjectOwner();
InvalidObjectId
error InvalidObjectId();
UnknownObjectKind
error UnknownObjectKind();
UnknownObjectSet
error UnknownObjectSet();
InvalidKindRevision
error InvalidKindRevision();
InvalidSetRevision
error InvalidSetRevision();
InvalidUpgradeArguments
error InvalidUpgradeArguments();
ObjectAlreadyExists
error ObjectAlreadyExists();
ObjectNotFound
error ObjectNotFound();
RevisionNotStored
error RevisionNotStored();
RevisionNotFound
error RevisionNotFound();
KindUpgradeRejected
error KindUpgradeRejected();
SetUpgradeRejected
error SetUpgradeRejected();
Unimplemented
error Unimplemented();
Structs
ObjectData
struct ObjectData {
Descriptor desc;
address owner;
bytes32[] elements;
}