Explorar o código

新增ethers的测试

skyfffire %!s(int64=3) %!d(string=hai) anos
pai
achega
09948a6632
Modificáronse 1 ficheiros con 10 adicións e 2 borrados
  1. 10 2
      test/speed/Web3SpeedTest.ts

+ 10 - 2
test/speed/Web3SpeedTest.ts

@@ -1,4 +1,4 @@
-import { web3 } from "hardhat";
+import { web3, ethers } from "hardhat";
 import logger from "../../utils/logger";
 import contracts from "../../config/contracts";
 
@@ -6,9 +6,15 @@ function test1() {}
 function test2() {
   new web3.eth.Contract([], contracts.UNIV3)
 }
+function test21() {
+  new ethers.Contract(contracts.UNIV3, [])
+}
 function test3() {
   web3.utils.toChecksumAddress('0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2')
 }
+function test31() {
+  ethers.utils.getAddress('0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2')
+}
 
 async function run(fun: Function) {
   const startTs = new Date().getTime()
@@ -30,7 +36,9 @@ async function main() {
   for (let i = 0; i < 100; i++) {
     // await run(test1)
     // await run(test2)
-    await run(test3)
+    // await run(test21)
+    // await run(test3)
+    await run(test31)
   }
 }