-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathhardhat.config.js
76 lines (70 loc) · 1.8 KB
/
hardhat.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
require("@nomicfoundation/hardhat-toolbox");
require("@openzeppelin/hardhat-upgrades");
require("hardhat-contract-sizer");
require("hardhat-gas-reporter");
require("dotenv").config();
const MAINNET_PRIVATE_KEY = process.env.MAINNET_PRIVATE_KEY || "";
const MUMBAI_PRIVATE_KEY = process.env.MUMBAI_PRIVATE_KEY || "";
const POLYGON_PRIVATE_KEY = process.env.POLYGON_PRIVATE_KEY || "";
const POLYGONSCAN_API_KEY = process.env.POLYGONSCAN_API_KEY || "";
const ETHERSCAN_API_KEY = process.env.ETHERSCAN_API_KEY || "";
const INFURA_API_KEY = process.env.INFURA_API_KEY || "";
const exportNetworks = {
hardhat: {
accounts: {
accountsBalance: "1000000000000000000000000000000000",
},
},
};
if (MUMBAI_PRIVATE_KEY != "") {
exportNetworks["mumbai"] = {
url: "https://polygon-testnet-rpc.allthatnode.com:8545",
accounts: [`${MUMBAI_PRIVATE_KEY}`],
};
}
if (POLYGON_PRIVATE_KEY != "") {
exportNetworks["polygon"] = {
url: "https://polygon-rpc.com",
accounts: [`${POLYGON_PRIVATE_KEY}`],
};
}
if (MAINNET_PRIVATE_KEY != "") {
exportNetworks["mainnet"] = {
url: `https://mainnet.infura.io/v3/${INFURA_API_KEY}`,
accounts: [`${MAINNET_PRIVATE_KEY}`]
}
}
module.exports = {
solidity: {
compilers: [
{
version: "0.8.28",
settings: {
optimizer: {
enabled: true,
runs: 1000000,
},
},
},
],
},
paths: {sources: "./contracts/hardhat/contracts"},
defaultNetwork: "hardhat",
networks: exportNetworks,
etherscan: {
apiKey: {
mumbai: POLYGONSCAN_API_KEY,
polygon: POLYGONSCAN_API_KEY,
mainnet: ETHERSCAN_API_KEY,
},
},
contractSizer: {
alphaSort: true,
runOnCompile: true,
disambiguatePaths: false,
},
gasReporter: {
enabled: true,
currency: "USD",
},
};