Skip to content

Commit 67e3c4e

Browse files
committed
add global evm address config file
1 parent b8c4c0e commit 67e3c4e

1 file changed

Lines changed: 41 additions & 0 deletions

File tree

frontend/src/config.rs

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
use enum_table::{EnumTable, Enumable};
2+
3+
#[derive(Enumable, Copy, Clone)]
4+
#[repr(u8)]
5+
pub enum ConfigEntry{
6+
Native,
7+
WrappedNativeAddress,
8+
CAssetDTokenWrapRouter,
9+
CAssetDTokenWrapFactory,
10+
VanillaV2Router,
11+
VanillaV3Router,
12+
}
13+
14+
static MAINNET: EnumTable<ConfigEntry, &'static str, { ConfigEntry::COUNT }> =
15+
enum_table::et!(ConfigEntry, &'static str, |t| match t {
16+
ConfigEntry::Native => "DFI",
17+
ConfigEntry::WrappedNativeAddress => "0x49febbF9626B2D39aBa11C01d83Ef59b3D56d2A4",
18+
ConfigEntry::CAssetDTokenWrapRouter => "",
19+
ConfigEntry::CAssetDTokenWrapFactory => "",
20+
ConfigEntry::VanillaV2Router => "0x3E8C92491fc73390166BA00725B8F5BD734B8fba",
21+
ConfigEntry::VanillaV3Router => "0x2A9c4EdE9994911359af815367187947eD1dDf02",
22+
});
23+
24+
static TESTNET: EnumTable<ConfigEntry, &'static str, { ConfigEntry::COUNT }> =
25+
enum_table::et!(ConfigEntry, &'static str, |t| match t {
26+
ConfigEntry::Native => "DFI",
27+
ConfigEntry::WrappedNativeAddress => "0x62AF40e6d8714eF9210AeF7e94A151c27673d7A9",
28+
ConfigEntry::CAssetDTokenWrapRouter => "0x7081cbaDb76F0df8eeB9889EFC821aFE6a451622",
29+
ConfigEntry::CAssetDTokenWrapFactory => "0xE521e9e0d066e7ba3702833E7B535Be6DE2fa41b",
30+
ConfigEntry::VanillaV2Router => "0x79208eADd9FbC29116108433a38Af62D0fD83850",
31+
ConfigEntry::VanillaV3Router => "",
32+
});
33+
34+
pub fn get_config_entry(chain_id: u32, config_entry: &ConfigEntry) -> &'static str {
35+
if chain_id == 1130{
36+
return MAINNET.get(config_entry);
37+
}else if chain_id == 1131{
38+
return TESTNET.get(config_entry);
39+
}
40+
""
41+
}

0 commit comments

Comments
 (0)