diff --git a/data/addresses.mainnet.json b/data/addresses.mainnet.json index 6a9f420d..db4aedd5 100644 --- a/data/addresses.mainnet.json +++ b/data/addresses.mainnet.json @@ -31,14 +31,14 @@ "address": "0x91d18e54DAf4F677cB28167158d6dd21F6aB3921", "category": "omnichain", "chain_id": 7000, - "chain_name": "zeta_testnet", + "chain_name": "zeta_mainnet", "type": "systemContract" }, { "address": "0x239e96c8f17C85c30100AC26F635Ea15f23E9c67", "category": "messaging", "chain_id": 7000, - "chain_name": "zeta_testnet", + "chain_name": "zeta_mainnet", "type": "connector" }, { @@ -46,118 +46,118 @@ "asset": "0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d", "category": "omnichain", "chain_id": 7000, - "chain_name": "zeta_testnet", - "coin_type": "erc20", - "decimals": 18, - "description": "ZetaChain ZRC20 USDC on BSC", "foreign_chain_id": "56", + "chain_name": "zeta_mainnet", + "type": "zrc20", "symbol": "USDC.BSC", - "type": "zrc20" + "coin_type": "erc20", + "decimals": 18, + "description": "ZetaChain ZRC20 USDC on BSC" }, { "address": "0x0cbe0dF132a6c6B4a2974Fa1b7Fb953CF0Cc798a", "asset": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", "category": "omnichain", "chain_id": 7000, - "chain_name": "zeta_testnet", - "coin_type": "erc20", - "decimals": 18, - "description": "ZetaChain ZRC20 USDC on ETH", "foreign_chain_id": "1", + "chain_name": "zeta_mainnet", + "type": "zrc20", "symbol": "USDC.ETH", - "type": "zrc20" + "coin_type": "erc20", + "decimals": 18, + "description": "ZetaChain ZRC20 USDC on ETH" }, { "address": "0x13A0c5930C028511Dc02665E7285134B6d11A5f4", "asset": "", "category": "omnichain", "chain_id": 7000, - "chain_name": "zeta_testnet", - "coin_type": "gas", - "decimals": 18, - "description": "ZetaChain ZRC20 BTC-btc_mainnet", "foreign_chain_id": "8332", + "chain_name": "zeta_mainnet", + "type": "zrc20", "symbol": "BTC.BTC", - "type": "zrc20" + "coin_type": "gas", + "decimals": 18, + "description": "ZetaChain ZRC20 BTC-btc_mainnet" }, { "address": "0x48f80608B672DC30DC7e3dbBd0343c5F02C738Eb", "asset": "", "category": "omnichain", "chain_id": 7000, - "chain_name": "zeta_testnet", - "coin_type": "gas", - "decimals": 18, - "description": "ZetaChain ZRC20 BNB-bsc_mainnet", "foreign_chain_id": "56", + "chain_name": "zeta_mainnet", + "type": "zrc20", "symbol": "BNB.BSC", - "type": "zrc20" + "coin_type": "gas", + "decimals": 18, + "description": "ZetaChain ZRC20 BNB-bsc_mainnet" }, { "address": "0x7c8dDa80bbBE1254a7aACf3219EBe1481c6E01d7", "asset": "0xdac17f958d2ee523a2206206994597c13d831ec7", "category": "omnichain", "chain_id": 7000, - "chain_name": "zeta_testnet", - "coin_type": "erc20", - "decimals": 18, - "description": "ZetaChain ZRC20 USDT on ETH", "foreign_chain_id": "1", + "chain_name": "zeta_mainnet", + "type": "zrc20", "symbol": "USDT.ETH", - "type": "zrc20" + "coin_type": "erc20", + "decimals": 18, + "description": "ZetaChain ZRC20 USDT on ETH" }, { "address": "0x91d4F0D54090Df2D81e834c3c8CE71C6c865e79F", "asset": "0x55d398326f99059ff775485246999027b3197955", "category": "omnichain", "chain_id": 7000, - "chain_name": "zeta_testnet", - "coin_type": "erc20", - "decimals": 18, - "description": "ZetaChain ZRC20 USDT on BSC", "foreign_chain_id": "56", + "chain_name": "zeta_mainnet", + "type": "zrc20", "symbol": "USDT.BSC", - "type": "zrc20" + "coin_type": "erc20", + "decimals": 18, + "description": "ZetaChain ZRC20 USDT on BSC" }, { "address": "0xd97B1de3619ed2c6BEb3860147E30cA8A7dC9891", "asset": "", "category": "omnichain", "chain_id": 7000, - "chain_name": "zeta_testnet", - "coin_type": "gas", - "decimals": 18, - "description": "ZetaChain ZRC20 ETH-eth_mainnet", "foreign_chain_id": "1", + "chain_name": "zeta_mainnet", + "type": "zrc20", "symbol": "ETH.ETH", - "type": "zrc20" + "coin_type": "gas", + "decimals": 18, + "description": "ZetaChain ZRC20 ETH-eth_mainnet" }, { - "address": "0x9fd96203f7b22bCF72d9DCb40ff98302376cE09c", "category": "omnichain", "chain_id": 7000, - "chain_name": "zeta_testnet", + "chain_name": "zeta_mainnet", + "address": "0x9fd96203f7b22bCF72d9DCb40ff98302376cE09c", "type": "uniswapv2Factory" }, { - "address": "0x5F0b1a82749cb4E2278EC87F8BF6B618dC71a8bf", "category": "omnichain", "chain_id": 7000, - "chain_name": "zeta_testnet", + "chain_name": "zeta_mainnet", + "address": "0x5F0b1a82749cb4E2278EC87F8BF6B618dC71a8bf", "type": "wZetaContract" }, { - "address": "0x2ca7d64A7EFE2D62A725E2B35Cf7230D6677FfEe", "category": "omnichain", "chain_id": 7000, - "chain_name": "zeta_testnet", + "chain_name": "zeta_mainnet", + "address": "0x2ca7d64A7EFE2D62A725E2B35Cf7230D6677FfEe", "type": "uniswapv2Router02" }, { - "address": "0x735b14BB79463307AAcBED86DAf3322B1e6226aB", "category": "omnichain", "chain_id": 7000, - "chain_name": "zeta_testnet", + "chain_name": "zeta_mainnet", + "address": "0x735b14BB79463307AAcBED86DAf3322B1e6226aB", "type": "fungibleModule" }, { @@ -217,17 +217,17 @@ "type": "tssUpdater" }, { - "address": "0xaeB6dDB7708467814D557e340283248be8E43124", + "address": "0xaf28a257D292e7f0E531073f70a175b57E0261a8", "category": "messaging", - "chain_id": "1", - "chain_name": "eth_mainnet", + "chain_id": "56", + "chain_name": "bsc_mainnet", "type": "pauser" }, { - "address": "0xaf28a257D292e7f0E531073f70a175b57E0261a8", + "address": "0xaeB6dDB7708467814D557e340283248be8E43124", "category": "messaging", - "chain_id": "56", - "chain_name": "bsc_mainnet", + "chain_id": "1", + "chain_name": "eth_mainnet", "type": "pauser" } -] +] \ No newline at end of file diff --git a/data/addresses.testnet.json b/data/addresses.testnet.json index 46887818..9446aa71 100644 --- a/data/addresses.testnet.json +++ b/data/addresses.testnet.json @@ -46,141 +46,120 @@ "asset": "0x07865c6e87b9f70255377e024ace6630c1eaa37f", "category": "omnichain", "chain_id": 7001, + "foreign_chain_id": "5", "chain_name": "zeta_testnet", + "type": "zrc20", + "symbol": "USDC", "coin_type": "erc20", "decimals": 18, - "description": "USDC-goerli_testnet", - "foreign_chain_id": "5", - "symbol": "USDC", - "type": "zrc20" + "description": "USDC-goerli_testnet" }, { "address": "0x13A0c5930C028511Dc02665E7285134B6d11A5f4", "asset": "", "category": "omnichain", "chain_id": 7001, + "foreign_chain_id": "5", "chain_name": "zeta_testnet", + "type": "zrc20", + "symbol": "gETH", "coin_type": "gas", "decimals": 18, - "description": "ETH-goerli_testnet", - "foreign_chain_id": "5", - "symbol": "gETH", - "type": "zrc20" + "description": "ETH-goerli_testnet" }, { "address": "0x48f80608B672DC30DC7e3dbBd0343c5F02C738Eb", "asset": "", "category": "omnichain", "chain_id": 7001, + "foreign_chain_id": "80001", "chain_name": "zeta_testnet", + "type": "zrc20", + "symbol": "tMATIC", "coin_type": "gas", "decimals": 18, - "description": "MATIC-mumbai_testnet", - "foreign_chain_id": "80001", - "symbol": "tMATIC", - "type": "zrc20" + "description": "MATIC-mumbai_testnet" }, { "address": "0x65a45c57636f9BcCeD4fe193A602008578BcA90b", "asset": "", "category": "omnichain", "chain_id": 7001, + "foreign_chain_id": "18332", "chain_name": "zeta_testnet", + "type": "zrc20", + "symbol": "tBTC", "coin_type": "gas", "decimals": 18, - "description": "BTC-btc_testnet-btc_testnet", - "foreign_chain_id": "18332", - "symbol": "tBTC", - "type": "zrc20" + "description": "BTC-btc_testnet-btc_testnet" }, { "address": "0x7c8dDa80bbBE1254a7aACf3219EBe1481c6E01d7", "asset": "0x64544969ed7EBf5f083679233325356EbE738930", "category": "omnichain", "chain_id": 7001, + "foreign_chain_id": "97", "chain_name": "zeta_testnet", + "type": "zrc20", + "symbol": "USDC", "coin_type": "erc20", "decimals": 18, - "description": "USDC-bsc_testnet", - "foreign_chain_id": "97", - "symbol": "USDC", - "type": "zrc20" + "description": "USDC-bsc_testnet" }, { "address": "0x91d4F0D54090Df2D81e834c3c8CE71C6c865e79F", "asset": "0x9999f7fea5938fd3b1e26a12c3f2fb024e194f97", "category": "omnichain", "chain_id": 7001, + "foreign_chain_id": "80001", "chain_name": "zeta_testnet", + "type": "zrc20", + "symbol": "USDC", "coin_type": "erc20", "decimals": 18, - "description": "USDC-mumbai_testnet", - "foreign_chain_id": "80001", - "symbol": "USDC", - "type": "zrc20" + "description": "USDC-mumbai_testnet" }, { "address": "0xd97B1de3619ed2c6BEb3860147E30cA8A7dC9891", "asset": "", "category": "omnichain", "chain_id": 7001, + "foreign_chain_id": "97", "chain_name": "zeta_testnet", + "type": "zrc20", + "symbol": "tBNB", "coin_type": "gas", "decimals": 18, - "description": "BNB-bsc_testnet", - "foreign_chain_id": "97", - "symbol": "tBNB", - "type": "zrc20" + "description": "BNB-bsc_testnet" }, { - "address": "0x9fd96203f7b22bCF72d9DCb40ff98302376cE09c", "category": "omnichain", "chain_id": 7001, "chain_name": "zeta_testnet", + "address": "0x9fd96203f7b22bCF72d9DCb40ff98302376cE09c", "type": "uniswapv2Factory" }, { - "address": "0x5F0b1a82749cb4E2278EC87F8BF6B618dC71a8bf", "category": "omnichain", "chain_id": 7001, "chain_name": "zeta_testnet", + "address": "0x5F0b1a82749cb4E2278EC87F8BF6B618dC71a8bf", "type": "wZetaContract" }, { - "address": "0x2ca7d64A7EFE2D62A725E2B35Cf7230D6677FfEe", "category": "omnichain", "chain_id": 7001, "chain_name": "zeta_testnet", + "address": "0x2ca7d64A7EFE2D62A725E2B35Cf7230D6677FfEe", "type": "uniswapv2Router02" }, { - "address": "0x735b14BB79463307AAcBED86DAf3322B1e6226aB", "category": "omnichain", "chain_id": 7001, "chain_name": "zeta_testnet", + "address": "0x735b14BB79463307AAcBED86DAf3322B1e6226aB", "type": "fungibleModule" }, - { - "address": "0x0000c304d2934c00db1d51995b9f6996affd17c0", - "category": "messaging", - "chain_id": "5", - "chain_name": "goerli_testnet", - "type": "zetaToken" - }, - { - "address": "0x00005e3125aba53c5652f9f0ce1a4cf91d8b15ea", - "category": "messaging", - "chain_id": "5", - "chain_name": "goerli_testnet", - "type": "connector" - }, - { - "address": "0x000047f11c6e42293f433c82473532e869ce4ec5", - "category": "omnichain", - "chain_id": "5", - "chain_name": "goerli_testnet", - "type": "erc20Custody" - }, { "address": "0x0000c9ec4042283e8139c74f4c64bcd1e0b9b54f", "category": "messaging", @@ -224,17 +203,31 @@ "type": "erc20Custody" }, { - "address": "0x55122f7590164Ac222504436943FAB17B62F5d7d", - "category": "omnichain", - "chain_id": "80001", - "chain_name": "mumbai_testnet", - "type": "tssUpdater" + "address": "0x0000c304d2934c00db1d51995b9f6996affd17c0", + "category": "messaging", + "chain_id": "5", + "chain_name": "goerli_testnet", + "type": "zetaToken" }, { - "address": "0x55122f7590164Ac222504436943FAB17B62F5d7d", + "address": "0x00005e3125aba53c5652f9f0ce1a4cf91d8b15ea", + "category": "messaging", + "chain_id": "5", + "chain_name": "goerli_testnet", + "type": "connector" + }, + { + "address": "0x000047f11c6e42293f433c82473532e869ce4ec5", "category": "omnichain", "chain_id": "5", "chain_name": "goerli_testnet", + "type": "erc20Custody" + }, + { + "address": "0x55122f7590164Ac222504436943FAB17B62F5d7d", + "category": "omnichain", + "chain_id": "80001", + "chain_name": "mumbai_testnet", "type": "tssUpdater" }, { @@ -246,10 +239,10 @@ }, { "address": "0x55122f7590164Ac222504436943FAB17B62F5d7d", - "category": "messaging", + "category": "omnichain", "chain_id": "5", "chain_name": "goerli_testnet", - "type": "pauser" + "type": "tssUpdater" }, { "address": "0x55122f7590164Ac222504436943FAB17B62F5d7d", @@ -258,6 +251,13 @@ "chain_name": "mumbai_testnet", "type": "pauser" }, + { + "address": "0x55122f7590164Ac222504436943FAB17B62F5d7d", + "category": "messaging", + "chain_id": "5", + "chain_name": "goerli_testnet", + "type": "pauser" + }, { "address": "0x55122f7590164Ac222504436943FAB17B62F5d7d", "category": "messaging", diff --git a/lib/addresses.ts b/lib/addresses.ts index 7aae67d0..0d2127cc 100644 --- a/lib/addresses.ts +++ b/lib/addresses.ts @@ -7,6 +7,9 @@ import { ParamChainName, ParamSymbol, ParamType } from "./types"; export const getAddress = (type: ParamType, network: ParamChainName, symbol?: ParamSymbol) => { const networks = [...testnet, ...mainnet]; let address; + if (type !== "zrc20" && symbol) { + throw new Error("Symbol is only supported when ParamType is zrc20"); + } if (type === "zrc20" && !symbol) { // for backwards compatibility const chainId = getChainId(network); @@ -15,7 +18,7 @@ export const getAddress = (type: ParamType, network: ParamChainName, symbol?: Pa }); } else { address = networks.find((n: any) => { - return n.chain_name === network && n.type === type; + return n.chain_name === network && n.type === type && n.symbol === symbol; }); } return address?.address; diff --git a/tasks/addresses.ts b/tasks/addresses.ts index a3fc4d54..a76d7e62 100644 --- a/tasks/addresses.ts +++ b/tasks/addresses.ts @@ -73,14 +73,14 @@ const fetchSystemContract = async (addresses: any, network: Network) => { address: systemContractResponse.data.SystemContract.system_contract, category: "omnichain", chain_id, - chain_name: "zeta_testnet", + chain_name: network, type: "systemContract", }); addresses.push({ address: systemContractResponse.data.SystemContract.connector_zevm, category: "messaging", chain_id, - chain_name: "zeta_testnet", + chain_name: network, type: "connector", }); } else { @@ -103,13 +103,13 @@ const fetchForeignCoinsData = async (chains: any, addresses: any, network: Netwo asset: token.asset, category: "omnichain", chain_id, - chain_name: "zeta_testnet", - coin_type: token.coin_type.toLowerCase(), - decimals: 18, - description: token.name, foreign_chain_id: token.foreign_chain_id, + chain_name: network, + type: "zrc20", symbol: token.symbol, - type: "zrc20", // TODO: dynamically fetch from contract + coin_type: token.coin_type.toLowerCase(), + decimals: 18, + description: token.name, // TODO: dynamically fetch from contract }); }); } else { @@ -123,14 +123,14 @@ const fetchForeignCoinsData = async (chains: any, addresses: any, network: Netwo const fetchAthensAddresses = async (addresses: any, hre: any, network: Network) => { const chain_id = network === "zeta_mainnet" ? 7000 : 7001; const systemContract = addresses.find((a: any) => { - return a.chain_name === "zeta_testnet" && a.type === "systemContract"; + return a.chain_name === network && a.type === "systemContract"; })?.address; const provider = new hre.ethers.providers.JsonRpcProvider(api[network].evm); const sc = SystemContract__factory.connect(systemContract, provider); const common = { category: "omnichain", chain_id, - chain_name: "zeta_testnet", + chain_name: network, }; try { addresses.push({ ...common, address: await sc.uniswapv2FactoryAddress(), type: "uniswapv2Factory" }); @@ -216,7 +216,7 @@ const fetchPauser = async (chains: any, addresses: any) => { return a.chain_name === chain.chain_name && a.type === "connector"; })?.address; if (erc20Custody) { - if (["18332", "8332", "7001"].includes(chain.chain_id)) return; + if (["18332", "8332", "7001", "7000"].includes(chain.chain_id)) return; const rpc = getEndpoints("evm", chain.chain_name)[0]?.url; const provider = new hre.ethers.providers.JsonRpcProvider(rpc); const connector = ZetaConnectorBase__factory.connect(erc20Custody, provider);