[DeFi Series] #2 Decentralized Asset Management and Yearn Finance

CPLABS
CPLABS-TECH
Published in
10 min readMay 10, 2021

In the previous post of this series, we looked at three major services (loan, currency exchange, and asset management) that are currently leading the DeFi ecosystem. In this post, for in-depth understanding of DeFi, let’s go one step further and focus on asset management protocols.

In particular, I’m planning to discuss the current status of DeFi through the development case of Yearn Finance, an Ethereum-based DeFi asset management protocol.

What’s an “Asset Management Protocol”?

In DeFi, an Asset Management Protocol is a bond-type fund product implemented through smart contracts on the blockchain network. Therefore, understanding funds in the existing financial market can be helpful to understand decentralized asset management protocols.

These days, it is easy to sign up for fund products thanks to the recent popularity of mobile-based securities. This has also increased the number of people with experience in fund investment. However, there are not that many people who actually understand the fund’s earning structure. Most of them think of banks or securities companies as a main operating entity since they sign up their fund products through these institutions. However, there is a separate entity that actually manages the investment.

In general, funds are operated by dividing roles into many institutions like vendors, asset managers, trustees and office management companies.

Source: Structure of DB asset operation and fund operation

Investors sign up their funds through vendors. Assets of the investors who signed up their funds are deposited into trustees that exist independently from vendors. Then, asset management companies request trustees to buy and sell stocks or bonds. After this, office management companies handle documents related to funds and set the price of the funds.

Since the investors’ assets are managed by several institutions, it is possible to prevent the funds from being indiscriminately abused. However, the participation of several institutions means an increase of commissions that investors have to pay. In conclusion, it is necessary to decentralize because trusting a single institution can lead to excessive concentration of power, but investors must endure the cost.

DeFi Asset Management eliminates the need for trust institutions by transparently automating the roles played by vendors, asset managers, trustees and office management companies through smart contracts.

In the DeFi asset management service, you can invest and recover assets by linking them with personal wallets without another sign up process.

The asset management protocol strategically invests the investor’s assets in other DeFi protocols (loans, exchange, asset management) based on algorithms. Investors can check their investment profits whenever they want and can transparently see the investing strategy. In addition, investors can recover the investment whenever they want and as much as they want without complicated procedures.

The need for asset management protocol

The asset management protocol follows profits by supplying liquidity to investors’ assets in other DeFi protocols such as loan protocols, automated market makers (AMM), etc. Sometimes it even invests in other asset management protocols. However, one of the characteristics of DeFi is that investors can directly invest in loans or AMMs. Then, is it necessary to use an asset management platform and pay commissions?

In order to understand the need for asset management protocols, we need to know the background of Yearn Finance.

Loan protocols appeared first in the DeFi market. Investors could deposit virtual assets to the loan protocol and receive interest income from other users who borrow money. However, as the number of loan protocols began to increase, optimization of investment became necessary. Since the interest rate of a loan protocol is determined by supply and demand, each protocol’s interest rate differs. From the investor’s perspective, in order to maximize the return on their investment, they need to move their investments while observing the returns of various loan protocols.

For example, let’s assume that an investor puts Tether (USDT), the stablecoin, in a place with the highest annual interest among loan protocols such as Compound, Dydx, Aave, etc. If the annual interest rate expected for each protocol’s tether deposit is 6%, 9%, or 4%, respectively, it would be smart to deposit in Dydx since it is expected to bring the highest return. However, if after a week the investment funds are concentrated in Dydx and the expected return of Compound moves higher than Dydx, the investor should consider withdrawing the investment and depositing it in Compound.

The expected return changes from moment to moment depending on the supply and demand of the funds. This means that the investors must focus on the interest of loan protocols and move their investments to maximize their expected return. In order to deal with this and automate this process, Andre developed the Earn contract.

Investors can expect to maximize their returns by simply depositing their assets in the Earn contract without the need of tracking high-interest loan protocols.

Moreover, the commission fee (gas price), which had to be paid each time the direct loan protocol was transferred, is required only once for the deposit and withdrawal to Earn. In other words, it is possible to share the commission fees among investors. In addition, when a large number of investment assets are gathered, strategies that are not easy to try with individual funds can be tried.

DeFi asset management has developed various and complicated strategies for more than simply comparing the interest rate of the loan protocol and investing where the expected return is the highest. For example, strategies like using the AMM protocol for investment, arbitrage trading using interest differences between each loan protocol, leveraged investment using unsecured loans, etc.

Therefore, when using an asset management protocol, individuals don’t need to understand the complicated investment strategy because they can expect the best return with minimal cost by simply depositing funds to it.

Development of Yearn Finance

Yearn can be categorized into three major versions:

  • Earn
  • Vault v1
  • Vault v2

Whenever the version was updated, there were major changes in structure and investment strategy.

Earn, the earliest version of Yearn, had a fixed investment strategy. However, this structure required changes due to diversification of the DeFi ecosystem. Starting from the Vault version, an independent investment strategy for each asset has been applied. In addition, the Vault version is designed to change the strategies if necessary.The Vault v2 has developed into a structure where multiple strategies can be applied at the same time for a single asset.

Earn

Earn, the first version, has a very simple structure. Strategies like deposit and withdrawal, asset storage, investment strategy, etc. are implemented as a single smart contract. It has a fixed investment strategy, meaning that it invests in the same strategy regardless of the type of asset. As previously mentioned, it uses the strategy of investing in the one with the highest APR (annual percentage rate) out of a total of four loan protocols at each investment point.

Structure of Earn’s smart contract

When an investor deposits their asset in Earn (yToken v1 in the image), APR Oracle determines the loan protocol with the highest interest rate at the moment and invests all assets in that service. APR Oracle is a smart contract designed to bring external DeFi’s annual percentage rate (APR) information. As a result, all investment processes are carried out on smart contracts using an on-chain method.

<Investment flow>

  1. Investors deposit their assets in a Yearn contract. During this process, the yToken, that works as a storage certificate, is issued.
  2. Earn contracts receive interest information of the current underlying asset from each loan protocol.
  3. The loan protocol with the highest annual interest rate is determined as an investment target. If it is different from the previous protocol, the existing investment is withdrawn and invested in the new loan protocol.
  4. Investors can return yToken and recover their investment at any time and as many times as they’d like.

Vault

Source

Unlike Earn, the structure of Vault v1 consists of a number of contracts that separate the functions and roles. Functions and roles are separated just like the existing financial market funds.

The main components of the Vault smart contract are: Vault, Controller, Strategy and Governance.

  • Vault: it works as a window for investors to deposit and withdraw assets. When you deposit your investment, yToken, which works as a storage certificate, is issued.
  • Controller: it works as an interface between Vault and Strategy and controls the communication and money flow.
  • Strategy: it’s a contract in charge of the investment strategy. It receives Vault assets and invests in external protocols.
  • Governance: it is a component for making important decisions for protocol operations such as strategy change, controller change, vault management, etc.

Earn uses the same investment strategy regardless of assets such as DAI, USDT, and USDC. However, starting from Vault v1, each asset uses a separate investment strategy. The investment strategy is developed by the user who has the role of “Strategist” and can be changed to a new strategy in Vault through voting from governance token holders.

For instance, in the case of the DAI Vault, it invests DAI as an underlying asset. For DAI Vault, an investment strategy called ‘StrategyDAICurve’ is applied. In the case of USDT Vault, it invests USDT as an underlying asset. For USDT Vault, an investment strategy called ‘StrategyUSDT3pool’ is applied.

In the case of Vault v1, most of the assets are using an investment strategy linked to the Curve AMM protocol. You can find the detailed investment strategies at the code level on Github.

Vault v2

In the Vault v2 structure, the controller contract is removed. Instead, users registered as Strategist and Guardian divide and substitute the role of existing controller platform.

For Vault v2, it mainly focused on improving the efficiency of operating investment capital. The main difference from other versions is that for each asset, multiple strategies are used simultaneously instead of one. Each strategy has an upper limit that can be managed among total assets. When the investment performance increases, the proportion of management also increases. This is to prevent the situation in which excessive investment is allocated to a specific investment strategy even when a specific investment strategy can no longer increase the rate of return. The return on investment can be reduced if too much capital is invested in certain protocols.

Vault v2 has become significantly more complex compared to previous versions in terms of strategy. For example, ‘StrategyGenericLevCompFarm’, one of the strategies used when investing in DAI Vault, operates as follows:

  1. If there is interest (COMP) occurred by depositing in Compound at the time of the previous investment, the COMP is received and changes Uniswap to DAI.
  2. Borrow DAI from Compound.
  3. Combine DAI borrowed from Compound and DAI deposited in Vault to invest in Compound.
  4. Borrow ‘x’ DAI from Dydx.
  5. Invest ‘x’ DAI borrowed from Dydx to invest in Compound
  6. Borrow ‘x’ DAIs from the compound at the reduced interest rate.
  7. Redeem ‘x’ DAIs to Dydx.

In particular, procedures 4 ~ 7 are methods using Dydx’s Flash Loan (unsecured loan). It is a strategy to arbitrarily lower loan interest by temporarily increasing the Compound’s loan pool supply.

The image below shows the mechanism of the assets actually moved by the above strategy:

The structural and strategic developments of each version of Yearn are summarized below:

<Structural development>

  • Earn: Fixed-single strategy, centralized contract structure.
  • Vault v1: Variable-single strategy, decentralized contract structure.
  • Vault v2: Variable-multiple strategy, decentralized contract structure.

<Strategic development>

  • Earn: invest in loan protocol that yields the highest returns at each investment point among many loan protocols.
  • Vault v1: liquidity provides investments to AMMs (Curve).
  • Vault v2: leveraged investment using Flash Loans and difference each protocol’s interest rate.

Although structures and strategies have developed over time, the main goal is to maximize return on investment.

Conclusion

Asset management protocols have eliminated the need for investors to analyze and understand other DeFi protocols. However, the unfamiliar way of wallet usage and non user-friendly UI/UX make investors hesitate. In order to expand the usage of DeFi and asset management protocols in the future, development of a user-friendly interface should be considered along with the structure and strategy. Eventually, CeFi (Centralized Finance) will be the main service in the form of investments instead of DeFi for individuals who do not have knowledge of the blockchain domain.

In terms of strategy, investment strategies are operated by a small number of strategists. In the future, it is expected to develop into a form in which anyone can freely propose strategies and receive rewards based on the performance.

In this article, we looked at DeFi, especially asset management protocol, through the development process of Yearn Finance. Because the asset management protocol is dependent on other DeFi protocols, the risks arising from the linked protocol can be conveyed. Therefore, in order to fully understand the value and risk of an asset management protocol, it is necessary to understand the external protocols linked to it.

In this series we will take a closer look at AMMs and loan protocols in the future. After that, we will look at possible problems in the connection between each protocol.

--

--

CPLABS
CPLABS-TECH

We unify and connect global businesses via Blockchain technology