Understanding Compound

Moresh Kokane
Konkrete
Published in
5 min readDec 6, 2019

This article is primarily written for the benefit of the internal team at Konkrete to further their understanding of how some of the liquidity pool based money markets work. These systems (or systems closely modelled on these) will form the underlying “money lego” blocks of what Konkrete intends to build on. Hence a intuitive understanding of these is a must before headlong technology development can be done.

We will keep the explanation simplistic and may end up glossing over certain detail.

The article is divided into 3 parts

  1. Understanding how Compound works
  2. Its current limitations
  3. How a system closely modelled on what Compound does can be developed to achieve Konkrete objectives

Understanding Compound

Compound is essentially a marketplace where those with one type of asset can borrow another type of asset against it. However it is important to understand that this is not a peer to peer marketplace where loans are matched 1 to 1 or 1 to many. It has a concept called “pooled liquidity” which makes it far closer to what a bank is. Note that Uniswap and Bancor also employ this concept of pooled liquidity. We will elaborate on that in a future article.

Consider a real world example where a person who wants to buy a house rocks up to a bank.

The house is worth $100,000. The Bank might say it will lend him 80% of the house value which is $80,000.

The bank takes a security over the house and the person gets $80,000.

As long as the person pays the interest on time he can keep the house. If he does not, the bank has the right to sell it and recover its loan and interest. Excess proceeds if any from the sale go back to the borrower.

Simple.

The question becomes where does the bank get the money from.

It comes from depositors.

Those who have excess money deposit their money with the bank for safe keeping. This money forms a pool which can then be dipped into to make any loans.

Note that it is not a specific investors money that gets deployed to a specific loan. It is all pooled together first and then deployed as and when a loan request comes in.

Part of the interest (after any operating fees that are due to the bank) get passed back to the depositors.

Note that because money is pooled together, a specific depositors money is not locked in a specific loan. Which means that depositors can withdraw their money if they ever have a need to. This is however only possible as long as not all of the money deposited by all depositors is not out on loans. There has to be some excess supply of deposits to cover a withdrawal request.

A liquidity reserve is needed.

Let’s also understand how the interest rates are determined. In today's real world, interest rates and liquidity reserves are determined by state regulation. In an ideal world however the interest rates would be market determined as a function of the balance between demand for loans and supply of money.

The more there is a demand for loans, the higher the interest rates go. And vice versa.

Typically not all of the money deposited in the pool gets deployed to loans, the fraction that ends up getting used up for loans is called the “utilization ratio”. The interest you get is on this fraction of your supplied money. The higher the utilization ratio the greater your return. But it also means lower liquidity.

In an ideal world, greater demand for loans would drive up interest rates higher and lead to a greater supply of money which in turn bring the interest rates back in to balance.

The system acts like a fine tuned scale, where greater demand on one side ends up increasing the time-cost (interest) of the other side.

Note that the interest distributions stay in your bank account. You can withdraw them anytime you like though. But while you choose to keep your money in the bank, its value over time would steadily appreciate.

On the demand side, lets now replace the asset (which earlier was a house) with an ERC 20 token.

On the supply side let's replace dollars with DAI.

The bank deposit vault gets replaced with Compounds smart contracts which manage the whole thing in an automated manner.

When you deposit money in a bank you can access that via the bank account you have. But in the DeFi world, there is no bank or bank account. What you get instead when you deposit DAI is cDAI, which effectively represents your share of the pool.

The interest payments keep coming from the borrowers, but they are not automatically paid to the depositors. Instead they are held in a form of reserve within compound.

Whenever someone wants to withdraw (cDAI to DAI) they get their original deposit + the interest that was accrued to them from the reserve.

If you do not withdraw then you keep earning interest which keeps on accumulating in the reserve.

Since cDAI has a claim on their original deposit + the interest accrued their value keeps on going up steadily.

The rate of increase is a function of the demand for loans at any given point in time as discussed earlier. This is also the interest rate.

Compounds current limitations

The above heading is a bit of a misstatement as it would be unfair to the superb team behind Compound to call the following as limitations. So the use of term limitation is only in the context of the application Konkrete is trying to build.

Compound only allows a certain list of ERC20 tokens to be used as collateral. In the long run they intend to decentralize themselves and allow the community to determine this list as well as the collateral factors. (Collateral factor is the percentage of an assets value that you can borrow).

Uniswap on the other hand has a similar liquidity pool model but they do not have the restriction list and are more akin to a universal protocol rather than an application.

--

--