---
title: 3.4 DeFi Lending
description: The basis of ‘lending’ and ‘credit’ and how they operate in Web3
---

# 3.4 DeFi Lending

Lending or ‘credit’ as a topic, is especially important in the macro context of crypto, as so much of the existing financial system is dependent upon it. In this lecture we will explain the basis of ‘lending’ and ‘credit’ and then dive into the specifics of how smart-contract enabled lending operates. We conclude, by pointing out, that lending in crypto is fundamentally changing the nature of credit in our monetary systems, and drastically altering how ‘money’ works. 

## What Does Credit Unlock? The Credit Creation Theory of Money

Traditional lending in the legacy financial system is the basis from which most people are able to purchase and own assets: (1) Most houses, are bought using a loan (Mortgage), (2) Most car payments are made from an auto-loan, and (3) Most businesses purchase commercial properties or other business items using credit as well. 

**Credit Agencies Set Rules of the Game:** Yet despite how widespread credit is in many societies, it is relatively centralized with the ‘rules of the game’ based upon ‘credit’ agencies that keep track of individual performance and assign scores deeming them fit or unfit for certain types of loans.

**Credit is Nation-State Dependent:** Zooming out a little more, we see that these silos and blockers are actually capped on the nation-state level, with differences in jurisdiction being responsible for differences in how credit is viewed and evaluated. 

**Credit Creation is How New Money is Created:** And from the most elevated position, we come to realize that credit creation - the creation of a new loan - is the basis from which more monetary supply is created and injected into a national economy. 

_"Since the 1980s, bank credit creation has decoupled from the real economy, expanding at a considerably faster rate than GDP. According to the Quantity Theory of Credit this is evidence that an increasing among of bank credit creation has been channeled into financial transactions.” (Where does Money Come From, Page 51)._


![](@site/static/img/bootcamp/mod-em-3.4.1.png)


_“Each and every time a bank makes a loan, new bank credit is created - new deposits - brand new money.” - Graham Towers (1939), Former Governor of the Central Bank of Canada_

_“In the Eurosystem, money is primarily created through the extension of bank credit… The commercial banks can create money themselves, the so-called giro money.” (Bundesbank, 2009)_

_“In the United Kingdom, money is endogenous - the Bank supplies base money on demand at its prevailing interest rate, and broad money is created by the banking system.” (Bank of England, 1994)_

All of this precursor is to understand the importance of lending in traditional finance, such that we can understand the implications of moving lending on-chain. Lending in traditional finance is managed by credit agencies and gatekeepers, it varies by jurisdiction and nation-state, and it is ultimately the basis of increased money supply that you and I tend to interact with. Keeping these three things in mind, let’s now see how crypto-lending turns legacy credit on its head! 

## Crypto Lending is For Global Money

For anyone interested in making sense of the question: Why do we need lending in crypto? Currently as it stands, money is locked on a regional level, insofar as an individual or an entity, must go through the commercial bank in that specific jurisdiction for approval on a loan. This limits the capacity and reach of credit, to the extent that foreign investors in a country are usually limited in their ability  to finance foreign purchases due to credit limits from their bank of origin. 

On a macro scale, crypto lending disrupts this model, by removing credit checks, by removing national indicators of ‘trustworthiness’ and simply outsourcing this problem to the rules programmed into the smart contract, with rates algorithmically set.

### The key principles of _Decentralized Financial Lending_ can be summarized as follows: 

* Loans are secured with assets held in a smart contract. 
* Loans are executed or liquidated based upon the time-duration of the loan, and whether sufficient value has been returned to the smart contract. 

_"If the collateral value falls below a specified ratio of the loan value, the position is automatically liquidated to pay back the debt.”_

* The system absorbs the loss of a loan repayment, usually by taking a fee from the interest paid by the borrower. 

_“A percentage of the interest paid by borrowers is typically allocated to a reserve pool to repay lenders when a liquidation fails to cover the value of the loan (failed liquidation).”_

* Rates for loans (in terms of interest) are algorithmically set based upon the _utilization rate_ of a lending pool. This weighs how many deposits remain in the pool, from how many loans have been taken out from it already. 

## DeFi Lending and How It Works

_DeFi Lending typically works by using smart contracts on a blockchain to facilitate the loan agreement between a borrower and a lender. The borrower and lender agree on the terms of the loan, such as the loan amount, interest rate, and repayment schedule, and the smart contract is used to enforce these terms. When the loan is repaid, the smart contract automatically releases the funds to the lender._

When a borrower wants to take out a loan, they deposit collateral, such as a stablecoin, or accepted token, into the smart contract. The smart contract then releases the loan amount to the borrower's wallet. The borrower then repays the loan, along with interest, according to the terms of the contract.

If lending is designed to be thoroughly decentralized, it requires the loan capital to be supplied by liquidity providers (instead of commercial banks). In this sense, the limit to the scope or amount of loans possible is capped by the total amount of available liquidity in the pool at a given time. Getting granular on the dynamics of each pool, the interest rate required by the borrower increases based on both the utilization rate, as well as the ‘token categorization’ of the loan (risky tokens trigger a lower Utilization Rate). 


![](@site/static/img/bootcamp/mod-em-3.4.2.png)


## Concrete Examples: Aave, MakerDAO, and Compound

The three most successful lending protocols to date all launched on Ethereum between 2017 and 2020. Since that time, they have accrued a total of 12 billion in TVL as of December 2022 - at its peak it was much higher. 

**[Aave](https://defillama.com/protocol/aave): 3.8 Billion, $2 billion USD borrowed.**

_“Aave is a decentralized non-custodial liquidity protocol where users can participate as depositors or borrowers. Depositors provide liquidity to the market to earn a passive income, while borrowers are able to borrow in an overcollateralized (perpetually) or undercollateralized (one-block liquidity) fashion.” [(Aave Docs)](https://docs.aave.com/hub/)_

Aave is one of the most well developed lending marketplaces in crypto. While it is maintained as a non-custodial liquidity protocol, its most recent version (Aave V3) has institutional KYC built into it, such that it can accommodate [clients like JP Morgan.](https://twitter.com/AaveAave/status/1587846905509433344) The other notable feature of Aave is its capacity to accommodate a vast diversity of different lenders: 


![](@site/static/img/bootcamp/mod-em-3.4.3.png)


As the image demonstrates, lending pools on Aave are customizable insofar as loans can be stable rate (meaning fixed interest payments of the same amount), variable rate (meaning changing payment amounts), utilizing interest bearing tokens, and for uncollateralized flash loans (discussed below).  Most interesting, is the fact that beyond the key users of Aave (lenders and borrowers), Aave offers lending services to wallets and dApps – meaning that in a smart-contract dominated future, we can imagine a world where self-executing code is programmed to lend or borrow from itself! _Is the composability thesis evident here?_

_Tokens:_

* _Aave: AAVE is the governance token of the AAVE ecosystem._ It is used for deciding on treasury allocation, and other mechanics of the protocol. Delegators can select users to represent their interests on the protocol by voting for or against specific proposals. 


![](@site/static/img/bootcamp/mod-em-3.4.4.png)


_Mechanism Design:_

The algorithmically programmed interest rates for different pools and different loans are the core of the incentive structure bringing lenders (liquidity) into pools that are able to service borrowers (users, dApps or wallets). Interestingly, because of the advanced design of the Aave ecosystem, the programmable contracts that execute loans are themselves governable by the community of token holders - such that there is a clear incentive to own the token and participate in the governance process. Finally, Aave can [also be staked, ](https://www.stakingrewards.com/earn/aave/)to protect  the protocol against a shortfall event and receive safeguard incentives in return. 

**[MakerDAO](https://defillama.com/protocol/makerdao): 6.31 Billion - DAI Issuance.**

[MakerDAO](https://docs.makerdao.com/getting-started/maker-protocol-101) trades as both a lending protocol, and a stablecoin issuance protocol, for its USD pegged asset DAI. 

_“MakerDAO is a lending platform that was launched in 2017 on the [Ethereum](https://www.coindesk.com/learn/how-does-ethereum-work/) blockchain. It powers a decentralized stablecoin called DAI. The protocol works by allowing anyone to take out loans in DAI using other cryptocurrencies as collateral.” ([Coindesk](https://www.coindesk.com/tech/2019/05/30/how-makerdao-works-a-video-explainer/))_

[DAI is collateralized by 127%](https://daistats.com/#/) using a basket of assets, including real-world assets. 


![](@site/static/img/bootcamp/mod-em-3.4.5.png)


_Mechanism Design of MakerDAO:_

_Tokens_: Two Tokens. 



* 1. MKR - Is used to govern the mechanics of the DAO. As a governance token, owners of MKR can decide on the DAI savings rate, and other levers that handle incentives for the protocol.
* 2. DAI - Is issued based upon assets that users lock into the DAO. This is the stable form of value that is issued out to borrowers locking up their collateral. Notably, DAI is backed by a basket of assets, including real-world fiat, and crypto. 

_Mechanism Design:_ 
Maker issues DAI out to users who collateralize their loan with other accepted token assets. Unlike other loans, there is no repayment time frame on the DAI, it is simply a stable form of value that can be used, in exchange for other value. Compared to Aave or Compound, Maker is a simpler design, offering only one type of lending pool, and issuing its own stable coin from that pool. Those who borrow DAI, can furthermore earn interest on their DAI by locking it up into the MakerDAO bank. Governance of the rates, as a way of increasing or decreasing the amount of DAI in circulation has led to Maker being referenced as the Central Bank of Crypto. 

**[Compound](https://defillama.com/protocol/compound)**: **1.9 billion in TVL, 600m Borrowed to Date.**

[Compound](https://thedefiant.io/what-is-compound-crypto) was one of the first lending protocols that stimulated DeFi Summer in 2020, and pioneered the concept of Liquidity Mining. Compound is the clearest example of algorithmically calculated interest rates based upon different pools structured by Liquidity Providers. 

_“Compound is an algorithmic, autonomous interest rate protocol built for developers, to unlock a universe of open financial applications.” ([DeFi Llama](https://defillama.com/protocol/compound))_

_Tokens:_

* _COMP:_ The COMP governance token is awarded out to anyone holding a c(Token) representative of either a loan or sourced collateral. The token can then be used to alter protocol mechanics via governance processes.
* _c(token):_ Any lent out token or collateralized asset, from which a user either earns or pays in interest for what it borrows. The lent out or collateralized asset is ‘delineated with a c’ similar to how liquid staking tokens work (stNEAR). 

_Mechanism Design:_

The mechanism design of Compound is directly in line with the algorithmic structure of LP pools and _Utilization Ratios_ discussed above. Users are incentivized to take out a loan if they do not wish to sell their underlying assets, but still wish to convert those assets to stable value that can be utilized. Liquidity Providers - or lenders - earn interest and token incentives for locking up their liquidity in a specific lending pool. The smart contract, maintains repayment rates, interest rewards, and new ratios for emergent loans, based upon how active a specific liquidity pool is. 

## Flash Loans

A final subset of DeFi lending worth diving into, is known as _flash loans._ The basis of a flash loan is for a user to be able to borrow and return the loan they take out, in the same transaction - so extremely quickly - depending on the L1 network they are utilizing. 

While flash loans may seem to be redundant, the underlying premise is that during the time in which the loan is received, and before the loan is paid back, a user can participate in some other smart contract operation such as arbitrage, liquidation, or another swap or loan. 


![](@site/static/img/bootcamp/mod-em-3.4.6.png)


Specifically flash loans are commonly used to:

* Swap collateral supporting a loan.
* Liquidate a liquidity pool on a decentralized exchange in order to refinance a loan. 
* Conduct arbitrage by exploiting the priced differences of an asset across various exchanges. 
* Exploit protocols for market manipulation, by creating artificial leverage. 

One of the most clear examples is a well known exploit done in the early days of Aave between Aave and Maker DAO: 


![](@site/static/img/bootcamp/mod-em-3.4.7.png)
_Source: [Moonpay blog](https://www.moonpay.com/learn/defi/defi-flash-loans)._

The conceptual logic of flash loans is to react faster than the chain is able to update, such that you can benefit off of moving your loan quickly into a specific operation, and then back to its originator. While many believe this is a potential vulnerability for lending protocols, others see it is a form of financial innovation. 

## Why is Lending such an Essential and Revolutionary Primitive for DeFi?

_On a crypto level:_ Credit enables the expedited flow of value, between assets, without requiring a buyer and seller to have to exchange them. It’s three primary innovations are as follows: 



* **Transparency and Security in the Lending Process:** Because the loan terms are encoded in a smart contract, the loan process is transparent and can be audited by anyone. This can help to reduce the risk of fraud as sometimes the case in the legacy financial system. Second, since the smart contract automatically manages the loan: Including tracking the borrower's repayment progress and enforcing penalties for late payments or non-payment. This eliminates the need for a traditional financial institution to manage the loan and allows for a more transparent and secure lending process.
* **Smart-Contract Based Loan Execution:** Because the loans are facilitated by smart contracts, they can be executed quickly and without the need for intermediaries, which can make the process more efficient and less costly. In the context of the nature of transaction costs, outsourcing loan execution to smart-contracts _significantly reduces transaction costs_ while also minimizing friction for the participating parties. 
* **Permissionless:** No Credit Checks or Borrower Specific Evaluations - as done in the legacy financial system. Anyone with collateral, is eligible to participate, and the smart contract operators as the manager and liquidator if the loan cannot be repaid. This makes credit participation a global, permissionless phenomenon, no longer limited by the nation state or specific credit agencies. 
  

_On a Macro Financial Level:_ In the broader context of economic history, and specifically the role that credit has played in money supply, DeFi Lending is fundamentally inverting the nature of credit - as being something supplied by a user, rather than created by a Commercial Bank (granted a commercial bank could supply the liquidity, which would inadvertently be created by them). Put more simply, lending in crypto is not based on credit creation; Instead, crypto lending requires prior tokens and liquidity in order to function. 

It inverts traditional lending in two fundamental ways: First, credit can no longer be created by a central intermediary with a mandate from the state to create money. Second, anyone can participate in either facet of the process, and there are no longer gatekeepers capable of barring certain individuals from participating.  Taken together, DeFi Lending is the first step in decentralizing and dis-intermediating control over credit supply across the legacy financial system. How this disintermediation couples with composable value creation across dApps, is _the macro question_ for the future of lending in crypto. 
