Every Protocol Core

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 contains the core contracts that power Every Protocol.

Contracts

  • SetRegistry — registers and manages object sets
  • KindRegistry — registers and manages kinds
  • ElementRegistry — registers object building blocks such as values, uniques, and matters
  • OmniRegistry — registers relations and enables object-to-object interactions
  • ObjectMinter — optional minting module allowing sets to define pricing, access, and sales logic

The contracts in this repository are in an early stage. We’re releasing the draft code now to build in public — with open feedback, shared exploration, and meaningful community contributions. We expect this to be an evolving, months-long process and welcome all forms of participation.

License

Every Protocol Core is licensed under the Business Source License 1.1 (BUSL-1.1), see BUSL_LICENSE, and the MIT License (MIT), See MIT_LICENSE. Each file declares its applicable license via the SPDX header.

Contents

Constraints

Git Source

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

Git Source

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

Git Source

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

Git Source

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

Git Source

State Variables

USER_START

uint64 constant USER_START = 17;

ValueIds

Git Source

State Variables

NATIVE

uint64 constant NATIVE = 0;

USER_START

uint64 constant USER_START = 17;

UniqueIds

Git Source

State Variables

USER_START

uint64 constant USER_START = 17;

Revisions

Git Source

State Variables

UNSPECIFIED

uint32 constant UNSPECIFIED = 0;

LATEST

uint32 constant LATEST = 0;

INITIAL

uint32 constant INITIAL = 1;

Contents

Contents

ElementRegistryErrors

Git Source

Errors

TokenNotExist

error TokenNotExist(uint64 token);

UnsupportedTokenStandard

error UnsupportedTokenStandard(uint8 std);

InvalidTokenContract

error InvalidTokenContract(address addr);

InvalidTokenAddress

error InvalidTokenAddress();

InvalidTokenData

error InvalidTokenData();

InvalidTokenRange

error InvalidTokenRange(uint64 begin, uint64 end);

UniqueElements

Git Source

State Variables

CODE

uint256 constant CODE = 0;

DATA

uint256 constant DATA = 1;

TOKEN_SPEC

uint256 constant TOKEN_SPEC = 2;

COUNT

uint256 constant COUNT = 3;

Structs

View

struct View {
    MatterHash code;
    MatterHash data;
    TokenSpecPacked tokenSpec;
}

UniqueRegistry

Git Source

Inherits: IUniqueRegistry, ElementRegistryErrors, Initializable, Soke

State Variables

UNIQUEREGISTRY_STORAGE_LOCATION

Deterministic storage slot per ERC-7201

keccak256(abi.encode(uint256(keccak256("every.storage.UniqueRegistry")) - 1)) & ~bytes32(uint256(0xff))

bytes32 private constant UNIQUEREGISTRY_STORAGE_LOCATION =
    0x04dc4921879709492146fc19ec213a3e22c8a01b900b814a9bdf73ef2a847900;

Functions

_getUniqueRegistryStorage

function _getUniqueRegistryStorage() private pure returns (UniqueRegistryStorage storage $);

__UniqueRegistry_init

function __UniqueRegistry_init(uint64 idStart) internal onlyInitializing;

uniqueRegister

Registers a new unique token

function uniqueRegister(address code, bytes32 data, TokenStandard std, uint8 decimals, string memory symbol)
    external
    override
    returns (uint64 id, Descriptor memory meta);

Parameters

NameTypeDescription
codeaddressAddress of the token contract
databytes32Hash of the associated matter
stdTokenStandardToken standard (e.g. ERC721)
decimalsuint8Number of decimals
symbolstringDisplay symbol (max 30 characters)

Returns

NameTypeDescription
iduint64ID of the new unique
metaDescriptordesc Descriptor after registration

uniqueUpdate

Updates the data hash of a unique

function uniqueUpdate(uint64 id, bytes32 data) external override returns (Descriptor memory meta);

Parameters

NameTypeDescription
iduint64Unique ID
databytes32New data hash

Returns

NameTypeDescription
metaDescriptordesc Updated descriptor

uniqueUpdate

Updates the data hash of a unique

function uniqueUpdate(uint64 id, bytes32 data, string memory symbol)
    external
    override
    returns (Descriptor memory meta);

Parameters

NameTypeDescription
iduint64Unique ID
databytes32New data hash
symbolstring

Returns

NameTypeDescription
metaDescriptordesc Updated descriptor

uniqueUpgrade

Upgrades the kind and/or set revision of a unique

function uniqueUpgrade(uint64 id, uint32 kindRev0, uint32 setRev0) external override returns (Descriptor memory meta);

Parameters

NameTypeDescription
iduint64Unique ID
kindRev0uint32
setRev0uint32

Returns

NameTypeDescription
metaDescriptordesc Descriptor after upgrade

uniqueTouch

Bumps the revision of a unique with no content change

function uniqueTouch(uint64 id) external override returns (Descriptor memory meta);

Parameters

NameTypeDescription
iduint64Unique ID

Returns

NameTypeDescription
metaDescriptordesc Descriptor after touch

uniqueTransfer

Transfers ownership of a unique token

function uniqueTransfer(uint64 id, address to) external override returns (address from);

Parameters

NameTypeDescription
iduint64Unique ID
toaddressAddress of the new owner

Returns

NameTypeDescription
fromaddressAddress of the previous owner

uniqueRevision

Resolves and validates a revision

function uniqueRevision(uint64 id, uint32 rev0) external view override returns (uint32 rev);

Parameters

NameTypeDescription
iduint64Unique ID
rev0uint32Requested revision (0 = latest)

Returns

NameTypeDescription
revuint32Resolved revision (0 = not found)

uniqueDescriptor

Returns the descriptor at a given revision

function uniqueDescriptor(uint64 id, uint32 rev0) external view override returns (Descriptor memory desc);

Parameters

NameTypeDescription
iduint64Unique ID
rev0uint32Revision to query (0 = latest)

Returns

NameTypeDescription
descDescriptorDescriptor at the specified revision

uniqueSnapshot

Returns descriptor and elements at a specific revision

function uniqueSnapshot(uint64 id, uint32 rev0)
    external
    view
    override
    returns (Descriptor memory desc, bytes32[] memory elems);

Parameters

NameTypeDescription
iduint64Unique ID
rev0uint32Revision to query (0 = latest)

Returns

NameTypeDescription
descDescriptorDescriptor at the revision
elemsbytes32[]Elements at the revision

uniqueOwner

Returns the current owner of a unique

function uniqueOwner(uint64 id) external view override returns (address owner);

Parameters

NameTypeDescription
iduint64Unique ID

Returns

NameTypeDescription
owneraddressAddress of the current owner

uniqueSota

Returns the latest descriptor and current owner

function uniqueSota(uint64 id) external view override returns (Descriptor memory desc, address owner);

Parameters

NameTypeDescription
iduint64Unique ID

Returns

NameTypeDescription
descDescriptorLatest descriptor
owneraddressAddress of the current owner

uniqueStatus

function uniqueStatus(uint64[] memory ids) external view override returns (bool active);

_register

function _register(
    uint64 id,
    address code,
    bytes32 data,
    TokenStandard std,
    uint8 decimals,
    bytes30 symbol,
    address owner
) private returns (Descriptor memory meta);

_kindOfUniqueRevision

Returns the latest revision of the Kind-of-Value object

function _kindOfUniqueRevision() private view returns (uint32);

_setOfUniqueRevision

Returns the latest revision of the Set-of-Value object

function _setOfUniqueRevision() private view returns (uint32);

Structs

UniqueRegistryStorage

Note: storage-location: erc7201:every.storage.UniqueRegistry

struct UniqueRegistryStorage {
    Counter48.Counter counter;
    Snapshots.Storage uniques;
}

ValueElements

Git Source

State Variables

CODE

uint256 constant CODE = 0;

DATA

uint256 constant DATA = 1;

TOKEN_SPEC

uint256 constant TOKEN_SPEC = 2;

COUNT

uint256 constant COUNT = 3;

Structs

View

struct View {
    MatterHash code;
    MatterHash data;
    TokenSpecPacked tokenSpec;
}

ValueRegistry

Git Source

Inherits: IValueRegistry, ElementRegistryErrors, Initializable, Soke

State Variables

VALUEREGISTRY_STORAGE_LOCATION

Deterministic storage slot per ERC-7201

keccak256(abi.encode(uint256(keccak256("every.storage.ValueRegistry")) - 1)) & ~bytes32(uint256(0xff))

bytes32 private constant VALUEREGISTRY_STORAGE_LOCATION =
    0x7e2fb0066d5c30a775c561af98650c8a5856bdd87a1fa6e7b509179e09d6c200;

Functions

_getValueRegistryStorage

function _getValueRegistryStorage() private pure returns (ValueRegistryStorage storage $);

__ValueRegistry_init

function __ValueRegistry_init(uint64 idStart, address owner, bytes32 data, uint8 decimals, string memory symbol)
    internal
    onlyInitializing;

valueRegister

Registers a new value token

function valueRegister(address code, bytes32 data, TokenStandard std, uint8 decimals, string memory symbol)
    external
    override
    returns (uint64 id, Descriptor memory meta);

Parameters

NameTypeDescription
codeaddressToken contract address
databytes32Hash of the underlying matter or metadata
stdTokenStandardToken standard (e.g. ERC20)
decimalsuint8Token's decimal precision
symbolstringDisplay symbol (max 30 characters)

Returns

NameTypeDescription
iduint64New value ID
metaDescriptordesc Descriptor after registration

valueUpdate

Updates the data hash of an existing value

function valueUpdate(uint64 id, bytes32 data) external override returns (Descriptor memory meta);

Parameters

NameTypeDescription
iduint64Value ID
databytes32New data hash

Returns

NameTypeDescription
metaDescriptordesc Updated descriptor (revision bumped)

valueUpdate

Updates the data hash of an existing value

function valueUpdate(uint64 id, bytes32 data, string memory symbol)
    external
    override
    returns (Descriptor memory meta);

Parameters

NameTypeDescription
iduint64Value ID
databytes32New data hash
symbolstring

Returns

NameTypeDescription
metaDescriptordesc Updated descriptor (revision bumped)

valueUpgrade

Upgrades the kind/set revision of a value

function valueUpgrade(uint64 id, uint32 kindRev0, uint32 setRev0) external override returns (Descriptor memory meta);

Parameters

NameTypeDescription
iduint64Value ID
kindRev0uint32New kind revision (0 = no change)
setRev0uint32New set revision (0 = no change)

Returns

NameTypeDescription
metaDescriptordesc Descriptor after upgrade

valueTouch

Touches a value, bumping its revision without changing its content

function valueTouch(uint64 id) external override returns (Descriptor memory meta);

Parameters

NameTypeDescription
iduint64Value ID

Returns

NameTypeDescription
metaDescriptordesc Descriptor after touch

valueTransfer

Transfers ownership of a value to a new address

function valueTransfer(uint64 id, address to) external override returns (address from);

Parameters

NameTypeDescription
iduint64Value ID
toaddressAddress to transfer ownership to

Returns

NameTypeDescription
fromaddressAddress of the previous owner

valueRevision

Resolves and validates a revision of a value

function valueRevision(uint64 id, uint32 rev0) external view override returns (uint32 rev);

Parameters

NameTypeDescription
iduint64Value ID
rev0uint32Requested revision (0 = latest)

Returns

NameTypeDescription
revuint32Validated revision (0 = not found)

valueDescriptor

Returns the descriptor of a value at a specific revision

function valueDescriptor(uint64 id, uint32 rev0) external view override returns (Descriptor memory desc);

Parameters

NameTypeDescription
iduint64Value ID
rev0uint32Revision to query (0 = latest)

Returns

NameTypeDescription
descDescriptorDescriptor at the given revision

valueSnapshot

Returns descriptor and elements of a value at a specific revision

function valueSnapshot(uint64 id, uint32 rev0)
    external
    view
    override
    returns (Descriptor memory desc, bytes32[] memory elems);

Parameters

NameTypeDescription
iduint64Value ID
rev0uint32Revision to query (0 = latest)

Returns

NameTypeDescription
descDescriptorDescriptor at the given revision
elemsbytes32[]Element values at the given revision

valueOwner

Returns the current owner of a value

function valueOwner(uint64 id) external view override returns (address owner);

Parameters

NameTypeDescription
iduint64Value ID

Returns

NameTypeDescription
owneraddressCurrent owner's address

valueSota

Returns the latest descriptor and current owner of a value

function valueSota(uint64 id) external view override returns (Descriptor memory desc, address owner);

Parameters

NameTypeDescription
iduint64Value ID

Returns

NameTypeDescription
descDescriptorLatest descriptor
owneraddressCurrent owner's address

valueStatus

Checks whether all specified values are active (revision > 0)

function valueStatus(uint64[] memory ids) external view override returns (bool active);

Parameters

NameTypeDescription
idsuint64[]Array of value IDs

Returns

NameTypeDescription
activeboolTrue if all values exist and are active

_register

function _register(
    uint64 id,
    address code,
    bytes32 data,
    TokenStandard std,
    uint8 decimals,
    string memory symbol,
    address owner
) private returns (Descriptor memory);

_kindOfValueRevision

Returns the latest revision of the Kind-of-Value object

function _kindOfValueRevision() private view returns (uint32);

_setOfValueRevision

Returns the latest revision of the Set-of-Value object

function _setOfValueRevision() private view returns (uint32);

Structs

ValueRegistryStorage

Note: storage-location: erc7201:every.storage.ValueRegistry

struct ValueRegistryStorage {
    Counter48.Counter counter;
    Snapshots.Storage values;
}

Contents

KindElements

Git Source

State Variables

CODE

uint256 constant CODE = 0;

DATA

uint256 constant DATA = 1;

ELEM_SPEC

uint256 constant ELEM_SPEC = 2;

RELS0

uint256 constant RELS0 = 3;

RELS1

uint256 constant RELS1 = 4;

RELS2

uint256 constant RELS2 = 5;

RELS3

uint256 constant RELS3 = 6;

COUNT

uint256 constant COUNT = 7;

Functions

packRelationSpec

function packRelationSpec(uint64[] memory rels) internal pure returns (bytes32, bytes32, bytes32, bytes32);

unpackRelationSpec

function unpackRelationSpec(bytes32 p0, bytes32 p1, bytes32 p2, bytes32 p3) internal pure returns (uint64[] memory);

packElementSpec

function packElementSpec(uint8[] memory elemSpec) internal pure returns (bytes32);

packElementSpec

function packElementSpec(ElementType[] memory elemSpec) internal pure returns (bytes32);

unpackElementSpec

function unpackElementSpec(bytes32 packed) internal pure returns (uint8[] memory);

asUint8Array

function asUint8Array(ElementType[] memory enums) internal pure returns (uint8[] memory casted);

Structs

View

struct View {
    MatterHash code;
    MatterHash data;
    ElementSpecPacked elemSpec;
    RelationQuadPacked rels0;
    RelationQuadPacked rels1;
    RelationQuadPacked rels2;
    RelationQuadPacked rels3;
}

KindRegistryErrors

Git Source

Errors

InvalidCode

error InvalidCode();

InvalidData

error InvalidData();

TooManyElementTypes

error TooManyElementTypes();

InvalidElementType

error InvalidElementType();

TooManyRelations

error TooManyRelations();

InvalidRelation

error InvalidRelation();

UnauthorizedAccess

error UnauthorizedAccess(uint64 id, address vistor);

Contents

ObjectMinterErrors

Git Source

Custom error definitions used throughout the ObjectMinter contract

Errors

MintPolicyInvalidIDRange

ID range is invalid (rangeStart >= rangeEnd)

error MintPolicyInvalidIDRange();

MintPolicyInvalidSaleTime

Sale period is invalid (saleStart >= saleEnd)

error MintPolicyInvalidSaleTime();

MintPolicyInvalidRecipient

Creator address (fundsRecipient) cannot be the zero address

error MintPolicyInvalidRecipient();

MintPolicyInvalidPrice

Price must be zero or valid depending on permission type

error MintPolicyInvalidPrice();

MintPolicyInvalidMintLimit

Mint limit must be non-zero (except for AllowTable)

error MintPolicyInvalidMintLimit();

MintPolicyInvalidPermissionType

Invalid permission type (out of enum range)

error MintPolicyInvalidPermissionType();

MintPolicyInvalidPermissionData

Permission data is incompatible with the permission type

error MintPolicyInvalidPermissionData();

MintPolicyInvalidStatus

Invalid or unexpected status value

error MintPolicyInvalidStatus();

MintPolicyUnavailable

No matching policy found for given object ID and constraints

error MintPolicyUnavailable();

MintPolicyNotFound

Specified policy index does not exist

error MintPolicyNotFound();

MintPolicyIndexOverflow

Policy index exceeds uint32 maximum (overflow)

error MintPolicyIndexOverflow();

MintPolicyInvalidContract

error MintPolicyInvalidContract();

MintInvalidProof

Merkle proof verification failed

error MintInvalidProof();

MintIncorrectPayment

Incorrect ETH amount sent for mint

error MintIncorrectPayment();

MintExceedsMintLimit

Caller has exceeded the allowed number of mints

error MintExceedsMintLimit();

MintCallbackFailed

Callback to IObjectMintable.onObjectMint failed

error MintCallbackFailed();

FeeConfigInvalidRate

Fee basis points exceeds 10,000 (100%)

error FeeConfigInvalidRate();

FeeConfigInvalidRecipient

Protocol fee recipient is the zero address

error FeeConfigInvalidRecipient();

Contents

AdjacencySpecUtils

Git Source

State Variables

MAX_ADJACENCIES

uint256 private constant MAX_ADJACENCIES = 16;

Functions

packQuad

function packQuad(Adjacency[] memory adjs, uint256 offset) internal pure returns (bytes32 out);

pack

function pack(Adjacency[] memory adjs)
    internal
    pure
    returns (bytes32 adjs0, bytes32 adjs1, bytes32 adjs2, bytes32 adjs3);

unpackQuad

function unpackQuad(bytes32 packed) internal pure returns (Adjacency[] memory out);

unpack

function unpack(bytes32 adjs0, bytes32 adjs1, bytes32 adjs2, bytes32 adjs3)
    internal
    pure
    returns (Adjacency[] memory adjs);

ObjectAuthorization

Git Source

Inherits: IObjectAuthorization, OmniRegistryErrors, Initializable

Manages directional authorization rules for object relations. Grants define who can initiate a relation (from or to) based on various criteria, such as ownership, token holding, delegation, or external contract verification.

State Variables

OBJECTAUTHORIZATION_STORAGE_LOCATION

Deterministic storage slot per ERC-7201

bytes32 private constant OBJECTAUTHORIZATION_STORAGE_LOCATION =
    0x66533e6d1966c5548931afa2a923bcafa00e1e6794f41ca0f03bbc3ab865ab00;

Functions

_getObjectAuthorizationStorage

function _getObjectAuthorizationStorage() private pure returns (ObjectAuthorizationStorage storage $);

__ObjectAuthorization_init

function __ObjectAuthorization_init() internal onlyInitializing;

grantFrom

Issues a grant to allow initiating relations from a tail object

function grantFrom(uint128 tail, RelationGrant memory grant) external;

Parameters

NameTypeDescription
tailuint128Tail object ID
grantRelationGrantGrant details

revokeFrom

Revokes a previously issued from grant

function revokeFrom(uint128 tail, uint32 grantId) external;

Parameters

NameTypeDescription
tailuint128Tail object ID
grantIduint32Grant ID to revoke

grantTo

Issues a grant to allow accepting relations to a head object

function grantTo(uint128 head, RelationGrant memory grant) external;

Parameters

NameTypeDescription
headuint128Head object ID
grantRelationGrantGrant details

revokeTo

Revokes a previously issued to grant

function revokeTo(uint128 head, uint32 grantId) external;

Parameters

NameTypeDescription
headuint128Head object ID
grantIduint32Grant 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 allow);

Parameters

NameTypeDescription
grantIduint32Grant ID to check
senderaddressAddress attempting the action
tailuint128Tail object ID
reluint64Relation ID
headKinduint64Kind ID of the target (head) object
headSetuint64Set ID of the target (head) object

Returns

NameTypeDescription
allowboolallowed 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);

Parameters

NameTypeDescription
grantIduint32Grant ID to check
senderaddressAddress attempting the action
headuint128Head object ID
reluint64Relation ID
tailKinduint64Kind ID of the source (tail) object
tailSetuint64Set ID of the source (tail) object

Returns

NameTypeDescription
<none>boolallowed True if authorized

_objectInfo

function _objectInfo(uint64 set, uint64 id)
    internal
    view
    virtual
    returns (Descriptor memory meta, address setContract, address owner);

_objectInfo

function _objectInfo(uint128 sid)
    private
    view
    returns (uint64 id, Descriptor memory meta, address setContract, address owner);

_validateHolder

function _validateHolder(address holder, bytes32 holding) internal view virtual returns (bool);

_validateGrantSpec

function _validateGrantSpec(RelationGrant memory grant) private view;

_validateGrant

function _validateGrant(RelationGrant memory grant, address sender, uint128 sid, uint64 rel, uint64 kind, uint64 set)
    private
    view
    returns (bool);

_grantKey

function _grantKey(uint8 direction, uint128 sid, uint32 grantId) private pure returns (uint256);

_pointerKey

function _pointerKey(uint8 direction, uint128 sid) private pure returns (uint256);

Structs

GrantPointer

struct GrantPointer {
    uint32 lastId;
    uint32 minValidId;
}

ObjectAuthorizationStorage

Note: storage-location: erc7201:every.storage.ObjectAuthorization

struct ObjectAuthorizationStorage {
    mapping(uint256 => GrantPointer) pointers;
    mapping(uint256 => RelationGrant) grants;
}

Enums

Direction

enum Direction {
    None,
    From,
    To
}

GrantStatus

enum GrantStatus {
    None,
    Granted,
    Revoked
}

ObjectInteraction

Git Source

Inherits: IObjectInteraction, OmniRegistryErrors, Soke

Tracks directed arcs between objects

State Variables

OBJECTDIGRAPH_STORAGE_LOCATION

Deterministic storage slot per ERC-7201

keccak256(abi.encode(uint256(keccak256("every.storage.ObjectDigraph")) - 1)) & ~bytes32(uint256(0xff))

bytes32 private constant OBJECTDIGRAPH_STORAGE_LOCATION =
    0x3df9584b527247f4900a5c6b7a8400cffee00eb89e1f2f5ad0861af4fb4c0500;

Functions

_getObjectDigraphStorage

function _getObjectDigraphStorage() private pure returns (ObjectDigraphStorage storage $);

__ObjectInteraction_init

function __ObjectInteraction_init() internal onlyInitializing;

relate

Links a tail object to a head object through a relation

function relate(uint256 tail, uint64 rel, uint256 head) external override;

Parameters

NameTypeDescription
tailuint256Encoded tail node
reluint64Relation ID
headuint256Encoded head node

unrelate

Unlinks a tail object from a head object

function unrelate(uint256 tail, uint64 rel, uint256 head) external override;

Parameters

NameTypeDescription
tailuint256Encoded tail node
reluint64Relation ID
headuint256Encoded head node

_kindAdmit

function _kindAdmit(uint64 kind, uint32 rev, uint64 rel) internal view virtual returns (bool admit, uint32 relRev);

_relationAdmit

function _relationAdmit(uint64 rel, uint32 rev, uint64 kind)
    internal
    view
    virtual
    returns (bool admit, uint48 effKind, uint16 effDegs, uint48 totalKind, uint16 totalDegs);

_relationRule

function _relationRule(uint64 rel) internal view virtual returns (RelationRule memory rule);

_objectInfo

function _objectInfo(uint64 set, uint64 id)
    internal
    view
    virtual
    returns (Descriptor memory meta, address setContract, address owner);

_allowFrom

function _allowFrom(uint32 grant, address sender, uint128 tail, uint64 rel, uint64 headKind, uint64 headSet)
    internal
    view
    virtual
    returns (bool allow);

_allowTo

function _allowTo(uint32 grant, address sender, uint128 head, uint64 rel, uint64 tailKind, uint64 tailSet)
    internal
    view
    virtual
    returns (bool allow);

_transferTailObjectOnRelate

function _transferTailObjectOnRelate(
    RelationRule memory rule,
    ObjectInfo memory tail,
    ObjectInfo memory head,
    address caller
) private returns (HoldingState holdingState, address holdingExtra);

_transferTailObjectOnUnrelate

function _transferTailObjectOnUnrelate(
    RichArc memory arc,
    RelationRule memory rule,
    ObjectInfo memory tail,
    ObjectInfo memory head,
    address caller
) private;

_executeHeadHookOnRelate

function _executeHeadHookOnRelate(ObjectInfo memory head, uint64 rel, uint64 tailData, ObjectInfo memory tail)
    private
    returns (Descriptor memory meta);

_executeHeadHookOnUnrelate

function _executeHeadHookOnUnrelate(ObjectInfo memory head, uint64 rel, uint64 tailData, ObjectInfo memory tail)
    private
    returns (Descriptor memory meta);

_requireKindAdmitRelation

function _requireKindAdmitRelation(uint64 headKind, uint32 kindRev, uint64 rel) private view returns (uint32);

_requireRelationAdmitKind

function _requireRelationAdmitKind(uint64 rel, uint32 relRev, uint64 tailKind)
    private
    view
    returns (DegreeBounds memory bounds, RelationRule memory rule);

_requireNoOutgoingArc

function _requireNoOutgoingArc(uint128 tail) private view;

_requireArcExists

function _requireArcExists(uint128 tail, uint128 head, uint64 rel) private view returns (RichArc memory arc);

_requirePostDegreeInRange

function _requirePostDegreeInRange(uint128 headSid, uint64 rel, int256 delta, DegreeBounds memory bounds)
    private
    view
    returns (uint256 effkindKey, uint256 totalKey);

_requireObjectExists

function _requireObjectExists(uint128 sid) private view returns (ObjectInfo memory);

_requireRelateAllowed

function _requireRelateAllowed(
    uint64 rel,
    ObjectInfo memory tail,
    ObjectInfo memory head,
    address caller,
    uint32 tailGrant,
    uint32 headGrant
) private view;

_requireUnrelateAllowed

function _requireUnrelateAllowed(
    RichArc memory arc,
    RelationRule memory rule,
    ObjectInfo memory tail,
    ObjectInfo memory head,
    address caller
) private view;

_requireDegreeInRange

function _requireDegreeInRange(uint256 deg, uint48 kind, uint16 degs) private pure;

_calcNewOwner

function _calcNewOwner(address tailOwner, address headOwner, address caller, address extra, HoldingState s)
    private
    pure
    returns (address newOwner);

_makeDegreeKey

function _makeDegreeKey(uint128 sid, uint64 rel, uint48 kind) private pure returns (uint256);

_encodeArc

function _encodeArc(uint64 rel, uint64 data, uint128 sid) private pure returns (uint256 arc);

_decodeVertex

function _decodeVertex(uint256 vtx) private pure returns (uint64 data, uint32 grant, uint128 sid);

Structs

RichArc

struct RichArc {
    uint48 time;
    uint48 effKind;
    uint48 rel;
    uint112 head;
    uint8 holdingState;
    address holdingExtra;
    uint24 padding;
    uint64 relData;
}

RelationOwnerShiftPlan

struct RelationOwnerShiftPlan {
    bool transfer;
    HoldingState holdingState;
    address from;
    address to;
    address holdingExtra;
}

ObjectInfo

struct ObjectInfo {
    uint64 id;
    uint128 sid;
    Descriptor meta;
    address setContract;
    address owner;
}

DegreeBounds

struct DegreeBounds {
    uint48 kind;
    uint16 kindDegs;
    uint48 totalKind;
    uint16 totalDegs;
}

ObjectDigraphStorage

Note: storage-location: erc7201:every.storage.ObjectDigraph

struct ObjectDigraphStorage {
    mapping(uint128 => RichArc) outArcs;
    mapping(uint256 => uint256) inDegs;
}

Enums

HoldingState

enum HoldingState {
    None,
    TailOwner,
    HeadOwner,
    Caller,
    Preset,
    Burned,
    Resolved,
    Pending
}

OmniRegistryErrors

Git Source

Errors

InvalidCode

error InvalidCode();

InvalidData

error InvalidData();

Unimplemented

error Unimplemented();

RecordNotExist

error RecordNotExist(uint64 id);

AdjacencyUnderflow

error AdjacencyUnderflow();

AdjacencyOverflow

error AdjacencyOverflow();

AdjacencyUnordered

error AdjacencyUnordered();

AdjacencyKindNotExist

error AdjacencyKindNotExist();

HeadKindRejectsRelation

error HeadKindRejectsRelation();

RelationRejectsTailKind

error RelationRejectsTailKind();

HeadSetRejectsTailObject

error HeadSetRejectsTailObject();

DegreeOverflow

error DegreeOverflow(uint48 kind);

DegreeUnderflow

error DegreeUnderflow(uint48 kind);

ArcExists

error ArcExists();

ArcNotExist

error ArcNotExist();

ArcMismatch

error ArcMismatch();

InvalidKind

error InvalidKind();

InvalidRelation

error InvalidRelation();

InvalidRelateShift

error InvalidRelateShift();

InvalidUnrelateShift

error InvalidUnrelateShift();

UnsupportedHoldingState

error UnsupportedHoldingState();

UnrelateLocked

error UnrelateLocked();

GrantNotFound

error GrantNotFound();

GrantRevoked

error GrantRevoked();

GrantFilterRelationInvalid

error GrantFilterRelationInvalid();

GrantFilterKindInvalid

error GrantFilterKindInvalid();

GrantFilterSetInvalid

error GrantFilterSetInvalid();

GrantInitiatorAnyoneExtraNotAllowed

error GrantInitiatorAnyoneExtraNotAllowed();

GrantInitiatorOwnerExtraNotAllowed

error GrantInitiatorOwnerExtraNotAllowed();

GrantInitiatorDelegateAddressInvalid

error GrantInitiatorDelegateAddressInvalid();

GrantInitiatorEligibleAddressInvalid

error GrantInitiatorEligibleAddressInvalid();

GrantInitiatorEligibleNotContract

error GrantInitiatorEligibleNotContract();

GrantInitiatorHolderValueParamsInvalid

error GrantInitiatorHolderValueParamsInvalid();

GrantInitiatorHolderUniqueParamsInvalid

error GrantInitiatorHolderUniqueParamsInvalid();

GrantInitiatorHolderObjectParamsInvalid

error GrantInitiatorHolderObjectParamsInvalid();

GrantInitiatorHolderTokenTypeUnknown

error GrantInitiatorHolderTokenTypeUnknown();

GrantInitiatorTypeUnknown

error GrantInitiatorTypeUnknown();

UnauthorizedAccess

error UnauthorizedAccess(uint64 id, address vistor);

Unauthorized

error Unauthorized();

RelationAdjacencies

Git Source

Inherits: OmniRegistryErrors, Initializable

Stores and verifies relation adjacency specs

State Variables

RELATIONADJACENCIES_STORAGE_LOCATION

Deterministic storage slot per ERC-7201

keccak256(abi.encode(uint256(keccak256("every.storage.RelationAdjacencies")) - 1)) & ~bytes32(uint256(0xff))

bytes32 private constant RELATIONADJACENCIES_STORAGE_LOCATION =
    0x8f9f6b9dd32d65efadc33d5cec42974db93f3ef45f03c2694c960af8740c1c00;

Functions

_getRelationAdjacenciesStorage

function _getRelationAdjacenciesStorage() private pure returns (RelationAdjacenciesStorage storage $);

__RelationAdjacencies_init

function __RelationAdjacencies_init() internal onlyInitializing;

_insert

function _insert(Adjacency[] memory adjs) internal returns (bytes32 specId);

_admit

function _admit(bytes32 specId, uint48 kind)
    internal
    view
    returns (bool admit, uint48 effKind, uint16 effDegs, uint48 totalKind, uint16 totalDegs);

_validate

function _validate(Adjacency[] memory adjs) internal pure returns (SpecIndex memory result);

_hash

function _hash(Adjacency[] memory adjs) private pure returns (bytes32 specId);

_hash

function _hash(bytes32 a0, bytes32 a1, bytes32 a2, bytes32 a3) private pure returns (bytes32 specId);

Structs

KindIndex

struct KindIndex {
    uint16 kindDegs;
    uint16 totalDegs;
    bool status;
    bool totalSpecified;
}

SpecIndex

struct SpecIndex {
    uint16 othersDegs;
    uint16 totalDegs;
    bool status;
    bool totalSpecified;
    bool othersSpecified;
    uint8 kindsSpecified;
}

RelationAdjacenciesStorage

Note: storage-location: erc7201:every.storage.RelationAdjacencies

struct RelationAdjacenciesStorage {
    mapping(bytes32 => mapping(uint48 => KindIndex)) kindIndices;
    mapping(bytes32 => SpecIndex) specIndices;
}

RelationElements

Git Source

State Variables

CODE

uint256 constant CODE = 0;

DATA

uint256 constant DATA = 1;

RULE

uint256 constant RULE = 2;

ADJS0

uint256 constant ADJS0 = 3;

ADJS1

uint256 constant ADJS1 = 4;

ADJS2

uint256 constant ADJS2 = 5;

ADJS3

uint256 constant ADJS3 = 6;

INDICES

uint256 constant INDICES = 7;

COUNT

uint256 constant COUNT = 8;

Functions

packRelationRule

function packRelationRule(RelationRule memory rule) internal pure returns (bytes32 packed);

unpackRelationRule

function unpackRelationRule(bytes32 packed) internal pure returns (RelationRule memory rule);

Structs

View

struct View {
    MatterHash code;
    MatterHash data;
    RelationRulePacked rule;
    AdjacencyQuadPacked adjs0;
    AdjacencyQuadPacked adjs1;
    AdjacencyQuadPacked adjs2;
    AdjacencyQuadPacked adjs3;
    bytes32 indices;
}

RelationRegistry

Git Source

Inherits: IRelationRegistry, OmniRegistryErrors, Soke, RelationAdjacencies

Relation registration and management

State Variables

RELATIONREGISTRY_STORAGE_LOCATION

Deterministic storage slot per ERC-7201

keccak256(abi.encode(uint256(keccak256("every.storage.RelationRegistry")) - 1)) & ~bytes32(uint256(0xff))

bytes32 private constant RELATIONREGISTRY_STORAGE_LOCATION =
    0xb889e63ac5a7d4985910c5a264fb181e381a8a3f46d10618004be5e9438ffc00;

Functions

_getRelationRegistryStorage

function _getRelationRegistryStorage() private pure returns (RelationRegistryStorage storage $);

__RelationRegistry_init

function __RelationRegistry_init() internal onlyInitializing;

relationRegister

Registers a new relation

function relationRegister(address code, bytes32 data, RelationRule memory rule, Adjacency[] memory adjs)
    external
    override
    returns (uint64 id, Descriptor memory meta);

Parameters

NameTypeDescription
codeaddressOptional logic contract address
databytes32Hash of the relation’s associated data
ruleRelationRuleRule defining the behavior and constraints of the relation
adjsAdjacency[]Array of tail kind admissibility and degree limits

Returns

NameTypeDescription
iduint64New relation ID
metaDescriptordesc Descriptor after registration

relationUpdate

Updates the data hash of a relation

function relationUpdate(uint64 id, bytes32 data) external override returns (Descriptor memory meta);

Parameters

NameTypeDescription
iduint64Relation ID
databytes32New data hash

Returns

NameTypeDescription
metaDescriptordesc Updated descriptor

relationUpdate

Updates the data hash of a relation

function relationUpdate(uint64 id, bytes32 data, Adjacency[] memory adjs)
    external
    override
    returns (Descriptor memory meta);

Parameters

NameTypeDescription
iduint64Relation ID
databytes32New data hash
adjsAdjacency[]

Returns

NameTypeDescription
metaDescriptordesc Updated descriptor

relationUpgrade

Upgrades the kind or set revision of a relation

function relationUpgrade(uint64 id, uint32 kindRev, uint32 setRev) external override returns (Descriptor memory meta);

Parameters

NameTypeDescription
iduint64Relation ID
kindRevuint32New kind revision (0 = no change)
setRevuint32New set revision (0 = no change)

Returns

NameTypeDescription
metaDescriptordesc Descriptor after upgrade

relationTouch

Touches a relation (bumps revision without modifying content)

function relationTouch(uint64 id) external override returns (Descriptor memory meta);

Parameters

NameTypeDescription
iduint64Relation ID

Returns

NameTypeDescription
metaDescriptordesc Descriptor after touch

relationTransfer

Transfers ownership of a relation to a new address

function relationTransfer(uint64 id, address to) external override returns (address from);

Parameters

NameTypeDescription
iduint64Relation ID
toaddressNew owner address

Returns

NameTypeDescription
fromaddressPrevious owner address

relationRevision

Resolves and validates a revision number

function relationRevision(uint64 id, uint32 rev0) external view override returns (uint32 rev);

Parameters

NameTypeDescription
iduint64Relation ID
rev0uint32Requested revision (0 = latest)

Returns

NameTypeDescription
revuint32Validated revision (0 if not found)

relationDescriptor

Returns descriptor of a relation at a specific revision

function relationDescriptor(uint64 id, uint32 rev0) external view override returns (Descriptor memory desc);

Parameters

NameTypeDescription
iduint64Relation ID
rev0uint32Revision to query (0 = latest)

Returns

NameTypeDescription
descDescriptorDescriptor at the specified revision

relationSnapshot

Returns descriptor and packed elements at a specific revision

function relationSnapshot(uint64 id, uint32 rev0)
    external
    view
    override
    returns (Descriptor memory desc, bytes32[] memory elems);

Parameters

NameTypeDescription
iduint64Relation ID
rev0uint32Revision to query (0 = latest)

Returns

NameTypeDescription
descDescriptorDescriptor at the revision
elemsbytes32[]Elements at the revision

relationOwner

Gets the current owner of a relation

function relationOwner(uint64 id) external view override returns (address owner);

Parameters

NameTypeDescription
iduint64Relation ID

Returns

NameTypeDescription
owneraddressAddress of the current owner

relationSota

Returns the latest descriptor and current owner of a relation

function relationSota(uint64 id) external view override returns (Descriptor memory desc, address owner);

Parameters

NameTypeDescription
iduint64Relation ID

Returns

NameTypeDescription
descDescriptorLatest descriptor
owneraddressCurrent owner

relationStatus

Checks whether all specified relations are active (rev > 0)

function relationStatus(uint64[] memory ids) external view override returns (bool active);

Parameters

NameTypeDescription
idsuint64[]Array of relation IDs

Returns

NameTypeDescription
activeboolTrue if all are valid and active

relationRule

Returns the rule definition for a relation

function relationRule(uint64 id) external view override returns (RelationRule memory rule);

Parameters

NameTypeDescription
iduint64Relation ID

Returns

NameTypeDescription
ruleRelationRulePossession 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
    override
    returns (bool admit, uint48 effKind, uint16 effDegs, uint48 totalKind, uint16 totalDegs);

Parameters

NameTypeDescription
iduint64Relation ID
revuint32Revision to check
kinduint64Tail kind ID to evaluate

Returns

NameTypeDescription
admitboolWhether the kind is admitted
effKinduint48Matched kind (0 = wildcard match)
effDegsuint16Degree bounds for the matched kind
totalKinduint48Special marker for total-kind (2^48-1 if defined)
totalDegsuint16Degree bounds for the total-kind

_relationAdmit

function _relationAdmit(uint64 id, uint32 rev, uint64 kind)
    internal
    view
    virtual
    returns (bool admit, uint48 effKind, uint16 effDegs, uint48 totalKind, uint16 totalDegs);

_relationRule

function _relationRule(uint64 id) internal view virtual returns (RelationRule memory rule);

_kindOfRelationRevision

Returns the latest revision of the Kind-of-Value object

function _kindOfRelationRevision() private view returns (uint32);

_setOfRelationRevision

Returns the latest revision of the Set-of-Value object

function _setOfRelationRevision() private view returns (uint32);

Structs

RelationRegistryStorage

Note: storage-location: erc7201:every.storage.RelationRegistry

struct RelationRegistryStorage {
    Counter48.Counter counter;
    Snapshots.Storage relations;
}

Contents

SetElements

Git Source

State Variables

CODE

uint256 constant CODE = 0;

DATA

uint256 constant DATA = 1;

COUNT

uint256 constant COUNT = 2;

Structs

View

struct View {
    MatterHash code;
    MatterHash data;
}

SetRegistryErrors

Git Source

Errors

InvalidCode

error InvalidCode();

InvalidData

error InvalidData();

SetContractNoCode

error SetContractNoCode();

SetContractNotIInteroperable

error SetContractNotIInteroperable();

SetContractNotISet

error SetContractNotISet();

SetContractAlreadyRegistered

error SetContractAlreadyRegistered();

SetContractNotRegistered

error SetContractNotRegistered();

OnSetRegisterRejected

error OnSetRegisterRejected();

OnSetRegisterReverted

error OnSetRegisterReverted();

OnSetUpdateRejected

error OnSetUpdateRejected();

OnSetUpdateReverted

error OnSetUpdateReverted();

OnSetUpgradeRejected

error OnSetUpgradeRejected();

OnSetUpgradeReverted

error OnSetUpgradeReverted();

OnSetTouchRejected

error OnSetTouchRejected();

OnSetTouchReverted

error OnSetTouchReverted();

NoRevisionSpecified

error NoRevisionSpecified();

UnauthorizedAccess

error UnauthorizedAccess(uint64 id, address vistor);

Contents

Contents

IElementRegistry

Git Source

Inherits: IValueRegistry, IUniqueRegistry

Element registration and management

IKindRegistry

Git Source

Interface for managing and registering object kinds

Functions

kindRegister

Registers a new kind

function kindRegister(bytes32 code, bytes32 data, ElementType[] memory elemSpec, uint64[] memory rels)
    external
    returns (uint64 id, Descriptor memory desc);

Parameters

NameTypeDescription
codebytes32Code hash of the kind
databytes32Data hash of the kind
elemSpecElementType[]Element type layout for objects of this kind
relsuint64[]Supported relation IDs

Returns

NameTypeDescription
iduint64New kind ID
descDescriptorDescriptor 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

NameTypeDescription
iduint64Kind ID
codebytes32New code hash (0 = skip)
databytes32New data hash (0 = skip)

Returns

NameTypeDescription
descDescriptorUpdated descriptor

kindUpdate

Updates supported relations of an existing kind

function kindUpdate(uint64 id, uint64[] memory rels) external returns (Descriptor memory desc);

Parameters

NameTypeDescription
iduint64Kind ID
relsuint64[]Updated relation list

Returns

NameTypeDescription
descDescriptorUpdated 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

NameTypeDescription
iduint64Kind ID
codebytes32New code hash (0 = skip)
databytes32New data hash (0 = skip)
relsuint64[]Updated relation list

Returns

NameTypeDescription
descDescriptorUpdated descriptor

kindUpgrade

Upgrades kind/set revision of an existing kind

function kindUpgrade(uint64 id, uint32 kindRev, uint32 setRev) external returns (Descriptor memory desc);

Parameters

NameTypeDescription
iduint64Kind ID
kindRevuint32New kind revision (0 = skip)
setRevuint32New set revision (0 = skip)

Returns

NameTypeDescription
descDescriptorDescriptor after upgrade

kindTouch

Touches a kind (bumps revision with no content changes)

function kindTouch(uint64 id) external returns (Descriptor memory desc);

Parameters

NameTypeDescription
iduint64Kind ID

Returns

NameTypeDescription
descDescriptorDescriptor after touch

kindTransfer

Transfers ownership of a kind

function kindTransfer(uint64 id, address to) external returns (address from);

Parameters

NameTypeDescription
iduint64Kind ID
toaddressNew owner address

Returns

NameTypeDescription
fromaddressPrevious owner address

kindRevision

Resolves and validates a specific revision

function kindRevision(uint64 id, uint32 rev0) external view returns (uint32 rev);

Parameters

NameTypeDescription
iduint64Kind ID
rev0uint32Revision to check (0 = latest)

Returns

NameTypeDescription
revuint32Valid 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

NameTypeDescription
iduint64Kind ID
rev0uint32Revision to query (0 = latest)

Returns

NameTypeDescription
descDescriptorDescriptor 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

NameTypeDescription
iduint64Kind ID
rev0uint32Revision to query (0 = latest)

Returns

NameTypeDescription
descDescriptorDescriptor at the revision
elemsbytes32[]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

NameTypeDescription
iduint64Kind ID

Returns

NameTypeDescription
owneraddressOwner 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

NameTypeDescription
iduint64Kind ID

Returns

NameTypeDescription
descDescriptorLatest descriptor
owneraddressCurrent owner address

kindStatus

Checks whether all specified kinds are active (rev > 0)

function kindStatus(uint64[] memory ids) external view returns (bool active);

Parameters

NameTypeDescription
idsuint64[]List of kind IDs

Returns

NameTypeDescription
activeboolTrue 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

NameTypeDescription
kinduint64Kind ID
revuint32Kind revision (0 = latest)
reluint64Relation ID to check

Returns

NameTypeDescription
admitboolWhether the relation is admitted
relRevuint32Specific relation revision admitted (0 = latest)

Events

KindRegistered

Emitted when a new kind is registered

event KindRegistered(
    uint64 id, Descriptor desc, bytes32 code, bytes32 data, ElementType[] elemSpec, uint64[] rels, address owner
);

Parameters

NameTypeDescription
iduint64Kind ID
descDescriptorDescriptor after registration
codebytes32Code hash associated with the kind
databytes32Data hash associated with the kind
elemSpecElementType[]Element type layout for objects of this kind
relsuint64[]Supported relation IDs
owneraddressOwner address of the kind

KindUpdated

Emitted when a kind is updated

event KindUpdated(uint64 id, Descriptor desc, bytes32 code, bytes32 data, uint64[] rels);

Parameters

NameTypeDescription
iduint64Kind ID
descDescriptorUpdated descriptor
codebytes32Updated code hash
databytes32Updated data hash
relsuint64[]Updated supported relations

KindUpgraded

Emitted when a kind is upgraded

event KindUpgraded(uint64 id, Descriptor desc);

Parameters

NameTypeDescription
iduint64Kind ID
descDescriptorDescriptor after upgrade

KindTouched

Emitted when a kind is touched (revision bump only)

event KindTouched(uint64 id, Descriptor desc);

Parameters

NameTypeDescription
iduint64Kind ID
descDescriptorDescriptor after touch

KindTransferred

Emitted when kind ownership is transferred

event KindTransferred(uint64 id, address from, address to);

Parameters

NameTypeDescription
iduint64Kind ID
fromaddressPrevious owner
toaddressNew owner

IObjectAuthorization

Git Source

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

NameTypeDescription
tailuint128Tail object ID
grantRelationGrantGrant details

revokeFrom

Revokes a previously issued from grant

function revokeFrom(uint128 tail, uint32 grantId) external;

Parameters

NameTypeDescription
tailuint128Tail object ID
grantIduint32Grant ID to revoke

grantTo

Issues a grant to allow accepting relations to a head object

function grantTo(uint128 head, RelationGrant memory grant) external;

Parameters

NameTypeDescription
headuint128Head object ID
grantRelationGrantGrant details

revokeTo

Revokes a previously issued to grant

function revokeTo(uint128 head, uint32 grantId) external;

Parameters

NameTypeDescription
headuint128Head object ID
grantIduint32Grant 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

NameTypeDescription
grantIduint32Grant ID to check
senderaddressAddress attempting the action
tailuint128Tail object ID
reluint64Relation ID
headKinduint64Kind ID of the target (head) object
headSetuint64Set ID of the target (head) object

Returns

NameTypeDescription
allowedboolTrue 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

NameTypeDescription
grantIduint32Grant ID to check
senderaddressAddress attempting the action
headuint128Head object ID
reluint64Relation ID
tailKinduint64Kind ID of the source (tail) object
tailSetuint64Set ID of the source (tail) object

Returns

NameTypeDescription
allowedboolTrue 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

NameTypeDescription
tailuint128Tail object ID (initiator)
grantRelationGrantGrant definition

RevokeFrom

Emitted when a grant from a tail object is revoked

event RevokeFrom(uint128 tail, uint32 grantId);

Parameters

NameTypeDescription
tailuint128Tail object ID (initiator)
grantIduint32ID 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

NameTypeDescription
headuint128Head object ID (receiver)
grantRelationGrantGrant definition

RevokeTo

Emitted when a grant to a head object is revoked

event RevokeTo(uint128 head, uint32 grantId);

Parameters

NameTypeDescription
headuint128Head object ID (receiver)
grantIduint32ID of the revoked grant

IObjectInteraction

Git Source

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

NameTypeDescription
tailuint256Encoded tail node
reluint64Relation ID
headuint256Encoded head node

unrelate

Unlinks a tail object from a head object

function unrelate(uint256 tail, uint64 rel, uint256 head) external;

Parameters

NameTypeDescription
tailuint256Encoded tail node
reluint64Relation ID
headuint256Encoded head node

Events

Emitted when a tail is linked to a head through a relation

event Related(uint128 head, Descriptor desc, uint256 arc);

Parameters

NameTypeDescription
headuint128Encoded SID of the head object
descDescriptorDescriptor of the head after the relation
arcuint256Encoded incoming arc

Emitted when multiple tails are linked to a head

event Related(uint128 head, Descriptor desc, uint256[] arcs);

Parameters

NameTypeDescription
headuint128Encoded SID of the head object
descDescriptorDescriptor of the head after the relations
arcsuint256[]Array of encoded incoming arcs

Unrelated

Emitted when a tail is unlinked from a head

event Unrelated(uint128 head, Descriptor desc, uint256 arc);

Parameters

NameTypeDescription
headuint128Encoded SID of the head object
descDescriptorDescriptor of the head after unlinking
arcuint256Encoded incoming arc

Unrelated

Emitted when multiple tails are unlinked from a head

event Unrelated(uint128 head, Descriptor desc, uint256[] arcs);

Parameters

NameTypeDescription
headuint128Encoded SID of the head object
descDescriptorDescriptor of the head after unlinking
arcsuint256[]Array of encoded incoming arcs

IObjectMinter

Git Source

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

NameTypeDescription
toaddressThe recipient address
setaddressThe set address
iduint64The 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

NameTypeDescription
toaddressThe recipient address
setaddressThe set address
iduint64The object ID to mint
databytesAdditional 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

NameTypeDescription
toaddressThe recipient address
setaddressThe set address
iduint64The object ID to mint
authbytesABI-encoded authorization data (see IMintAuthArgument)
policyuint32The 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

NameTypeDescription
toaddressThe recipient address
setaddressThe set address
iduint64The object ID to mint
databytesAdditional mint data
authbytesABI-encoded authorization data (see IMintAuthArgument)
policyuint32The 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

NameTypeDescription
policyMintPolicyThe policy details to add

Returns

NameTypeDescription
indexuint32The assigned policy index

mintPolicyDisable

Disable a mint policy (callable only by set contracts)

function mintPolicyDisable(uint32 index) external;

Parameters

NameTypeDescription
indexuint32The policy index to disable

mintPolicyEnable

Enable a mint policy (callable only by set contracts)

function mintPolicyEnable(uint32 index) external;

Parameters

NameTypeDescription
indexuint32The policy index to enable

mintPolicyCount

Get number of mint policies for a set

function mintPolicyCount(address set) external view returns (uint256 count);

Parameters

NameTypeDescription
setaddressThe set address to query

Returns

NameTypeDescription
countuint256Number of policies

mintPolicyGet

Get mint policy by index

function mintPolicyGet(address set, uint32 index) external view returns (MintPolicy memory policy);

Parameters

NameTypeDescription
setaddressThe set address
indexuint32Policy index

Returns

NameTypeDescription
policyMintPolicyThe 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

NameTypeDescription
setaddressThe set address
iduint64The object ID to check
maskuint8Bitmask indicating which MintPermissionType values are included. Each bit corresponds to a permission type (e.g., bit 0 = Public, bit 1 = Allowlist, etc.).

Returns

NameTypeDescription
policyMintPolicyThe 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

NameTypeDescription
setaddressThe set address
iduint64The object ID to check
maskuint8Bitmask indicating which MintPermissionType values are included. Each bit corresponds to a permission type (e.g., bit 0 = Public, bit 1 = Allowlist, etc.).
offsetuint32Starting policy index to search from

Returns

NameTypeDescription
policyMintPolicyThe first matching mint policy

Events

MintPolicyEnabled

Emitted when a mint policy is enabled

event MintPolicyEnabled(address set, MintPolicy policy);

Parameters

NameTypeDescription
setaddressThe set address the policy applies to
policyMintPolicyThe enabled policy details

MintPolicyDisabled

Emitted when a mint policy is disabled

event MintPolicyDisabled(address set, MintPolicy policy);

Parameters

NameTypeDescription
setaddressThe set address the policy applies to
policyMintPolicyThe 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

NameTypeDescription
setaddressThe address of the set contract the object is minted from
iduint64The ID of the minted object within the set
operatoraddressThe address that initiated the mint (usually msg.sender)
toaddressThe recipient address receiving the minted object
currencyaddressThe address of the payment token (native or ERC20)
paymentuint96The total payment (includes both fee and funds)
fundsRecipientaddressThe address receiving the creator or project revenue
fundsuint96The amount sent to the fundsRecipient
feeRecipientaddressThe address receiving the protocol fee
feeuint96The amount sent to the feeRecipient

IOmniRegistry

Git Source

Inherits: IRelationRegistry, IObjectAuthorization, IObjectInteraction

Interface for object interactions

IRelationRegistry

Git Source

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

NameTypeDescription
codeaddressOptional logic contract address
databytes32Hash of the relation’s associated data
ruleRelationRuleRule defining the behavior and constraints of the relation
adjsAdjacency[]Array of tail kind admissibility and degree limits

Returns

NameTypeDescription
iduint64New relation ID
descDescriptorDescriptor after registration

relationUpdate

Updates the data hash of a relation

function relationUpdate(uint64 id, bytes32 data) external returns (Descriptor memory desc);

Parameters

NameTypeDescription
iduint64Relation ID
databytes32New data hash

Returns

NameTypeDescription
descDescriptorUpdated 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

NameTypeDescription
iduint64Relation ID
databytes32New data hash
adjsAdjacency[]New array of adjacency rules

Returns

NameTypeDescription
descDescriptorUpdated 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

NameTypeDescription
iduint64Relation ID
kindRevuint32New kind revision (0 = no change)
setRevuint32New set revision (0 = no change)

Returns

NameTypeDescription
descDescriptorDescriptor after upgrade

relationTouch

Touches a relation (bumps revision without modifying content)

function relationTouch(uint64 id) external returns (Descriptor memory desc);

Parameters

NameTypeDescription
iduint64Relation ID

Returns

NameTypeDescription
descDescriptorDescriptor after touch

relationTransfer

Transfers ownership of a relation to a new address

function relationTransfer(uint64 id, address to) external returns (address from);

Parameters

NameTypeDescription
iduint64Relation ID
toaddressNew owner address

Returns

NameTypeDescription
fromaddressPrevious owner address

relationRevision

Resolves and validates a revision number

function relationRevision(uint64 id, uint32 rev0) external view returns (uint32 rev);

Parameters

NameTypeDescription
iduint64Relation ID
rev0uint32Requested revision (0 = latest)

Returns

NameTypeDescription
revuint32Validated 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

NameTypeDescription
iduint64Relation ID
rev0uint32Revision to query (0 = latest)

Returns

NameTypeDescription
descDescriptorDescriptor 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

NameTypeDescription
iduint64Relation ID
rev0uint32Revision to query (0 = latest)

Returns

NameTypeDescription
descDescriptorDescriptor at the revision
elemsbytes32[]Elements at the revision

relationOwner

Gets the current owner of a relation

function relationOwner(uint64 id) external view returns (address owner);

Parameters

NameTypeDescription
iduint64Relation ID

Returns

NameTypeDescription
owneraddressAddress 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

NameTypeDescription
iduint64Relation ID

Returns

NameTypeDescription
descDescriptorLatest descriptor
owneraddressCurrent owner

relationStatus

Checks whether all specified relations are active (rev > 0)

function relationStatus(uint64[] memory ids) external view returns (bool active);

Parameters

NameTypeDescription
idsuint64[]Array of relation IDs

Returns

NameTypeDescription
activeboolTrue 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

NameTypeDescription
iduint64Relation ID

Returns

NameTypeDescription
ruleRelationRulePossession 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

NameTypeDescription
iduint64Relation ID
revuint32Revision to check
kinduint64Tail kind ID to evaluate

Returns

NameTypeDescription
admitboolWhether the kind is admitted
effKinduint48Matched kind (0 = wildcard match)
effDegsuint16Degree bounds for the matched kind
totalKinduint48Special marker for total-kind (2^48-1 if defined)
totalDegsuint16Degree 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

NameTypeDescription
iduint64ID of the relation
descDescriptorDescriptor of the relation
codeaddressOptional logic contract address
databytes32Hash of the associated metadata or logic
ruleRelationRuleRelation rule defining interaction logic
adjsAdjacency[]List of admitted tail kinds and degree constraints
owneraddressAddress of the relation's owner

RelationUpdated

Emitted when a relation is updated

event RelationUpdated(uint64 id, Descriptor desc, bytes32 data);

Parameters

NameTypeDescription
iduint64ID of the relation
descDescriptorUpdated descriptor
databytes32New data hash

RelationUpgraded

Emitted when a relation is upgraded (kind/set revision bumped)

event RelationUpgraded(uint64 id, Descriptor desc);

Parameters

NameTypeDescription
iduint64ID of the relation
descDescriptorDescriptor after upgrade

RelationTouched

Emitted when a relation is touched (revision incremented without content change)

event RelationTouched(uint64 id, Descriptor desc);

Parameters

NameTypeDescription
iduint64ID of the relation
descDescriptorDescriptor after touch

RelationTransferred

Emitted when ownership of a relation is transferred

event RelationTransferred(uint64 id, address from, address to);

Parameters

NameTypeDescription
iduint64ID of the relation
fromaddressPrevious owner
toaddressNew owner

ISetRegistry

Git Source

Interface for registering and managing sets

Functions

setRegister

Registers a new set

function setRegister(bytes32 data) external returns (uint64 id, Descriptor memory desc);

Parameters

NameTypeDescription
databytes32Hash of external content (e.g. metadata or schema)

Returns

NameTypeDescription
iduint64ID of the new set
descDescriptorDescriptor after registration

setUpdate

Updates the data hash of an existing set

function setUpdate(bytes32 data) external returns (uint64 id, Descriptor memory desc);

Parameters

NameTypeDescription
databytes32New data hash

Returns

NameTypeDescription
iduint64ID of the updated set
descDescriptorUpdated descriptor

setUpgrade

Upgrades the kind or set revision

function setUpgrade(uint32 kindRev, uint32 setRev) external returns (uint64 id, Descriptor memory desc);

Parameters

NameTypeDescription
kindRevuint32New kind revision (0 to skip)
setRevuint32New set revision (0 to skip)

Returns

NameTypeDescription
iduint64ID of the set
descDescriptorDescriptor after upgrade

setTouch

Touches a set (increments revision without any changes)

function setTouch() external returns (uint64 id, Descriptor memory desc);

Returns

NameTypeDescription
iduint64ID of the set
descDescriptorDescriptor after touch

setRevision

Resolves and validates a specific revision

function setRevision(uint64 id, uint32 rev0) external view returns (uint32 rev);

Parameters

NameTypeDescription
iduint64Set ID
rev0uint32Requested revision (0 = latest)

Returns

NameTypeDescription
revuint32Validated 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

NameTypeDescription
iduint64Set ID
rev0uint32Revision to query (0 = latest)

Returns

NameTypeDescription
descDescriptorDescriptor 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

NameTypeDescription
iduint64Set ID
rev0uint32Revision to query (0 = latest)

Returns

NameTypeDescription
descDescriptorDescriptor at the revision
elemsbytes32[]Packed element list

setOwner

Returns the current owner of a set

function setOwner(uint64 id) external view returns (address owner);

Parameters

NameTypeDescription
iduint64Set ID

Returns

NameTypeDescription
owneraddressOwner address

setSota

Returns the latest descriptor and current owner

function setSota(uint64 id) external view returns (Descriptor memory desc, address owner);

Parameters

NameTypeDescription
iduint64Set ID

Returns

NameTypeDescription
descDescriptorLatest descriptor
owneraddressCurrent owner

setStatus

Checks whether all provided set IDs are active

function setStatus(uint64[] memory ids) external view returns (bool active);

Parameters

NameTypeDescription
idsuint64[]List of set IDs

Returns

NameTypeDescription
activeboolTrue 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

NameTypeDescription
iduint64Set ID

Returns

NameTypeDescription
codeaddressAddress 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

NameTypeDescription
iduint64ID of the new set
descDescriptorSet descriptor after registration
codeaddressAddress of the associated set contract
databytes32Hash of the associated matter (external content)
owneraddressOwner address of the set

SetUpdated

Emitted when a set is updated

event SetUpdated(uint64 id, Descriptor desc, bytes32 data);

Parameters

NameTypeDescription
iduint64ID of the set
descDescriptorUpdated descriptor
databytes32New data hash

SetUpgraded

Emitted when a set is upgraded

event SetUpgraded(uint64 id, Descriptor desc);

Parameters

NameTypeDescription
iduint64ID of the set
descDescriptorDescriptor after upgrade

SetTouched

Emitted when a set is touched (revision bumped without content change)

event SetTouched(uint64 id, Descriptor desc);

Parameters

NameTypeDescription
iduint64ID of the set
descDescriptorDescriptor after touch

IUniqueRegistry

Git Source

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

NameTypeDescription
codeaddressAddress of the token contract
databytes32Hash of the associated matter
stdTokenStandardToken standard (e.g. ERC721)
decimalsuint8Number of decimals
symbolstringDisplay symbol (max 30 characters)

Returns

NameTypeDescription
iduint64ID of the new unique
descDescriptorDescriptor after registration

uniqueUpdate

Updates the data hash of a unique

function uniqueUpdate(uint64 id, bytes32 data) external returns (Descriptor memory desc);

Parameters

NameTypeDescription
iduint64Unique ID
databytes32New data hash

Returns

NameTypeDescription
descDescriptorUpdated 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

NameTypeDescription
iduint64Unique ID
databytes32New data hash
symbolstringNew display symbol (max 30 characters)

Returns

NameTypeDescription
descDescriptorUpdated 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

NameTypeDescription
iduint64Unique ID
kindRevuint32New kind revision (0 = no change)
setRevuint32New set revision (0 = no change)

Returns

NameTypeDescription
descDescriptorDescriptor after upgrade

uniqueTouch

Bumps the revision of a unique with no content change

function uniqueTouch(uint64 id) external returns (Descriptor memory desc);

Parameters

NameTypeDescription
iduint64Unique ID

Returns

NameTypeDescription
descDescriptorDescriptor after touch

uniqueTransfer

Transfers ownership of a unique token

function uniqueTransfer(uint64 id, address to) external returns (address from);

Parameters

NameTypeDescription
iduint64Unique ID
toaddressAddress of the new owner

Returns

NameTypeDescription
fromaddressAddress of the previous owner

uniqueRevision

Resolves and validates a revision

function uniqueRevision(uint64 id, uint32 rev0) external view returns (uint32 rev);

Parameters

NameTypeDescription
iduint64Unique ID
rev0uint32Requested revision (0 = latest)

Returns

NameTypeDescription
revuint32Resolved 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

NameTypeDescription
iduint64Unique ID
rev0uint32Revision to query (0 = latest)

Returns

NameTypeDescription
descDescriptorDescriptor 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

NameTypeDescription
iduint64Unique ID
rev0uint32Revision to query (0 = latest)

Returns

NameTypeDescription
descDescriptorDescriptor at the revision
elemsbytes32[]Elements at the revision

uniqueOwner

Returns the current owner of a unique

function uniqueOwner(uint64 id) external view returns (address owner);

Parameters

NameTypeDescription
iduint64Unique ID

Returns

NameTypeDescription
owneraddressAddress 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

NameTypeDescription
iduint64Unique ID

Returns

NameTypeDescription
descDescriptorLatest descriptor
owneraddressAddress 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

NameTypeDescription
idsuint64[]List of unique IDs

Returns

NameTypeDescription
activeboolTrue 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

NameTypeDescription
iduint64Unique ID
descDescriptorDescriptor of the unique
codeaddressToken contract address
databytes32Hash of the underlying asset (e.g., image, model, metadata)
specTokenSpecToken specification (standard, decimals, and symbol)
owneraddressAddress of the initial owner

UniqueUpdated

Emitted when a unique is updated

event UniqueUpdated(uint64 id, Descriptor desc, bytes32 data, TokenSpec spec);

Parameters

NameTypeDescription
iduint64Unique ID
descDescriptorUpdated descriptor (same ID, new revision)
databytes32New data hash representing the updated asset
specTokenSpecUpdated or unchanged token specification

UniqueUpgraded

Emitted when a unique is upgraded to a new revision

event UniqueUpgraded(uint64 id, Descriptor desc);

Parameters

NameTypeDescription
iduint64Unique ID
descDescriptorDescriptor 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

NameTypeDescription
iduint64Unique ID
descDescriptorDescriptor after touch (updated revision only)

UniqueTransferred

Emitted when ownership of a unique is transferred

event UniqueTransferred(uint64 id, address from, address to);

Parameters

NameTypeDescription
iduint64Unique ID
fromaddressPrevious owner's address
toaddressNew owner's address

IValueRegistry

Git Source

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

NameTypeDescription
codeaddressToken contract address
databytes32Hash of the underlying matter or metadata
stdTokenStandardToken standard (e.g. ERC20)
decimalsuint8Token's decimal precision
symbolstringDisplay symbol (max 30 characters)

Returns

NameTypeDescription
iduint64New value ID
descDescriptorDescriptor after registration

valueUpdate

Updates the data hash of an existing value

function valueUpdate(uint64 id, bytes32 data) external returns (Descriptor memory desc);

Parameters

NameTypeDescription
iduint64Value ID
databytes32New data hash

Returns

NameTypeDescription
descDescriptorUpdated 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

NameTypeDescription
iduint64Value ID
databytes32New data hash
symbolstringNew display symbol

Returns

NameTypeDescription
descDescriptorUpdated descriptor

valueUpgrade

Upgrades the kind/set revision of a value

function valueUpgrade(uint64 id, uint32 kindRev0, uint32 setRev0) external returns (Descriptor memory desc);

Parameters

NameTypeDescription
iduint64Value ID
kindRev0uint32New kind revision (0 = no change)
setRev0uint32New set revision (0 = no change)

Returns

NameTypeDescription
descDescriptorDescriptor after upgrade

valueTouch

Touches a value, bumping its revision without changing its content

function valueTouch(uint64 id) external returns (Descriptor memory desc);

Parameters

NameTypeDescription
iduint64Value ID

Returns

NameTypeDescription
descDescriptorDescriptor after touch

valueTransfer

Transfers ownership of a value to a new address

function valueTransfer(uint64 id, address to) external returns (address from);

Parameters

NameTypeDescription
iduint64Value ID
toaddressAddress to transfer ownership to

Returns

NameTypeDescription
fromaddressAddress 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

NameTypeDescription
iduint64Value ID
rev0uint32Requested revision (0 = latest)

Returns

NameTypeDescription
revuint32Validated 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

NameTypeDescription
iduint64Value ID
rev0uint32Revision to query (0 = latest)

Returns

NameTypeDescription
descDescriptorDescriptor 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

NameTypeDescription
iduint64Value ID
rev0uint32Revision to query (0 = latest)

Returns

NameTypeDescription
descDescriptorDescriptor at the given revision
elemsbytes32[]Element values at the given revision

valueOwner

Returns the current owner of a value

function valueOwner(uint64 id) external view returns (address owner);

Parameters

NameTypeDescription
iduint64Value ID

Returns

NameTypeDescription
owneraddressCurrent 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

NameTypeDescription
iduint64Value ID

Returns

NameTypeDescription
descDescriptorLatest descriptor
owneraddressCurrent owner's address

valueStatus

Checks whether all specified values are active (revision > 0)

function valueStatus(uint64[] memory ids) external view returns (bool active);

Parameters

NameTypeDescription
idsuint64[]Array of value IDs

Returns

NameTypeDescription
activeboolTrue 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

NameTypeDescription
iduint64ID of the newly registered value
descDescriptorDescriptor of the value
codeaddressToken contract address
databytes32Hash of the underlying asset or metadata
specTokenSpecToken specification (standard, decimals, symbol)
owneraddressAddress of the initial owner

ValueUpdated

Emitted when a value is updated

event ValueUpdated(uint64 id, Descriptor desc, bytes32 data, TokenSpec spec);

Parameters

NameTypeDescription
iduint64ID of the value
descDescriptorUpdated descriptor (with bumped revision)
databytes32New hash of the asset or metadata
specTokenSpecUpdated or unchanged token specification

ValueUpgraded

Emitted when a value is upgraded (revision of kind/set updated)

event ValueUpgraded(uint64 id, Descriptor desc);

Parameters

NameTypeDescription
iduint64ID of the value
descDescriptorDescriptor after upgrade

ValueTouched

Emitted when a value is touched (revision bump only, no content change)

event ValueTouched(uint64 id, Descriptor desc);

Parameters

NameTypeDescription
iduint64ID of the value
descDescriptorDescriptor after touch

ValueTransferred

Emitted when ownership of a value is transferred

event ValueTransferred(uint64 id, address from, address to);

Parameters

NameTypeDescription
iduint64ID of the value
fromaddressPrevious owner address
toaddressNew owner address

Contents

IERC20MetadataMinimal

Git Source

Functions

name

function name() external view returns (string memory);

symbol

function symbol() external view returns (string memory);

decimals

function decimals() external view returns (uint8);

IERC7572

Git Source

Functions

contractURI

function contractURI() external view returns (string memory);

Events

ContractURIUpdated

event ContractURIUpdated();

Contents

IInteroperable

Git Source

Inherits: IERC165

Interface for set contracts that support object-level interoperability

Enables a set to react to registry lifecycle events and object interactions. These callbacks are invoked before the respective action is finalized. The protocol requires that the callback returns the expected value for the action to proceed.

Functions

onSetRegister

Called before a set is registered

function onSetRegister(uint64 set, Descriptor memory od) external returns (bytes4 selector);

Parameters

NameTypeDescription
setuint64Set ID
odDescriptorDescriptor of the set

Returns

NameTypeDescription
selectorbytes4Must return onSetRegister.selector

onSetUpdate

Called before a set is updated

function onSetUpdate(uint64 set, Descriptor memory od) external returns (bytes4 selector);

Parameters

NameTypeDescription
setuint64Set ID
odDescriptorUpdated descriptor

Returns

NameTypeDescription
selectorbytes4Must return onSetUpdate.selector

onSetUpgrade

Called before a set is upgraded

function onSetUpgrade(uint64 set, Descriptor memory od) external returns (bytes4 selector);

Parameters

NameTypeDescription
setuint64Set ID
odDescriptorDescriptor after upgrade

Returns

NameTypeDescription
selectorbytes4Must return onSetUpgrade.selector

onSetTouch

Called before a set is touched (revision bump with no content change)

function onSetTouch(uint64 set, Descriptor memory od) external returns (bytes4 selector);

Parameters

NameTypeDescription
setuint64Set ID
odDescriptorDescriptor after touch

Returns

NameTypeDescription
selectorbytes4Must return onSetTouch.selector

onObjectRelate

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

NameTypeDescription
iduint64Head object ID (belongs to this set)
reluint64Relation ID
datauint64Optional relation data (uint64 encoded)
tailSetuint64Set ID of the tail object
tailIduint64ID of the tail object
tailKinduint64Kind ID of the tail object

Returns

NameTypeDescription
odDescriptorUpdated descriptor of the head object

onObjectUnrelate

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

NameTypeDescription
iduint64Head object ID (belongs to this set)
reluint64Relation ID
datauint64Optional relation data (uint64 encoded)
tailSetuint64Set ID of the tail object
tailIduint64ID of the tail object
tailKinduint64Kind ID of the tail object

Returns

NameTypeDescription
odDescriptorUpdated descriptor of the head object

onObjectTransfer

Called before ownership of an object from this set is transferred as part of a relation or unrelation operation.

function onObjectTransfer(uint64 id, address from, address to) external returns (bytes4 selector);

Parameters

NameTypeDescription
iduint64ID of the object being transferred
fromaddressCurrent owner
toaddressNew owner

Returns

NameTypeDescription
selectorbytes4Must return onObjectTransfer.selector to proceed

IObjectMinterAdmin

Git Source

Interface for managing mint policies on the object minter

All functions apply to the set represented by the calling contract and must be access-controlled

Functions

addMintPolicy

Adds a new mint policy for the set represented by the calling contract

function addMintPolicy(MintPolicy memory policy) external returns (uint32 index);

Parameters

NameTypeDescription
policyMintPolicyThe policy configuration to add

Returns

NameTypeDescription
indexuint32Assigned policy index

disableMintPolicy

Disables a mint policy for the set represented by the calling contract

function disableMintPolicy(uint32 index) external;

Parameters

NameTypeDescription
indexuint32Index of the policy to disable

enableMintPolicy

Enables a mint policy for the set represented by the calling contract

function enableMintPolicy(uint32 index) external;

Parameters

NameTypeDescription
indexuint32Index of the policy to enable

IRemoteMintable

Git Source

Inherits: IERC165

Interface for set contracts that support minting via an external ObjectMinter

Functions

onObjectMint

Called by ObjectMinter after payment is collected but before finalizing the mint

If id0 is 0, the contract must assign and return a new object ID. If id0 is non-zero, the contract must validate and return the same ID.

function onObjectMint(address operator, address to, uint64 id0, uint256 context, bytes memory data)
    external
    returns (bytes4 selector, uint64 id);

Parameters

NameTypeDescription
operatoraddressAddress that initiated the mint (typically msg.sender)
toaddressRecipient of the newly minted object
id0uint64Requested object ID (0 = assign automatically)
contextuint256Packed 256-bit context data (see MintingContext)
databytesOptional arbitrary payload passed for custom logic

Returns

NameTypeDescription
selectorbytes4Must return onObjectMint.selector to confirm success
iduint64Finalized object ID to be minted

objectMinter

Returns the address of the ObjectMinter contract

function objectMinter() external view returns (address minter);

Returns

NameTypeDescription
minteraddressThe ObjectMinter address

ISet

Git Source

Inherits: IERC165

Minimal interface for set contracts

Functions

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

NameTypeDescription
iduint64Object ID
kindRev0uint32New kind revision (0 = no change)
setRev0uint32New set revision (0 = no change)

Returns

NameTypeDescription
odDescriptorDescriptor after upgrade

touch

Touch an object to increment revision without content change

function touch(uint64 id) external returns (Descriptor memory od);

Parameters

NameTypeDescription
iduint64Object ID

Returns

NameTypeDescription
odDescriptorDescriptor after touch

transfer

Transfer ownership of an object

function transfer(uint64 id, address to) external;

Parameters

NameTypeDescription
iduint64Object ID
toaddressAddress of the new owner

uri

Get URI template for metadata

Client should replace {id} and {rev} placeholders

function uri() external view returns (string memory uri_);

Returns

NameTypeDescription
uri_stringURI template string

owner

Get current owner of an object

function owner(uint64 id) external view returns (address owner_);

Parameters

NameTypeDescription
iduint64Object ID

Returns

NameTypeDescription
owner_addressCurrent owner address

revision

Resolve and validate a revision number

function revision(uint64 id, uint32 rev0) external view returns (uint32 rev);

Parameters

NameTypeDescription
iduint64Object ID
rev0uint32Revision to check (0 = latest)

Returns

NameTypeDescription
revuint32Valid revision (0 if invalid)

descriptor

Get descriptor at a specific revision

function descriptor(uint64 id, uint32 rev0) external view returns (Descriptor memory od);

Parameters

NameTypeDescription
iduint64Object ID
rev0uint32Revision number (0 = latest)

Returns

NameTypeDescription
odDescriptorDescriptor at that revision

elements

Get elements at a specific revision

function elements(uint64 id, uint32 rev0) external view returns (bytes32[] memory elems);

Parameters

NameTypeDescription
iduint64Object ID
rev0uint32Revision number (0 = latest)

Returns

NameTypeDescription
elemsbytes32[]Elements array at that revision

sota

Get the latest descriptor and current owner

function sota(uint64 id) external view returns (Descriptor memory od, address owner_);

Parameters

NameTypeDescription
iduint64Object ID

Returns

NameTypeDescription
odDescriptorDescriptor at the specified revision
owner_addressCurrent owner (not historical)

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

NameTypeDescription
iduint64Object ID
rev0uint32Revision number to query (0 = latest)

Returns

NameTypeDescription
odDescriptorDescriptor at the specified revision
elemsbytes32[]Elements at the specified revision

Events

Created

Emitted when a new object is created

event Created(uint64 id, Descriptor od, bytes32[] elems, address owner);

Parameters

NameTypeDescription
iduint64Object ID
odDescriptorObject descriptor
elemsbytes32[]Elements of the object
owneraddressInitial owner

Updated

Emitted when an object is updated

event Updated(uint64 id, Descriptor od, bytes32[] elems);

Parameters

NameTypeDescription
iduint64Object ID
odDescriptorUpdated descriptor
elemsbytes32[]Updated elements

Upgraded

Emitted when an object is upgraded

event Upgraded(uint64 id, Descriptor od);

Parameters

NameTypeDescription
iduint64Object ID
odDescriptorDescriptor after upgrade

Touched

Emitted when an object is touched (bumped without content change)

event Touched(uint64 id, Descriptor od);

Parameters

NameTypeDescription
iduint64Object ID
odDescriptorLatest descriptor

Destroyed

Emitted when an object is destroyed

event Destroyed(uint64 id, Descriptor od);

Parameters

NameTypeDescription
iduint64Object ID
odDescriptorDescriptor before destruction

Transferred

Emitted when ownership is transferred

event Transferred(uint64 id, address from, address to);

Parameters

NameTypeDescription
iduint64Object ID
fromaddressPrevious owner
toaddressNew owner

ISetRegistryAdmin

Git Source

Interface for privileged set registration and upgrade operations

All methods operate on the set represented by the calling contract and must be access-controlled

Functions

registerSet

Registers the set represented by the calling contract

function registerSet(bytes32 data) external returns (uint64 id, Descriptor memory desc);

Parameters

NameTypeDescription
databytes32Content hash (e.g., metadata or schema)

Returns

NameTypeDescription
iduint64Newly assigned set ID
descDescriptorDescriptor of the registered set

updateSet

Updates the content hash for the set represented by the calling contract

function updateSet(bytes32 data) external returns (uint64 id, Descriptor memory desc);

Parameters

NameTypeDescription
databytes32New content hash

Returns

NameTypeDescription
iduint64Set ID
descDescriptorUpdated descriptor

upgradeSet

Upgrades the kind or set revision of the set represented by the calling contract

Pass 0 to skip updating either revision

function upgradeSet(uint32 kindRev0, uint32 setRev0) external returns (uint64 id, Descriptor memory desc);

Parameters

NameTypeDescription
kindRev0uint32New kind revision (0 = no change)
setRev0uint32New set revision (0 = no change)

Returns

NameTypeDescription
iduint64Set ID
descDescriptorDescriptor after upgrade

touchSet

Increments the revision of the set represented by the calling contract

function touchSet() external returns (uint64 id, Descriptor memory desc);

Returns

NameTypeDescription
iduint64Set ID
descDescriptorDescriptor after revision bump

ISoke

Git Source

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

NameTypeDescription
setraddressAddress of the Set Registry

omniRegistry

Returns the address of the Omni Registry contract

function omniRegistry() external view returns (address omnir);

Returns

NameTypeDescription
omniraddressAddress of the Omni Registry

kindRegistry

Returns the address of the Kind Registry contract

function kindRegistry() external view returns (address kindr);

Returns

NameTypeDescription
kindraddressAddress of the Kind Registry

elementRegistry

Returns the address of the Element Registry contract

function elementRegistry() external view returns (address elemr);

Returns

NameTypeDescription
elemraddressAddress of the Element Registry

Contents

Counter48

Git Source

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

Git Source

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

Git Source

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

Git Source

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

Git Source

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;
    mapping(uint256 => Revision) revisions;
}

Contents

Descriptor

Git Source

struct Descriptor {
    uint32 traits;
    uint32 rev;
    uint32 kindRev;
    uint32 setRev;
    uint64 kindId;
    uint64 setId;
}

DescriptorPacked

Git Source

type DescriptorPacked is bytes32;

DescriptorLib

Git Source

Functions

pack

function pack(Descriptor memory d) internal pure returns (DescriptorPacked);

unpack

function unpack(DescriptorPacked packed) internal pure returns (Descriptor memory d);

traits

function traits(DescriptorPacked packed) internal pure returns (uint32);

rev

function rev(DescriptorPacked packed) internal pure returns (uint32);

kindRev

function kindRev(DescriptorPacked packed) internal pure returns (uint32);

setRev

function setRev(DescriptorPacked packed) internal pure returns (uint32);

kindId

function kindId(DescriptorPacked packed) internal pure returns (uint64);

setId

function setId(DescriptorPacked packed) internal pure returns (uint64);

ElementType

Git Source

enum ElementType {
    None,
    Info,
    Value,
    Unique,
    Object,
    List,
    Table,
    Perm,
    Json,
    Wasm,
    Image,
    Model
}

ElementLib

Git Source

Structs

ElementValueRef

Reference to a fungible token value instance

struct ElementValueRef {
    uint16 rev;
    uint48 tok;
    uint192 amount;
}

ElementUniqueRef

Reference to a unique token instance

struct ElementUniqueRef {
    uint16 rev;
    uint48 tok;
    uint64 id;
    uint128 amount;
}

ElementObjectRef

Reference to an object instance

struct ElementObjectRef {
    uint128 _reserved;
    uint64 set;
    uint64 id;
}

MatterForm

Git Source

enum MatterForm {
    None,
    List,
    Table,
    Perm,
    Json,
    Wasm,
    Image,
    Model
}

MatterSpec

Git Source

struct MatterSpec {
    MatterForm form;
    bytes31 mime;
}

MatterSpecPacked

Git Source

type MatterSpecPacked is bytes32;

MatterContent

Git Source

struct MatterContent {
    MatterSpecPacked spec;
    bytes blob;
}

MatterHash

Git Source

type MatterHash is bytes32;

MintPolicy

Git Source

Defines the access and payment rules for minting objects

struct MintPolicy {
    uint32 index;
    MintPolicyStatus status;
    MintPermissionType perm;
    uint16 limit;
    uint32 tag;
    address recipient;
    address currency;
    uint96 price;
    uint64 idStart;
    uint64 idEnd;
    uint64 saleStart;
    uint64 saleEnd;
    bytes32 data;
}

MintPolicyStatus

Git Source

Indicates the current status of a mint policy

enum MintPolicyStatus {
    None,
    Enabled,
    Disabled
}

MintPermissionType

Git Source

Access modes used to restrict who can mint

enum MintPermissionType {
    Public,
    Allowlist,
    AllowTable
}

MintPermissionData

Git Source

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

Git Source

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

Git Source

Struct representing packed minting context

Layout (MSB → LSB): [uint64 _reserved | uint64 idStart | uint64 idEnd | uint32 policy | uint32 tag]

struct MintContext {
    uint64 _reserved;
    uint64 idStart;
    uint64 idEnd;
    uint32 policy;
    uint32 tag;
}

MintContextLib

Git Source

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

NameTypeDescription
ctxMintContextThe MintContext struct

Returns

NameTypeDescription
packeduint256The 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

NameTypeDescription
policyuint32Policy index
taguint32Custom user tag
idStartuint64Inclusive object ID start
idEnduint64Exclusive object ID end

Returns

NameTypeDescription
packeduint256The packed uint256 representation

unpack

Unpacks a packed uint256 into a MintContext struct

function unpack(uint256 packed) internal pure returns (MintContext memory ctx);

Parameters

NameTypeDescription
packeduint256The packed uint256

Returns

NameTypeDescription
ctxMintContextThe unpacked MintContext struct

Adjacency

Git Source

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

NameTypeDescription
degsuint16Encodes minimum and maximum degree constraints. minDeg = (degs & 0x8000) >> 15, maxDeg = degs & 0x7FFF
kinduint48Kind ID of the related object. 0 = any other kind, 0xFFFFFFFFFFFF = total, [1, 2^48 - 2] = specific kind ID

SID

Git Source

struct SID {
    uint64 set;
    uint64 id;
}

Node

Git Source

struct Node {
    uint64 data;
    uint32 _reserved;
    uint32 grant;
    uint64 set;
    uint64 id;
}

Arc

Git Source

struct Arc {
    uint64 data;
    uint64 rel;
    uint64 set;
    uint64 id;
}

RelationInitiator

Git Source

Defines who is authorized to initiate a relation

enum RelationInitiator {
    Owner,
    Holder,
    Preset,
    Eligible,
    Anyone
}

RelationGrant

Git Source

Describes a granted permission to initiate a relation

struct RelationGrant {
    uint32 id;
    uint8 status;
    RelationInitiator initiator;
    uint16 reserved;
    uint64 rel;
    uint64 kind;
    uint64 set;
    bytes32 extra;
}

RelationTerminator

Git Source

Defines who is allowed to call unrelate()

enum RelationTerminator {
    TailOwner,
    HeadOwner,
    Either,
    Neither,
    Anyone,
    Nobody
}

RelationOwnerShift

Git Source

Defines how ownership of the tail object changes during relate/unrelate

enum RelationOwnerShift {
    Retain,
    TransferToTailOwner,
    TransferToHeadOwner,
    TransferToCaller,
    TransferToPreset,
    TransferToBurned,
    TransferToResolved,
    TransferToIntended,
    HoldForTailOwner,
    HoldForHeadOwner,
    HoldForCaller,
    HoldForPreset,
    HoldForBurned,
    HoldForResolved,
    HoldPending
}

RelationRule

Git Source

Defines relation lifecycle rules: who can relate/unrelate and how ownership shifts

struct RelationRule {
    uint8 version;
    RelationOwnerShift relateShift;
    RelationTerminator terminator;
    RelationOwnerShift unrelateShift;
    uint64 unrelateDelay;
    bytes20 extra;
}

RelationLib

Git Source

Structs

RelationInitiatorDataPreset

Data for Delegate-based authorization

struct RelationInitiatorDataPreset {
    uint96 padding;
    address delegateAddr;
}

RelationInitiatorDataEligible

Data for Verified-based authorization

struct RelationInitiatorDataEligible {
    uint96 padding;
    address contractAddr;
}

RelationInitiatorDataHolder

Data for Holder-based authorization

struct RelationInitiatorDataHolder {
    TokenType tokenType;
    uint8 padding;
    uint48 tokenSet;
    uint64 tokenId;
    uint128 tokenAmount;
}

TokenStandard

Git Source

enum TokenStandard {
    None,
    Native,
    ERC20,
    ERC721,
    ERC1155
}

TokenType

Git Source

enum TokenType {
    None,
    Value,
    Unique,
    Object
}

TokenSpec

Git Source

struct TokenSpec {
    TokenStandard std;
    uint8 decimals;
    bytes30 symbol;
}

TokenSpecPacked

Git Source

type TokenSpecPacked is bytes32;

TokenLib

Git Source

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);

TokenSpecAccessors

Git Source

Functions

std

function std(bytes32 t) internal pure returns (uint8);

decimals

function decimals(bytes32 t) internal pure returns (uint8);

symbol

function symbol(bytes32 t) internal pure returns (bytes30);

std

function std(TokenSpecPacked t) internal pure returns (uint8);

decimals

function decimals(TokenSpecPacked t) internal pure returns (uint8);

symbol

function symbol(TokenSpecPacked t) internal pure returns (bytes30);

Contents

Soke

Git Source

Inherits: Initializable

State Variables

SOKE_STORAGE_LOCATION

bytes32 private constant SOKE_STORAGE_LOCATION = 0x389a4784c2c3e8284bc1418c5b9cf4b556f52088a652459a6e23aae4f7902700;

Functions

_getSokeStorage

function _getSokeStorage() private pure returns (SokeStorage storage $);

__Soke_init

function __Soke_init(address setr, address omnir, address kindr, address elemr) internal onlyInitializing;

setRegistry

function setRegistry() public view returns (address);

omniRegistry

function omniRegistry() public view returns (address);

kindRegistry

function kindRegistry() public view returns (address);

elementRegistry

function elementRegistry() public view returns (address);

Structs

SokeStorage

Note: storage-location: erc7201:every.storage.Soke

struct SokeStorage {
    address setRegistry;
    address omniRegistry;
    address kindRegistry;
    address elementRegistry;
}

ElementRegistry

Git Source

Inherits: IElementRegistry, ElementRegistryErrors, OwnableUpgradeable, UUPSUpgradeable, Soke, ValueRegistry, UniqueRegistry

Functions

_authorizeUpgrade

function _authorizeUpgrade(address newImplementation) internal virtual override onlyOwner;

semver

function semver() external pure returns (uint32 version);

initialize

function initialize(
    address owner,
    address setr,
    address omnir,
    address kindr,
    bytes32 data,
    uint8 decimals,
    string memory symbol
) public initializer;

KindRegistry

Git Source

Inherits: IKindRegistry, KindRegistryErrors, OwnableUpgradeable, UUPSUpgradeable, Soke

Kind registration and management

State Variables

KINDREGISTRY_STORAGE_LOCATION

Deterministic storage slot per ERC-7201

keccak256(abi.encode(uint256(keccak256("every.storage.KindRegistry")) - 1)) & ~bytes32(uint256(0xff))

bytes32 private constant KINDREGISTRY_STORAGE_LOCATION =
    0xb8c55f98767a73472af02b22c010d8184657966d48d072fe22562cfc13903400;

Functions

_getKindRegistryStorage

function _getKindRegistryStorage() private pure returns (KindRegistryStorage storage $);

_authorizeUpgrade

function _authorizeUpgrade(address newImplementation) internal virtual override onlyOwner;

semver

function semver() external pure returns (uint32 version);

initialize

function initialize(address owner, address setr, address omnir, address elemr) public initializer;

kindRegister

Registers a new kind

function kindRegister(bytes32 code, bytes32 data, ElementType[] memory elemSpec, uint64[] memory rels)
    external
    override
    returns (uint64 id, Descriptor memory desc);

Parameters

NameTypeDescription
codebytes32Code hash of the kind
databytes32Data hash of the kind
elemSpecElementType[]Element type layout for objects of this kind
relsuint64[]Supported relation IDs

Returns

NameTypeDescription
iduint64New kind ID
descDescriptorDescriptor after registration

kindUpdate

Updates code and/or data of an existing kind

function kindUpdate(uint64 id, bytes32 code, bytes32 data) external override returns (Descriptor memory desc);

Parameters

NameTypeDescription
iduint64Kind ID
codebytes32New code hash (0 = skip)
databytes32New data hash (0 = skip)

Returns

NameTypeDescription
descDescriptorUpdated descriptor

kindUpdate

Updates code and/or data of an existing kind

function kindUpdate(uint64 id, uint64[] memory rels) external override returns (Descriptor memory desc);

Parameters

NameTypeDescription
iduint64Kind ID
relsuint64[]

Returns

NameTypeDescription
descDescriptorUpdated descriptor

kindUpdate

Updates code and/or data of an existing kind

function kindUpdate(uint64 id, bytes32 code, bytes32 data, uint64[] memory rels)
    external
    override
    returns (Descriptor memory desc);

Parameters

NameTypeDescription
iduint64Kind ID
codebytes32New code hash (0 = skip)
databytes32New data hash (0 = skip)
relsuint64[]

Returns

NameTypeDescription
descDescriptorUpdated descriptor

kindUpgrade

Upgrades kind/set revision of an existing kind

function kindUpgrade(uint64 id, uint32 kindRev, uint32 setRev) external override returns (Descriptor memory desc);

Parameters

NameTypeDescription
iduint64Kind ID
kindRevuint32New kind revision (0 = skip)
setRevuint32New set revision (0 = skip)

Returns

NameTypeDescription
descDescriptorDescriptor after upgrade

kindTouch

Touches a kind (bumps revision with no content changes)

function kindTouch(uint64 id) external override returns (Descriptor memory desc);

Parameters

NameTypeDescription
iduint64Kind ID

Returns

NameTypeDescription
descDescriptorDescriptor after touch

kindTransfer

Transfers ownership of a kind

function kindTransfer(uint64 id, address to) external override returns (address from);

Parameters

NameTypeDescription
iduint64Kind ID
toaddressNew owner address

Returns

NameTypeDescription
fromaddressPrevious owner address

kindRevision

Resolves and validates a specific revision

function kindRevision(uint64 id, uint32 rev0) external view override returns (uint32 rev);

Parameters

NameTypeDescription
iduint64Kind ID
rev0uint32Revision to check (0 = latest)

Returns

NameTypeDescription
revuint32Valid revision number (0 if not found)

kindDescriptor

Returns the descriptor at a given revision

function kindDescriptor(uint64 id, uint32 rev0) external view override returns (Descriptor memory desc);

Parameters

NameTypeDescription
iduint64Kind ID
rev0uint32Revision to query (0 = latest)

Returns

NameTypeDescription
descDescriptorDescriptor at that revision

kindSnapshot

Returns descriptor and elements at a specific revision

function kindSnapshot(uint64 id, uint32 rev0)
    external
    view
    override
    returns (Descriptor memory desc, bytes32[] memory elems);

Parameters

NameTypeDescription
iduint64Kind ID
rev0uint32Revision to query (0 = latest)

Returns

NameTypeDescription
descDescriptorDescriptor at the revision
elemsbytes32[]Element hashes of the kind at the revision

kindOwner

Returns the current owner of a kind

function kindOwner(uint64 id) external view override returns (address owner);

Parameters

NameTypeDescription
iduint64Kind ID

Returns

NameTypeDescription
owneraddressOwner address

kindSota

Returns the latest descriptor and current owner of a kind

function kindSota(uint64 id) external view override returns (Descriptor memory desc, address owner);

Parameters

NameTypeDescription
iduint64Kind ID

Returns

NameTypeDescription
descDescriptorLatest descriptor
owneraddressCurrent owner address

kindStatus

Checks whether all specified kinds are active (rev > 0)

function kindStatus(uint64[] memory ids) external view override returns (bool active);

Parameters

NameTypeDescription
idsuint64[]List of kind IDs

Returns

NameTypeDescription
activeboolTrue if all specified kinds exist and are active

kindAdmit

Checks whether a kind at a given revision admits a specific relation

function kindAdmit(uint64 id, uint32 rev, uint64 rel) public view override returns (bool admit, uint32 relRev);

Parameters

NameTypeDescription
iduint64
revuint32Kind revision (0 = latest)
reluint64Relation ID to check

Returns

NameTypeDescription
admitboolWhether the relation is admitted
relRevuint32Specific relation revision admitted (0 = latest)

_validateHolder

Reverts if msg.sender is not the current owner of the given kind

function _validateHolder(uint64 id) private view;

_validateRelations

Validates the given relations are active

function _validateRelations(uint64[] memory rels) private view;

_validateElementTypes

function _validateElementTypes(ElementType[] memory elemSpec) private pure;

_kindOfKindRevision

Returns the latest revision of the Kind-of-Kind object

function _kindOfKindRevision() private view returns (uint32);

_setOfKindRevision

Returns the latest revision of the Set-of-Kind object

function _setOfKindRevision() private view returns (uint32);

_registerKind

function _registerKind(
    uint64 id,
    uint32 kindRev,
    uint32 setRev,
    bytes32 code,
    bytes32 data,
    ElementType[] memory elemSpec,
    uint64[] memory rels,
    address owner
) private returns (Descriptor memory desc);

_unpack

function _unpack(uint64 revid) private pure returns (uint16 rev, uint48 id);

Structs

KindRegistryStorage

Note: storage-location: erc7201:every.storage.KindRegistry

struct KindRegistryStorage {
    Counter48.Counter counter;
    Snapshots.Storage kinds;
}

ObjectMinter

Git Source

Inherits: IObjectMinter, ObjectMinterErrors, ReentrancyGuard, OwnableUpgradeable, UUPSUpgradeable

State Variables

OBJECTMINTER_STORAGE_LOCATION

keccak256(abi.encode(uint256(keccak256("every.storage.ObjectMinter")) - 1)) & ~bytes32(uint256(0xff))

bytes32 private constant OBJECTMINTER_STORAGE_LOCATION =
    0x9579d02970471cd8d5ac819714a969ec86c15010903f2a1dfec179aa98f14b00;

Functions

_getObjectMinterStorage

function _getObjectMinterStorage() private pure returns (ObjectMinterStorage storage $);

_authorizeUpgrade

function _authorizeUpgrade(address newImplementation) internal virtual override onlyOwner;

semver

function semver() external pure returns (uint32 version);

initialize

function initialize(address owner, address feeRecipient, uint16 feeBps) public initializer;

setFeeConfig

function setFeeConfig(address set, address feeRecipient, uint16 feeBps) external onlyOwner;

mint

Mint an object (public permission)

function mint(address to, address set, uint64 id) external payable override nonReentrant;

Parameters

NameTypeDescription
toaddressThe recipient address
setaddressThe set address
iduint64The object ID to mint

mint

Mint an object (public permission)

function mint(address to, address set, uint64 id, bytes memory data) external payable override nonReentrant;

Parameters

NameTypeDescription
toaddressThe recipient address
setaddressThe set address
iduint64The object ID to mint
databytes

mint

Mint an object (public permission)

function mint(address to, address set, uint64 id, bytes memory auth, uint32 policy)
    external
    payable
    override
    nonReentrant;

Parameters

NameTypeDescription
toaddressThe recipient address
setaddressThe set address
iduint64The object ID to mint
authbytes
policyuint32

mint

Mint an object (public permission)

function mint(address to, address set, uint64 id, bytes memory data, bytes memory auth, uint32 policy)
    external
    payable
    override
    nonReentrant;

Parameters

NameTypeDescription
toaddressThe recipient address
setaddressThe set address
iduint64The object ID to mint
databytes
authbytes
policyuint32

mintPolicyAdd

Add a new mint policy (callable only by set contracts)

function mintPolicyAdd(MintPolicy memory policy) external override returns (uint32 index);

Parameters

NameTypeDescription
policyMintPolicyThe policy details to add

Returns

NameTypeDescription
indexuint32The assigned policy index

mintPolicyEnable

Enable a mint policy (callable only by set contracts)

function mintPolicyEnable(uint32 index) external override;

Parameters

NameTypeDescription
indexuint32The policy index to enable

mintPolicyDisable

Disable a mint policy (callable only by set contracts)

function mintPolicyDisable(uint32 index) external override;

Parameters

NameTypeDescription
indexuint32The policy index to disable

mintPolicyCount

Get number of mint policies for a set

function mintPolicyCount(address set) external view override returns (uint256 count);

Parameters

NameTypeDescription
setaddressThe set address to query

Returns

NameTypeDescription
countuint256Number of policies

mintPolicyGet

Get mint policy by index

function mintPolicyGet(address set, uint32 index) external view override returns (MintPolicy memory policy);

Parameters

NameTypeDescription
setaddressThe set address
indexuint32Policy index

Returns

NameTypeDescription
policyMintPolicyThe mint policy details

mintPolicySearch

Search for applicable mint policy with permission mask

function mintPolicySearch(address set, uint64 id, uint8 mask)
    external
    view
    override
    returns (MintPolicy memory policy);

Parameters

NameTypeDescription
setaddressThe set address
iduint64The object ID to check
maskuint8Bitmask indicating which MintPermissionType values are included. Each bit corresponds to a permission type (e.g., bit 0 = Public, bit 1 = Allowlist, etc.).

Returns

NameTypeDescription
policyMintPolicyThe first matching mint policy

mintPolicySearch

Search for applicable mint policy with permission mask

function mintPolicySearch(address set, uint64 id, uint8 mask, uint32 offset)
    external
    view
    override
    returns (MintPolicy memory policy);

Parameters

NameTypeDescription
setaddressThe set address
iduint64The object ID to check
maskuint8Bitmask indicating which MintPermissionType values are included. Each bit corresponds to a permission type (e.g., bit 0 = Public, bit 1 = Allowlist, etc.).
offsetuint32

Returns

NameTypeDescription
policyMintPolicyThe first matching mint policy

_validateMintableContract

function _validateMintableContract(address contractAddr) private view;

_validatePolicy

function _validatePolicy(MintPolicy memory p) private pure;

_searchMintPolicy

function _searchMintPolicy(address set, uint64 id, uint32 offset, uint8 mask)
    private
    view
    returns (MintPolicy memory);

_mint

function _mint(address to, address set, uint64 id, bytes memory data, bytes memory auth, uint32 policy) private;

_checkPolicy

function _checkPolicy(address set, uint64 id, uint32 index) private view returns (MintPolicy memory policy);

_authorize

function _authorize(MintPolicy memory policy, address user, bytes memory auth)
    private
    pure
    returns (MintPolicy memory);

_preMint

function _preMint(MintPolicy memory policy, address user, address set) private;

_callMint

function _callMint(MintPolicy memory policy, address operator, address to, address set, uint64 id, bytes memory data)
    private
    returns (uint64);

_postMint

function _postMint(MintPolicy memory policy, address operator, address to, address set, uint64 id) private;

_computeSplit

function _computeSplit(address set, uint96 totalAmount)
    private
    view
    returns (uint96 creatorAmount, uint96 protocolAmount, address protocolRecipient);

_collectPayment

function _collectPayment(address currency, address from, uint96 amount) private;

_disbursePayment

function _disbursePayment(address currency, address to, uint96 amount) private;

Structs

FeeConfig

Protocol fee configuration for a specific set or the default fallback

struct FeeConfig {
    uint16 status;
    uint16 bps;
    address recipient;
}

ObjectMinterStorage

Note: storage-location: erc7201:every.storage.ObjectMinter

struct ObjectMinterStorage {
    FeeConfig defaultFeeConfig;
    mapping(address => FeeConfig) feeConfigs;
    mapping(address => MintPolicy[]) policies;
    mapping(address => mapping(address => uint256)) minted;
}

OmniRegistry

Git Source

Inherits: IOmniRegistry, OmniRegistryErrors, OwnableUpgradeable, UUPSUpgradeable, Soke, RelationRegistry, ObjectAuthorization, ObjectInteraction

Functions

_authorizeUpgrade

function _authorizeUpgrade(address newImplementation) internal virtual override onlyOwner;

semver

function semver() external pure returns (uint32 version);

initialize

function initialize(address owner, address setr, address kindr, address elemr) public initializer;

_relationAdmit

function _relationAdmit(uint64 rel, uint32 rev, uint64 kind)
    internal
    view
    virtual
    override(RelationRegistry, ObjectInteraction)
    returns (bool admit, uint48 effKind, uint16 effDegs, uint48 totalKind, uint16 totalDegs);

_kindAdmit

function _kindAdmit(uint64 kind, uint32 rev, uint64 rel)
    internal
    view
    virtual
    override(ObjectInteraction)
    returns (bool admit, uint32 relRev);

_relationRule

function _relationRule(uint64 rel)
    internal
    view
    virtual
    override(RelationRegistry, ObjectInteraction)
    returns (RelationRule memory rule);

_objectInfo

function _objectInfo(uint64 set, uint64 id)
    internal
    view
    override(ObjectAuthorization, ObjectInteraction)
    returns (Descriptor memory desc, address setContract, address owner);

_allowFrom

function _allowFrom(uint32 grantId, address sender, uint128 tail, uint64 rel, uint64 headKind, uint64 headSet)
    internal
    view
    override
    returns (bool allow);

_allowTo

function _allowTo(uint32 grantId, address sender, uint128 head, uint64 rel, uint64 tailKind, uint64 tailSet)
    internal
    view
    override
    returns (bool allow);

SetRegistry

Git Source

Inherits: ISetRegistry, SetRegistryErrors, OwnableUpgradeable, UUPSUpgradeable, Soke

Set registration and management

State Variables

SETREGISTRY_STORAGE_LOCATION

Deterministic storage slot per ERC-7201

keccak256(abi.encode(uint256(keccak256("every.storage.SetRegistry")) - 1)) & ~bytes32(uint256(0xff))

bytes32 private constant SETREGISTRY_STORAGE_LOCATION =
    0xb8684b9e6721af0d1bdda1cb8f0f025a168f1333cb4134fd73b30bed06876100;

Functions

_getSetRegistryStorage

function _getSetRegistryStorage() private pure returns (SetRegistryStorage storage $);

_authorizeUpgrade

function _authorizeUpgrade(address newImplementation) internal virtual override onlyOwner;

semver

function semver() external pure returns (uint32 version);

initialize

function initialize(address owner, address omnir, address kindr, address elemr) public initializer;

setRegister

Registers a new set

function setRegister(bytes32 data) external override returns (uint64 id, Descriptor memory desc);

Parameters

NameTypeDescription
databytes32Hash of external content (e.g. metadata or schema)

Returns

NameTypeDescription
iduint64ID of the new set
descDescriptorDescriptor after registration

setUpdate

Updates the data hash of an existing set

function setUpdate(bytes32 data) external override returns (uint64 id, Descriptor memory desc);

Parameters

NameTypeDescription
databytes32New data hash

Returns

NameTypeDescription
iduint64ID of the updated set
descDescriptorUpdated descriptor

setUpgrade

Upgrades the kind or set revision

function setUpgrade(uint32 kindRev, uint32 setRev) external override returns (uint64 id, Descriptor memory desc);

Parameters

NameTypeDescription
kindRevuint32New kind revision (0 to skip)
setRevuint32New set revision (0 to skip)

Returns

NameTypeDescription
iduint64ID of the set
descDescriptorDescriptor after upgrade

setTouch

Touches a set (increments revision without any changes)

function setTouch() external override returns (uint64 id, Descriptor memory desc);

Returns

NameTypeDescription
iduint64ID of the set
descDescriptorDescriptor after touch

setRevision

Resolves and validates a specific revision

function setRevision(uint64 id, uint32 rev0) external view override returns (uint32 rev);

Parameters

NameTypeDescription
iduint64Set ID
rev0uint32Requested revision (0 = latest)

Returns

NameTypeDescription
revuint32Validated revision (0 if not found)

setDescriptor

Returns the descriptor at a given revision

function setDescriptor(uint64 id, uint32 rev0) external view override returns (Descriptor memory desc);

Parameters

NameTypeDescription
iduint64Set ID
rev0uint32Revision to query (0 = latest)

Returns

NameTypeDescription
descDescriptorDescriptor of the set at the specified revision

setSnapshot

Returns descriptor and elements of a set at a specific revision

function setSnapshot(uint64 id, uint32 rev)
    external
    view
    override
    returns (Descriptor memory desc, bytes32[] memory elems);

Parameters

NameTypeDescription
iduint64Set ID
revuint32

Returns

NameTypeDescription
descDescriptorDescriptor at the revision
elemsbytes32[]Packed element list

setOwner

Returns the current owner of a set

function setOwner(uint64 id) external view override returns (address owner);

Parameters

NameTypeDescription
iduint64Set ID

Returns

NameTypeDescription
owneraddressOwner address

setSota

Returns the latest descriptor and current owner

function setSota(uint64 id) external view override returns (Descriptor memory desc, address owner);

Parameters

NameTypeDescription
iduint64Set ID

Returns

NameTypeDescription
descDescriptorLatest descriptor
owneraddressCurrent owner

setStatus

Checks whether all provided set IDs are active

function setStatus(uint64[] memory ids) external view override returns (bool active);

Parameters

NameTypeDescription
idsuint64[]List of set IDs

Returns

NameTypeDescription
activeboolTrue if all sets have a revision > 0

setContract

Returns the contract address associated with a set

function setContract(uint64 id) external view override returns (address code);

Parameters

NameTypeDescription
iduint64Set ID

Returns

NameTypeDescription
codeaddressAddress of the deployed contract

_validateHolder

Validates that the caller is the owner of the set

function _validateHolder(uint64 id) private view;

_kindOfSetRevision

Returns the latest revision of the Kind-of-Set object

function _kindOfSetRevision() private view returns (uint32);

_setOfSetRevision

Returns the latest revision of the Set-of-Set object

function _setOfSetRevision() private view returns (uint32);

_regsiterSet

function _regsiterSet(uint64 id, uint32 kindRev, uint32 setRev, address code, bytes32 data, address owner)
    private
    returns (Descriptor memory desc);

_regsiterSetEmit

function _regsiterSetEmit(uint64 id, uint32 kindRev, uint32 setRev, address code, bytes32 data, address owner)
    private
    returns (Descriptor memory desc);

_validateSetContract

function _validateSetContract(address c) private view;

Structs

SetRegistryStorage

Note: storage-location: erc7201:every.storage.SetRegistry

struct SetRegistryStorage {
    Counter48.Counter counter;
    Snapshots.Storage sets;
    mapping(address => uint64) contracts;
}