Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Insufficient Funds Error #8

Open
daidokoro opened this issue Feb 3, 2021 · 7 comments
Open

Insufficient Funds Error #8

daidokoro opened this issue Feb 3, 2021 · 7 comments

Comments

@daidokoro
Copy link

Hi,

First off thanks for putting this together. It has been extremely useful in better understanding Smart Contracts and Arbitrage in general.

I'm currently using the project as a basis to create my own bot in Go.

Currently when I run the node app I get an Insufficient Funds error whenever an arbitrage opportunity is detected.

Error:

Profitable?  Asset Order      Exchange Order  Input                   Output                  Profit                  Timestamp
-----------  ---------------  --------------  ----------------------  ----------------------  ----------------------  -------------------------
true         WETH, DAI, WETH  ZRX, 1Split     0.00128                 0.001282346964590108    0.000002346964590107    2021-02-03T11:49:13-06:00

/Users/daidokoro/Projects/crypto/defi-bot/node_modules/web3-core-helpers/lib/errors.js:28
        var err = new Error('Returned error: ' + message);
                  ^

Error: Returned error: insufficient funds for gas * price + value
    at Object.ErrorResponse (/Users/daidokoro/Projects/crypto/defi-bot/node_modules/web3-core-helpers/lib/errors.js:28:19)
    at /Users/daidokoro/Projects/crypto/defi-bot/node_modules/web3-core-requestmanager/lib/index.js:303:36
    at XMLHttpRequest.request.onreadystatechange (/Users/daidokoro/Projects/crypto/defi-bot/node_modules/web3-providers-http/lib/index.js:98:13)
    at XMLHttpRequestEventTarget.dispatchEvent (/Users/daidokoro/Projects/crypto/defi-bot/node_modules/xhr2-cookies/dist/xml-http-request-event-target.js:34:22)
    at XMLHttpRequest._setReadyState (/Users/daidokoro/Projects/crypto/defi-bot/node_modules/xhr2-cookies/dist/xml-http-request.js:208:14)
    at XMLHttpRequest._onHttpResponseEnd (/Users/daidokoro/Projects/crypto/defi-bot/node_modules/xhr2-cookies/dist/xml-http-request.js:318:14)
    at IncomingMessage.<anonymous> (/Users/daidokoro/Projects/crypto/defi-bot/node_modules/xhr2-cookies/dist/xml-http-request.js:289:61)
    at IncomingMessage.emit (node:events:341:22)
    at endReadableNT (node:internal/streams/readable:1294:12)
    at processTicksAndRejections (node:internal/process/task_queues:80:21) {
  data: null
}

My Config

RPC_URL="https://mainnet.infura.io/v3/<apikey>"
ADDRESS="0x<my account hash>"
PRIVATE_KEY="0x<my private key>"
CONTRACT_ADDRESS="0x<my deployed contract hash>"
GAS_LIMIT=3000000
GAS_PRICE=400
ESTIMATED_GAS=1700000

The account I'm using currently has a balance of 0.8 ETH

I have tried reducing the FLASH_AMOUNT variable in the script as I believed maybe it was trying to borrow more than it could actually afford, but even with the value set to 1 ETH, I still get the same error.

I also noticed that the Input value shown in the table is always 0.00128. When I print out the non-profitable values, the inputs vary, but only the input value above seems to show up when a profitable arbitrage is detected.

Is there something i'm missing here?

Thanks in advance

@brotherlymite
Copy link

I've deployed on the Ropsten test net and I'm getting the exact same error.
Did you get to know @daidokoro on why this is happening?
I have around 5 ETH on the wallet so I think it's not because of insufficient funds.

@restorepro
Copy link

Are you using vs code as your ide?

@Nisthar
Copy link

Nisthar commented Jun 4, 2021

any update on this ?

@WandileChamane
Copy link

Hey Guys any update on this, there are some improvements I would like to push, So I will fork the repo, these are mainly on the price format nothing major. But this issue on the other hand makes no sense to me. I have about 96 eth on the acc that deployed the contract. on a forked mainnet running on infura and have about 1 eth on the contract itself yet im still getting this issue.

Didnt wanna open a new issue as this is here, but can we solve this please. Thanks

@restorepro
Copy link

I was unable to get it to function, moved on to something else...

@WandileChamane
Copy link

Not giving up will post back later today.

@daidokoro
Copy link
Author

daidokoro commented Jun 10, 2021

Hey, so in the end I wasn't able to resolve this. I went as far as to rewrite most of this in Go. I was able to get the Go version to scan for arbitrage using the same contracts however, the only arbitrages that were detected were always for 0.00128 ETH. The exact same values as the Node version. Given the nature of trading and arbitrage, it's strange to not see more arbitrary values. (arbitrary --> arbitrage), it's in the name.

I didn't go any further due to time constraints. The smart contract itself may require a look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants