-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuidler.config.ts
101 lines (94 loc) · 3.04 KB
/
buidler.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
// @ts-ignore
import {usePlugin} from '@nomiclabs/buidler/config';
import path from 'path';
import fs from 'fs';
import {accounts} from './test-wallets';
import {eEthereumNetwork} from './helpers/types';
usePlugin('@nomiclabs/buidler-ethers');
usePlugin('buidler-typechain');
usePlugin('solidity-coverage');
usePlugin('@nomiclabs/buidler-waffle');
usePlugin('@nomiclabs/buidler-etherscan');
usePlugin('solidity-coverage');
['misc', 'deployments', 'migrations'].forEach((folder) => {
const tasksPath = path.join(__dirname, 'tasks', folder);
fs.readdirSync(tasksPath).forEach((task) => require(`${tasksPath}/${task}`));
});
export const BUIDLEREVM_CHAIN_ID = 31337;
const DEFAULT_BLOCK_GAS_LIMIT = 12500000;
const DEFAULT_GAS_PRICE = 50000000000; // 50 gwei
const HARDFORK = 'istanbul';
const INFURA_KEY = process.env.INFURA_KEY || '';
const ETHERSCAN_KEY = process.env.ETHERSCAN_KEY || '';
const MNEMONIC_PATH = "m/44'/60'/0'/0";
const MNEMONICS: {[network: string]: string} = {
[eEthereumNetwork.kovan]: process.env.MNEMONIC || '',
[eEthereumNetwork.ropsten]: process.env.MNEMONIC || '',
[eEthereumNetwork.main]: process.env.MNEMONIC || '',
};
const getCommonNetworkConfig = (networkName: eEthereumNetwork, networkId: number) => {
return {
url: `https://${networkName}.infura.io/v3/${INFURA_KEY}`,
hardfork: HARDFORK,
blockGasLimit: DEFAULT_BLOCK_GAS_LIMIT,
gasPrice: DEFAULT_GAS_PRICE,
chainId: networkId,
accounts: {
mnemonic: MNEMONICS[networkName],
path: MNEMONIC_PATH,
initialIndex: 0,
count: 20,
},
};
};
const config = {
solc: {
version: '0.6.12',
optimizer: {enabled: true, runs: 200},
evmVersion: 'istanbul',
},
typechain: {
outDir: 'types',
target: 'ethers-v4',
},
etherscan: {
apiKey: ETHERSCAN_KEY,
},
defaultNetwork: 'localhost',
// defaultNetwork: 'buidlerevm',
mocha: {
timeout: 0,
},
networks: {
kovan: getCommonNetworkConfig(eEthereumNetwork.kovan, 42),
ropsten: getCommonNetworkConfig(eEthereumNetwork.ropsten, 3),
main: getCommonNetworkConfig(eEthereumNetwork.main, 1),
buidlerevm: {
hardfork: 'istanbul',
blockGasLimit: DEFAULT_BLOCK_GAS_LIMIT,
gas: 2000000,
gasPrice: DEFAULT_GAS_PRICE,
chainId: BUIDLEREVM_CHAIN_ID,
throwOnTransactionFailures: true,
throwOnCallFailures: true,
loggingEnabled: true,
accounts: accounts.map(({secretKey, balance}: { secretKey: string; balance: string }) => ({
privateKey: secretKey,
balance,
})),
},
ganache: {
url: 'http://ganache:8545',
accounts: {
mnemonic: 'fox sight canyon orphan hotel grow hedgehog build bless august weather swarm',
path: "m/44'/60'/0'/0",
initialIndex: 0,
count: 20,
},
},
coverage: {
url: 'http://localhost:8555',
},
},
};
export default config;