-
Notifications
You must be signed in to change notification settings - Fork 0
/
hardhat.config.ts
139 lines (136 loc) · 3.67 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
import 'dotenv/config';
import '@nomiclabs/hardhat-waffle';
import '@nomiclabs/hardhat-ethers';
import '@nomiclabs/hardhat-etherscan';
import '@typechain/hardhat';
import '@typechain/hardhat/dist/type-extensions';
import 'hardhat-gas-reporter';
import 'hardhat-contract-sizer';
import 'hardhat-deploy';
import 'solidity-coverage';
import { HardhatUserConfig, NetworksUserConfig } from 'hardhat/types';
import * as env from './utils/env';
import 'tsconfig-paths/register';
import { addressRegistry } from 'utils/constants';
const networks: NetworksUserConfig =
env.isHardhatCompile() || env.isHardhatClean() || env.isTestingLocal()
? {}
: {
hardhat: {
forking: {
enabled: process.env.FORK ? true : false,
url: env.getNodeUrl('sepolia'),
},
chainId: 11155111,
companionNetworks: {
receiver: 'hardhat',
},
},
ethereum: {
url: env.getNodeUrl('ethereum'),
accounts: env.getAccounts('ethereum'),
chainId: 1,
companionNetworks: {
receiver: 'optimism',
// receiver: 'polygon', // Uncomment to select as sidechain
},
},
optimism: {
url: env.getNodeUrl('optimism'),
accounts: env.getAccounts('ethereum'),
chainId: 10,
companionNetworks: { sender: 'ethereum' },
},
polygon: {
url: env.getNodeUrl('polygon'),
accounts: env.getAccounts('ethereum'),
chainId: 137,
companionNetworks: { sender: 'ethereum' },
},
sepolia: {
url: env.getNodeUrl('sepolia'),
accounts: env.getAccounts('test'),
chainId: 11155111,
companionNetworks: {
receiver: 'optimisticSepolia',
},
},
sepoliaDummy: {
url: env.getNodeUrl('sepolia'),
accounts: env.getAccounts('test'),
chainId: 11155111,
companionNetworks: {
receiver: 'sepoliaDummy',
},
},
optimisticSepolia: {
url: env.getNodeUrl('optimisticSepolia'),
accounts: env.getAccounts('test'),
chainId: 11155420,
companionNetworks: {
sender: 'sepolia',
},
},
};
const config: HardhatUserConfig = {
defaultNetwork: 'hardhat',
namedAccounts: {
deployer: {
default: 0,
},
...addressRegistry,
},
mocha: {
timeout: process.env.MOCHA_TIMEOUT || 300000,
},
networks,
solidity: {
compilers: [
{
version: '0.8.15',
settings: {
optimizer: {
enabled: true,
runs: 200,
},
},
},
],
},
contractSizer: {
alphaSort: true,
disambiguatePaths: false,
runOnCompile: false,
strict: true,
only: ['solidity/contracts/'],
except: ['solidity/contracts/for-test/'],
},
gasReporter: {
currency: process.env.COINMARKETCAP_DEFAULT_CURRENCY || 'USD',
coinmarketcap: process.env.COINMARKETCAP_API_KEY,
enabled: process.env.REPORT_GAS ? true : false,
showMethodSig: true,
onlyCalledMethods: false,
},
etherscan: {
apiKey: env.getEtherscanAPIKeys(['ethereum', 'optimisticEthereum', 'polygon', 'sepolia', 'optimisticSepolia']),
customChains: [
{
network: 'optimisticSepolia',
chainId: 11155420,
urls: {
apiURL: 'https://api-sepolia-optimistic.etherscan.io/api',
browserURL: 'https://sepolia-optimism.etherscan.io',
},
},
],
},
typechain: {
outDir: 'typechained',
target: 'ethers-v5',
},
paths: {
sources: './solidity',
},
};
export default config;