This repository has been archived by the owner on May 29, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
/
truffle.js
69 lines (63 loc) · 1.55 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
require('dotenv').config()
const Web3WsProvider = require('web3-providers-ws');
const HDWalletProvider = require('truffle-hdwallet-provider')
const PrivateKeyProvider = require('truffle-privatekey-provider')
function createProvider(url) {
var key = null
var provider = null
if (url.indexOf('localhost') === -1) {
if (process.env.MNEMONIC) {
key = process.env.MNEMONIC
provider = new HDWalletProvider(key, url)
} else if (process.env.PRIVATE_KEY) {
key = process.env.PRIVATE_KEY
provider = new PrivateKeyProvider(key, url)
}
} else {
provider = new Web3WsProvider(url)
}
return provider
}
module.exports = {
networks: {
development: {
provider: createProvider('ws://localhost:8545'),
network_id: '*' // Match any network id
},
kovan: {
provider: createProvider('https://kovan.infura.io'),
network_id: 42,
gas: 4712383,
gasPrice: 20000000000
},
rinkeby: {
provider: createProvider('https://rinkeby.infura.io'),
network_id: 4,
gas: 4712383,
gasPrice: 20000000000
},
ropsten: {
provider: createProvider('https://ropsten.infura.io'),
network_id: 3,
gas: 4712383,
gasPrice: 20000000000
},
mainnet: {
provider: createProvider('https://mainnet.infura.io'),
network_id: 1,
gas: 4500000,
gasPrice: 10000000000
}
},
compilers: {
solc: {
version: '0.4.23',
settings: {
optimizer: {
enabled: true,
runs: 200
},
},
},
},
};