diff --git a/.github/markets/pr_template.md b/.github/markets/pr_template.md index 6ecb128..66da4e6 100644 --- a/.github/markets/pr_template.md +++ b/.github/markets/pr_template.md @@ -29,6 +29,7 @@ Each json file under the [configs](../../configs) folder correspond to their res | `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 | +|`transfer_quick_select_tokens` |`TransferQuickSelectToken[]` |true |List of quick select tokens for deposit and withdrawal forms. | ## TransferDisabledTokens Data Structure |Field |Type |Required |Description |Notes | @@ -119,4 +120,10 @@ Each json file under the [configs](../../configs) folder correspond to their res ## 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 +|`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 | + +## TransferQuickSelectToken Data Structure +|Field |Type |Required |Description |Notes | +|---|---|---|---|---| +|`show` |`string` |true |The default token will be show on UI deposit/withdrawal forms | +|`real` |`string` |true |The default token will be use to transfer in deposit/withdrawal | \ No newline at end of file diff --git a/README.md b/README.md index 0f7f551..ccb3137 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,7 @@ Currently, each JSON file contain the following data on its corresponding networ - cross selling source tokens - map of IBC channels for external IBC chains (such as Osmosis, Noble, etc.) - information about IBC tokens that are not added on chain or require packet forwarding +- default quick select tokens in deposit/withdrawal forms Additionally, the JSON file for mainnet contains the following data to support ongoing campaigns/promotions: - demex points config diff --git a/config.schema.json b/config.schema.json index 683a082..cc99062 100644 --- a/config.schema.json +++ b/config.schema.json @@ -515,6 +515,28 @@ "description": "Indicates whether or not to show APR tooltip on Spot Pools page" } } + }, + "transfer_quick_select_token": { + "type": "object", + "description": "Token for quick select in transfer form", + "required": ["show", "real"], + "properties": { + "show": { + "type": "string", + "description": "Token to show on UI" + }, + "real": { + "type": "string", + "description": "Token to use in transfer" + } + } + }, + "transfer_quick_select_tokens": { + "type": "array", + "description": "List of tokens for quick select in transfer form", + "items": { + "$ref": "#/$defs/transfer_quick_select_token" + } } } } diff --git a/configs/devnet.json b/configs/devnet.json index 86d3aff..71b9380 100644 --- a/configs/devnet.json +++ b/configs/devnet.json @@ -45,5 +45,23 @@ ], "spot_pool_config": { "show_apr_tooltip": false - } + }, + "transfer_quick_select_tokens": [ + { + "show": "swth", + "real" : "swth" + }, + { + "show": "usdc", + "real" : "usdc" + }, + { + "show": "eth", + "real" : "eth" + }, + { + "show": "dai", + "real" : "dai" + } + ] } \ No newline at end of file diff --git a/configs/mainnet.json b/configs/mainnet.json index b11caa5..8ad5cb0 100644 --- a/configs/mainnet.json +++ b/configs/mainnet.json @@ -477,5 +477,23 @@ }, "spot_pool_config": { "show_apr_tooltip": true - } + }, + "transfer_quick_select_tokens": [ + { + "show": "brdg/4b90a8d1225d11ed7af0661ff7309714189a527302892cad03ace7615d417d38", + "real" : "cgt/1" + }, + { + "show": "swth", + "real" : "swth" + }, + { + "show": "eth.1.2.942d87", + "real" : "eth.1.2.942d87" + }, + { + "show": "brdg/a02afc2c1edf77cc023eefa25fc036c184612faf9365cda9c1daa3b1675ebf8f", + "real" : "brdg/a02afc2c1edf77cc023eefa25fc036c184612faf9365cda9c1daa3b1675ebf8f" + } + ] } diff --git a/configs/testnet.json b/configs/testnet.json index 2d3c393..faf2c78 100644 --- a/configs/testnet.json +++ b/configs/testnet.json @@ -59,5 +59,23 @@ }, "spot_pool_config": { "show_apr_tooltip": false - } + }, + "transfer_quick_select_tokens": [ + { + "show": "swth", + "real" : "swth" + }, + { + "show": "usdc", + "real" : "usdc" + }, + { + "show": "eth", + "real" : "eth" + }, + { + "show": "dai", + "real" : "dai" + } + ] } diff --git a/scripts/check_configs.ts b/scripts/check_configs.ts index c13f7d3..49c4174 100644 --- a/scripts/check_configs.ts +++ b/scripts/check_configs.ts @@ -34,6 +34,7 @@ interface ConfigJSON { market_banners?: MarketBanner[]; market_promo?: {[marketId: string]: MarketPromo}; spot_pool_config?: SpotPoolConfig; + transfer_quick_select_tokens?: TransferQuickSelectToken[]; } interface InvalidEntry { @@ -132,6 +133,11 @@ interface SpotPoolConfig { show_apr_tooltip: boolean; } +interface TransferQuickSelectToken { + show: string; + real: string; +} + type OutcomeMap = { [key in CarbonSDK.Network]: boolean }; // true = success, false = failure const outcomeMap: OutcomeMap = { @@ -420,6 +426,39 @@ function isValidMarketPromo(marketPromo: {[marketId: string]: MarketPromo}, netw return true; } +function isValidQuickSelectTokens(quickSelectTokens: TransferQuickSelectToken[], network: CarbonSDK.Network, denoms: string[]): boolean { + const duplicateQuickSelectTokens = checkDuplicateEntries(quickSelectTokens.map(token => token.show)); + const invalidQuickSelectTokens = checkValidEntries(quickSelectTokens.map(token => token.show), denoms); + + const duplicateRealTokens = checkDuplicateEntries(quickSelectTokens.map(token => token.real)); + const invalidRealTokens = checkValidEntries(quickSelectTokens.map(token => token.real), denoms); + + if (duplicateQuickSelectTokens.status && duplicateQuickSelectTokens.entry) { + let listOfDuplicates: string = duplicateQuickSelectTokens.entry.join(", "); + console.error(`ERROR: ${network}.json has the following duplicated quick select tokens: ${listOfDuplicates}. Please make sure to input each token only once in ${network}`); + return false; + } + + if (invalidQuickSelectTokens.status && invalidQuickSelectTokens.entry) { + let listOfInvalidTokens: string = invalidQuickSelectTokens.entry.join(", "); + console.error(`ERROR: ${network}.json has the following invalid quick select token denoms: ${listOfInvalidTokens}. Please make sure to only input valid token denoms in ${network}`); + return false; + } + + if (duplicateRealTokens.status && duplicateRealTokens.entry) { + let listOfDuplicates: string = duplicateRealTokens.entry.join(", "); + console.error(`ERROR: ${network}.json has the following duplicated real tokens: ${listOfDuplicates}. Please make sure to input each token only once in ${network}`); + return false; + } + + if (invalidRealTokens.status && invalidRealTokens.entry) { + let listOfInvalidTokens: string = invalidRealTokens.entry.join(", "); + console.error(`ERROR: ${network}.json has the following invalid real token denoms: ${listOfInvalidTokens}. Please make sure to only input valid token denoms in ${network}`); + return false; + } + return true; +} + async function main() { for (const net of myArgs) { let network: CarbonSDK.Network; @@ -775,6 +814,11 @@ async function main() { const isDemexTradingLeagueConfigValid = isValidDemexTradingLeagueConfig(jsonData.demex_trading_league_config, network, marketIds, jsonData.blacklisted_markets, perpPoolIds, tokenSymbols) if (!isDemexTradingLeagueConfigValid) outcomeMap[network] = false; } + + // check for validate quick select tokens + if (jsonData.transfer_quick_select_tokens && !isValidQuickSelectTokens(jsonData.transfer_quick_select_tokens, network, tokens)) { + outcomeMap[network] = false; + } } } const outcomeArr = Object.values(outcomeMap);