forked from fudgebucket27/moody-brains
-
Notifications
You must be signed in to change notification settings - Fork 0
/
truffle.js
96 lines (87 loc) · 2.48 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
const HDWalletProvider = require("truffle-hdwallet-provider");
const PrivateKeyProvider = require("truffle-privatekey-provider");
const MNEMONIC = process.env.MNEMONIC;
const NODE_API_KEY = process.env.INFURA_KEY || process.env.ALCHEMY_KEY;
const isInfura = !!process.env.INFURA_KEY;
const needsNodeAPI =
process.env.npm_config_argv &&
(process.env.npm_config_argv.includes("rinkeby") ||
process.env.npm_config_argv.includes("live"));
if ((!MNEMONIC || !NODE_API_KEY) && needsNodeAPI) {
console.error("Please set a mnemonic and ALCHEMY_KEY or INFURA_KEY.");
process.exit(0);
}
const rinkebyNodeUrl = isInfura
? "https://rinkeby.infura.io/v3/" + NODE_API_KEY
: "https://eth-rinkeby.alchemyapi.io/v2/" + NODE_API_KEY;
let mainnetNodeUrl = isInfura
? "https://mainnet.infura.io/v3/" + NODE_API_KEY
: "https://eth-mainnet.alchemyapi.io/v2/" + NODE_API_KEY;
const goerliNodeUrl = "https://goerli.infura.io/v3/b7c22d73c16e4c0ea3f88dadbdffbe03"
module.exports = {
networks: {
development: {
host: "localhost",
port: 8545,
gas: 5000000,
network_id: "*", // Match any network id
},
rinkeby: {
provider: function () {
return new HDWalletProvider(MNEMONIC, rinkebyNodeUrl, 1);
},
gas: 5000000,
network_id: 4,
gasPrice: 5000000000, // 5 gwei
},
goerli: {
provider: function () {
return new PrivateKeyProvider(
"7c71142c72a019568cf848ac7b805d21f2e0fd8bc341e8314580de11c6a397bf",
"https://goerli.infura.io/v3/b7c22d73c16e4c0ea3f88dadbdffbe03"
);
},
gas: 5000000,
network_id: 5,
gasPrice: 5000000000, // 5 gwei
},
live: {
network_id: 1,
provider: function () {
return new HDWalletProvider(MNEMONIC, mainnetNodeUrl, 1);
},
gas: 5000000,
gasPrice: 101000000000, // 5 gwei
confirmations: 2,
timeoutBlocks: 200,
skipDryRun: false,
websocket: true,
timeoutBlocks: 50000,
//networkCheckTimeout: 1000000
},
},
mocha: {
reporter: "eth-gas-reporter",
reporterOptions: {
currency: "USD",
gasPrice: 2,
},
},
compilers: {
solc: {
version: "pragma",
settings: {
optimizer: {
enabled: true,
runs: 200 // Optimize for how many times you intend to run the code
},
},
},
},
plugins: [
'truffle-plugin-verify'
],
api_keys: {
etherscan: process.env.ETHERSCAN_API_KEY_FOR_VERIFICATION
}
};