-
Notifications
You must be signed in to change notification settings - Fork 1
/
hardhat.config.ts
110 lines (106 loc) · 3.03 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
import * as dotenv from 'dotenv';
dotenv.config();
import { task, HardhatUserConfig } from 'hardhat/config';
import '@nomiclabs/hardhat-waffle';
import 'solidity-coverage';
import 'hardhat-gas-reporter';
import '@typechain/hardhat';
import '@nomiclabs/hardhat-ethers';
import 'hardhat-deploy';
import 'hardhat-contract-sizer';
import { removeConsoleLog } from 'hardhat-preprocessor';
import { nodeUrl, accounts } from './utils/network';
import { ethers } from 'hardhat';
import { utils } from 'ethers';
// This is a sample Hardhat task. To learn how to create your own go to
// https://hardhat.org/guides/create-task.html
task('accounts', 'Prints the list of accounts', async (taskArgs, hre) => {
const accounts = await hre.ethers.getSigners();
for (const account of accounts) {
console.log(account.address);
}
});
const config: HardhatUserConfig = {
defaultNetwork: 'hardhat',
paths: {
sources: './contracts',
tests: './test',
artifacts: './build/artifacts',
cache: './build/cache',
deploy: './scripts/deploy',
},
solidity: {
compilers: [
{
version: '0.8.0',
settings: {
optimizer: {
enabled: false, // TODO: process.env.TEST
runs: 200,
},
},
},
],
},
mocha: {
timeout: 20000,
},
gasReporter: {
currency: 'USD',
coinmarketcap: process.env.COINMARKETCAP_API_KEY,
enabled: process.env.REPORT_GAS ? true : false,
showMethodSig: true,
onlyCalledMethods: false,
},
typechain: {
outDir: 'typechained',
target: 'ethers-v5',
},
networks: {
hardhat: {
gasPrice: 50954251693,
chainId: 1337, // temporary for MetaMask support: https://github.com/MetaMask/metamask-extension/issues/10290
forking: {
url: nodeUrl('mainnet'),
blockNumber: 13000000, // (Aug-10-2021 09:53:39 PM +UTC) post London fork
},
accounts: [
{
privateKey: '0xc5e8f61d1ab959b397eecc0a37a6517b8e67a0e7cf1f4bce5591f3ed80199122', // cryptodipto
balance: utils.parseEther('1000').toString(),
},
{
privateKey: '0xc5e8f61d1ab959b397eecc0a37a6517b8e67a0e7cf1f4bce5591f3ed80199121', // alice
balance: utils.parseEther('1000').toString(),
},
],
},
localhost: {
url: nodeUrl('localhost'),
},
rinkeby: {
url: nodeUrl('rinkeby'),
accounts: accounts('rinkeby'),
},
// can configure other networks, see examples:
// https://github.com/wighawag/template-ethereum-contracts/blob/main/hardhat.config.ts
},
namedAccounts: {
deployer: {
default: 0, // by default, take the first account as deployer
rinkeby: '0x5238A644636946963ffeDAc52Ec53fb489D3a1CD', // on rinkeby, use a specific account
},
},
contractSizer: {
alphaSort: true,
disambiguatePaths: false,
runOnCompile: true,
strict: true,
},
preprocess: {
eachLine: removeConsoleLog(
(hre) => hre.network.name !== 'hardhat' && hre.network.name !== 'localhost'
),
},
};
export default config;