-
Notifications
You must be signed in to change notification settings - Fork 73
/
Copy pathtruffle.js
78 lines (73 loc) · 1.85 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 HDWalletProvider = require('truffle-hdwallet-provider')
const assert = require('assert')
const DEFAULT_GAS_PRICE_GWEI = 5
const GAS_LIMIT = 6.5e6
const DEFAULT_MNEMONIC =
'candy maple cake sugar pudding cream honey rich smooth crumble sweet treat'
function truffleConfig({
mnemonic = DEFAULT_MNEMONIC,
gasPriceGWei = DEFAULT_GAS_PRICE_GWEI,
gas = GAS_LIMIT,
optimizedEnabled = true,
urlRinkeby = 'https://rinkeby.infura.io/',
urlKovan = 'https://kovan.infura.io/',
urlMainnet = 'https://mainnet.infura.io',
urlDevelopment = 'localhost',
portDevelopment = 8545
} = {}) {
assert(mnemonic, 'The mnemonic has not been provided')
console.log(`Using gas limit: ${gas / 1000} K`)
console.log(`Using gas price: ${gasPriceGWei} Gwei`)
console.log(`Optimizer enabled: ${optimizedEnabled}`)
console.log('Using default mnemonic: %s', mnemonic === DEFAULT_MNEMONIC)
const gasPrice = gasPriceGWei * 1e9
const _getProvider = url => {
return () => new HDWalletProvider({ mnemonic, url })
}
return {
networks: {
development: {
host: urlDevelopment,
port: portDevelopment,
gas,
gasPrice,
network_id: '*',
websockets: true
},
mainnet: {
provider: _getProvider(urlMainnet),
network_id: '1',
gas,
gasPrice
},
rinkeby: {
provider: _getProvider(urlRinkeby),
network_id: '4',
gas,
gasPrice
},
kovan: {
provider: _getProvider(urlKovan),
network_id: '8',
gas,
gasPrice
}
},
// Native binary
compilers: {
solc: {
// version: "native"
version: '0.5.2',
docker: false
}
},
solc: {
optimizer: {
enabled: optimizedEnabled
}
}
}
}
module.exports = truffleConfig({
optimizedEnabled: true
})