truffle-config.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. require("dotenv").config({ path: ".env" });
  2. const HDWalletProvider = require("@truffle/hdwallet-provider");
  3. /**
  4. *
  5. * @param {string} url
  6. * @returns {HDWalletProvider} An instance of HDWalletProvider
  7. */
  8. function payerProvider(url) {
  9. return () =>
  10. new HDWalletProvider({
  11. mnemonic: process.env.MNEMONIC,
  12. providerOrUrl: url,
  13. // This option makes deployments more reliable (by avoiding rate limiting errors) at the cost of
  14. // taking a little longer.
  15. pollingInterval: 12000,
  16. });
  17. }
  18. module.exports = {
  19. migrations_directory: process.env.MIGRATIONS_DIR,
  20. networks: {
  21. development: {
  22. host: "127.0.0.1",
  23. port: 8545,
  24. network_id: "*",
  25. },
  26. [process.env.MIGRATIONS_NETWORK]: {
  27. provider: payerProvider(process.env.RPC_URL),
  28. network_id: process.env.NETWORK_ID,
  29. },
  30. },
  31. compilers: {
  32. solc: {
  33. version: "0.8.23",
  34. settings: {
  35. optimizer: {
  36. enabled: true,
  37. runs: 200,
  38. },
  39. },
  40. },
  41. },
  42. plugins: [
  43. "truffle-plugin-verify",
  44. "truffle-contract-size",
  45. "truffle-plugin-stdjsonin",
  46. ],
  47. };