Kind Registry

Kind registration and management.

Functions

register

Registers a new kind with the specified parameters.

function register(ElementType[] memory stateSpec, bytes32 code, bytes32 data, uint64[] memory relSpec)
    external
    returns (uint64);

Parameters

NameTypeDescription
stateSpecElementType[]Specification of the elements that define the object's state.
codebytes32The material hash of the kind's code.
databytes32The material hash of the kind's data.
relSpecuint64[]List of relations supported by this kind.

Returns

NameTypeDescription
<none>uint64The ID of the newly registered kind.

update

Updates the code, data of an existing kind.

function update(uint64 id, bytes32 code, bytes32 data) external returns (Meta memory);

Parameters

NameTypeDescription
iduint64The ID of the kind to be updated.
codebytes32The new material hash representing the kind's code. A zero value indicates no change.
databytes32The new material hash representing the kind's data. A zero value indicates no change.

Returns

NameTypeDescription
<none>MetaThe updated metadata for the kind.

update

Updates the code, data, and relations of an existing kind.

function update(uint64 id, bytes32 code, bytes32 data, uint64[] memory relSpec) external returns (Meta memory);

Parameters

NameTypeDescription
iduint64The ID of the kind to update.
codebytes32The new material hash representing the kind's code. A zero value indicates no change.
databytes32The new material hash representing the kind's data. A zero value indicates no change.
relSpecuint64[]The updated list of relations for the kind.

Returns

NameTypeDescription
<none>MetaThe updated metadata of the kind.

upgrade

Upgrades a kind's kind and/or set to a newer revision.

function upgrade(uint64 id, uint32 kindRev, uint32 setRev) external returns (Meta memory);

Parameters

NameTypeDescription
iduint64The ID of the kind to upgrade.
kindRevuint32The newer revision of the kind's kind object (0 indicates no upgrade).
setRevuint32The newer revision of the kind's set object (0 indicates no upgrade).

Returns

NameTypeDescription
<none>MetaThe metadata of the kind after the upgrade.

touch

Increases the revision of the kind without any state changes.

function touch(uint64 id) external returns (Meta memory);

Parameters

NameTypeDescription
iduint64The ID of the kind to touch.

Returns

NameTypeDescription
<none>MetaThe updated metadata of the kind.

transfer

Transfers ownership of a kind to another address.

function transfer(uint64 id, address to) external;

Parameters

NameTypeDescription
iduint64The ID of the kind to transfer.
toaddressThe address of the new owner.

ownerOf

Returns the owner of a kind.

function ownerOf(uint64 id) external view returns (address);

Parameters

NameTypeDescription
iduint64The ID of the kind.

Returns

NameTypeDescription
<none>addressThe address of the owner.

stateSpecAt

Retrieves the state specification of a kind at a given revision.

function stateSpecAt(uint64 id, uint32 rev) external view returns (ElementType[] memory);

Parameters

NameTypeDescription
iduint64The ID of the kind.
revuint32The specific revision number. A zero value returns the latest revision.

Returns

NameTypeDescription
<none>ElementType[]The state specification of the kind.

codeAt

Retrieves the code hash of a kind at a given revision.

function codeAt(uint64 id, uint32 rev) external view returns (bytes32);

Parameters

NameTypeDescription
iduint64The ID of the kind.
revuint32The specific revision number. A zero value returns the latest revision.

Returns

NameTypeDescription
<none>bytes32The code hash of the kind.

relSpecAt

Retrieves the relations supported by a kind at a given revision.

function relSpecAt(uint64 id, uint32 rev) external view returns (uint64[] memory);

Parameters

NameTypeDescription
iduint64The ID of the kind.
revuint32The specific revision number. A zero value returns the latest revision.

Returns

NameTypeDescription
<none>uint64[]The supported relations.

metaAt

Returns the metadata of a kind at a specific revision.

function metaAt(uint64 id, uint32 rev) external view returns (Meta memory);

Parameters

NameTypeDescription
iduint64The ID of the kind.
revuint32The revision number. A zero value returns the latest revision.

Returns

NameTypeDescription
<none>MetaThe metadata of the kind.

stateAt

Retrieves the elements of a kind at a specific revision.

function stateAt(uint64 id, uint32 rev) external view returns (bytes32[] memory);

Parameters

NameTypeDescription
iduint64The ID of the kind.
revuint32The revision number. A zero value returns the latest revision.

Returns

NameTypeDescription
<none>bytes32[]The elements of the kind at the specified revision.

revAt

Checks if a revision of a kind is valid.

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

Parameters

NameTypeDescription
iduint64The unique identifier of the kind.
revuint32The specific revision to check, with zero indicating the latest revision.

Returns

NameTypeDescription
<none>uint32The revision number requested. A zero return value means the revision is invalid.

Events

KindRegistered

Emitted when a new kind is registered in the registry.

event KindRegistered(
    uint64 id, Meta meta, ElementType[] stateSpec, bytes32 code, bytes32 data, uint64[] relSpec, address owner
);

Parameters

NameTypeDescription
iduint64The ID of the newly registered kind.
metaMetaMetadata of the registered kind.
stateSpecElementType[]The element specification of objects belonging to this kind.
codebytes32The material hash of the kind's code.
databytes32The material hash of the kind's data.
relSpecuint64[]List of relations supported by this kind.
owneraddressThe address that owns the registered kind.

KindUpdated

Emitted when a kind is updated.

event KindUpdated(uint64 id, Meta meta, uint64[] relSpec, bytes32 code, bytes32 data);

Parameters

NameTypeDescription
iduint64The ID of the updated kind.
metaMetaUpdated metadata of the kind.
relSpecuint64[]Updated list of relations associated with the kind.
codebytes32Updated material hash of the kind's code.
databytes32Updated material hash of the kind's data.

KindUpgraded

Emitted when a kind is upgraded.

event KindUpgraded(uint64 id, Meta meta);

Parameters

NameTypeDescription
iduint64The ID of the upgraded kind.
metaMetaUpdated metadata of the upgraded kind.

KindTouched

Emitted when a kind's revision is bumped without state change.

event KindTouched(uint64 id, Meta meta);

Parameters

NameTypeDescription
iduint64The ID of the kind.
metaMetaMetadata of the touched kind.

KindTransferred

Emitted when ownership of a kind is transferred.

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

Parameters

NameTypeDescription
iduint64The ID of the kind being transferred.
fromaddressThe current owner of the kind.
toaddressThe new owner of the kind.