6eer / uniswap-sushiswap-arbitrage-bot

Two bots written in JS that uses flashswaps and normal swaps to arbitrage Uniswap. Includes an automated demostration.
MIT License
586 stars 264 forks source link

Error running bot_flashswap.js #8

Closed rkedia145 closed 3 years ago

rkedia145 commented 3 years ago

Hi There,

I am trying to run your demo environment, and everything worked until the very last step where I try to run the bot_flashswap.js. I am getting the following error:

Bot listening!

/Users/rk145/projects/src/mfin/crypto/uniswap-sushiswap-arbitrage-bot/node_modules/web3-eth-abi/lib/index.js:298
        throw new Error('Returned values aren\'t valid, did it run Out of Gas? ' +
              ^

Error: Returned values aren't valid, did it run Out of Gas? You might also see this error if you are not using the correct ABI for the contract you are retrieving data from, requesting data from a block number that does not exist, or querying a node which is not fully synced.
    at ABICoder.decodeParametersWith (/Users/rk145/projects/src/mfin/crypto/uniswap-sushiswap-arbitrage-bot/node_modules/web3-eth-abi/lib/index.js:298:15)
    at ABICoder.decodeParameters (/Users/rk145/projects/src/mfin/crypto/uniswap-sushiswap-arbitrage-bot/node_modules/web3-eth-abi/lib/index.js:285:17)
    at Contract._decodeMethodReturn (/Users/rk145/projects/src/mfin/crypto/uniswap-sushiswap-arbitrage-bot/node_modules/web3-eth-contract/lib/index.js:470:22)
    at Method.outputFormatter (/Users/rk145/projects/src/mfin/crypto/uniswap-sushiswap-arbitrage-bot/node_modules/web3-eth-contract/lib/index.js:760:42)
    at Method.formatOutput (/Users/rk145/projects/src/mfin/crypto/uniswap-sushiswap-arbitrage-bot/node_modules/web3-core-method/lib/index.js:147:54)
    at sendTxCallback (/Users/rk145/projects/src/mfin/crypto/uniswap-sushiswap-arbitrage-bot/node_modules/web3-core-method/lib/index.js:523:33)
    at Object.callback (/Users/rk145/projects/src/mfin/crypto/uniswap-sushiswap-arbitrage-bot/node_modules/web3-core-requestmanager/lib/index.js:308:9)
    at /Users/rk145/projects/src/mfin/crypto/uniswap-sushiswap-arbitrage-bot/node_modules/web3-providers-ws/lib/index.js:114:45
    at Array.forEach (<anonymous>)
    at WebsocketProvider._onMessage (/Users/rk145/projects/src/mfin/crypto/uniswap-sushiswap-arbitrage-bot/node_modules/web3-providers-ws/lib/index.js:102:69)
    at W3CWebSocket._dispatchEvent [as dispatchEvent] (/Users/rk145/projects/src/mfin/crypto/uniswap-sushiswap-arbitrage-bot/node_modules/yaeti/lib/EventTarget.js:115:12)
    at W3CWebSocket.onMessage (/Users/rk145/projects/src/mfin/crypto/uniswap-sushiswap-arbitrage-bot/node_modules/websocket/lib/W3CWebSocket.js:234:14)
    at WebSocketConnection.<anonymous> (/Users/rk145/projects/src/mfin/crypto/uniswap-sushiswap-arbitrage-bot/node_modules/websocket/lib/W3CWebSocket.js:205:19)
    at WebSocketConnection.emit (node:events:365:28)
    at WebSocketConnection.processFrame (/Users/rk145/projects/src/mfin/crypto/uniswap-sushiswap-arbitrage-bot/node_modules/websocket/lib/WebSocketConnection.js:554:26)
    at /Users/rk145/projects/src/mfin/crypto/uniswap-sushiswap-arbitrage-bot/node_modules/websocket/lib/WebSocketConnection.js:323:40

Do you have any guidance on how to address this? I tried increasing the gasNeeded constant by two orders of magnitude just to be safe (*200), and I also tried uncommenting line 144, but still getting the same error...

Thank you!

kiidfreak commented 2 years ago

@rkedia145 Any update on this?