forked from KyberNetwork/bridge_eth_smart_contracts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtruffle.js
61 lines (56 loc) · 1.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
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 = false,
urlRinkeby = 'https://rinkeby.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: '*'
},
mainnet: {
provider: _getProvider(urlMainnet),
network_id: '1',
gas,
gasPrice
},
rinkeby: {
provider: _getProvider(urlRinkeby),
network_id: '4',
gas,
gasPrice
}
},
solc: {
optimizer: {
enabled: optimizedEnabled
}
}
}
}
module.exports = truffleConfig({
optimizedEnabled: true
})