Deep dive into Compound Protocol and Money Markets

arnau ramio
15 min readAug 31, 2020

Original Post (Spanish) = https://criptoblog.tutellus.com/compound-y-mercados-de-dinero/

Here we are again, dedicating time to learn more about DeFi and its protocols that will make it possible to turn the idea of a decentralized, accessible, more efficient financial system with clear improvements, into a technology implemented in our society. Can you imagine that companies start investing in the DeFi protocols since the traditional system does not encourage savings and therefore offers terrible returns on their assets? Nor do I think it is very far. In case you want to know more about other protocols you can learn about Maker, Kyber, Uniswap, FlashLoans, MoneyOnChain and DeFi here.

In today’s post we are going to deal with Compound, a protocol that, through an interest rate generated algorithmically based on supply and demand, allows us to create a money market. Exciting, I know.

Compound began to be heard around 2017, the year in which they had their first round of investment of 8 million dollars in a closed way, followed by another that came later of 25 million. The project was founded by Robert Leshner, so the support of private investments is not surprising, since he has a long history in the financial world and a 3-year vision of what DeFi can bring to the world.

The idea of ​​the protocol is to generate money markets where anyone can borrow capital (giving collateral as collateral) at an interest rate calculated algorithmically according to supply and demand that is updated every 10 seconds (each block of Ethereum).

This is fascinating, especially if we compare it with what we are used to seeing, not only in the traditional world, but even in other crypto lending protocols.

LOANS IN THE TRADITIONAL FINANCIAL SYSTEM

In the money markets of the traditional world, we are used to the cost of money being set by Central Banks. These interest rates are usually neither elastic nor proportional to market supply and demand. Somehow they use these types to centrally “direct” economic development. I honestly believe that one day this idea will be as absurd as the Soviet Union trying to centrally control the quantity of potatoes to be produced. A free movement of prices between supply and demand, in my opinion, will always bring a better balance in the economy. You just have to see where interest rates are right now, most of them very close to 0.

In fact, it is thanks to these mechanisms that at times we have had “free money bar.” Those moments of maximum inflation that the only thing they contribute is the dilution of the effectiveness of money, destabilizing the economy. As a result of this, QE (quantitative easing) companies appear; companies that are not competitive but stay afloat thanks to cheap access to financing, breaking a sacred law of the market: penalize inefficient companies and reward efficient ones.

Regarding bank loans, we can see fixed, variable and correlated interest rates with some indices, which change gradually over time. In the case of personal loans there are also differences, since depending on the use you want to make of the money you can pay more or less interest.

In short, access to money is centralized, it is slow, it depends on intermediaries who generate fiction to the process and who have the power to manipulate the contractual conditions.

LENDING PLATFORMS WITH BLOCKCHIAN

On the other hand we have the lending platforms of the crypto world. They have a system that puts borrowers in contact with specific assets, reducing liquidity and the immediate availability of money, since it will not be available until terms such as time or interest rate have been established.

For example, I have 1BTC and I want to borrow it to get a return on my asset without parting with it. The system will connect my BTC with a “borrower” who wants to borrow it: this means that we will have to reach an agreement regarding conditions, making the process slow and full of friction. In addition, the “lender” has to renounce the availability of its assets until the expiration of the contract, causing higher rates for the “borrower”. Financial logic tells us that the longer I make my money available, the more profitability I will obtain, or what is the same, the more expensive it will be to borrow that money. Although you do not take this at face value either, we have seen more profitable 2-year bonds than 10-year bonds, something that breaks this logic that we mentioned.

COMPOUND MONEY MARKET

On the other hand, Compound’s proposal is different, innovative and disruptive. They basically create a money market where people with excess can lend their surplus to people with productive uses and profitable investments for that money, paying interest in return. The difference is that in this protocol there are no intermediaries, but rather that users can lend their assets by adding them to a shared and decentralized pool, allowing all “lenders” and “borrowers” ​​to deposit and withdraw their assets whenever they wish. In other words, in Compound a “borrower” does not borrow a specific asset and reaches an agreement with the “lender”, but rather requests a loan from a pool shared by all the “lenders”. This allows the latter to withdraw their assets whenever they wish, and the process of requesting a loan is much faster, since there are no terms and conditions to set. There is no friction.

“Compound is a decentralized protocol which establishes money markets with algorithmically set interest rates based on supply and demand, allowing users to frictionlessly exchange the time value of Ethereum assets”

The interest rate is set and updated every 10 seconds depending on the supply and demand of a specific asset. This allows creating an automatic incentive system; that is, if there is a lot of demand to borrow an asset but there is little supply, the interest rate will rise, incentivizing the lender to deposit assets to generate a return. On the other hand, if there is a lot of supply but little demand, the interest rate will be lower, encouraging the creation of credit. We could say that it is a money market typical of the Austrian economy, which changes depending on the market, not on centralized interests.

Something amazing is also that we could be talking about the cheapest loans in the entire ecosystem. If the “lender” is not obliged to retain its assets for X time, but can deposit and withdraw whenever it wishes, this will make the cost of borrowing much lower since at no time will you deprive the availability of capital to their forks. On the other hand, we must bear in mind that the rates are updated every 10 seconds, and although they will probably vary slightly (since they depend on the liquidity of the protocol) we have to expect gradual changes in the cost of money. The counterpart is that if you have borrowed excessively, the protocol does not allow you to withdraw your capital, although as a reward, you will surely be obtaining returns of 20% per year, since the supply and demand ratio is so high that the interest rate to shoot.

General metrics in compound.finance

Something interesting about the image is how the most common is to collateralize ETH and borrow stablecoins. This is logical, since you do not want to ask for a loan in a volatile asset, since you would be assuming a very high risk compared to the acquisition of a stable currency.

LENDERS

Contrary to other types of p2p platforms, when a user supplies assets to make available to borrowers, they add them to a common pool, making the asset more liquid than with direct lending.

At the time of supplying the assets, Compound will generate a token (cToken) that represents the balance of the deposited token plus the accumulated interest every 10 seconds, obtained through the increase in the value of the cTokens. Thus, accruing interest is as easy as holding cTokens, which are transferable, tradable and programmable at the same time. To recover your assets plus the acquired interest it is as easy as redeeming the cTokens in Compound. Currently available: cZRX, zREP. cBAT, cUSDC, cWBTC, cSAI, cDAI and cETH.

The way in which profitability is obtained through cTokens is through the interest paid for the loans generated, which accumulate and allow the cTokens to increase in value. The cETH, for example, have an exit value of 0.020ETH, a proportion that increases as they accumulate interest. If, for example, you borrow 1ETH ($ 190), you will receive 50 cETH in return because they are worth 0.020ETH (this was at launch, now they are equivalent to 0.020062ETH since they have increased in value due to the accumulation of interest). You do not earn interest because the number of tokens increases but because the value of the token increases.

etherscan: Compound Ethereum Token

The most obvious use cases are aimed at long-term Ethereum investors who can use Compound as another source of income without losing their ETH. On the other hand, this is also available to dApps, machines, exchanges or even protocols, which thanks to the flexibility of the Compound protocol of being able to deposit and withdraw your assets at all times, allows them to increase their income in case of having idle assets, even for a short period of time (you can get protocol performance for even 10 seconds). This certainly allows the creation of new business models for the Ethereum ecosystem. You can even get to the day when available assets of companies are deposited in Compound or similar money market protocols, taking advantage of periods in which that available capital is “idle”.

Finally we are seeing a growing trend in adopting cDai as a stable currency. This is something curious, since we are talking about a Dai that also accumulates interest. This ability to generate Dais with interest will generate competition between stable currencies, since in the end people want to use the most profitable form of money. For me, a most interesting use case.

There are even other forms of Dai such as rDai, a token that separates the performance of Compound to another account, being able to reinvest it to generate compound interest in the protocol. In addition, it offers new use cases such as for example that companies accept only rDai, allowing the time that they have control of that money, to extract a performance sent to another account. Imagine intermediaries who have momentary control of money and move enormous amounts of capital, but cannot take advantage of it. Of course, disruptive.

BORROWERS

As for borrowers, they must deposit collateral in order to borrow. This collateral is in fact obtained by blocking the funds that have been added in the shared pool of Compound, depriving you of the possibility of withdrawing them until you do not return the capital that you have borrowed. That is, you collateralize your cTokens, so you can no longer transfer or redeem them for your borrowed assets. Of course, you continue to obtain profitability for them!

As we mentioned, this process is frictionless, you only have to specify the asset you want to borrow and it will be done, there is no need to negotiate terms or conditions; borrowing is instantaneous.

Window to borrow WBTC — $22.51 = 75% of collateral

You can borrow up to 74% of your capital, since when it reaches 75% your position is liquidated so that the protocol can recover the borrowed capital. This is a very curious subject of the Compound protocol. In the case of Maker, the settlements are automatic, since the collateralized ETH is sold at a 3% discount on the markup to recover the loans in DAI. In the case of Compound, they offer a “tool” for liquidators, who are users willing to repay the loan in exchange for receiving the collateral with an incentive of 5% (not counting transaction fees). These actions are usually very fast and it is difficult to access very profitable settlements because they tend to disappear quickly.

So we can identify another participant in the protocol: the liquidators. These have the possibility of settling the “health” function once: {“value”: “1.0”}, it is less than “1”. To understand how it is settled, a practical version of the process is needed, since it is more focused on professionals seeking returns. We will see more about the settlements in both the Blockchain Master and the DeFi Bootcamp.

“Unsafe” accounts liable to be liquidated

In terms of use cases, the reasons for borrowing at Compound are quite logical; borrow on the spot without relying on off-chain capital inflows and thus have immediate liquidity or to be able to make investments without parting with your ETH. Although the most interesting case is to give it a speculative use and to be able to make shorts in the price.

Let’s imagine Bob is a big ETH believer, and he already has some investments in that asset. Now Bob estimates that the BAT token is going to fall compared to the ETH, so he collateralizes ETH ($ 200) and borrows BAT ($100) that he will sell to the market immediately for ETH. When the price of BAT falls 50% compared to ETH, Bob reacquires BAT with the ETH he acquired before the fall (this time he maintains 50% in ETH since the price of BAT has fallen) in order to recover his collateral with that BAT. Using a money market, Bob has been able to leverage his economic prediction and end up with $250 worth of ETH.

ORACLES

For these processes -as always- we must use Oracles to be able to determine the prices of the assets and guarantee the correct functioning of the protocol. In Compound’s case, the data comes from high-volume exchanges like CoinbasePro, Bittrex, Polineix, and Binance. Something that is fascinating is the maximum price variation that the protocol accepts; a maximum variation of 10% per hour. This security measure is excellent in case of market crashes, since it gives borrowers a small margin of time to secure their loans and avoid liquidations.

GOVERNANCE

Currently, Compound’s governance is centralized despite working to move towards decentralization. “The Timelock” is a team-controlled address with the power to make protocol changes.

We have recently seen published the process by which the Compound DAO will be built, without many specifications but by making public the distribution of the ‘COMP’ governance tokens:

COMP tokens distribution

All those who have these tokens will have a window in Compound.finance to be able to vote and make “proposals” for the protocol. In fact, this week we had the first proposal to add USDT as an available asset in Compound, which the community voted in favor;

Voting to add USDT in Compound

One challenge I see in the COMP token is that it has unlimited governance powers (if someone acquires more than 50%, neither the team itself could protect the centralized decision protocol) and that there does not seem to be a minimum value (since it does not receive compensation economic as other governance tokens), could provoke little interest on the part of the holders to participate in the governance, and they could also sell that power for very low values. I believe that governance tokens should have tokenomics that include a future revaluation mechanism for the token; in part to increase the cost of an attack on governance and to encourage its holding and avoid centralizing the token in a few accounts. Let’s remember that what the protocol has the most value is governance, and if Compound has 1,000 million collateralized, and its governance attack is 100 million, we have a problem. We will have to wait for more news on the practical application of the Compound DAO.

Another reflection that I want to share in the growing trend of protocols to decentralize and to render without power and even eliminate the foundations that usually accumulate great decision-making power. At first, it may seem that it is due to the great awareness of the ecosystem of the importance of decentralizing, but from the demand to Maker due to the liquidations caused by “Black Thursday” — where many lost their collaterals due to a sharp drop in price more and more protocols choose to decentralize to avoid legal and liability conflicts. It could be that large crypto foundations with strong decision-making power become a thing of the past. Obviously this is an opinion, although it is not surprising that now so many protocols are suddenly beginning to appear with the intention of completely decentralizing.

HOW THE PROTOCOL WORKS

  • Balance of funds: As we have seen, Compound has a shared liquidity pool where collateralized loans can be made. On one side we have the funds deposited by the lenders, and on the other the funds loaned, which will never be equivalent since 10% of the available funds are kept as liquid reserves in order to guarantee liquidity to the pool; that is, allow deposits and withdrawals of funds at any time.
  • Utilization ratio: The price of money (interest rate) is determined based on supply and demand, thus entering into an automatic liquidity incentive system that we mentioned earlier. If there is a lot of demand and little availability to lend, the interest rate increases and therefore the performance of the lenders, encouraging their entry into the shared pool. Otherwise, if there is a lot of liquidity and little demand, the price of money is very low and there is an incentive to borrow. This calculation is achieved first by calculating the utilization ratio, that is, how much of the available funds have been borrowed.

Once we have the utilization ratio, we can calculate the interest rate at which the loan of an asset will be paid:

This is the formula of the Compound protocol, with which we can understand that the cost of capital will be around 2.5% to 20% depending on the relationship between supply and demand.

  • Lending interest: When calculating the interest generated by the protocol for lenders, it is calculated by dividing the total amount acquired in interest on loans among all lenders. In order to know the interest you would get today, you can consult it here.

In this case we have that the borrowed capital is $ 386k with an interest of 2.09% (Borrow APY). This interest rate will generate a profit of $ 8,067.4 (Gross Borrow) that is distributed among the capital available to lend $ 55.88M (Gross Supply), which is equivalent to an interest of 0.01% (supply APY).

The 0.02% increase in Gross Supply and the 1.48% reduction in Gross Borrow refer to the growth or decrease of the total position to lend and the total loaned.

At this point I can only comment that the formulas offered are examples of how the calculations work, but these are a bit more complex. That is why if we put these calculations into practice we will find that an exact value of the interest rate is never achieved, for this we should follow the real calculations, available here.

Let’s take an example:

- Ether interest rate = (2.5% + utilization ratio * 20%) -> 2.636%

Compound value = 2.09%

- USDC interest rate = (2.5% utilization ratio * 20%) -> 5.576%

Compound value = 3.60%

- DAI interest rate = (2.5% + utilization ratio * 20%) -> 19.976%

Compound value = 2.96%

We have the most critical case with Dai, since it actually works particularly differently. Dai that have still been borrowed are sent to Maker’s DSR, influencing the interest rate that borrowers must pay. Besides that the type is also influenced by Maker’s stability fee.

COMPOUND CONCLUSIONS

Without a doubt, we are facing a protocol with enormous potential. Not only because it allows the creation of a money market in the DeFi ecosystem of Ethereum but above all because it rethinks how the act of lending and borrowing works. Recalculating the interest rate every 10 seconds and having a decentralized and shared pool and not a system that directly connects specific assets with each borrower opens up a new world of possibilities.

In the first place, it manages to offer the cheapest loans in the ecosystem, since the lender will always be able to have its capital whenever it wants, it can get a return on its assets even if it is only 10 seconds. This had never happened before. Second, there is no type of friction and intermediary, it is completely decentralized, you can even lend and borrow without having to identify yourself, you only need an account in Metamask.

Finally, an interesting topic is the appearance of cTokens, since now we are seeing how people prefer to use cDai and not DAI, which in the end are the same, only that cDai have an integrated interest. This brings to light possible rivalries between stablecoins, as each will ultimately seek to make use of the most profitable currency.

We will continue to discuss DeFi protocols and projects, until next time!

REFERENCES

https://defimadrid.tutellus.com

https://blockchainbarcelona.tutellus.com

https://compound.finance/

https://app.compound.finance/

https://observablehq.com/@jflatow/compound-interest-rates

https://compound.finance/docs

https://free-online-app.com/compound-interest-calculator/

https://www.investing.com/central-banks/

https://www.visualcapitalist.com/chart-the-downward-spiral-in-interest-rates/

https://medium.com/compound-finance/compound-governance-decentralized-b18659f811e0

https://medium.com/compound-finance/introducing-compound-the-money-market-protocol-4b9546bac87

https://defiweekly.substack.com/p/governance-liability-and-competition

--

--

arnau ramio

Blockchain-Business Developer & DeFi Manager. Co-Founder & COO at Themar Solutions and Co-Founder of Learningheroes.com