paint-brush
Compound: The Money Market on Ethereumby@juliawu
3,103 reads
3,103 reads

Compound: The Money Market on Ethereum

by Julia WuJune 30th, 2020
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

Compound: The Money Market on Ethereum is the "most valuable" decentralized finance protocol. The value locked into the Compound protocol reached a staggering $1 billion on June 26, 2020. Compound establishes money markets in which anyone can earn interest instantly by supplying assets, and borrow instantly at a given interest rate. The key characteristics of the dynamic money markets run by Compound are: Liquidity: Users can instantly supply to and withdraw from a shared liquidity pool Borrowing with collateral, using their supplied assets as collateral.

Companies Mentioned

Mention Thumbnail
Mention Thumbnail

Coins Mentioned

Mention Thumbnail
Mention Thumbnail
featured image - Compound: The Money Market on Ethereum
Julia Wu HackerNoon profile picture

On June 26, 2020, the value locked into the Compound protocol reached a staggering $1 billion, making it the "most valuable" decentralized finance protocol. In the past year, DeFi became the hottest topic in the crypto. Let's take a close look at one of its most popular projects.

This post is an "executive summary" about Compound a synthesis based on core resources such as the whitepaper and developer documentation.

Source: https://compound.finance/markets

Motivation

It is common for cryptocurrency holders to purchase tokens and let them sit idle in accounts. In the past year, the majority of all Ethereum tokens have not moved. Perhaps an "unconscious" tendency carried over from traditional markets, some cryptocurrency holders let assets sit with the hope that their value will somehow increase over time.

For fiat currencies, interest rates have served as the "price" of money. It adjusts based on supply and demand and connects those who want to borrow with those who can lend. That has not been the case for crypto assets. There is still a possibility that tokens will depreciate, unlike some "real-world" assets such as real estate and dividends on equities.

Compound is about putting idle crypto assets to work. It is an open-source Ethereum protocol with interest rate markets, allowing users to supply and borrow Ethereum tokens. Through variable interest rates, Compound establishes money markets in which anyone can earn interest instantly by supplying assets, and borrow instantly at a given interest rate. These interest rates are algorithmically set and tracked by smart contracts, with no humans in the loop.

While lending/borrowing for cryptocurrencies was still possible before Compound, it was less efficient. In particular, there was a lack of liquidity as exchanges had to perform "matching" between borrowers and suppliers.

The key characteristics of the dynamic money markets run by Compound are:

  1. Liquidity: Users can instantly supply to and withdraw from a shared liquidity pool
  2. Borrowing with collateral: Users can instantly borrow from a money market, using their supplied assets as collateral
  3. Algorithmic interest rates: The protocol algorithmically sets interest rates based on supply and demand
  4. Dynamic: No "maturity dates" on loans

The supply and borrowing interest rates represent an asset's Annual Percentage Yield (APY).

cTokens

Source: https://compound.finance/ctokens

When you supply an asset such as DAI, Ethereum, Tether, USD Coin, or Basic Attention Token to the Compound protocol, you get cTokens in exchange. cTokens are simply ERC20 tokens that represent your balance in the Compound protocol. The main aspects of cTokens are:

  1. They represent the asset you supplied and accrue interest over time
  2. They can be used as collateral to borrow from the Compound protocol

Interest Accrual

Compound operates in markets, meaning that every asset has its own supply and demand market.

Interest rates are accrued with every Ethereum block. Every 15 seconds, the balance of cTokens increases by 1/2,102,400 of the quoted annual interest rate for the underlying asset.

Let's run through an example of how you might earn interest if you supply some DAI:

After supplying DAI to Compound, you get cTokens to represent the DAI. These cTokens are called cDAI. Every token has an exchange rate against its respective cToken, meaning that 1 DAI can be exchanged for a specific amount of cDAI.

The DAI market has an interest rate model. The moment you get access to cTokens, you start earning interest: As time goes by, each cToken becomes convertible to a growing amount of its underlying asset.

Example: 

  1. You supply 1,000 DAI to Compound. At the time of supply, the exchange rate of DAI to cDAI was 0.020070. Consequently, you earn 1,000/0.020070 = 49,825.61 cDAI
  2. A few months later, you want to redeem your DAI using the cDAI in your wallet. Now, that exchange rate has gone up to 0.021591. Therefore, 49,825.61 cDAI is now equivalent to 49,825.61*0.021591 = 1,075.78 DAI
  3. Source: https://compound.finance/ctokens

Interest is accrued for all suppliers and borrowers that interact with a market's cToken contract. When any of the following actions are triggered, interest is added to the underlying balance of every supplier and borrower:

  • Mint (supplying assets mints cTokens)
  • Redeem
  • Borrow
  • Repay 

Each cToken has a supply rate and borrow rate, which gets updated with every Ethereum block. We will dive into the specifics of supply and borrow rates soon.

Each market also has excess liquidity: there are always more assets supplied than assets borrowed. Interest paid by borrowers is earned by suppliers of the asset.

A small portion of the interest paid by borrowers is set aside as reserves (5 - 10% of the market).

Supplying

As we saw earlier, in exchange for supplying an asset, the user gets some cTokens:

amount of cTokens = underlying tokens supplied / current exchange rate

The exchange rate between cTokens and the underlying asset increases over time. It is calculated by factoring in the total borrows and reserves of that asset:

exchangeRate = (underlyingBalance + totalBorrowBalance - reserves) / tokenSupply

As for the supply rate, also known as the APY earned by the supplier: It is derived from the following factors:

  • Borrow rate
  • Reserve factor
  • Total amount of borrows

Borrowing

To borrow on Compound, users first supply assets to be used as collateral. For example, you can use DAI as collateral to borrow ETH, ZRX, BAT, and more. 

The amount that you can borrow is a function of the collateral you supplied. Ranging from 0 to 1, the collateral factor represents the portion of the underlying asset value that can be borrowed. 

For example, if you supplied $100 worth of ETH, which has a collateral factor of 75%, you can borrow at most $75.

Borrowing has no time duration, and balances can be repaid at any time. But interest is always accumulating, so if your borrowing balance exceeds the limit, your account can be liquidated. This can also happen if the collateral declines in value while the value of borrowed assets increases over time.

Liquidation is a reward/incentive mechanism in which a member of the Compound community can repay up to 50% of the asset you owe. In exchange, they receive a proportionate amount of your collateral but at a discounted price.

Practical Use Cases

Let's walk through some examples of how Compound can be used for trading crypto assets:

It's possible to use borrowing to multiply exposure to a specific asset, or to short an asset.

  1. Alice thinks that ZRX will increase in value. She supplies 10,000 ZRX to Compound, and uses it as collateral to borrow 30 ETH. She then sends 30 ETH to an exchange to purchase 6,000 more ZRX. Alice now has a 16,000 exposure to ZRX, and owes Compound 30 ETH. If ZRX/ETH increases in value as she expects, Alice will be able to re-purchase the ETH from ZRX and repay Compound for less than how much she had to pay initially (6,000). She would repay her debt while keeping the excess ZRX.
  2. Bob wants to short ZRX. So he supplies 100 ETH to Compound and uses it as collateral to borrow 12,000 of ZRX. He then sells the 12,000 ZRX for 60 ETH. He now has 160 ETH exposure. If ZRX/ETH does decrease in value, Bob will be able to re-purchase the 12,000 ZRX for less than 60 ETH. So when he repays his debt of 12,000 ZRX, he can pocket the difference in ETH, keeping the excess ETH as profit.
  3. Say you are a "whale", aka a large institutional investor betting that BAT will fall in the coming weeks. You take out a loan of BAT tokens with USDC. You immediately sell the assets for USDC at your favorite exchange. A few days later, BAT has gone down as you hoped, so you repurchase the same amount of BAT, but for less USDC than you initially paid. You return the borrowed BAT and keep the difference between the earnings from selling BAT for USDC a month ago, versus repurchasing BAT a few days later.

Governance

“The individuals, applications and institutions that use the Compound protocol are capable of collectively stewarding it into the future — and are incentivized to provide good governance.” — Robert Leshner, Compound Founder

A guiding philosophy behind Compound is that the power should be in the hands of its community. To that end, the protocol has an on-chain system that distributes COMP (governance) tokens to Compound users. The goal is to allow COMP token holders and their representatives to propose and vote on actions that affect the protocol.

Just like cTokens, COMP tokens are ERC-20 assets. Every day, about 2,880 COMP tokens are distributed across all markets to the users of the protocol (equivalent to about USD 840k). 

The number 2,880 comes from the fact that 4,229,949 COMP is placed in a reservoir contract, with approximately 0.44 COMP being distributed per Ethereum block--which totals about 2,880 per day. 

50% of COMP goes to suppliers and the other half to borrowers.

Source: https://medium.com/compound-finance/expanding-compound-governance-ce13fcd4fe36

Any address with more than 100,000 COMP can propose governance actions. Proposals can be found here: https://compound.comradery.io/

When a proposal is created, the community gets a 3-day voting period. 

COMP was first tested with a limited group of stakeholders. Without relying on the Compound team or other middlemen, the community was able to vote on proposals such as adding a new asset, Tether, to the protocol and creating a new DAI interest rate model.

The Arbitrageurs

USD locked in Compound (notice what happened when the COMP token launched)! Source: https://cipher.substack.com/p/contextualising-compound

June 16 marked an important day for Compound, as the team announced the official launch of the COMP governance token. This is a milestone in the protocol's progress towards full decentralization, gradually waiving the central role of the Compound core team. 

Since you get COMP by just interacting with the protocol (even when you borrow), it is possible to move large amounts of money to the markets just to receive some COMP to then sell them for profit.

Some deep-pocketed investors parked their idle tokens on Compound for a few days to receive a substantial amount of COMP, since the more you supply, the more COMP you get. These investors could then sell COMP in exchanges as their prices rose. 

On June 25, Coinbase announced support for Compound (COMP). 

We have yet to see what else might come out of the COMP rally, as well as what the core team will take on next. What we do know is that the explosive trajectory of projects like Compound has evidenced the unstoppable nature of DeFi. 

Additional Sources