Skip to content

Commit

Permalink
Add promo markets and upgrade sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
Jarrett0203 committed Jul 8, 2024
1 parent 9ee9238 commit 110df73
Show file tree
Hide file tree
Showing 9 changed files with 54 additions and 6 deletions.
1 change: 1 addition & 0 deletions .github/markets/pr_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Each json file under the [configs](../../configs) folder correspond to their res
|---|---|---|---|---|
|`network` |`string` |true |The network that the json file corresponds to |The networks available are: **mainnet, testnet, devnet** |
|`prelaunch_markets` |`string[]` |true |The array of market names which are designated as Pre-Launch markets. When added to this list, the markets will have a `Pre-Launch` tag attached to it. |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). |
|`promo_markets` |`string[]` |true |The array of market names which are designated as Promo markets. Mainly used to determine the markets for Demex Trading League. |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 `prelaunch_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). |
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ The config JSON schema can be found [here](/config.schema.json).

Currently, each JSON file contain the following data on its corresponding network (mainnet, testnet, devnet):
- list of pre-launch markets
- promo markets
- blacklisted markets
- blacklisted pools
- blacklisted tokens
Expand All @@ -25,6 +26,11 @@ More metadata will be added in the future if required by the Demex frontend. Ple
"market_1",
"market_2"
],
"promo_markets": [
"promo_market_1",
"promo_market_2",
"promo_market_3"
],
"blacklisted_markets": [
"blacklisted_market_1",
"blacklisted_market_2",
Expand Down
12 changes: 12 additions & 0 deletions config.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"required": [
"network",
"prelaunch_markets",
"promo_markets",
"blacklisted_markets",
"blacklisted_pools",
"blacklisted_tokens",
Expand All @@ -29,6 +30,13 @@
"$ref": "#/$defs/prelaunch_market"
}
},
"promo_markets": {
"type": "array",
"description": "List of market names designated as Promo markets",
"items": {
"$ref": "#/$defs/promo_market"
}
},
"blacklisted_markets": {
"type": "array",
"description": "List of blacklisted market names",
Expand Down Expand Up @@ -172,6 +180,10 @@
"type": "string",
"description": "Market name of Pre-launch market"
},
"promo_market": {
"type": "string",
"description": "Market name of Promo market"
},
"blacklisted_market": {
"type": "string",
"description": "Blacklisted market name"
Expand Down
1 change: 1 addition & 0 deletions configs/devnet.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"network": "devnet",
"prelaunch_markets": [],
"promo_markets": [],
"blacklisted_markets": [
"swth_btc2",
"ETH_PERP.USDC",
Expand Down
3 changes: 3 additions & 0 deletions configs/mainnet.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{
"network": "mainnet",
"prelaunch_markets": [],
"promo_markets": [
"cmkt/201"
],
"blacklisted_markets": [
"gm1_busd1",
"SWTH_UST",
Expand Down
3 changes: 3 additions & 0 deletions configs/testnet.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{
"network": "testnet",
"prelaunch_markets": [],
"promo_markets": [
"ATOM_PERP.CGUSD"
],
"blacklisted_markets": [
"swth_btc",
"swth_btc2",
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
}
22 changes: 22 additions & 0 deletions scripts/check_configs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const myArgs = process.argv.slice(2);
interface ConfigJSON {
network: CarbonSDK.Network;
prelaunch_markets: string[];
promo_markets: string[];
blacklisted_markets: string[];
blacklisted_pools: string[];
blacklisted_tokens: string[];
Expand Down Expand Up @@ -167,6 +168,13 @@ async function main() {
outcomeMap[network] = false;
}

const hasInvalidPromoMarkets = checkValidEntries(jsonData.promo_markets, markets);
if (hasInvalidPromoMarkets.status && hasInvalidPromoMarkets.entry) {
let listOfInvalidMarkets: string = hasInvalidPromoMarkets.entry.join(', ');
console.error(`ERROR: ${network}.json has the following invalid promo market entries: ${listOfInvalidMarkets}. Please make sure to only input valid markets in ${network}`);
outcomeMap[network] = false;
}

const hasInvalidBlacklistedMarkets = checkValidEntries(jsonData.blacklisted_markets, markets);
if (hasInvalidBlacklistedMarkets.status && hasInvalidBlacklistedMarkets.entry) {
let listOfInvalidMarkets: string = hasInvalidBlacklistedMarkets.entry.join(', ');
Expand All @@ -182,6 +190,13 @@ async function main() {
outcomeMap[network] = false;
}

const hasDuplicatePromoMarkets = checkDuplicateEntries(jsonData.promo_markets);
if (hasDuplicatePromoMarkets.status && hasDuplicatePromoMarkets.entry) {
let listOfDuplicates: string = hasDuplicatePromoMarkets.entry.join(", ");
console.error(`ERROR: ${network}.json has the following duplicated promo market entries: ${listOfDuplicates}. Please make sure to only input each market once in ${network}`);
outcomeMap[network] = false;
}

const hasDuplicateBlacklistedMarkets = checkDuplicateEntries(jsonData.blacklisted_markets);
if (hasDuplicateBlacklistedMarkets.status && hasDuplicateBlacklistedMarkets.entry) {
let listOfDuplicates: string = hasDuplicateBlacklistedMarkets.entry.join(", ");
Expand All @@ -197,6 +212,13 @@ async function main() {
outcomeMap[network] = false;
}

const hasBlacklistedMarketsInPromo = checkBlacklistedMarkets(jsonData.promo_markets, jsonData.blacklisted_markets);
if (hasBlacklistedMarketsInPromo.status && hasBlacklistedMarketsInPromo.entry) {
let listOfBlacklistedMarkets: string = hasBlacklistedMarketsInPromo.entry.join(", ");
console.error(`ERROR: ${network}.json has the following blacklisted market entries in promo markets entries: ${listOfBlacklistedMarkets}. Please make sure that blacklisted markets are not found in promo markets in ${network}`);
outcomeMap[network] = false;
}

// query all liquidity pools
const allPools = await sdk.query.liquiditypool.PoolAll({
pagination: {
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1702,10 +1702,10 @@ camelcase@^6.0.0:
resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.3.0.tgz#5685b95eb209ac9c0c177467778c9c84df58ba9a"
integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==

carbon-js-sdk@^0.10.5:
version "0.10.5"
resolved "https://registry.yarnpkg.com/carbon-js-sdk/-/carbon-js-sdk-0.10.5.tgz#61e3afe83eef163d0baba0da861556494b3e0a94"
integrity sha512-G+OLLt4G2u6e+mg7JOJrCgADivlgTFf2uRb+vvH7dq4HBA6bAAJHfoNTo4B5h10UC2Ma0BVanJ9CO/U+uY5Rqw==
carbon-js-sdk@^0.11.1:
version "0.11.1"
resolved "https://registry.yarnpkg.com/carbon-js-sdk/-/carbon-js-sdk-0.11.1.tgz#d61f446d61161c5b0be613848ec97f229c7d0ec3"
integrity sha512-MMt/JbcqCPMxXqSvyoC7R87uMe5ZEa3K5qtZ9VSeG0O+P1jMENuNswMQWSMK+RESYITAbGj8rpe3HYXwvyR5qQ==
dependencies:
"@cityofzion/neon-api" "^4.9.0"
"@cityofzion/neon-core" "^4.9.0"
Expand Down

0 comments on commit 110df73

Please sign in to comment.