arrow-left

All pages
gitbookPowered by GitBook
1 of 1

Loading...

API

API for the @astralprotocol/contracts package

hashtag
State modifying methods

constructor

Initiates the smart contract with an hardcoded uri type representing the did method (did:geo). Also initiates the msg.sender as the default admin and as a data supplier role.

registerRole

Registers a new user with the ability to register a spatial asset. Contract creator is hardcoded as default admin and data supplier roles.

enableStorage

Registers a new storage that can accept GeoDID document creation.

disableStorage

Disables an existing storage.

registerSpatialAsset

Registers on-chain one Spatial Asset.

addChildrenGeoDIDs

Adds children GeoDIDs to an existing GeoDID. GeoDIDId must correspond to a GeoDID type that can be a parent (Collection or type 0).

addParentGeoDID

Adds a GeoDID as a parent to an already existing GeoDID.

removeChildrenGeoDIDs

Removes children GeoDIDs from a specified GeoDID.

removeParentGeoDID

Removes a specified parent GeoDID from a GeoDID.

deactivateSpatialAsset

De-registers a spatial asset.

constructor(string memory uri) public

bytes32

OPTIONAL

GeoDID Id of the parent. Must be set to 0 if no parent is to be added.

childrenGeoDIDIDs

bytes32[]

OPTIONAL

GeoDID IDs of the children. Must be set to [] if no children are to be added.

cid

bytes32

REQUIRED

CID of the GeoDID Document generated with its creation (check @astralprotocol/core)

offChainStorage

bytes32

REQUIRED

Bytes32 representation of the off-chain storage signature (must be pre-approved)

geoDIDtype

uint256

REQUIRED

0 for Collection type GeoDIDs, 1 for Item type GeoDIDs. emit SpatialAssetRegistered(owner, geoDIDId, cid, offChainStorage, geoDIDId, _canBeParent[geoDIDId]);

Event
Arguments
Condition

SpatialAssetRegistered

address indexed to, bytes32 indexed geoDIDId, bytes32 indexed cid, bytes32 offChainStorage, bytes32 root, bool canBeParent

Successful registration of a GeoDID

ParentAdded

bytes32 indexed geoDIDId, bytes32 indexed parentGeoDIDId

If parentGeoDIDId is different than 0

ChildrenAdded

bytes32 indexed geoDIDId, bytes32 indexed childrenGeoDIDId

If the childrenGeoDIDIds array is not empty and the GeoDIDs exist

Event
Arguments
Condition

ChildrenAdded

bytes32 indexed geoDIDId, bytes32 indexed childrenGeoDIDId

If the childrenGeoDIDIds array is not empty and the GeoDIDs exist

Event
Arguments
Condition

ParentAdded

bytes32 indexed geoDIDId, bytes32 indexed parentGeoDIDId

If parentGeoDIDId exists

Event
Arguments
Condition

ChildrenRemoved

bytes32 indexed geoDIDId, bytes32 indexed childrenGeoDIDId

If the childrenGeoDIDIds array is not empty and the GeoDIDs exist.

Event
Arguments
Condition

ParentRemoved

bytes32 indexed geoDIDId, bytes32 indexed parentGeoDIDId

If parentGeoDIDId exists

Event
Arguments
Condition

SpatialAssetDeactivated

bytes32 indexed geoDIDId, bytes32[] **** childrenToRemove

If geoDIDId exists

Name

Type

Attributes

Description

offChainStorage

bytes32

REQUIRED

Bytes32 representation of the off-chain storage signature to be enabled

Name

Type

Attributes

Description

offChainStorage

bytes32

REQUIRED

Bytes32 representation of the off-chain storage signature to be disabled

Name

Type

Attributes

Description

owner

address

REQUIRED

To be designated the owner of the GeoDID. Currently must be msg.sender.

geoDIDId

bytes32

REQUIRED

GeoDID Id generated with the GeoDID creation (check @astralprotocol/core)

Name

Type

Attributes

Description

geoDIDId

bytes32

REQUIRED

GeoDID Id generated with the GeoDID creation and registered in the smart contract

childrenGeoDIDIDs

bytes32[]

OPTIONAL

GeoDID IDs of the children. Must be set to [] if no children are to be added (nothing is executed in the function)

Name

Type

Attributes

Description

geoDIDId

bytes32

REQUIRED

GeoDID Id generated with the GeoDID creation (check @astralprotocol/core)

parentGeoDIDId

bytes32

REQUIRED

GeoDID Id of the parent. It must exist.

Name

Type

Attributes

Description

geoDIDId

bytes32

REQUIRED

GeoDID Id generated with the GeoDID creation (check @astralprotocol/core)

childrenGeoDIDIds

bytes32[]

OPTIONAL

GeoDID IDs of the children. Must be set to [] if no children are to be removed.

Name

Type

Attributes

Description

geoDIDId

bytes32

REQUIRED

GeoDID Id generated with the GeoDID creation (check @astralprotocol/core)

parentGeoDIDId

bytes32

REQUIRED

GeoDID Id of the parent to remove. It must exist.

Name

Type

Attributes

Description

geoDIDId

bytes32

REQUIRED

GeoDID Id generated with the GeoDID creation (check @astralprotocol/core)

childrenGeoDIDIds

bytes32[]

OPTIONAL

GeoDID IDs of the children. Must be set to [] if no children are to be removed.

parentGeoDIDId

function registerRole() public
function enableStorage(bytes32 offChainStorage) public
function disableStorage(bytes32 offChainStorage) public
function registerSpatialAsset (
    address owner, 
    bytes32 geoDIDId, 
    bytes32 parentGeoDIDId , 
    bytes32[] memory childrenGeoDIDIds, 
    bytes32 cid, 
    bytes32 offChainStorage, 
    uint256 geoDIDtype
) public
function addChildrenGeoDIDs(
    bytes32 geoDIDId, 
    bytes32[] memory childrenGeoDIDIds
) public
function addParentGeoDID(
	  bytes32 geoDIDId, 
    bytes32 parentGeoDIDId
) public
function removeChildrenGeoDIDs(
    bytes32 geoDIDId, 
    bytes32[] memory childrenGeoDIDIds
) public
function removeParentGeoDID(
    bytes32 geoDIDId, 
    bytes32 parentGeoDIDId
) public
function deactivateSpatialAsset(
    bytes32 geoDIDId, 
    bytes32[] memory childrenToRemove
) public