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

Transactions reverted "Fail with error 'Not enough funds to repay dydx loan!" #4

Open
olegmitrakhovich opened this issue Sep 1, 2020 · 11 comments

Comments

@olegmitrakhovich
Copy link
Owner

So far the bot was able to find some ARB opportunities, but all 3 transactions were reverted:
https://etherscan.io/address/0x92E52890cfA407D9713A6cFcd7FB6F8d50B99FB2

The error I am getting is "Fail with error 'Not enough funds to repay dydx loan!", no idea why this is happening? My theory is that the prices that the bot is finding are wrong, therefore the calculation of profit for that transaction is wrong. I tried switching to another service like QuickNode instead of Infura, but the result is the same. Any ideas are welcome :)

@olegmitrakhovich
Copy link
Owner Author

New block received. Block # 10769902
Kyber -> Uniswap. Dai input / output: 20000 / 20226.65515378271518166
Uniswap -> Kyber. Dai input / output: 20000 / 19864.450886301560153009
<------------------Using Gas Price:----------------------->
<BN: 4614ff8200>
Arb opportunity found Kyber -> Uniswap!
Expected profit: 55.41484450071518166 Dai
New block received. Block # 10769903
Kyber -> Uniswap. Dai input / output: 20000 / 20002.773397261110680253
Uniswap -> Kyber. Dai input / output: 20000 / 19864.36329089209059149
<------------------Using Gas Price:----------------------->
<BN: 4614ff8200>
Kyber -> Uniswap. Dai input / output: 20000 / 20002.773397261110680253
Uniswap -> Kyber. Dai input / output: 20000 / 19864.36329089209059149
<------------------Using Gas Price:----------------------->
<BN: 4614ff8200>
New block received. Block # 10769904
New block received. Block # 10769905
New block received. Block # 10769906
(node:30758) UnhandledPromiseRejectionWarning: Error: Transaction has been reverted by the EVM:
{
"blockHash": "0x5ab8fd72d3c70c8592a81de9b42b6c1056f72393b8119b95d6e7f5cbe5e28ee4",
"blockNumber": 10769905,
"contractAddress": null,
"cumulativeGasUsed": 7898434,
"from": "0x91df1a2da70f5a9085773ea483aa46f7c13a728f",
"gasUsed": 1217128,
"logs": [],
"logsBloom": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000$
"status": false,
"to": "0x92e52890cfa407d9713a6cfcd7fb6f8d50b99fb2",
"transactionHash": "0x92fd033de7fd2807f594a812cb96746c05b62732331e208e67cf2bae8cb0d990",
"transactionIndex": 74
}
at Object.TransactionError (/root/Defi-Arb-Bot/node_modules/web3-core-helpers/src/errors.js:96:21)
at Object.TransactionRevertedWithoutReasonError (/root/Defi-Arb-Bot/node_modules/web3-core-helpers/src/errors.js:108:21)
at /root/Defi-Arb-Bot/node_modules/web3-core-method/src/index.js:482:48
at
at process._tickCallback (internal/process/next_tick.js:188:7)
(node:30758) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or $
Kyber -> Uniswap. Dai input / output: 20000 / 19943.426926241242587365

@olegmitrakhovich
Copy link
Owner Author

@olegmitrakhovich
Copy link
Owner Author

transaction

@cnspot
Copy link

cnspot commented Sep 3, 2020

it mean uniswap sell price<buy price ,so money be come lesser?

@olegmitrakhovich
Copy link
Owner Author

olegmitrakhovich commented Sep 3, 2020

the prices that I am getting are just wrong and there was no ARB in actuality. @cnspot

@cnspot
Copy link

cnspot commented Sep 7, 2020

this bug had fixed now?
the bug of geting wrong prices

@StrawberryFlavor
Copy link

Maybe it would be better not to use dydx loan, just arbitrage on uniswap, the trading pair can be as follows: WETH--> token, token --> DAI, DAI-WETH, this is just an example. This can avoid the extra transaction cost of loan and only use the existing balance

@olegmitrakhovich
Copy link
Owner Author

hmmm good idea...pull request? @StrawberryFlavor

@krishanb4
Copy link

I think in your wallet must have dydx interest pay amount before getting loan

@olegmitrakhovich
Copy link
Owner Author

sorry, what do you mean? @krishanb4

@krishanb4
Copy link

krishanb4 commented Dec 12, 2020

if you use DAI(example) your wallet must have dydx fee(DAI) before start arbi. Because if your profit cannot pay dydx loan fee you have to pay it from your wallet DAI balance.

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

4 participants