-
Notifications
You must be signed in to change notification settings - Fork 11
/
hardhat.config.ts
161 lines (145 loc) · 4.43 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
import { HardhatUserConfig } from 'hardhat/config';
import '@nomiclabs/hardhat-etherscan';
import '@nomiclabs/hardhat-ethers';
import '@typechain/hardhat';
import '@idle-finance/hardhat-proposals-plugin';
import 'solidity-coverage';
import 'tsconfig-paths/register';
import '@primitivefi/hardhat-dodoc';
import * as dotenv from 'dotenv';
dotenv.config();
const rinkebyAlchemyApiKey = process.env.RINKEBY_ALCHEMY_API_KEY;
const kovanAlchemyApiKey = process.env.KOVAN_ALCHEMY_API_KEY;
const testnetPrivateKey = process.env.TESTNET_PRIVATE_KEY;
const privateKey = process.env.ETH_PRIVATE_KEY;
const enableMainnetForking = process.env.ENABLE_MAINNET_FORKING;
const enableArbitrumForking = process.env.ENABLE_ARBITRUM_FORKING;
const mainnetAlchemyApiKey = process.env.MAINNET_ALCHEMY_API_KEY;
const arbitrumAlchemyApiKey = process.env.ARBITRUM_ALCHEMY_API_KEY;
const useJSONTestReporter = process.env.REPORT_TEST_RESULTS_AS_JSON;
if (enableArbitrumForking && !arbitrumAlchemyApiKey) {
throw new Error('Cannot fork arbitrum without arbitrum alchemy api key.');
} else if (enableArbitrumForking) {
console.log('arbitrum forking enabled');
}
if (enableMainnetForking) {
if (!mainnetAlchemyApiKey) {
throw new Error('Cannot fork mainnet without mainnet alchemy api key.');
}
console.log('Mainnet forking enabled.');
} else {
console.log('Mainnet forking disabled.');
}
if (useJSONTestReporter) {
console.log(`Reporting test results as JSON, you will not see them in the console.`);
}
export default {
dodoc: {
runOnCompile: false,
debugMode: false,
include: [
'contracts/core',
'contracts/libs',
'contracts/oracle',
'contracts/pcv',
'contracts/peg',
'contracts/refs',
'contracts/utils'
]
// More options...
},
etherscan: {
apiKey: {
// Your API key for Etherscan
// Obtain one at https://etherscan.io/ or https://arbiscan.io/
mainnet: process.env.ETHERSCAN_KEY,
arbitrumOne: process.env.ARBISCAN_KEY
}
},
gasReporter: {
enabled: !!process.env.REPORT_GAS
},
networks: {
hardhat: {
gas: 12e6,
chainId: 5777, // Any network (default: none)
forking: enableMainnetForking
? {
url: `https://eth-mainnet.alchemyapi.io/v2/${mainnetAlchemyApiKey}`
}
: enableArbitrumForking
? {
url: `https://arb-mainnet.g.alchemy.com/v2/${arbitrumAlchemyApiKey}`
}
: undefined
},
localhost: {
accounts: testnetPrivateKey ? [testnetPrivateKey] : [],
url: 'http://127.0.0.1:8545'
},
kovan: {
url: `https://eth-kovan.alchemyapi.io/v2/${kovanAlchemyApiKey}`,
accounts: testnetPrivateKey ? [testnetPrivateKey] : [],
gasPrice: 20000000000 // gas price that is paid for kovan transactions. currently 20 gigawei
},
rinkeby: {
url: `https://eth-rinkeby.alchemyapi.io/v2/${rinkebyAlchemyApiKey}`,
accounts: testnetPrivateKey ? [testnetPrivateKey] : []
},
arbitrumOne: {
url: `https://arb-mainnet.g.alchemy.com/v2/${arbitrumAlchemyApiKey}`,
accounts: privateKey ? [privateKey] : [],
gasPrice: 1000000000 // gas price that is paid for arbitrum transactions. currently .9 gigawei
},
mainnet: {
url: `https://eth-mainnet.alchemyapi.io/v2/${mainnetAlchemyApiKey}`,
accounts: privateKey ? [privateKey] : [],
gasPrice: 40000000000 // gas price that is paid for mainnet transactions. currently 40 gigawei
}
},
solidity: {
compilers: [
{
version: '0.8.10',
settings: {
optimizer: {
enabled: true,
runs: 200
}
}
},
{
version: '0.8.13',
settings: {
optimizer: {
enabled: true,
runs: 200
}
}
},
{
version: '0.4.18',
settings: {
optimizer: {
enabled: true,
runs: 200
}
}
}
]
},
mocha: {
timeout: 1000000,
reporter: useJSONTestReporter ? 'mocha-multi-reporters' : undefined,
reporterOptions: useJSONTestReporter
? {
configFile: 'mocha-reporter-config.json'
}
: undefined
},
typechain: {
outDir: './types/contracts/',
target: 'ethers-v5',
alwaysGenerateOverloads: false // should overloads with full signatures like deposit(uint256) be generated always, even if there are no overloads?
}
} as HardhatUserConfig;