diff --git a/src/contract.c b/src/contract.c index 31798dc..b4151a5 100644 --- a/src/contract.c +++ b/src/contract.c @@ -25,13 +25,33 @@ const uint8_t NULL_ETH_ADDRESS[ADDRESS_LENGTH] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; // Array containing the chains supported by squid -const char SQUID_SUPPORTED_CHAINS[NUM_SUPPORTED_CHAINS][PARAMETER_LENGTH] = { - "Ethereum", "Polygon", "Arbitrum", "Avalanche", "Moonbeam", "binance", - "cosmoshub", "crescent", "injective", "juno", "kujira", "osmosis", - "secret", "terra-2", "Agoric", "ASSETMANTLE", "Axelarnet", "COMDEX", - "EVMOS", "fetch", "KI", "REGEN", "UMEE"}; +const struct chainIdToChainName_t SQUID_SUPPORTED_CHAINS[NUM_SUPPORTED_CHAINS] = { + {"Ethereum", "Ethereum"}, + {"Arbitrum", "Arbitrum"}, + {"Avalanche", "Avalanche C-Chain"}, + {"Moonbeam", "Moonbeam Mainnet"}, + {"Polygon", "Polygon"}, + {"binance", "Binance"}, + {"cosmoshub", "Cosmos Hub"}, + {"crescent", "Crescent"}, + {"injective", "Injective"}, + {"juno", "Juno"}, + {"kujira", "Kujira"}, + {"osmosis", "Osmosis"}, + {"secret", "Secret Network"}, + {"terra-2", "Terra-2"}, + {"Agoric", "Agoric"}, + {"ASSETMANTLE", "AssetMantle"}, + {"Axelarnet", "Axelar"}, + {"COMDEX", "Comdex"}, + {"EVMOS", "Evmos"}, + {"fetch", "Fetch"}, + {"KI", "Ki"}, + {"REGEN", "Regen"}, + {"UMEE", "Umee"}, +}; -// Array containing the 15 most used tokens supported by squid +// Array containing the most used tokens supported by squid // each represented with their symbol and decimals const struct tokenSymbolToDecimals_t SQUID_SUPPORTED_TOKENS[NUM_SUPPORTED_TOKENS] = { {"ETH", 18}, @@ -49,4 +69,7 @@ const struct tokenSymbolToDecimals_t SQUID_SUPPORTED_TOKENS[NUM_SUPPORTED_TOKENS {"axlUSDT", 6}, {"WMATIC", 18}, {"WBNB", 18}, + {"WGLMR", 18}, + {"WFTM", 18}, + {"WAVAX", 18}, }; \ No newline at end of file diff --git a/src/handle_query_contract_ui.c b/src/handle_query_contract_ui.c index 3818faf..c638346 100644 --- a/src/handle_query_contract_ui.c +++ b/src/handle_query_contract_ui.c @@ -36,6 +36,12 @@ static void set_to_asset_ui(ethQueryContractUI_t *msg, squid_parameters_t *conte // Set UI for "Destination Chain" screen. static void set_dest_chain_ui(ethQueryContractUI_t *msg, squid_parameters_t *context) { strlcpy(msg->title, "To Chain", msg->titleLength); + for (size_t i = 0; i < NUM_SUPPORTED_CHAINS; i++) { + if (!memcmp(context->dest_chain, SQUID_SUPPORTED_CHAINS[i].chain_id, MAX_CHAIN_ID_LEN)) { + strlcpy(msg->msg, SQUID_SUPPORTED_CHAINS[i].chain_name, msg->msgLength); + return; + } + } strlcpy(msg->msg, context->dest_chain, msg->msgLength); } diff --git a/src/squid_plugin.h b/src/squid_plugin.h index c604859..c4a39bb 100644 --- a/src/squid_plugin.h +++ b/src/squid_plugin.h @@ -16,7 +16,7 @@ #define TOKEN_SENT_FOUND 1 #define NUM_SUPPORTED_CHAINS 23 -#define NUM_SUPPORTED_TOKENS 15 +#define NUM_SUPPORTED_TOKENS 18 extern const uint8_t NULL_ETH_ADDRESS[ADDRESS_LENGTH]; @@ -25,7 +25,17 @@ typedef struct tokenSymbolToDecimals_t { uint8_t decimals_sent; } tokenSymbolToDecimals_t; -extern const char SQUID_SUPPORTED_CHAINS[NUM_SUPPORTED_CHAINS][PARAMETER_LENGTH]; +// Longest chain id is currently "ASSETMANTLE" +#define MAX_CHAIN_ID_LEN 12 +// Longest chain name is currently "Avalanche C-Chain" +#define MAX_CHAIN_NAME_LEN 18 + +typedef struct chainIdToChainName_t { + char chain_id[MAX_CHAIN_ID_LEN]; + char chain_name[MAX_CHAIN_NAME_LEN]; +} chainIdToChainName_t; + +extern const struct chainIdToChainName_t SQUID_SUPPORTED_CHAINS[NUM_SUPPORTED_CHAINS]; extern const struct tokenSymbolToDecimals_t SQUID_SUPPORTED_TOKENS[NUM_SUPPORTED_TOKENS]; // Returns 1 if corresponding address is the address for the chain token (ETH, BNB, MATIC, @@ -108,7 +118,7 @@ static inline void printf_hex_array(const char *title __attribute__((unused)), static inline bool is_chain_supported(squid_parameters_t *context) { for (size_t i = 0; i < NUM_SUPPORTED_CHAINS; i++) { - if (!memcmp(context->dest_chain, SQUID_SUPPORTED_CHAINS[i], PARAMETER_LENGTH)) { + if (!memcmp(context->dest_chain, SQUID_SUPPORTED_CHAINS[i].chain_id, MAX_CHAIN_ID_LEN)) { return 1; } } diff --git a/tests/snapshots/bsc_nanos_callBridge_normal_flow/00004.png b/tests/snapshots/bsc_nanos_callBridge_normal_flow/00004.png index 59dfcd0..093180d 100644 Binary files a/tests/snapshots/bsc_nanos_callBridge_normal_flow/00004.png and b/tests/snapshots/bsc_nanos_callBridge_normal_flow/00004.png differ diff --git a/tests/snapshots/bsc_nanosp_callBridge_normal_flow/00004.png b/tests/snapshots/bsc_nanosp_callBridge_normal_flow/00004.png index fc9f315..518fc0e 100644 Binary files a/tests/snapshots/bsc_nanosp_callBridge_normal_flow/00004.png and b/tests/snapshots/bsc_nanosp_callBridge_normal_flow/00004.png differ diff --git a/tests/snapshots/bsc_nanox_callBridge_normal_flow/00004.png b/tests/snapshots/bsc_nanox_callBridge_normal_flow/00004.png index fc9f315..518fc0e 100644 Binary files a/tests/snapshots/bsc_nanox_callBridge_normal_flow/00004.png and b/tests/snapshots/bsc_nanox_callBridge_normal_flow/00004.png differ