From 4a4a62fcc182c098d263393bb7d75250ec5eda46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1n=20Jakub=20Nani=C5=A1ta?= Date: Thu, 7 Dec 2023 16:30:03 -0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=A7=20Fix=20failing=20main=20(#75)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/oft/package.json | 1 - .../ua-utils-evm-hardhat-test/hardhat.config.ts | 1 - packages/ua-utils-evm-hardhat-test/package.json | 1 - .../test/task/getDefaultConfig.test.ts | 16 +++++++++------- .../src/tasks/getDefaultConfig.ts | 1 - yarn.lock | 5 ----- 6 files changed, 9 insertions(+), 16 deletions(-) diff --git a/examples/oft/package.json b/examples/oft/package.json index 304dd2790..b7d4a1458 100644 --- a/examples/oft/package.json +++ b/examples/oft/package.json @@ -24,7 +24,6 @@ "hardhat": "^2.19.2", "hardhat-contract-sizer": "^2.10.0", "hardhat-deploy": "^0.11.43", - "hardhat-deploy-ethers": "^0.4.1", "prettier": "^3.1.0", "solhint": "^4.0.0", "ts-node": "^10.9.1", diff --git a/packages/ua-utils-evm-hardhat-test/hardhat.config.ts b/packages/ua-utils-evm-hardhat-test/hardhat.config.ts index 3b5080e82..2c14c94f5 100644 --- a/packages/ua-utils-evm-hardhat-test/hardhat.config.ts +++ b/packages/ua-utils-evm-hardhat-test/hardhat.config.ts @@ -1,5 +1,4 @@ import 'hardhat-deploy' -import 'hardhat-deploy-ethers' import assert from 'assert' import { withLayerZeroArtifacts } from '@layerzerolabs/utils-evm-hardhat' import { EndpointId } from '@layerzerolabs/lz-definitions' diff --git a/packages/ua-utils-evm-hardhat-test/package.json b/packages/ua-utils-evm-hardhat-test/package.json index 8cee8830b..481affb4d 100644 --- a/packages/ua-utils-evm-hardhat-test/package.json +++ b/packages/ua-utils-evm-hardhat-test/package.json @@ -41,7 +41,6 @@ "ethers": "^5.7.0", "hardhat": "^2.19.2", "hardhat-deploy": "^0.11.22", - "hardhat-deploy-ethers": "^0.4.1", "sinon": "^17.0.1", "ts-node": "^10.9.1", "typescript": "^5.2.2" diff --git a/packages/ua-utils-evm-hardhat-test/test/task/getDefaultConfig.test.ts b/packages/ua-utils-evm-hardhat-test/test/task/getDefaultConfig.test.ts index ac712b807..66c3765bd 100644 --- a/packages/ua-utils-evm-hardhat-test/test/task/getDefaultConfig.test.ts +++ b/packages/ua-utils-evm-hardhat-test/test/task/getDefaultConfig.test.ts @@ -1,8 +1,8 @@ import { describe } from 'mocha' import { defaultExecutorConfig, defaultUlnConfig, setupDefaultEndpoint } from '../__utils__/endpoint' -import { getNetworkRuntimeEnvironment } from '@layerzerolabs/utils-evm-hardhat' +import { createContractFactory, getEidForNetworkName } from '@layerzerolabs/utils-evm-hardhat' import hre from 'hardhat' -import { expect, assert } from 'chai' +import { expect } from 'chai' describe('task: getDefaultConfig', () => { beforeEach(async () => { @@ -12,19 +12,21 @@ describe('task: getDefaultConfig', () => { it('should return default configurations', async () => { const networks = Object.keys(hre.userConfig.networks ?? {}) const getDefaultConfigTask = await hre.run('getDefaultConfig', { networks: networks.toString() }) + const contractFactory = createContractFactory() for (const localNetwork of networks) { + const localEid = getEidForNetworkName(localNetwork) + for (const remoteNetwork of networks) { if (localNetwork === remoteNetwork) continue const defaultConfig = getDefaultConfigTask[localNetwork][remoteNetwork] - const network = await getNetworkRuntimeEnvironment(localNetwork) - const sendUln302 = await network.ethers.getContract('SendUln302') - const receiveUln302 = await network.ethers.getContract('ReceiveUln302') + const sendUln302 = await contractFactory({ contractName: 'SendUln302', eid: localEid }) + const receiveUln302 = await contractFactory({ contractName: 'ReceiveUln302', eid: localEid }) // verify defaultSendLibrary & defaultReceiveLibrary - expect(defaultConfig.defaultSendLibrary).to.eql(sendUln302.address) - expect(defaultConfig.defaultReceiveLibrary).to.eql(receiveUln302.address) + expect(defaultConfig.defaultSendLibrary).to.eql(sendUln302.contract.address) + expect(defaultConfig.defaultReceiveLibrary).to.eql(receiveUln302.contract.address) // verify sendUln expect(defaultConfig.sendExecutorConfig.maxMessageSize).to.eql(defaultExecutorConfig.maxMessageSize) diff --git a/packages/ua-utils-evm-hardhat/src/tasks/getDefaultConfig.ts b/packages/ua-utils-evm-hardhat/src/tasks/getDefaultConfig.ts index 491478a45..c33bac58b 100644 --- a/packages/ua-utils-evm-hardhat/src/tasks/getDefaultConfig.ts +++ b/packages/ua-utils-evm-hardhat/src/tasks/getDefaultConfig.ts @@ -1,6 +1,5 @@ import { ActionType } from 'hardhat/types' import { task } from 'hardhat/config' -import 'hardhat-deploy-ethers/internal/type-extensions' import { createConnectedContractFactory, getEidForNetworkName } from '@layerzerolabs/utils-evm-hardhat' import { Endpoint, Uln302 } from '@layerzerolabs/protocol-utils-evm' diff --git a/yarn.lock b/yarn.lock index a1dbf5a7a..9f953ce72 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6812,11 +6812,6 @@ hardhat-contract-sizer@^2.10.0: cli-table3 "^0.6.0" strip-ansi "^6.0.0" -hardhat-deploy-ethers@^0.4.1: - version "0.4.1" - resolved "https://registry.yarnpkg.com/hardhat-deploy-ethers/-/hardhat-deploy-ethers-0.4.1.tgz#dd70b0cc413ed99e98994047b383a004cf1c14f8" - integrity sha512-RM6JUcD0dOCjemxnKLtK7XQQI7NWn+LxF5qicGYax0PtWayEUXAewOb4WIHZ/yearhj+s2t6dL0MnHyLTENwJg== - hardhat-deploy@^0.11.22, hardhat-deploy@^0.11.43: version "0.11.43" resolved "https://registry.npmjs.org/hardhat-deploy/-/hardhat-deploy-0.11.43.tgz"