[DeFi series] #1 DeFi Ecosystem

CPLABS
CPLABS-TECH
Published in
8 min readMar 17, 2021

As virtual assets (also known as cryptocurrencies) became increasingly popular, there have been many attempts in the blockchain field to provide new value for virtual asset holders. Due to these efforts, DeFi, a blockchain-based form of financial service using virtual assets, is gaining popularity among investors.

In this DeFi series, for the purpose of in-depth understanding, let’s look gradually from user application service stage to smart contract code level.

Introduction

In the first part of the DeFi series, let’s explore the major services currently leading the DeFi market.

DeFi is a term used to refer to Decentralized Finance. As you can assume from its name, it includes financial services and the entire financial system as a whole. As a result the term DeFi has ambiguous boundaries and does not draw any specific image.

Currently, DeFi is developing new markets by creating relationships between services (loan, exchange, asset management, insurance, payment, futures, derivatives, etc) provided from the traditional market and each service on the blockchain field.

This article will mainly deal with Lending, Automated Market Makers (AMM), and Asset Management projects that are currently leading the DeFi markets among a variety of services. (In this case, the standard for ‘leading the market’ is based on the scale of interest of people and cash flow).

DeFi platform based on Ethereum

DeFi is not a concept dependent on a specific blockchain network. It is a blockchain based application service which can be composed on any kind of blockchain.

In the current stage, although the amount of deposited funds for Ethereum based DeFi service has dominant possession, many investors are turning their attention to other network-based DeFi due to the skyrocketing gas price of Ethereum. In specific, the Binance Smart Chain-based DeFi market is growing rapidly.

Lending & Borrowing

Compound, Maker, Aave, Dydx, etc., are P2P loan platforms that are implemented with smart contracts on the Ethereum network.

Investors can deposit their assets in a Lending Pool prepared for each virtual asset. Simply put, investors’ role is liquidity provider. At this time, token issued by most platforms works as a deposit guarantee which is absolutely necessary to recover the investment.

DAI and cDAI in Compound platform

For instance, cDAI is issued when depositing DAI in the DAI pool on a platform called Compound. In this case, cDAI is required to take the interest income and DAI that you have deposited.

DAI and cDAI in Compound platform

Loan users can borrow and use funds from a loan pool that has been collected from unspecified investors in a format of virtual assets. During this process, you have to submit other virtual assets as a collateral.

It could be hard to understand why you are borrowing specific virtual assets while submitting larger amounts of virtual assets as a collateral. However, you can accept this situation if you consider in a way that collateral is meant to keep investors’ assets safely.

So far, it is hard to find a difference with existing financial loan services except that the platform is implemented with smart contracts.

However, one interesting thing with DeFi is that it also allows loans without collateral. On platforms like Aave and Dydx, loans are allowed without collateral which is also known as flash loans. This is possible by dealing with all loans, investments, and repayments in one transaction. We will cover the flash loan in detail later on.

Automated Market Makers

Automated Market Makers(AMM) correspond to blockchain-specific exchanges. This back-end technology, which appeared about 30 years ago, is developing since new ways of transaction become possible based on blockchain technology. Based on this AMM, Decentralized Exchanges(DEX) are rapidly growing.

With blockchain, you cannot freely order like centralized exchanges because of gas commissions that are incurred every time a contract function is called. This eventually led to the demand for new methods which can replace the existing order book-centered transaction system. Therefore, the Automated Market Makers have drawn attention, since they determine the price according to the proportion of assets deposited in advance.

On AMMs platforms, market makers (or investors) deposit their two types of virtual asset pairs in a liquidity pool. In this stage, the value of two assets that are deposited must be the same based on their current price. For example, let’s assume that the price of ETH and DAI in the current market is $2000 and $1. In this case, the market maker can deposit in the ETH-DAI liquidity pool so that the total value of the asset ($10,000) has a ratio of 1:1, such as 5ETH:10,000DAI.

Service users use liquidity pools to swap one virtual asset for another. During this process, a paid commission fee is distributed as a reward to liquidity providers. In other words, the investors who are playing an important role in the service’s operation.

When a user exchanges a virtual asset, the exchange rate is automatically determined based on the ratio between the assets deposited in the liquidity pool. This price (ratio) depends on the fluctuation of supply (deposit) and demand (swap).

For example, if 10ETH and 20,000DAI are deposited in the ETH-DAI pool, the exchange rate between these two assets is 1:2000. However, if DAI and ETH are traded $1, $1500 each on the central exchange, arbitrage investors can earn $500 by purchasing ETH at $1,500 on the central exchange and converting it to DAI on AMMs platforms. In this case, the amount of ETH deposited in the liquidity pool increases while the amount of DAI decreases meaning that it will naturally lead to change of exchange rate. This process will continue until the ratio of these two assets’ value become identical as that of central exchange.

The exact exchange rate of two assets deposited in the pool is determined by the equation of specific constant and the amount of two assets. There are slight differences in formulas applied to each AMMs platform. Main examples of exchange rate determination methods are CPMM, CSMM, and CMMM.

  • CPMM: Constant Product Market Maker
  • CSMM: Constant Sum Market Maker
  • CMMM: Constant Mean Market Maker

The key to operate AMMs is to secure the sufficient amount of deposit assets since insufficient deposit assets in the pool can lead to non-permanent loss and imbalance of the pool. In order to avoid this problem, AMMs platforms usually provide incentives like governance tokens to liquidity providers in addition to commission fee rewards so it can induce inflow of many investors for stable service operation. Examples of Ethereum-based AMMs include Curve, Uniswap, and Sushiswap.

Asset Management

Simply put, an asset management platform is a decentralized fund. The asset management protocol is an indirect investment product that invests and manages funds collected from investors to other DeFi protocols (loan, liquidity pool, etc) mentioned above. Examples of Ethereum-based asset management platforms include Yearn Finance, Harvest Finance, and Badger DAO.

For a better understanding, let’s see a simple investment strategy that asset management platforms actually use:

In this example, users are willing to invest their own DAI into DAI loan protocol. All of the Compound, Aave, and Dydx platforms have their own DAI pool and the current interest of DAI loan for each platform is shown below:

  • Compound: 10%
  • Aave: 8%
  • Dydx: 12%

If we presume that investors are rational, they will definitely invest their DAI in the Dydx platform since it is expected to have the highest return.

However, if after a week, loan interest of Dydx falls to 8% and loan interest of Compound rises to 11%, investors will take the funds invested in Dydx and invest them in Compound. This kind of action will continue whenever the loan interest of each platform changes. Moreover, the gas price coming from the change of platform is not easy to ignore.

By investing in the DeFi asset management platform, investors can deal with two problems mentioned above. For instance, if an investor entrust their DAI to Yearn Finance’s Vault, Yearn will periodically check the information of each loan protocol’s interest and invest in the platform with the highest level of interest rate at each investment point. All of these processes are dealt automatically by a smart contract.

<Investment flow>

1. Investors deposit their assets in a Yearn smart contract. At this time, yToken is issued.

2. Yearn smart contract collects the interest information of each loan protocol.

3. Yearn determines the loan protocol with the highest annual interest rate as an investment target. If it’s not the platform previously invested, the smart contract retrieves the existing investment and invests in a new loan protocol.

4. Investors can return their yToken and retrieve their investment whenever they want.

Currently, the strategy used in asset management is applied not only on loan protocols but also other DeFi platforms.

We will look at the investment strategy in detail in upcoming posts.

Conclusion

As mentioned before, DeFi provides various services in addition to loan, exchange, and asset management. Furthermore, each service is connected closely to each other forming a complex ecosystem. Compared to how sudden DeFi came up to the surface, it is very complicated when you look inside.

Starting from difficult UI/UX, the complex usage of DeFi is becoming an obstacle for people who are new to it. In addition, there are many tasks to solve for DeFi to improve, such as credit management risks and regulations according to guidelines of anti-money laundering organizations. However, there will be many efforts to close the gap between users and technologies considering the potential of DeFi.

This article introduced some of the representative services of DeFi. Following articles will take one step further and will focus on Yearn Finance, which is one of the representative asset management platforms. By tracking the progress of Yearn protocol, we will understand the flow and direction of DeFi and also understand how to use blockchain and smart contracts from a technological perspective.

If you have any opinions or issues related to this blog, please contact us through:

* contact@coinplug.com

--

--

CPLABS
CPLABS-TECH

We unify and connect global businesses via Blockchain technology