Until recently, the only way to secure DeFi loan was to lock-up large amounts of collateral. Flash loans are a new and exciting type of loan –  one that requires no collateral at all!

What are Flash loans?

Flash loans are a unique type of DeFi loan in which borrowed capital must be repaid in the same block. If the amount borrowed is not repaid in full within the block, the entire loan is canceled.

Despite the one-block restriction, flash loan funds can go much further within a block than most would assume. It common for Flash Loans to leverage several exchanges and lending protocols before repayment, all within the single block time-frame.

Since flash loans are not granted without ensuring repayment, they do not require collateral to be issued. This is in stark contrast to normal DeFi loans, which require over-collateralization.

In most instances, using flash loans requires programming experience, which unfortunately places the feature out of reach for many DeFi users.

What are Flash Loans For?

Flash loans are relatively new, with new potential use cases arising every month. Listed below are the ones we’ve observed so far.

Arbitrage opportunities

The most straightforward use case for flash loans is for arbitrage on simple price discrepancies between decentralized exchanges (DEXes).

A flash loan transaction can easily be directed to purchase an asset on DEX A, sell it on DEX B, and pocket the difference after repaying the loan.

These arbitrage opportunities can take many forms, and involve any number of exchanges, lending platforms, or other protocols.

Niche applications

Several unique use-cases are being developed using flash loans, especially in niches where a short-term loan can simplify an existing process.

A prime example of this would be DeFi Saver’s 1-transaction closing tool for Maker Vaults.

Manually de-leveraging or closing Maker Vaults can often involve unnecessary extra transactions, risks, and fees. This is especially true when attempting to avoid a Vault liquidation when one does not have Dai on-hand.

DeFi Saver’s automated solution boils down the Vault closure process into a single step, harnessing Aave’s flash loans to streamline the process. With the click of a button, users can repay their Vault debt with a Dai flash loan, convert some of their Maker collateral to Dai via a decentralized exchange, and repay the loan.

This is immensely valuable, as it can rapidly close Vaults and save a user precious time and fees – especially compared to the traditional “unwinding” process or a forced liquidation (which involves a liquidation fee of 13%).

Exploits

A controversial side to flash loans has been a recent flurry of so-called “attacks” on DeFi protocols, which have been funded with flash loans.

These attacks are different from traditional hacks in the sense that are not outright-theft. Rather, they’ve historically consisted of oracle manipulation to exploit thin order books and take advantage of bugs in smart-contracts – all while in the confines of the system rules.

One particular pair of attacks earlier this year targeted bZx, manipulating pricing data and resulting in a total loss of almost $1 million in Ether.

More recently, Balancer saw select token pools drained using Flash Loans to trigger an exploit with deflationary tokens.

Although devastating to those affected, these attacks are somewhat inevitable and do assist in stress-testing and discovering flaws in DeFi protocols.

DeFi Protocols Offering Flash Loans

Aave

Aave, which launched as ETHLend in 2017, is likely the best-known platform for flash loans. They were possibly the first to bring flash loans into the DeFi spotlight on a large scale, launching the feature at the very start of 2020.

They do not require any capital to get started, and charge a small flash loan fee of 0.09%. They provide guidance and a number of tutorials to help with flash loan implementation, which can be found here.

Aave is the liquidity pool provider behind the DeFi Saver 1-transaction closing tool for Maker Vaults.

dYdX

dYdX is a DeFi protocol best known for its decentralized exchange which is popular for margin-trading. They also offer flash loans using dYdX liquidity pools, however developers are somewhat left on their own for flash loan implementation.

For utilizing dYdX for flash loans, it is recommended to look at their official protocol documentation.

Uniswap V2

Uniswap launched version 2 of their platform on May 18th 2020, which includes their very own type of flash loans called “flash swaps”.

Although almost identical to the regular flash loan, Uniswap flash swap funds can be returned OR paid for in Ether, as long as the entire value of the loan is covered. In contrast, flash loans on other platforms must be repaid in the original asset.

Uniswap charges liquidity provider fees, by taking 0.3% off all input amounts – including the assets being repaid at the end of the flash swap.

Closing Thoughts

While Flash Loans have received somewhat of a bad rep in DeFi, we’re here to tell you that their possibilities will ultimately bring about much more benefits to end-users on a wider time scale.

With things like Flash Loans, markets can become more efficient as anyone in the world can exploit arbitrage opportunities without having a significant amount so capital on hand to do so. This premise of letting anyone act like a whale will unlock many unique features – many of which we have not thought of to date.

Sign up for This Week in DeFi