-
Notifications
You must be signed in to change notification settings - Fork 1
/
truffle.js
78 lines (72 loc) · 2.4 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
const config = require('./config');
const ProviderEngine = require('web3-provider-engine');
const RpcSubprovider = require('web3-provider-engine/subproviders/rpc.js');
const FilterSubprovider = require('web3-provider-engine/subproviders/filters.js');
const subproviders = require('@0xproject/subproviders');
const LedgerSubprovider = subproviders.LedgerSubprovider;
const TransportNodeHid = require('@ledgerhq/hw-transport-node-hid').default;
const Eth = require('@ledgerhq/hw-app-eth').default;
const HDWalletProvider = require('truffle-hdwallet-provider');
async function ledgerEthereumNodeJsClientFactoryAsync() {
const ledgerConnection = await TransportNodeHid.create();
const ledgerEthClient = new Eth(ledgerConnection);
return ledgerEthClient;
}
const engine = new ProviderEngine();
const ledgerSubprovider = new LedgerSubprovider({
networkId: 1,
baseDerivationPath: "m/44'/60'/0'",
ledgerEthereumClientFactoryAsync: ledgerEthereumNodeJsClientFactoryAsync,
accountFetchingConfigs: {
addressSearchLimit: 100,
shouldAskForOnDeviceConfirmation: false
}
});
engine.addProvider(new FilterSubprovider());
engine.addProvider(ledgerSubprovider);
engine.addProvider(new RpcSubprovider({
rpcUrl: config.INFURA_MAINNET_URL,
}));
engine.start();
module.exports = {
networks: {
development: {
host: 'localhost',
port: 8545,
network_id: '*',
gasPrice: 120000000000,
gas: 4700036
},
coverage: {
host: "localhost",
network_id: "*",
port: 8555, // <-- If you change this, also set the port option in .solcover.js.
gas: 0xfffffffffff, // <-- Use this high gas value
gasPrice: 0x01 // <-- Use this low gas price
},
ganache: {
network_id: 5777,
host: 'localhost',
port: 7545,
gas: 6721975
},
ropsten: {
provider: new HDWalletProvider(config.HD_WALLET_MNEMONIC, config.INFURA_ROPSTEN_URL, 0),
network_id: 3,
gas: 3955555,
gasPrice: 10000000000 // 10 Gwei
},
mainnet: {
provider: engine,
network_id: 1,
gas: 4712388,
gasPrice: 2000000000 // 2 Gwei
}
},
solc: {
optimizer: {
enabled: true,
runs: 200
}
}
};