Skip to content

Commit

Permalink
basic structure of config repo
Browse files Browse the repository at this point in the history
  • Loading branch information
Jayden Teoh authored and Jayden Teoh committed Nov 29, 2022
1 parent 9fbf45f commit 98827a5
Show file tree
Hide file tree
Showing 7 changed files with 1,148 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .github/markets/pr_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# New Feature Market Template

Please update the below configurations carefully. Each featured markets json file under the [configs](../../configs) folder correspond to their respective networks. For example, [configs/mainnet.json](../../configs/mainnet.json) is for adding maerkets to feature in the `mainnet`. As such, please check which network you would like to feature your market at and add to the correct `configs/<network>.json` file.

Please make sure to add to the **bottom** of the array.

## Feature Market Data Structure
|Field |Type |Required |Description |Notes |
|---|---|---|---|---|
|`name` |`string` |true |The denom of the market which is used to generate the list of featured markets in Demex |Name **MUST** match the name of the market in the Carbon markets api. Please refer to the [api](https://api.carbon.network/carbon/market/v1/markets?pagination.limit=10000) |
22 changes: 22 additions & 0 deletions .github/workflows/market-config-validation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
on:
pull_request:
branches:
-master
name: Pull request workflow
jobs:
validate_markets:
name: Validate Markets
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

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

- name: Validate nodes schema
uses: borales/[email protected]
with:
cmd: validate # validate using json schema
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/node_modules
39 changes: 39 additions & 0 deletions config.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"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"
],
"properties": {
"network": {
"type": "string",
"enum": [
"mainnet",
"testnet",
"devnet"
]
},
"featured_markets": {
"type": "array",
"items": {
"$ref": "#/$defs/featured_market"
}
}
},
"$defs": {
"featured_market": {
"type": "object",
"required": [
"name"
],
"properties": {
"name": {
"type": "string",
"description": "The denom of the market which is used to generate the list of featured markets in Demex"
}
}
}
}
}
20 changes: 20 additions & 0 deletions configs/mainnet.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"network": "mainnet",
"featured_markets": [
{
"name": "ETHUSDC_PERP"
},
{
"name": "WBTCUSDC_PERP"
},
{
"name": "busd1_usdc1"
},
{
"name": "zwap.1.18.393529_swth"
},
{
"name": "lkt1_usdc1"
}
]
}
17 changes: 17 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "demex-webapp-config",
"version": "1.0.0",
"description": "demex-webapp-config is a repository to allow frontends to fetch metadata associated with Demex",
"repository": "https://github.com/Switcheo/demex-webapp-config",
"author": "Switcheo <[email protected]>",
"license": "MIT",
"scripts": {
"validate": "pajv validate -s config.schema.json -d configs/markets.json --verbose"
},
"dependencies": {
"@types/node": "^18.11.9",
"pajv": "^1.2.0",
"ts-node": "^10.9.1",
"typescript": "^4.9.3"
}
}
Loading

0 comments on commit 98827a5

Please sign in to comment.