From 772d47de3f97515672fc2d00dd64b7c790ba6b18 Mon Sep 17 00:00:00 2001 From: kylehoang92 Date: Mon, 3 Feb 2025 15:49:07 +0700 Subject: [PATCH 1/2] feat: nps round 2 --- .github/markets/pr_template.md | 6 ++++++ config.schema.json | 15 ++++++++++++++- configs/devnet.json | 5 ++++- configs/mainnet.json | 5 ++++- configs/testnet.json | 5 ++++- scripts/check_configs.ts | 23 +++++++++++++++++++++++ 6 files changed, 55 insertions(+), 4 deletions(-) diff --git a/.github/markets/pr_template.md b/.github/markets/pr_template.md index c042f84..ca41ca5 100644 --- a/.github/markets/pr_template.md +++ b/.github/markets/pr_template.md @@ -31,6 +31,7 @@ Each json file under the [configs](../../configs) folder correspond to their res |`disabled_transfer_banner_config` |`DisabledTransferBannerConfig` |false |Config parameters for displaying banner to inform users that transfers for the relevant tokens are disabled | |`trading_leagues` |`TradingLeague[]` |false |Map of trading league config with their path. | |`lst_native_aprs` |`LSTNativeAPR[]` |false |List of LST native APR APIs. | +|`nps_config` | `NPSConfig` | false | Config parameters for managing NPS survey | ## Maintenance Data Structure |Field |Type |Required |Description |Notes | @@ -155,3 +156,8 @@ Each json file under the [configs](../../configs) folder correspond to their res |`api_url` |`string` |true |The API to fetch LST Native APR | |`lst_denoms` |`object` |true |The key value object for mapping denom of protocol api and carbon lst denom | +## NPSConfig Data Structure +|Field |Type |Required |Description |Notes | +|---|---|---|---|---| +|`start` |`string` |false |Start time of the NPS survey | This field **MUST** follow the valid ISO 8601 format
e.g. *2024-01-23T09:00+00:00* (23 Jan 2024, 9am UTC) | +|`end` |`string` |true |End time of the NPS survey | This field **MUST** follow the valid ISO 8601 format
e.g. *2024-01-23T09:00+00:00* (23 Jan 2024, 9am UTC) | diff --git a/config.schema.json b/config.schema.json index 977d50b..595f612 100644 --- a/config.schema.json +++ b/config.schema.json @@ -658,6 +658,19 @@ "items": { "$ref": "#/$defs/lst_native_apr" } + }, + "nps_config": { + "type": "object", + "description": "Config parameters for managing NPS survey", + "required": ["end"], + "properties": { + "start": { + "$ref": "#/$defs/start" + }, + "end": { + "$ref": "#/$defs/end" + } + } } } -} \ No newline at end of file +} diff --git a/configs/devnet.json b/configs/devnet.json index 0a4301c..38e326b 100644 --- a/configs/devnet.json +++ b/configs/devnet.json @@ -65,5 +65,8 @@ "label_denom": "dai", "target_denom" : "dai" } - ] + ], + "nps_config": { + "end": "2025-02-16T12:00:00Z" + } } \ No newline at end of file diff --git a/configs/mainnet.json b/configs/mainnet.json index 5e0d353..360712c 100644 --- a/configs/mainnet.json +++ b/configs/mainnet.json @@ -547,5 +547,8 @@ "milkTIA": "ibc/16065EE5282C5217685C8F084FC44864C25C706AC37356B0D62811D50B96920F" } } - ] + ], + "nps_config": { + "end": "2025-02-16T12:00:00Z" + } } diff --git a/configs/testnet.json b/configs/testnet.json index f3f0a07..0e496b5 100644 --- a/configs/testnet.json +++ b/configs/testnet.json @@ -79,5 +79,8 @@ "label_denom": "dai", "target_denom" : "dai" } - ] + ], + "nps_config": { + "end": "2025-02-16T12:00:00Z" + } } diff --git a/scripts/check_configs.ts b/scripts/check_configs.ts index fb90206..6be3903 100644 --- a/scripts/check_configs.ts +++ b/scripts/check_configs.ts @@ -38,6 +38,7 @@ interface ConfigJSON { announcement_banner: AnnouncementBanner; quick_select_deposit_options?: QuickSelectToken[]; lst_native_aprs?: LstNativeAPR[]; + nps_config?: NPSConfig; } interface InvalidEntry { @@ -162,6 +163,11 @@ interface LstNativeAPR { lst_denoms: SimpleMap; } +interface NPSConfig { + start?: string; + end: string; +} + type OutcomeMap = { [key in CarbonSDK.Network]: boolean }; // true = success, false = failure const outcomeMap: OutcomeMap = { @@ -530,6 +536,19 @@ function isValidLSTNativeDenom(lstNativeAPRs: LstNativeAPR[], network: CarbonSDK return true; } +function isValidNPSConfig(npsConfig: NPSConfig, network: CarbonSDK.Network): boolean { + const { start, end } = npsConfig; + if (start && end) { + const startTime = new Date(start); + const endTime = new Date(end); + if (endTime < startTime) { + console.error(`ERROR: nps_config.end is before nps_config.start in ${network}.json`); + return false; + } + } + return true; +} + async function main() { for (const net of myArgs) { let network: CarbonSDK.Network; @@ -925,6 +944,10 @@ async function main() { if (jsonData.lst_native_aprs && !isValidLSTNativeDenom(jsonData.lst_native_aprs, network, tokens)) { outcomeMap[network] = false; } + // check for NPS config + if (jsonData.nps_config && !isValidNPSConfig(jsonData.nps_config, network)) { + outcomeMap[network] = false; + } } } const outcomeArr = Object.values(outcomeMap); From 81175d50f451ac0bf3601ae364a7dbd03e4cdd61 Mon Sep 17 00:00:00 2001 From: kylehoang92 Date: Mon, 3 Feb 2025 16:26:22 +0700 Subject: [PATCH 2/2] fix: remove invalid entries in testnet.json --- configs/testnet.json | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/configs/testnet.json b/configs/testnet.json index 0e496b5..4dced8b 100644 --- a/configs/testnet.json +++ b/configs/testnet.json @@ -1,13 +1,7 @@ { "network": "testnet", "prelaunch_markets": [], - "blacklisted_markets": [ - "swth_btc", - "swth_btc2", - "swth_nex", - "swth_nexo", - "swth_dai" - ], + "blacklisted_markets": [], "blacklisted_pools": [], "blacklisted_tokens": [], "transfer_options": {}, @@ -28,7 +22,7 @@ "external_chain_channels": {}, "additional_ibc_token_config": [], "demex_trading_league_config": { - "promoMarkets": ["ATOM_PERP.CGUSD"], + "promoMarkets": [], "currentPrizeSymbol": "USDC", "currentCompPerpPoolId": 1 }, @@ -66,18 +60,6 @@ { "label_denom": "swth", "target_denom" : "swth" - }, - { - "label_denom": "usdc", - "target_denom" : "usdc" - }, - { - "label_denom": "eth", - "target_denom" : "eth" - }, - { - "label_denom": "dai", - "target_denom" : "dai" } ], "nps_config": {