-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathtruffle-config.js
113 lines (104 loc) · 3.12 KB
/
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
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
109
110
111
112
113
/**
* Use this file to configure your truffle project. It's seeded with some
* common settings for different networks and features like migrations,
* compilation and testing. Uncomment the ones you need or modify
* them to suit your project as necessary.
*
* More information about configuration can be found at:
*
* truffleframework.com/docs/advanced/configuration
*
*/
const HDWalletProvider = require("truffle-hdwallet-provider");
const fs = require("fs");
const TESTNET_PROVIDER = "https://testnet-rpc.thundercore.com";
const MAINNET_PROVIDER = "https://mainnet-rpc.thundercore.com";
let privateKeys = null;
let mnemonic = null;
try {
privateKeys = fs
.readFileSync(".private-keys", { encoding: "ascii" })
.split("\n")
.filter(x => x.length > 0);
} catch (err) {
if (err.code !== "ENOENT") {
throw err;
}
}
if (!privateKeys) {
try {
mnemonic = fs.readFileSync(".mnemonic", { encoding: "ascii" }).trim();
} catch (err) {
if (err.code !== "ENOENT") {
throw err;
}
}
}
module.exports = {
networks: {
// For `truffle develop`
development: {
host: "127.0.0.1", // Localhost (default: none)
port: 9545, // Standard Ethereum port (default: none)
network_id: "*" // Any network (default: none)
},
"thunder-testnet": {
provider: () => {
if (privateKeys === null && mnemonic === null) {
throw new Error("Please create a .private-keys or .mnemonic file");
}
return privateKeys
? new HDWalletProvider(
privateKeys,
TESTNET_PROVIDER,
0, // <- change address_index if you want to default to an address other than the first one
privateKeys.length
)
: new HDWalletProvider(
mnemonic,
TESTNET_PROVIDER,
0 // <- change address_index if you want to use an address other than the first one
);
},
network_id: "18"
},
"thunder-mainnet": {
provider: () => {
if (privateKeys === null && mnemonic === null) {
throw new Error("Please create a .private-keys or .mnemonic file");
}
return privateKeys
? new HDWalletProvider(
privateKeys,
MAINNET_PROVIDER,
0, // <- change address_index if you want to use non-first address
privateKeys.length
)
: new HDWalletProvider(
mnemonic,
MAINNET_PROVIDER,
0 // <- change address_index if you want to use non-first address
);
},
network_id: "108"
}
},
// Set default mocha options here, use special reporters etc.
mocha: {
// timeout: 100000
},
// Configure your compilers
compilers: {
solc: {
version: "0.5.9", // Fetch exact version from solc-bin (default: truffle's version)
settings: {
// see the solidity docs for advice about optimization and evmversion
optimizer: {
enabled: true,
runs: 200
},
evmVersion: "byzantium" // Current evm on ThunderCore fixed at "byzantium"
}
}
}
};