truffle-config.js 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. require('dotenv').config()
  2. const HDWalletProvider = require('@truffle/hdwallet-provider')
  3. const utils = require('web3-utils')
  4. // const infuraKey = "fj4jll3k.....";
  5. //
  6. // const fs = require('fs');
  7. // const mnemonic = fs.readFileSync(".secret").toString().trim();
  8. module.exports = {
  9. /**
  10. * Networks define how you connect to your ethereum client and let you set the
  11. * defaults web3 uses to send transactions. If you don't specify one truffle
  12. * will spin up a development blockchain for you on port 9545 when you
  13. * run `develop` or `test`. You can ask a truffle command to use a specific
  14. * network from the command line, e.g
  15. *
  16. * $ truffle test --network <network-name>
  17. */
  18. networks: {
  19. // Useful for testing. The `development` name is special - truffle uses it by default
  20. // if it's defined here and no other network is specified at the command line.
  21. // You should run a client (like ganache-cli, geth or parity) in a separate terminal
  22. // tab if you use this network and you must also set the `host`, `port` and `network_id`
  23. // options below to some value.
  24. development: {
  25. host: '127.0.0.1', // Localhost (default: none)
  26. port: 8545, // Standard Ethereum port (default: none)
  27. network_id: '*', // Any network (default: none)
  28. },
  29. // Another network with more advanced options...
  30. // advanced: {
  31. // port: 8777, // Custom port
  32. // network_id: 1342, // Custom network
  33. // gas: 8500000, // Gas sent with each transaction (default: ~6700000)
  34. // gasPrice: 20000000000, // 20 gwei (in wei) (default: 100 gwei)
  35. // from: <address>, // Account to send txs from (default: accounts[0])
  36. // websockets: true // Enable EventEmitter interface for web3 (default: false)
  37. // },
  38. // Useful for deploying to a public network.
  39. // NB: It's important to wrap the provider as a function.
  40. kovan: {
  41. provider: () => new HDWalletProvider(process.env.PRIVATE_KEY, 'https://kovan.infura.io/v3/c7463beadf2144e68646ff049917b716'),
  42. network_id: 42,
  43. gas: 6000000,
  44. gasPrice: utils.toWei('1', 'gwei'),
  45. // confirmations: 0,
  46. // timeoutBlocks: 200,
  47. skipDryRun: true
  48. },
  49. rinkeby: {
  50. provider: () => new HDWalletProvider(process.env.PRIVATE_KEY, 'https://rinkeby.infura.io/v3/c7463beadf2144e68646ff049917b716'),
  51. network_id: 4,
  52. gas: 6000000,
  53. gasPrice: utils.toWei('1', 'gwei'),
  54. // confirmations: 0,
  55. // timeoutBlocks: 200,
  56. skipDryRun: true
  57. },
  58. mainnet: {
  59. provider: () => new HDWalletProvider(process.env.PRIVATE_KEY, 'http://ethereum-rpc.trustwalletapp.com'),
  60. network_id: 1,
  61. gas: 6000000,
  62. gasPrice: utils.toWei('2', 'gwei'),
  63. // confirmations: 0,
  64. // timeoutBlocks: 200,
  65. skipDryRun: true
  66. },
  67. // Useful for private networks
  68. // private: {
  69. // provider: () => new HDWalletProvider(mnemonic, `https://network.io`),
  70. // network_id: 2111, // This network is yours, in the cloud.
  71. // production: true // Treats this network as if it was a public net. (default: false)
  72. // }
  73. },
  74. // Set default mocha options here, use special reporters etc.
  75. mocha: {
  76. // timeout: 100000
  77. },
  78. // Configure your compilers
  79. compilers: {
  80. solc: {
  81. version: '0.5.11', // Fetch exact version from solc-bin (default: truffle's version)
  82. // docker: true, // Use "0.5.1" you've installed locally with docker (default: false)
  83. settings: { // See the solidity docs for advice about optimization and evmVersion
  84. optimizer: {
  85. enabled: true,
  86. runs: 200
  87. },
  88. // evmVersion: "byzantium"
  89. }
  90. }
  91. }
  92. }