hardhat.config.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. import { HardhatUserConfig, extendEnvironment } from "hardhat/config";
  2. import {HardhatRuntimeEnvironment} from "hardhat/types";
  3. import "@nomicfoundation/hardhat-toolbox";
  4. import deployer from './.secret-config'
  5. import logger from './utils/logger'
  6. import debug from './utils/debug'
  7. const FTM_RPC = 'http://3.227.34.41:8545'
  8. const FTM_WS = 'ws://3.227.34.41:8546'
  9. const FTM_IPC = '/ethereum/data/opera.ipc'
  10. const config: HardhatUserConfig = {
  11. defaultNetwork: 'FTM',
  12. solidity: "0.7.6",
  13. networks: {
  14. FTM: {
  15. url: FTM_RPC,
  16. chainId: 250,
  17. accounts: [deployer.private]
  18. }
  19. },
  20. paths: {
  21. sources: "./contracts",
  22. tests: "./test",
  23. cache: "./cache",
  24. artifacts: "./artifacts"
  25. },
  26. mocha: {
  27. timeout: 40000
  28. }
  29. };
  30. extendEnvironment((hre: HardhatRuntimeEnvironment) => {
  31. const Web3 = require('web3');
  32. hre.Web3 = Web3;
  33. logger.debug(`is ${debug.isDev() ? 'dev' : 'pro'} model.`)
  34. if (debug.isDev()) {
  35. logger.debug(`use ${FTM_WS}`)
  36. hre.web3 = new Web3(FTM_WS);
  37. } else {
  38. const net = require('net');
  39. logger.debug(`use ${FTM_IPC}`)
  40. hre.web3 = new Web3(FTM_IPC, net);
  41. }
  42. })
  43. export default config;