From e7c96c8ec35fb8f5184bc6a153593d1744b37328 Mon Sep 17 00:00:00 2001 From: hoelee Date: Fri, 2 Aug 2024 22:35:45 +0800 Subject: [PATCH] before verify at etherscan --- contracts/SimpleStorage.sol | 2 +- hardhat.config.js | 37 ++++++++++++++++++++++--------------- package.json | 2 +- scripts/deploy.js | 3 +++ 4 files changed, 27 insertions(+), 17 deletions(-) diff --git a/contracts/SimpleStorage.sol b/contracts/SimpleStorage.sol index a3aa950..2b5a32b 100644 --- a/contracts/SimpleStorage.sol +++ b/contracts/SimpleStorage.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity 0.8.24; +pragma solidity ^0.8.8; contract SimpleStorage { // boolean, uint, int, address, bytes diff --git a/hardhat.config.js b/hardhat.config.js index ece3673..2651831 100644 --- a/hardhat.config.js +++ b/hardhat.config.js @@ -1,5 +1,8 @@ require("@nomicfoundation/hardhat-toolbox"); +//// Deprecated, below import combined in toolbox import already require("@nomiclabs/hardhat-ethers"); +//require("@nomiclabs/hardhat-etherscan"); +//require("@nomicfoundation/hardhat-verify"); require("dotenv").config(); const RPC_URL_SEPOLIA = process.env.SEPOLIA_RPC_URL; @@ -8,25 +11,29 @@ const PRIVATE_KEY_SEPOLIA = process.env.SEPOLIA_PRIVATE_KEY; const RPC_URL_GANACHE = process.env.LOCAL_RPC_URL; const PRIVATE_KEY_GANACHE = process.env.LOCAL_PRIVATE_KEY; +const ETHERSCAN_API_KEY = process.env.ETHERSCAN_API_KEY; + /** @type import('hardhat/config').HardhatUserConfig */ module.exports = { - defaultNetwork: "hardhat", - networks: { - sepolia: { - url: RPC_URL_SEPOLIA, - accounts: [PRIVATE_KEY_SEPOLIA], - chainID: 11155111, - }, - ganache: { - url: RPC_URL_GANACHE, - accounts: [PRIVATE_KEY_GANACHE], - chainID: 5777, - }, - }, - solidity: "0.8.24", + defaultNetwork: "hardhat", + networks: { + sepolia: { + url: RPC_URL_SEPOLIA, + accounts: [PRIVATE_KEY_SEPOLIA], + chainID: 11155111, + }, + ganache: { + url: RPC_URL_GANACHE, + accounts: [PRIVATE_KEY_GANACHE], + chainID: 5777, + }, + }, + solidity: "0.8.24", + etherscan: { + apiKey: ETHERSCAN_API_KEY, + }, }; - task("accounts", "Prints the list of accounts", async (taskArgs, hre) => { const accounts = await hre.ethers.getSigners(); diff --git a/package.json b/package.json index 5c91a85..f1ce984 100644 --- a/package.json +++ b/package.json @@ -27,4 +27,4 @@ "solidity-coverage": "^0.8.0", "typechain": "^8.3.0" } -} +} \ No newline at end of file diff --git a/scripts/deploy.js b/scripts/deploy.js index d3e193c..465cea7 100644 --- a/scripts/deploy.js +++ b/scripts/deploy.js @@ -11,6 +11,9 @@ async function main() { console.log("Deployed contract to: " + simpleStorage.address); } +// Auto verify contract in etherscan +//async function verify(contractAddress, args) {} + // main main() .then(() => process.getMaxListeners(0))