The Worst Sandwich: How to Lose 90% in One Swap
I went for a wild ride on the MEV train this morning. It’s tax season here in the US and in trying to cash out some funds I learned a very scary lesson. Here's my short cautionary tale about implicit risk.
Disclaimer: I am not an MEV expert, so I apo...
blog.developerdao.com4 min read
Thanks for that hint. I wasn't aware of that, too.
I've never used a DEX so far, only CEXes. On CEXes, there's the limit order, which ensures that you'll trade at a certain maximum price. Like "buy this token, but not if it costs more than $1.1", giving a simple example. On the other hand, there's also the "market order", where you trade no matter which price movements will happen. But usually it's not a too good idea to choose this. Because then such "bad surprises" might happen there, too.
So isn't there something like a limit order on DEXes? I'm a web3 dev, but still a ton of learning to do. Dunno how DEXes work in detail. But couldn't you e.g. code it like to revert a transaction if the result was not hitting some limit order criteria? I mean there are even things like flash loans, where you can trade and get millions, but then at the end through keeping it within the same transaction, everything will revert at the end if the loan is not paid back. So I'll kind of "naively" assume there could be a way to code a limit order, too ... well, the gas costs will be gone then. But at least you can be sure not losing 90%.