Skip to content

Commit

Permalink
Merge branch 'master' into feat/add-sample-market
Browse files Browse the repository at this point in the history
  • Loading branch information
sarah-thong committed Oct 31, 2023
2 parents 38b5e30 + e6ee98d commit 94944da
Show file tree
Hide file tree
Showing 12 changed files with 2,022 additions and 744 deletions.
4 changes: 3 additions & 1 deletion .github/markets/pr_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ Each json file under the [configs](../../configs) folder correspond to their res
|`featured_markets` |`string[]` |true |The array of market names which will be listed under the Featured tab on Demex's [Markets page](https://app.dem.exchange/markets) |The market names listed here **MUST** match the market names listed under the Carbon [Markets API](https://api.carbon.network/carbon/market/v1/markets?pagination.limit=10000). |
|`blacklisted_markets` |`string[]` |true |The array of market names that are blacklisted. A market can be blacklisted for a number of reasons, such as it being invalid/duplicate/wrongly-added/etc. |The market names listed here **MUST** match the market names listed under the Carbon [Markets API](https://api.carbon.network/carbon/market/v1/markets?pagination.limit=10000). The market names listed here **CANNOT** be under the `featured_markets` field at the same time. |
|`blacklisted_pools` |`string[]` |true |The array of pool ids that are blacklisted. A pool can be blacklisted for a number of reasons, such as it being invalid/duplicate/wrongly-added/etc. |The pool ids listed here **MUST** match the pool ids listed under the Carbon [Liquidity Pool API](https://api.carbon.network/carbon/liquiditypool/v1/pools?pagination.limit=10000). |
|`blacklisted_tokens` |`string[]` |true |The array of token denoms that are blacklisted. A token can be blacklisted for a number of reasons, such as it being invalid/deprecated/etc. |The token denoms listed here **MUST** match the token denoms listed under the Carbon [Tokens API](https://api.carbon.network/carbon/coin/v1/tokens?pagination.limit=10000). |
|`blacklisted_tokens` |`string[]` |true |The array of token denoms that are blacklisted. A token can be blacklisted for a number of reasons, such as it being invalid/deprecated/etc. |The token denoms listed here **MUST** match the token denoms listed under the Carbon [Tokens API](https://api.carbon.network/carbon/coin/v1/tokens?pagination.limit=10000). |
|`transfer_options` |`object` |true |A collection of blockchain networks along with their associated priority numbers, used to establish their order in the transfer options list for deposit and withdrawal forms. |Blockchain network listed here **MUST** match the valid chainName of the bridges listed under BridgeAll RPC call.<br /><br /> To view the values of BridgeAll RPC call, simply run `yarn get-bridges [network]` on the command line. Sample for mainnet: `yarn get-bridges mainnet`|
|`network_fees` |`object` |true |List of token denoms along with their associated priority numbers, used to establish their default order in the network fees preference list. |Token denoms listed here **MUST** match the valid denoms listed under MinGasPriceAll RPC call.<br /><br /> To view the values of MinGasPriceAll RPC call, simply run `yarn get-min-gas-prices [network]` on the command line. Sample for mainnet: `yarn get-min-gas-prices mainnet`|
17 changes: 8 additions & 9 deletions .github/workflows/market-config-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,17 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set Node-js version
uses: actions/setup-node@v3
with:
node-version: '18.14.2'

- name: Install Dependencies
uses: borales/[email protected]
with:
cmd: install --ignore-engines # will run `yarn install` command
run: yarn install --ignore-engines # will run `yarn install` command

- name: Validate featured markets schema
uses: borales/[email protected]
with:
cmd: validate # validate using json schema
run: yarn validate # validate using json schema

- name: Test market entries for invalid/duplicate markets
uses: borales/[email protected]
with:
cmd: check-configs mainnet testnet devnet # check using check_configs.ts script
run: yarn check-configs mainnet testnet devnet # check using check_configs.ts script
60 changes: 34 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,35 +8,43 @@ Currently, each JSON file contain the following data on its corresponding networ
- blacklisted markets
- blacklisted pools
- blacklisted tokens
- default blockchain transfer option order in deposit/withdrawal forms dropdown
- default network token fee order

More metadata will be added in the future if required by the Demex frontend. Please see below the structure of the JSON file:

```
```json
{
"network": "testnet",
"featured_markets": [
"market_1",
"market_2",
"market_3",
...
],
"blacklisted_markets": [
"blacklisted_market_1",
"blacklisted_market_2",
"blacklisted_market_3",
...
],
"blacklisted_pools": [
"blacklisted_pool_1",
"blacklisted_pool_2",
"blacklisted_pool_3",
...
],
"blacklisted_tokens": [
"blacklisted_token_1",
"blacklisted_token_2",
"blacklisted_token_3",
...
]
"network": "testnet",
"featured_markets": [
"market_1",
"market_2",
"market_3"
],
"blacklisted_markets": [
"blacklisted_market_1",
"blacklisted_market_2",
"blacklisted_market_3"
],
"blacklisted_pools": [
"blacklisted_pool_1",
"blacklisted_pool_2",
"blacklisted_pool_3"
],
"blacklisted_tokens": [
"blacklisted_token_1",
"blacklisted_token_2",
"blacklisted_token_3"
],
"transfer_options": {
"chain_1": 0,
"chain_2": 1,
"chain_3": 2
},
"network_fees": {
"token_denom_1": 0,
"token_denom_2": 1,
"token_denom_3": 2
}
}
```
138 changes: 83 additions & 55 deletions config.schema.json
Original file line number Diff line number Diff line change
@@ -1,61 +1,89 @@
{
"title": "Demex Webapp Config",
"description": "demex-webapp-config is a repository to allow frontends to fetch metadata associated with Demex",
"type": "object",
"required": [
"network",
"featured_markets",
"blacklisted_markets",
"blacklisted_pools",
"blacklisted_tokens"
],
"properties": {
"network": {
"type": "string",
"enum": [
"mainnet",
"testnet",
"devnet"
]
},
"featured_markets": {
"type": "array",
"items": {
"$ref": "#/$defs/featured_market"
}
},
"blacklisted_markets": {
"type": "array",
"items": {
"$ref": "#/$defs/blacklisted_market"
}
},
"blacklisted_pools": {
"type": "array",
"items": {
"$ref": "#/$defs/blacklisted_pool"
}
},
"blacklisted_tokens": {
"type": "array",
"items": {
"$ref": "#/$defs/blacklisted_token"
}
"title": "Demex Webapp Config",
"description": "demex-webapp-config is a repository to allow frontends to fetch metadata associated with Demex",
"type": "object",
"required": [
"network",
"featured_markets",
"blacklisted_markets",
"blacklisted_pools",
"blacklisted_tokens",
"transfer_options",
"network_fees"
],
"properties": {
"network": {
"type": "string",
"enum": [
"mainnet",
"testnet",
"devnet"
]
},
"featured_markets": {
"type": "array",
"items": {
"$ref": "#/$defs/featured_market"
}
},
"blacklisted_markets": {
"type": "array",
"description": "List of blacklisted market names",
"items": {
"$ref": "#/$defs/blacklisted_market"
}
},
"blacklisted_pools": {
"type": "array",
"description": "List of blacklisted pool ids",
"items": {
"$ref": "#/$defs/blacklisted_pool"
}
},
"blacklisted_tokens": {
"type": "array",
"description": "List of blacklisted token denoms",
"items": {
"$ref": "#/$defs/blacklisted_token"
}
},
"transfer_options": {
"type": "object",
"description": "List of blockchain networks and their priority numbers, used to set their order in deposit and withdrawal forms transfer option dropdown",
"patternProperties": {
".*": {
"type": "integer"
}
},
"additionalProperties": false
},
"$defs": {
"featured_market": {
"type": "string"
},
"blacklisted_market": {
"type": "string"
},
"blacklisted_pool": {
"type": "string",
"pattern": "^\\d+$"
},
"blacklisted_token": {
"type": "string"
"network_fees": {
"type": "object",
"description": "List of token denoms and their priority numbers, used to set their order in network fee preferences",
"patternProperties": {
".*": {
"type": "integer"
}
},
"additionalProperties": false
}
},
"$defs": {
"featured_market": {
"type": "string"
},
"blacklisted_market": {
"type": "string",
"description": "Blacklisted market name"
},
"blacklisted_pool": {
"type": "string",
"description": "Blacklisted pool id (type: string)",
"pattern": "^\\d+$"
},
"blacklisted_token": {
"type": "string",
"description": "Blacklisted token denom"
}
}
}
25 changes: 14 additions & 11 deletions configs/devnet.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
{
"network": "devnet",
"featured_markets": [
"BTC_PERP.USDC",
"swth_eth",
"swth_nexo",
"swth_nexo"
],
"blacklisted_markets": [],
"blacklisted_pools": [],
"blacklisted_tokens": []
}
"network": "devnet",
"featured_markets": [],
"blacklisted_markets": [
"swth_btc2"
],
"blacklisted_pools": [],
"blacklisted_tokens": [],
"transfer_options": {},
"network_fees": {
"swth": 0,
"usdc": 1,
"eth": 2
}
}
Loading

0 comments on commit 94944da

Please sign in to comment.