maksimryndin / ekubo-atomic-arbitrage

Atomic arbitrage bot for Ekubo
https://medium.com/@maksim.ryndin/how-to-create-an-atomic-arbitrage-bot-in-starknet-part-2-the-foggy-desert-d3f28fad69c7
MIT License
15 stars 2 forks source link

CLEAR_AT_LEAST_MINIMUM #1

Closed abduramann closed 3 months ago

abduramann commented 3 months ago

What do you mean by “ we cannot rely on the error instead of the profit estimation.”? Why can’t we rely on CLEAR_AT_LEAST_MINIMUM error? Or why can someone think that he should rely on that?

thanks.

maksimryndin commented 3 months ago

Hey! Thanks for the interest!

Disclaimer: I am not 100% sure on the reasoning below as I don't see the source code of contracts. It is based on different scattered information.

What I mean on relying - that we don't estimate a profit for a swap and just blindly execute the transaction hoping that it will be reverted just because we cannot withdraw an initial investment from balances of Ekubo Core contract.

For example, we transferred some amount (say 100 ETH) before any swap to our balance at Core contract. And it wasn't followed by any swap. After that we run the bot with a modified strategy: we transfer some amount (say 90 EHT) to Ekubo, execute a swap (or multihop swap), and clear at 90 ETH minimum hoping that in case the swap is unprofitable, the tx will be reverted. Sounds good but our balance at Ekubo already contains 100 ETH. So for an unprofitable arbitrage when we get less than 90 ETH back, the tx will not be reverted as the clear call will succeed.

I've finished the second part of the article today - perhaps, it will make things clearer. Feel free to comment! :) and upvote :)

abduramann commented 3 months ago

Understood. Thanks for clear explanation. In fact, I found out your repo before your article :) I’ll comment and upvote it once I’m available.