Skip to content

Commit

Permalink
Add config for show Spot pool APR tooltip (#243)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
thanhpn and sarah-thong authored Dec 12, 2024
1 parent a814033 commit e7fa5fc
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 3 deletions.
8 changes: 7 additions & 1 deletion .github/markets/pr_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down Expand Up @@ -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. |
|`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 |
10 changes: 10 additions & 0 deletions config.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
}
}
}
5 changes: 4 additions & 1 deletion configs/devnet.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,8 @@
"content": "Hello World",
"hideable": true
}
]
],
"spot_pool_config": {
"show_apr_tooltip": false
}
}
3 changes: 3 additions & 0 deletions configs/mainnet.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
3 changes: 3 additions & 0 deletions configs/testnet.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,8 @@
],
"direct_deposit": {
"domain": "https://test-dagger.dem.exchange"
},
"spot_pool_config": {
"show_apr_tooltip": false
}
}
16 changes: 15 additions & 1 deletion scripts/check_configs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ interface ConfigJSON {
wswth_contract?: string;
market_banners?: MarketBanner[];
market_promo?: {[marketId: string]: MarketPromo};
spot_pool_config?: SpotPoolConfig;
}

interface InvalidEntry {
Expand Down Expand Up @@ -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 = {
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit e7fa5fc

Please sign in to comment.