jamesbachini / DEX-Arbitrage

Example arbitrage trading bot
GNU General Public License v3.0
615 stars 350 forks source link

Can you provide any direction on this error? #28

Closed m5k closed 1 year ago

m5k commented 1 year ago

I have added an avalanche config, both pools are uni-v2. The script ran for 12 hours with no errors then the spread became good and now that its apparently trying to make a swap but this error is showing. Any advice would be greatly appreciated. Thank you for your hard work on this, your effort to teach and train the community is not overlooked.

ReferenceError: inTrade is not defined at dualTrade (/Users/account/Documents/DEX-Arbitrage/scripts/trade.js:74:3) at lookForDualTrade (/Users/account/Documents/web3DEV/ARB/DEX-Arbitrage/scripts/trade.js:63:13) at processTicksAndRejections (node:internal/process/task_queues:95:5) at lookForDualTrade (/Users/account/Documents/web3DEV/ARB/DEX-Arbitrage/scripts/trade.js:65:7) at lookForDualTrade (/Users/account/Documents/web3DEV/ARB/DEX-Arbitrage/scripts/trade.js:65:7) at lookForDualTrade (/Users/account/Documents/web3DEV/ARB/DEX-Arbitrage/scripts/trade.js:65:7) at lookForDualTrade (/Users/account/Documents/web3DEV/ARB/DEX-Arbitrage/scripts/trade.js:69:5) at main (/Users/account/Documents/web3DEV/ARB/DEX-Arbitrage/scripts/trade.js:20:3)

{ "arbContract": "0x[redacted]", "minBasisPointsPerTrade": 0, "routers": [ { "dex": "traderjoe", "address": "0x60aE616a2155Ee3d9A68541Ba4544862310933d4" }, { "dex": "pangolin", "address": "0xE54Ca86531e17Ef3616d22Ca28b0D458b6C89106" } ], "baseAssets": [ { "sym": "WAVAX","address": "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7" } ], "tokens": [ { "sym": "PNG", "address": "0x60781C2586D68229fde47564546784ab3fACA982" }, { "sym": "WAVAX","address": "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7" } ], "routes": [ ["0xE54Ca86531e17Ef3616d22Ca28b0D458b6C89106","0x60aE616a2155Ee3d9A68541Ba4544862310933d4","0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7","0x60781C2586D68229fde47564546784ab3fACA982"], ["0x60aE616a2155Ee3d9A68541Ba4544862310933d4","0x60aE616a2155Ee3d9A68541Ba4544862310933d4","0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7","0x60781C2586D68229fde47564546784ab3fACA982"], ["0x60aE616a2155Ee3d9A68541Ba4544862310933d4","0xE54Ca86531e17Ef3616d22Ca28b0D458b6C89106","0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7","0x60781C2586D68229fde47564546784ab3fACA982"], ["0xE54Ca86531e17Ef3616d22Ca28b0D458b6C89106","0xE54Ca86531e17Ef3616d22Ca28b0D458b6C89106","0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7","0x60781C2586D68229fde47564546784ab3fACA982"] ] }

jamesbachini commented 1 year ago

That's strange as inTrade should be defined on line 5 here:

https://github.com/jamesbachini/DEX-Arbitrage/blob/e74b085b07e2231a631124b9e7eb33cade250c01/scripts/trade.js#L5

Perhaps double check that line hasn't been accidentally deleted or changing it to define inTrade as false if you are using some form of type checking i.e.

let inTrade = false;

m5k commented 1 year ago

So weird, that line is in fact missing ',inTrade,balances;'. Will try this thanks for the quick reply!

m5k commented 1 year ago

This is good to go. I can't imagine what I did to the code to lose those variables at the end of the line. Perhaps a little too much whiskey this weekend. ;) Thank you.