-
Notifications
You must be signed in to change notification settings - Fork 0
/
truffle-config.js
57 lines (53 loc) · 1.4 KB
/
truffle-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
const path = require('path');
const HDWalletProvider = require('@truffle/hdwallet-provider');
const fs = require('fs');
const mnemonic = fs.readFileSync('.secret').toString().trim();
if (!mnemonic || mnemonic.split(' ').length !== 12) {
throw new Error('unable to retrieve mnemonic from .secret');
}
const gasPriceTestnetRaw = fs
.readFileSync('.gas-price-testnet.json')
.toString()
.trim();
const gasPriceTestnet = parseInt(JSON.parse(gasPriceTestnetRaw).result, 16);
if (typeof gasPriceTestnet !== 'number' || isNaN(gasPriceTestnet)) {
throw new Error(
'unable to retrieve network gas price from .gas-price-testnet.json',
);
}
module.exports = {
contracts_build_directory: path.join(__dirname, 'src/ethereum/abis'),
networks: {
develop: {
port: 8545,
network_id: 31,
},
mainnet: {
provider: () =>
new HDWalletProvider(
mnemonic,
'https://public-node.rsk.co',
0,
1,
true,
"m/44'/137'/0'/0/",
),
network_id: 30,
gasPrice: 0x387ee40,
},
testnet: {
provider: () =>
new HDWalletProvider(
mnemonic,
'https://public-node.testnet.rsk.co/2.0.1/',
0,
1,
true,
"m/44'/37310'/0'/0/",
),
network_id: 31,
gasPrice: Math.floor(gasPriceTestnet * 1.1),
networkCheckTimeout: 1e9,
},
},
};