generated from veeso-dev/rust-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
298 additions
and
603 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
# Deferred Data | ||
|
||
- [Deferred Data](#deferred-data) | ||
- [Introduction](#introduction) | ||
- [HTTP Endpoint](#http-endpoint) | ||
- [Get contracts](#get-contracts) | ||
- [Get contract by id](#get-contract-by-id) | ||
|
||
## Introduction | ||
|
||
Deferred **Data** canister takes care of storing sell contracts and provides the following functionalities: | ||
|
||
- **Create contract**: the contract is inserted into the ledger by [deferred-minter](./deferred-minter.md). | ||
- **Close contract**: the contract is closed by [deferred-minter](./deferred-minter.md). | ||
- **Get contract data**: get the data for a contract. Closed contracts are not returned | ||
- **Get all contracts**: get all existing contracts. Closed contracts are not returned | ||
- **Get contract document**: get a contract document with its data and mime type | ||
- **Upload contract document**: The agency can upload documents for a contract | ||
- **Update contract property**: The agency can both update a contract property and restricted property. Mind that when we talk about **contract properties** we don't mean any property, but just those stored in the `properties` and `restricted_properties` fields. | ||
|
||
## HTTP Endpoint | ||
|
||
### Get contracts | ||
|
||
This endpoints gets all the IDs of registered contracts | ||
|
||
```txt | ||
GET /contracts | ||
``` | ||
|
||
Response: | ||
|
||
```json | ||
[ | ||
1, | ||
2, | ||
3 | ||
] | ||
``` | ||
|
||
### Get contract by id | ||
|
||
Get a contract by id | ||
|
||
```txt | ||
GET /contract/:id | ||
``` | ||
|
||
Response: | ||
|
||
```json | ||
{ | ||
"id": 1, | ||
"type": "Sell", | ||
"sellers": [ | ||
{ | ||
"address": "0x...", | ||
"quota": 100 | ||
} | ||
], | ||
"buyers": [ | ||
"0x000", | ||
"0x001", | ||
], | ||
"installments": 4000, | ||
"value": 400000, | ||
"deposit": 50000, | ||
"currency": "USD", | ||
"properties": [], | ||
"restrictedProperties": [], | ||
"documents": { | ||
"1": { | ||
"accessList": ["agent"], | ||
"mimeType": "application/pdf" | ||
} | ||
}, | ||
"agency": { | ||
... | ||
}, | ||
"expiration": "2050-01-1", | ||
"closed": false | ||
} | ||
``` | ||
|
||
> Restricted properties are redacted based on your permissions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,8 @@ | |
- [Close a sell contract](#close-a-sell-contract) | ||
- [close contract requirements](#close-contract-requirements) | ||
- [Close contract](#close-contract) | ||
- [HTTP Endpoint](#http-endpoint) | ||
- [Agents](#agents) | ||
|
||
## Introduction | ||
|
||
|
@@ -29,7 +31,7 @@ A party involved in the sell process (buyer/seller/agency) must send Ethereum to | |
|
||
#### Create contract | ||
|
||
At this point the agency can send the `ContractRegistration` data and call the `create_contract` endpoint on the canister. | ||
At this point the **agency** can send the `ContractRegistration` data and call the `create_contract` endpoint on the canister. | ||
|
||
This endpoint will call `create_contract` on the **Deferred** Ethereum ERC721 which will mint the tokens and after that it will call `create_contract` on **deferred_data** to store the contract on the ledger. | ||
|
||
|
@@ -46,10 +48,41 @@ A party involved in the sell process (buyer/seller/agency) must send Ethereum to | |
|
||
#### Close contract | ||
|
||
At this point the agency can close the contract by calling `close_contract` on the canister. | ||
The **agency** can close the contract by calling `close_contract` on the canister. | ||
|
||
This will mark the contract as closed both on the ledger and on the ERC721. | ||
|
||
Once the contract is closed tokens can't be traded anymore and the sell contract is completed. | ||
|
||
> ❗ The agency must ensure before closing the contract that the buyer owns all the tokens | ||
## HTTP Endpoint | ||
|
||
### Agents | ||
|
||
```txt | ||
GET /agents | ||
``` | ||
|
||
Returns all the agents registered. | ||
|
||
The response has the following syntax: | ||
|
||
```json | ||
[ | ||
{ | ||
"address": "Via roma 12", | ||
"city": "Milan", | ||
"continent": "Europe", | ||
"country": "Italy", | ||
"email": "[email protected]", | ||
"mobile": "3661677509", | ||
"name": "MilanHouses", | ||
"owner": "principal", | ||
"region": "...", | ||
"vat": "", | ||
"website": "", | ||
"zipCode": "33100" | ||
} | ||
] | ||
``` |
Oops, something went wrong.