Try   HackMD

searching from scratch

Note: we will have to drastically over-simplify and cut many corners. Writing a decent backrunner from scratch in 2 hours is highly ambitious.

This talk is:

  • interactive
  • collaborative
  • rushed 😅

Ask questions!!

backrunner blueprint

  • subscribe to mempool txs on websocket provider
  • filter for Uniswap (SwapRouter02) trades
    • filter for multicall
  • decode calldata data using abiDecoder
    • filter for exactInputSingle & exactOutputSingle
    • extract trade data from multicall calldata
      • reminder: inner deadline param has to be removed
    • filter for (TOKEN -> WETH) swaps ONLY
    • assume executor will only hold WETH
  • write executor contract
    • accept trade data as param to execute function
    • buy tokens (which mempool user will have sold) on Uniswap
    • (my_buy_amount == mempool_user_sell_amount == mempoolTx.amountIn)
    • sell all purchased tokens on Sushiswap
    • return updated WETH balance
  • simulation-based profit analysis (not ideal, but quick & easy to implement)
    • blindly/optimistically build backrun bundle
    • simulate on local(-ish) mev-geth
    • use return value to determine whether bundle is worth sending

TODO

  • test contract against local mainnet fork
  • deploy contract on mainnet & update contracts.ts