From f5525d3d2f036a0ba1982a6f7c572981d30b0d01 Mon Sep 17 00:00:00 2001 From: cyl19970726 <15258378443@163.com> Date: Wed, 22 Feb 2023 01:33:47 +0800 Subject: [PATCH] add deploy script --- scripts/deploy-ethstorage-v3.ts | 52 +++++++++++++++++++++++++++++++++ scripts/deploy-sli-v3.ts | 40 +++++++++++++++++++++++++ 2 files changed, 92 insertions(+) create mode 100644 scripts/deploy-ethstorage-v3.ts create mode 100644 scripts/deploy-sli-v3.ts diff --git a/scripts/deploy-ethstorage-v3.ts b/scripts/deploy-ethstorage-v3.ts new file mode 100644 index 0000000..3b2f25e --- /dev/null +++ b/scripts/deploy-ethstorage-v3.ts @@ -0,0 +1,52 @@ +// const hubfacFac = await ethers.getContractFactory("HubFactory"); +// const hubFac = await hubfacFac.deploy(); +// await hubFac.deployed(); + +// await hubFac.newHubImp(); + +// expect(await hubFac.createHub(true)).to.emit(hubFac,"CreateHub"); +// let hub = await hubFac.hubs(0); +// console.log(hub); +// let git3 = await ethers.getContractAt("Hubv3",hub) + + +import { ethers } from "hardhat"; + +async function main() { + let provider = ethers.provider + let [operator,] = await ethers.getSigners(); + let nonce = await operator.getTransactionCount() + + + let price = await provider.getFeeData() + console.log(price) + + console.log(operator.address, nonce) + + const Git3Fac = await ethers.getContractFactory("HubFactory"); + const hubFac = await Git3Fac.deploy({ nonce: nonce }); + + let logicReceipt = await hubFac.deployed() + console.log(logicReceipt.deployTransaction.hash) + nonce++ + + await hubFac.newHubImp({ nonce: nonce }); + nonce++ + + await hubFac.createHub(true,{ nonce: nonce }) + nonce++ + + let hubAddr = await hubFac.hubs(0); + let git3 = await ethers.getContractAt("Hubv3",hubAddr) + + // console.log({logicReceipt,proxyReceipt}); + console.log("HubFactory Contract", hubFac.address); + console.log("Hub Contract", git3.address); +} + +// We recommend this pattern to be able to use async/await everywhere +// and properly handle errors. +main().catch((error) => { + console.error(error); + process.exitCode = 1; +}); diff --git a/scripts/deploy-sli-v3.ts b/scripts/deploy-sli-v3.ts new file mode 100644 index 0000000..c389647 --- /dev/null +++ b/scripts/deploy-sli-v3.ts @@ -0,0 +1,40 @@ +import { ethers } from "hardhat"; + +async function main() { + let provider = ethers.provider + let [operator,] = await ethers.getSigners(); + let nonce = await operator.getTransactionCount() + + + let price = await provider.getFeeData() + console.log(price) + + console.log(operator.address, nonce) + + const Git3Fac = await ethers.getContractFactory("HubFactory"); + const hubFac = await Git3Fac.deploy({ nonce: nonce }); + + let logicReceipt = await hubFac.deployed() + console.log(logicReceipt.deployTransaction.hash) + nonce++ + + await hubFac.newHubImp({ nonce: nonce }); + nonce++ + + await hubFac.createHub(false,{ nonce: nonce }) + nonce++ + + let hubAddr = await hubFac.hubs(0); + let git3 = await ethers.getContractAt("Hubv3",hubAddr) + + // console.log({logicReceipt,proxyReceipt}); + console.log("HubFactory Contract", hubFac.address); + console.log("Hub Contract", git3.address); +} + +// We recommend this pattern to be able to use async/await everywhere +// and properly handle errors. +main().catch((error) => { + console.error(error); + process.exitCode = 1; +});