-
Notifications
You must be signed in to change notification settings - Fork 26
/
hardhat.config.ts
118 lines (115 loc) · 2.76 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
import fs from 'fs';
import './tasks/balance';
import './tasks/deploy';
import '@nomiclabs/hardhat-ethers';
import '@nomiclabs/hardhat-etherscan';
import '@nomicfoundation/hardhat-toolbox';
import '@openzeppelin/hardhat-upgrades';
import '@typechain/hardhat';
import 'dotenv/config';
import 'hardhat-watcher';
import 'hardhat-contract-sizer';
import 'hardhat-gas-reporter';
import 'hardhat-abi-exporter';
import 'hardhat-preprocessor';
function getRemappings() {
return fs
.readFileSync('remappings.txt', 'utf8')
.split('\n')
.filter(Boolean)
.map((line) => line.trim().split('='));
}
const ALCHEMY_API_KEY = process.env.ALCHEMY_API_KEY;
/**
* @type import('hardhat/config').HardhatUserConfig
*/
module.exports = {
// localNetworksConfig: './networks.ts',
solidity: {
compilers: [
{
version: '0.8.10',
},
],
},
defaultNetwork: 'hardhat',
networks: {
hardhat: {
gasPrice: 0,
initialBaseFeePerGas: 0,
allowUnlimitedContractSize: true,
chainId: 1337,
forking: {
url: `https://eth-mainnet.alchemyapi.io/v2/${ALCHEMY_API_KEY}`,
blockNumber: parseInt(process.env.ALCHEMY_BLOCK),
},
},
localhost: {
gasPrice: 0,
},
goerli: {
url: `https://eth-goerli.alchemyapi.io/v2/${ALCHEMY_API_KEY}`,
chainId: 5,
accounts: [process.env.GOERLI_PRIVATE_KEY],
},
sepolia: {
url: `https://rpc.sepolia.org`,
chainId: 11155111,
accounts: [process.env.SEPOLIA_PRIVATE_KEY],
},
mordor: {
url: 'https://www.ethercluster.com/mordor',
chainId: 63,
accounts: [process.env.MORDOR_PRIVATE_KEY],
},
},
etherscan: {
apiKey: {
goerli: `${process.env.ETHERSCAN_API_KEY}`,
sepolia: `${process.env.ETHERSCAN_API_KEY}`,
bscTestnet: `${process.env.BSCSCAN_API_KEY}`,
bsc: `${process.env.BSCSCAN_API_KEY}`,
},
},
watcher: {
compilation: {
tasks: ['compile'],
},
node: {
tasks: [
'compile',
{ command: 'compile', params: { quiet: true } },
'node',
{ command: 'node', params: { noCompile: true } },
],
},
},
gasReporter: {
enabled: process.env.REPORT_GAS ? true : false,
},
contractSizer: {
alphaSort: true,
runOnCompile: process.env.REPORT_SIZE ? true : false,
disambiguatePaths: false,
},
abiExporter: {
path: './abi/',
clear: true,
only: [''],
spacing: 2,
},
preprocess: {
eachLine: () => ({
transform: (line: string) => {
if (line.match(/^\s*import /i)) {
getRemappings().forEach(([find, replace]) => {
if (line.match(find)) {
line = line.replace(find, replace);
}
});
}
return line;
},
}),
},
};