-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtruffle.js.default
executable file
·57 lines (48 loc) · 1.2 KB
/
truffle.js.default
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 WalletProvider = require("truffle-wallet-provider")
const Wallet = require('ethereumjs-wallet')
const development = {
host : '127.0.0.1',
port : 8545,
network_id : 5777,
gas : process.env.TRUFFLE_GAS || 3 * 10**6,
gasPrice : process.env.TRUFFLE_GAS_PRICE || 20 * 10**9
}
const infuraAccessToken = process.env.INFURA_ACCESS_TOKEN
const infuraNetworks = ! infuraAccessToken ?
{} :
["ropsten", "rinkeby", "kovan", "mainnet"].reduce(
(result, network) => {
const envForPrivateKey = `${network.toUpperCase()}_PRIVATE_KEY`
const privateKeyString = process.env[envForPrivateKey]
if (privateKeyString) {
const privateKey = Buffer.from(
privateKeyString.replace('0x', ''),
'hex'
)
const wallet = Wallet.fromPrivateKey(privateKey)
const provider = new WalletProvider(
wallet,
`https://${network}.infura.io/${infuraAccessToken}`
)
result[network] = {
...development,
provider
}
}
return result
},
{}
)
module.exports = {
rpc : development,
networks : {
...infuraNetworks,
development
},
solc : {
optimizer : {
enabled : true,
runs : 200
}
}
}