From 9afca6e6bf5f0d37d68c7cd539aa3a5b3c060176 Mon Sep 17 00:00:00 2001 From: adityajirafe Date: Mon, 3 Jun 2024 18:11:48 +0800 Subject: [PATCH] add cross selling source tokens to config --- .github/markets/pr_template.md | 1 + config.schema.json | 14 +++++++++++++- configs/devnet.json | 3 ++- configs/mainnet.json | 3 ++- configs/testnet.json | 3 ++- scripts/check_configs.ts | 33 ++++++++++++++++++++++++--------- 6 files changed, 44 insertions(+), 13 deletions(-) diff --git a/.github/markets/pr_template.md b/.github/markets/pr_template.md index ad86dc2..ed4bd64 100644 --- a/.github/markets/pr_template.md +++ b/.github/markets/pr_template.md @@ -16,6 +16,7 @@ Each json file under the [configs](../../configs) folder correspond to their res |`perp_pool_banners` |`PerpPoolBanner` |true |List of Objects that indicate the banner content on specific perp pool pages. | |`demex_points_config` |`DemexPointsConfig` |false |Object that contains the parameters to earn demex points. |This object **must be included** for mainnet.json as demex points is already live on mainnet. | |`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). | ## Maintenance Data Structure |Field |Type |Required |Description |Notes | diff --git a/config.schema.json b/config.schema.json index 6d7c93f..61e0aa3 100644 --- a/config.schema.json +++ b/config.schema.json @@ -10,7 +10,8 @@ "blacklisted_tokens", "transfer_options", "network_fees", - "perp_pool_banners" + "perp_pool_banners", + "cross_selling_source_tokens" ], "properties": { "network": { @@ -157,6 +158,13 @@ } } } + }, + "cross_selling_source_tokens": { + "type": "array", + "description": "List of cross selling source token denoms", + "items": { + "$ref": "#/$defs/cross_selling_source_token" + } } }, "$defs": { @@ -225,6 +233,10 @@ "perpTradingBoost": { "type": "integer", "description": "The spin boost multiplier for boosted perp markets trading volume" + }, + "cross_selling_source_token": { + "type": "string", + "description": "Cross selling source token denom" } } } \ No newline at end of file diff --git a/configs/devnet.json b/configs/devnet.json index ef23ece..f6c63bb 100644 --- a/configs/devnet.json +++ b/configs/devnet.json @@ -14,5 +14,6 @@ "usdc": 1, "eth": 2 }, - "perp_pool_banners": [] + "perp_pool_banners": [], + "cross_selling_source_tokens": [] } diff --git a/configs/mainnet.json b/configs/mainnet.json index 22d6474..36acea8 100644 --- a/configs/mainnet.json +++ b/configs/mainnet.json @@ -196,5 +196,6 @@ "perpPoolDepositBoost": 2, "perpTradingBoost": 3 } - } + }, + "cross_selling_source_tokens": ["swth"] } diff --git a/configs/testnet.json b/configs/testnet.json index 8674c3c..e4fd90b 100644 --- a/configs/testnet.json +++ b/configs/testnet.json @@ -32,5 +32,6 @@ "symbol": "1000PEPE" } } - } + }, + "cross_selling_source_tokens": ["swth"] } diff --git a/scripts/check_configs.ts b/scripts/check_configs.ts index c8facbc..b915aaa 100644 --- a/scripts/check_configs.ts +++ b/scripts/check_configs.ts @@ -21,7 +21,8 @@ interface ConfigJSON { demex_points_config: DemexPointsConfig, perp_pool_promo: { [perpPoolId: string]: PerpPoolPromo, - } + }, + cross_selling_source_tokens: string[]; } interface InvalidEntry { @@ -234,17 +235,31 @@ async function main() { }); const tokens: string[] = allTokens.tokens.map(token => token.denom); - const hasInvalidTokens = checkValidEntries(jsonData.blacklisted_tokens, tokens); - if (hasInvalidTokens.status && hasInvalidTokens.entry) { - let listOfInvalidTokens: string = hasInvalidTokens.entry.join(', '); - console.error(`ERROR: ${network}.json has the following invalid token denom entries: ${listOfInvalidTokens}. Please make sure to only input valid token denom in ${network}`); + const hasInvalidBlacklistedTokens = checkValidEntries(jsonData.blacklisted_tokens, tokens); + if (hasInvalidBlacklistedTokens.status && hasInvalidBlacklistedTokens.entry) { + let listOfInvalidTokens: string = hasInvalidBlacklistedTokens.entry.join(', '); + console.error(`ERROR: ${network}.json has the following invalid blacklisted token denom entries: ${listOfInvalidTokens}. Please make sure to only input valid token denom in ${network}`); + outcomeMap[network] = false; + } + + const hasDuplicateBlacklistedTokens = checkDuplicateEntries(jsonData.blacklisted_tokens); + if (hasDuplicateBlacklistedTokens.status && hasDuplicateBlacklistedTokens.entry) { + let listOfDuplicates: string = hasDuplicateBlacklistedTokens.entry.join(", "); + console.error(`ERROR: ${network}.json has the following duplicated blacklisted token denom entries: ${listOfDuplicates}. Please make sure to input each token denom only once in ${network}`); + outcomeMap[network] = false; + } + + const hasInvalidCrossSellingTokens = checkValidEntries(jsonData.cross_selling_source_tokens, tokens); + if (hasInvalidCrossSellingTokens.status && hasInvalidCrossSellingTokens.entry) { + let listOfInvalidTokens: string = hasInvalidCrossSellingTokens.entry.join(', '); + console.error(`ERROR: ${network}.json has the following invalid cross selling source token denom entries: ${listOfInvalidTokens}. Please make sure to only input valid token denom in ${network}`); outcomeMap[network] = false; } - const hasDuplicateTokens = checkDuplicateEntries(jsonData.blacklisted_tokens); - if (hasDuplicateTokens.status && hasDuplicateTokens.entry) { - let listOfDuplicates: string = hasDuplicateTokens.entry.join(", "); - console.error(`ERROR: ${network}.json has the following duplicated token denom entries: ${listOfDuplicates}. Please make sure to input each token denom only once in ${network}`); + const hasDuplicateCrossSellingTokens = checkDuplicateEntries(jsonData.cross_selling_source_tokens); + if (hasDuplicateCrossSellingTokens.status && hasDuplicateCrossSellingTokens.entry) { + let listOfDuplicates: string = hasDuplicateCrossSellingTokens.entry.join(", "); + console.error(`ERROR: ${network}.json has the following duplicated cross selling source token denom entries: ${listOfDuplicates}. Please make sure to input each token denom only once in ${network}`); outcomeMap[network] = false; }