-
Notifications
You must be signed in to change notification settings - Fork 1
/
truffle.js
148 lines (144 loc) · 3.53 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
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
/*
* NB: since truffle-hdwallet-provider 0.0.5 you must wrap HDWallet providers in a
* function when declaring them. Failure to do so will cause commands to hang. ex:
* ```
* mainnet: {
* provider: function() {
* return new HDWalletProvider(mnemonic, 'https://mainnet.infura.io/<infura-key>')
* },
* network_id: '1',
* gas: 4500000,
* gasPrice: 10000000000,
* },
*/
const appConfig = require('./src/config');
const Web3 = require('web3');
const web3 = new Web3();
const HDWalletProvider = require('truffle-hdwallet-provider');
const addressCountValue = appConfig.getAddressCount().get();
const mnemonicKeyValue = appConfig.getMnemonic().get();
const infuraKeyValue = appConfig.getInfuraKey().get();
const gasKeyValue = appConfig.getGasWei().get();
const gasPriceKeyValue = appConfig.getGasPriceGwei().get();
const defaultAddressIndex = appConfig.getDefaultAddressIndex().get();
const etherscanApiKeyValue = appConfig.getEtherscanApiKey().get();
module.exports = {
web3: Web3,
mocha: {
enableTimeouts: false,
},
compilers: {
solc: {
version: "0.5.3",
optimizer: {
enabled: true,
runs: 200
}
}
},
api_keys: {
etherscan: etherscanApiKeyValue
},
plugins: [
'truffle-plugin-verify'
],
verify: {
preamble: "Author: Guillermo Salazar <guillesalazar@gmail.com>.\nVersion: 1.0.0"
},
networks: {
geth: {
host: 'localhost',
port: 8045,
network_id: '*'
},
ganache: {
host: '127.0.0.1',
port: 8545,
network_id: '*',
function() {
return new HDWalletProvider(
mnemonicKeyValue,
`http://localhost:8545`,
defaultAddressIndex,
addressCountValue
);
},
confirmations: 0,
timeoutBlocks: 50,
skipDryRun: true
},
coverage: {
host: "127.0.0.1",
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
},
infuraRinkeby: {
provider: function() {
return new HDWalletProvider(
mnemonicKeyValue,
`https://rinkeby.infura.io/v3/${infuraKeyValue}`,
defaultAddressIndex,
addressCountValue
);
},
gas: gasKeyValue,
gasPrice: web3.utils.toWei(gasPriceKeyValue, 'gwei'),
network_id: '4'
},
infuraKovan: {
provider: function() {
return new HDWalletProvider(
mnemonicKeyValue,
`https://kovan.infura.io/v3/${infuraKeyValue}`,
defaultAddressIndex,
addressCountValue
);
},
gas: gasKeyValue,
gasPrice: web3.utils.toWei(gasPriceKeyValue, 'gwei'),
network_id: '42'
},
infuraRopsten: {
provider: function() {
return new HDWalletProvider(
mnemonicKeyValue,
`https://ropsten.infura.io/v3/${infuraKeyValue}`,
defaultAddressIndex,
addressCountValue
);
},
gas: gasKeyValue,
gasPrice: web3.utils.toWei(gasPriceKeyValue, 'gwei'),
network_id: '3',
skipDryRun: true,
},
infuraMainnet: {
provider: function() {
return new HDWalletProvider(
mnemonicKeyValue,
`https://mainnet.infura.io/v3/${infuraKeyValue}`,
defaultAddressIndex,
addressCountValue
);
},
gas: gasKeyValue,
gasPrice: web3.utils.toWei(gasPriceKeyValue, 'gwei'),
network_id: '1'
},
infuraNet: {
provider: function() {
return new HDWalletProvider(
mnemonicKeyValue,
`https://infuranet.infura.io/v3/${infuraKeyValue}`,
defaultAddressIndex,
addressCountValue
);
},
gas: gasKeyValue,
gasPrice: web3.utils.toWei(gasPriceKeyValue, 'gwei'),
network_id: '2'
}
}
};