@oceanprotocol/keeper-contracts
Version:
Integration of SEAs, DID and OceanToken in Solidity
81 lines (65 loc) • 2.08 kB
Markdown
# library: ConditionStoreLibrary
Documentation:
```
Condition Store Library
Ocean Protocol Team
* Implementation of the Condition Store Library.
Condition is a key component in the service execution agreement.
This library holds the logic for creating and updating condition
Any Condition has only four state transitions starts with Uninitialized,
Unfulfilled, Fulfilled, and Aborted. Condition state transition goes only
forward from Unintialized -> Unfulfilled -> {Fulfilled || Aborted}
For more information: https://github.com/oceanprotocol/OEPs/issues/119
TODO: update the OEP link
```
## Structs
### public Condition
Members:
* address typeRef
* enum ConditionStoreLibrary.ConditionState state
* address lastUpdatedBy
* uint256 blockNumberUpdated
### public ConditionList
Members:
* mapping(bytes32 => struct ConditionStoreLibrary.Condition) conditions
* bytes32[] conditionIds
## Enums
### ConditionState
Members:
* Uninitialized
* Unfulfilled
* Fulfilled
* Aborted
## Functions
### internal create
Documentation:
```
create new condition
check whether the condition exists, assigns
condition type, condition state, last updated by,
and update at (which is the current block number)
_self is the ConditionList storage pointer
_id valid condition identifier
_typeRef condition contract address
size is the condition index
```
Parameters:
* struct ConditionStoreLibrary.ConditionList _self
* bytes32 _id
* address _typeRef
### internal updateState
Documentation:
```
updateState update the condition state
check whether the condition state transition is right,
assign the new state, update last updated by and
updated at.
_self is the ConditionList storage pointer
_id condition identifier
_newState the new state of the condition
ConditionState
```
Parameters:
* struct ConditionStoreLibrary.ConditionList _self
* bytes32 _id
* enum ConditionStoreLibrary.ConditionState _newState