-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtruffle.js
60 lines (52 loc) · 1.47 KB
/
truffle.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
const fs = require('fs');
const HDWalletProvider = require('truffle-hdwallet-provider');
const PRIVATE_FILE = './.private.json';
let privateJson = {};
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
const truffleExport = {
networks: {
development: {
host: 'localhost',
port: 8545,
network_id: '*',
gas: 2000000,
gasPrice: 10000000000,
}
},
solc: {
optimizer: {
enabled: true,
runs: 200
}
},
mocha: {
useColors: true
}
};
// Example of .private.json
//
// {
// "name": "my_private_net",
// "endpoint": "https://production.consortium.com",
// "network_id": "*",
// "apikey": "...",
// "apisecret": "...",
// "address": "0xab123..89zyx",
// "account": 0,
// "gas": 2000000,
// "gas": 20000000000,
// "privateKey": "0x890abc..12xyz",
// "mnemonic": "the world is too small to not care",
// "password": "bananas_are_not_meant_to_be_yellow!1!!1"
// }
if (fs.existsSync(PRIVATE_FILE)) {
privateJson = require(PRIVATE_FILE);
truffleExport.networks[privateJson.name] = {
provider: () => new HDWalletProvider(privateJson.mnemonic, privateJson.endpoint, privateJson.account || 0),
from: privateJson.address,
network_id: privateJson.network_id,
gas: privateJson.gas || 2000000,
gasPrice: privateJson.gasPrice || 20000000000,
};
}
module.exports = truffleExport;