EatTheBlocks Forum

Flash Loans, MEV, Frontrunning, and more

Greetings. Found some interesting articles:

This is a $16k flash profit https://cryptopotato.com/defi-flashloands-how-someone-made-16000-with-zero-investment/

Of course, the ‘0 investment’ isn’t entirely true. As they used dydx, it cost 2 wei (under $0.01). They also had to pay gas fees (at the time, it wasn’t as high). Also, each time they swap, they pay the respective swap fees. They also pay the withdrawal fee.

This one $40,000 profit https://www.coindesk.com/markets/2020/08/12/first-mover-how-a-defi-trader-made-an-89-profit-in-minutes-slinging-stablecoins/.

What’s not addressed is if MEV, front running, or sandwiching were factors, and if so, how the person dealt with it.

In both articles, the coder used dydx, which I assume they did, because of the 2 wei fee (less than a penny). The $16k profit used curve, where as the $40k profit used uniswap and curve. What’s more interesting is that they weren’t doing a traditional arb of buying an asset on 1 pool, and reselling the same asset on a different pool. They took advantage of the price flux of multiple assets (stable coins, here), and multiple pools, to generate a profit.

To address the issues of MEV, front running, and sandwiches, I came across:

  • Flashbots
  • Archer DAO
  • MistX, which appears to work with Flashbots.

How to be able to take advantage of MistX, Archer, Flashbots? How would one code their flashbot smart contract, to use them?

When going between multiple assets–not just stablecoins, but variations of ETH, BTC, and other assets–how would one put it together? Take flash loan out in what asset (say using cream finance, or another that supports more assets than dydx), swap for what asset(s), and pay back the flash loan/swap, and profit. For example, tBTC, sBTC, pBTC, WBTC, RENBTC all have different prices, often differing by a few hundred dollars. Which would I start with, swap to, and then pay back and profit?

While researching the issues, I also came across some interesting articles on Polygon:

Have these been implemented, yet? If so, how to take advantage of, as mentioned in my first post. If not, any idea when?

I’m also interested in this…let’s do research and work it out together…