-
Notifications
You must be signed in to change notification settings - Fork 2
/
truffle.js
executable file
·94 lines (86 loc) · 3.34 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/**
* Truffle configuration
*/
const cnf = require('./config/networks.json');
const HDWalletProvider = require('@truffle/hdwallet-provider');
require('@babel/register');
require('core-js/stable');
require('regenerator-runtime/runtime');
const network = process.env.NETWORK;
let secrets = '';
secrets = require('./config/.secrets.json');
const path = require('path');
const basePath = process.cwd();
const buildDir = path.join(basePath, 'build');
const buildDirContracts = path.join(basePath, 'build/contracts');
const srcDir = path.join(basePath, 'contracts');
const testDir = path.join(basePath, 'test/contracts');
const migrationsDir = path.join(basePath, 'migrations/contracts');
module.exports = {
plugins: [
'solidity-coverage',
'truffle-plugin-verify'
],
api_keys: {
etherscan: secrets.etherscan_key, //Put in here te etherscan API key for contract verification
polygonscan: secrets.polygonscan_key //Put in here te etherscan API key for contract verification
},
mocha: {
useColors: true // disable bottom for testing dev/troubleshooting
// reporter: 'eth-gas-reporter',
// reporterOptions: {
// currency: 'CHF',
// gasPrice: cnf.networks.develop.gasPrice
// }
},
compilers: {
solc: {
version: '0.8.19',
docker: false,
settings: {
optimizer: {
enabled: true,
runs: 200
}
}
}
},
networks: {
develop: {
host: cnf.networks.develop.host,
port: cnf.networks.develop.port,
network_id: cnf.networks.develop.chainId, // eslint-disable-line
gas: cnf.networks.develop.gas,
gasPrice: cnf.networks.develop.gasPrice
},
coverage: {
host: cnf.networks.coverage.host,
network_id: cnf.networks.coverage.chainId, // eslint-disable-line
port: cnf.networks.coverage.port,
gas: cnf.networks.coverage.gas,
gasPrice: cnf.networks.coverage.gasPrice
},
goerliInfura: getInfuraConfig("goerli"),
sepoliaInfura: getInfuraConfig("sepolia"),
mumbaiInfura: getInfuraConfig("mumbai"),
polygonInfura: getInfuraConfig("polygon"),
mainnetInfura: getInfuraConfig("mainnet")
},
build_directory: buildDir, // eslint-disable-line
contracts_build_directory: buildDirContracts, // eslint-disable-line
migrations_directory: migrationsDir, // eslint-disable-line
contracts_directory: srcDir, // eslint-disable-line
test_directory: testDir // eslint-disable-line
};
function getInfuraConfig(networkName) {
let infuraProvider = new HDWalletProvider(secrets.mnemonic, secrets.infura_host[networkName] + secrets.infura_key);
return {
network_id: cnf.networks[networkName].chainId, // eslint-disable-line
provider: infuraProvider,
from: infuraProvider.getAddress(),
gas: cnf.networks[networkName].gas,
gasPrice: cnf.networks[networkName].gasPrice,
networkCheckTimeout: 10000,
timeoutBlocks: 200
};
}