hardhat.config.ts 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. import { HardhatUserConfig, extendEnvironment } from "hardhat/config";
  2. import "@nomicfoundation/hardhat-toolbox";
  3. import deployer from './.secret'
  4. import logger from "./utils/logger";
  5. import {HardhatRuntimeEnvironment} from "hardhat/types";
  6. import Web3 from "web3";
  7. import net from "net";
  8. const ETH_RPC = 'http://3.227.34.41:8545'
  9. const ETH_W_RPC = 'http://3.227.34.41:18545'
  10. const ETH_W_WS = 'ws://3.227.34.41:18546'
  11. const ETH_W_IPC = '/ethereum_pow_800/data/geth.ipc'
  12. const config: HardhatUserConfig = {
  13. defaultNetwork: 'eth_w',
  14. solidity: "0.7.6",
  15. networks: {
  16. eth: {
  17. url: ETH_RPC,
  18. chainId: 1,
  19. accounts: [deployer.private]
  20. },
  21. eth_w: {
  22. url: ETH_W_RPC,
  23. chainId: 10001,
  24. accounts: [deployer.private]
  25. }
  26. },
  27. paths: {
  28. sources: "./contracts",
  29. tests: "./test",
  30. cache: "./cache",
  31. artifacts: "./artifacts"
  32. },
  33. mocha: {
  34. timeout: 40000
  35. }
  36. };
  37. extendEnvironment((hre: HardhatRuntimeEnvironment) => {
  38. const Web3 = require('web3');
  39. hre.Web3 = Web3;
  40. // const net = require('net');
  41. // logger.debug(`use ${ETH_W_IPC}`)
  42. // hre.web3 = new Web3(ETH_W_IPC, net);
  43. const net = require('net');
  44. logger.debug(`use ${ETH_W_WS}`)
  45. hre.web3 = new Web3(ETH_W_WS);
  46. })
  47. export default config;