Browse Source

基本配置都OK了

龚成明 3 năm trước cách đây
mục cha
commit
317ddb2c97
2 tập tin đã thay đổi với 40 bổ sung2 xóa
  1. 28 1
      hardhat.config.ts
  2. 12 1
      test/Univ3Test.ts

+ 28 - 1
hardhat.config.ts

@@ -1,8 +1,35 @@
 import { HardhatUserConfig } from "hardhat/config";
 import "@nomicfoundation/hardhat-toolbox";
 
+import deployer from './.secret'
+
+const ETH_RPC = '/ethereum/data/geth.ipc'
+const ETH_W_RPC = 'https://mainnet.ethereumpow.org'
+
 const config: HardhatUserConfig = {
-  solidity: "0.8.17",
+  defaultNetwork: 'eth_w',
+  solidity: "0.7.6",
+  networks: {
+    eth: {
+      url: ETH_RPC,
+      chainId: 1,
+      accounts: [deployer.private]
+    },
+    eth_w: {
+      url: ETH_W_RPC,
+      chainId: 10001,
+      accounts: [deployer.private]
+    }
+  },
+  paths: {
+    sources: "./contracts",
+    tests: "./test",
+    cache: "./cache",
+    artifacts: "./artifacts"
+  },
+  mocha: {
+    timeout: 40000
+  }
 };
 
 export default config;

+ 12 - 1
test/Univ3Test.ts

@@ -1,7 +1,18 @@
 import {ethers} from "hardhat";
 
+import { network } from "hardhat";
+
 describe('Univ3 Test', () => {
-  it('parseEther test', async () => {
+
+  it('Parse ether test', async () => {
     console.log(ethers.utils.parseEther('2.123456789'))
   })
+
+  it('Get block number test', async () => {
+    console.log(await ethers.provider.getBlockNumber())
+  })
+
+  // it('Get balance test', async () => {
+  //   console.log(ethers.provider.getBalance())
+  // })
 })