浏览代码

first commit

hel 1 年之前
父节点
当前提交
e6a569b174
共有 12 个文件被更改,包括 139 次插入0 次删除
  1. 50 0
      .eslintrc
  2. 8 0
      contracts/receiver.sol
  3. 8 0
      contracts/sender.sol
  4. 0 0
      src/0setting.ts
  5. 25 0
      src/1culLine.ts
  6. 2 0
      src/3deploy.ts
  7. 0 0
      src/4caller.ts
  8. 46 0
      src/5transfer.ts
  9. 0 0
      src/bitStable.ts
  10. 0 0
      src/deploy.js
  11. 0 0
      src/flasbotRun.ts
  12. 0 0
      src/workflow

+ 50 - 0
.eslintrc

@@ -0,0 +1,50 @@
+{
+  "parser": "@typescript-eslint/parser",
+  "root": true,
+  "extends": [
+    "eslint:recommended",
+    "plugin:@typescript-eslint/recommended",
+    "plugin:@typescript-eslint/recommended-requiring-type-checking",
+    "plugin:prettier/recommended"
+  ],
+  "plugins": ["@typescript-eslint", "prettier"],
+  "parserOptions": {
+    "ecmaVersion": 2022,
+    "sourceType": "module",
+    "project": "./tsconfig.json"
+  },
+  "env": {
+    "node": true,
+    "es6": true
+  },
+  "settings": {
+    "import/resolver": {
+      "alias": {
+        "map": [["@", "./"]],
+        "extensions": [".js", ".ts"]
+      }
+    }
+  },
+  "rules": {
+    "prettier/prettier": ["error", { "singleQuote": true, "semi": false }],
+    "@typescript-eslint/no-inferrable-types": 0,
+    "@typescript-eslint/no-unused-vars": 1,
+    "@typescript-eslint/no-unsafe-assignment": "off",
+    "@typescript-eslint/no-unsafe-member-access": 0,
+    "@typescript-eslint/no-unsafe-argument": 0,
+    "@typescript-eslint/no-unsafe-return": 0,
+    "@typescript-eslint/no-var-requires": 0,
+    "@typescript-eslint/no-explicit-any": "off",
+    "no-param-reassign": 0,
+    "import/export": 0,
+    "max-len": [
+      "warn",
+      {
+        "code": 100,
+        "tabWidth": 4
+      }
+    ],
+    "no-void": 0,
+    "@typescript-eslint/ban-ts-comment": 0
+  }
+}

+ 8 - 0
contracts/receiver.sol

@@ -0,0 +1,8 @@
+// SPDX-License-Identifier: UNLICENSED
+pragma solidity ^0.8.0;
+
+contract receiver {
+    constructor(){
+
+    }
+}

+ 8 - 0
contracts/sender.sol

@@ -0,0 +1,8 @@
+// SPDX-License-Identifier: UNLICENSED
+pragma solidity ^0.8.0;
+
+contract sender {
+    constructor(){
+
+    }
+}

+ 0 - 0
src/0setting.ts


+ 25 - 0
src/1culLine.ts

@@ -0,0 +1,25 @@
+import { ethers } from 'ethers'
+
+const amountIn = 0n
+const amountOut = 0n
+
+const provider = new ethers.JsonRpcProvider('https://eth.rpc.blxrbdn.com')
+const contract = new ethers.Contract(
+  '0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D',
+  [
+    'function getAmountsOut(uint amountIn, address[] memory path) internal view returns (uint[] memory amounts)',
+  ],
+  provider,
+)
+async function getAmountOut() {
+  const res = await contract.getAmountsOut(ethers.parseEther('2'), [
+    '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',
+    '0x6B175474E89094C44Da98b954EedeAC495271d0F',
+  ])
+  // console.log(ethers.parseEther('1'))
+  console.log(res[0])
+  console.log(res[1])
+  console.log(res[1] / res[0])
+}
+
+getAmountOut().then()

+ 2 - 0
src/3deploy.ts

@@ -0,0 +1,2 @@
+const bytecode =
+  require('../artifacts/contracts/executor.sol/Executor.json').bytecode

+ 0 - 0
src/4caller.ts


+ 46 - 0
src/5transfer.ts

@@ -0,0 +1,46 @@
+import { ethers } from 'ethers'
+import { fundWallet } from './0setting'
+
+const mnemonic = ethers.Wallet.createRandom().mnemonic!
+const hdNode = ethers.HDNodeWallet.fromPhrase(mnemonic.phrase)
+console.log(mnemonic.phrase)
+const numWallet = 500
+const targetWallet = []
+// 派生路径:m / purpose' / coin_type' / account' / change / address_index
+// 我们只需要切换最后一位address_index,就可以从hdNode派生出新钱包
+for (let i = 0; i < numWallet; i++) {
+  const wallet = hdNode.deriveChild(i)
+  targetWallet.push(wallet.address)
+}
+
+function gasSend(address: string, nonce: number) {
+  try {
+    fundWallet.sendTransaction({
+      to: address,
+      nonce: nonce,
+      value: ethers.parseEther('0.001'),
+    })
+  } catch (error) {
+    console.log(error)
+  }
+}
+
+function sleep(ms: number) {
+  return new Promise((resolve) => setTimeout(resolve, ms))
+}
+
+async function main() {
+  let nonce = await fundWallet.getNonce()
+
+  for (let i = 0; i < 1000; i++) {
+    for (let i = 0; i < 30; i++) {
+      // const gas = await poly.getFeeData()
+      gasSend(0, nonce)
+      nonce++
+      console.log(nonce)
+    }
+    await sleep(1000)
+  }
+}
+
+main()

+ 0 - 0
src/bitStable.ts


+ 0 - 0
src/deploy.js


+ 0 - 0
src/flasbotRun.ts


+ 0 - 0
src/workflow