@oceanprotocol/keeper-contracts
Version:
Integration of SEAs, DID and OceanToken in Solidity
129 lines (105 loc) • 3.18 kB
Markdown
# library: AgreementStoreLibrary
Documentation:
```
Agreement Store Library
Ocean Protocol Team
* Implementation of the Agreement Store Library.
For more information: https://github.com/oceanprotocol/OEPs/issues/125
TODO: update the OEP link
The agreement store library holds the business logic
in which manages the life cycle of SEA agreement, each
agreement is linked to the DID of an asset, template, and
condition IDs.
```
## Structs
### public Agreement
Members:
* bytes32 did
* address templateId
* bytes32[] conditionIds
* address lastUpdatedBy
* uint256 blockNumberUpdated
### public AgreementList
Members:
* mapping(bytes32 => struct AgreementStoreLibrary.Agreement) agreements
* mapping(bytes32 => bytes32[]) didToAgreementIds
* mapping(address => bytes32[]) templateIdToAgreementIds
* bytes32[] agreementIds
### public AgreementActors
Members:
* mapping(bytes32 => mapping(address => bytes32)) AgreementActor
### public AgreementActorsList
Members:
* mapping(bytes32 => address[]) ActorsList
## Functions
### internal create
Documentation:
```
create new agreement
checks whether the agreement Id exists, creates new agreement
instance, including the template, conditions and DID.
_self is AgreementList storage pointer
_id agreement identifier
_did asset decentralized identifier
_templateId template identifier
_conditionIds array of condition identifiers
size which is the index of the created agreement
```
Parameters:
* struct AgreementStoreLibrary.AgreementList _self
* bytes32 _id
* bytes32 _did
* address _templateId
* bytes32[] _conditionIds
### internal setActorType
Documentation:
```
setActorType set a mapping between actors and their types.
The stored type is the hash of the string format of an actor type
(consumer, provider, verifier, publisher, curator, etc).
_self is AgreementActors storage pointer
_id agreement identifier
_actor actor address
_actorType actor type hash
```
Parameters:
* struct AgreementStoreLibrary.AgreementActors _self
* bytes32 _id
* address _actor
* bytes32 _actorType
### internal getActorType
Documentation:
```
getActorType for a given agreement Id, returns the actor type
_self is AgreementActors storage pointer
_id agreement identifier
_actor actor address
bytes32 actor type
```
Parameters:
* struct AgreementStoreLibrary.AgreementActors _self
* bytes32 _id
* address _actor
### internal setActors
Documentation:
```
setActors associate actor addresses to an agreement
_self is AgreementActorsList storage pointer
_id agreement identifier
_actors array of actor addresses
```
Parameters:
* struct AgreementStoreLibrary.AgreementActorsList _self
* bytes32 _id
* address[] _actors
### internal getActors
Documentation:
```
getActors actor addresses for an agreement
_self is AgreementActorsList storage pointer
_id agreement identifier
_actors array of actor addresses
```
Parameters:
* struct AgreementStoreLibrary.AgreementActorsList _self
* bytes32 _id