Done Contract, Before Deploy

This commit is contained in:
2024-08-10 00:09:46 +08:00
parent f5a03faebd
commit 2320250d51
5 changed files with 121 additions and 21 deletions
+103 -2
View File
@@ -6,7 +6,108 @@ require("hardhat-gas-reporter");
require("hardhat-contract-sizer");
require("dotenv").config();
/** @type import('hardhat/config').HardhatUserConfig */
const RPC_URL_SEPOLIA = process.env.SEPOLIA_RPC_URL || "https://eth-sepolia";
const PRIVATE_KEY_SEPOLIA = process.env.SEPOLIA_PRIVATE_KEY || "0xkey";
const RPC_URL_GANACHE = process.env.LOCAL_RPC_URL || "http://192.168.1.10:7545";
const PRIVATE_KEY_GANACHE = process.env.LOCAL_PRIVATE_KEY || "0xkey";
const ETHERSCAN_API_KEY = process.env.ETHERSCAN_API_KEY || "Your etherscan API key";
const POLYGONSCAN_API_KEY = process.env.POLYGONSCAN_API_KEY || "Your polygonscan API key";
const COINMARKETCAP_API_KEY = process.env.COINMARKETCAP_API_KEY || "Your coinmarketcap API key";
const REPORT_GAS = process.env.REPORT_GAS || "true";
const REPORT_PRICE = process.env.REPORT_PRICE || "false";
// optional
const MNEMONIC = process.env.MNEMONIC || "your mnemonic";
module.exports = {
solidity: "0.8.24",
defaultNetwork: "hardhat",
networks: {
sepolia: {
url: RPC_URL_SEPOLIA,
accounts: [PRIVATE_KEY_SEPOLIA],
chainId: 11155111,
blockConfirmation: 6,
},
ganache: {
url: RPC_URL_GANACHE,
accounts: [PRIVATE_KEY_GANACHE],
chainId: 5777,
blockConfirmation: 1,
},
localhost: {
// Hardhost similar like ganache, can debug the transaction
// Start in terminal - yarn hardhat node
url: "http://127.0.0.1:8545/",
chainId: 31337,
blockConfirmation: 1,
},
},
etherscan: {
apiKey: ETHERSCAN_API_KEY,
customChains: [],
/*
// yarn hardhat verify --network <NETWORK> <CONTRACT_ADDRESS> <CONSTRUCTOR_PARAMETERS>
apiKey: {
sepolia: ETHERSCAN_API_KEY,
polygon: POLYGONSCAN_API_KEY,
},
customChains: [
{
network: "goerli",
chainId: 5,
urls: {
apiURL: "https://api-goerli.etherscan.io/api",
browserURL: "https://goerli.etherscan.io",
},
},
],
*/
},
sourcify: {
enabled: false,
},
gasReporter: {
enabled: REPORT_GAS === "true",
offline: REPORT_PRICE === "false",
coinmarketcap: COINMARKETCAP_API_KEY,
token: "ETH", // ETH, BNB, MATIC, AVAX, HT, MOVR - https://www.npmjs.com/package/hardhat-gas-reporter
currency: "USD",
//gasPrice: 10, // In case gasPriceApi not working https://etherscan.io/gastracker#chart_gasprice
gasPriceApi:
"https://api.etherscan.io/api?module=proxy&action=eth_gasPrice&apikey=" +
ETHERSCAN_API_KEY,
outputFile: "gas-report.txt",
noColors: true,
},
/*
contractSizer: {
runOnCompile: false,
only: ["Raffle"],
},
*/
namedAccounts: {
deployer: {
default: 0, // here this will by default take the first account as deployer
1: 0, // similarly on mainnet it will take the first account as deployer. Note though that depending on how hardhat network are configured, the account 0 on one network can be different than on another
},
player: {
default: 1,
},
},
solidity: {
compilers: [
{
version: "0.8.24",
},
],
},
/*
mocha: {
timeout: 500000, // 500 seconds max for running tests
},
*/
};
+4 -5
View File
@@ -1,16 +1,15 @@
{
"license": "Unlicense",
"devDependencies": {
"license": "Unlicense",
"devDependencies": {
"@nomicfoundation/hardhat-ethers": "^3.0.2",
"@nomiclabs/hardhat-ethers": "npm:hardhat-deploy-ethers",
"@nomiclabs/hardhat-ethers": "^2.2.3",
"@nomiclabs/hardhat-etherscan": "^3.1.8",
"@nomiclabs/hardhat-waffle": "^2.0.6",
"chai": "^5.1.1",
"dotenv": "^16.4.5",
"ethereum-waffle": "^4.0.10",
"ethers": "^6.13.2",
"hardhat": "^2.22.7",
"hardhat": "^2.22.8",
"hardhat-contract-sizer": "^2.10.0",
"hardhat-deploy": "^0.12.4",
"hardhat-gas-reporter": "^2.2.0",
+14 -14
View File
@@ -1827,7 +1827,7 @@
resolved "https://registry.yarnpkg.com/@nomicfoundation/edr-win32-x64-msvc/-/edr-win32-x64-msvc-0.5.2.tgz#f16db88bf4fe09a996af0a25096e09deecb72bfa"
integrity sha512-CcvvuA3sAv7liFNPsIR/68YlH6rrybKzYttLlMr80d4GKJjwJ5OKb3YgE6FdZZnOfP19HEHhsLcE0DPLtY3r0w==
"@nomicfoundation/edr@^0.5.0":
"@nomicfoundation/edr@^0.5.2":
version "0.5.2"
resolved "https://registry.yarnpkg.com/@nomicfoundation/edr/-/edr-0.5.2.tgz#e8c7b3d3dd4a312432ab3930dec60f76dc5c4926"
integrity sha512-hW/iLvUQZNTVjFyX/I40rtKvvDOqUEyIi96T28YaLfmPL+3LW2lxmYLUXEJ6MI14HzqxDqrLyhf6IbjAa2r3Dw==
@@ -1926,10 +1926,10 @@
"@nomicfoundation/solidity-analyzer-linux-x64-musl" "0.1.2"
"@nomicfoundation/solidity-analyzer-win32-x64-msvc" "0.1.2"
"@nomiclabs/hardhat-ethers@npm:hardhat-deploy-ethers":
version "0.4.2"
resolved "https://registry.yarnpkg.com/hardhat-deploy-ethers/-/hardhat-deploy-ethers-0.4.2.tgz#10aa44ef806ec8cf3d67ad9692f3762ed965b5e7"
integrity sha512-AskNH/XRYYYqPT94MvO5s1yMi+/QvoNjS4oU5VcVqfDU99kgpGETl+uIYHIrSXtH5sy7J6gyVjpRMf4x0tjLSQ==
"@nomiclabs/hardhat-ethers@^2.2.3":
version "2.2.3"
resolved "https://registry.yarnpkg.com/@nomiclabs/hardhat-ethers/-/hardhat-ethers-2.2.3.tgz#b41053e360c31a32c2640c9a45ee981a7e603fe0"
integrity sha512-YhzPdzb612X591FOe68q+qXVXGG2ANZRvDo0RRUtimev85rCrAlv/TLMEZw5c+kq9AbzocLTVX/h2jVIFPL9Xg==
"@nomiclabs/hardhat-etherscan@^3.1.8":
version "3.1.8"
@@ -5235,10 +5235,10 @@ dot-case@^2.1.0:
dependencies:
no-case "^2.2.0"
dotenv@^10.0.0:
version "10.0.0"
resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-10.0.0.tgz#3d4227b8fb95f81096cdd2b66653fb2c7085ba81"
integrity sha512-rlBi9d8jpv9Sf1klPjNfFAuWDjKLwTIJJ/VxtoTwIR6hnZxcEOQCZg2oIL3MWBYw5GpUDKOEnND7LXTbIpQ03Q==
dotenv@^16.4.5:
version "16.4.5"
resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-16.4.5.tgz#cdd3b3b604cb327e286b4762e13502f717cb099f"
integrity sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg==
dotenv@^8.1.0:
version "8.6.0"
@@ -7228,14 +7228,14 @@ hardhat-gas-reporter@^2.2.0:
sha1 "^1.1.1"
viem "2.7.14"
hardhat@^2.22.7:
version "2.22.7"
resolved "https://registry.yarnpkg.com/hardhat/-/hardhat-2.22.7.tgz#3de0ce5074063cf468876c5e62f84c66d2408e8e"
integrity sha512-nrXQAl+qUr75TsCLDo8P41YXLc+5U7qQMMCIrbbmy1/uQaVPncdjDrD5BR0CENvHRj7EBqO+JkofpozXoIfJKg==
hardhat@^2.22.8:
version "2.22.8"
resolved "https://registry.yarnpkg.com/hardhat/-/hardhat-2.22.8.tgz#348dcdb48c44648ae7723f6efb511785e2b220c5"
integrity sha512-hPh2feBGRswkXkoXUFW6NbxgiYtEzp/3uvVFjYROy6fA9LH8BobUyxStlyhSKj4+v1Y23ZoUBOVWL84IcLACrA==
dependencies:
"@ethersproject/abi" "^5.1.2"
"@metamask/eth-sig-util" "^4.0.0"
"@nomicfoundation/edr" "^0.5.0"
"@nomicfoundation/edr" "^0.5.2"
"@nomicfoundation/ethereumjs-common" "4.0.4"
"@nomicfoundation/ethereumjs-tx" "5.0.4"
"@nomicfoundation/ethereumjs-util" "9.0.4"