-
Notifications
You must be signed in to change notification settings - Fork 1
/
truffle-config.js
60 lines (53 loc) · 1.69 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
const path = require("path");
const fs = require('fs');
const HDWalletProvider = require('@truffle/hdwallet-provider');
const { stageGasPrice, prodGasPrice } = require('./constants.js');
function provider(network) {
if (network !== 'rinkeby' && network !== 'polygon') {
throw new Error('Allowed network are rinkeby and polygon');
} else if (!fs.existsSync(path.resolve(__dirname, './.pk'))) {
throw new Error('Private key file ".pk" does not exist in monorepo root');
}
return new HDWalletProvider({
privateKeys: [fs.readFileSync(path.resolve(__dirname, './.pk')).toString().trim()],
providerOrUrl: network === 'rinkeby'
? "wss://rinkeby.infura.io/ws/v3/7f00ea5349e64a078e7a9533c9126cef"
: "https://polygon-rpc.com/",
});
}
module.exports = {
contracts_build_directory: path.join(__dirname, "/build"),
networks: {
development: {
host: "127.0.0.1", // Localhost (default: none)
port: 8545, // Standard Ethereum port (default: none)
network_id: '*', // Any network (default: none)
gasPrice: 1000000000, // 1 gwei
},
stage: {
provider: () => provider('rinkeby'),
network_id: 4,
confirmations: 2,
timeoutBlocks: 200,
skipDryRun: true,
gasPrice: stageGasPrice,
},
prod: {
provider: () => provider('polygon'),
network_id: 137,
networkCheckTimeout: 10000000,
confirmations: 2,
timeoutBlocks: 200,
skipDryRun: true,
gasPrice: prodGasPrice,
},
},
mocha: {
timeout: 100000
},
compilers: {
solc: {
version: "^0.8.7", // Fetch exact version from solc-bin (default: truffle's version)
}
},
};