From c67b302650b7b6c0841489b09733c0910225f766 Mon Sep 17 00:00:00 2001 From: Andrew Soon Date: Tue, 17 Dec 2024 20:35:19 +0800 Subject: [PATCH 1/7] Add quick select deposit options config --- configs/mainnet.json | 102 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 84 insertions(+), 18 deletions(-) diff --git a/configs/mainnet.json b/configs/mainnet.json index 0cdeeea..a987893 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", @@ -289,7 +299,9 @@ "perpTradingBoost": 6 } }, - "cross_selling_source_tokens": ["swth"], + "cross_selling_source_tokens": [ + "swth" + ], "external_chain_channels": { "Archway": { "Noble": "channel-29" @@ -341,58 +353,94 @@ "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": "swth", - "chainRoutes": ["Terra"] + "chainRoutes": [ + "Terra" + ] }, { "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 }, @@ -483,5 +531,23 @@ }, "spot_pool_config": { "show_apr_tooltip": true - } -} + }, + "quick_select_deposit_options": [ + { + "label_denom": "brdg/d8c3db91ad4ba11fe52971b4c387b0110c8951ec0f5b8f0fb445ef0306a349e1", + "targe_denom": "cgt/1" + }, + { + "label_denom": "swth", + "targe_denom": "swth" + }, + { + "label_denom": "eth.1.2.942d87", + "targe_denom": "eth.1.2.942d87" + }, + { + "label_denom": "brdg/a02afc2c1edf77cc023eefa25fc036c184612faf9365cda9c1daa3b1675ebf8f", + "targe_denom": "brdg/a02afc2c1edf77cc023eefa25fc036c184612faf9365cda9c1daa3b1675ebf8f" + } + ] +} \ No newline at end of file From 9921fee8e927084118f54c85f18586bcc53a4763 Mon Sep 17 00:00:00 2001 From: Andrew Soon Date: Tue, 17 Dec 2024 20:35:57 +0800 Subject: [PATCH 2/7] Fix label --- configs/mainnet.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configs/mainnet.json b/configs/mainnet.json index a987893..97f3b52 100644 --- a/configs/mainnet.json +++ b/configs/mainnet.json @@ -535,19 +535,19 @@ "quick_select_deposit_options": [ { "label_denom": "brdg/d8c3db91ad4ba11fe52971b4c387b0110c8951ec0f5b8f0fb445ef0306a349e1", - "targe_denom": "cgt/1" + "target_denom": "cgt/1" }, { "label_denom": "swth", - "targe_denom": "swth" + "target_denom": "swth" }, { "label_denom": "eth.1.2.942d87", - "targe_denom": "eth.1.2.942d87" + "target_denom": "eth.1.2.942d87" }, { "label_denom": "brdg/a02afc2c1edf77cc023eefa25fc036c184612faf9365cda9c1daa3b1675ebf8f", - "targe_denom": "brdg/a02afc2c1edf77cc023eefa25fc036c184612faf9365cda9c1daa3b1675ebf8f" + "target_denom": "brdg/a02afc2c1edf77cc023eefa25fc036c184612faf9365cda9c1daa3b1675ebf8f" } ] } \ No newline at end of file From 2f911d653810203af45b150818cf99e18cf8f68c Mon Sep 17 00:00:00 2001 From: Andrew Soon Date: Tue, 17 Dec 2024 20:59:29 +0800 Subject: [PATCH 3/7] Revert auto-formatter changes --- configs/mainnet.json | 80 +++++++++----------------------------------- 1 file changed, 16 insertions(+), 64 deletions(-) diff --git a/configs/mainnet.json b/configs/mainnet.json index 97f3b52..c9984ab 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", @@ -299,9 +289,7 @@ "perpTradingBoost": 6 } }, - "cross_selling_source_tokens": [ - "swth" - ], + "cross_selling_source_tokens": ["swth"], "external_chain_channels": { "Archway": { "Noble": "channel-29" @@ -353,94 +341,58 @@ "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": "swth", - "chainRoutes": [ - "Terra" - ] + "chainRoutes": ["Terra"] }, { "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 }, From f7477799bc844f153b141f7c1a5978275624f4d9 Mon Sep 17 00:00:00 2001 From: hochangjun <32430247+hochangjun@users.noreply.github.com> Date: Tue, 17 Dec 2024 21:03:53 +0800 Subject: [PATCH 4/7] added pudgy penguin market banner added pudgy penguin market banner --- configs/mainnet.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configs/mainnet.json b/configs/mainnet.json index 0cdeeea..a48224d 100644 --- a/configs/mainnet.json +++ b/configs/mainnet.json @@ -469,9 +469,9 @@ }, "market_banners": [ { - "market_id": "cmkt/246", - "content": "This is a pre-launch perp for Hyperliquid's HYPE and assumes a total supply of 1 billion. [Learn more.](https://guide.dem.exchange/trade/futures/market-specifications/pre-launch-perpetuals)", - "show_from": "2024-11-04T09:00+00:00" + "market_id": "cmkt/253", + "content": "Trade Pudgy Penguins floor price movements without owning the NFT. This market is based on the floor price of the Pudgy Penguins NFT collection, aggregated from top NFT marketplaces, denominated in USD.", + "show_from": "2024-12-06T09:00+00:00" } ], "market_promo": { From 93dd4fe5aa0ccc3eed8d277db6e9a098d13d3a62 Mon Sep 17 00:00:00 2001 From: Andrew Soon Date: Tue, 17 Dec 2024 21:11:01 +0800 Subject: [PATCH 5/7] Remove invalid token in network_fees config --- configs/mainnet.json | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/configs/mainnet.json b/configs/mainnet.json index c9984ab..c890d8e 100644 --- a/configs/mainnet.json +++ b/configs/mainnet.json @@ -92,15 +92,14 @@ "ibc/75249A18DEFBEFE55F83B1C70CAD234DF164F174C6BC51682EE92C2C81C18C93": 11, "ibc/B7864B03E1B9FD4F049243E92ABD691586F682137037A9F3FCA5222815620B3C": 12, "ibc/4E06CF24FEBFB3F5AF645377DCC0B70AA6183BAF6B918B8B6243FCDEB7D38118": 13, - "bnb.1.6.773edb": 14, - "usdc.1.6.53ff75": 15, - "busd.1.6.754a80": 16, - "eth.1.19.c3b805": 17, - "cglp.1.19.1698d3": 18, - "zil.1.18.1a4a06": 19, - "bneo.1.14.e2e5f6": 20, - "eth.1.2.942d87": 21, - "usdc.1.2.343151": 22 + "usdc.1.6.53ff75": 14, + "busd.1.6.754a80": 15, + "eth.1.19.c3b805": 16, + "cglp.1.19.1698d3": 17, + "zil.1.18.1a4a06": 18, + "bneo.1.14.e2e5f6": 19, + "eth.1.2.942d87": 20, + "usdc.1.2.343151": 21 }, "spot_history_market_list": { "cmkt/117": "BINANCE:ETHUSD", From 4a9c807dd636fdda5d0b78c48d3d5a17c2d6d633 Mon Sep 17 00:00:00 2001 From: thanhpn Date: Mon, 16 Dec 2024 14:44:12 +0700 Subject: [PATCH 6/7] Add config for quick select tokens --- .github/markets/pr_template.md | 9 ++++++++- README.md | 1 + config.schema.json | 22 ++++++++++++++++++++ configs/devnet.json | 20 +++++++++++++++++- configs/mainnet.json | 2 +- configs/testnet.json | 20 +++++++++++++++++- scripts/check_configs.ts | 37 ++++++++++++++++++++++++++++++++++ 7 files changed, 107 insertions(+), 4 deletions(-) diff --git a/.github/markets/pr_template.md b/.github/markets/pr_template.md index 6ecb128..8058e56 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 | +|`quick_select_tokens` |`QuickSelectToken[]` |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 | + +## QuickSelectToken Data Structure +|Field |Type |Required |Description |Notes | +|---|---|---|---|---| +|`label_denom` |`string` |true |The default token will be show on UI deposit/withdrawal forms | +|`target_denom` |`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..e8ca37a 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" } } + }, + "quick_select_token": { + "type": "object", + "description": "Token denom for quick select in transfer form", + "required": ["label_denom", "target_denom"], + "properties": { + "label_denom": { + "type": "string", + "description": "Token denom to show on UI" + }, + "target_denom": { + "type": "string", + "description": "Token denom to use in transfer" + } + } + }, + "quick_select_tokens": { + "type": "array", + "description": "List of tokens for quick select in transfer form", + "items": { + "$ref": "#/$defs/quick_select_token" + } } } } diff --git a/configs/devnet.json b/configs/devnet.json index 86d3aff..b15a558 100644 --- a/configs/devnet.json +++ b/configs/devnet.json @@ -45,5 +45,23 @@ ], "spot_pool_config": { "show_apr_tooltip": false - } + }, + "quick_select_deposit_options": [ + { + "label_denom": "swth", + "target_denom" : "swth" + }, + { + "label_denom": "usdc", + "target_denom" : "usdc" + }, + { + "label_denom": "eth", + "target_denom" : "eth" + }, + { + "label_denom": "dai", + "target_denom" : "dai" + } + ] } \ No newline at end of file diff --git a/configs/mainnet.json b/configs/mainnet.json index 94b3eaf..3f6d81a 100644 --- a/configs/mainnet.json +++ b/configs/mainnet.json @@ -501,4 +501,4 @@ "target_denom": "brdg/a02afc2c1edf77cc023eefa25fc036c184612faf9365cda9c1daa3b1675ebf8f" } ] -} \ No newline at end of file +} diff --git a/configs/testnet.json b/configs/testnet.json index 2d3c393..39e3b49 100644 --- a/configs/testnet.json +++ b/configs/testnet.json @@ -59,5 +59,23 @@ }, "spot_pool_config": { "show_apr_tooltip": false - } + }, + "quick_select_deposit_options": [ + { + "label_denom": "swth", + "target_denom" : "swth" + }, + { + "label_denom": "usdc", + "target_denom" : "usdc" + }, + { + "label_denom": "eth", + "target_denom" : "eth" + }, + { + "label_denom": "dai", + "target_denom" : "dai" + } + ] } diff --git a/scripts/check_configs.ts b/scripts/check_configs.ts index c13f7d3..76467b6 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; + quick_select_deposit_options?: QuickSelectToken[]; } interface InvalidEntry { @@ -132,6 +133,11 @@ interface SpotPoolConfig { show_apr_tooltip: boolean; } +interface QuickSelectToken { + label_denom: string; + target_denom: string; +} + type OutcomeMap = { [key in CarbonSDK.Network]: boolean }; // true = success, false = failure const outcomeMap: OutcomeMap = { @@ -420,6 +426,32 @@ function isValidMarketPromo(marketPromo: {[marketId: string]: MarketPromo}, netw return true; } +function isValidQuickSelectTokens(quickSelectTokens: QuickSelectToken[], network: CarbonSDK.Network, denoms: string[]): boolean { + const duplicateQuickSelectTokens = checkDuplicateEntries(quickSelectTokens.map(token => token.label_denom)); + const invalidQuickSelectTokens = checkValidEntries(quickSelectTokens.map(token => token.label_denom), denoms); + + const invalidTargetTokens = checkValidEntries(quickSelectTokens.map(token => token.target_denom), denoms); + + if (duplicateQuickSelectTokens.status && duplicateQuickSelectTokens.entry) { + let listOfDuplicates: string = duplicateQuickSelectTokens.entry.join(", "); + console.error(`ERROR: ${network}.json has the following duplicated label token denoms: ${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 label token denoms: ${listOfInvalidTokens}. Please make sure to only input valid token denoms in ${network}`); + return false; + } + + if (invalidTargetTokens.status && invalidTargetTokens.entry) { + let listOfInvalidTokens: string = invalidTargetTokens.entry.join(", "); + console.error(`ERROR: ${network}.json has the following invalid target 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 +807,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.quick_select_deposit_options && !isValidQuickSelectTokens(jsonData.quick_select_deposit_options, network, tokens)) { + outcomeMap[network] = false; + } } } const outcomeArr = Object.values(outcomeMap); From a836a0ed7ab81c6386a4da49c1f67e8c4019e330 Mon Sep 17 00:00:00 2001 From: thanhpn Date: Tue, 17 Dec 2024 19:55:31 +0700 Subject: [PATCH 7/7] Address reviewser comments --- .github/markets/pr_template.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/markets/pr_template.md b/.github/markets/pr_template.md index 8058e56..8eb3771 100644 --- a/.github/markets/pr_template.md +++ b/.github/markets/pr_template.md @@ -126,4 +126,4 @@ Each json file under the [configs](../../configs) folder correspond to their res |Field |Type |Required |Description |Notes | |---|---|---|---|---| |`label_denom` |`string` |true |The default token will be show on UI deposit/withdrawal forms | -|`target_denom` |`string` |true |The default token will be use to transfer in deposit/withdrawal | \ No newline at end of file +|`target_denom` |`string` |true |The default token will be use to transfer in deposit/withdrawal |