OOPS
OOPS (Object Operating and Positioning System) is the contract responsible for handling the registration and management of relations, transforms, and spaces, while also overseeing object interactions and positioning within the protocol.
Functions
registerRelation
Registers a new relation
function registerRelation(bytes32 desc, RelationRule memory rule, uint64[] memory adjSpec) external returns (uint64);
Parameters
Name | Type | Description |
---|---|---|
desc | bytes32 | The description of the relation |
rule | RelationRule | The rule defining the relation's behavior |
adjSpec | uint64[] | The adjacency specification for the relation |
Returns
Name | Type | Description |
---|---|---|
<none> | uint64 | The ID of the newly registered relation |
updateRelation
Updates an existing relation
function updateRelation(uint64 rel, bytes32 desc) external;
Parameters
Name | Type | Description |
---|---|---|
rel | uint64 | The ID of the relation to update |
desc | bytes32 | The new description of the relation |
transferRelation
Transfers ownership of a relation to another address
function transferRelation(uint64 rel, address to) external;
Parameters
Name | Type | Description |
---|---|---|
rel | uint64 | The ID of the relation |
to | address | The address to transfer ownership to |
registerSpace
Registers a new space at a specific block
function registerSpace(uint64 block, bytes32 desc) external;
Parameters
Name | Type | Description |
---|---|---|
block | uint64 | The block number of the space |
desc | bytes32 | The description of the space |
updateSpace
Updates an existing space
function updateSpace(uint64 block, bytes32 desc, uint64[] memory rels) external;
Parameters
Name | Type | Description |
---|---|---|
block | uint64 | The block number of the space |
desc | bytes32 | The new description of the space |
rels | uint64[] | Updated relations in the space |
transferSpace
Transfers ownership of a space to another address
function transferSpace(uint64 block, address to) external;
Parameters
Name | Type | Description |
---|---|---|
block | uint64 | The block number of the space |
to | address | The address to transfer ownership to |
relate
Relates a dependent object to a destination object
function relate(uint256 dep, uint128 dest) external;
Parameters
Name | Type | Description |
---|---|---|
dep | uint256 | The ID of the dependent object |
dest | uint128 | The ID of the destination object |
relate
Relates multiple dependent objects to a destination object
function relate(uint256[] memory deps, uint128 dest) external;
Parameters
Name | Type | Description |
---|---|---|
deps | uint256[] | Array of dependent object IDs |
dest | uint128 | The ID of the destination object |
unrelate
Unrelates a dependent object from a destination object
function unrelate(uint256 dep, uint128 dest) external;
Parameters
Name | Type | Description |
---|---|---|
dep | uint256 | The ID of the dependent object |
dest | uint128 | The ID of the destination object |
unrelate
Unrelates multiple dependent objects from a destination object
function unrelate(uint256[] memory deps, uint256 dest) external;
Parameters
Name | Type | Description |
---|---|---|
deps | uint256[] | Array of dependent object IDs |
dest | uint256 | The ID of the destination object |
move
Moves an object to a new position
function move(uint256 obj, uint128 pos) external;
Parameters
Name | Type | Description |
---|---|---|
obj | uint256 | The ID of the object |
pos | uint128 | The new position of the object |
move
Moves multiple objects to a new position
function move(uint256[] memory objs, uint128 pos) external;
Parameters
Name | Type | Description |
---|---|---|
objs | uint256[] | Array of object IDs |
pos | uint128 | The new position of the objects |
Events
RelationRegistered
Emitted when a new relation is registered
event RelationRegistered(uint64 rel, RelationRule rule, uint64[] adjSpec, bytes32 desc, address owner);
Parameters
Name | Type | Description |
---|---|---|
rel | uint64 | The ID of the registered relation |
rule | RelationRule | The rule defining the relation's behavior |
adjSpec | uint64[] | Specifies adjacencies or dependencies for the relation |
desc | bytes32 | The description of the relation |
owner | address | The owner of the relation |
RelationUpdated
Emitted when an existing relation is updated
event RelationUpdated(uint64 rel, bytes32 desc);
Parameters
Name | Type | Description |
---|---|---|
rel | uint64 | The ID of the updated relation |
desc | bytes32 | The updated description of the relation |
RelationTransferred
Emitted when a relation's ownership is transferred
event RelationTransferred(uint64 rel, address from, address to);
Parameters
Name | Type | Description |
---|---|---|
rel | uint64 | The ID of the transferred relation |
from | address | The current owner of the relation |
to | address | The new owner of the relation |
SpaceRegistered
Emitted when a new space is registered
event SpaceRegistered(uint64 block, bytes32 desc, address owner);
Parameters
Name | Type | Description |
---|---|---|
block | uint64 | The block number where the space is registered |
desc | bytes32 | The description of the space |
owner | address | The owner of the space |
SpaceUpdated
Emitted when a space's details are updated
event SpaceUpdated(uint64 block, bytes32 desc, uint64[] rels);
Parameters
Name | Type | Description |
---|---|---|
block | uint64 | The block number of the space |
desc | bytes32 | The updated description of the space |
rels | uint64[] | The updated relations in the space |
SpaceTransferred
Emitted when ownership of a space is transferred
event SpaceTransferred(uint64 block, address from, address to);
Parameters
Name | Type | Description |
---|---|---|
block | uint64 | The block number of the space |
from | address | The current owner of the space |
to | address | The new owner of the space |
Related
Emitted when an object is related to another object
event Related(uint256 dep, uint128 dest, uint32 rev);
Parameters
Name | Type | Description |
---|---|---|
dep | uint256 | The ID of the dependent object |
dest | uint128 | The ID of the destination object |
rev | uint32 | The revision number of the relation |
Related
Emitted when multiple objects are related to a destination object
event Related(uint256[] deps, uint128 dest, uint32 rev);
Parameters
Name | Type | Description |
---|---|---|
deps | uint256[] | Array of dependent object IDs |
dest | uint128 | The ID of the destination object |
rev | uint32 | The revision number of the relation |
Unrelated
Emitted when an object is unrelated (disconnected) from another object
event Unrelated(uint256 dep, uint128 dest, uint32 rev);
Parameters
Name | Type | Description |
---|---|---|
dep | uint256 | The ID of the dependent object |
dest | uint128 | The ID of the destination object |
rev | uint32 | The revision number of the relation |
Unrelated
Emitted when multiple objects are unrelated from a destination object
event Unrelated(uint256[] deps, uint128 dest, uint32 rev);
Parameters
Name | Type | Description |
---|---|---|
deps | uint256[] | Array of dependent object IDs |
dest | uint128 | The ID of the destination object |
rev | uint32 | The revision number of the relation |
Moved
Emitted when the position of an object is changed
event Moved(uint256 obj, uint128 pos);
Parameters
Name | Type | Description |
---|---|---|
obj | uint256 | The ID of the object being moved |
pos | uint128 | The new position of the object |
Moved
Emitted when multiple objects are moved to a new position
event Moved(uint256[] objs, uint128 pos);
Parameters
Name | Type | Description |
---|---|---|
objs | uint256[] | Array of object IDs being moved |
pos | uint128 | The new position of the objects |
Structs
RelationRule
Describes the rules of a relation between objects.
struct RelationRule {
uint8 ownerOnForm;
uint8 posOnForm;
uint8 connOnForm;
uint8 ownerOnTerm;
uint8 posOnTerm;
uint8 connOnTerm;
}