-
Notifications
You must be signed in to change notification settings - Fork 118
/
hardhat.config.cjs
57 lines (53 loc) · 1.45 KB
/
hardhat.config.cjs
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
const {loadEnv} = require('ldenv');
loadEnv();
require('@nomicfoundation/hardhat-network-helpers');
const {addForkConfiguration, addNetworksFromEnv} = require('hardhat-rocketh');
const {task} = require('hardhat/config');
// we override the node task to set up our block time interval
// setting it up in the config below would also set it in tests and we do not want that
task('node').setAction(async (args, hre, runSuper) => {
if (process.env['BLOCK_TIME']) {
hre.config.networks.hardhat.mining = hre.config.networks.hardhat.mining || {};
hre.config.networks.hardhat.mining.auto = true;
hre.config.networks.hardhat.mining.interval = parseInt(process.env['BLOCK_TIME']) * 1000;
}
return runSuper(args);
});
const defaultVersion = '0.8.25';
const defaultSettings = {
optimizer: {
enabled: true,
runs: 999999,
},
viaIR: true,
outputSelection: {
'*': {
'*': ['evm.methodIdentifiers'],
},
},
};
const config = {
solidity: {
compilers: [
{
version: defaultVersion,
settings: {...defaultSettings},
},
],
},
networks:
// this setup forking for netwoirk if env var HARDHAT_FORK is set
addForkConfiguration(
// this add network for each respective env var found (ETH_NODE_URI_<network>)
addNetworksFromEnv({
hardhat: {
initialBaseFeePerGas: process.env.HARDHAT_FORK ? 1 : 0,
allowUnlimitedContractSize: process.env.HARDHAT_FORK ? false : true,
},
}),
),
paths: {
sources: 'src',
},
};
module.exports = config;