forked from ProjectOpenSea/opensea-creatures
-
Notifications
You must be signed in to change notification settings - Fork 1
/
truffle.js
73 lines (67 loc) · 1.77 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
const HDWalletProvider = require("truffle-hdwallet-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;
const mainnetNodeUrl = isInfura
? "https://mainnet.infura.io/v3/" + NODE_API_KEY
: "https://eth-mainnet.alchemyapi.io/v2/" + NODE_API_KEY;
module.exports = {
networks: {
development: {
host: "localhost",
port: 7545,
gas: 5000000,
network_id: "*", // Match any network id
},
rinkeby: {
provider: function () {
return new HDWalletProvider(MNEMONIC, rinkebyNodeUrl);
},
gas: 5000000,
network_id: 4,
},
live: {
network_id: 1,
provider: function () {
return new HDWalletProvider(MNEMONIC, mainnetNodeUrl);
},
gas: 5000000,
gasPrice: 5000000000,
},
},
mocha: {
reporter: "eth-gas-reporter",
reporterOptions: {
currency: "USD",
gasPrice: 2,
},
},
compilers: {
solc: {
version: "^0.8.0",
settings: {
optimizer: {
enabled: true,
runs: 20 // Optimize for how many times you intend to run the code
},
},
},
},
plugins: [
'truffle-plugin-verify'
],
api_keys: {
etherscan: 'ETHERSCAN_API_KEY_FOR_VERIFICATION'
}
};