Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add packet-forwarding config to demex-webapp-config #169

Merged
merged 15 commits into from
Jul 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions .github/markets/pr_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ Each json file under the [configs](../../configs) folder correspond to their res
|`perp_pool_promo` |`PerpPoolPromo` |false |Map of Objects that contains perp pool promo parameters for each pool |If the `perp_pool_promo` property is omitted, no promo will be shown. The key of each entry is the ids of the perp pools with existing promo. |
|`cross_selling_source_tokens` |`string[]` |true |The array of cross selling source tokens. Acquiring these tokens on the spot market will trigger a help wizard, prompting users to borrow USDG and trade perps on Demex. |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). |
|`typeform_widget_config` |`TypeformWidgetConfig[]` |false |Object that contains the parameters for ongoing surveys. | If the `message` property is omitted, default message is shown: "We want to hear from you!". Multiple widgets being displayed on the same page is not supported. Ensure pages don't overlap between configs. |
|`external_chain_channels` |`obj` |true |Map of Objects containing destination channels for external IBC chains (e.g. Osmosis, Noble, etc.) |1. To transfer tokens from Osmosis => Noble, you need to look for the `Osmosis` object, then search for `Noble` in the object to get the channel to be input in `sourceChannel` for MsgTransfer tx msg (in this case channel-750)<br /><br />2. Blockchain names in this object **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` |
|`additional_ibc_token_config` |`AdditionalIBCTokenConfig[]` |true |List of information about IBC tokens that are not added on chain or require packet forwarding. |

## Maintenance Data Structure
|Field |Type |Required |Description |Notes |
|---|---|---|---|---|
Expand All @@ -41,7 +44,7 @@ Each json file under the [configs](../../configs) folder correspond to their res
|`depositsPerSpin` |`integer` |true |Amount deposited in the perp pool that will earn 1 spin after 1 week. |
|`tradingVolumePerSpin` |`integer` |true |Volume traded on perp markets that will earn 1 spin. |

## PerpPoolPromo
## PerpPoolPromo Data Structure
|Field |Type |Required |Description |Notes |
|---|---|---|---|---|
|`start` |`string` |true |Start time of the promo. |
Expand All @@ -55,4 +58,11 @@ Each json file under the [configs](../../configs) folder correspond to their res
|`message` |`string` |false |The message shown to the user on the widget. |
|`surveyLink` |`string` |true |The link to the survey that will be shown when user clicks on the widget. |
|`endTime` |`string` |true |End time of the survey |
|`pages` |`string[]` | true |The paths to the pages on which the typeform widget must be shown.
|`pages` |`string[]` | true |The paths to the pages on which the typeform widget must be shown. |

## AdditionalIBCTokenConfig Data Structure
|Field |Type |Required |Description |Notes |
|---|---|---|---|---|
|`baseDenom` |`string` |true |The denom of this token on its native chain (e.g. `uosmo` for $OSMO on Osmosis, `uatom` for $ATOM on CosmosHub) |
|`chainRoutes` |`string[]` |true |The list of IBC chains that this token needs to be forwarded through in order to be deposited into Carbon blockchain. |1. You need to add **at least 1** blockchain network to this array.<br /><br />2. Blockchain networks in this array **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` |
|`denomOnCarbon` |`string` |false |Denom of token that is added to Carbon chain but still requires packet-forwarding (omit if this token is **NOT** added to Carbon chain) |The denom in this field **MUST** match the token denoms listed under the Carbon [Tokens API](https://api.carbon.network/carbon/coin/v1/tokens?pagination.limit=10000). |
5 changes: 4 additions & 1 deletion .github/workflows/market-config-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ jobs:
run: yarn install --ignore-engines # will run `yarn install` command

- name: Validate config schema
run: yarn validate # validate using json schema
uses: docker://orrosenblatt/validate-json-action:latest
env:
INPUT_SCHEMA: config.schema.json
INPUT_JSONS: configs/mainnet.json,configs/testnet.json,configs/devnet.json

- name: Test market entries for invalid/duplicate markets
run: yarn check-configs mainnet testnet devnet # check using check_configs.ts script
26 changes: 25 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ Currently, each JSON file contain the following data on its corresponding networ
- default blockchain transfer option order in deposit/withdrawal forms dropdown
- default network token fee order
- cross selling source tokens
- map of IBC channels for external IBC chains (such as Osmosis, Noble, etc.)
- information about IBC tokens that are not added on chain or require packet forwarding

Additionally, the JSON file for mainnet contains the following data to support ongoing campaigns/promotions:
- demex points config
Expand Down Expand Up @@ -51,6 +53,28 @@ More metadata will be added in the future if required by the Demex frontend. Ple
"token_denom_2": 1,
"token_denom_3": 2
},
"cross_selling_source_tokens": ["source_token_1"]
"cross_selling_source_tokens": ["source_token_1"],
"external_chain_channels": {
"from_blockchain_1": {
"to_blockchain_1": "channel_1",
"to_blockchain_2": "channel_2"
},
"from_blockchain_2": {
"to_blockchain_3": "channel_3",
"to_blockchain_4": "channel_4",
"to_blockchain_5": "channel_5"
}
},
"additional_ibc_token_config": [{
"baseDenom": "denom_1",
"chainRoutes": ["blockchain_1", "blockchain_2"]
}, {
"baseDenom": "denom_2",
"chainRoutes": ["blockchain_3", "blockchain_4"]
}, {
"baseDenom": "denom_3",
"chainRoutes": ["blockchain_5", "blockchain_6"],
"denomOnCarbon": "carbon_denom_1"
}]
}
```
55 changes: 54 additions & 1 deletion config.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
"transfer_options",
"network_fees",
"perp_pool_banners",
"cross_selling_source_tokens"
"cross_selling_source_tokens",
"external_chain_channels",
"additional_ibc_token_config"
],
"properties": {
"network": {
Expand Down Expand Up @@ -192,6 +194,29 @@
}
}
}
},
"external_chain_channels": {
"type": "object",
"description": "Map of destination channels for external IBC chains",
"patternProperties": {
"^[0-9A-Za-z ]+$": {
"type": "object",
"patternProperties": {
"^[0-9A-Za-z ]+$": {
"type": "string",
"pattern": "^channel-([0-9]+)$"
}
}
}
},
"additionalProperties": false
},
"additional_ibc_token_config": {
"type": "array",
"description": "List of information for tokens that (1) are not added on Carbon blockchain or (2) require packet forwarding",
"items": {
"$ref": "#/$defs/additional_ibc_token_info"
}
},
"$defs": {
"prelaunch_market": {
Expand Down Expand Up @@ -268,6 +293,34 @@
"type": "string",
"description": "The end time of the tyepform survey",
"pattern": "^\\d{4}(-\\d\\d(-\\d\\d(T\\d\\d:\\d\\d(:\\d\\d)?(\\.\\d+)?(([+-]\\d\\d:\\d\\d)|Z)?)?)?)?$"
},
"additional_ibc_token_info": {
"type": "object",
"description": "Information for token that (1) is not added on Carbon blockchain or (2) requires packet forwarding.",
"required": [
"baseDenom",
"chainRoutes"
],
"properties": {
"baseDenom": {
"type": "string",
"description": "Denom of token on its native chain",
"minLength": 2
},
"chainRoutes": {
"type": "array",
"description": "List of IBC chains that token needs to be forwarded through before being deposited into Carbon",
"items": {
"type": "string"
},
"minItems": 1
},
"denomOnCarbon": {
"type": "string",
"description": "Denom of token on Carbon chain (omit if token is not added to Carbon chain)",
"minLength": 2
}
}
}
}
}
4 changes: 3 additions & 1 deletion configs/devnet.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,7 @@
}
},
"perp_pool_banners": [],
"cross_selling_source_tokens": []
"cross_selling_source_tokens": [],
"external_chain_channels": {},
"additional_ibc_token_config": []
}
86 changes: 85 additions & 1 deletion configs/mainnet.json
Original file line number Diff line number Diff line change
Expand Up @@ -235,5 +235,89 @@
"/account/balance"
]
}
]
],
"external_chain_channels": {
"Archway": {
"Noble": "channel-29"
},
"Axelar": {
"Osmosis": "channel-3"
},
"DYDX": {
"Noble": "channel-0"
},
"Osmosis": {
"Axelar": "channel-208",
"Carbon": "channel-188",
"Cosmos Hub": "channel-0",
"Kujira": "channel-259",
"Noble": "channel-750",
"Stride": "channel-326"
},
"Cosmos Hub": {
"Stride": "channel-391",
"Noble": "channel-536",
"Osmosis": "channel-141"
},
"Kujira": {
"Noble": "channel-62",
"Osmosis": "channel-3"
},
"Noble": {
"Archway": "channel-12",
"Cosmos Hub": "channel-4",
"DYDX": "channel-33",
"Kujira": "channel-2",
"Osmosis": "channel-1",
"Stargaze": "channel-11",
"Terra": "channel-30"
},
"Stargaze": {
"Noble": "channel-204"
},
"Stride": {
"Cosmos Hub": "channel-0",
"Osmosis": "channel-5"
},
"Terra": {
"Noble": "channel-253"
}
},
"additional_ibc_token_config": [{
"baseDenom": "uusdc",
"chainRoutes": ["Archway", "Noble"]
}, {
"baseDenom": "uusdc",
"chainRoutes": ["Cosmos Hub", "Noble"]
}, {
"baseDenom": "uusdc",
"chainRoutes": ["DYDX", "Noble"]
}, {
"baseDenom": "uusdc",
"chainRoutes": ["Kujira", "Noble"]
}, {
"baseDenom": "swth",
"chainRoutes": ["Osmosis"]
}, {
"baseDenom": "uusdc",
"chainRoutes": ["Osmosis", "Noble"]
}, {
"baseDenom": "uusdc",
"chainRoutes": ["Stargaze", "Noble"]
}, {
"baseDenom": "uusdc",
"chainRoutes": ["Terra", "Noble"]
}, {
"baseDenom": "uatom",
"chainRoutes": ["Osmosis", "Cosmos Hub"],
"denomOnCarbon": "ibc/6CDD4663F2F09CD62285E2D45891FC149A3568E316CE3EBBE201A71A78A69388"
}, {
"baseDenom": "ustrd",
"chainRoutes": ["Osmosis", "Stride"],
"denomOnCarbon": "ibc/FCFF8B19C61677F3B78E2A5AE3B4A34A8D23858D16905F253B8438B3AFD07FF8"
}, {
"baseDenom": "ustrd",
"chainRoutes": ["Cosmos Hub", "Stride"],
"denomOnCarbon": "ibc/B8D03406E060650ECE2D521287AC9A94D036C4C78B4AB871AC740A5FF2030D79"
}]
}
4 changes: 3 additions & 1 deletion configs/testnet.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,7 @@
}
}
},
"cross_selling_source_tokens": ["swth"]
"cross_selling_source_tokens": ["swth"],
"external_chain_channels": {},
"additional_ibc_token_config": []
}
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"scripts": {
"preinstall": "yarn config set ignore-engines true",
"validate": "pajv validate -s config.schema.json -d \"configs/*.json\" --verbose",
"check-configs": "ts-node scripts/check_configs",
"check-configs": "ts-node scripts/check_configs mainnet testnet devnet",
"upgrade-sdk": "yarn upgrade carbon-js-sdk@latest",
"get-bridges": "ts-node scripts/get_all_bridges",
"get-min-gas-prices": "ts-node scripts/get_all_network_fees",
Expand All @@ -18,11 +18,11 @@
"@cosmjs/tendermint-rpc": "~0.31.3",
"@types/node": "^18.11.9",
"@types/node-fetch": "^2.6.2",
"carbon-js-sdk": "^0.10.5",
"carbon-js-sdk": "^0.11.1",
"long": "^4.0.0",
"node-fetch": "^2.6.1",
"pajv": "^1.2.0",
"ts-node": "^10.9.1",
"typescript": "^4.9.3"
}
}
}
Loading
Loading