-
Notifications
You must be signed in to change notification settings - Fork 26
/
truffle.js
108 lines (101 loc) · 2.42 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/*
* NB: since truffle-hdwallet-provider 0.0.5 you must wrap HDWallet providers in a
* function when declaring them. Failure to do so will cause commands to hang. ex:
* ```
* mainnet: {
* provider: function() {
* return new HDWalletProvider(mnemonic, 'https://mainnet.infura.io/<infura-key>')
* },
* network_id: '1',
* gas: 4500000,
* gasPrice: 10000000000,
* },
*/
require("dotenv").config();
const web3 = require("web3");
const HDWalletProvider = require("truffle-hdwallet-provider");
const {
ETH_NODE_ADDRESS,
ETH_NODE_USER,
ETH_NODE_PASSWORD,
ETH_FROM_ADDRESS,
HD_MNEMONIC,
INFURA_API_KEY
} = process.env;
function getProvider() {
return new web3.providers.HttpProvider(
ETH_NODE_ADDRESS,
10000,
ETH_NODE_USER,
ETH_NODE_PASSWORD
);
}
function getHDProvider() {
return new HDWalletProvider(
HD_MNEMONIC,
"https://rinkeby.infura.io/v3/" + INFURA_API_KEY
);
}
module.exports = {
// See <http://truffleframework.com/docs/advanced/configuration>
// to customize your Truffle configuration!
networks: {
// development: {
// host: "127.0.0.1",
// port: 8545,
// gas: 4500000, // Gas limit used for deploys
// gasPrice: 10000000000,
// network_id: "*" // Match any network id
// },
// development: {
// host: "127.0.0.1",
// port: 9545,
// gas: 45000000, // Gas limit used for deploys
// gasPrice: 10000000000,
// network_id: "*" // Match any network id
// },
// this is rinkeby for our geth node
rinkeby_geth: {
provider: getProvider,
network_id: 4,
from: ETH_FROM_ADDRESS,
gas: 4500000, // 2M gas limit used for deploy
gasPrice: 10000000000 // 10gwei
},
rinkeby_local: {
provider: getHDProvider,
network_id: 4,
gas: 4500000, // 2M gas limit used for deploy
gasPrice: 10000000000 // 10gwei
},
live: {
provider: getProvider,
network_id: 1,
from: ETH_FROM_ADDRESS,
gas: 1000000, // 1M
gasPrice: 5000000000 // 5 gwei
}
},
solc: {
optimizer: {
enabled: true,
runs: 200
}
},
// https://truffle.readthedocs.io/en/beta/advanced/configuration/
mocha: {
bail: true
},
compilers: {
solc: {
version: "0.5.10",
settings: {
evmVersion: "constantinople",
optimizer: {
enabled: true,
runs: 200
}
}
}
}
};