From 480d10da6efa05a0eed08b697587e5dad4dc671c Mon Sep 17 00:00:00 2001 From: cyhhao Date: Sat, 4 Feb 2023 11:50:13 +0800 Subject: [PATCH] deploy --- contracts/UpgradeProxy.sol | 2 +- package-lock.json | 1 + scripts/deploy.ts | 25 ++++++++++++++++++++----- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/contracts/UpgradeProxy.sol b/contracts/UpgradeProxy.sol index 393772d..99b2808 100644 --- a/contracts/UpgradeProxy.sol +++ b/contracts/UpgradeProxy.sol @@ -8,5 +8,5 @@ contract UpgradeableProxy is TransparentUpgradeableProxy { address logic, address admin, bytes memory data - ) public TransparentUpgradeableProxy(logic, admin, data) {} + ) TransparentUpgradeableProxy(logic, admin, data) {} } diff --git a/package-lock.json b/package-lock.json index 749e18c..19cf5e4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5,6 +5,7 @@ "requires": true, "packages": { "": { + "name": "git3-contract", "version": "1.0.0", "license": "ISC", "dependencies": { diff --git a/scripts/deploy.ts b/scripts/deploy.ts index cb15f81..3752632 100644 --- a/scripts/deploy.ts +++ b/scripts/deploy.ts @@ -1,22 +1,37 @@ 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 Git3 = await ethers.getContractFactory("Git3Hub"); - const git3 = await Git3.deploy(); + const git3 = await Git3.deploy({ nonce: nonce }); + let logicReceipt = await git3.deployed() + console.log(logicReceipt.deployTransaction.hash) + nonce++ + let factory1 = await ethers.getContractFactory("UpgradeableProxy"); // Proxy don't need to init Git3 contract because the constructor is empty. let initSelector = "0x"; - let [operator,] = await ethers.getSigners(); + let proxyInstance = await factory1 .connect(operator) - .deploy(git3.address, operator.address, initSelector); + .deploy(git3.address, operator.address, initSelector, { nonce: nonce }); let proxyReceipt = await proxyInstance.deployed() + console.log(proxyReceipt.deployTransaction.hash) // console.log({logicReceipt,proxyReceipt}); - console.log("Logic Contract",git3.address); - console.log("Proxy Contract",git3.address); + console.log("Logic Contract", git3.address); + console.log("Proxy Contract", proxyInstance.address); } // We recommend this pattern to be able to use async/await everywhere