-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathhardhat.config.js
105 lines (96 loc) · 3.45 KB
/
hardhat.config.js
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
require('@nomicfoundation/hardhat-toolbox');
require('solidity-coverage');
if (process.env.STORAGE_LAYOUT) {
require('hardhat-storage-layout');
}
if (process.env.CHECK_CONTRACT_SIZE) {
require('hardhat-contract-sizer');
}
const { importNetworks, readJSON } = require('@axelar-network/axelar-chains-config');
const env = process.env.ENV || 'testnet';
const chains = require(`@axelar-network/axelar-chains-config/info/${env}.json`);
const keys = readJSON(`${__dirname}/keys.json`);
const { networks, etherscan } = importNetworks(chains, keys);
networks.hardhat.hardfork = process.env.EVM_VERSION || 'london';
const optimizerSettings = {
enabled: true,
runs: 1000000,
details: {
peephole: process.env.COVERAGE === undefined,
inliner: process.env.COVERAGE === undefined,
jumpdestRemover: true,
orderLiterals: true,
deduplicate: true,
cse: process.env.COVERAGE === undefined,
constantOptimizer: true,
yul: true,
yulDetails: {
stackAllocation: true,
},
},
};
// Need to manually specify outputSelection settings for the hardhat-storage-layout plugin since we're using customized compiler settings.
// https://www.npmjs.com/package/hardhat-storage-layout?activeTab=code
const outputSelectionSettings = process.env.STORAGE_LAYOUT
? {
'*': {
'*': ['storageLayout'],
},
}
: {};
const defaultSettings = {
version: '0.8.23',
settings: {
evmVersion: process.env.EVM_VERSION || 'london',
optimizer: optimizerSettings,
outputSelection: outputSelectionSettings,
},
};
// Some contracts use fixed compiler settings to ensure deterministic bytecodes across versions
const compilerSettings = {
version: '0.8.19',
settings: {
evmVersion: process.env.EVM_VERSION || 'london',
optimizer: optimizerSettings,
outputSelection: outputSelectionSettings,
},
};
/**
* @type import('hardhat/config').HardhatUserConfig
*/
module.exports = {
solidity: {
compilers: [defaultSettings],
// Fix compiler settings for contracts that aren't being changed
// Allow skipping overrides for Slither to work correctly
overrides: process.env.NO_OVERRIDES
? {}
: {
'contracts/deploy/ConstAddressDeployer.sol': compilerSettings,
'contracts/deploy/Create2Deployer.sol': compilerSettings,
'contracts/deploy/Create3Deployer.sol': compilerSettings,
'contracts/upgradable/Proxy.sol': compilerSettings,
'contracts/upgradable/InitProxy.sol': compilerSettings,
'contracts/upgradable/FinalProxy.sol': compilerSettings,
'contracts/upgradable/FixedProxy.sol': compilerSettings,
'contracts/governance/InterchainGovernance.sol': compilerSettings,
'contracts/governance/Multisig.sol': compilerSettings,
'contracts/utils/Operators.sol': compilerSettings,
},
},
defaultNetwork: 'hardhat',
networks,
etherscan,
mocha: {
timeout: 4 * 60 * 60 * 1000, // 4 hrs
},
gasReporter: {
enabled: process.env.REPORT_GAS !== undefined,
excludeContracts: ['contracts/test'],
},
contractSizer: {
runOnCompile: process.env.CHECK_CONTRACT_SIZE,
strict: process.env.CHECK_CONTRACT_SIZE,
except: ['contracts/test'],
},
};