From b593c0bf736e499610a441228a073d0289056819 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1n=20Jakub=20Nani=C5=A1ta?= Date: Tue, 5 Dec 2023 11:18:00 -0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=AA=9A=20OmniGraph=E2=84=A2=20Delete=20de?= =?UTF-8?q?ployments=20before=20deploying=20(#60)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/ua-utils-evm-hardhat-test/deploy/001_bootstrap.ts | 7 +++++-- packages/ua-utils-evm-hardhat-test/deploy/002_oapp.ts | 6 +++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/packages/ua-utils-evm-hardhat-test/deploy/001_bootstrap.ts b/packages/ua-utils-evm-hardhat-test/deploy/001_bootstrap.ts index cd348e163..5869d9ebc 100644 --- a/packages/ua-utils-evm-hardhat-test/deploy/001_bootstrap.ts +++ b/packages/ua-utils-evm-hardhat-test/deploy/001_bootstrap.ts @@ -1,6 +1,6 @@ import { type DeployFunction } from 'hardhat-deploy/types' -import { AddressZero } from '@ethersproject/constants' import assert from 'assert' +import { formatEid } from '@layerzerolabs/utils' /** * This deploy function will deploy and configure LayerZero endpoint @@ -13,23 +13,26 @@ const deploy: DeployFunction = async ({ getUnnamedAccounts, deployments, network const [deployer] = await getUnnamedAccounts() assert(deployer, 'Missing deployer') + await deployments.delete('EndpointV2') const endpointV2Deployment = await deployments.deploy('EndpointV2', { from: deployer, args: [network.config.eid], }) + await deployments.delete('SendUln302') const sendUln302 = await deployments.deploy('SendUln302', { from: deployer, args: [endpointV2Deployment.address, 0, 0], }) + await deployments.delete('ReceiveUln302') const receiveUln302 = await deployments.deploy('ReceiveUln302', { from: deployer, args: [endpointV2Deployment.address], }) console.table({ - Network: network.name, + Network: `${network.name} (endpoint ${formatEid(network.config.eid)})`, EndpointV2: endpointV2Deployment.address, SendUln302: sendUln302.address, ReceiveUln302: receiveUln302.address, diff --git a/packages/ua-utils-evm-hardhat-test/deploy/002_oapp.ts b/packages/ua-utils-evm-hardhat-test/deploy/002_oapp.ts index 158553d7a..b56907807 100644 --- a/packages/ua-utils-evm-hardhat-test/deploy/002_oapp.ts +++ b/packages/ua-utils-evm-hardhat-test/deploy/002_oapp.ts @@ -1,3 +1,4 @@ +import { formatEid } from '@layerzerolabs/utils' import { type DeployFunction } from 'hardhat-deploy/types' import assert from 'assert' @@ -7,15 +8,18 @@ import assert from 'assert' * @param env `HardhatRuntimeEnvironment` */ const deploy: DeployFunction = async ({ getUnnamedAccounts, deployments, network }) => { + assert(network.config.eid != null, `Missing endpoint ID for network ${network.name}`) + const [deployer] = await getUnnamedAccounts() assert(deployer, 'Missing deployer') + await deployments.delete('DefaultOApp') const defaultOAppDeployment = await deployments.deploy('DefaultOApp', { from: deployer, }) console.table({ - Network: network.name, + Network: `${network.name} (endpoint ${formatEid(network.config.eid)})`, DefaultOApp: defaultOAppDeployment.address, }) }