flashbots / simple-arbitrage

Example arbitrage bot using Flashbots
1.98k stars 749 forks source link

Bugfix: use updated token reserves on each block #19

Closed pawurb closed 3 years ago

pawurb commented 3 years ago

Hi. Maybe I misunderstand something but it looks like currently updateReserves is only effectively executed once on startup.

await UniswappyV2EthPair.updateReserves(provider, markets.allMarketPairs); is run on each block but looks like updated markets.allMarketPairs are not used afterwards. This PR fixes passing marketsByToken to evaluateMarkets so that their reserves are updated.

pawurb commented 3 years ago

Sorry, it's now passed by reference. Closing.