Skip to content

Commit

Permalink
removing private package
Browse files Browse the repository at this point in the history
  • Loading branch information
sirarthurmoney committed Oct 24, 2023
1 parent 0036665 commit 9888d5c
Show file tree
Hide file tree
Showing 8 changed files with 96 additions and 41 deletions.
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@layerzerolabs/ua-utils",
"version": "0.0.14",
"version": "0.0.15",
"repository": "https://github.com/LayerZero-Labs/ua-utils.git",
"license": "MIT",
"main": "dist/index.js",
Expand Down Expand Up @@ -31,7 +31,6 @@
"dependencies": {
"@layerzerolabs/lz-definitions": "latest",
"@layerzerolabs/lz-sdk": "0.0.12",
"@layerzerolabs/lz-evm-sdk-v1": "latest",
"chalk": "4.1.2",
"cli-ux": "^6.0.9"
},
Expand Down
87 changes: 87 additions & 0 deletions src/constants/endpoints.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
export const LZ_ENDPOINTS: {[key: string]: string} = {
"aavegotchi-testnet": "0xfeBE4c839EFA9f506C092a32fD0BB546B76A1d38",
"arbitrum-mainnet": "0x3c2269811836af69497E5F486A85D7316753cf62",
"arbitrum-testnet": "0x6aB5Ae6822647046626e83ee6dB8187151E1d5ab",
"astar-mainnet": "0xb6319cC6c8c27A8F5dAF0dD3DF91EA35C4720dd7",
"aurora-mainnet": "0xb6319cC6c8c27A8F5dAF0dD3DF91EA35C4720dd7",
"aurora-testnet": "0x83c73Da98cf733B03315aFa8758834b36a195b87",
"avalanche-mainnet": "0x3c2269811836af69497E5F486A85D7316753cf62",
"avalanche-testnet": "0x93f54D755A063cE7bB9e6Ac47Eccc8e33411d706",
"base-mainnet": "0xb6319cC6c8c27A8F5dAF0dD3DF91EA35C4720dd7",
"base-testnet": "0x6aB5Ae6822647046626e83ee6dB8187151E1d5ab",
"blockgen-testnet": "0x55370E0fBB5f5b8dAeD978BA1c075a499eB107B8",
"bsc-mainnet": "0x3c2269811836af69497E5F486A85D7316753cf62",
"bsc-testnet": "0x6Fcb97553D41516Cb228ac03FdC8B9a0a9df04A1",
"canto-mainnet": "0x9740FF91F1985D8d2B71494aE1A2f723bb3Ed9E4",
"canto-testnet": "0xae92d5aD7583AD66E49A0c67BAd18F6ba52dDDc1",
"celo-mainnet": "0x3A73033C0b1407574C76BdBAc67f126f6b4a9AA9",
"celo-testnet": "0xae92d5aD7583AD66E49A0c67BAd18F6ba52dDDc1",
"conflux-mainnet": "0xb6319cC6c8c27A8F5dAF0dD3DF91EA35C4720dd7",
"conflux-testnet": "0x83c73Da98cf733B03315aFa8758834b36a195b87",
"coredao-mainnet": "0x9740FF91F1985D8d2B71494aE1A2f723bb3Ed9E4",
"coredao-testnet": "0xae92d5aD7583AD66E49A0c67BAd18F6ba52dDDc1",
"dexalot-mainnet": "0x9740FF91F1985D8d2B71494aE1A2f723bb3Ed9E4",
"dexalot-testnet": "0x6C7Ab2202C98C4227C5c46f1417D81144DA716Ff",
"dfk-mainnet": "0x9740FF91F1985D8d2B71494aE1A2f723bb3Ed9E4",
"dos-testnet": "0x45841dd1ca50265Da7614fC43A361e526c0e6160",
"eon-testnet": "0x83c73Da98cf733B03315aFa8758834b36a195b87",
"ethereum-mainnet": "0x66A71Dcef29A0fFBDBE3c6a460a3B5BC225Cd675",
"ethereum-testnet": "0xbfD2135BFfbb0B5378b56643c2Df8a87552Bfa23",
"fantom-mainnet": "0xb6319cC6c8c27A8F5dAF0dD3DF91EA35C4720dd7",
"fantom-testnet": "0x7dcAD72640F835B0FA36EFD3D6d3ec902C7E5acf",
"fuse-mainnet": "0x9740FF91F1985D8d2B71494aE1A2f723bb3Ed9E4",
"gnosis-mainnet": "0x9740FF91F1985D8d2B71494aE1A2f723bb3Ed9E4",
"gnosis-testnet": "0xae92d5aD7583AD66E49A0c67BAd18F6ba52dDDc1",
"harmony-mainnet": "0x9740FF91F1985D8d2B71494aE1A2f723bb3Ed9E4",
"harmony-testnet": "0xae92d5aD7583AD66E49A0c67BAd18F6ba52dDDc1",
"hubble-testnet": "0x8b14D287B4150Ff22Ac73DF8BE720e933f659abc",
"kava-mainnet": "0xb6319cC6c8c27A8F5dAF0dD3DF91EA35C4720dd7",
"kava-testnet": "0x8b14D287B4150Ff22Ac73DF8BE720e933f659abc",
"klaytn-mainnet": "0x9740FF91F1985D8d2B71494aE1A2f723bb3Ed9E4",
"klaytn-testnet": "0x6aB5Ae6822647046626e83ee6dB8187151E1d5ab",
"lif3-testnet": "0x55370E0fBB5f5b8dAeD978BA1c075a499eB107B8",
"loot-mainnet": "0xb6319cC6c8c27A8F5dAF0dD3DF91EA35C4720dd7",
"loot-testnet": "0x83c73Da98cf733B03315aFa8758834b36a195b87",
"mantle-mainnet": "0xb6319cC6c8c27A8F5dAF0dD3DF91EA35C4720dd7",
"mantle-testnet": "0x2cA20802fd1Fd9649bA8Aa7E50F0C82b479f35fe",
"meritcircle-mainnet": "0xb6319cC6c8c27A8F5dAF0dD3DF91EA35C4720dd7",
"meritcircle-testnet": "0xae92d5aD7583AD66E49A0c67BAd18F6ba52dDDc1",
"meter-mainnet": "0xa3a8e19253Ab400acDac1cB0eA36B88664D8DedF",
"meter-testnet": "0x3De2f3D1Ac59F18159ebCB422322Cb209BA96aAD",
"metis-mainnet": "0x9740FF91F1985D8d2B71494aE1A2f723bb3Ed9E4",
"metis-testnet": "0xae92d5aD7583AD66E49A0c67BAd18F6ba52dDDc1",
"moonbeam-mainnet": "0x9740FF91F1985D8d2B71494aE1A2f723bb3Ed9E4",
"moonbeam-testnet": "0xb23b28012ee92E8dE39DEb57Af31722223034747",
"moonriver-mainnet": "0x7004396C99D5690da76A7C59057C5f3A53e01704",
"nova-mainnet": "0x4EE2F9B7cf3A68966c370F3eb2C16613d3235245",
"okx-mainnet": "0x9740FF91F1985D8d2B71494aE1A2f723bb3Ed9E4",
"okx-testnet": "0xae92d5aD7583AD66E49A0c67BAd18F6ba52dDDc1",
"opbnb-mainnet": "0xb6319cC6c8c27A8F5dAF0dD3DF91EA35C4720dd7",
"opbnb-testnet": "0x83c73Da98cf733B03315aFa8758834b36a195b87",
"optimism-mainnet": "0x3c2269811836af69497E5F486A85D7316753cf62",
"optimism-testnet": "0xae92d5aD7583AD66E49A0c67BAd18F6ba52dDDc1",
"orderly-testnet": "0x83c73Da98cf733B03315aFa8758834b36a195b87",
"polygon-mainnet": "0x3c2269811836af69497E5F486A85D7316753cf62",
"polygon-testnet": "0xf69186dfBa60DdB133E91E9A4B5673624293d8F8",
"portal-testnet": "0xd682ECF100f6F4284138AA925348633B0611Ae21",
"scroll-mainnet": "0xb6319cC6c8c27A8F5dAF0dD3DF91EA35C4720dd7",
"scroll-testnet": "0x6098e96a28E02f27B1e6BD381f870F1C8Bd169d3",
"sepolia-mainnet": "0x7cacBe439EaD55fa1c22790330b12835c6884a91",
"sepolia-testnet": "0xae92d5aD7583AD66E49A0c67BAd18F6ba52dDDc1",
"shimmer-testnet": "0x83c73Da98cf733B03315aFa8758834b36a195b87",
"telos-mainnet": "0x66A71Dcef29A0fFBDBE3c6a460a3B5BC225Cd675",
"telos-testnet": "0x83c73Da98cf733B03315aFa8758834b36a195b87",
"tenet-mainnet": "0x2D61DCDD36F10b22176E0433B86F74567d529aAa",
"tenet-testnet": "0x6aB5Ae6822647046626e83ee6dB8187151E1d5ab",
"tomo-mainnet": "0xb6319cC6c8c27A8F5dAF0dD3DF91EA35C4720dd7",
"tomo-testnet": "0xae92d5aD7583AD66E49A0c67BAd18F6ba52dDDc1",
"xpla-testnet": "0x83c73Da98cf733B03315aFa8758834b36a195b87",
"zkconsensys-mainnet": "0xb6319cC6c8c27A8F5dAF0dD3DF91EA35C4720dd7",
"zkconsensys-testnet": "0x6aB5Ae6822647046626e83ee6dB8187151E1d5ab",
"zkpolygon-mainnet": "0x9740FF91F1985D8d2B71494aE1A2f723bb3Ed9E4",
"zkpolygon-testnet": "0x6aB5Ae6822647046626e83ee6dB8187151E1d5ab",
"zksync-mainnet": "0x9b896c0e23220469C7AE69cb4BbAE391eAa4C8da",
"zksync-testnet": "0x093D2CF57f764f09C3c2Ac58a42A2601B8C79281",
"zora-mainnet": "0xb6319cC6c8c27A8F5dAF0dD3DF91EA35C4720dd7",
"zora-testnet": "0x83c73Da98cf733B03315aFa8758834b36a195b87"
}
4 changes: 2 additions & 2 deletions src/getConfig.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getDeploymentAddresses, getApplicationConfig, getEvmContractAddress } from "./utils/crossChainHelper";
import { getDeploymentAddresses, getApplicationConfig, getEndpointAddress } from "./utils/crossChainHelper";
import { ENDPOINT_ABI, MESSAGING_LIBRARY_ABI } from "./constants/abi";
import { logError } from "./utils/helpers";

Expand All @@ -21,7 +21,7 @@ export default async (taskArgs: any, hre: any) => {
}
}

const endpoint = await hre.ethers.getContractAt(ENDPOINT_ABI, getEvmContractAddress("Endpoint", network));
const endpoint = await hre.ethers.getContractAt(ENDPOINT_ABI, getEndpointAddress(network));
const appConfig = await endpoint.uaConfigLookup(contractAddress);
const sendVersion = appConfig.sendVersion;
const receiveVersion = appConfig.receiveVersion;
Expand Down
4 changes: 2 additions & 2 deletions src/getDefaultConfig.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ethers } from "ethers";
import { getProvider, getLayerZeroChainId, getEvmContractAddress } from "./utils/crossChainHelper";
import { getProvider, getLayerZeroChainId, getEndpointAddress } from "./utils/crossChainHelper";
const { ENDPOINT_ABI, MESSAGING_LIBRARY_ABI } = require("./constants/abi")

export default async (taskArgs: any, hre: any) => {
Expand All @@ -9,7 +9,7 @@ export default async (taskArgs: any, hre: any) => {
networks.map(async (network: string) => {
const provider = getProvider(hre, network);
console.log()
const endpoint = new ethers.Contract(getEvmContractAddress("Endpoint", network), ENDPOINT_ABI, provider);
const endpoint = new ethers.Contract(getEndpointAddress(network), ENDPOINT_ABI, provider);
const sendVersion = await endpoint.defaultSendVersion();
const receiveVersion = await endpoint.defaultReceiveVersion();
const sendLibraryAddress = await endpoint.defaultSendLibrary();
Expand Down
4 changes: 0 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ task("checkWireAllConfig", "", checkWireAllConfig)
.addOptionalParam("addresses", "addresses of contracts in same order as chains")
.addOptionalParam("proxyContract", "name of proxy contract")
.addOptionalParam("proxyChain", "name of proxy chain")
// npx hardhat checkConfig --e testnet --u --t --m --chains ethereum-testnet,arbitrum-testnet --contract ExampleOFTV2
// npx hardhat checkConfig --e testnet --u --t --m --chains ethereum-testnet,arbitrum-testnet,optimism-testnet --contract OFTV2 --proxy-contract ProxyOFTV2 --proxy-chain optimism-testnet
// npx hardhat checkConfig --e testnet --u --t --m --chains ethereum-testnet,arbitrum-testnet,optimism-testnet --addresses "0xD90E022dE858DfDFC3C0f66b0D9ACD12CA6eA3Ec,0x137d4e9C2431A3DCBa6e615E9438F2c558353a17,0x27631753FC88e7b45a46679B9Cd2e06378cB43dC"

task("wireAll", "", wireAll)
.addParam("e", "the environment ie: mainnet, testnet or sandbox")
Expand All @@ -41,4 +38,3 @@ task("wireAll", "", wireAll)
.addOptionalParam("n", "send to gnosis", false, types.boolean)
.addOptionalParam("gasLimit", "override execution gasLimit")
.addOptionalParam("gnosisConfigPath", "Optional config path. Default: ./constants/gnosisConfig.json", "./constants/gnosisConfig.json", types.string)
// npx hardhat --network ethereum-testnet wireAll --e testnet --config-path "./constants/oftv2Config/wireUpConfig.json"
4 changes: 2 additions & 2 deletions src/setConfig.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { promptToProceed, writeToCsv, logError, logWarning, printTransactions, logSuccess, configExist, getConfig } from "./utils/helpers";
import { executeTransaction, executeGnosisTransactions, getContractAt, getWalletContractAt, Transaction, getContract, getWalletContract, getApplicationConfig, getEvmContractAddress, getLayerZeroChainId } from "./utils/crossChainHelper";
import { executeTransaction, executeGnosisTransactions, getContractAt, getWalletContractAt, Transaction, getContract, getWalletContract, getApplicationConfig, getEndpointAddress, getLayerZeroChainId } from "./utils/crossChainHelper";
import { ENDPOINT_ABI, MESSAGING_LIBRARY_ABI, USER_APPLICATION_ABI } from "./constants/abi";
import { utils } from "ethers";

Expand Down Expand Up @@ -34,7 +34,7 @@ export default async (taskArgs: any, hre: any) => {
const networkConfig = config[network];

if (!networkConfig) return;
const endpoint = await getContractAt(hre, network, ENDPOINT_ABI, getEvmContractAddress("Endpoint", network));
const endpoint = await getContractAt(hre, network, ENDPOINT_ABI, getEndpointAddress(network));

const contractName = networkConfig.name ?? name;
const contractAddress = networkConfig.address ?? address;
Expand Down
22 changes: 2 additions & 20 deletions src/utils/crossChainHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import EthersAdapter from "@gnosis.pm/safe-ethers-lib";
import SafeServiceClient from "@gnosis.pm/safe-service-client";
import Safe from "@gnosis.pm/safe-core-sdk";
import { LZ_APP_ABI } from "../constants/abi";
import { LZ_ENDPOINTS } from "../constants/endpoints";
import { MainnetEndpointId, TestnetEndpointId, SandboxEndpointId } from "@layerzerolabs/lz-definitions";
import { promptToProceed, arrayToCsv, getConfig } from "./helpers";
const path = require("path");
Expand Down Expand Up @@ -302,7 +303,6 @@ export const getDeploymentAddresses = (network: string, throwIfMissing: boolean

export const getApplicationConfig = async (remoteNetwork: string, sendLibrary: any, receiveLibrary: any, applicationAddress: string) => {
const remoteChainId = getLayerZeroChainId(remoteNetwork);
console.log({remoteChainId})
const sendConfig = await sendLibrary.appConfig(applicationAddress, remoteChainId);
let inboundProofLibraryVersion = sendConfig.inboundProofLibraryVersion;
let inboundBlockConfirmations = sendConfig.inboundBlockConfirmations.toNumber();
Expand All @@ -323,25 +323,7 @@ export const getApplicationConfig = async (remoteNetwork: string, sendLibrary: a
};
};

export const getEvmContractAddress = (
contractName: string,
network: string,
): string => {
const [chainName, environment] = network.split("-");
const deploymentFolderName = getDeploymentFolderName(
chainName,
environment,
)
return require(`@layerzerolabs/lz-evm-sdk-v1/deployments/${deploymentFolderName}/${contractName}.json`).address
}

const getDeploymentFolderName = (chainName: string, environment: string): string => {
if (['localnet', 'sandbox'].includes(environment)) {
return chainName + '-sandbox-local'
}
// monorepo packages
return `${chainName.split("-")[0]}-${environment}`
}
export const getEndpointAddress = (network: string): string => { return LZ_ENDPOINTS[network] }

// expecting "chain-environment" eg. "ethereum-mainnet", "ethereum-testnet", "ethereum-sandbox"
export const getLayerZeroChainId = (network: string): string => {
Expand Down
9 changes: 0 additions & 9 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -590,15 +590,6 @@
dependencies:
tiny-invariant "^1.3.1"

"@layerzerolabs/lz-evm-sdk-v1@latest":
version "1.5.50"
resolved "https://registry.npmjs.org/@layerzerolabs/lz-evm-sdk-v1/-/lz-evm-sdk-v1-1.5.50.tgz#37bb5571bd517259d7384f696080e6c57f55d417"
integrity sha512-8YGQPBTQGVjtwDeABhkbzHKQ5Lyv9UhmSd6+xBZiZ369qTNNgJco9qJ9LdT9WGEprzf+/38uO+MSJffTy5scmw==
dependencies:
"@ethersproject/abi" "^5.7.0"
"@ethersproject/providers" "^5.7.2"
ethers "^5.7.2"

"@layerzerolabs/[email protected]":
version "0.0.12"
resolved "https://registry.npmjs.org/@layerzerolabs/lz-sdk/-/lz-sdk-0.0.12.tgz#b41b5b266d41f89c0a720de48581e0a8910180a8"
Expand Down

0 comments on commit 9888d5c

Please sign in to comment.