-
Notifications
You must be signed in to change notification settings - Fork 0
/
hardhat.config.js
168 lines (135 loc) · 3.21 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
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
162
163
164
165
166
167
168
require('dotenv').config();
const fs = require('fs');
require("@nomiclabs/hardhat-waffle");
const mNodeKey = process.env.MORALIS_KEY;
const aMNodeKey = process.env.ALCHEMY_OPTM_KEY;
const aTNodeKey = process.env.ALCHEMY_OPTT_KEY;
function getProvider(chainId) {
const mRegions = ["speedy-nodes-nyc"];
const mUrl = `https://${mRegions[0]}.moralis.io/${mNodeKey}/`;
const aUrl = `g.alchemy.com/v2/`;
switch (chainId) {
case 1:
return mUrl + "eth/mainnet";
case 10:
return "https://opt-mainnet." + aUrl + aMNodeKey;
case 3:
return mUrl + "eth/ropsten";
case 4:
return mUrl + "eth/rinkeby";
case 42:
return mUrl + "eth/kovan";
case 420:
return mUrl + "eth/goerli";
case 69:
return "https://opt-kovan." + aUrl + aTNodeKey;
case 42161:
return mUrl + "arbitrum/mainnet";
case 421611:
return mUrl + "arbitrum/testnet";
case 56:
return mUrl + "bsc/mainnet";
case 97:
return mUrl + "bsc/testnet";
case 137:
return mUrl + "polygon/mainnet";
case 80001:
return mUrl + "polygon/mumbai";
case 43114:
return mUrl + "avalanche/mainnet";
case 43113:
return mUrl + "avalanche/testnet";
case 250:
return mUrl + "fantom/mainnet";
default:
return "unsupported/chainId";
}
}
const mainnetAccount = [process.env.MAINNET_KEY];
const bank = fs.readFileSync("./data/testnetBank.json");
const testnetAccounts = (JSON.parse(bank)).privateKeys;
module.exports = {
defaultNetwork: "localhost",
networks: {
ethereum: {
url: getProvider(1),
accounts: mainnetAccount
},
optimism: {
url: getProvider(10),
accounts: mainnetAccount
},
ropsten: {
url: getProvider(3),
accounts: testnetAccounts
},
rinkeby: {
url: getProvider(4),
accounts: testnetAccounts
},
kovan: {
url: getProvider(42),
accounts: testnetAccounts
},
goerli: {
url: getProvider(420),
accounts: testnetAccounts
},
optimismKovan: {
url: getProvider(69),
accounts: testnetAccounts
},
arbitrum: {
url: getProvider(42161),
accounts: mainnetAccount
},
arbitrumTestnet: {
url: getProvider(421611),
accounts: testnetAccounts
},
binance: {
url: getProvider(56),
accounts: mainnetAccount
},
binanceTestnet: {
url: getProvider(97),
accounts: testnetAccounts
},
polygon: {
url: getProvider(137),
accounts: mainnetAccount
},
mumbai: {
url: getProvider(80001),
accounts: testnetAccounts
},
avalanche: {
url: getProvider(43114),
accounts: mainnetAccount
},
avalancheTestnet: {
url: getProvider(43113),
accounts: testnetAccounts
},
fantom: {
url: getProvider(250),
accounts: mainnetAccount
}
},
solidity: {
version: "0.8.4",
settings: {
optimizer: {
enabled: true,
runs:200
}
}
},
paths: {
sources: "./src/solidity/contracts",
tests: "./src/solidity/test",
cache: "./src/solidity/cache",
artifacts: "./src/solidity/artifacts"
},
mocha: { timeout: 40000 }
};