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

"insufficient funds for gas * price + value\"}}","error" #12

Closed MetaNynja closed 2 years ago

MetaNynja commented 2 years ago

Error: insufficient funds for intrinsic transaction cost (error={"reason":"processing response error","code":"SERVER_ERROR","body":"{\"jsonrpc\": \"2.0\", \"id\": 51, \"error\": {\"code\": -32000, \"message\": \"insufficient funds for gas * price + value\"}}","error":{"code":-32000}

I keep getting the above error. I have changed the gas from 30 to 150 to test if I needed to indicate a high gas price however it gives the same error at a price of 150.

Any suggestions?

yuichiroaoki commented 2 years ago

What about the gas limit??

MetaNynja commented 2 years ago

I have the gas limit at 15 000 000 and also tried 20 000 000. Anything over 20 give a gas limit exceeded error.

I’m ran this over the smart contract you already have in there though, so I thought I would deploy my own with your poly-flash contract to see if that would fix it but I ran into an issue with the contract, I logged the contract issue on the contract issues section. I’m new to all this and appreciate the help.

yuichiroaoki commented 2 years ago

Do you have enough matic value on your wallet?? Probably 1 matic would be enough to execute flashloan call.

MetaNynja commented 2 years ago

Yes I definitely have enough.

MetaNynja commented 2 years ago

I just ran the bot again on Video Studio Code using the smart contract address that you made (I still get errors trying to make my own contract). I got this error.

C:\Users\User\Poly Bot1\poly-flashloan-bot\node_modules\@ethersproject\logger\lib\index.js:199 var error = new Error(message); ^

Error: insufficient funds for intrinsic transaction cost (error={"reason":"processing response error","code":"SERVER_ERROR","body":"{\"jsonrpc\": \"2.0\", \"id\": 51, \"error\": {\"code\": -32000, \"message\": \"insufficient funds for gas * price + value\"}}","error":{"code":-32000},"requestBody":"{\"method\":\"eth_sendRawTransaction\",\"params\":[\"0xf9048d808506fc23ac0083e4e1c0940e0ec2c716b5ba2512af9d3790d8804da42ddd5880b90424b27f6a2500000000000000000000000000000000000000000000000000000000000000200000000000000000000000002144ee9e47998e0d7ea990252d6fe63107a3101800000000000000000000000000000000000000000000000000000002540be4000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000024000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000400000000000000000000000001b02da8cb0d097eb8d57a175b88c7d8b479975060000000000000000000000000000000000000000000000000000000000000003000000000000000000000000c2132d05d31c914a87c6611c10748aeb04b58e8f0000000000000000000000007ceb23fd6bc0add59e62ac25578270cff1b9f6190000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa841740000000000000000000000000000000000000000000000000000000000000040000000000000000000000000c0788a3ad43d79aa53b09c2eacc313a787d1d60700000000000000000000000000000000000000000000000000000000000000020000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa841740000000000000000000000008f3cf7ad23cd3cadbd9735aff958023239c6a06300000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000400000000000000000000000001b02da8cb0d097eb8d57a175b88c7d8b4799750600000000000000000000000000000000000000000000000000000000000000030000000000000000000000008f3cf7ad23cd3cadbd9735aff958023239c6a0630000000000000000000000007ceb23fd6bc0add59e62ac25578270cff1b9f6190000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa8417400000000000000000000000000000000000000000000000000000000000000400000000000000000000000005c6ec38fb0e2609672bdf628b1fd605a523e592300000000000000000000000000000000000000000000000000000000000000020000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa84174000000000000000000000000c2132d05d31c914a87c6611c10748aeb04b58e8f820135a016abbfd349e46074822272e0c6ad6154262df79efb2b540f521f24f74e092fb0a07d1cf5ca878546cd9463b362f8b464e996f14d4555d91c21762867580a63931f\"],\"id\":51,\"jsonrpc\":\"2.0\"}","requestMethod":"POST","url":"REDACTED"}, method="sendTransaction", transaction="0xf9048d808506fc23ac0083e4e1c0940e0ec2c716b5ba2512af9d3790d8804da42ddd5880b90424b27f6a2500000000000000000000000000000000000000000000000000000000000000200000000000000000000000002144ee9e47998e0d7ea990252d6fe63107a3101800000000000000000000000000000000000000000000000000000002540be4000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000024000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000400000000000000000000000001b02da8cb0d097eb8d57a175b88c7d8b479975060000000000000000000000000000000000000000000000000000000000000003000000000000000000000000c2132d05d31c914a87c6611c10748aeb04b58e8f0000000000000000000000007ceb23fd6bc0add59e62ac25578270cff1b9f6190000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa841740000000000000000000000000000000000000000000000000000000000000040000000000000000000000000c0788a3ad43d79aa53b09c2eacc313a787d1d60700000000000000000000000000000000000000000000000000000000000000020000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa841740000000000000000000000008f3cf7ad23cd3cadbd9735aff958023239c6a06300000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000400000000000000000000000001b02da8cb0d097eb8d57a175b88c7d8b4799750600000000000000000000000000000000000000000000000000000000000000030000000000000000000000008f3cf7ad23cd3cadbd9735aff958023239c6a0630000000000000000000000007ceb23fd6bc0add59e62ac25578270cff1b9f6190000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa8417400000000000000000000000000000000000000000000000000000000000000400000000000000000000000005c6ec38fb0e2609672bdf628b1fd605a523e592300000000000000000000000000000000000000000000000000000000000000020000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa84174000000000000000000000000c2132d05d31c914a87c6611c10748aeb04b58e8f820135a016abbfd349e46074822272e0c6ad6154262df79efb2b540f521f24f74e092fb0a07d1cf5ca878546cd9463b362f8b464e996f14d4555d91c21762867580a63931f", code=INSUFFICIENT_FUNDS, version=providers/5.5.1) at Logger.makeError (C:\Users\User\Poly Bot1\poly-flashloan-bot\node_modules\@ethersproject\logger\lib\index.js:199:21) at Logger.throwError (C:\Users\User\Poly Bot1\poly-flashloan-bot\node_modules\@ethersproject\logger\lib\index.js:208:20) at checkError (C:\Users\User\Poly Bot1\poly-flashloan-bot\node_modules\@ethersproject\providers\lib\json-rpc-provider.js:95:16) at JsonRpcProvider. (C:\Users\User\Poly Bot1\poly-flashloan-bot\node_modules\@ethersproject\providers\lib\json-rpc-provider.js:659:47) at step (C:\Users\User\Poly Bot1\poly-flashloan-bot\node_modules\@ethersproject\providers\lib\json-rpc-provider.js:48:23) at Object.throw (C:\Users\User\Poly Bot1\poly-flashloan-bot\node_modules\@ethersproject\providers\lib\json-rpc-provider.js:29:53) at rejected (C:\Users\User\Poly Bot1\poly-flashloan-bot\node_modules\@ethersproject\providers\lib\json-rpc-provider.js:21:65) at runMicrotasks () at processTicksAndRejections (node:internal/process/task_queues:96:5) {

MetaNynja commented 2 years ago

Issue solved.

newbie-coin commented 2 years ago

@MetaNynja Hi, I meet the same question, could you share how to solve it?

MetaNynja commented 2 years ago

@MetaNynja Hi, I meet the same question, could you share how to solve it?

Hey, I accidentally put my wallet address instead of my private key. Make sure you're using the private key and not the wallet address.

newbie-coin commented 2 years ago

@MetaNynja Hi, I meet the same question, could you share how to solve it?

Hey, I accidentally put my wallet address instead of my private key. Make sure you're using the private key and not the wallet address.

Yep, I solved the problem, and not the private key problem, it's the gas fee, when I set a high gas fee, it can run correctly. Than you for you reply!

And could you run the code to make a completely arbitrage process? When I run the code, it will run correctly, but fail in arbitrage, it will return Fail with error 'Not enough amount to return loan in transaction as below link, do you have any idea about it, Thank you! https://polygonscan.com/tx/0xda035267038ac478b14e924bb1a96222d1d8aabc305d9c09b03c2c99b2023223

MetaNynja commented 2 years ago

@MetaNynja Hi, I meet the same question, could you share how to solve it?

Hey, I accidentally put my wallet address instead of my private key. Make sure you're using the private key and not the wallet address.

Yep, I solved the problem, and not the private key problem, it's the gas fee, when I set a high gas fee, it can run correctly. Than you for you reply!

And could you run the code to make a completely arbitrage process? When I run the code, it will run correctly, but fail in arbitrage, it will return Fail with error 'Not enough amount to return loan in transaction as below link, do you have any idea about it, Thank you!

https://polygonscan.com/tx/0xda035267038ac478b14e924bb1a96222d1d8aabc305d9c09b03c2c99b2023223

I have the same problem. I think it's because the price changes too quickly and the arbitrage opportunity gets missed.