Skip main navigation

How do borrowing and lending work in DeFi?

The main reason people want to borrow crypto assets from a DeFi protocol is for trading and speculation purposes.
Looking up at skyscrapers
© RMIT 2021

The main reason people want to borrow crypto assets from a DeFi protocol is for trading and speculation purposes. For example, if someone was bullish on ETH and had $250 worth of ETH and didn’t want to liquidate, they could deposit that amount to a DeFi vault and borrow $200 worth of USDC or Dai and use that to buy more e.g. $200 USD worth of more ETH.

This allows the speculator to transform their $250 ETH position into a $450 ETH position i.e. leveraging into a larger position. The advantages of doing so through DeFi lending platforms is that as a borrower you are not handing over custody of your collateral to an institution where you might face counterparty risk (instead you face a different protocol risk).

Another potential advantage is that it preserves anonymity and avoids KYC (know your customer) procedures.

What are flash loans?

One innovation in the DeFI space is flash loans e.g. offered by the Aave protocol. This opens the door to all kinds of transactions that were previously restricted due to frictions in the traditional finance space. To recap, flash loans are loans that can be borrowed without collateral and are borrowed and repaid within the same blockchain transaction.

A common use case for flash loans is arbitrage. If someone can see a mispricing for example 1 DAI = $1 USDC on Balancer but 1 DAI = $0.95 USDC on Curve. A flash loan would allow someone for example to instantaneously borrow 100,000 DAI on AAVE, buy 100,000 USDC on Balance and sell for 105,263 DAI on Curve (100,000/0.95). After repaying the AAVE loan of 100,000 DAI with 0.09% flash loan fee (i.e. repaying back 100,090 DAI) that would leave the would-be arbitrageur a profit of 5,173 DAI (105,263-100,090).

Visual example of flash loan explained in article

The open-access aspect of DeFI means anyone can avail themselves of this mispricing opportunity, whereas in traditional finance many arbitrage opportunities can go missed if people don’t have the access to funds or the ability to combine both buy and sell legs of the arbitrage in a timely manner. It is worth bearing in mind there are other considerations when carrying out arbitrage such as slippage, gas fees and miner extractable value (MEV) front-running risks.

Another main use case for flash loans is refinancing. The concept of debt refinancing will be familiar to those who have moved a mortgage from one institution to another. In the DeFi space perhaps a user at Compound has borrowed DAI at an interest rate of 10% but sees that Aave are suddenly offering a loan at only 5%. A flash loan can allow the user to simultaneously pay back the loan on Compound withdraw the collateral, deposit collateral at Aave and take out a loan there at the cheaper 5% rate. Also if the user has a leveraged trading position from borrowed funds that is also lent out at Compound, users can refinance this trading position instantaneously without having to liquidate or unwind both trades. In this example, the user has transferred their loan (and collateral) from Compound to Aave.

A similar use case is collateral swapping whereby a user who has taken out a loan on Compound with ETH as collateral, with a flash loan can pay back the loan, withdraw the ETH, swap the ETH for BAL on Uniswap and retake the loan at Compound but this time with BAL as deposited collateral. In this example the loan at Compound is essentially still the same, it has just been refinanced with BAL as the supplied collateral instead of ETH.

Another use case is self-liquidation. If for example, the value of your collateral in ETH is decreasing to levels close to where the protocol will auto-liquidate your loan of token DAI, you may wish to take out a flash loan to close out the loan to avoid the liquidity fee from the protocol (who liquidates your collateral at a discount). If in this example you don’t have the DAI funds to pay off your loan and you do not wish to acquire more, you can take a flash loan in Dai to pay off your loan and reclaim your ETH deposit minus flash loan fee.

The main advantages of being a DeFI lender are the attractive rates of return, often 5-30% annualised yield compared to around 1% in fiat currencies. This allows crypto assets to earn a passive income on their holdings without liquidating. Another reason to engage in DeFi lending is to avoid capital gain tax on crypto holdings. By not selling crypto holdings, keeping potential gains unrealised and lending on DeFI platforms to avoid taxable events can sometime be an incentive.

Further Reading and Viewing:

DeFi Decoded – Lending and Borrowing of Crypto Assets, Ninepoint Partners YouTube video

DeFi and the Future of Finance, Forthcoming August 2021, Book by Ashwin Ramachandran, Campbell Harvey, and Joey Santoro

© RMIT 2021
This article is from the free online

Decentralised Finance: Blockchain, Ethereum, and The Future of Banking

Created by
FutureLearn - Learning For Life

Reach your personal and professional goals

Unlock access to hundreds of expert online courses and degrees from top universities and educators to gain accredited qualifications and professional CV-building certificates.

Join over 18 million learners to launch, switch or build upon your career, all at your own pace, across a wide range of topic areas.

Start Learning now