Git Product home page Git Product logo

frontruning's Introduction

FrontRuning

This script was designed to frontrun transactions from the Uniswap V2 Router.

It spys on the mempool using blocknative and calcualtes a best buy to maximise revenue.

The sequence of events are outlined in the index.js which is the centre of the entire script.

A blocknative emitter emmits out transactions from the mempool. These are then filtered by the watcher, which only allows in transactions that meet certain criterias.

These transactions are then passed through an isProfitable function, which calcates if the transaction is worth frontrunning.

Finally, the data is passed through to the Uniswap router and using their SDK is able to initialise purchases and selling.

ISSUES that I am aware of

I had no experiences with emmiters when I started the project. So my two emmiter method in index.js was a probabbly not a good solution. The reason why I initialised the emitter before the buy is because buying takes time, and I want the emitter to be able to cancel my transaction if something were to go wrong.

I also has the sell function in the emitter because I had to wait untill their transaction to be finished so that It could affect the sale price before I sold the tokens

A lot of the older code that was writen prior have not been refactored with new knowledge such as the if(condition) return

I was very liberal with my use of async and await methods because I wasnt sure which part of my code would be asyncronous. I am aware that It is more costly than regular functions

frontruning's People

Contributors

imalexhu avatar samyin999 avatar

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.