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

Crash when detected arbitrage opportunity #50

Closed adedade closed 2 years ago

adedade commented 2 years ago
│ 5 │ USDT   │ 3333.00 │ ETH    │ 3326.28 │ -6.7 │ -0.2 │ Getting quote for WETH → USDT…       │   1.1s │ 2022-02-07T04:13:49.296Z │     │ 6 │ USDT   │ 3333.00 │ USDC   │ 3337.08 │  4.1 │  0.1 │                                      │   1.2s │ 2022-02-07T04:13:49.379Z │     │ 7 │ USDT   │ 3333.00 │ WMATIC │ 3340.57 │  7.6 │  0.2 │                                      │   0.8s │ 2022-02-07T04:13:48.972Z │     └───┴────────┴─────────┴────────┴─────────┴──────┴──────┴──────────────────────────────────────┴────────┴──────────────────────────┘     /Users/adedade/poly-flashloan-bot/node_modules/@ethersproject/logger/lib/index.js:199ATIC…     │        │ 2022-02-07T03:53:52.713Z │
        var error = new Error(message);22 │  3.2 │  0.1 │                                      │   2.8s │ 2022-02-07T03:53:55.531Z │
                    ^──┴────────┴─────────┴──────┴──────┴──────────────────────────────────────┴────────┴──────────────────────────┘

Error: invalid BigNumber value (argument="value", value=undefined, code=INVALID_ARGUMENT, version=bignumber/5.5.0)
    at Logger.makeError (/Users/adedade/poly-flashloan-bot/node_modules/@ethersproject/logger/lib/index.js:199:21)
    at Logger.throwError (/Users/adedade/poly-flashloan-bot/node_modules/@ethersproject/logger/lib/index.js:208:20)
    at Logger.throwArgumentError (/Users/adedade/poly-flashloan-bot/node_modules/@ethersproject/logger/lib/index.js:211:21)
    at Function.BigNumber.from (/Users/adedade/poly-flashloan-bot/node_modules/@ethersproject/bignumber/lib/bignumber.js:241:23)
    at NumberCoder.encode (/Users/adedade/poly-flashloan-bot/node_modules/@ethersproject/abi/lib/coders/number.js:36:39)
    at /Users/adedade/poly-flashloan-bot/node_modules/@ethersproject/abi/lib/coders/array.js:74:19
    at Array.forEach (<anonymous>)
    at pack (/Users/adedade/poly-flashloan-bot/node_modules/@ethersproject/abi/lib/coders/array.js:60:12)
    at TupleCoder.encode (/Users/adedade/poly-flashloan-bot/node_modules/@ethersproject/abi/lib/coders/tuple.js:71:33)
    at AbiCoder.encode (/Users/adedade/poly-flashloan-bot/node_modules/@ethersproject/abi/lib/abi-coder.js:93:15) {
  reason: 'invalid BigNumber value',

@yuichiroaoki any chance you could look into this bug? thanks!

Sshimaninja commented 2 years ago

I get the same error. I also edited the loan amount. I'm not sure if that's related but it is something we both have in common.

adedade commented 2 years ago

I did get that error also with the default loan amount unfortunately

yuichiroaoki commented 2 years ago

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

adedade commented 2 years ago

I saw that you pushed some updates. I've pulled the latest changes and will check if the issue is resolved :)

adedade commented 2 years ago

Great job @yuichiroaoki, it works well!