Skip to content

Instantly share code, notes, and snippets.

View vasinl124's full-sized avatar

MaxMillions vasinl124

View GitHub Profile
@vasinl124
vasinl124 / listen.js
Created May 15, 2023 07:05 — forked from BlockmanCodes/listen.js
Uniswap V2, V3, Sushiswap: listen for swaps
const ethers = require('ethers')
const v3PoolArtifact = require("@uniswap/v3-core/artifacts/contracts/UniswapV3Pool.sol/UniswapV3Pool.json")
const v2PairArtifact = require('@uniswap/v2-periphery/build/IUniswapV2Pair.json')
const USDC_ETH_V3 = '0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640'
const ETH_USDT_V2 = '0x0d4a11d5eeaac28ec3f61d100daf4d40471f1852'
const ETH_USDT_SUSHI = '0x06da0fd433c1a5d7a4faa01111c044910a184553'
sqrtToPrice = (sqrt) => {
// This is a basic uniswap frontrunning MEV bot
// Made by Merunas follow me on youtube to see how to use it and edit it: https://www.youtube.com/channel/UCJInIwgW1duAEnMHHxDK7XQ
// 1. Setup ethers, required variables, contracts and start function
const { Wallet, ethers } = require('ethers')
const { FlashbotsBundleProvider, FlashbotsBundleResolution } = require('@flashbots/ethers-provider-bundle')
// 1.1 Setup ABIs and Bytecodes
const UniswapAbi = [{"inputs":[{"internalType":"address","name":"_factory","type":"address"},{"internalType":"address","name":"_WETH","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"WETH","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"tokenA","type":"address"},{"internalType":"address","name":"tokenB","type":"address"},{"internalType":"uint256","name":"amountADesired","type":"uint256"},{"internalType":"uint256","name":"amountBDesire