Skip to content

Commit

Permalink
remove zetacore from url
Browse files Browse the repository at this point in the history
  • Loading branch information
fadeev committed Jan 10, 2024
1 parent 6cfc35d commit 32e4912
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 49 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"@uniswap/v2-periphery": "^1.1.0-beta.0",
"@uniswap/v3-periphery": "^1.4.3",
"@zetachain/networks": "^2.4.3",
"axios": "^1.6.5",
"chai": "^4.3.6",
"cpx": "^1.5.0",
"del-cli": "^5.0.0",
Expand Down Expand Up @@ -79,4 +80,4 @@
},
"types": "./dist/lib/index.d.ts",
"version": "0.0.8"
}
}
65 changes: 17 additions & 48 deletions tasks/addresses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ import {
import { ZetaConnector__factory } from "dist/typechain-types";
import { zetaConnectorNonEthSol } from "typechain-types/factories/contracts/evm";

const ATHENS_EVM_RPC =
"https://zetachain-athens-evm.blockpi.network/v1/rpc/public";
const ATHENS_EVM_RPC = "https://zetachain-athens-evm.blockpi.network/v1/rpc/public";
const ATHENS_TENDERMINT_RPC = "http://46.4.15.110:1317";

const fetchChains = async (chainObject: any) => {
Expand All @@ -28,19 +27,15 @@ const fetchChains = async (chainObject: any) => {
};
});
} else {
console.error(
"Error fetching chains:",
response.status,
response.statusText
);
console.error("Error fetching chains:", response.status, response.statusText);
}
} catch (error) {
console.error("Error fetching chains:", error);
}
};

const fetchTssData = async (chainObject: any) => {
const URL = `${ATHENS_TENDERMINT_RPC}/zeta-chain/zetacore/crosschain/get_tss_address`;
const URL = `${ATHENS_TENDERMINT_RPC}/zeta-chain/crosschain/get_tss_address`;
try {
const tssResponse: AxiosResponse<any> = await axios.get(URL);

Expand All @@ -51,43 +46,34 @@ const fetchTssData = async (chainObject: any) => {
chainObject[chain]["tss"] = chain.includes("btc") ? btc : eth;
}
} else {
console.error(
"Error fetching TSS data:",
tssResponse.status,
tssResponse.statusText
);
console.error("Error fetching TSS data:", tssResponse.status, tssResponse.statusText);
}
} catch (error) {
console.error("Error fetching TSS data:", error);
}
};

const fetchSystemContract = async (chainObject: any) => {
const URL = `${ATHENS_TENDERMINT_RPC}/zeta-chain/zetacore/fungible/system_contract`;
const URL = `${ATHENS_TENDERMINT_RPC}/zeta-chain/fungible/system_contract`;
try {
const systemContractResponse: AxiosResponse<any> = await axios.get(URL);

if (systemContractResponse.status === 200) {
if (!chainObject["zeta_testnet"]) {
chainObject["zeta_testnet"] = {};
}
chainObject["zeta_testnet"]["systemContract"] =
systemContractResponse.data.SystemContract.system_contract;
chainObject["zeta_testnet"]["connectorZEVM"] =
systemContractResponse.data.SystemContract.connector_zevm;
chainObject["zeta_testnet"]["systemContract"] = systemContractResponse.data.SystemContract.system_contract;
chainObject["zeta_testnet"]["connectorZEVM"] = systemContractResponse.data.SystemContract.connector_zevm;
} else {
console.error(
"Error fetching system contract:",
systemContractResponse.statusText
);
console.error("Error fetching system contract:", systemContractResponse.statusText);
}
} catch (error) {
console.error("Error fetching system contract:", error);
}
};

const fetchForeignCoinsData = async (chainObject: any) => {
const URL = `${ATHENS_TENDERMINT_RPC}/zeta-chain/zetacore/fungible/foreign_coins`;
const URL = `${ATHENS_TENDERMINT_RPC}/zeta-chain/fungible/foreign_coins`;
try {
const foreignCoinsResponse: AxiosResponse<any> = await axios.get(URL);
if (foreignCoinsResponse.status === 200) {
Expand All @@ -102,21 +88,14 @@ const fetchForeignCoinsData = async (chainObject: any) => {
}
});
} else {
console.error(
"Error fetching foreign coins data:",
foreignCoinsResponse.status,
foreignCoinsResponse.statusText
);
console.error("Error fetching foreign coins data:", foreignCoinsResponse.status, foreignCoinsResponse.statusText);
}
} catch (error) {
console.error("Error fetching foreign coins data:", error);
}
};

const fetchAthensAddresses = async (
chainObject: any,
hre: HardhatRuntimeEnvironment
) => {
const fetchAthensAddresses = async (chainObject: any, hre: HardhatRuntimeEnvironment) => {
const zeta = "zeta_testnet";
if (chainObject[zeta] && chainObject[zeta]["systemContract"]) {
const athens = chainObject[zeta];
Expand All @@ -138,36 +117,26 @@ const fetchAthensAddresses = async (
};

const fetchChainSpecificAddresses = async (chainObject: any) => {
const URL = `${ATHENS_TENDERMINT_RPC}/zeta-chain/zetacore/observer/get_client_params_for_chain`;
const URL = `${ATHENS_TENDERMINT_RPC}/zeta-chain/observer/get_client_params_for_chain`;
try {
for (const chain in chainObject) {
if (chain.includes("zeta") || chain.includes("btc")) continue;
const id = chainObject[chain].chainId;
const response: AxiosResponse<any> = await axios.get(`${URL}/${id}`);
if (response.status === 200) {
chainObject[chain]["zetaTokenContractAddress"] =
response.data.core_params.zeta_token_contract_address;
chainObject[chain]["connectorContractAddress"] =
response.data.core_params.connector_contract_address;
chainObject[chain]["erc20CustodyContractAddress"] =
response.data.core_params.erc20_custody_contract_address;
chainObject[chain]["zetaTokenContractAddress"] = response.data.core_params.zeta_token_contract_address;
chainObject[chain]["connectorContractAddress"] = response.data.core_params.connector_contract_address;
chainObject[chain]["erc20CustodyContractAddress"] = response.data.core_params.erc20_custody_contract_address;
} else {
console.error(
"Error fetching chain data:",
response.status,
response.statusText
);
console.error("Error fetching chain data:", response.status, response.statusText);
}
}
} catch (error) {
console.error("Error fetching chain data:", error);
}
};

const fetchPauserUpdater = async (
chainObject: any,
hre: HardhatRuntimeEnvironment
) => {
const fetchPauserUpdater = async (chainObject: any, hre: HardhatRuntimeEnvironment) => {
try {
for (const chain in chainObject) {
const provider = new hre.ethers.providers.JsonRpcProvider(ATHENS_EVM_RPC);
Expand Down
28 changes: 28 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2497,6 +2497,15 @@ aws4@^1.8.0:
resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.12.0.tgz#ce1c9d143389679e253b314241ea9aa5cec980d3"
integrity sha512-NmWvPnx0F1SfrQbYwOi7OeaNGokp9XhzNioJ/CSBs8Qa4vxug81mhJEAVZwxXuBmYB5KDRfMq/F3RR0BIU7sWg==

axios@^1.6.5:
version "1.6.5"
resolved "https://registry.yarnpkg.com/axios/-/axios-1.6.5.tgz#2c090da14aeeab3770ad30c3a1461bc970fb0cd8"
integrity sha512-Ii012v05KEVuUoFWmMW/UQv9aRIc3ZwkWDcM+h5Il8izZCtRVpDUfwpoFf7eOtajT3QiGR4yDUx7lPqHJULgbg==
dependencies:
follow-redirects "^1.15.4"
form-data "^4.0.0"
proxy-from-env "^1.1.0"

babel-runtime@^6.9.2:
version "6.26.0"
resolved "https://registry.yarnpkg.com/babel-runtime/-/babel-runtime-6.26.0.tgz#965c7058668e82b55d7bfe04ff2337bc8b5647fe"
Expand Down Expand Up @@ -4496,6 +4505,11 @@ follow-redirects@^1.12.1:
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.2.tgz#b460864144ba63f2681096f274c4e57026da2c13"
integrity sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==

follow-redirects@^1.15.4:
version "1.15.4"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.4.tgz#cdc7d308bf6493126b17ea2191ea0ccf3e535adf"
integrity sha512-Cr4D/5wlrb0z9dgERpUL3LrmPKVDsETIJhaCMeDfuFYcqa5bldGV6wBsAN6X/vxlXQtFBMrXdXxdL8CbDTGniw==

for-each@^0.3.3:
version "0.3.3"
resolved "https://registry.yarnpkg.com/for-each/-/for-each-0.3.3.tgz#69b447e88a0a5d32c3e7084f3f1710034b21376e"
Expand Down Expand Up @@ -4538,6 +4552,15 @@ form-data@^3.0.0:
combined-stream "^1.0.8"
mime-types "^2.1.12"

form-data@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/form-data/-/form-data-4.0.0.tgz#93919daeaf361ee529584b9b31664dc12c9fa452"
integrity sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==
dependencies:
asynckit "^0.4.0"
combined-stream "^1.0.8"
mime-types "^2.1.12"

form-data@~2.3.2:
version "2.3.3"
resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.3.3.tgz#dcce52c05f644f298c6a7ab936bd724ceffbf3a6"
Expand Down Expand Up @@ -7108,6 +7131,11 @@ promise@^8.0.0:
dependencies:
asap "~2.0.6"

proxy-from-env@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/proxy-from-env/-/proxy-from-env-1.1.0.tgz#e102f16ca355424865755d2c9e8ea4f24d58c3e2"
integrity sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==

prr@~1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/prr/-/prr-1.0.1.tgz#d3fc114ba06995a45ec6893f484ceb1d78f5f476"
Expand Down

0 comments on commit 32e4912

Please sign in to comment.