Skip to content

Commit

Permalink
docs: add terms of agreement (#621)
Browse files Browse the repository at this point in the history
  • Loading branch information
0xHansLee authored Jan 13, 2023
1 parent b3ac6d1 commit d5b448c
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 8 deletions.
11 changes: 9 additions & 2 deletions .gitbook/1-users/3-data-exchange/1-consume-data.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,21 @@ For `deal-file-path`, create a following JSON file.
"amount": "1000000"
},
"max_num_data": 10,
"consumer_address": "panacea1..."
"consumer_address": "panacea1...",
"agreement_terms": [
{
"id": 1,
"required": true,
"title": "Terms of data provision",
"description": "The provided data will be used for ..."
}
]
}
```
It is very important to set data schema specifically and correctly, so that data being provided can be validated accurately by oracles.

For more details about data deals, please see the [Data Deal](../../3-protocol-devs/1-dep-specs/2-data-deal.md) specification.


## Query deals

You can query a deal with its deal ID.
Expand Down
24 changes: 21 additions & 3 deletions .gitbook/1-users/3-data-exchange/2-provide-data.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ The certificate form is like below:
"cid" : "{ipfs-cid}",
"unique_id" : "{oracle-unique-id}",
"oracle_address" : "{oracle-address}",
"deal_id": "{deal-id}",
"deal_id": <deal-id>,
"provider_address" : "{your-address}",
"data_hash" : "{data-hash}"
},
Expand All @@ -76,9 +76,27 @@ Now you can use this certificate in the next step.

## Submit consent

Broadcast the following `submit-consent` transaction with certificate from oracle.
Broadcast the following `submit-consent` transaction with the certificate from oracle and agreements of terms for data provision.

**consent.json**

```json
{
"deal_id": <deal-id>,
"certificate": {
...
},
"agreements": [
{
"id": 1,
"agreement": true
}
]
}
```

```bash
panacead submit-consent ${certificate-file-path} \
panacead submit-consent ${consent-file-path} \
--from ${data-provider-addr} \
--chain-id ${chain-id} \
--gas auto --gas-adjustment 1.30 --gas-prices 5umed \
Expand Down
12 changes: 11 additions & 1 deletion .gitbook/3-protocol-devs/1-dep-specs/2-data-deal.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,15 @@ message Deal {
uint64 max_num_data = 5;
uint64 cur_num_data = 6;
string consumer_address = 7;
DealStatus status = 8;
repeated AgreementTerm agreement_terms = 8;
DealStatus status = 9;
}
message AgreementTerm {
uint32 id = 1;
bool required = 2;
string title = 3;
string description = 4;
}
```

Expand All @@ -59,6 +67,7 @@ message Deal {
- `max_num_data`: The maximum number of data the consumer want
- `cur_num_data`: The current number of data provided
- `consumer_address`: A consumer's account address of the form `panacea1...`
- `agreement_terms`: Terms of agreement of data provision
- `status`: The status of deal. 3 statuses can be possible
- `DEAL_STATUS_ACTIVE`: The status when deal is active (`cur_num_data` < `max_num_data`).
- `DEAL_STATUS_INACTIVE`: The status when deal is deactivated (when consumer deactivated the deal)
Expand All @@ -74,6 +83,7 @@ message MsgCreateDeal {
cosmos.base.v1beta1.Coin budget = 2;
uint64 max_num_data = 3;
string consumer_address = 4;
repeated AgreementTerm agreement_terms = 5;
}
```

Expand Down
12 changes: 10 additions & 2 deletions .gitbook/3-protocol-devs/1-dep-specs/3-data-provider-consent.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,22 +53,30 @@ message UnsignedCertificate {
}
```

Using the `Certificate`, provider can submit consent to provide the data.
Using the `Certificate`, provider can submit consent to provide the data with agreement of terms.

```proto
message MsgSubmitConsent {
Consent consent = 1;
}
message Consent {
Certificate certificate = 1;
uint64 deal_id = 1;
Certificate certificate = 2;
repeated Agreement agreements = 3;
}
message Agreement {
uint32 term_id = 1;
bool agreement = 2;
}
```

When this consent is submitted, blockchain will check:
- if the data is provided by the owner of the data
- if the data is validated by a registered and active oracle
- if the data is provided in duplicate
- if the provider agrees to the required terms of agreement

If all checks pass, rewards are distributed to the provider and oracle(more about [incentive](./6-incentives.md)).

Expand Down

0 comments on commit d5b448c

Please sign in to comment.