How the Compound Protocol Allows You to Always Earn Positive Interest on Your Assets

Matt Solomon
Floatify
Published in
8 min readOct 7, 2019

You may have heard of Compound, the protocol Floatify uses behind the scenes to provide you high interest rates. Compound lets users loan out their money to earn interest rates of 5–10%. It’s understandable if you’re pretty skeptical — how can this system guarantee these positive interest rates?

In this article we’ll dive into Compound and understand how it works. We won’t focus on the technical details of implementation, but instead we’ll look at the protocol from a high level to see how it works.

Note that there are other similar services, such as dYdX and Fulcrum, but this article will focus on Compound, since it’s currently the dominant protocol in the decentralized lending space, and the one used behind the scenes at Floatify.

Compound Logo (source)

What is Compound?

Compound is a decentralized, open-source protocol that lets you do one of two things:

  1. Borrow an asset
  2. Supply an asset

Just like traditional loans you are familiar with, if you borrow an asset, you need to pay back interest. Similarly, if you supply an asset, you earn interest. Unlike many loans, this interest rate is not constant and changes frequently.

The Compound protocol exists as a set of smart contracts on the Ethereum blockchain. These smart contracts are effectively just lines of code that store data and perform computation.

Approximately every 15 seconds — which is the time it takes for a new block to be added to the Ethereum block time — your interest accrues and the rates are updated.

What Assets are Supported?

The assets that are supplied and borrowed are not traditional currencies like US dollars, but instead are cryptocurrencies built on top of Ethereum.

The most popular assets on Compound are Ether (ETH), the native token of Ethereum, as well as Dai (DAI) and USD Coin (USDC). Ethereum has a volatile price, whereas DAI and USDC are designed so that 1 DAI = $1 and 1 USDC = $1.

How Do You Supply an Asset?

The process of supplying assets to earn interest can be pretty complex if you are not familiar with Ethereum. It looks like this:

  1. Create an account on an exchange such as Coinbase
  2. Purchase one of the currencies supported by Compound, such as DAI or USDC
  3. Download and setup a wallet like MetaMask
  4. Backup your seed phrase so you don’t lose your funds if something happens to your computer
  5. Send the DAI or USDC from Coinbase to your MetaMask wallet
  6. Use any of the interfaces listed on Compound’s home page to make your deposit
  7. Repeat the steps in reverse when you are ready to withdraw

To simplify this flow, we created Floatify. After one-time setup of your Floatify account — which is comparable to the setup process on Coinbase — just deposit funds from your bank account and steps 2–6 happen automatically in the background for you. (If you’d rather go through the process manually but need some help, feel free to reach out)

How Do You Borrow an Asset?

To borrow an asset, it must be collateralized. With traditional loans, you are lent money, and the bank trusts you to pay it back based on your credit score. With collateralized loans, instead of checking your credit score, you are required to put up collateral.

If you go to the bowling alley and borrow bowling shoes, they might keep your regular shoes behind the counter. Your regular shoes are the collateral for the bowling shoes you are borrowing. This way, you are incentivized to return the bowling shoes since you value your regular shoes. If you don’t give the bowling shoes back (i.e. you don’t pay back your loan), the bowling alley loses a pair of shoes, but they still have your regular shoes (i.e. the collateral you provide). Perhaps they can sell those to afford a new pair of bowling shoes.

In the traditional finance world, collateralized loans do exist, though you may not have experience with them. Here’s an example of an email promoting collateralized loans. Instead of selling stocks to obtain the funds needed to pay college tuition, you could use those stocks as collateral for a loan, and use that loan for the down payment. If you don’t pay back the loan, the bank would sell off my stocks and keep the proceeds.

Email offer explaining how traditional collateralized loans works

The amount you can borrow is based on the value of the collateral you provide. It’s possible your collateral drops in value, so to account for this each asset on Compound has a collateral factor. This factor represents what percent of that asset’s value you can borrow.

For example, ETH currently has a collateral factor of 75%. If you provide $100 of ETH as collateral, this means you can borrow up to $100*0.75=$75 of another currency, such as DAI.

How Are Interest Rates Guaranteed?

With the basics covered, we can now dive a bit deeper into understanding how things work. To suppliers, the most interesting part of Compound is that your assets are guaranteed to earn a positive (but variable) interest rate, and can be withdrawn any time.

There are two main aspects that enable this. One is the asset pool, and the second is collateralization + liquidation.

The Asset Pool

Unlike traditional loans, there are not just two parties involved in each loan. Instead, when assets are supplied, they go to a pool of all assets. When assets are borrowed, they are borrowed from this pool.

Interest rates and terms are therefore not negotiated between parties, but instead are calculated based on assets supplied vs. assets borrowed. When there is a lot of supply and little borrowing, interest rates decrease to incentivize more borrowing. When there’s lots of borrowing but little supply, interest rates increase to incentivize more lending. Because users are constantly supplying and borrowing from the protocol, rates are constantly changing.

The rates are computed based on this supply and demand in order to ensure the asset pools always have more supplied than borrowed. This excess liquidity reduces the risk of suppliers losing their assets, and has two effects:

  1. The rate paid by borrowers is always higher than the rate earned by suppliers. This is required because there is more value supplied than borrowed.
  2. When supplying, you can withdraw your assets at any time (with the exception of bank run risk, as described below). You are simply withdrawing from the pool, and not taking the funds from any particular borrower.

Additionally, a certain amount of interest from each market is set aside as reserves. This provides an extra mechanism for Compound to ensure liquidity and reduce risk. For DAI — the currency Floatify uses behind the scenes — this reserve value is currently 5%, but for the other currencies its 10%.

Collateralization + Liquidation

Collateralization was described earlier, so here we’ll just cover liquidation.

Before we said there are two things you can do on Compound — borrow assets and supply assets. For advanced users, there’s actually a third thing — liquidate assets.

Recall that the amount you can borrow is contingent on how much you supplied. In our example above, $100 of ETH lets us borrow $100*0.75=$75 of DAI. But if the price of ETH drops, our original $100 of ETH might now be worth only $90. At this point, we should only be allowed to borrow $90*0.75=$67.50, but we are actually borrowing more than that. As a result, we can be liquidated.

When liquidated, a liquidator (which can be anyone, including you) repays a portion of your loan on your behalf, and receives a proportional amount of your collateral. They receive this collateral at a 5% discount, to incentivize liquidations. The effect of this liquidation is that your borrowed value is now properly matched to your collateral value.

This liquidation process helps reduce the risk to users supplying assets, so they do not lose any assets due to borrowers not paying back their loans.

How Are Interest Rates Calculated?

Recall that while the interest rate is guaranteed to be positive, you are not locked in to a given rate. The interest rate changes based on supply and demand of that asset, and each asset has its own interest rate model. Below we describe the current interest rate model for DAI. If you don’t like math, you may want to skip this section! Note that the interest rate models for other currencies are very similar, just with different values for the variables.

Calculating Borrow Rates

Currently, all interest rate models are governed by the equation

borrowRate = baseRate + (U * multiplier)

where

  • borrowRate is the interest rate to take out a loan
  • baseRate is the minimum interest rate to take out a loan,
  • U, the utilization ratio, is the ratio between the amount borrowed and amount supplied.
  • multiplier is a scale factor which determines the maximum possible borrowRate

DAI, for example, currently has the following values set:

  • baseRate: 5%
  • multiplier: 12%
  • U: this is our variable that is always changing

This gives an interest rate model of

borrowRate = 0.05 + (U * 0.12)

Now, consider the case where lots of people are supplying money, but no one is borrowing, giving us U=0. This means that borrowRate=0.05+(0*0.12)=0.05, or 5%.

If every single DAI that is suppled is currently borrowed, then U=1 and we have borrowRate=0.05+(1*0.12)=0.17, or 17%.

Therefore, we can see the rate to take out a loan in DAI can vary between 5% and 17%.

At the time of this writing, there is ~23.53 million DAI borrowed, and 35.39 million DAI being supplied, giving an interest rate for borrowers of

0.05 + (23.53 / 35.39) * 0.12 = 0.1298

which equals 12.98%.

Calculating Supply Rates

Now that we know the borrow rate, we can easily calculate the supply rate. This is defined as

supplyRate = borrowRate * U * (1-reserves)

where the reserves value is the 5% of interest is held in reserves which was mentioned earlier.

Using the current values, we see the current supply rate is

0.1298 * (23.53 / 35.39) * (1 - 0.05) = 0.0820

which is 8.20%.

Additional Information

Because Compound is open-source and lives on Ethereum, you can verify all of the above information for yourself. Below are some useful references if you’re interested in doing this:

  • Compound’s Developer page, which contains links to all the smart contracts
  • The Compound protocol GitHub
  • Compound FAQ

If you have any questions, you can either reach out to us at Floatify or to the Compound team directly!

--

--