[DeFi 101] Lending and Borrowing in DeFi

Moai Finance
5 min readFeb 8, 2024

--

To delve into the concept of lending and borrowing, it’s crucial to recognize it as a fundamental element of any financial system. We often encounter borrowing in our lives such as car loans or mortgages. The basic premise involves lenders providing funds to borrowers in exchange for the repayment with interest. Traditional lending and borrowing are typically facilitated by centralized intermediaries such as banks or peer-to-peer lending platforms, with the money market handling short-term transactions.

Example of the lending and borrowing in DeFi

What is Lending and Borrowing in DeFi?

DeFi lending empowers users to engage in decentralized and permissionless lending or borrowing, maintaining full control over their assets. Operating on smart contracts, DeFi lending is accessible to everyone without the need for personal details or reliance on external custody. Compound, as a main DeFi lending protocols, established money markets for specific tokens, allowing users to lend their tokens and earn interest based on the current supply APY (Annual Percentage Yield). The supplied tokens are used as collateral for borrowers, who must overcollateralize their loans. In this process, the smart contract issues other tokens that represent the supplied tokens and interest.

Why do we need lending market?

Borrowed funds can serve various purposes, from covering unexpected expenses to avoiding immediate token sales, enhancing leverage in a position for traders or capturing arbitrage opportunities. Creating money markets will provide more opportunities to participants to make profits in diverse ways. Especially in fast-moving markets, the lending market can be a good risk hedging strategy.

How to deal with the interest?

Users desiring to become lenders deposit their tokens into a designated money market and commence earning interest on their tokens based on the current supply APY. The tokens that lenders supplied will be sent to a smart contract and the smart contract will issue other tokens about supplied tokens and the interest. These token can be used to redeem for the underlying tokens. The interest that borrowers pay is the interest lenders earn, so the borrow APY is higher than the supply APY and the rates of the interest is based on lending and borrowing demand.

How does it work?

Example of Lending process in Compound by Finematics

Lend & Redeem
To explain the mechanics of lending, let’s try with Compound for an example. Users deposit tokens into Compound, receiving cTokens which are the supplied tokens in return.
For instance, a user deposited 10 ETH into the ETH market in Compound by the underlying exchange rate of 0.02 and received 500 cETH (10 / 0.02). The exchange rate would increase with each Ethereum block and it depends on the supply APY. In this example, the rate from cETH to ETH increases by 0.0000000004 with each block. Assuming that the rate does not change for a month in this example and 4 blocks per minute, the number is 0.0000000004 * 4 * 60 (1 hour) * 24 (1 day) * 30 (1 month) = 0.00006912.
We can add this number to the previous rate then, 0.02 + 0.00006912 = 0.02006912. The user now can redeem 500 * 0.02006912 = 10.03456 ETH which is around 0.35% more after a month and APY is around 4.2%. In this case, the lending protocol makes more ETH than the initial deposited amount.

Borrow & Repay
The borrowing limit depends on factors such as available funds in a market and the collateral factor controlled by the quality of supplied tokens. Collateral factor calculates how much can be borrowed based on what is the deposited token. For borrowing in Compound, users utilize cTokens as collateral and borrow different tokens. While collateral earns interest, users are unable to redeem or transfer assets as long as they serve as collateral. The amount available for borrowing depends on the collateral factor of the supplied assets. A smart contract monitors collateral across users’ accounts, calculating a safe borrowing limit to prevent immediate liquidation.
For example, the collateral factor of ETH is 75% which means you can borrow up to 75% value of collateral can be borrowed. The more you borrow, the more likely liquidation begins. When users repay the borrowed amount and unlock their collateral, they must also settle the accrued interest on the borrowed assets. The accrued interest is determined by the borrow APY and increases automatically with each Ethereum block.

Liquidation
If the value of the collateral decreases and hits a certain level, the liquidation of the collateral occurs to repay the borrowed amount. In order to fulfill this in a decentralized way, the Compound protocol avoids depending on a centralized authority to handle liquidation tasks. Instead, it encourages other participants to undertake liquidation actions and incentivizes them. These liquidators would repay borrowed funds and, in return, receive collateral in a different asset at a discounted rate.

DeFi category ranks by DeFiLlma

Conclusion

According to DeFiLlama, a prominent DeFi TVL (Total Value Locked) aggregator, the lending market takes the 2nd biggest category in DeFi sectors. Establishing money markets with tokens will accelerate growth speed of particular ecosystems in DeFi as well. Moai Finance will add money markets to give users financial advantages of hedging risks and reducing inventory costs by benefits of lending instead of utilizing spot assets.

Moai Finance

*** This post is for general informational and educational purposes to help users who are unfamiliar with DeFi investing using cryptocurrency to use the service. It is not a recommendation to invest in crypto assets and should not be used as a basis for investment decisions under any circumstances. It should not be construed as financial, legal, or other professional advice and you should seek advice directly from a qualified professional.

Cryptocurrencies are volatile in value. The value of your investment may rise or fall, and you may incur losses as well as gains depending on the fluctuations in the value of your investment. Please check carefully what the purpose of the investment is, whether it is reliable, and whether there are any risks in investing, we wish you a successful and safe investment.

--

--

Moai Finance

Universial Liquidity Gateway / Multi-chain DeFi / Follow us on Twitter — https://x.com/MoaiFinance