yuichiroaoki / poly-flashloan-bot Goto Github PK
View Code? Open in Web Editor NEWFlashloan Bot on Polygon
License: MIT License
Flashloan Bot on Polygon
License: MIT License
I have found an arbitrage opportunity and it handed it over to the flashloan smart contract, but then it failed with this error message:
Error: replacement fee too low
Additionally, I have attached the log output thrown by the script, maybe it helps to investigate this issue.
log.txt
And there were 2 transactions on Polygon:
https://polygonscan.com/tx/0xd8595edf297a3d5760b1fde6bdaafa0d1c08bf3f9225bd2f1bd1ab405759e6d8
https://polygonscan.com/tx/0x0b2893428bc9919ab742578b03121e71b88f6fa6404ef4c71519e943eed17113
Do you have an idea why this error is happening and how to prevent it?
I don't know how this error happened, but some people got this error when they change the config.
Is it normal to have 10 billions in my transaction debug as loanAmount and I set only 10000 as loan amount
Describe the bug
When running Yarn Start I receive an error.
/Users/kyleborg/poly-flashloan-bot-main/node_modules/@ethersproject/logger/lib/index.js:199
var error = new Error(message);
^
Error: network does not support ENS (operation="ENS", network="matic", code=UNSUPPORTED_OPERATION, version=providers/5.5.2)
at Logger.makeError (/Users/kyleborg/poly-flashloan-bot-main/node_modules/@ethersproject/logger/lib/index.js:199:21)
at Logger.throwError (/Users/kyleborg/poly-flashloan-bot-main/node_modules/@ethersproject/logger/lib/index.js:208:20)
at JsonRpcProvider. (/Users/kyleborg/poly-flashloan-bot-main/node_modules/@ethersproject/providers/lib/base-provider.js:2007:36)
at step (/Users/kyleborg/poly-flashloan-bot-main/node_modules/@ethersproject/providers/lib/base-provider.js:48:23)
at Object.next (/Users/kyleborg/poly-flashloan-bot-main/node_modules/@ethersproject/providers/lib/base-provider.js:29:53)
at fulfilled (/Users/kyleborg/poly-flashloan-bot-main/node_modules/@ethersproject/providers/lib/base-provider.js:20:58)
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
reason: 'network does not support ENS',
code: 'UNSUPPORTED_OPERATION',
operation: 'ENS',
network: 'matic'
}
To Reproduce
Steps to reproduce the behavior:
yarn start from terminal
Expected behavior
Yarn install crashes
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
Smartphone (please complete the following information):
Additional context
Add any other context about the problem here.
The script runs normally for some time and then it crashes showing this:
TypeError: Cannot read properties of undefined (reading 'status')
at E:\poly-flashloan-bot-main\dist\inchPrice.js:81:33
at Generator.next (<anonymous>)
at fulfilled (E:\poly-flashloan-bot-main\dist\inchPrice.js:5:58)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
seems to happen with every transaction
https://polygonscan.com/tx/0x3cd38115cdea6b0fbcfcd441de5891236eb802fe0863a63cba9c336ce6ac6c83
in error.log i found every time this error
at getLendingPool (C:\Users\vkart\Desktop\bot\poly-flashloan-bot-main\dist\flashloan.js:31:46)
at C:\Users\vkart\Desktop\bot\poly-flashloan-bot-main\dist\flashloan.js:39:24
at Generator.next (<anonymous>)
at fulfilled (C:\Users\vkart\Desktop\bot\poly-flashloan-bot-main\dist\flashloan.js:5:58)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Just curious to see if anyone makes money with this bot because the example contract that was actually deployed seems to only have failed transactions (not profitable).
Thank you
insufficient funds for intrinsic transaction cost among other errors.
there is 7 Matic balance in the wallet which based on previous transactions should cover the gas
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":["0xf9078d3585746a52880083e4e1c094fc36872ebd477c3f10395c026036c0929298f7c780b907246bf2b46d000000000000000000000000000000000000000000000000000000000000002000000000000000000000000010dd6d8a29d489bede472cc1b22dc695c144c5c700000000000000000000000000000000000000000000000000000002540be4000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000046000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000002a0000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000020000000000000000000000001b02da8cb0d097eb8d57a175b88c7d8b4799750600000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000d500b1d8e8ef31e21c99d1db9a6444d3adf12700000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa84174000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000001f4000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000010000000000000000000000001b02da8cb0d097eb8d57a175b88c7d8b4799750600000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000020000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa841740000000000000000000000000d500b1d8e8ef31e21c99d1db9a6444d3adf127000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000020000000000000000000000001b02da8cb0d097eb8d57a175b88c7d8b4799750600000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000d500b1d8e8ef31e21c99d1db9a6444d3adf12700000000000000000000000007ceb23fd6bc0add59e62ac25578270cff1b9f619000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000001f4000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000020000000000000000000000001b02da8cb0d097eb8d57a175b88c7d8b4799750600000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000020000000000000000000000007ceb23fd6bc0add59e62ac25578270cff1b9f6190000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa84174000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000001f4000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000010000000000000000000000001b02da8cb0d097eb8d57a175b88c7d8b4799750600000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000020000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa841740000000000000000000000000d500b1d8e8ef31e21c99d1db9a6444d3adf127000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000820136a092be41c90199171cbaf13a726f49012781761107e08fd69896589a3f343de9d7a02751c537d059ca76e9748d9fb20e8a3ab19df7999fe9add041be686a4d7acbd7"],"id":51,"jsonrpc":"2.0"}","requestMethod":"POST","url":"https://polygon-mainnet.g.alchemy.com/v2/G5RvrE0Q5SmLt2jXV7X7GlvUU5qdBh6O"}, method="sendTransaction", transaction="0xf9078d3585746a52880083e4e1c094fc36872ebd477c3f10395c026036c0929298f7c780b907246bf2b46d000000000000000000000000000000000000000000000000000000000000002000000000000000000000000010dd6d8a29d489bede472cc1b22dc695c144c5c700000000000000000000000000000000000000000000000000000002540be4000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000046000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000002a0000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000020000000000000000000000001b02da8cb0d097eb8d57a175b88c7d8b4799750600000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000d500b1d8e8ef31e21c99d1db9a6444d3adf12700000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa84174000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000001f4000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000010000000000000000000000001b02da8cb0d097eb8d57a175b88c7d8b4799750600000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000020000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa841740000000000000000000000000d500b1d8e8ef31e21c99d1db9a6444d3adf127000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000020000000000000000000000001b02da8cb0d097eb8d57a175b88c7d8b4799750600000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000d500b1d8e8ef31e21c99d1db9a6444d3adf12700000000000000000000000007ceb23fd6bc0add59e62ac25578270cff1b9f619000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000001f4000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000020000000000000000000000001b02da8cb0d097eb8d57a175b88c7d8b4799750600000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000020000000000000000000000007ceb23fd6bc0add59e62ac25578270cff1b9f6190000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa84174000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000001f4000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000010000000000000000000000001b02da8cb0d097eb8d57a175b88c7d8b4799750600000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000020000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa841740000000000000000000000000d500b1d8e8ef31e21c99d1db9a6444d3adf127000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000820136a092be41c90199171cbaf13a726f49012781761107e08fd69896589a3f343de9d7a02751c537d059ca76e9748d9fb20e8a3ab19df7999fe9add041be686a4d7acbd7", code=INSUFFICIENT_FUNDS, version=providers/5.5.2)
at Logger.makeError (/root/poly-flashloan-bot/node_modules/@ethersproject/logger/lib/index.js:199:21)
at Logger.throwError (/root/poly-flashloan-bot/node_modules/@ethersproject/logger/lib/index.js:208:20)
at checkError (/root/poly-flashloan-bot/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:95:16)
at JsonRpcProvider. (/root/poly-flashloan-bot/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:659:47)
at step (/root/poly-flashloan-bot/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:48:23)
at Object.throw (/root/poly-flashloan-bot/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:29:53)
at rejected (/root/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) {
reason: 'insufficient funds for intrinsic transaction cost',
code: 'INSUFFICIENT_FUNDS',
error: Error: processing response 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":["0xf9078d3585746a52880083e4e1c094fc36872ebd477c3f10395c026036c0929298f7c780b907246bf2b46d000000000000000000000000000000000000000000000000000000000000002000000000000000000000000010dd6d8a29d489bede472cc1b22dc695c144c5c700000000000000000000000000000000000000000000000000000002540be4000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000046000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000002a0000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000020000000000000000000000001b02da8cb0d097eb8d57a175b88c7d8b4799750600000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000d500b1d8e8ef31e21c99d1db9a6444d3adf12700000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa84174000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000001f4000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000010000000000000000000000001b02da8cb0d097eb8d57a175b88c7d8b4799750600000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000020000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa841740000000000000000000000000d500b1d8e8ef31e21c99d1db9a6444d3adf127000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000020000000000000000000000001b02da8cb0d097eb8d57a175b88c7d8b4799750600000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000d500b1d8e8ef31e21c99d1db9a6444d3adf12700000000000000000000000007ceb23fd6bc0add59e62ac25578270cff1b9f619000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000001f4000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000020000000000000000000000001b02da8cb0d097eb8d57a175b88c7d8b4799750600000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000020000000000000000000000007ceb23fd6bc0add59e62ac25578270cff1b9f6190000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa84174000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000001f4000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000010000000000000000000000001b02da8cb0d097eb8d57a175b88c7d8b4799750600000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000020000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa841740000000000000000000000000d500b1d8e8ef31e21c99d1db9a6444d3adf127000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000820136a092be41c90199171cbaf13a726f49012781761107e08fd69896589a3f343de9d7a02751c537d059ca76e9748d9fb20e8a3ab19df7999fe9add041be686a4d7acbd7"],"id":51,"jsonrpc":"2.0"}", requestMethod="POST", url="https://polygon-mainnet.g.alchemy.com/v2/G5RvrE0Q5SmLt2jXV7X7GlvUU5qdBh6O", code=SERVER_ERROR, version=web/5.5.1)
at Logger.makeError (/root/poly-flashloan-bot/node_modules/@ethersproject/logger/lib/index.js:199:21)
at Logger.throwError (/root/poly-flashloan-bot/node_modules/@ethersproject/logger/lib/index.js:208:20)
at /root/poly-flashloan-bot/node_modules/@ethersproject/web/lib/index.js:301:32
at step (/root/poly-flashloan-bot/node_modules/@ethersproject/web/lib/index.js:33:23)
at Object.next (/root/poly-flashloan-bot/node_modules/@ethersproject/web/lib/index.js:14:53)
at fulfilled (/root/poly-flashloan-bot/node_modules/@ethersproject/web/lib/index.js:5:58)
at runMicrotasks ()
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
reason: 'processing response error',
code: 'SERVER_ERROR',
body: '{"jsonrpc": "2.0", "id": 51, "error": {"code": -32000, "message": "insufficient funds for gas * price + value"}}',
error: Error: insufficient funds for gas * price + value
at getResult (/root/poly-flashloan-bot/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:142:21)
at processJsonFunc (/root/poly-flashloan-bot/node_modules/@ethersproject/web/lib/index.js:344:22)
at /root/poly-flashloan-bot/node_modules/@ethersproject/web/lib/index.js:276:46
at step (/root/poly-flashloan-bot/node_modules/@ethersproject/web/lib/index.js:33:23)
at Object.next (/root/poly-flashloan-bot/node_modules/@ethersproject/web/lib/index.js:14:53)
at fulfilled (/root/poly-flashloan-bot/node_modules/@ethersproject/web/lib/index.js:5:58)
at runMicrotasks ()
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
code: -32000,
data: undefined
},
requestBody: '{"method":"eth_sendRawTransaction","params":["0xf9078d3585746a52880083e4e1c094fc36872ebd477c3f10395c026036c0929298f7c780b907246bf2b46d000000000000000000000000000000000000000000000000000000000000002000000000000000000000000010dd6d8a29d489bede472cc1b22dc695c144c5c700000000000000000000000000000000000000000000000000000002540be4000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000046000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000002a0000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000020000000000000000000000001b02da8cb0d097eb8d57a175b88c7d8b4799750600000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000d500b1d8e8ef31e21c99d1db9a6444d3adf12700000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa84174000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000001f4000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000010000000000000000000000001b02da8cb0d097eb8d57a175b88c7d8b4799750600000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000020000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa841740000000000000000000000000d500b1d8e8ef31e21c99d1db9a6444d3adf127000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000020000000000000000000000001b02da8cb0d097eb8d57a175b88c7d8b4799750600000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000d500b1d8e8ef31e21c99d1db9a6444d3adf12700000000000000000000000007ceb23fd6bc0add59e62ac25578270cff1b9f619000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000001f4000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000020000000000000000000000001b02da8cb0d097eb8d57a175b88c7d8b4799750600000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000020000000000000000000000007ceb23fd6bc0add59e62ac25578270cff1b9f6190000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa84174000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000001f4000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000010000000000000000000000001b02da8cb0d097eb8d57a175b88c7d8b4799750600000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000020000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa841740000000000000000000000000d500b1d8e8ef31e21c99d1db9a6444d3adf127000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000820136a092be41c90199171cbaf13a726f49012781761107e08fd69896589a3f343de9d7a02751c537d059ca76e9748d9fb20e8a3ab19df7999fe9add041be686a4d7acbd7"],"id":51,"jsonrpc":"2.0"}',
requestMethod: 'POST',
url: 'https://polygon-mainnet.g.alchemy.com/v2/G5RvrE0Q5SmLt2jXV7X7GlvUU5qdBh6O'
},
method: 'sendTransaction',
transaction: {
nonce: 53,
gasPrice: BigNumber { _hex: '0x746a528800', _isBigNumber: true },
gasLimit: BigNumber { _hex: '0xe4e1c0', _isBigNumber: true },
to: '0xFC36872EBD477c3f10395c026036c0929298f7c7',
value: BigNumber { _hex: '0x00', _isBigNumber: true },
data: '0x6bf2b46d000000000000000000000000000000000000000000000000000000000000002000000000000000000000000010dd6d8a29d489bede472cc1b22dc695c144c5c700000000000000000000000000000000000000000000000000000002540be4000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000046000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000002a0000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000020000000000000000000000001b02da8cb0d097eb8d57a175b88c7d8b4799750600000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000d500b1d8e8ef31e21c99d1db9a6444d3adf12700000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa84174000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000001f4000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000010000000000000000000000001b02da8cb0d097eb8d57a175b88c7d8b4799750600000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000020000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa841740000000000000000000000000d500b1d8e8ef31e21c99d1db9a6444d3adf127000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000020000000000000000000000001b02da8cb0d097eb8d57a175b88c7d8b4799750600000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000d500b1d8e8ef31e21c99d1db9a6444d3adf12700000000000000000000000007ceb23fd6bc0add59e62ac25578270cff1b9f619000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000001f4000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000020000000000000000000000001b02da8cb0d097eb8d57a175b88c7d8b4799750600000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000020000000000000000000000007ceb23fd6bc0add59e62ac25578270cff1b9f6190000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa84174000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000001f4000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000010000000000000000000000001b02da8cb0d097eb8d57a175b88c7d8b4799750600000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000020000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa841740000000000000000000000000d500b1d8e8ef31e21c99d1db9a6444d3adf127000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000',
chainId: 137,
v: 310,
r: '0x92be41c90199171cbaf13a726f49012781761107e08fd69896589a3f343de9d7',
s: '0x2751c537d059ca76e9748d9fb20e8a3ab19df7999fe9add041be686a4d7acbd7',
from: '0x1fc27eF673a4C61F0e58981efD3A4209f13c5651',
hash: '0xd51f21449c9f25930a37942d99c038558ec6795bb396f8eda511999e4db67303',
type: null,
confirmations: 0
},
transactionHash: '0xd51f21449c9f25930a37942d99c038558ec6795bb396f8eda511999e4db67303'
}
Node.js v17.3.1
root@vultr:~/poly-flashloan-bot/src#
value: BigNumber { _hex: '0x00', _isBigNumber: true },
data: '0x6bf2b46d000000000000000000000000000000000000000000000000000000000000002000000000000000000000000010dd6d8a29d489bede472cc1b22dc695c144c5c700000000000000000000000000000000000000000000000000000002540be4000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000046000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000002a0000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000020000000000000000000000001b02da8cb0d097eb8d57a175b88c7d8b4799750600000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000d500b1d8e8ef31e21c99d1db9a6444d3adf12700000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa84174000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000001f4000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000010000000000000000000000001b02da8cb0d097eb8d57a175b88c7d8b4799750600000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000020000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa841740000000000000000000000000d500b1d8e8ef31e21c99d1db9a6444d3adf127000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000020000000000000000000000001b02da8cb0d097eb8d57a175b88c7d8b4799750600000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000d500b1d8e8ef31e21c99d1db9a6444d3adf12700000000000000000000000007ceb23fd6bc0add59e62ac25578270cff1b9f619000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000001f4000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000020000000000000000000000001b02da8cb0d097eb8d57a175b88c7d8b4799750600000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000020000000000000000000000007ceb23fd6bc0add59e62ac25578270cff1b9f6190000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa84174000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000001f4000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000010000000000000000000000001b02da8cb0d097eb8d57a175b88c7d8b4799750600000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000020000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa841740000000000000000000000000d500b1d8e8ef31e21c99d1db9a6444d3adf127000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000',
chainId: 137,
v: 310,
r: '0x92be41c90199171cbaf13a726f49012781761107e08fd69896589a3f343de9d7',
s: '0x2751c537d059ca76e9748d9fb20e8a3ab19df7999fe9add041be686a4d7acbd7',
from: '0x1fc27eF673a4C61F0e58981efD3A4209f13c5651',
hash: '0xd51f21449c9f25930a37942d99c038558ec6795bb396f8eda511999e4db67303',
type: null,
confirmations: 0
},
transactionHash: '0xd51f21449c9f25930a37942d99c038558ec6795bb396f8eda511999e4db67303'
}
Node.js v17.3.1
Deploy a public smart contract because everyone don't have to deploy their own one.
Hello! anyone knows how to test trigger a execution of flashloan to the blockchain just to see if it is working properly.. at least streaming a tx.. I found a few opportunities but no TX was trigger. Also I don't know where exactly is the profit calculator.
Thanks!
I made some changes to the code (but not the smart contract) and once it found an arbitrage opportunity and it called the smart contract, it failed with the above error message.
Is there something wrong in the contract, or did I do something wrong on my side?
Any help would be much appreciated.
https://polygonscan.com/tx/0xa2685e50e596df610877ddf1f871b5443e232133f02a51310552f5c6d9e5b588
Hi guys,
New error here, I will continue my tests.
Fail with error 'AS'
Contract address: https://polygonscan.com/tx/0xf976a46752e1d447b9681b88ff52e6eda63db3b590f27b932492a40aab2854f7
https://polygonscan.com/address/0xf651b785aa4aac0edcf2220ad88a9d2b52f640ff
Here is my contract and here were all the opportunities my bot found, but there was a big delay in between, anyone knows how to shorten it?
These are the opportunities it found today, but when it goes to the contract, each of them had an around 20 mins delay.
This is the opportunity it found 4 days ago, also had an around 20 mins delay.
whare can change estimate profit
Minimize negative price impact
Make it possible to trade like 1inch -> it will get to trade at the price 1inch estimates
uniswap
0x
Would it be nice to have a log file that we can check that tracks all the meaningful events, like arbitrage opportunities detected with some related data or failures with stacktrace, that way we can help you debug the bot and report issues. Thoughts?
Hi,
since you recommended not using 1inch anymore I started redesigning the bot. I encountered the problem that we don’t know the „best“ protocol anymore. Executing the bot for every protocol makes no sense since cyclic arbitraging needs more than one pair. So i tried finding the protocol by asynchronously checking all exchange rates and returning the highest rate giving protocol BUT this causes the bot to fail at some point if i set low intervals. To summarize all my tests with different strategies the last weeks: i didn’t quite found the best performing solution for this :) since your private bot is profitable I’m highly interested in your strategy of finding the protocol!
Fail with error 'UniswapV2Library: INSUFFICIENT_INPUT_AMOUNT'
how can i resolve this error
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.
Hi! I try to start script and a few hours later he returned this result
undefined5 │ undefinedUSDT │ undefined1000.00 │ undefinedETH │ undefined1020.48 │ undefined20.5 │ undefined2.0 │ undefined │ undefined 2.4s │ undefined2022-02-04T21:53:53.923Z │50 │ undefined19.5 │ undefined 2.0 │ undefined │ undefined6 │ undefinedUSDT │ undefined1000.00 │ undefinedUSDC │ undefined1019.50 │ undefined19.5 │ undefined2.0 │ undefined │ undefined 2.0s │ undefined2022-02-04T21:53:53.506Z │17 │ undefined15.2 │ undefined 1.5 │ undefined │ undefined7 │ undefinedUSDT │ undefined1000.00 │ undefinedWMATIC │ undefined1015.17 │ undefined15.2 │ undefined1.5 │ undefined │ undefined 5.3s │ undefined2022-02-04T21:53:56.837Z
What could be the problem? As far as I understand, the script found a positive result, but nothing happened further. Nothing happened at the contract address
│ 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!
Hello @yuichiroaoki I would like to contact you but I cannot find your information anywhere. Can you send me your contact information to chat. TG/Skype/etc is best. Thankyou
I got quite some transactions that just say Fail
without further information. The bot seems to be running successfully, but somehow there is an error inside the smart contract. However, I have no idea how to debug this?
https://polygonscan.com/tx/0x62db419e8b7d43347e0ddb5e438fe8194bac07a3b520d018a7e89c478320d4f6
build succussfully but no output. in error.log like below
[2022-05-30T20:01:34.330] [WARN] error - Failed to estimate price: missing revert data in call exception
[2022-05-30T20:01:34.717] [WARN] error - Failed to estimate price: missing revert data in call exception
[2022-05-30T20:01:34.868] [WARN] error - Failed to estimate price: missing revert data in call exception
[2022-05-30T20:01:34.915] [WARN] error - Failed to estimate price: missing revert data in call exception
[2022-05-30T20:01:34.917] [WARN] error - Failed to estimate price: missing revert data in call exception
[2022-05-30T20:01:34.922] [WARN] error - Failed to estimate price: missing revert data in call exception
[2022-05-30T20:01:34.927] [WARN] error - Failed to estimate price: missing revert data in call exception
[2022-05-30T20:01:34.933] [WARN] error - Failed to estimate price: missing revert data in call exception
A conditional statement that executes the flash loan only if the arbitrage opportunity is profitable
Great bot here, thanks.
Once an opportunity is detected, i have (in my terminal) the table Flash Loans and the different opportunities in the table but nothing happens.
Should I have ETH or only MATIC in the wallet or in the contract?
Actually I have some MATIC in my wallet address but not any transaction is trigeered either in my wallet address or contract address and even on the 3 txns of the 3 opportunities at that time
Contract: https://polygonscan.com/address/0x1098b028Db5edDBD5f3b807D5F9Ea04B8268d342
Is your feature request related to a problem? Please describe.
Prevents MEV and Frontrunning bots from moving in and stealing the profit. Also prevents lost $ from failed transactions
Describe the solution you'd like
Additional context
Furucombo uses it and It works well.
Suggested on #10
Build a web UI with react
Hi,
Sorry to bother you again with the same issue.
I deployed in the mainnet and I still get the same error message.
I can see in alchemy I am sucefully making API calls but I still get the same error message.
Do you know how to solve this.
Thanks in advance.
Describe the bug
"not found libraries/RouteUtils.sol" when compiling on remix
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Contract to deploy
Any help would be greatly appreciated
Hi Yuichi,
I can't yarn install anymore since the last update. Any ideas?
➤ YN0000: ┌ Resolution step ➤ YN0000: └ Completed ➤ YN0000: ┌ Fetch step ➤ YN0013: │ @ethersproject/networks@npm:5.5.2 can't be found in the cache and w ➤ YN0013: │ @ethersproject/providers@npm:5.5.2 can't be found in the cache and ➤ YN0013: │ @ethersproject/random@npm:5.5.1 can't be found in the cache and wil ➤ YN0013: │ ethers@npm:5.5.3 can't be found in the cache and will be fetched fr ➤ YN0001: │ Error [ERR_STREAM_PREMATURE_CLOSE]: Premature close at new NodeError (node:internal/errors:371:5) at PassThrough.onclose (node:internal/streams/end-of-stream:134:30) at PassThrough.emit (node:events:390:28) at emitCloseNT (node:internal/streams/destroy:145:10) at processTicksAndRejections (node:internal/process/task_queues:82:21) ➤ YN0001: │ Error [ERR_STREAM_PREMATURE_CLOSE]: Premature close at new NodeError (node:internal/errors:371:5) at PassThrough.onclose (node:internal/streams/end-of-stream:134:30) at PassThrough.emit (node:events:390:28) at emitCloseNT (node:internal/streams/destroy:145:10) at processTicksAndRejections (node:internal/process/task_queues:82:21) ➤ YN0001: │ Error [ERR_STREAM_PREMATURE_CLOSE]: Premature close at new NodeError (node:internal/errors:371:5) at PassThrough.onclose (node:internal/streams/end-of-stream:134:30) at PassThrough.emit (node:events:390:28) at emitCloseNT (node:internal/streams/destroy:145:10) at processTicksAndRejections (node:internal/process/task_queues:82:21) ➤ YN0001: │ Error [ERR_STREAM_PREMATURE_CLOSE]: Premature close at new NodeError (node:internal/errors:371:5) at PassThrough.onclose (node:internal/streams/end-of-stream:134:30) at PassThrough.emit (node:events:390:28) at emitCloseNT (node:internal/streams/destroy:145:10) at processTicksAndRejections (node:internal/process/task_queues:82:21) ➤ YN0000: └ Completed in 2s 586ms ➤ YN0000: Failed with errors in 2s 795ms
https://polygonscan.com/tx/0x49ebdaae4fdf126c974e5a7e1198109454f9b9ce8aa5f2c4aa571192510a7793
seems to be the same error as before with the other contract, not sure how to troubleshoot this
finds plenty of opportunities, gas is set way higher than it needs to be just in case, also running in a VPS near the alchemy servers for improved speed
The following error message is expected when you run flashloan with no arbitrage opportunities.
Fail with error 'Not enough amount to return loan'
When the bot says there's an arbitrage opportunity and run flashloan, the transaction gets reverted because of the above error.
Attempting to add new (common) pairs; UNI, LINK I add addresses.ts entries, directly queried from 1inch Polygon API:
UNI: { symbol:"UNI", name:"Uniswap", decimals:18, address:"0xb33eaad8d922b1083446dc23f610c2567fb5180f", logoURI: "https://tokens.1inch.io/0x1f9840a85d5af5bf1d1762f925bdaddc4201f984.png" }, LINK: { symbol:"LINK", name:"ChainLink Token", decimals:18, address:"0x53e0bca35ec356bd5dddfebbd1fc0fd03fabad39", logoURI: "https://tokens.1inch.io/0x514910771af9ca656af840dff83e8264ecf986ca.png", },
and add trading pairs to config.ts:
export const tradingTokens = [
ERC20Token.DAI,
ERC20Token.WETH,
ERC20Token.USDC,
ERC20Token.USDT,
ERC20Token.WMATIC,
ERC20Token.UNI,
ERC20Token.LINK
];
Results in the following errors during testing:
yarn test results sample:
● Uniswap price check › POLYGON_UNISWAP_V3 › DAI -> LINK
missing revert data in call exception (error={"reason":"processing response error","code":"SERVER_ERROR","body":"{\"jsonrpc\":\"2.0\",\"id\":50,\"error\":{\"code\":-32000,\"message\":\"execution reverted\"}}\n","error":{"code":-32000},"requestBody":"{\"method\":\"eth_call\",\"params\":[{\"to\":\"0xb27308f9f90d607463bb33ea1bebb41c27ce5ab6\",\"data\":\"0xf7729d430000000000000000000000008f3cf7ad23cd3cadbd9735aff958023239c6a06300000000000000000000000053e0bca35ec356bd5dddfebbd1fc0fd03fabad390000000000000000000000000000000000000000000000000000000000000bb80000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000000000000000000\"},\"latest\"],\"id\":50,\"jsonrpc\":\"2.0\"}","requestMethod":"POST","url":"<MY ALCHEMY ADDRESS>"}, data="0x", code=CALL_EXCEPTION, version=providers/5.5.2)
at Logger.Object.<anonymous>.Logger.makeError (node_modules/@ethersproject/logger/src.ts/index.ts:225:28)
at Logger.Object.<anonymous>.Logger.throwError (node_modules/@ethersproject/logger/src.ts/index.ts:237:20)
at checkError (node_modules/@ethersproject/providers/src.ts/json-rpc-provider.ts:34:16)
at JsonRpcProvider.<anonymous> (node_modules/@ethersproject/providers/src.ts/json-rpc-provider.ts:562:20)
at step (node_modules/@ethersproject/providers/lib/json-rpc-provider.js:48:23)
at Object.throw (node_modules/@ethersproject/providers/lib/json-rpc-provider.js:29:53)
at rejected (node_modules/@ethersproject/providers/lib/json-rpc-provider.js:21:65)
● Uniswap price check › POLYGON_UNISWAP_V3 › USDT -> LINK
call revert exception (method="quoteExactInputSingle(address,address,uint24,uint256,uint160)", errorArgs=["Unexpected error"], errorName="Error", errorSignature="Error(string)", reason="Unexpected error", code=CALL_EXCEPTION, version=abi/5.5.0)
at Logger.Object.<anonymous>.Logger.makeError (node_modules/@ethersproject/logger/src.ts/index.ts:225:28)
at Logger.Object.<anonymous>.Logger.throwError (node_modules/@ethersproject/logger/src.ts/index.ts:237:20)
at Interface.Object.<anonymous>.Interface.decodeFunctionResult (node_modules/@ethersproject/abi/src.ts/interface.ts:425:23)
at Object.<anonymous> (node_modules/@ethersproject/contracts/src.ts/index.ts:392:44)
at step (node_modules/@ethersproject/contracts/lib/index.js:48:23)
at Object.next (node_modules/@ethersproject/contracts/lib/index.js:29:53)
at fulfilled (node_modules/@ethersproject/contracts/lib/index.js:20:58)
● Uniswap price check › POLYGON_UNISWAP_V3 › USDT -> LINK
call revert exception (method="quoteExactInputSingle(address,address,uint24,uint256,uint160)", errorArgs=["Unexpected error"], errorName="Error", errorSignature="Error(string)", reason="Unexpected error", code=CALL_EXCEPTION, version=abi/5.5.0)
at Logger.Object.<anonymous>.Logger.makeError (node_modules/@ethersproject/logger/src.ts/index.ts:225:28)
at Logger.Object.<anonymous>.Logger.throwError (node_modules/@ethersproject/logger/src.ts/index.ts:237:20)
at Interface.Object.<anonymous>.Interface.decodeFunctionResult (node_modules/@ethersproject/abi/src.ts/interface.ts:425:23)
at Object.<anonymous> (node_modules/@ethersproject/contracts/src.ts/index.ts:392:44)
at step (node_modules/@ethersproject/contracts/lib/index.js:48:23)
at Object.next (node_modules/@ethersproject/contracts/lib/index.js:29:53)
at fulfilled (node_modules/@ethersproject/contracts/lib/index.js:20:58)
Test Suites: 1 failed, 3 passed, 4 total
Tests: 18 failed, 133 passed, 151 total
Snapshots: 0 total
Time: 109.821 s
Ran all test suites.
All exchanges have the same error for UNI and LINK pairs.
Fees need to be calculated before send the transaction to avoid 'Not enough amount to return loan', 'INSUFFICIENT_OUTPUT_AMOUNT' errors... It would be nice if you can implement something like this:
Actually when you swap 3 times in one transactions it can be 0.05x3 = 0.15 % fees on top of the flashloans fees 0.09%... Total 0.24% and.... slippery can add it on top again if the bot takes to long time to get the quote :) Eg: 0.24 + 6 = 6.24%
'const diffAmount' should be here MORE than 1000 + 6.24% or 62.4 USD to return to loan BUT we don't know how many swaps will be done before getting the quote so this const doesn't really help for now (but interesting to get it there).
Everything need to be done in milliseconds.
To avoid "high slippery" Im testing some auto rotation proxies services directly in the CallUrl... (I'm not a dev so I try easy way first) in order to increase transactions speed. I'll continue my tests...
With all of this we may have much less opportunities but at least we will be able to get a profit from them when their is big prices movements and to make it works.
https://polygonscan.com/address/0x3b89c1a54a2db96826b1319ae393b52a86938e60
/Users/adedade/poly-flashloan-bot/dist/inchPrice.js:30
amount.toString() +
^
TypeError: Cannot read properties of undefined (reading 'toString')
at get1inchQuoteCallUrl (/Users/adedade/poly-flashloan-bot/dist/inchPrice.js:30:16)
at /Users/adedade/poly-flashloan-bot/dist/inchPrice.js:53:31
at Generator.next (<anonymous>)
at fulfilled (/Users/adedade/poly-flashloan-bot/dist/inchPrice.js:5:58)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
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?
Hi!
First of all thanks for sharing this code.
I am having an issue I cant solve when I use the command "yarn start". It says "Error Request failed with status code 400".
Can you please help me to sort that issue?
Thanks in advance.
I really appreciate what you have done but I'm not agree with what you have write.
I've edited your bot, I have removed 1inch API and add call directly with dex smartcontract quote.
I have done 1 to 1 swap.
I have run bot for several time but I never have found a profitable arbitrage!
I share an example:
1 USD Coin -> 0.99924 Tether USD [UNISWAP_V3]
1 USD Coin -> 0.99549 Tether USD [SUSHISWAP]
1 USD Coin -> 0.99407 Tether USD [QUICKSWAP]
1 USD Coin -> 0.99723 Tether USD [APESWAP]
1 USD Coin -> 0.99868 Tether USD [JETSWAP]
1 USD Coin -> 0.99818 Tether USD [POLYCAT]
1 USD Coin -> 0.99812 Tether USD [WAULTSWAP]
0.99924 Tether USD -> 0.99899 USD Coin [UNISWAP_V3]
0.99924 Tether USD -> 0.99774 USD Coin [SUSHISWAP]
0.99924 Tether USD -> 0.99918 USD Coin [QUICKSWAP]
0.99924 Tether USD -> 0.998 USD Coin [APESWAP]
0.99924 Tether USD -> 0.99855 USD Coin [JETSWAP]
0.99924 Tether USD -> 0.99623 USD Coin [POLYCAT]
0.99924 Tether USD -> 0.9971 USD Coin [WAULTSWAP]
Thank you for sharing your code!
I have it up and running by following your instructions but I keep getting lots of errors like Request failed with status code 400
. What am I doing wrong?
I am on the Polygon mainnet and the smart contract is deployed.
Thanks for your help.
When use the command source startup.sh I get the following error
[+] Building 2.3s (10/12)
=> [internal] load build definition from Dockerfile 0.1s
=> => transferring dockerfile: 38B 0.0s
=> [internal] load .dockerignore 0.1s
=> => transferring context: 35B 0.0s
=> [internal] load metadata for docker.io/library/node:16.14 1.1s
=> [internal] load build context 0.4s
=> => transferring context: 3.72kB 0.4s
=> [1/8] FROM docker.io/library/node:16.14@sha256:6e54786b2ad01667d46524e82806298714f50d2be72b39706770aed55faedbd7 0.0s
=> CACHED [2/8] WORKDIR /app 0.0s
=> CACHED [3/8] COPY package.json . 0.0s
=> CACHED [4/8] RUN yarn set version berry 0.0s
=> CACHED [5/8] COPY .yarn tsconfig.json .yarnrc.yml ./ 0.0s
=> ERROR [6/8] RUN yarn install 0.6s
------
> [6/8] RUN yarn install:
#10 0.593 node:internal/modules/cjs/loader:936
#10 0.593 throw err;
#10 0.593 ^
#10 0.593
#10 0.593 Error: Cannot find module '/app/.yarn/releases/yarn-3.2.0.cjs'
#10 0.593 at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
#10 0.593 at Function.Module._load (node:internal/modules/cjs/loader:778:27)
#10 0.593 at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
#10 0.593 at node:internal/main/run_main_module:17:47 {
#10 0.593 code: 'MODULE_NOT_FOUND',
#10 0.593 requireStack: []
#10 0.593 }
------
executor failed running [/bin/sh -c yarn install]: exit code: 1
TypeError: process.stdout.getWindowSize is not a function or its return value is not iterable
at /app/dist/index.js:27:38
at Generator.next (<anonymous>)
at /app/dist/index.js:8:71
at new Promise (<anonymous>)
at __awaiter (/app/dist/index.js:4:12)
at main (/app/dist/index.js:24:20)
at Object.<anonymous> (/app/dist/index.js:173:18)
at Module._compile (internal/modules/cjs/loader.js:1085:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
at Module.load (internal/modules/cjs/loader.js:950:32)
Using Ubuntu WSL2 and Yarn 3.2.0
Using yarn:
Yarn install & build seem to work, but yarn start command hangs infinitely.
/home/h4ckm1n/Documents/GitHub/poly-flashloan-bot/node_modules/@ethersproject/logger/src.ts/index.ts:225
const error: any = new Error(message);
^
Error: invalid BigNumber value (argument="value", value=[500], code=INVALID_ARGUMENT, version=bignumber/5.5.0)
at Logger.makeError (/home/h4ckm1n/Documents/GitHub/poly-flashloan-bot/node_modules/@ethersproject/logger/src.ts/index.ts:225:28)
at Logger.throwError (/home/h4ckm1n/Documents/GitHub/poly-flashloan-bot/node_modules/@ethersproject/logger/src.ts/index.ts:237:20)
at Logger.throwArgumentError (/home/h4ckm1n/Documents/GitHub/poly-flashloan-bot/node_modules/@ethersproject/logger/src.ts/index.ts:241:21)
at Function.BigNumber.from (/home/h4ckm1n/Documents/GitHub/poly-flashloan-bot/node_modules/@ethersproject/bignumber/src.ts/bignumber.ts:291:23)
at NumberCoder.encode (/home/h4ckm1n/Documents/GitHub/poly-flashloan-bot/node_modules/@ethersproject/abi/src.ts/coders/number.ts:25:27)
at /home/h4ckm1n/Documents/GitHub/poly-flashloan-bot/node_modules/@ethersproject/abi/src.ts/coders/array.ts:71:19
at Array.forEach ()
at pack (/home/h4ckm1n/Documents/GitHub/poly-flashloan-bot/node_modules/@ethersproject/abi/src.ts/coders/array.ts:54:12)
at TupleCoder.encode (/home/h4ckm1n/Documents/GitHub/poly-flashloan-bot/node_modules/@ethersproject/abi/src.ts/coders/tuple.ts:54:20)
at AbiCoder.encode (/home/h4ckm1n/Documents/GitHub/poly-flashloan-bot/node_modules/@ethersproject/abi/src.ts/abi-coder.ts:112:15) {
reason: 'invalid BigNumber value',
code: 'INVALID_ARGUMENT',
argument: 'value',
value: [ 500 ]
}
Waiting for the debugger to disconnect...
[nodemon] app crashed - waiting for file changes before starting...
Thread opened to discuss our progress on implementing V3
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.