From 3b586dd4313f1b1a355e43e4d3867602c3d88ee9 Mon Sep 17 00:00:00 2001 From: Andrew Soon Date: Fri, 23 Aug 2024 14:57:28 +0800 Subject: [PATCH 1/7] Refactor banners in perp pool config and add past_tense_text property --- config.schema.json | 44 +++---------- configs/mainnet.json | 133 ++++++++++++++++++++++++--------------- scripts/check_configs.ts | 41 +++--------- 3 files changed, 99 insertions(+), 119 deletions(-) diff --git a/config.schema.json b/config.schema.json index 8954e52..ac15cc9 100644 --- a/config.schema.json +++ b/config.schema.json @@ -10,7 +10,6 @@ "blacklisted_tokens", "transfer_options", "network_fees", - "perp_pool_banners", "cross_selling_source_tokens", "external_chain_channels", "additional_ibc_token_config" @@ -86,40 +85,6 @@ } } }, - "perp_pool_banners": { - "type": "array", - "description": "List of perp pool banners", - "items": { - "type": "object", - "required": [ - "perp_pool_id", - "title" - ], - "properties": { - "perp_pool_id": { - "$ref": "#/$defs/perp_pool_id" - }, - "show_from": { - "$ref": "#/$defs/show_from" - }, - "show_until": { - "$ref": "#/$defs/show_until" - }, - "title": { - "$ref": "#/$defs/title" - }, - "removed_markets": { - "$ref": "#/$defs/removed_markets" - }, - "added_markets": { - "$ref": "#/$defs/added_markets" - }, - "subtext": { - "$ref": "#/$defs/subtext" - } - } - } - }, "demex_points_config": { "type": "object", "description": "Config for demex points", @@ -301,6 +266,10 @@ "type": "string", "description": "The message shown on the banner describing markets being removed" }, + "past_tense_text": { + "type": "string", + "description": "The alternative message shown after the date of markets being added or removed has passed" + }, "added_markets": { "type": "string", "description": "The message shown on the banner describing markets being added" @@ -405,6 +374,9 @@ "added_markets": { "$ref": "#/$defs/added_markets" }, + "past_tense_text": { + "$ref": "#/$defs/past_tense_text" + }, "subtext": { "$ref": "#/$defs/subtext" } @@ -412,4 +384,4 @@ } } } -} +} \ No newline at end of file diff --git a/configs/mainnet.json b/configs/mainnet.json index 91de82c..4a8d669 100644 --- a/configs/mainnet.json +++ b/configs/mainnet.json @@ -1,8 +1,18 @@ { "network": "mainnet", "prelaunch_markets": [], - "blacklisted_markets": ["gm1_busd1", "SWTH_UST", "LUNA_SWTH"], - "blacklisted_pools": ["34", "43", "44", "74", "83"], + "blacklisted_markets": [ + "gm1_busd1", + "SWTH_UST", + "LUNA_SWTH" + ], + "blacklisted_pools": [ + "34", + "43", + "44", + "74", + "83" + ], "blacklisted_tokens": [ "swthb.1.6.d04123", "swth.1.18.94d5fe", @@ -68,32 +78,6 @@ "eth.1.2.942d87": 21, "usdc.1.2.343151": 22 }, - "perp_pool_banners": [ - { - "perp_pool_id": "9", - "show_until": "2024-08-25T08:00+00:00", - "title": "New Markets added", - "added_markets": "CRV will be added to this Perp Pool on 22 Aug, 08:00 AM UTC. This banner will disappear on 25 Aug." - }, - { - "perp_pool_id": "7", - "show_until": "2024-08-25T08:00+00:00", - "title": "New Markets added", - "added_markets": "SUN will be added to this Perp Pool on 22 Aug, 08:00 AM UTC. This banner will disappear on 25 Aug." - }, - { - "perp_pool_id": "4", - "show_until": "2024-08-30T08:00+00:00", - "title": "New Markets added", - "added_markets": "On 20 Aug, 08:00 AM UTC, this perp pool was renamed to 'Modular'. MNT, MANTA, ARB, OP were added to this Perp Pool" - }, - { - "perp_pool_id": "6", - "show_until": "2024-08-30T08:00+00:00", - "title": "Markets removed", - "removed_markets": "On 20 Aug 8AM UTC, all markets in this perp pool have been moved to the Celestia Perp Pool to consolidate liquidity." - } - ], "spot_history_market_list": { "cmkt/117": "BINANCE:ETHUSD", "cmkt/118": "BINANCE:BTCUSD", @@ -258,7 +242,9 @@ "perpTradingBoost": 6 } }, - "cross_selling_source_tokens": ["swth"], + "cross_selling_source_tokens": [ + "swth" + ], "external_chain_channels": { "Archway": { "Noble": "channel-29" @@ -309,54 +295,88 @@ "additional_ibc_token_config": [ { "baseDenom": "uusdc", - "chainRoutes": ["Archway", "Noble"] + "chainRoutes": [ + "Archway", + "Noble" + ] }, { "baseDenom": "uusdc", - "chainRoutes": ["Cosmos Hub", "Noble"] + "chainRoutes": [ + "Cosmos Hub", + "Noble" + ] }, { "baseDenom": "uusdc", - "chainRoutes": ["DYDX", "Noble"] + "chainRoutes": [ + "DYDX", + "Noble" + ] }, { "baseDenom": "uusdc", - "chainRoutes": ["Kujira", "Noble"] + "chainRoutes": [ + "Kujira", + "Noble" + ] }, { "baseDenom": "swth", - "chainRoutes": ["Osmosis"] + "chainRoutes": [ + "Osmosis" + ] }, { "baseDenom": "uusdc", - "chainRoutes": ["Osmosis", "Noble"] + "chainRoutes": [ + "Osmosis", + "Noble" + ] }, { "baseDenom": "uusdc", - "chainRoutes": ["Stargaze", "Noble"] + "chainRoutes": [ + "Stargaze", + "Noble" + ] }, { "baseDenom": "uusdc", - "chainRoutes": ["Terra", "Noble"] + "chainRoutes": [ + "Terra", + "Noble" + ] }, { "baseDenom": "uatom", - "chainRoutes": ["Osmosis", "Cosmos Hub"], + "chainRoutes": [ + "Osmosis", + "Cosmos Hub" + ], "denomOnCarbon": "ibc/6CDD4663F2F09CD62285E2D45891FC149A3568E316CE3EBBE201A71A78A69388" }, { "baseDenom": "ustrd", - "chainRoutes": ["Osmosis", "Stride"], + "chainRoutes": [ + "Osmosis", + "Stride" + ], "denomOnCarbon": "ibc/FCFF8B19C61677F3B78E2A5AE3B4A34A8D23858D16905F253B8438B3AFD07FF8" }, { "baseDenom": "ustrd", - "chainRoutes": ["Cosmos Hub", "Stride"], + "chainRoutes": [ + "Cosmos Hub", + "Stride" + ], "denomOnCarbon": "ibc/B8D03406E060650ECE2D521287AC9A94D036C4C78B4AB871AC740A5FF2030D79" } ], "demex_trading_league_config": { - "promoMarkets": ["cmkt/201"], + "promoMarkets": [ + "cmkt/201" + ], "currentPrizeSymbol": "USDC", "currentCompPerpPoolId": 3 }, @@ -365,28 +385,37 @@ "perp_pools": { "incentives": { "proxy": "0x7b1C7216C117cC62D875e3086518B238392cf04d", - "distributors": ["0x5268d461317f2f39b5023fCC25cFF31210C4b947"] + "distributors": [ + "0x5268d461317f2f39b5023fCC25cFF31210C4b947" + ] }, "banners": [ { - "perp_pool_id": "8", - "show_until": "2024-07-29T08:00+00:00", + "perp_pool_id": "9", + "show_until": "2024-08-25T08:00+00:00", "title": "New Markets added", - "added_markets": "ETC Perp Market will be added to this Perp Pool on 24 Jul, 08:00 AM UTC. This banner will disappear on 29 Jul." + "added_markets": "CRV will be added to this Perp Pool on 22 Aug, 08:00 AM UTC. This banner will disappear on 25 Aug." }, { - "perp_pool_id": "9", - "show_until": "2024-07-29T08:00+00:00", + "perp_pool_id": "7", + "show_until": "2024-08-25T08:00+00:00", "title": "New Markets added", - "added_markets": "LDO Perp Market will be added to this Perp Pool on 24 Jul, 08:00 AM UTC. This banner will disappear on 29 Jul." + "added_markets": "SUN will be added to this Perp Pool on 22 Aug, 08:00 AM UTC. This banner will disappear on 25 Aug." }, { - "perp_pool_id": "1", - "show_until": "2024-07-15T08:00+00:00", + "perp_pool_id": "4", + "show_until": "2024-08-30T08:00+00:00", "title": "New Markets added", - "removed_markets": "[Ticker] Perp Market will be added to this Perp Pool on [Date]. This banner will disappear on [Date] 08:00 AM UTC." + "added_markets": "On 20 Aug, 08:00 AM UTC, this perp pool was renamed to 'Modular'. MNT, MANTA, ARB, OP were added to this Perp Pool" + }, + { + "perp_pool_id": "6", + "show_until": "2024-08-30T08:00+00:00", + "title": "Markets removed", + "removed_markets": "On 20 Aug 8AM UTC, all markets in this perp pool will be moved to the Celestia Perp Pool to consolidate liquidity.", + "past_tense_text": "On 20 Aug 8AM UTC, all markets in this perp pool have been moved to the Celestia Perp Pool to consolidate liquidity." } ] }, "wswth_contract": "0x0e59f6Cf81B5Fae9F7a5912062Fe53909e7221C2" -} +} \ No newline at end of file diff --git a/scripts/check_configs.ts b/scripts/check_configs.ts index 32d32ca..485bed9 100644 --- a/scripts/check_configs.ts +++ b/scripts/check_configs.ts @@ -18,7 +18,6 @@ interface ConfigJSON { network_fees: { [denom: string]: number; }; - perp_pool_banners: PerpPoolBanner[]; demex_points_config: DemexPointsConfig; perp_pool_promo: { [perpPoolId: string]: PerpPoolPromo; @@ -96,7 +95,7 @@ interface Incentives { interface PerpPoolConfig { incentives: Incentives - banners: PerpPoolBanner + banners: PerpPoolBanner[] } type OutcomeMap = { [key in CarbonSDK.Network]: boolean }; // true = success, false = failure @@ -236,13 +235,13 @@ function isValidAdditionalIbcTokenConfig(addTokenConfigArr: AdditionalIbcTokenCo } function isValidDemexTradingLeagueConfig( - demexTradingLeagueConfig: DemexTradingLeagueConfig, - network: CarbonSDK.Network, + demexTradingLeagueConfig: DemexTradingLeagueConfig, + network: CarbonSDK.Network, marketIds: string[], blacklistedMarkets: string[], perpPoolIds: string[], tokenSymbols: string[]) { - + const hasInvalidPromoMarkets = checkValidEntries(demexTradingLeagueConfig.promoMarkets, marketIds); if (hasInvalidPromoMarkets.status && hasInvalidPromoMarkets.entry) { let listOfInvalidMarkets: string = hasInvalidPromoMarkets.entry.join(', '); @@ -256,7 +255,7 @@ function isValidDemexTradingLeagueConfig( console.error(`ERROR: ${network}.json has the following duplicated promo market entries in demex_trading_league_config: ${listOfDuplicates}. Please make sure to only input each market once in ${network}`); return false; } - + const hasBlacklistedMarketsInPromo = checkBlacklistedMarkets(demexTradingLeagueConfig.promoMarkets, blacklistedMarkets); if (hasBlacklistedMarketsInPromo.status && hasBlacklistedMarketsInPromo.entry) { let listOfBlacklistedMarkets: string = hasBlacklistedMarketsInPromo.entry.join(", "); @@ -453,22 +452,6 @@ async function main() { }) const perpPoolIds = perpPoolsQuery.pools.map((pool) => pool.poolId.toString()) - const perpPoolBannerIds = Object.values(jsonData.perp_pool_banners).map((banner) => banner.perp_pool_id) - - const hasInvalidPerpPoolBannerIds = checkValidEntries(perpPoolBannerIds, perpPoolIds) - const hasDuplicatePerpPoolBannerIds = checkDuplicateEntries(perpPoolBannerIds) - - if (hasInvalidPerpPoolBannerIds.status && hasInvalidPerpPoolBannerIds.entry) { - let listOfInvalidIds: string = hasInvalidPerpPoolBannerIds.entry.join(", "); - console.error(`ERROR: ${network}.json has the following invalid perp pool ids under the perp_pool_banners field: ${listOfInvalidIds}`) - outcomeMap[network] = false; - } - - if (hasDuplicatePerpPoolBannerIds.status && hasDuplicatePerpPoolBannerIds.entry) { - let listOfDuplicates: string = hasDuplicatePerpPoolBannerIds.entry.join(", "); - console.error(`ERROR: ${network}.json has duplicated perp pool banners for the following perp pool ids: ${listOfDuplicates}. Please make sure to input each perp pool banner only once in ${network}`); - outcomeMap[network] = false; - } if (network === CarbonSDK.Network.MainNet && !jsonData.demex_points_config) { console.error(`ERROR: ${network}.json is missing demex_points_config`) @@ -556,13 +539,13 @@ async function main() { const hasDuplicateLinks = checkDuplicateEntries(distributorsArr) if (hasDuplicateLinks.status && hasDuplicateLinks.entry) { let listOfDuplicates: string = hasDuplicateLinks.entry.join(", "); - console.error(`ERROR: ${network}.json has the following duplicated distributors in the perp pools incentives configs: ${listOfDuplicates}. Please make sure to only input each link once in ${network}`); + console.error(`ERROR: ${network}.json has the following duplicated distributors in the perp_pools incentives configs: ${listOfDuplicates}. Please make sure to only input each link once in ${network}`); outcomeMap[network] = false; } distributorsArr.forEach((address) => { if (!checkAddressIsEVM(address)) { - console.error(`ERROR: ${network}.json has invalid EVM address in perp pools incentives configs: ${address}`); + console.error(`ERROR: ${network}.json has invalid EVM address in perp_pools incentives configs: ${address}`); outcomeMap[network] = false; } }) @@ -571,19 +554,15 @@ async function main() { const proxy = perpPoolConfig.incentives.proxy if (proxy) { if (!checkAddressIsEVM(proxy)) { - console.error(`ERROR: ${network}.json has invalid EVM address in perp pools incentives proxy configs: ${proxy}`); + console.error(`ERROR: ${network}.json has invalid EVM address in perp_pools incentives proxy configs: ${proxy}`); outcomeMap[network] = false; } } } + if (perpPoolConfig.banners) { const banners = perpPoolConfig.banners // Checking perp pool banners - const perpPoolsQuery = await sdk.query.perpspool.PoolInfoAll({ - pagination: PageRequest.fromPartial({ - limit: new Long(10000), - }), - }) const perpPoolIds = perpPoolsQuery.pools.map((pool) => pool.poolId.toString()) const perpPoolBannerIds = Object.values(banners).map((banner) => banner.perp_pool_id) @@ -593,7 +572,7 @@ async function main() { if (hasInvalidPerpPoolBannerIds.status && hasInvalidPerpPoolBannerIds.entry) { let listOfInvalidIds: string = hasInvalidPerpPoolBannerIds.entry.join(", "); - console.error(`ERROR: ${network}.json has the following invalid perp pool ids under the perp_pool_banners field: ${listOfInvalidIds}`) + console.error(`ERROR: ${network}.json has the following invalid perp pool ids under the perp_pools banners field: ${listOfInvalidIds}`) outcomeMap[network] = false; } From c4ecd34f4eb80ec1ae87ff7c62d41aa1ce834709 Mon Sep 17 00:00:00 2001 From: Andrew Soon Date: Fri, 23 Aug 2024 15:00:56 +0800 Subject: [PATCH 2/7] Add action trigger date --- config.schema.json | 5 +++++ configs/mainnet.json | 1 + scripts/check_configs.ts | 2 ++ 3 files changed, 8 insertions(+) diff --git a/config.schema.json b/config.schema.json index ac15cc9..c282b2f 100644 --- a/config.schema.json +++ b/config.schema.json @@ -266,6 +266,11 @@ "type": "string", "description": "The message shown on the banner describing markets being removed" }, + "action_trigger_date": { + "type": "string", + "description": "The date and time when the action in the banner message is triggered. The past_tense_text will not be shown if this value is omitted", + "pattern": "^\\d{4}(-\\d\\d(-\\d\\d(T\\d\\d:\\d\\d(:\\d\\d)?(\\.\\d+)?(([+-]\\d\\d:\\d\\d)|Z)?)?)?)?$" + }, "past_tense_text": { "type": "string", "description": "The alternative message shown after the date of markets being added or removed has passed" diff --git a/configs/mainnet.json b/configs/mainnet.json index 4a8d669..f6c1eb5 100644 --- a/configs/mainnet.json +++ b/configs/mainnet.json @@ -413,6 +413,7 @@ "show_until": "2024-08-30T08:00+00:00", "title": "Markets removed", "removed_markets": "On 20 Aug 8AM UTC, all markets in this perp pool will be moved to the Celestia Perp Pool to consolidate liquidity.", + "action_trigger_date": "2024-08-20T08:00+00:00", "past_tense_text": "On 20 Aug 8AM UTC, all markets in this perp pool have been moved to the Celestia Perp Pool to consolidate liquidity." } ] diff --git a/scripts/check_configs.ts b/scripts/check_configs.ts index 485bed9..f16570c 100644 --- a/scripts/check_configs.ts +++ b/scripts/check_configs.ts @@ -49,6 +49,8 @@ interface PerpPoolBanner { title: string; removed_markets?: string; added_markets?: string; + action_trigger_date?: string; + past_tense_text?: string; subtext?: string; } From 8341828c1bed7beee6d81bc2bd1d791a3a12cf4e Mon Sep 17 00:00:00 2001 From: Andrew Soon <77280201+andrewsoon@users.noreply.github.com> Date: Fri, 23 Aug 2024 15:06:20 +0800 Subject: [PATCH 3/7] Remove auto formatting --- configs/mainnet.json | 78 +++++++++----------------------------------- 1 file changed, 16 insertions(+), 62 deletions(-) diff --git a/configs/mainnet.json b/configs/mainnet.json index f6c1eb5..f62bb1e 100644 --- a/configs/mainnet.json +++ b/configs/mainnet.json @@ -1,18 +1,8 @@ { "network": "mainnet", "prelaunch_markets": [], - "blacklisted_markets": [ - "gm1_busd1", - "SWTH_UST", - "LUNA_SWTH" - ], - "blacklisted_pools": [ - "34", - "43", - "44", - "74", - "83" - ], + "blacklisted_markets": ["gm1_busd1", "SWTH_UST", "LUNA_SWTH"], + "blacklisted_pools": ["34", "43", "44", "74", "83"], "blacklisted_tokens": [ "swthb.1.6.d04123", "swth.1.18.94d5fe", @@ -242,9 +232,7 @@ "perpTradingBoost": 6 } }, - "cross_selling_source_tokens": [ - "swth" - ], + "cross_selling_source_tokens": ["swth"], "external_chain_channels": { "Archway": { "Noble": "channel-29" @@ -295,88 +283,54 @@ "additional_ibc_token_config": [ { "baseDenom": "uusdc", - "chainRoutes": [ - "Archway", - "Noble" - ] + "chainRoutes": ["Archway", "Noble"] }, { "baseDenom": "uusdc", - "chainRoutes": [ - "Cosmos Hub", - "Noble" - ] + "chainRoutes": ["Cosmos Hub", "Noble"] }, { "baseDenom": "uusdc", - "chainRoutes": [ - "DYDX", - "Noble" - ] + "chainRoutes": ["DYDX", "Noble"] }, { "baseDenom": "uusdc", - "chainRoutes": [ - "Kujira", - "Noble" - ] + "chainRoutes": ["Kujira", "Noble"] }, { "baseDenom": "swth", - "chainRoutes": [ - "Osmosis" - ] + "chainRoutes": ["Osmosis"] }, { "baseDenom": "uusdc", - "chainRoutes": [ - "Osmosis", - "Noble" - ] + "chainRoutes": ["Osmosis", "Noble"] }, { "baseDenom": "uusdc", - "chainRoutes": [ - "Stargaze", - "Noble" - ] + "chainRoutes": ["Stargaze", "Noble"] }, { "baseDenom": "uusdc", - "chainRoutes": [ - "Terra", - "Noble" - ] + "chainRoutes": ["Terra", "Noble"] }, { "baseDenom": "uatom", - "chainRoutes": [ - "Osmosis", - "Cosmos Hub" - ], + "chainRoutes": ["Osmosis", "Cosmos Hub"], "denomOnCarbon": "ibc/6CDD4663F2F09CD62285E2D45891FC149A3568E316CE3EBBE201A71A78A69388" }, { "baseDenom": "ustrd", - "chainRoutes": [ - "Osmosis", - "Stride" - ], + "chainRoutes": ["Osmosis", "Stride"], "denomOnCarbon": "ibc/FCFF8B19C61677F3B78E2A5AE3B4A34A8D23858D16905F253B8438B3AFD07FF8" }, { "baseDenom": "ustrd", - "chainRoutes": [ - "Cosmos Hub", - "Stride" - ], + "chainRoutes": ["Cosmos Hub", "Stride"], "denomOnCarbon": "ibc/B8D03406E060650ECE2D521287AC9A94D036C4C78B4AB871AC740A5FF2030D79" } ], "demex_trading_league_config": { - "promoMarkets": [ - "cmkt/201" - ], + "promoMarkets": ["cmkt/201"], "currentPrizeSymbol": "USDC", "currentCompPerpPoolId": 3 }, @@ -419,4 +373,4 @@ ] }, "wswth_contract": "0x0e59f6Cf81B5Fae9F7a5912062Fe53909e7221C2" -} \ No newline at end of file +} From c493f57bf4a76bbf3ea6ff86b06f11c212bc2350 Mon Sep 17 00:00:00 2001 From: Andrew Soon <77280201+andrewsoon@users.noreply.github.com> Date: Fri, 23 Aug 2024 15:07:02 +0800 Subject: [PATCH 4/7] Update mainnet.json --- configs/mainnet.json | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/configs/mainnet.json b/configs/mainnet.json index f62bb1e..d810bf7 100644 --- a/configs/mainnet.json +++ b/configs/mainnet.json @@ -339,9 +339,7 @@ "perp_pools": { "incentives": { "proxy": "0x7b1C7216C117cC62D875e3086518B238392cf04d", - "distributors": [ - "0x5268d461317f2f39b5023fCC25cFF31210C4b947" - ] + "distributors": ["0x5268d461317f2f39b5023fCC25cFF31210C4b947"] }, "banners": [ { From 0f56cab8ec9952369ea87ed69551d0658dbe6513 Mon Sep 17 00:00:00 2001 From: Andrew Soon <77280201+andrewsoon@users.noreply.github.com> Date: Fri, 23 Aug 2024 15:14:59 +0800 Subject: [PATCH 5/7] Update mainnet.json --- configs/mainnet.json | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/configs/mainnet.json b/configs/mainnet.json index d810bf7..ba3868d 100644 --- a/configs/mainnet.json +++ b/configs/mainnet.json @@ -68,6 +68,32 @@ "eth.1.2.942d87": 21, "usdc.1.2.343151": 22 }, + "perp_pool_banners": [ + { + "perp_pool_id": "9", + "show_until": "2024-08-25T08:00+00:00", + "title": "New Markets added", + "added_markets": "CRV will be added to this Perp Pool on 22 Aug, 08:00 AM UTC. This banner will disappear on 25 Aug." + }, + { + "perp_pool_id": "7", + "show_until": "2024-08-25T08:00+00:00", + "title": "New Markets added", + "added_markets": "SUN will be added to this Perp Pool on 22 Aug, 08:00 AM UTC. This banner will disappear on 25 Aug." + }, + { + "perp_pool_id": "4", + "show_until": "2024-08-30T08:00+00:00", + "title": "New Markets added", + "added_markets": "On 20 Aug, 08:00 AM UTC, this perp pool was renamed to 'Modular'. MNT, MANTA, ARB, OP were added to this Perp Pool" + }, + { + "perp_pool_id": "6", + "show_until": "2024-08-30T08:00+00:00", + "title": "Markets removed", + "removed_markets": "On 20 Aug 8AM UTC, all markets in this perp pool have been moved to the Celestia Perp Pool to consolidate liquidity." + } + ], "spot_history_market_list": { "cmkt/117": "BINANCE:ETHUSD", "cmkt/118": "BINANCE:BTCUSD", From 4161e9106cacae4bb456c338c63ca15008550a29 Mon Sep 17 00:00:00 2001 From: Andrew Soon <77280201+andrewsoon@users.noreply.github.com> Date: Fri, 23 Aug 2024 15:16:01 +0800 Subject: [PATCH 6/7] Update config.schema.json --- config.schema.json | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/config.schema.json b/config.schema.json index c282b2f..1053cbd 100644 --- a/config.schema.json +++ b/config.schema.json @@ -10,6 +10,7 @@ "blacklisted_tokens", "transfer_options", "network_fees", + "perp_pool_banners", "cross_selling_source_tokens", "external_chain_channels", "additional_ibc_token_config" @@ -85,6 +86,40 @@ } } }, + "perp_pool_banners": { + "type": "array", + "description": "List of perp pool banners", + "items": { + "type": "object", + "required": [ + "perp_pool_id", + "title" + ], + "properties": { + "perp_pool_id": { + "$ref": "#/$defs/perp_pool_id" + }, + "show_from": { + "$ref": "#/$defs/show_from" + }, + "show_until": { + "$ref": "#/$defs/show_until" + }, + "title": { + "$ref": "#/$defs/title" + }, + "removed_markets": { + "$ref": "#/$defs/removed_markets" + }, + "added_markets": { + "$ref": "#/$defs/added_markets" + }, + "subtext": { + "$ref": "#/$defs/subtext" + } + } + } + }, "demex_points_config": { "type": "object", "description": "Config for demex points", @@ -389,4 +424,4 @@ } } } -} \ No newline at end of file +} From 0cba2056da3fa0450cdd8dc8802a98a34ea193cf Mon Sep 17 00:00:00 2001 From: Andrew Soon <77280201+andrewsoon@users.noreply.github.com> Date: Fri, 23 Aug 2024 15:17:22 +0800 Subject: [PATCH 7/7] Update check_configs.ts --- scripts/check_configs.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/scripts/check_configs.ts b/scripts/check_configs.ts index f16570c..5f1dc6d 100644 --- a/scripts/check_configs.ts +++ b/scripts/check_configs.ts @@ -18,6 +18,7 @@ interface ConfigJSON { network_fees: { [denom: string]: number; }; + perp_pool_banners: PerpPoolBanner[]; demex_points_config: DemexPointsConfig; perp_pool_promo: { [perpPoolId: string]: PerpPoolPromo; @@ -454,6 +455,22 @@ async function main() { }) const perpPoolIds = perpPoolsQuery.pools.map((pool) => pool.poolId.toString()) + const perpPoolBannerIds = Object.values(jsonData.perp_pool_banners).map((banner) => banner.perp_pool_id) + + const hasInvalidPerpPoolBannerIds = checkValidEntries(perpPoolBannerIds, perpPoolIds) + const hasDuplicatePerpPoolBannerIds = checkDuplicateEntries(perpPoolBannerIds) + + if (hasInvalidPerpPoolBannerIds.status && hasInvalidPerpPoolBannerIds.entry) { + let listOfInvalidIds: string = hasInvalidPerpPoolBannerIds.entry.join(", "); + console.error(`ERROR: ${network}.json has the following invalid perp pool ids under the perp_pool_banners field: ${listOfInvalidIds}`) + outcomeMap[network] = false; + } + + if (hasDuplicatePerpPoolBannerIds.status && hasDuplicatePerpPoolBannerIds.entry) { + let listOfDuplicates: string = hasDuplicatePerpPoolBannerIds.entry.join(", "); + console.error(`ERROR: ${network}.json has duplicated perp pool banners for the following perp pool ids: ${listOfDuplicates}. Please make sure to input each perp pool banner only once in ${network}`); + outcomeMap[network] = false; + } if (network === CarbonSDK.Network.MainNet && !jsonData.demex_points_config) { console.error(`ERROR: ${network}.json is missing demex_points_config`)