From 4d93c7c27486230f3360abbe3a1c23489b0451c5 Mon Sep 17 00:00:00 2001 From: SK0M0R0H Date: Fri, 11 Aug 2023 15:51:15 +0300 Subject: [PATCH] deploy with libs #46 --- deploy/contracts/gate/gate0.sol | 2 +- deploy/contracts/gate/gate15.sol | 2 +- deploy/contracts/gate/gate_argument.sol | 8 ++++---- deploy/tasks/deploy.ts | 26 ++++++++++++------------- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/deploy/contracts/gate/gate0.sol b/deploy/contracts/gate/gate0.sol index 1f2e6ff..18cdd4e 100644 --- a/deploy/contracts/gate/gate0.sol +++ b/deploy/contracts/gate/gate0.sol @@ -20,7 +20,7 @@ //---------------------------------------------------------------------------// pragma solidity >=0.8.4; -import "../../../contracts/types.sol"; +import "@nilfoundation/evm-placeholder-verification/contracts/types.sol"; import "./gate_argument.sol"; library template_gate0{ diff --git a/deploy/contracts/gate/gate15.sol b/deploy/contracts/gate/gate15.sol index c1f2839..c07c1c3 100644 --- a/deploy/contracts/gate/gate15.sol +++ b/deploy/contracts/gate/gate15.sol @@ -20,7 +20,7 @@ //---------------------------------------------------------------------------// pragma solidity >=0.8.4; -import "../../../contracts/types.sol"; +import "@nilfoundation/evm-placeholder-verification/contracts/types.sol"; import "./gate_argument.sol"; library template_gate15{ diff --git a/deploy/contracts/gate/gate_argument.sol b/deploy/contracts/gate/gate_argument.sol index 8605aa8..fb028ba 100644 --- a/deploy/contracts/gate/gate_argument.sol +++ b/deploy/contracts/gate/gate_argument.sol @@ -19,10 +19,10 @@ //---------------------------------------------------------------------------// pragma solidity >=0.8.4; -import "../../../contracts/types.sol"; -import "../../../contracts/basic_marshalling.sol"; -import "../../../contracts/commitments/batched_lpc_verifier.sol"; -import "../../../contracts/interfaces/gate_argument.sol"; +import "@nilfoundation/evm-placeholder-verification/contracts/types.sol"; +import "@nilfoundation/evm-placeholder-verification/contracts/basic_marshalling.sol"; +import "@nilfoundation/evm-placeholder-verification/contracts/commitments/batched_lpc_verifier.sol"; +import "@nilfoundation/evm-placeholder-verification/contracts/interfaces/gate_argument.sol"; import "./gate0.sol"; import "./gate15.sol"; diff --git a/deploy/tasks/deploy.ts b/deploy/tasks/deploy.ts index 34936e9..f0590b3 100644 --- a/deploy/tasks/deploy.ts +++ b/deploy/tasks/deploy.ts @@ -1,12 +1,12 @@ import {task} from 'hardhat/config' -const hre = require('hardhat') +// import {hre} from 'hardhat' import * as fs from 'fs'; task("deploy") .setAction(async (taskArgs, {ethers, run}) => { - const {deployments, getNamedAccounts} = hre; - const {deploy} = deployments; + // const {deployments, getNamedAccounts} = hre; + // const {deploy} = deployments; // https://sepolia.etherscan.io/address/0x489dbc0762b3d9bd9843db11eecd2a177d84ba2b const sepoliaPlaceholderVerifierAddress = '0x489Dbc0762b3D9Bd9843Db11EECd2A177D84ba2b'; @@ -20,19 +20,19 @@ task("deploy") let deployedLib = {} for (let lib of libs) { - await deploy(lib, { - log: true, - }); - deployedLib[lib] = (await hre.deployments.get(lib)).address + const libFactory = await ethers.getContractFactory(lib); + const libContract = await libFactory.deploy(); + await libContract.deployed(); + deployedLib[lib] = libContract.address } - const gateArgument = await deploy('template_gate_argument_split_gen', { - libraries: deployedLib, - log: true, - }); + // const gateArgument = await deploy('template_gate_argument_split_gen', { + // libraries: deployedLib, + // log: true, + // }); - // const GateArgument = await ethers.getContractFactory("template_gate_argument_split_gen"); - // const gateArgument = await GateArgument.deploy(); + const GateArgument = await ethers.getContractFactory("template_gate_argument_split_gen", { libraries: deployedLib}); + const gateArgument = await GateArgument.deploy(); await gateArgument.deployed(); console.log("GateArgument at: ", gateArgument.address)