Code Monkey home page Code Monkey logo

mev-inspect-js's People

Contributors

dependabot[bot] avatar destiner avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

mev-inspect-js's Issues

Distinguish between forks

Currently, it doesn't distinguish between e.g. Uniswap V2 and Sushiswap. It would need to have an "address -> fork name" mapping across supported chains. Forks outside this mapping may be mapped as "Unknown fork" or excluded completely.

Fetch logs more efficiently across blocks

Since we rely on event logs instead of call traces, and we know what logs to look for in advance, it would likely be more efficient to fetch them via eth_getFilterLogs. This is especially useful when looking for MEV across hundreds of blocks.

Compare against known MEV searcher transactions

While #11 is helpful, its information is limited: as I realised, Flashbots misses quite a handful of easy-to-detect MEV. Another strategy might be first to identify a few active MEV bots, and then analyse their transactions. Since we know they are bots, any transaction involving them in which we can't find MEV would be suspicious, and might hint at missing some arbitrage.

Test against transactions with large amount of actions

Now that I'm relatively confident that the package works well for a simple swaps and arbs, it would be cool to test it against transactions with large number of swaps and token transfers coming from several protocols.

Error [ERR_REQUIRE_ESM]: require() of ES Module

When executing:
const inspector = new Inspector(1, provider);

I got error:

Error [ERR_REQUIRE_ESM]: require() of ES Module /home/myhome/Documents/ethereum/solidity/searcher/node_modules/mev-inspect/lib/index.js from /home/myhome/Documents/ethereum/solidity/searcher/index.ts not supported.
Instead change the require of index.js in /home/myhome/Documents/ethereum/solidity/searcher/index.ts to a dynamic import() which is available in all CommonJS modules.

However if I add
"type": "module",

in my package.json, I got error:

ReferenceError: exports is not defined in ES module scope

I am using nvm version 0.38.0

Use transfer events to detect "from" of Uniswap V2/V3 swaps

Tx: 0xd53808dc31c908b7acad610d5efa726afe67e7c9739083be9c1b4cb6d2cdaeac.

In the swap with the log index 10, sender set to 0x58418d6c83efab01ed78b0ac42e55af01ee77dba, while the actual erc20 token sender 0x5aa3393e361c2eb342408559309b3e873cd876d6 (as seen in transfer with the log index 7). This breaks arbitrage detection heuristics.

Uni V3 might also be subject to this.

Arbitrage not detected when swap.from and swap.to are different

In most cases, both from and to addresses are the same. Sometimes though, they are different, which breaks the algorithm.

Example txs:

  • 0x49fb0fb07827b3e6fa425fbb7ef1f1fbe3dfedbf656519bfe6d4bf9391aea1d2.
  • 0xcce82565d597057f6d0391fecb139e773cd9cac9a5f9d9ee5a21f7aa2b912bd3

Preliminarily compare against Flashbots data

First pass at testing/validation on real data.

Run mev-inspect-js against a number of consecutive blocks, and compare the found MEV with the data in the same period from Flashbots explorer.

Fetch pool data via Multicall

Before extracting swaps, we need to fetch pool assets from the blockchain. It's faster to fetch the assets in batches via Multicall.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.