/
truffle-config.js
40 lines (37 loc) · 1.06 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
const HDWalletProvider = require("@truffle/hdwallet-provider");
const fs = require("fs");
const mnemonic = fs.readFileSync(".secret").toString().trim();
if (!mnemonic || mnemonic.split(" ").length !== 12) {
throw new Error("unable to retrieve mnemonic from .secret");
}
const gasPriceTestnetRaw = fs
.readFileSync(".gas-price-testnet.json")
.toString()
.trim();
const gasPriceTestnet = parseInt(JSON.parse(gasPriceTestnetRaw).result, 16);
if (typeof gasPriceTestnet !== "number" || isNaN(gasPriceTestnet)) {
throw new Error(
"unable to retrieve network gas price from .gas-price-testnet.json"
);
}
console.log("Gas price Testnet: " + gasPriceTestnet);
module.exports = {
networks: {
development: {
host: "127.0.0.1",
port: 4444,
network_id: "*",
},
testnet: {
provider: () => new HDWalletProvider(mnemonic, 'https://public-node.testnet.rsk.co/'),
network_id: 31,
gasPrice: Math.floor(gasPriceTestnet * 1.1),
networkCheckTimeout: 1e9
},
},
compilers: {
solc: {
version: "0.8.1",
},
},
};