Skip to content

Commit

Permalink
fix: docs
Browse files Browse the repository at this point in the history
  • Loading branch information
veeso committed Feb 21, 2024
1 parent 8d7943e commit 4011fe4
Show file tree
Hide file tree
Showing 9 changed files with 399 additions and 21 deletions.
41 changes: 20 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,49 +4,48 @@
![Ethereum](https://github.com/EKOKEtoken/ekoke/workflows/ethereum/badge.svg)
[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-%23FE5196?logo=conventionalcommits&logoColor=white)](https://conventionalcommits.org)

<img src="./docs/images/logo.png" alt="deferred logo" width="128" />
<img src="./assets/images/deferred-logo.png" alt="deferred logo" width="128" />

<img src="./docs/images/ekoke-logo.png" alt="ekoke logo" width="128" />
<img src="./assets/images/ekoke-logo.png" alt="ekoke logo" width="128" />

<img src="./docs/images/icp-logo.svg" alt="icp-logo" width="128" />
<img src="./assets/images/icp-logo.svg" alt="icp-logo" width="128" />

Powered by **Internet Computer**

---

- [EKOKE](#ekoke)
- [Introduction](#introduction)
- [Project Purpose](#project-purpose)
- [Project components](#project-components)
- [Documentation](#documentation)
- [Get started](#get-started)
- [Project structure](#project-structure)
- [Changelog](#changelog)
- [License](#license)

---

## Introduction
## Documentation

### Project Purpose
Read the [Project Documentation](./docs/README.md)

The project aims to facilitate the sale of a property between two or more parties, referred to in this document as A (seller) and B (buyer/s), using NFTs that serve as promissory notes.
## Get started

### Project components

Deferred consists of three main canisters:

- **Deferred**: This NFT canister is used to define the sell of a real estate between two parts (the buyer and the seller).
- **EKOKE Token**: A fungible token ERC20-like, deflationary, used as an incentive to promote the buying of the NFTs and the adoption of the "Deferred method".
- **Marketplace**: A D-APP which permits to trade Deferred NFTs.
...

## Project structure

The project is composed by the following components:

- **deferred**: A DIP721 ICP canister which represents the Deferred NFTs.
- **Ekoke**: A ICRC-2 token ICP canister which represents the fungible token $EKOKE.
- **Marketplace**: A canister which manages the Deferred tokens sell.
- **RegisterUI**: A website for the real estate agency to register sell-contracts.
- **MarketplaceUI**: A website for the marketplace canister, where the users can buy and sell theirs Deferreds.
- **Ekoke-Swap**: A simple web canister to swap Ekoke tokens between ERC20 <> ICRC2 token
- **EKOKE**: A ICRC-2 token ICP canister which represents the fungible token $EKOKE.
- **ekoke-archive**: block history for ekoke transactions
- **ekoke-index**: Index canister for ekoke
- **ekoke-ledger**: A ICRC-2 token ICP canister which represents the fungible token $EKOKE.
- **ekoke-swap**: A simple web canister to swap Ekoke tokens between ERC20 <> ICRC2 token
- **marketplace**: A canister which manages the Deferred tokens sell and $EKOKE rewards giveaway.

## Changelog

Read [CHANGELOG](./CHANGELOG.md)

## License

Expand Down
File renamed without changes
File renamed without changes
File renamed without changes
11 changes: 11 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Documentation

## Canisters

- [Deferred](./canisters/deferred.md)
- [EKOKE-index](./canisters/ekoke-index.md)
- [Marketplace](./canisters/marketplace.md)

## EKOKE DAO

- [DAO](./dao.md)
236 changes: 236 additions & 0 deletions docs/canisters/deferred.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,236 @@
# Deferred Canister

- [Deferred Canister](#deferred-canister)
- [Introduction](#introduction)
- [Data](#data)
- [Contract](#contract)
- [Roles](#roles)
- [API](#api)
- [register\_contract](#register_contract)
- [admin\_sign\_contract](#admin_sign_contract)
- [get\_contract](#get_contract)
- [get\_token](#get_token)
- [get\_signed\_contracts](#get_signed_contracts)
- [get\_agencies](#get_agencies)
- [remove\_agency](#remove_agency)
- [admin\_get\_unsigned\_contracts](#admin_get_unsigned_contracts)
- [seller\_increment\_contract\_value](#seller_increment_contract_value)
- [update\_contract\_buyers](#update_contract_buyers)
- [update\_contract\_property](#update_contract_property)
- [admin\_set\_ekoke\_ledger\_canister](#admin_set_ekoke_ledger_canister)
- [admin\_set\_marketplace\_canister](#admin_set_marketplace_canister)
- [admin\_set\_role](#admin_set_role)
- [admin\_remove\_role](#admin_remove_role)
- [admin\_register\_agency](#admin_register_agency)
- [HTTP API](#http-api)
- [Request protocol](#request-protocol)
- [Request Body](#request-body)
- [HTTP Methods](#http-methods)
- [getContracts](#getcontracts)
- [getContract](#getcontract)
- [getToken](#gettoken)
- [getAgencies](#getagencies)
- [Token Metadata](#token-metadata)

![Deferred logo](../../assets/images/deferred-logo.png)

## Introduction

Deferred is a canister which provides a **Non-fungible Token (NFT)** which implements the **DIP-721** Standard <https://github.com/Psychedelic/DIP721/blob/develop/spec.md>.

The Deferred canister takes care of registering the sell or financing of a real estate between two or more parts, **Buyers** and **Sellers**. This agreement between parts is called **Contract**.

The Buyer is represented by its Principal, while the Seller is represented by its Principal and its **Quota** in the contract ownership in a total sum of 100.

Each **Contract** is identified by an **ID** (NAT).

Each **Contract** will have Token associated, identified by an incremental **TokenIdentifier** (NAT) as specified by the DIP721 standard.

## Data

### Contract

A Contract is identified by the following properties

- **id**: the contract unique identifier
- **value**: the FIAT value of the contract
- **currency**: the currency used to represent the value
- **agency**: the agency which has created the contract
- **sellers**: the contract sellers
- **buyers**: the contract buyers
- **is_signed**: if signed the contract tokens can be sold. The token must be signed by custodians (or DAO)
- **type**: the contract type (Sell / Funding)
- **reward**: the reward of EKOKE token given to a NFT buyer
- **properties**: contract properties and metadata

## Roles

On the deferred canister the following roles exists:

- **Custodian**: administrator of the canister, following the DIP721 standard. It can administrate the canister and sign contracts.
- **Agent**: role for agencies. Agent can create contracts, but he cannot sign them.

## API

See [DID file](../../src/deferred/deferred.did)

### register_contract

Register a contract with the provided data.

**The contract value** MUST be **multiple of installments**.

### admin_sign_contract

Approve and sign an existing contract. Once signed, the contract's tokens can be sold on the marketplace.

### get_contract

Get contract by ID

### get_token

Get token and its related contract by ID

### get_signed_contracts

Get the IDS for all the signed contract

### get_agencies

Get all the agencies

### remove_agency

Remove an agency. Only admin or the agent himself can call this method

### admin_get_unsigned_contracts

Get unsigned contracts

### seller_increment_contract_value

The seller increments the contract value and mint new NFTs for it

### update_contract_buyers

Update the principal of the contract.

Only the sellers or the buyers can call this method.

### update_contract_property

Change a contract property.

Can be called by Agent, Custodian or seller.

### admin_set_ekoke_ledger_canister

Update ekoke ledger canister principal

### admin_set_marketplace_canister

Update marketplace canister

### admin_set_role

Set role for principal

### admin_remove_role

Remove a role

### admin_register_agency

Register a new agency in the canister and give to its principal the role of agent

## HTTP API

The deferred canister also exposes an HTTP API

### Request protocol

| Method | GET |
|--------------|------------------|
| Content-type | application/json |

### Request Body

The request body must be JSON encoded, and must follow this syntax

| Name | Type | Description |
|--------|--------|----------------------------------------------|
| method | string | HTTP method name |
| params | json | key-value map of optional request parameters |

### HTTP Methods

This list contains the http available methods with its parameters and response.

#### getContracts

Get all contracts ids

Body:

```json
{}
```

Response

```json
[
1,
2,
]
```

#### getContract

Get a contract by ID

Body:

```json
{
"id": 1
}
```

Response:

See Contract in did. Returns 404 if it doesn't exist.

#### getToken

Get a token by ID

Body:

```json
{
"id": 1
}
```

Response:

See TokenInfo in did. Returns 404 if it doesn't exist.

#### getAgencies

Returns all the agencies which have been registered.

## Token Metadata

Each NFT has the following properties, following the DIP721 standard.

- `token:contract_id`: contract id
- `token:value`: fiat value of the contract
- `token:currency`: currency name to represent the value
- `token:picoEkoke_reward`: reward given when someone buys the contract on the marketplace
- `contract:sellers`: contract sellers principals
- `contract:buyers`: contract buyers principals

> To these properties the contract properties can be added using the syntax `contract:keyname`
35 changes: 35 additions & 0 deletions docs/canisters/ekoke-index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# EKOKE Index canister

- [EKOKE Index canister](#ekoke-index-canister)
- [Introduction](#introduction)
- [API](#api)
- [ledger\_id](#ledger_id)
- [list\_subaccounts](#list_subaccounts)
- [get\_account\_transactions](#get_account_transactions)
- [commit](#commit)

## Introduction

The ekoke-index canister takes care of providing the transaction history for each account.

## API

See the full documentation on the [DID](../../src/ekoke_index/ekoke-index.did)

This API implements the index canister standard according to the SNS DAO.

### ledger_id

Returns the ledger ID

### list_subaccounts

Get all the subaccounts for a given principal

### get_account_transactions

Get the transactions for a given account

### commit

This endpoint is called by the ekoke-ledger to commit a transaction into the index.
Loading

0 comments on commit 4011fe4

Please sign in to comment.