From ab23430a08fccf826ea79c59e5be2c0b9b8b066a Mon Sep 17 00:00:00 2001 From: Ana Julia Date: Mon, 19 Jun 2023 22:03:44 -0300 Subject: [PATCH] Remediate scripts --- scripts/example/SnapshotGate/deploy-snapshot-gate.js | 2 +- scripts/util/cast-protocol-client-proxies.js | 2 +- scripts/util/deploy-mock-tokens.js | 4 ++-- scripts/util/deploy-protocol-client-beacons.js | 4 ++-- scripts/util/deploy-protocol-client-impls.js | 4 ++-- scripts/util/deploy-protocol-client-proxies.js | 4 ++-- scripts/util/deploy-protocol-handler-facets.js | 2 +- test/protocol/ProtocolInitializationHandlerTest.js | 10 +++++----- 8 files changed, 16 insertions(+), 16 deletions(-) diff --git a/scripts/example/SnapshotGate/deploy-snapshot-gate.js b/scripts/example/SnapshotGate/deploy-snapshot-gate.js index 1cab7d0f2..16670413f 100644 --- a/scripts/example/SnapshotGate/deploy-snapshot-gate.js +++ b/scripts/example/SnapshotGate/deploy-snapshot-gate.js @@ -24,7 +24,7 @@ async function deploySnapshotGateExample(snapshotGateArgs, maxPriorityFeePerGas) // Deploy the SnapshotGate const SnapshotGate = await getContractFactory("SnapshotGate"); const snapshotGate = await SnapshotGate.deploy(...snapshotGateArgs, await getFees(maxPriorityFeePerGas)); - await snapshotGate.deployTransaction.wait(confirmations); + await snapshotGate.waitForDeployment(confirmations); return [snapshotGate]; } diff --git a/scripts/util/cast-protocol-client-proxies.js b/scripts/util/cast-protocol-client-proxies.js index 8fecc8e4e..7552aac99 100644 --- a/scripts/util/cast-protocol-client-proxies.js +++ b/scripts/util/cast-protocol-client-proxies.js @@ -1,5 +1,5 @@ const hre = require("hardhat"); -const ethers = hre.ethers; +const { getContractAt } = hre.ethers; /** * Cast the Protocol Client Proxy contracts to their implementation interfaces diff --git a/scripts/util/deploy-mock-tokens.js b/scripts/util/deploy-mock-tokens.js index de3927c1e..db2322ec0 100644 --- a/scripts/util/deploy-mock-tokens.js +++ b/scripts/util/deploy-mock-tokens.js @@ -41,13 +41,13 @@ async function deployAndMintMockNFTAuthTokens() { //Deploy a mock NFT to represent the Lens Protocol profile NFT let lensTokenContractFactory = await getContractFactory("MockNFTAuth721"); const lensTokenContract = await lensTokenContractFactory.deploy(); - await lensTokenContract.deployTransaction.wait(confirmations); + await lensTokenContract.waitForDeployment(confirmations); console.log(`✅ Mock Lens NFT Token deployed to: ${await lensTokenContract.getAddress()}`); //Deploy a mock NFT to represent the ENS NFT let ensTokenContractFactory = await getContractFactory("MockNFTAuth721"); const ensTokenContract = await ensTokenContractFactory.deploy(); - await ensTokenContract.deployTransaction.wait(confirmations); + await ensTokenContract.waitForDeployment(confirmations); console.log(`✅ Mock ENS NFT Token deployed to: ${await ensTokenContract.getAddress()}`); if (network == "test" || network == "localhost") { diff --git a/scripts/util/deploy-protocol-client-beacons.js b/scripts/util/deploy-protocol-client-beacons.js index 824674d67..6443b1854 100644 --- a/scripts/util/deploy-protocol-client-beacons.js +++ b/scripts/util/deploy-protocol-client-beacons.js @@ -1,5 +1,5 @@ const hre = require("hardhat"); -const ethers = hre.ethers; +const { getContractFactory } = hre.ethers; const environments = require("../../environments"); const confirmations = hre.network.name === "hardhat" ? 1 : environments.confirmations; const { getFees } = require("./utils"); @@ -34,7 +34,7 @@ async function deployProtocolClientBeacons(protocolClients, protocolClientArgs, await bosonVoucherImpl.getAddress(), await getFees(maxPriorityFeePerGas) ); - await clientBeacon.deployTransaction.wait(confirmations); + await clientBeacon.waitForDeployment(confirmations); return [clientBeacon]; } diff --git a/scripts/util/deploy-protocol-client-impls.js b/scripts/util/deploy-protocol-client-impls.js index 1357bf743..928b89990 100644 --- a/scripts/util/deploy-protocol-client-impls.js +++ b/scripts/util/deploy-protocol-client-impls.js @@ -1,5 +1,5 @@ const hre = require("hardhat"); -const ethers = hre.ethers; +const { getContractFactory } = hre.ethers; const environments = require("../../environments"); const confirmations = hre.network.name === "hardhat" ? 1 : environments.confirmations; const { getFees } = require("./utils"); @@ -23,7 +23,7 @@ async function deployProtocolClientImpls(implementationArgs, maxPriorityFeePerGa // Deploy the BosonVoucher contract const BosonVoucher = await getContractFactory("BosonVoucher"); const bosonVoucher = await BosonVoucher.deploy(...implementationArgs, await getFees(maxPriorityFeePerGas)); - await bosonVoucher.deployTransaction.wait(confirmations); + await bosonVoucher.waitForDeployment(confirmations); return [bosonVoucher]; } diff --git a/scripts/util/deploy-protocol-client-proxies.js b/scripts/util/deploy-protocol-client-proxies.js index 68fb3b0c3..0f537b673 100644 --- a/scripts/util/deploy-protocol-client-proxies.js +++ b/scripts/util/deploy-protocol-client-proxies.js @@ -1,5 +1,5 @@ const hre = require("hardhat"); -const ethers = hre.ethers; +const { getContractFactory } = hre.ethers; const environments = require("../../environments"); const confirmations = hre.network.name === "hardhat" ? 1 : environments.confirmations; const { getFees } = require("./utils"); @@ -31,7 +31,7 @@ async function deployProtocolClientProxies(protocolClients, maxPriorityFeePerGas // Deploy the ClientProxy for BosonVoucher const ClientProxy = await getContractFactory("BeaconClientProxy"); const clientProxy = await ClientProxy.deploy(await getFees(maxPriorityFeePerGas)); - await clientProxy.deployTransaction.wait(confirmations); + await clientProxy.waitForDeployment(confirmations); // init instead of constructors let transactionResponse = await clientProxy.initialize( diff --git a/scripts/util/deploy-protocol-handler-facets.js b/scripts/util/deploy-protocol-handler-facets.js index 0b48c43e1..4178d7e53 100644 --- a/scripts/util/deploy-protocol-handler-facets.js +++ b/scripts/util/deploy-protocol-handler-facets.js @@ -88,7 +88,7 @@ async function deployProtocolFacets(facetNames, facetsToInit, maxPriorityFeePerG let FacetContractFactory = await getContractFactory(facetName); const constructorArgs = (facetsToInit[facetName] && facetsToInit[facetName].constructorArgs) || []; const facetContract = await FacetContractFactory.deploy(...constructorArgs, await getFees(maxPriorityFeePerGas)); - await facetContract.deployTransaction.wait(confirmations); + await facetContract.waitForDeployment(confirmations); const deployedFacet = { name: facetName, diff --git a/test/protocol/ProtocolInitializationHandlerTest.js b/test/protocol/ProtocolInitializationHandlerTest.js index 4f8cb0543..6324619b5 100644 --- a/test/protocol/ProtocolInitializationHandlerTest.js +++ b/test/protocol/ProtocolInitializationHandlerTest.js @@ -81,7 +81,7 @@ describe("ProtocolInitializationHandler", async function () { await getFees(maxPriorityFeePerGas) ); - await protocolInitializationFacetDeployed.deployTransaction.wait(); + await protocolInitializationFacetDeployed.waitForDeployment(); }); it("Addresses and calldata length mismatch", async function () { @@ -161,7 +161,7 @@ describe("ProtocolInitializationHandler", async function () { // Mock a new facet to add to diamond so we can call initialize again let FacetTestFactory = await getContractFactory("Test3Facet"); const testFacet = await FacetTestFactory.deploy(await getFees(maxPriorityFeePerGas)); - await testFacet.deployTransaction.wait(); + await testFacet.waitForDeployment(); const calldataTestFacet = testFacet.interface.encodeFunctionData("initialize", [await rando.getAddress()]); @@ -296,7 +296,7 @@ describe("ProtocolInitializationHandler", async function () { it("Should call facet initializer internally when _addresses and _calldata are supplied", async function () { let FacetTestFactory = await getContractFactory("Test3Facet"); const testFacet = await FacetTestFactory.deploy(await getFees(maxPriorityFeePerGas)); - await testFacet.deployTransaction.wait(); + await testFacet.waitForDeployment(); const calldataTestFacet = testFacet.interface.encodeFunctionData("initialize", [await rando.getAddress()]); @@ -332,7 +332,7 @@ describe("ProtocolInitializationHandler", async function () { beforeEach(async function () { let FacetTestFactory = await getContractFactory("Test3Facet"); testFacet = await FacetTestFactory.deploy(await getFees(maxPriorityFeePerGas)); - await testFacet.deployTransaction.wait(); + await testFacet.waitForDeployment(); version = formatBytes32String("2.3.0"); }); @@ -408,7 +408,7 @@ describe("ProtocolInitializationHandler", async function () { await getFees(maxPriorityFeePerGas) ); - await mockInitializationFacetDeployed.deployTransaction.wait(); + await mockInitializationFacetDeployed.waitForDeployment(); const facetNames = [ "SellerHandlerFacet",