Skip to content

Commit

Permalink
Merge branch 'main' into init-prototypes
Browse files Browse the repository at this point in the history
  • Loading branch information
skosito committed Jul 3, 2024
2 parents efd62ce + 925af7b commit 0ff9029
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 15 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Build

on:
push:
branches:
- main
pull_request:
branches:
- "*"
types:
- synchronize
- opened
- reopened
- ready_for_review

jobs:
lint:
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v3

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "16"
registry-url: "https://registry.npmjs.org"

- name: Install Dependencies
run: yarn install

- name: Build
run: yarn build
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,15 @@
"@typechain/hardhat": "^6.1.2",
"@types/chai": "^4.3.1",
"@types/inquirer": "^8.2.1",
"@types/lodash": "^4.17.6",
"@types/mocha": "^10.0.1",
"@types/node": "^17.0.25",
"@typescript-eslint/eslint-plugin": "^5.20.0",
"@typescript-eslint/parser": "^5.20.0",
"@uniswap/v2-core": "^1.0.1",
"@uniswap/v2-periphery": "^1.1.0-beta.0",
"@uniswap/v3-periphery": "^1.4.3",
"@zetachain/networks": "8.0.0",
"@zetachain/networks": "^8.0.0",
"axios": "^1.6.5",
"chai": "^4.3.6",
"cpx": "^1.5.0",
Expand Down
27 changes: 14 additions & 13 deletions tasks/addresses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import uniswapV2Router from "@uniswap/v2-periphery/build/IUniswapV2Router02.json
import SwapRouter from "@uniswap/v3-periphery/artifacts/contracts/SwapRouter.sol/SwapRouter.json";
import { getEndpoints } from "@zetachain/networks";
import axios, { AxiosResponse } from "axios";
import { ethers } from "ethers";
import { task } from "hardhat/config";
import { HardhatRuntimeEnvironment } from "hardhat/types";
import { isEqual } from "lodash";
Expand Down Expand Up @@ -134,12 +135,12 @@ const fetchForeignCoinsData = async (chains: any, addresses: any, network: Netwo
}
};

const fetchAthensAddresses = async (addresses: any, hre: any, network: Network) => {
const fetchAthensAddresses = async (addresses: any, network: Network) => {
const chain_id = network === "zeta_mainnet" ? 7000 : 7001;
const systemContract = addresses.find((a: any) => {
return a.chain_name === network && a.type === "systemContract";
})?.address;
const provider = new hre.ethers.providers.JsonRpcProvider(api[network].evm);
const provider = new ethers.providers.JsonRpcProvider(api[network].evm);
const sc = SystemContract__factory.connect(systemContract, provider);
const common = {
category: "omnichain",
Expand Down Expand Up @@ -207,7 +208,7 @@ const fetchTSSUpdater = async (chains: any, addresses: any) => {
if (erc20Custody) {
if (["18332", "8332"].includes(chain.chain_id)) return;
const rpc = getEndpoints("evm", chain.chain_name)[0]?.url;
const provider = new hre.ethers.providers.JsonRpcProvider(rpc);
const provider = new ethers.providers.JsonRpcProvider(rpc);
const custody = ERC20Custody__factory.connect(erc20Custody, provider);
return custody.TSSAddressUpdater().then((address: string) => {
addresses.push({
Expand All @@ -232,7 +233,7 @@ const fetchPauser = async (chains: any, addresses: any) => {
if (erc20Custody) {
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 provider = new ethers.providers.JsonRpcProvider(rpc);
const connector = ZetaConnectorBase__factory.connect(erc20Custody, provider);
return connector.pauserAddress().then((address: string) => {
addresses.push({
Expand All @@ -248,13 +249,13 @@ const fetchPauser = async (chains: any, addresses: any) => {
);
};

const fetchFactoryV2 = async (addresses: any, hre: HardhatRuntimeEnvironment, network: Network) => {
const fetchFactoryV2 = async (addresses: any, network: Network) => {
const routers = addresses.filter((a: any) => a.type === "uniswapV2Router02");

for (const router of routers) {
const rpc = getEndpoints("evm", router.chain_name)[0]?.url;
const provider = new hre.ethers.providers.JsonRpcProvider(rpc);
const routerContract = new hre.ethers.Contract(router.address, uniswapV2Router.abi, provider);
const provider = new ethers.providers.JsonRpcProvider(rpc);
const routerContract = new ethers.Contract(router.address, uniswapV2Router.abi, provider);

try {
const wethAddress = await routerContract.WETH();
Expand Down Expand Up @@ -284,13 +285,13 @@ const fetchFactoryV2 = async (addresses: any, hre: HardhatRuntimeEnvironment, ne
}
};

const fetchFactoryV3 = async (addresses: any, hre: HardhatRuntimeEnvironment, network: Network) => {
const fetchFactoryV3 = async (addresses: any, network: Network) => {
const routers = addresses.filter((a: any) => a.type === "uniswapV3Router");

for (const router of routers) {
const rpc = getEndpoints("evm", router.chain_name)[0]?.url;
const provider = new hre.ethers.providers.JsonRpcProvider(rpc);
const routerContract = new hre.ethers.Contract(router.address, SwapRouter.abi, provider);
const provider = new ethers.providers.JsonRpcProvider(rpc);
const routerContract = new ethers.Contract(router.address, SwapRouter.abi, provider);

try {
const wethAddress = await routerContract.WETH9();
Expand Down Expand Up @@ -339,12 +340,12 @@ const main = async (args: any, hre: HardhatRuntimeEnvironment) => {
await fetchTssData(chains, addresses, network);
await fetchSystemContract(addresses, network);
await fetchForeignCoinsData(chains, addresses, network);
await fetchAthensAddresses(addresses, hre, network);
await fetchAthensAddresses(addresses, network);
await fetchChainSpecificAddresses(chains, addresses, network);
await fetchTSSUpdater(chains, addresses);
await fetchPauser(chains, addresses);
await fetchFactoryV2(addresses, hre, network);
await fetchFactoryV3(addresses, hre, network);
await fetchFactoryV2(addresses, network);
await fetchFactoryV3(addresses, network);

addresses = addresses.sort((a: AddressDetails, b: AddressDetails) => {
if (a.chain_id !== b.chain_id) {
Expand Down
7 changes: 6 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2008,6 +2008,11 @@
"@types/level-errors" "*"
"@types/node" "*"

"@types/lodash@^4.17.6":
version "4.17.6"
resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.17.6.tgz#193ced6a40c8006cfc1ca3f4553444fb38f0e543"
integrity sha512-OpXEVoCKSS3lQqjx9GGGOapBeuW5eUboYHRlHP9urXPX25IKZ6AnP5ZRxtVf63iieUbsHxLn8NQ5Nlftc6yzAA==

"@types/[email protected]", "@types/lru-cache@^5.1.0":
version "5.1.1"
resolved "https://registry.npmjs.org/@types/lru-cache/-/lru-cache-5.1.1.tgz"
Expand Down Expand Up @@ -2262,7 +2267,7 @@
"@uniswap/v3-core" "1.0.0"
base64-sol "1.0.1"

"@zetachain/[email protected]":
"@zetachain/networks@^8.0.0":
version "8.0.0"
resolved "https://registry.yarnpkg.com/@zetachain/networks/-/networks-8.0.0.tgz#3e838bb6b14e4a8d381f95b4cbc2f1172e851e4e"
integrity sha512-I0HhH5qOGW0Jkjq5o5Mi6qGls6ycHnhWjc+r+Ud8u8YW+HU4lEUn4gvulxj+ccHKj3nV/0gEsmNrWRY9ct49nQ==
Expand Down

0 comments on commit 0ff9029

Please sign in to comment.