diff --git a/examples/zksync-ethers-example/deploy/001_deploy.ts b/examples/zksync-ethers-example/deploy/001_deploy.ts index 291679f53..5a425e597 100644 --- a/examples/zksync-ethers-example/deploy/001_deploy.ts +++ b/examples/zksync-ethers-example/deploy/001_deploy.ts @@ -47,4 +47,11 @@ export default async function (hre: HardhatRuntimeEnvironment) { const tx2 = await greeter.setGreeting('Hello, world again with name!'); await tx2.wait(); console.info(chalk.green(`Greeter greeting set to: ${await greeter.greet()}`)); + + const newContractFactory = new hre.zksyncEthers.ContractFactory(artifact.abi, artifact.bytecode, wallet); + const deployedContract = await newContractFactory.deploy("Hello World with new contract factory."); + console.info(chalk.green(`Contract with new ContractFactory deployed to ${await deployedContract.getAddress()}`)) + + const newContract = new hre.zksyncEthers.Contract(await deployedContract.getAddress(),artifact.abi,wallet); + console.info(await newContract.greet()); } diff --git a/examples/zksync-ethers-example/deploy/002_deploy.ts b/examples/zksync-ethers-example/deploy/002_deploy.ts index 954737be7..c179af93a 100644 --- a/examples/zksync-ethers-example/deploy/002_deploy.ts +++ b/examples/zksync-ethers-example/deploy/002_deploy.ts @@ -99,4 +99,11 @@ export default async function (hre: HardhatRuntimeEnvironment) { console.info(chalk.green(`Greeter from getContractAt set to: ${await contract3.greet()}`)); const contract3Runner = contract3.runner as Signer; console.info(chalk.green('Runner from getContractAt set to: ', await contract3Runner.getAddress())); + + const newContractFactory = new hre.ethers.ContractFactory(artifact.abi, artifact.bytecode, signer); + const deployedContract = await newContractFactory.deploy("Hello World with new contract factory."); + console.info(chalk.green(`Contract with new ContractFactory deployed to ${await deployedContract.getAddress()}`)) + + const newContract = new hre.ethers.Contract(await deployedContract.getAddress(),artifact.abi,signer); + console.info(await newContract.greet()); } diff --git a/packages/hardhat-zksync-ethers/src/extension-generator.ts b/packages/hardhat-zksync-ethers/src/extension-generator.ts index 07a629181..440815740 100644 --- a/packages/hardhat-zksync-ethers/src/extension-generator.ts +++ b/packages/hardhat-zksync-ethers/src/extension-generator.ts @@ -25,7 +25,7 @@ export class ZkSyncGenerator implements Generator { public populateExtension(): any { return lazyObject(() => { - const { zksyncEthers } = require('zksync-ethers'); + const zksyncEthers = require('zksync-ethers'); const { ethWeb3Provider, zkWeb3Provider } = createProviders(this._hre); const { ethers } = require('ethers');