An article to understand the money market protocol Compound
WePiggy_小猪存币
2020-12-01 08:43
本文约7495字,阅读全文需要约30分钟
Pay tribute to the pioneers of DeFi.

author

Robert Leshner, Geoffrey Hayes

https://compound.finance

author

WePiggy Community Volunteer-Qingqingwa (Reviser: wjw, Chuan page | Typesetting: Chuan page)

https://wepiggy.com

Summary

This paper introduces a decentralized protocol based on supply and demand that establishes money markets with algorithmically set rates, allowing users to frictionlessly exchange the time value of Ethereum assets.

Table of contents

Table of contents

1 Introduction................................................ ................................................... ................... 3

2 Compound protocol................................................... ................................................ 4

2.1 Supply Assets ................................................ ................................................ 4

2.1.1 Main use cases................................... ................................................ 4

2.2 Borrowing Assets................................................ ................................................ 5

2.2.1 Collateral value................................................... ................................... 5

2.2.2 Risk and liquidation................................................ ................................... 5

2.2.3 Main use cases................................... ................................................ 6

2.3 Interest rate model................................... ................................................ 6

2.3.1 Liquidity Incentive Structure................................................... ................................... 6

3 Implementation and system framework................................... ................................................... 7

3.1 cToken contract................................................... ................................................. 7

3.2 Interest Rate Mechanism................................................ ................................................ 8

3.2.1 Market dynamics................................... ..................................... 8

3.2.2 Debit dynamics................................................... ..................................... 8

3.3 Borrowing................................................... ................................................... ..... 9

3.4 Liquidation................................................ ................................................... ..... 9

3.5 Price feed................................................... ................................................... ...... 9

3.6 Auditor................................................... ................................................... .. 9

3.7 Governance................................................ ................................................... ... 10

refer to................................................. ................................................... ................................ 11

first level title

1 Introduction

The market for cryptocurrencies and digital blockchain assets has grown into a vibrant ecosystem where investors, speculators, and traders exchange thousands of [1] blockchain assets. Unfortunately, the complexity of financial markets has not kept pace: participants have little ability to trade the time value of assets.

Interest rates fill the gap between those who have idle assets and those who have none (assets that can be used for production or investment); the time value of trading assets is beneficial to both parties and creates non-zero-sum wealth. For blockchain assets, there are currently two major flaws:

l Extremely limited borrowing mechanisms, which lead to mispricing of assets (such as "liar coins" with unfathomable valuations, because there is no way to short them).

l Blockchain assets have negative yields due to huge storage costs and risks (whether on or off exchanges), with no natural interest rate to offset these costs. This exacerbates volatility because there is no incentive to hold coins.

Centralized exchanges (including Bitfinex, Poloniex, etc.) allow customers to trade blockchain assets on margin, and there is a "borrowing market" built into the exchange. These are trust-based systems (you have to trust that the exchange won't get hacked, steal your assets, or close out your positions by mistake), limited to a specific group of customers, and limited to a few (the most mainstream )assets. Finally, balances and positions are virtual; you cannot move positions on-chain, for example using borrowed Ethereum and other tokens in smart contracts or ICOs, making these facilities inaccessible to dApps[2].

In this article, we will introduce a decentralized system for lending and lending Ethereum tokens frictionlessly, without the drawbacks of existing methods, enabling proper money markets to function, and creating a secure positive yield method to store assets.

first level title

2. Compound protocol

Each money market corresponds to a unique type of Ethereum on-chain asset (such as ETH, ERC-20 stablecoin (such as Dai) or ERC-20 utility token (such as Augur)), and contains a transparent and publicly inspectable Ledger, which records all transactions and historical interest rates.

secondary title

2.1 Supply Assets

On an exchange or P2P platform, a user's assets are lent to another user through a matching method, while the Compound protocol aggregates each user's supply; when a user provides an asset, it becomes a homogeneous resource . This approach provides much greater liquidity than direct lending; unless all assets in the market are borrowed (see below: Protocol Incentivizes Liquidity), users can withdraw assets at any time without having to wait for a specific loan to mature.

Assets supplied to the market are represented by a balance of ERC-20 tokens (“cTokens”) that entitle the owner to increasing amounts of the underlying asset. As the money market generates interest (which is a function of borrowing demand), cTokens can be exchanged for more underlying assets than before. This way, earning interest requires simply holding an ERC-20 cToken.

2.1.1 Main Use Cases

Whether it's dApps, machines, or exchanges, as long as you hold token balances in these markets, you can use the Compound protocol as a source of monetization and use these balances to obtain incremental returns; this may open up new opportunities for the Ethereum ecosystem. business model.

secondary title

2.2 Borrowing Assets

Compound allows users to use cTokens as collateral, frictionlessly borrow from the protocol, and use them anywhere in the Ethereum ecosystem. Unlike P2P protocols, borrowing from Compound simply requires the user to specify the desired asset; there are no negotiable terms, maturity dates, or funding terms; borrowing is instant and predictable. Similar to offering an asset, every money market has a floating rate set by market forces that determines the cost of borrowing each asset.

2.2.1 Collateral value

Assets held by the protocol (represented by ownership of cTokens) are used as collateral for borrowing from the protocol. Each market has a pledge rate from 0 to 1, which represents the portion of the value of the underlying asset that can be borrowed. Assets with illiquid market capitalization and small market capitalization ratios are relatively low, and they cannot be used as good collateral. Assets with high market value and strong liquidity have a relatively high pledge rate. The value of various underlying token balances in an account multiplied by their respective pledge rates is equal to the user's borrowing ability.

Users can borrow assets up to their borrowing capacity, and the account cannot take any actions that would cause the total value of borrowed assets to exceed its borrowing capacity (for example, borrowing, transferring cToken collateral, or redeeming cToken collateral); this protects the protocol Avoid the risk of default.

2.2.2 Risk and liquidation

If the account’s outstanding loan value exceeds its borrowing capacity, a certain percentage of the outstanding loan can be repaid by other accounts in exchange for the account’s cToken collateral, and the liquidation price is slightly better than the market price, which is the current market price minus the liquidation discount ; this incentivizes an ecosystem of arbitrageurs to step in quickly to reduce borrower exposure and de-risk the protocol.

The liquidation coefficient refers to the ratio of the repayable part of a liquidation to the loaned assets each time the liquidation is called, ranging from 0 to 1, such as 25%. The liquidation process can continue until the user's borrowed funds fall below their borrowing capacity.

Any Ethereum address that owns the borrowed asset can call the liquidation function, exchanging its asset for the borrower's cToken collateral. Since users, assets, and prices are all included in the Compound protocol, liquidation is frictionless and does not depend on any external systems or orders.

2.2.3 Main Use Cases

Being able to seamlessly hold new assets (without selling or rearranging portfolios) brings new superpowers to consumers, traders and developers of dApps:

l No need to wait for the order to be completed, and no need to perform off-chain operations, dApps can borrow tokens and use them in the Ethereum ecosystem, such as purchasing computing power on the Golem network.

l Traders looking to short tokens can borrow tokens, place them on an exchange, and then sell tokens, profiting from the drop in overvalued tokens.

secondary title

2.3 Interest Rate Model

Instead of a single funding provider or borrower having to negotiate terms and interest rates, the Compound protocol uses an interest rate model that achieves an interest rate equilibrium based on supply and demand in each money market. According to economic theory, interest rates (the "price" of money) rise as a function of demand; when demand is low, interest rates fall. vice versa. Utilization across markets unifies supply and demand into one variable:

Demand curves are compiled through governance and expressed as a function of utilization. For example, the borrowing rate might be something like

The interest rate earned by the provider of funds is implicit, equal to the borrowing rate multiplied by the utilization rate.

The protocol does not guarantee liquidity; instead, it relies on an interest rate model to incentivize it. During periods of extreme demand for an asset, the protocol’s liquidity (the tokens that can be withdrawn or borrowed) will drop; when this happens, interest rates will rise, stimulating supply and discouraging borrowing.

first level title

At the heart of the money market is a ledger that allows Ethereum accounts to supply or borrow assets while accruing interest as a function of time. The protocol’s smart contracts will be open to the public, free for machines, dApps, and users alike.

secondary title

3.1 cToken contract

As the total borrowing in the market increases (as a function of borrower interest accumulation), the exchange rate between the token and the underlying asset also increases.

secondary title

3.2 Interest Rate Mechanism

The Compound money market is defined as a uniform interest rate for all borrowers, which adjusts over time as supply and demand change.

The history of each interest rate in each money market is recorded by an Interest Rate Index (Interest Rate Index), which is calculated every time the interest rate changes, it is minted, redeemed, borrowed, repaid by users or when assets are liquidated.

3.2.1 Market Dynamics

Every time a transaction occurs, the interest rate index of the asset is updated, compounding the interest since the previous index, using the interest during the period, denominated in r * t, calculated using the interest rate of each block

Total market outstanding borrowings are updated to include interest outstanding since the last index:

A portion of accumulated interest is reserved (reserved) as a reserve, determined by reserveFactor (reserve factor), ranging from 0 to 1:

3.2.2 Borrowing Dynamics

The borrower's balance, including interest due, is a ratio calculated by dividing the current index by the index of the user's balance at the last checkpoint.. This tuple describes the account balance when the last interest was paid.

secondary title

3.3 Borrowing

Borrowing interest is calculated in exactly the same way as balance interest in Section 3.2; the borrower has the right to repay an outstanding loan at any time by calling the repayBorrow(uint amount) function.

secondary title

If the user's loan balance exceeds the total collateral value (borrowing ability) due to the decrease in the value of the collateral or the appreciation of the borrowed assets, the public function liquidate(address target, address collateralAsset, address borrowAsset, uint closeAmount) can be called, the caller It will exchange its own assets with the borrower's collateral at a slightly better price than the market price.

secondary title

Price Oracles (price oracles) maintain the current exchange rate for each supported asset; the Compound protocol delegates the ability to set asset values ​​to a committee that aggregates prices from the top 10 exchanges. These rates are used to determine borrowing capacity, collateral requirements, and all functions required to calculate account valuations.

secondary title

3.6 Auditor

Every function call is validated by a policy layer called the Comptroller; the contract confirms collateral and liquidity before allowing users to act.

secondary title

3.7 Governance

Compound will start with centralized control over the protocol (e.g. choosing the interest rate model for each asset) and transition to full community and stakeholder control over time. The following permissions in the agreement are controlled by the administrator:

l Create a new cToken marketplace.

l Update the interest rate model for each market.

l Update the address of the oracle.

Electing new administrators, like a DAO controlled by the community; since the DAO itself can elect new administrators, the management will evolve over time based on individual decisions of stakeholders.

first level title

4 Summary

l Compound creates a functioning money market for Ethereum assets.

l The interest rate in each money market is determined by the supply and demand of the underlying asset; when the demand for borrowed assets increases, or the supply decreases, the interest rate will rise, thereby stimulating additional liquidity.

first level title

refer to

[1] Cryptocurrency Market Capitalizations. https://coinmarketcap.com/

[2] Bitfixex Margin Funding Guide. https://support.bitfinex.com/

[3] ETHLend White Paper. https://github.com/ETHLend

[4] Ripio White Paper. https://ripiocredit.network/

[5] Lendroid White Paper. https://lendroid.com/

[6] dYdX White Paper. https://whitepaper.dydx.exchange/

[7] Fred Ehrsam: The Decentralized Business Model. https://blog.coinbase.com/

WePiggy_小猪存币
作者文库