forked from CoinbaseStablecoin/solidity-tutorial
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtruffle-config.js
48 lines (46 loc) · 1007 Bytes
/
truffle-config.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
const HDWalletProvider = require("@truffle/hdwallet-provider");
module.exports = {
compilers: {
solc: {
version: "0.6.11",
settings: {
optimizer: {
enabled: false,
runs: 10000,
},
},
},
},
networks: {
development: {
host: "localhost",
port: 8545,
network_id: "*",
},
mainnet: infuraProvider("mainnet", 1),
ropsten: infuraProvider("ropsten", 3),
},
mocha: {
timeout: 10000,
reporter: "Spec",
},
plugins: [],
};
function infuraProvider(network, networkId) {
return {
provider() {
const { MNEMONIC, INFURA_API_KEY } = process.env;
if (!MNEMONIC || !INFURA_API_KEY) {
console.error(
"Environment variables MNEMONIC and INFURA_API_KEY are required"
);
process.exit(1);
}
return new HDWalletProvider(
MNEMONIC,
`https://${network}.infura.io/v3/${INFURA_API_KEY}`
);
},
network_id: networkId,
};
}