From e7fa5fc937d6cf0300300672c3da59a0eb5a908c Mon Sep 17 00:00:00 2001 From: Pham Thanh Date: Thu, 12 Dec 2024 15:37:02 +0700 Subject: [PATCH] Add config for show Spot pool APR tooltip (#243) * Add config for show Spot pool APR tooltip * Address reviewer comment * Edit documentation copy for spot_pool_config --------- Co-authored-by: Thong Yuan Yu Sarah --- .github/markets/pr_template.md | 8 +++++++- config.schema.json | 10 ++++++++++ configs/devnet.json | 5 ++++- configs/mainnet.json | 3 +++ configs/testnet.json | 3 +++ scripts/check_configs.ts | 16 +++++++++++++++- 6 files changed, 42 insertions(+), 3 deletions(-) diff --git a/.github/markets/pr_template.md b/.github/markets/pr_template.md index e09bd72..17a34f3 100644 --- a/.github/markets/pr_template.md +++ b/.github/markets/pr_template.md @@ -26,6 +26,7 @@ Each json file under the [configs](../../configs) folder correspond to their res | `native_token_contracts_map` | `object` | false | Map of token denoms to their respective contract addresses on the native chain. | | | `native_depositor_contracts_map` | `object` | false | Map of axelar connection ids to their respective native depositor contract addresses |`market_promo` |`MarketPromo` |false |Map of Objects that contains market promo parameters for each market |If the `market_promo` property is omitted, no promo will be shown. The key of each entry is the ids of the market with existing promo. | +|`spot_pool_config` |`SpotPoolConfig` |false |Object that contains the config parameters for the [Spot Pools](https://app.dem.exchange/pools/spot) page on Demex | ## Maintenance Data Structure |Field |Type |Required |Description |Notes | @@ -105,4 +106,9 @@ Each json file under the [configs](../../configs) folder correspond to their res |---|---|---|---|---| |`start` |`string` |true |Start time of the promo. | |`end` |`string` |true |End time of the promo. | -|`tooltip` |`string` |false |Tooltip message for perp trading boost tag. | \ No newline at end of file +|`tooltip` |`string` |false |Tooltip message for perp trading boost tag. | + +## SpotPoolConfig Data Structure +|Field |Type |Required |Description |Notes | +|---|---|---|---|---| +|`show_apr_tooltip` |`boolean` |true |Indicates whether or not to show the Annual Percentage Returns (APR) tooltip on [Spot Pools](https://app.dem.exchange/pools/spot) page | \ No newline at end of file diff --git a/config.schema.json b/config.schema.json index ffcfe0e..641ea39 100644 --- a/config.schema.json +++ b/config.schema.json @@ -472,6 +472,16 @@ } }, "additionalProperties": false + }, + "spot_pool_config": { + "type": "object", + "description": "Config parameters for Spot Pools page", + "properties": { + "show_apr_tooltip": { + "type": "boolean", + "description": "Indicates whether or not to show APR tooltip on Spot Pools page" + } + } } } } diff --git a/configs/devnet.json b/configs/devnet.json index 99f2321..5559c22 100644 --- a/configs/devnet.json +++ b/configs/devnet.json @@ -37,5 +37,8 @@ "content": "Hello World", "hideable": true } - ] + ], + "spot_pool_config": { + "show_apr_tooltip": false + } } \ No newline at end of file diff --git a/configs/mainnet.json b/configs/mainnet.json index d0c9c3f..7a4152b 100644 --- a/configs/mainnet.json +++ b/configs/mainnet.json @@ -450,5 +450,8 @@ "end": "2024-12-20T08:00:00Z", "tooltip": "Trade MNT-PERP to earn 3x points in the Mantle Trading League!" } + }, + "spot_pool_config": { + "show_apr_tooltip": true } } diff --git a/configs/testnet.json b/configs/testnet.json index d614e60..ce9f0d3 100644 --- a/configs/testnet.json +++ b/configs/testnet.json @@ -51,5 +51,8 @@ ], "direct_deposit": { "domain": "https://test-dagger.dem.exchange" + }, + "spot_pool_config": { + "show_apr_tooltip": false } } diff --git a/scripts/check_configs.ts b/scripts/check_configs.ts index 9cd7d3b..1ff89fc 100644 --- a/scripts/check_configs.ts +++ b/scripts/check_configs.ts @@ -31,6 +31,7 @@ interface ConfigJSON { wswth_contract?: string; market_banners?: MarketBanner[]; market_promo?: {[marketId: string]: MarketPromo}; + spot_pool_config?: SpotPoolConfig; } interface InvalidEntry { @@ -116,6 +117,10 @@ interface MarketPromo { tooltip?: string; } +interface SpotPoolConfig { + show_apr_tooltip: boolean; +} + type OutcomeMap = { [key in CarbonSDK.Network]: boolean }; // true = success, false = failure const outcomeMap: OutcomeMap = { @@ -332,7 +337,7 @@ function isValidMarketPromo(marketPromo: {[marketId: string]: MarketPromo}, netw outcomeMap[network] = false; } - for (const promoId in marketPromoIds) { + for (const promoId of marketPromoIds) { const promoInfo = marketPromo[promoId]; const startTimeStr = promoInfo.start; const endTimeStr = promoInfo.end; @@ -674,6 +679,15 @@ async function main() { if(jsonData.market_promo && !isValidMarketPromo(jsonData.market_promo, network, marketIds)) { outcomeMap[network] = false; } + + // check for spot pool config + if (jsonData.spot_pool_config) { + const spotPoolConfig = jsonData.spot_pool_config + if (spotPoolConfig.show_apr_tooltip === undefined) { + console.error(`ERROR: the show_apr_tooltip field is missing in spot_pool_config of ${network}.json. Please enter a boolean value for show_apr_tooltip.`); + outcomeMap[network] = false; + } + } // external chain channels check const isExternalChannelsValid = isValidExternalChainChannels(jsonData.external_chain_channels, ibcBridgeNames, network);