yuichiroaoki / poly-flashloan-bot

Flashloan Bot on Polygon
https://yuichiroaoki.medium.com/flashloan-bot-on-polygon-part-2-3eae0ac33986?sk=80821da4ca1d0462c7c9ae617df56bdd
MIT License
302 stars 192 forks source link

Undefined when opportunity found, followed by invalid Bignumber error message. #51

Closed Sshimaninja closed 2 years ago

Sshimaninja commented 2 years ago

Getting an "undefined" issue when there is profitable arb opportunity on the flash loan bot. I have changed the loan amount, and added several router addresses for different exchanges, as well as a new token.

│ 19 │ USDC │ 11111.00 │ WMATIC │ 11096.64 │ -14.4 │ -0.1 │ Getting quote for USDC → WMATIC… │ │ 2022-02-07T03:53:51.878Z │ │ WBTC │ 11111.00 │ WMATIC │ 349.05 │ -10761.9 │ -96.9 │ Getting quote for WBTC → WMATIC… │ │ 2022-02-07T03:53:51.92 │ undefined20 │ undefinedUSDC │ undefined11111.00 │ undefinedWBTC │ undefined11126.36 │ undefined 15.4 │ undefined 0.1 │ undefined │ undefined 1.7s │ undefined2022-02-07T03:53:53.600Z │C… │ 1.0s │ 2022-02-07T03:53:52.91 │ 21 │ USDC │ 11111.00 │ CRV │ 10890.26 │ -220.7 │ -2.0 │ Getting quote for CRV → USDC… │ 0.8s │ 2022-02-07T03:53:52.67

No error thrown for this but, I do get the following error which is mentioned in another issue:

Error: invalid BigNumber value (argument="value", value=undefined, code=INVALID_ARGUMENT, version=bignumber/5.5.0)

I will look into this myself, and I thank you for any help you can offer.

yuichiroaoki commented 2 years ago

My bad. The problem was because of the poor error handling of axios response. Will fix that.

Sshimaninja commented 2 years ago

ty King Roaoki I'll verify asap.