forked from AlphaWallet/stl-contracts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
hardhat.config.ts
209 lines (193 loc) · 6.03 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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
import "@nomiclabs/hardhat-waffle";
import "@nomicfoundation/hardhat-toolbox-viem";
import "@openzeppelin/hardhat-upgrades";
// import "@nomicfoundation/hardhat-chai-matchers";
import "@nomiclabs/hardhat-ethers";
require("dotenv").config();
/// ENVVAR
// - CI: output gas report to file instead of stdout
// - COVERAGE: enable coverage report
// - ENABLE_GAS_REPORT: enable gas report
// - COMPILE_MODE: production modes enables optimizations (default: development)
// - COMPILE_VERSION: compiler version (default: 0.8.9)
// - COINMARKETCAP: coinmarkercat api key for USD value in gas report
const argv = require("yargs/yargs")()
.env("")
.options({
coverage: {
type: "boolean",
default: false,
},
gas: {
alias: "enableGasReport",
type: "boolean",
default: false,
},
gasReport: {
alias: "enableGasReportPath",
type: "string",
implies: "gas",
default: undefined,
},
mode: {
alias: "compileMode",
type: "string",
choices: ["production", "development"],
default: "development",
},
ir: {
alias: "enableIR",
type: "boolean",
default: false,
},
compiler: {
alias: "compileVersion",
type: "string",
default: "0.8.13",
},
coinmarketcap: {
alias: "coinmarketcapApiKey",
type: "string",
},
}).argv;
const withOptimizations = argv.gas || argv.compileMode === "production";
// Go to https://www.alchemyapi.io, sign up, create
// a new App in its dashboard, and replace "KEY" with its key
let {
PRIVATE_KEY,
ALCHEMY_API_KEY,
ALCHEMY_RINKEBY_API_KEY,
ALCHEMY_ROPSTEN_API_KEY,
ETHERSCAN_API_KEY,
INFURA_API_KEY,
ARBISCAN_API_KEY,
POLYGONSCAN_API_KEY,
OPTIMISM_API_KEY,
ALCHEMY_ARBITRUM_API_KEY,
} = process.env;
PRIVATE_KEY = PRIVATE_KEY ? PRIVATE_KEY : "0x2222453C7891EDB92FE70662D5E45A453C7891EDB92FE70662D5E45A453C7891";
// if not defined .env then set empty API keys, we dont use it for tests
INFURA_API_KEY = INFURA_API_KEY ? INFURA_API_KEY : "";
ALCHEMY_API_KEY = ALCHEMY_API_KEY ? ALCHEMY_API_KEY : "";
ETHERSCAN_API_KEY = ETHERSCAN_API_KEY ? ETHERSCAN_API_KEY : "";
ALCHEMY_RINKEBY_API_KEY = ALCHEMY_RINKEBY_API_KEY ? ALCHEMY_RINKEBY_API_KEY : "";
ALCHEMY_ROPSTEN_API_KEY = ALCHEMY_ROPSTEN_API_KEY ? ALCHEMY_ROPSTEN_API_KEY : "";
ARBISCAN_API_KEY = ARBISCAN_API_KEY ? ARBISCAN_API_KEY : "";
POLYGONSCAN_API_KEY = POLYGONSCAN_API_KEY ? POLYGONSCAN_API_KEY : "";
OPTIMISM_API_KEY = OPTIMISM_API_KEY ? OPTIMISM_API_KEY : "";
ALCHEMY_ARBITRUM_API_KEY = ALCHEMY_ARBITRUM_API_KEY ? ALCHEMY_ARBITRUM_API_KEY : "";
/**
* @type import('hardhat/config').HardhatUserConfig
*/
let config = {
solidity: {
compilers: [
{
version: "0.8.20",
settings: {
optimizer: {
enabled: true,
runs: 200,
},
},
},
],
},
networks: {
hardhat: {
blockGasLimit: 10000000,
initialBaseFeePerGas: 0,
// allowUnlimitedContractSize: !withOptimizations,
},
goerli: {
// url: `https://goerli.infura.io/v3/${INFURA_API_KEY}`,
// url: `https://rpc.ankr.com/eth_goerli`,
url: `https://eth-goerli.public.blastapi.io`,
// url: `https://goerli.infura.io/v3/${INFURA_API_KEY}`,
accounts: [`${PRIVATE_KEY}`],
},
sepolia: {
url: `https://rpc.sepolia.org`,
// url: `https://goerli.infura.io/v3/${INFURA_API_KEY}`,
accounts: [`${PRIVATE_KEY}`],
},
rinkeby: {
// url: `https://eth-rinkeby.alchemyapi.io/v2/${ALCHEMY_RINKEBY_API_KEY}`,
url: `https://rinkeby.infura.io/v3/${INFURA_API_KEY}`,
accounts: [`${PRIVATE_KEY}`],
},
// "https://rpc-mumbai.maticvigil.com",
// "https://polygon-mumbai-bor.publicnode.com",
// "wss://polygon-mumbai-bor.publicnode.com",
// "https://polygon-mumbai.gateway.tenderly.co",
// "wss://polygon-mumbai.gateway.tenderly.co"
// "https://matic-mumbai.chainstacklabs.com"
polygonMumbai: {
url: `https://rpc-mumbai.maticvigil.com`, //ths RPC seems to work more consistently
accounts: [`${PRIVATE_KEY}`],
},
mainnet: {
// url: `https://eth-mainnet.alchemyapi.io/v2/${ALCHEMY_API_KEY}`,
url: `https://mainnet.infura.io/v3/${INFURA_API_KEY}`,
accounts: [`${PRIVATE_KEY}`],
},
bsc: {
url: `https://bsc-dataseed1.binance.org:443`,
accounts: [`${PRIVATE_KEY}`],
},
xdai: {
url: `https://rpc.xdaichain.com/`,
accounts: [`${PRIVATE_KEY}`],
},
polygon: {
// url: `https://polygon.infura.io/v3/${INFURA_API_KEY}`,
// url: `https://polygon-rpc.com`,
// url: `https://matic-mainnet.chainstacklabs.com`,
url: `https://polygon-mainnet.infura.io/v3/${INFURA_API_KEY}`,
accounts: [`${PRIVATE_KEY}`],
},
arbitrumOne: {
// url: `https://arbitrum.public-rpc.com`,
// ALCHEMY_ARBITRUM_API_KEY
// url: `https://arb-mainnet.g.alchemy.com/v2/${ALCHEMY_ARBITRUM_API_KEY}`,
url: `https://arb1.arbitrum.io/rpc`,
accounts: [`${PRIVATE_KEY}`],
},
arbitrumTestnet: {
url: `https://rinkeby.arbitrum.io/rpc`,
accounts: [`${PRIVATE_KEY}`],
},
optimisticEthereum: {
url: `https://mainnet.optimism.io`,
accounts: [`${PRIVATE_KEY}`],
},
},
etherscan: {
enabled: true,
// Your API key for Etherscan
// Obtain one at https://etherscan.io/
apiKey: {
mainnet: `${ETHERSCAN_API_KEY}`,
goerli: `${ETHERSCAN_API_KEY}`,
arbitrumTestnet: `${ARBISCAN_API_KEY}`,
arbitrumOne: `${ARBISCAN_API_KEY}`,
polygonMumbai: `${POLYGONSCAN_API_KEY}`,
polygon: `${POLYGONSCAN_API_KEY}`,
optimisticEthereum: `${OPTIMISM_API_KEY}`,
},
},
};
if (argv.gas) {
require("hardhat-gas-reporter");
module.exports.gasReporter = {
showMethodSig: true,
currency: "USD",
outputFile: argv.gasReport,
coinmarketcap: argv.coinmarketcap,
};
}
if (argv.coverage) {
require("solidity-coverage");
// config.networks.hardhat["initialBaseFeePerGas"] = 0;
}
export default config;