Posts

Flash Loans a Threat to Defi?

avatar of @gadrian
25
@gadrian
·
·
0 views
·
2 min read

A few days ago I didn't know flash loans existed in crypto.

The name is kind of self-explanatory: flash=quick.

What does that mean, more exactly? That someone can take such a flash loan often without collateral in a decentralized manner, with the condition to pay it back in the same transaction.

What do you mean "in the same transaction"? Well, here's where smart contracts come into place. On Ethereum and other chains that support them, smart contracts are more or less complicated programs. A flash loan smart contract would put together a number of operations, which are then executed in the same transaction by the blockchain.

Obviously, the first operation is taking the loan and the last one is to repay it, otherwise the whole smart contract won't execute, as far as I understood it. But in-between you can squeeze a number of other operations.

And here's the BIG issue with flash loans, in my opinion, and, from a quick search, apparently not only mine.

You can create a flash loan smart contract that manipulates the market price, for example - only a few days ago happened on Pancake Bunny on BSC - then taking advantage of impermanent loss, gain huge profits while leaving the platform(s) and everyone on them take the loss. All while the attacker pays back the loan and goes away with the profit.

This kind of exploit was invented on Ethereum, but it's now being used on BSC as well.

And this is a known exploit of the flash loans, which makes me wonder why are they still around, at least until someone comes out with a fix for this loophole?

Maybe because as long as there are lenders willing to offer flash loans and borrowers taking their chances, not necessarily as bad actors, they'll still be around.

The reaction has to come from the market. If these attacks become unprofitable (and even better, costly), they will soon stop. But we can't expect people to react, because they are too slow, as these attacks end within seconds or minutes, there needs to be some kind of smart contract counter-measures for when market manipulation is attempted.

If you want to learn more about flash loans, this is a good starting point: https://www.coindesk.com/what-is-a-flash-loan

Posted Using LeoFinance Beta