Skip to content

Commit

Permalink
Merge pull request #87 from defactor-com/docs/metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
xavier506 authored May 3, 2024
2 parents 477bbd0 + ff17971 commit 093239b
Show file tree
Hide file tree
Showing 4 changed files with 1,984 additions and 1,175 deletions.
42 changes: 21 additions & 21 deletions docs/back-end-api/erc20CollateralToken/graphql.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Outlined below is a detailed overview of the API's functionalities, leveraging a

:::info

The `erc20collateralpool` contact is based on a token that follows the erc20 token standard and has exactly a precision of 6. For example it can be `usdc`, `euroc` or any other token that meets the above mentioned requirements.
The `erc20collateralpool` contract is based on a token that follows the erc20 token standard and has exactly a precision of 6. For example it can be `usdc`, `euroc` or any other token that meets the above mentioned requirements.

:::

Expand Down Expand Up @@ -129,11 +129,11 @@ Upon successful completion of a request, the server will issue a status code of
## Pools
The `collateralDetails` schema has the following properties:

| Property | Description |
| --- | --- |
| `collateralToken` | The address where the collateral token is deployed. |
| `collateralTokenChainlink` | The address where the contract that indicates the price of the collateral token is deployed. |
| `collateralTokenFactor` | Used to adjust the collateral amount from the price of the collateral. |
| Property | Description |
| --------------------------- | --------------------------------------------------------------------------------------------------------- |
| `collateralToken` | The address where the collateral token is deployed. |
| `collateralTokenChainlink` | The address where the contract that indicates the price of the collateral token is deployed. |
| `collateralTokenFactor` | Used to adjust the collateral amount from the price of the collateral. |
| `collateralTokenPercentage` | Used to calculate the amount of collateral token a borrower will need to provide to borrow from the pool. |

### `Create Pool`
Expand Down Expand Up @@ -572,7 +572,7 @@ Upon successful request completion, the server will respond with a status code o

### `Update Pool Metadata`

Update the pool metadata
Update the pool metadata.

**HTTP Request Method**: POST

Expand All @@ -596,19 +596,19 @@ mutation ($pool: UpdatePoolMetadataInput!) {
```json
{
"pool": {
"id": "23",
"name": "FACTR Pool 23",
"id": "1",
"name": "FACTR Pool 1",
"description": "FACTR is a tool that facilitates the connection between the traditional world of assets and the decentralized ecosystem of cryptocurrencies. Explore more about Defactor and its potential in the financial world!",
"logo": "https://assets.coingecko.com/coins/images/19201/standard/jFLSu4U9_400x400.png?1696518648",
"collateralToken": {
"name":"FACTR",
"logo": "https://assets.coingecko.com/coins/images/19201/standard/jFLSu4U9_400x400.png?1696518648",
"symbol": "FACTR"
"logo": "https://assets.coingecko.com/coins/images/19201/standard/jFLSu4U9_400x400.png?1696518648"
}
}
}
```

Some fields in the collateral token are obtained by the backend from the blockchain itself, such as `name`, `symbol`, and `token precision`.

**Response**

Upon successful request completion, the server will issue a status code of 200 alongside a JSON object. This object incorporates the following attributes:
Expand Down Expand Up @@ -1362,9 +1362,9 @@ Upon successful request completion, the server will respond with a status code o

Authorize a third party address to expend a designated sum of funds of the indicated token.

| Property | Description |
| --- | --- |
| `tokenAddress` | The address where the collateral token is deployed. |
| Property | Description |
| -------------------- | ----------------------------------------------------------------- |
| `tokenAddress` | The address where the collateral token is deployed. |
| `addressToAuthorize` | The address where the `erc20collateralpool` contract is deployed. |

**HTTP Request Method**: POST
Expand Down Expand Up @@ -1467,10 +1467,10 @@ Upon successful request completion, the server will issue a status code of 200 a

Get the historical contributions by filtered by event and group by period of time

| Property | Description |
| --- | --- |
| Property | Description |
| ---------- | ------------------------------------------------------------------------------------ |
| `filterBy` | One of the following values: `minute`, `hour`, `day`, `week`, `month`, `year`, `all` |
| `byEvent` | One of the following values: `LendEvent`, `BorrowEvent`, `All`. |
| `byEvent` | One of the following values: `LendEvent`, `BorrowEvent`, `All`. |

**HTTP Request Method**: POST

Expand Down Expand Up @@ -1532,9 +1532,9 @@ Upon successful request completion, the server will issue a status code of 200 a
### Error Response Format
The errors have the GraphQL error schema, an object with an `errors` array property where each item has the following schema:

| Property | Description |
| --- | --- |
| `message` | The description of the error |
| Property | Description |
| ------------ | ------------------------------------------------------------------------------ |
| `message` | The description of the error |
| `extensions` | An object with the path to the field that caused the error, and the error code |

**Examples**
Expand Down
46 changes: 23 additions & 23 deletions docs/back-end-api/erc20CollateralToken/restful.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Outlined below is a detailed overview of the API's functionalities, leveraging a

:::info

The `erc20collateralpool` contact is based on a token that follows the erc20 token standard and has exactly a precision of 6. For example it can be `usdc`, `euroc` or any other token that meets the above mentioned requirements.
The `erc20collateralpool` contract is based on a token that follows the erc20 token standard and has exactly a precision of 6. For example it can be `usdc`, `euroc` or any other token that meets the above mentioned requirements.

:::

Expand Down Expand Up @@ -107,11 +107,11 @@ Upon successful completion of a request, the server will issue a status code of
## Pools
The `collateralDetails` schema has the following properties:

| Property | Description |
| --- | --- |
| `collateralToken` | The address where the collateral token is deployed. |
| `collateralTokenChainlink` | The address where the contract that indicates the price of the collateral token is deployed. |
| `collateralTokenFactor` | Used to adjust the collateral amount from the price of the collateral. |
| Property | Description |
| --------------------------- | --------------------------------------------------------------------------------------------------------- |
| `collateralToken` | The address where the collateral token is deployed. |
| `collateralTokenChainlink` | The address where the contract that indicates the price of the collateral token is deployed. |
| `collateralTokenFactor` | Used to adjust the collateral amount from the price of the collateral. |
| `collateralTokenPercentage` | Used to calculate the amount of collateral token a borrower will need to provide to borrow from the pool. |

### `Create Pool`
Expand Down Expand Up @@ -459,7 +459,7 @@ Upon successful request completion, the server will respond with a status code o

### `Update Pool Metadata`

Update the pool metadata
Update the pool metadata.

**HTTP Request Method**: POST

Expand All @@ -472,19 +472,19 @@ Update the pool metadata
```json
{
"pool": {
"id": "24",
"name": "FACTR Pool 24",
"id": "1",
"name": "FACTR Pool 1",
"description": "FACTR is a tool that facilitates the connection between the traditional world of assets and the decentralized ecosystem of cryptocurrencies. Explore more about Defactor and its potential in the financial world!",
"logo": "https://assets.coingecko.com/coins/images/19201/standard/jFLSu4U9_400x400.png?1696518648",
"collateralToken": {
"name":"FACTR",
"logo": "https://assets.coingecko.com/coins/images/19201/standard/jFLSu4U9_400x400.png?1696518648",
"symbol": "FACTR"
"logo": "https://assets.coingecko.com/coins/images/19201/standard/jFLSu4U9_400x400.png?1696518648"
}
}
}
```

Some fields in the collateral token are obtained by the backend from the blockchain itself, such as `name`, `symbol`, and `token precision`.

**Response**

Upon successful request completion, the server will issue a status code of 200 alongside a JSON object. This object incorporates the following attributes:
Expand Down Expand Up @@ -1104,9 +1104,9 @@ Upon successful request completion, the server will respond with a status code o

Authorize a third party address to expend a designated sum of funds of the indicated token.

| Property | Description |
| --- | --- |
| `tokenAddress` | The address where the collateral token is deployed. |
| Property | Description |
| -------------------- | ----------------------------------------------------------------- |
| `tokenAddress` | The address where the collateral token is deployed. |
| `addressToAuthorize` | The address where the `erc20collateralpool` contract is deployed. |

**HTTP Request Method**: POST
Expand Down Expand Up @@ -1158,10 +1158,10 @@ Upon successful completion of a request, the server will issue a status code of

Get the historical contributions by filtered by event and group by period of time

| Property | Description |
| --- | --- |
| Property | Description |
| ---------- | ------------------------------------------------------------------------------------ |
| `filterBy` | One of the following values: `minute`, `hour`, `day`, `week`, `month`, `year`, `all` |
| `byEvent` | One of the following values: `LendEvent`, `BorrowEvent`, `All`. |
| `byEvent` | One of the following values: `LendEvent`, `BorrowEvent`, `All`. |

**HTTP Request Method**: GET

Expand Down Expand Up @@ -1211,11 +1211,11 @@ Upon successful request completion, the server will issue a status code of 200 a
### Error Response Format
The errors have the following schema:

| Property | Description |
| --- | --- |
| `error` | The description of the error |
| `path` | The path to the field that caused the error |
| `code` | The error code |
| Property | Description |
| -------- | ------------------------------------------- |
| `error` | The description of the error |
| `path` | The path to the field that caused the error |
| `code` | The error code |

**Examples**

Expand Down
15 changes: 5 additions & 10 deletions docs/back-end-api/sdk/software-development-kit.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ async liquidatePool(poolId: bigint): Promise<ethers.ContractTransaction | ethers

## Examples

### Lending to a Pool
Import the library and instantiate the `SelfProvider` class with the `ERC20CollateralPool` contract.

```typescript
import { SelfProvider } from "@defactor/defactor-sdk";
Expand All @@ -111,7 +111,11 @@ const providerInstance = new SelfProvider.SelfProvider<ERC20CollateralPool>(
contractConfig.providerUrl!, // loaded from config file
contractConfig.privateKey! // loaded from config file
);
```

### Lending to a Pool

```typescript
const poolId = 1;
const amount = BigInt(100_000000); // 100 USDC

Expand All @@ -122,15 +126,6 @@ console.log(lendTx);
### Borrowing from a Pool

```typescript
import { SelfProvider } from "@defactor/defactor-sdk";

const providerInstance = new SelfProvider.SelfProvider<ERC20CollateralPool>(
ERC20CollateralPool,
contractConfig.contractAddress!, // loaded from config file
contractConfig.providerUrl!, // loaded from config file
contractConfig.privateKey! // loaded from config file
);

const poolId = 1;
const amount = BigInt(10_000000); // 10 USDC

Expand Down
Loading

0 comments on commit 093239b

Please sign in to comment.