To construct a new coin arbitrage:

  • change immutables.js

  • change .env variables.

    • WALLET_ADDRESS
    • WALLET_SECRET
    • OPTIMISM_WSS_MAINNET
  • fund wallet. Both ETH and WETH (or whichever token0 is)

  • approve coins - edit and run node client/approveCoin.js as approprite for each tokens.

to start listening and execute trade if profitable, run node client/calculateArb.js

  • edit and run node client/sandbox.js to check if triangular trades succeeds.

Deploy to Heroku

Edit Heroku settings

  • push this repo to github

  • add Procfile

  • add engine on package.json

      "engines": {
        "node": "12.x"
      }
    
  • run heroku create my-app-name

  • run git push heroku main

  • set .env varaibles on heroku

    • run heroku config:set OPTIMISM_WSS_MAINNET=your-alchemy-key-here
    • run heroku config:set WALLET_ADDRESS=your-wallet-address-here
    • run heroku config:set WALLET_SECRET=your-walllet-key-here
  • run heroku scale web=0 arbitrage=1

random notes to self

  • uniswap v3 fee percents as numbers:

    • 1% = 10000
    • 0.3% = 3000
  • make sure package.json dependencies are not under devDependencies.

Helpful Heroku Commands

  • heroku config will show your hidden variables

  • heroku logs --tail will show your script running