-
Notifications
You must be signed in to change notification settings - Fork 0
/
hardhat.config.ts
129 lines (124 loc) · 3.63 KB
/
hardhat.config.ts
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
require("dotenv").config();
import "@nomiclabs/hardhat-truffle5";
import "@nomiclabs/hardhat-ethers";
import "@openzeppelin/hardhat-upgrades";
import "@openzeppelin/hardhat-defender";
import { task } from "hardhat/config";
import "@nomiclabs/hardhat-waffle";
import "hardhat-contract-sizer";
import "hardhat-typechain";
import "hardhat-deploy";
import "@nomiclabs/hardhat-etherscan";
import "hardhat-gas-reporter";
import "solidity-coverage";
// dotenv.config({ path: '.' + '/.env' });
const enableGasReport = !!process.env.ENABLE_GAS_REPORT;
// This is a sample Buidler task. To learn how to create your own go to
// https://buidler.dev/guides/create-task.html
task("accounts", "Prints the list of accounts", async (args, hre) => {
const accounts = await hre.ethers.getSigners();
for (const account of accounts) {
console.log(await account.getAddress());
}
});
export default {
defender: {
apiKey: process.env.DEFENDER_TEAM_API_KEY,
apiSecret: process.env.DEFENDER_TEAM_API_SECRET_KEY,
},
contractSizer: {
alphaSort: true,
runOnCompile: true,
disambiguatePaths: false,
},
optimizer: {
enabled: true,
runs: 200,
},
// defaultNetwork: "hardhat",
networks: {
hardhat: {
allowUnlimitedContractSize: true,
loggingEnabled: false,
},
localhost: {
url: "http://127.0.0.1:8545", // same address and port for both Buidler and Ganache node
gas: 8000000,
gasLimit: 8000000,
gasPrice: 1,
},
mainnet: {
url: `https://eth-mainnet.alchemyapi.io/v2/${process.env.MAINNET_ALCHEMY_API_KEY}`,
accounts: [`0x${process.env.PRIVATE_KEY}`],
throwOnTransactionFailures: true,
loggingEnabled: true,
gas: 5000000,
gasPrice: 50000000000, // 50 gwei, ref: https://etherscan.io/gastracker
blockGasLimit: 8000000,
timeout: 3600000
},
kovan: {
url: `https://eth-kovan.alchemyapi.io/v2/${process.env.KOVAN_ALCHEMY_API_KEY}`,
accounts: [`0x${process.env.PRIVATE_KEY}`],
throwOnTransactionFailures: true,
loggingEnabled: true,
},
goerli: {
url: `https://eth-goerli.alchemyapi.io/v2/${process.env.GOERLI_ALCHEMY_API_KEY}`,
accounts: [`0x${process.env.PRIVATE_KEY}`],
throwOnTransactionFailures: true,
loggingEnabled: true,
gas: 5000000,
gasPrice: 200000000000,
blockGasLimit: 8000000,
timeout: 10800000
},
rinkeby: {
url: `https://eth-rinkeby.alchemyapi.io/v2/${process.env.RINKEBY_ALCHEMY_API_KEY}`,
accounts: [`0x${process.env.PRIVATE_KEY}`],
throwOnTransactionFailures: true,
loggingEnabled: true,
gasPrice: 10000000000
},
mumbai: {
url: `https://polygon-mumbai.g.alchemy.com/v2/${process.env.POLYGON_TESTNET_ALCHEMY_API_KEY}`,
accounts: [`0x${process.env.PRIVATE_KEY}`],
throwOnTransactionFailures: true,
loggingEnabled: true,
},
polygon: {
url: `https://polygon-mainnet.g.alchemy.com/v2/${process.env.POLYGON_MAINNET_ALCHEMY_API_KEY}`,
accounts: [`0x${process.env.PRIVATE_KEY}`],
throwOnTransactionFailures: true,
loggingEnabled: true,
}
},
namedAccounts: {
deployer: 0,
},
paths: {
sources: 'contracts',
},
etherscan: {
// Your API key for Etherscan
// Obtain one at https://etherscan.io/
apiKey: process.env.ETHERSCAN_API_KEY,
},
solidity: {
version: "0.8.4",
settings: {
optimizer: {
enabled: true,
},
},
},
typechain: {
outDir: "types",
target: "ethers-v5",
},
gasReporter: {
enable: enableGasReport,
currency: "USD",
outputFile: process.env.CI ? "gas-report.txt" : undefined,
},
};