forked from fei-protocol/fei-protocol-core
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhardhat.config.ts
124 lines (107 loc) · 3.28 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
import { HardhatUserConfig } from 'hardhat/config';
import '@nomiclabs/hardhat-waffle';
import '@nomiclabs/hardhat-ethers';
import '@typechain/hardhat';
import '@idle-finance/hardhat-proposals-plugin';
import 'hardhat-gas-reporter';
import 'hardhat-contract-sizer';
import 'solidity-coverage';
import 'tsconfig-paths/register';
import * as dotenv from 'dotenv';
dotenv.config();
const rinkebyAlchemyApiKey = process.env.RINKEBY_ALCHEMY_API_KEY;
const testnetPrivateKey = process.env.TESTNET_PRIVATE_KEY;
const privateKey = process.env.ETH_PRIVATE_KEY;
const runE2ETests = process.env.RUN_E2E_TESTS;
const enableMainnetForking = process.env.ENABLE_MAINNET_FORKING;
const mainnetAlchemyApiKey = process.env.MAINNET_ALCHEMY_API_KEY;
const runAllTests = process.env.RUN_ALL_TESTS;
const useJSONTestReporter = process.env.REPORT_TEST_RESULTS_AS_JSON;
if (!(process.env.NODE_OPTIONS && process.env.NODE_OPTIONS.includes('max-old-space-size'))) {
throw new Error(
`Please export node env var max-old-space-size before running hardhat. "export NODE_OPTIONS=--max-old-space-size=4096"`
);
}
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 {
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}`,
blockNumber: 14635776 // Thursday, April 21st
}
: undefined
},
localhost: {
url: 'http://127.0.0.1:8545'
},
rinkeby: {
url: `https://eth-rinkeby.alchemyapi.io/v2/${rinkebyAlchemyApiKey}`,
accounts: testnetPrivateKey ? [testnetPrivateKey] : []
},
mainnet: {
url: `https://eth-mainnet.alchemyapi.io/v2/${mainnetAlchemyApiKey}`,
accounts: privateKey ? [privateKey] : [],
gasPrice: 150000000000
}
},
solidity: {
compilers: [
{
version: '0.8.10',
settings: {
optimizer: {
enabled: true,
runs: 200
}
}
},
{
version: '0.4.18',
settings: {
optimizer: {
enabled: true,
runs: 200
}
}
}
]
},
paths: {
tests: runAllTests ? './test/' : runE2ETests ? './test/integration/' : './test/unit/'
},
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?
},
proposals: {
governor: '0x0BEF27FEB58e857046d630B2c03dFb7bae567494',
votingToken: '0xc7283b66Eb1EB5FB86327f08e1B5816b0720212B'
}
} as HardhatUserConfig;