Skip to content

Instantly share code, notes, and snippets.

@korrio
Created October 28, 2021 17:34
Show Gist options
  • Save korrio/820c33283b5732d5351ecd5f0869b0aa to your computer and use it in GitHub Desktop.
Save korrio/820c33283b5732d5351ecd5f0869b0aa to your computer and use it in GitHub Desktop.
truffle-config.js
const HDWalletProvider = require('@truffle/hdwallet-provider');
const Web3 = require('web3');
const fs = require('fs');
const { infuraProjectId, privateKeys, etherApiKey, bscApiKey } = JSON.parse(fs.readFileSync('.secret').toString().trim());
// const infuraProjectId = `86f947e6d8ad4483a95d5a53864e7a8e`;
const binanceTestnetProvider = new HDWalletProvider({
privateKeys: privateKeys,
providerOrUrl: `https://data-seed-prebsc-1-s1.binance.org:8545`
});
const kovanProvider = new HDWalletProvider({
privateKeys: privateKeys,
providerOrUrl: `https://kovan.infura.io/v3/${infuraProjectId}`
});
const rinkebyProvider = new HDWalletProvider({
privateKeys: privateKeys,
providerOrUrl: `https://rinkeby.infura.io/v3/${infuraProjectId}`
});
module.exports = {
contracts_build_directory: './build/contracts',
networks: {
bscTestnet: {
provider: () => binanceTestnetProvider,
network_id: '97',
gas: 5500000,
skipDryRun: true,
},
kovan: {
provider: () => kovanProvider,
network_id: '42',
gas: 5500000,
skipDryRun: true,
},
rinkeby: {
provider: () => rinkebyProvider,
network_id: '4',
gas: 4500000,
gasPrice: 10000000000,
skipDryRun: true,
},
// for_etherscan_verification: {
// network_id: process.env.VERIFICATION_CHAIN_ID,
// host: process.env.VERIFICATION_RPC_URL,
// },
ganache: {
host: '127.0.0.1',
port: 8545,
network_id: '*',
gasPrice: 100000000000,
gas: 10000000,
disableConfirmationListener: true,
},
},
compilers: {
solc: {
version: '0.7.5',
settings: {
optimizer: {
enabled: true,
runs: 200,
},
evmVersion: 'istanbul',
},
},
},
plugins: ['solidity-coverage', 'truffle-plugin-verify'],
api_keys: {
etherscan: etherApiKey,
bscscan: bscApiKey
},
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment