API
API for the @astralprotocol/contracts package

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.
1
constructor(string memory uri) public
Copied!
registerRole
Registers a new user with the ability to register a spatial asset. Contract creator is hardcoded as default admin and data supplier roles.
1
function registerRole() public
Copied!
enableStorage
Registers a new storage that can accept GeoDID document creation.
1
function enableStorage(bytes32 offChainStorage) public
Copied!
Parameters
Name
Type
Attributes
Description
offChainStorage
bytes32
REQUIRED
Bytes32 representation of the off-chain storage signature to be enabled
disableStorage
Disables an existing storage.
1
function disableStorage(bytes32 offChainStorage) public
Copied!
Parameters
Name
Type
Attributes
Description
offChainStorage
bytes32
REQUIRED
Bytes32 representation of the off-chain storage signature to be disabled
registerSpatialAsset
Registers on-chain one Spatial Asset.
1
function registerSpatialAsset (
2
address owner,
3
bytes32 geoDIDId,
4
bytes32 parentGeoDIDId ,
5
bytes32[] memory childrenGeoDIDIds,
6
bytes32 cid,
7
bytes32 offChainStorage,
8
uint256 geoDIDtype
9
) public
Copied!
Parameters
Emitted Events
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)
parentGeoDIDId
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
addChildrenGeoDIDs
Adds children GeoDIDs to an existing GeoDID. GeoDIDId must correspond to a GeoDID type that can be a parent (Collection or type 0).
1
function addChildrenGeoDIDs(
2
bytes32 geoDIDId,
3
bytes32[] memory childrenGeoDIDIds
4
) public
Copied!
Parameters
Emitted Events
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)
Event
Arguments
Condition
ChildrenAdded
bytes32 indexed geoDIDId, bytes32 indexed childrenGeoDIDId
If the childrenGeoDIDIds array is not empty and the GeoDIDs exist
addParentGeoDID
Adds a GeoDID as a parent to an already existing GeoDID.
1
function addParentGeoDID(
2
bytes32 geoDIDId,
3
bytes32 parentGeoDIDId
4
) public
Copied!
Parameters
Emitted Events
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.
Event
Arguments
Condition
ParentAdded
bytes32 indexed geoDIDId, bytes32 indexed parentGeoDIDId
If parentGeoDIDId exists
removeChildrenGeoDIDs
Removes children GeoDIDs from a specified GeoDID.
1
function removeChildrenGeoDIDs(
2
bytes32 geoDIDId,
3
bytes32[] memory childrenGeoDIDIds
4
) public
Copied!
Parameters
Emitted Events
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.
Event
Arguments
Condition
ChildrenRemoved
bytes32 indexed geoDIDId, bytes32 indexed childrenGeoDIDId
If the childrenGeoDIDIds array is not empty and the GeoDIDs exist.
removeParentGeoDID
Removes a specified parent GeoDID from a GeoDID.
1
function removeParentGeoDID(
2
bytes32 geoDIDId,
3
bytes32 parentGeoDIDId
4
) public
Copied!
Parameters
Emitted Events
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.
Event
Arguments
Condition
ParentRemoved
bytes32 indexed geoDIDId, bytes32 indexed parentGeoDIDId
If parentGeoDIDId exists
deactivateSpatialAsset
De-registers a spatial asset.
1
function deactivateSpatialAsset(
2
bytes32 geoDIDId,
3
bytes32[] memory childrenToRemove
4
) public
Copied!
Parameters
Emitted Events
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.
Event
Arguments
Condition
SpatialAssetDeactivated
bytes32 indexed geoDIDId, bytes32[] childrenToRemove
If geoDIDId exists
Last modified 7mo ago
Export as PDF
Copy link