Set Interface

Interface a user-created set must implement.

interface ISet {
    // events
    event Created(uint64 id, Meta meta, bytes32[] state, address owner);
    event Updated(uint64 id, Meta meta, bytes32[] state);
    event Upgraded(uint64 id, Meta meta);
    event Touched(uint64 id, Meta meta);
    event Destroyed(uint64 id, Meta meta);
    event Transferred(uint64 id, address from, address to);

    // write functions
    function update(uint64 id, bytes32[] memory state) external returns (Meta memory);
    function upgrade(uint64 id, uint32 kindRev, uint32 setRev) external returns (Meta memory);
    function touch(uint64 id) external returns (Meta memory);
    function transfer(uint64 id, address to) external;

    // view functions
    function ownerOf(uint64 id) external view returns (address);
    function metaAt(uint64 id, uint32 rev) external view returns (Meta memory);
    function stateAt(uint64 id, uint32 rev) external view returns (bytes32[] memory);
    function revAt(uint64 id, uint32 rev) external view returns (uint32);
}

Functions

update

Updates the elements of an object.

function update(uint64 id, bytes32[] memory state) external returns (Meta memory);

Parameters

NameTypeDescription
iduint64The ID of the object to update.
statebytes32[]The new elements of the object.

Returns

NameTypeDescription
<none>MetaThe updated metadata of the object.

upgrade

Upgrades the kind and/or set of an object to a newer revision.

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

Parameters

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

Returns

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

touch

Touches an object to trigger a revision bump.

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

Parameters

NameTypeDescription
iduint64The ID of the object to touch.

Returns

NameTypeDescription
<none>MetaThe metadata of the object after the touch.

transfer

Transfers the ownership of an object to a new address.

function transfer(uint64 id, address to) external;

Parameters

NameTypeDescription
iduint64The ID of the object to transfer.
toaddressThe address to transfer the ownership to.

ownerOf

Returns the owner of an object.

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

Parameters

NameTypeDescription
iduint64The ID of the object.

Returns

NameTypeDescription
<none>addressThe address of the object's owner.

metaAt

Returns the metadata of an object at a particular revision.

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

Parameters

NameTypeDescription
iduint64The ID of the object.
revuint32The revision number. A zero value indicates the latest revision.

Returns

NameTypeDescription
<none>MetaThe metadata of the object.

stateAt

Returns the elements of an object at a particular revision.

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

Parameters

NameTypeDescription
iduint64The ID of the object.
revuint32The revision number. A zero value indicates the latest revision.

Returns

NameTypeDescription
<none>bytes32[]The elements of the object.

revAt

Checks if a revision of an object is valid.

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

Parameters

NameTypeDescription
iduint64The ID of the object.
revuint32The specific revision. A zero value indicates the latest revision.

Returns

NameTypeDescription
<none>uint32The revision number requested. Zero indicates an invalid revision.

Events

Created

Emitted when a new object is created within a set.

event Created(uint64 id, Meta meta, bytes32[] state, address owner);

Parameters

NameTypeDescription
iduint64The ID of the object.
metaMetaThe metadata of the object.
statebytes32[]The elements of the object.
owneraddressThe address of the object's owner.

Updated

Emitted when an object is updated.

event Updated(uint64 id, Meta meta, bytes32[] state);

Parameters

NameTypeDescription
iduint64The ID of the object.
metaMetaThe updated metadata of the object.
statebytes32[]The updated elements of the object.

Upgraded

Emitted when an object is upgraded.

event Upgraded(uint64 id, Meta meta);

Parameters

NameTypeDescription
iduint64The ID of the object.
metaMetaThe updated metadata of the object after the upgrade.

Touched

Emitted when an object is touched.

event Touched(uint64 id, Meta meta);

Parameters

NameTypeDescription
iduint64The ID of the object.
metaMetaThe metadata of the object.

Destroyed

Emitted when an object is destroyed.

event Destroyed(uint64 id, Meta meta);

Parameters

NameTypeDescription
iduint64The ID of the object.
metaMetaThe metadata of the object before destruction.

Transferred

Emitted when the ownership of an object is transferred.

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

Parameters

NameTypeDescription
iduint64The ID of the object.
fromaddressThe address of the current owner.
toaddressThe address of the new owner.