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/README.md b/README.md index 653749c..b29a604 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,7 @@ Currently, each JSON file contain the following data on its corresponding networ - blacklisted tokens - default blockchain transfer option order in deposit/withdrawal forms dropdown - default network token fee order +- cross selling source tokens Additionally, the JSON file for mainnet contains the following data to support ongoing campaigns/promotions: - demex points config @@ -48,6 +49,7 @@ More metadata will be added in the future if required by the Demex frontend. Ple "token_denom_1": 0, "token_denom_2": 1, "token_denom_3": 2 - } + }, + "cross_selling_source_tokens": ["source_token_1"] } ``` 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 2d7c615..918fa2c 100644 --- a/configs/mainnet.json +++ b/configs/mainnet.json @@ -199,5 +199,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; }