Flash Loans

What are flash loans?
  • Users can borrow funds without any upfront collateral for a short period of time
  • The catch is you must pay the flash loan back in the same Ethereum transaction you bought it with
  • Can be up to millions of dollars borrowed
  • Must be paid back in the same cryptocurrency block that it was borrowed in
  • An innovative approach made possible by the DeFi space, flash loans come with risks. Flash loans have been used in the past to attack the lending protocols that issue them.
Flash Loans work like this:
  1. A borrower requests funds in the form of a flash loan.
  2. They instantly use the funds to take advantage of an arbitrage opportunity between two decentralized exchanges.
  3. Once the transaction is complete, the flash loan is returned with charged fees
  4. The borrower keeps whatever profits were accumulated from the arbitrage.
Why would you want a loan that you would have to pay back almost immediately? What’s the purpose?
Trading Arbitrage
  • Ex: If you bought BAT at Binance for $1,000,000 and sold it on Coinbase for $1,100,000 you would make $100,000 profit
    • Be aware that you do have to pay fees (Aave is 0.09%)
  • Easier Ex: If you bought an apple from your mom for $1 and sold it to your dad for $2, you would easily double your money
Collateral Swap
  • Users can exchange current collateral assets for other assets, making it easier for users to manage their risks and avoid getting liquidated.
  • Collateral, deposited before borrowing funds, can now be swapped for another cryptocurrency inside Aave.
  • Essentially you can change out your collateral without touching the initial amount of money you borrowed
  • When locking up cryptocurrencies as collateral there is a risk that the asset can devalue in price. If this occurs, a user could swap their cryptocurrency into a stablecoin to avoid price fluctuations.
  • Ex: Users collateralize ETH to borrow DAI. For some reason, they know that ETH price will decrease. Users transfer all ETH to YFI, and YFI then has good news so that the price increases. Therefore, users both avoid liquidation and can borrow more DAI due to the increase in YFI price.
  • image
Self-Liquidation

Example:

  • If you deposited 100 ETH into Aave and it was worth $200 each ($20k total), giving you interest over time
  • At the time, you needed money. So you took a loan worth $16k worth of Tether (stablecoin) to pay bills, of which you spent it all
  • Fast-forward and now 1 ETH = $2,000, so you now how $200k worth of ETH locked up as collateral from your deposit
  • To get immediate access to it, you take out a flash loan worth $16k of Tether to repay your loan and get access to your initial 100 ETH
  • You would then use that initial 100 ETH, convert it to Tether, and use it to repay back your original loan
  • Now you have withdrawn $184,000 ETH (fees included) without putting any of your own money upfront, essentially liquidating yourself