Skip to content

Commit

Permalink
ci: generate contract addresses (#380)
Browse files Browse the repository at this point in the history
  • Loading branch information
fadeev authored and lumtis committed Oct 21, 2024
1 parent 6af8595 commit 7ede964
Show file tree
Hide file tree
Showing 14 changed files with 4,041 additions and 688 deletions.
419 changes: 419 additions & 0 deletions v2/data/addresses.mainnet.json

Large diffs are not rendered by default.

326 changes: 326 additions & 0 deletions v2/data/addresses.testnet.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,326 @@
[
{
"address": "0x0000ecb8cdd25a18f12daa23f6422e07fbf8b9e1",
"category": "messaging",
"chain_id": 97,
"chain_name": "bsc_testnet",
"type": "connector"
},
{
"address": "0x0000a7db254145767262c6a81a7ee1650684258e",
"category": "omnichain",
"chain_id": 97,
"chain_name": "bsc_testnet",
"type": "erc20Custody"
},
{
"address": "0x8531a5aB847ff5B22D855633C25ED1DA3255247e",
"category": "omnichain",
"chain_id": 97,
"chain_name": "bsc_testnet",
"type": "tss"
},
{
"address": "0x0000c9ec4042283e8139c74f4c64bcd1e0b9b54f",
"category": "messaging",
"chain_id": 97,
"chain_name": "bsc_testnet",
"type": "zetaToken"
},
{
"address": "ZETAjseVjuFsxdRxo6MmTCvqFwb3ZHUx56Co3vCmGis",
"category": "omnichain",
"chain_id": 901,
"chain_name": "solana_devnet",
"type": "gateway"
},
{
"address": "0x239e96c8f17C85c30100AC26F635Ea15f23E9c67",
"category": "messaging",
"chain_id": 7001,
"chain_name": "zeta_testnet",
"type": "connector"
},
{
"category": "omnichain",
"chain_id": 7001,
"chain_name": "zeta_testnet",
"address": "0x735b14BB79463307AAcBED86DAf3322B1e6226aB",
"type": "fungibleModule"
},
{
"address": "0xEdf1c3275d13489aCdC6cD6eD246E72458B8795B",
"category": "omnichain",
"chain_id": 7001,
"chain_name": "zeta_testnet",
"type": "systemContract"
},
{
"category": "omnichain",
"chain_id": 7001,
"chain_name": "zeta_testnet",
"address": "0x9fd96203f7b22bCF72d9DCb40ff98302376cE09c",
"type": "uniswapV2Factory"
},
{
"category": "omnichain",
"chain_id": 7001,
"chain_name": "zeta_testnet",
"address": "0x2ca7d64A7EFE2D62A725E2B35Cf7230D6677FfEe",
"type": "uniswapV2Router02"
},
{
"category": "omnichain",
"chain_id": 7001,
"chain_name": "zeta_testnet",
"address": "0x5F0b1a82749cb4E2278EC87F8BF6B618dC71a8bf",
"type": "zetaToken"
},
{
"address": "0x05BA149A7bd6dC1F937fA9046A9e05C05f3b18b0",
"asset": "",
"category": "omnichain",
"chain_id": 7001,
"chain_name": "zeta_testnet",
"coin_type": "gas",
"decimals": 18,
"description": "ZetaChain ZRC20 sETH-sepolia_testnet",
"foreign_chain_id": "11155111",
"symbol": "sETH.SEPOLIA",
"type": "zrc20"
},
{
"address": "0x0cbe0dF132a6c6B4a2974Fa1b7Fb953CF0Cc798a",
"asset": "0x07865c6e87b9f70255377e024ace6630c1eaa37f",
"category": "omnichain",
"chain_id": 7001,
"chain_name": "zeta_testnet",
"coin_type": "erc20",
"decimals": 6,
"description": "USDC-goerli_testnet",
"foreign_chain_id": "5",
"symbol": "USDC",
"type": "zrc20"
},
{
"address": "0x13A0c5930C028511Dc02665E7285134B6d11A5f4",
"asset": "",
"category": "omnichain",
"chain_id": 7001,
"chain_name": "zeta_testnet",
"coin_type": "gas",
"decimals": 18,
"description": "ETH-goerli_testnet",
"foreign_chain_id": "5",
"symbol": "gETH",
"type": "zrc20"
},
{
"address": "0x236b0DE675cC8F46AE186897fCCeFe3370C9eDeD",
"asset": "",
"category": "omnichain",
"chain_id": 7001,
"chain_name": "zeta_testnet",
"coin_type": "gas",
"decimals": 18,
"description": "ZetaChain ZRC20 Base Sepolia ETH-base_sepolia",
"foreign_chain_id": "84532",
"symbol": "ETH.BASESEPOLIA",
"type": "zrc20"
},
{
"address": "0x48f80608B672DC30DC7e3dbBd0343c5F02C738Eb",
"asset": "",
"category": "omnichain",
"chain_id": 7001,
"chain_name": "zeta_testnet",
"coin_type": "gas",
"decimals": 18,
"description": "MATIC-mumbai_testnet",
"foreign_chain_id": "80001",
"symbol": "tMATIC",
"type": "zrc20"
},
{
"address": "0x65a45c57636f9BcCeD4fe193A602008578BcA90b",
"asset": "",
"category": "omnichain",
"chain_id": 7001,
"chain_name": "zeta_testnet",
"coin_type": "gas",
"decimals": 8,
"description": "BTC-btc_testnet-btc_testnet",
"foreign_chain_id": "18332",
"symbol": "tBTC",
"type": "zrc20"
},
{
"address": "0x777915D031d1e8144c90D025C594b3b8Bf07a08d",
"asset": "",
"category": "omnichain",
"chain_id": 7001,
"chain_name": "zeta_testnet",
"coin_type": "gas",
"decimals": 18,
"description": "ZetaChain ZRC20 Amoy MATIC-amoy_testnet",
"foreign_chain_id": "80002",
"symbol": "MATIC.AMOY",
"type": "zrc20"
},
{
"address": "0x7c8dDa80bbBE1254a7aACf3219EBe1481c6E01d7",
"asset": "0x64544969ed7EBf5f083679233325356EbE738930",
"category": "omnichain",
"chain_id": 7001,
"chain_name": "zeta_testnet",
"coin_type": "erc20",
"decimals": 6,
"description": "USDC-bsc_testnet",
"foreign_chain_id": "97",
"symbol": "USDC",
"type": "zrc20"
},
{
"address": "0x91d4F0D54090Df2D81e834c3c8CE71C6c865e79F",
"asset": "0x9999f7fea5938fd3b1e26a12c3f2fb024e194f97",
"category": "omnichain",
"chain_id": 7001,
"chain_name": "zeta_testnet",
"coin_type": "erc20",
"decimals": 6,
"description": "USDC-mumbai_testnet",
"foreign_chain_id": "80001",
"symbol": "USDC",
"type": "zrc20"
},
{
"address": "0xADF73ebA3Ebaa7254E859549A44c74eF7cff7501",
"asset": "",
"category": "omnichain",
"chain_id": 7001,
"chain_name": "zeta_testnet",
"coin_type": "gas",
"decimals": 9,
"description": "ZetaChain ZRC20 SOL on Solana Devnet",
"foreign_chain_id": "901",
"symbol": "SOL.SOLANA",
"type": "zrc20"
},
{
"address": "0xcC683A782f4B30c138787CB5576a86AF66fdc31d",
"asset": "0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238",
"category": "omnichain",
"chain_id": 7001,
"chain_name": "zeta_testnet",
"coin_type": "erc20",
"decimals": 6,
"description": "ZetaChain ZRC20 USDC on SEPOLIA",
"foreign_chain_id": "11155111",
"symbol": "USDC.SEPOLIA",
"type": "zrc20"
},
{
"address": "0xd97B1de3619ed2c6BEb3860147E30cA8A7dC9891",
"asset": "",
"category": "omnichain",
"chain_id": 7001,
"chain_name": "zeta_testnet",
"coin_type": "gas",
"decimals": 18,
"description": "BNB-bsc_testnet",
"foreign_chain_id": "97",
"symbol": "tBNB",
"type": "zrc20"
},
{
"address": "tb1qy9pqmk2pd9sv63g27jt8r657wy0d9ueeh0nqur",
"category": "omnichain",
"chain_id": 18332,
"chain_name": "btc_testnet",
"type": "tss"
},
{
"address": "0x60E6b70bC2761f878Ff992276612F67FbABC1761",
"category": "messaging",
"chain_id": 80002,
"chain_name": "amoy_testnet",
"type": "connector"
},
{
"address": "0xFDE448af6140a8702A1165c44A0895ebE24b0C02",
"category": "omnichain",
"chain_id": 80002,
"chain_name": "amoy_testnet",
"type": "erc20Custody"
},
{
"address": "0x8531a5aB847ff5B22D855633C25ED1DA3255247e",
"category": "omnichain",
"chain_id": 80002,
"chain_name": "amoy_testnet",
"type": "tss"
},
{
"address": "0x1432612E60cad487C857E7D38AFf57134916c902",
"category": "messaging",
"chain_id": 80002,
"chain_name": "amoy_testnet",
"type": "zetaToken"
},
{
"address": "0xc0B74d761ef4EC9e9473f65687d36B9F13DB0dCc",
"category": "messaging",
"chain_id": 84532,
"chain_name": "base_sepolia",
"type": "connector"
},
{
"address": "0x3A1f7b35EF57543B4e86c384eF6a368Ed811a36E",
"category": "omnichain",
"chain_id": 84532,
"chain_name": "base_sepolia",
"type": "erc20Custody"
},
{
"address": "0x8531a5aB847ff5B22D855633C25ED1DA3255247e",
"category": "omnichain",
"chain_id": 84532,
"chain_name": "base_sepolia",
"type": "tss"
},
{
"address": "0xf4e63991E7475b659bd97Bba85f32a7259239D5d",
"category": "messaging",
"chain_id": 84532,
"chain_name": "base_sepolia",
"type": "zetaToken"
},
{
"address": "0x3963341dad121c9CD33046089395D66eBF20Fb03",
"category": "messaging",
"chain_id": 11155111,
"chain_name": "sepolia_testnet",
"type": "connector"
},
{
"address": "0x84725b70a239d3Faa7C6EF0C6C8E8b6c8e28338b",
"category": "omnichain",
"chain_id": 11155111,
"chain_name": "sepolia_testnet",
"type": "erc20Custody"
},
{
"address": "0x8531a5aB847ff5B22D855633C25ED1DA3255247e",
"category": "omnichain",
"chain_id": 11155111,
"chain_name": "sepolia_testnet",
"type": "tss"
},
{
"address": "0x0000c304D2934c00Db1d51995b9f6996AffD17c0",
"category": "messaging",
"chain_id": 11155111,
"chain_name": "sepolia_testnet",
"type": "zetaToken"
}
]
13 changes: 13 additions & 0 deletions v2/hardhat.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import "@nomicfoundation/hardhat-toolbox";
import "./tasks/addresses";
import { getHardhatConfigNetworks } from "@zetachain/networks";
import { HardhatUserConfig } from "hardhat/config";

const config: HardhatUserConfig = {
networks: {
...getHardhatConfigNetworks(),
},
solidity: "0.8.26",
};

export default config;
25 changes: 25 additions & 0 deletions v2/lib/addresses.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { getChainId } from "@zetachain/networks";

import mainnet from "../data/addresses.mainnet.json";
import testnet from "../data/addresses.testnet.json";
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);
address = networks.find((n: any) => {
return n.foreign_chain_id === chainId?.toString() && n.type === type && n.coin_type === "gas";
});
} else {
address = networks.find((n: any) => {
return n.chain_name === network && n.type === type && n.symbol === symbol;
});
}
return address?.address;
};
4 changes: 4 additions & 0 deletions v2/lib/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export { default as mainnet } from "../data/addresses.mainnet.json";
export { default as testnet } from "../data/addresses.testnet.json";
export * from "./addresses";
export * from "./types";
4 changes: 4 additions & 0 deletions v2/lib/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export type ParamSymbol = "USDC.BSC" | "USDC.ETH" | "BTC.BTC" | "ETH.BASE" | "PEPE.ETH" | "BNB.BSC" | "SHIB.ETH" | "USDT.ETH" | "USDT.BSC" | "USDC.BASE" | "POL.POLYGON" | "DAI.ETH" | "ULTI.BSC" | "ETH.ETH" | "USDT.POL" | "ULTI.ETH" | "USDC.POL" | "sETH.SEPOLIA" | "USDC" | "gETH" | "ETH.BASESEPOLIA" | "tMATIC" | "tBTC" | "MATIC.AMOY" | "SOL.SOLANA" | "USDC.SEPOLIA" | "tBNB";
export type ParamChainName = "eth_mainnet" | "bsc_mainnet" | "polygon_mainnet" | "zeta_mainnet" | "btc_mainnet" | "base_mainnet" | "bsc_testnet" | "solana_devnet" | "zeta_testnet" | "btc_testnet" | "amoy_testnet" | "base_sepolia" | "sepolia_testnet";
export type ParamType = "connector" | "erc20Custody" | "tss" | "uniswapV2Factory" | "uniswapV2Router02" | "uniswapV3Factory" | "uniswapV3Router" | "weth9" | "zetaToken" | "fungibleModule" | "systemContract" | "zrc20" | "gateway";

Loading

0 comments on commit 7ede964

Please sign in to comment.