forked from livepeer/merkle-mine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
truffle.js
46 lines (42 loc) · 1.18 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
const KeystoreProvider = require("truffle-keystore-provider")
const Web3 = require("web3")
const memoizeProviderCreator = () => {
let keystoreProviders = {}
return (account, dataDir, providerUrl, readOnly) => {
if (readOnly) {
return new Web3.providers.HttpProvider(providerUrl)
} else {
if (providerUrl in keystoreProviders) {
return keystoreProviders[providerUrl]
} else {
const provider = new KeystoreProvider(account, dataDir, providerUrl)
keystoreProviders[providerUrl] = provider
return provider
}
}
}
}
const createProvider = memoizeProviderCreator()
module.exports = {
networks: {
dev: {
host: "localhost",
port: 8545,
network_id: "*"
},
rinkeby: {
provider: () => {
return createProvider(process.env.RINKEBY_ACCOUNT, process.env.DATA_DIR, "https://rinkeby.infura.io", process.env.READ_ONLY)
},
network_id: 4,
gas: 6600000
},
mainnet: {
provider: () => {
return createProvider(process.env.MAINNET_ACCOUNT, process.env.DATA_DIR, "https://mainnet.infura.io", process.env.READ_ONLY)
},
network_id: 1,
gas: 6600000
}
}
}