What is Compound Finance?
Compound finance is a decentralized lending and borrowing platform for cryptocurrencies.
Just like a bank where you can deposit your money and earn an interest on your savings, with Compound you deposit your cryptocurrency tokens to earn a return.
And just like a bank can use your deposits to lend to others so too can Compound lend to borrowers
However there are some key differences between Compound and your bank
- Compound offers much more attractive interest rates. Whereas your Well Fargo account may earn 0.1% per year, Compound offers much much higher interest rates to savers. As of February 2022 they hover around 2%. This is because Compound has close to 0 expectation of default. A credit card by Wells Fargo is associated with a lot of risk. A customer’s ability to repay depends on a lot of external factors such as the status of their job and the state of the economy. Compound offers the safest borrowing. As long as borrowers supply and maintain more collateral than they borrow the risk of default is very low. Hence interest rates don’t need to be punitive.
- Compound is an automated standardized money robot. With compound there is no intermediary. There is just a smart contract protocol that operates according to specific rules. This protocol does not need to pay for employees, real estate and other costs associated with borrowing at a bank. It just exists on the Ethereum blockchain and can scale as much as it likes and offer its service forever.
- Your Wells Fargo account is not easy to integrate and plug and play with other DeFi apps. You can’t move it elsewhere. This is a killer feature of Compound and we will describe it in more detail below
Is Compound like Lending Club?
You may be thinking: “ok if its not a bank and there is no intermediary; then maybe it kind of like a peer-to-peer lending network. Something like Lending Club.”
It is not. Compound operates very differently to Lending Club.
Rather than matching a person who wants to lend money with a person who wants to borrow, Compound is like a robot that automates loans for a pool of money.
This effectively allows you to interact on your own with Compound. It does not necessitate there being users on the other side with an exact opposite view at the exact same time.
Compound offers the rate that is currently available and then you can either take it or leave it. This standardisation simplifies the product so that a lot for people can participate.
Compound is a key component of the DeFi space. The protocol has spearheaded a lot of innovation that was later copied by other DeFi platforms. If you want to understand DeFi then you need to understand Compound.
OK so how does Compound work?
Compound is technically a smart contract on the Ethereum network. If you did not understand that sentence then it is best you read my simple explanation of Ethereum first.
In Compound you can borrow and lend ERC-20 tokens. As a refresher, these are tokens that are compatible with the Ethereum network.
If you want to borrow you need to put up more collateral than your borrow amount. So, for example, if you want to borrow $100 you may need to put up $200 worth of crypto as collateral
How collateral works with Compound
Because borrowers are unknown they have no names or credit and employment histories to share. There is no way to send a collector after them if they default on their payments.
Hence, in order to borrow a user needs to offer collateral in the form of cryptocurrencies that they hold. And the collateral they offer needs to be higher than the value of their loan.
This is similar to traditional finance.
For example, with a mortgage you are required to put up some downpayment for your house and then the rest is given to you as a loan by the bank. This way the collateral (the house) is worth more than the loan the bank gives you.
Hence, the bank is secure in that the risk of default is low. If you fail to pay they liquidate your house. As a result the bank can offer lower lending rates compared to, say, a credit card where the risk of default is high and there is no collateral to liquidate in case of a default.
With Compound the risk of default is almost zero. If a user’s collateral ratio (loan divided by collateral value) falls below a certain threshold then Compound sells the collateral. This way Compound never loses money.
In fact, Compound itself does not sell your collateral. There is a group of people called Keepers that do this.
Keepers constantly check Compound and if they find anyone who has exceeded their collateral limit they liquidate them and get a fee from Compound for doing so.
What makes good collateral:
- An asset that has transparent value.
- Something with liquidity. If Compound needs to seize the collateral and liquidate it then it should be easy to sell.
- It should be stable as opposed to fluctuating in price
For example ETH is a standard everyone can agree on: it is very liquid and easy to agree on its price. Stablecoins are also great for being transparent and liquid.
It’s not really a loan
The loans are technically not loans because there is no fixed interest rate, no periodical installments that you need to repay and there is no fixed repayment period.
All borrowers pay the same rate and all lenders receive the same rate. As a supplier or borrower you can participate whenever you want and for as long as you want.
Also the interest varies. As supply and demand change so do the interest rates vary. This simple relationship is easy for every one to understand and is what has contributed to Compound’s popularity.
Time to get a little technical
Don’t worry this will still be simple to understand.
As discussed, Compound started off by accepting ERC-20 tokens. These are cryptocurrencies such as ETH or stablecoins like DAI. There are many more.
What makes Compound so great is that is uses a pretty primitive algorithm.
When there is more demand interest rates go up and when there is less they drop.
I’ve plotted this simple relationship as a straight line where the interest rate rises as demand increases.
Compound collateral factors explained
Now, every crypto token has a “collateral factor” ranging from 0 to 90. If this is zero then the asset cannot be used as collateral.
The higher the factor the less risky the asset.
So a stablecoin such as DAI might get a factor of 90. This is because Compound expects that the DAI token is very unlikely to fluctuate much. 1 DAI is expected to equal 1 USD in perpetuity.
Compound is willing to lend out more DAI as a % of the DAI you put up as collateral. That percentage, known as the collateral ratio, is 100 divided by the collateral factor. I will show you an example shortly.
Let’s delve into the mechanics of Compound with some examples
For DAI which has a factor of 90 the col. ratio is 100/90=1.111. This means a user who puts up 100 DAI as collateral can borrow up to 90 DAI.
If their col. ratio goes above 1.111 they will get liquidated.
As described above Keepers are responsible for selling the borrower’s DAI when you exceed the collateral ratio. For this reason it is never good to borrow the maximum.
It is always best to maintain a buffer. In our case say you could borrow 80 DAI instead of 90.
With Compound you have many different tokens as collateral. So you look at the weighted average of these in order to calculate ratios across cryptos
I took the following examples from an excellent course I took on DeFi finance by Duke university.
Suppose I deposit 100 DAI and 2 ETH. And suppose the col. factor for ETH is 60 and its price is $200. So now I can borrow 90%*$100 + 60%*$400= $90+$240=$330. So your collateral ratio is $500/$330=151%
A more algorithmic way to get here is to look at is as follows:
Note that I have $100 worth of DAI and $400 worth of ETH. So DAI makes up 20% of my holdings and ETH makes up 80%.
The collateral ratio can be calculated as 100/(0.2*90+0.8*60)=151%. Then the maximum I can take out is $500/151%=$330
How are supply & borrow rates set?
Interest rates on Compound vary and update every 15 seconds when a new block is created on the Ethereum network.
This is unique to the world of DeFi. In Traditional banking you have a daily compounded rate but can’t go lower than that.
Note that for Compound to lend it needs to have that amount available to supply. So in aggregate Compound can never lend more than its supply.
The ratio of money that gets lent to the amount of supplied is known as the utilization rate and is a way of measuring demand for loans.
The cool thing about how Compound sets interest rates is that is extremely simple. The rate is a set as a function of demand.
If demand for loans increases the rate increases and if demand for lending drops then the interest rate drops.
You can easily plot this on a graph as a line as depicted above where
Interest rate =α +β*χ
Where α (alpha) is the intercept on the y-axis, i.e the base rate, when there is 0 demand for loans.
The slope, β (beta), represents the rate of change for these rates as demand fluctuates.
Finally χ (chi) is the utilization rate representing the demand for loans on the horizontal axis.
These parameters can differ for each token.
The real formula is only slightly more complex in that if demand exceeds a certain level there is a kink in the slope. This is because Compound may be approaching full capacity and wants to jack up rates in order to discourage further lending
Don’t worry we are going to look at some examples further on.
Let’s just briefly describe how lender rates are set.
How to calculate suppliers’ interest rates
Suppliers of liquidity also earn a variable interest rate. They don’t get the same rate that borrowers pay.
If the supply pool has a $100Mn and only $40Mn is lent out then interest needs to be distributed across the $100Mn.
Remember, this is not a peer-to-peer lending model and all suppliers receive the same rate. Hence suppliers receive less than the interest rate paid by borrowers.
Similar to the borrower rate, the supplier rate is also encoded in a formula:
Suppliers get paid an interest rate that is equal to the borrow rate * utilization ratio minus a small fee. The fee is used to build up a reserve as a buffer to protect against defaults.
Compound interest rate setting example
Imagine there is DAI 100Mn in supply and DAI 50Mn borrowed.
This means that the utilization rate is 50% (50Mn/100Mn right? ).
Assume the base rate is α=1% and the slope β= 10%.
The means borrowers would pay 1%+ 10%*50%=6%.
The supplier would get paid 50%*6%=3%. Then a small fee would be deducted, say 0.2% for the reserve fund.
So lenders would get 2.8% interest.
This rate will change as more people borrow. So like we said if I borrow $50Mn I pay 6% and suppliers get 2.8%.
But if in the next 15 seconds someone comes along and borrows another $25Mn then the utilization rate increases and so the interest rate increases. The new utilization ratio has become
(DAI 50Mn+DAI 25Mn) / DAI 100Mn =75%
So the new borrower interest rate is 1%+10% * 75%=8.5%.
And suppliers would get 75%*8.5=6.375% minus the reserve fee of 0.2%=6.135%
So interest rates fluctuate constantly for everyone subject to demand and supply conditions. And they do this almost instantaneously (every 15 seconds).
You can see why this would be an economist’s dream. It’s pure, automated market efficiency.
Why do people borrow on Compound?
A common question on people’s minds is: “If you have the collateral why would you want to borrow? Usually its people without money who need to borrow it.
So if you have it why borrow?”
There are three main reasons people borrow on Compound
- They don’t want to sell their collateral because they expect the value to increase.
- They want leverage. Say you have ETH. You put it up as collateral and borrow DAI. You buy more ETH. Then you put that up as collateral and borrow more. If the value of ETH goes up you end up making a profit. You can lever both long or short positions in the market
- They need money but don’t want to sell their crypto because they would need to pay capital gains tax
Compound v2: cTokens and how they revolutionized DeFi
About 2 years into its existence Comp introduced a new innovation that was a catalyst for the DeFi space.
This feature went on to be copied and built upon by multiple other DeFi apps.
The innovation was the introduction of cTokens which represent your ownership of the asset you have borrowed.
Kind of like how equity represents ownership of a piece of a company the cToken is an equity token that represents your piece of the lending pool of a specific cryptocurrency.
So for example, if you put up ETH as collateral you get cETH in return. It’s kind of like a receipt that proves you have given the funds to Compound. To get your ETH back you return your cETH.
This is similar to redemption certificate or US dollar note that promised to pay the bearer of the note in gold or silver. You could then use this bank note to perform other transactions.
For example, you could lend it or put it in another savings account and so on. In a similar way cDAI is redeemable for actual DAI, cETH for ETH, cBTC for BTC and so on.
cTokens came out of Compound Labs the company that originally developed Compound. Their key motivation was in simplifying the programming and automating the process.
When you supply tokens it is hard to keep track of them. Compound needed an algorithmic way to do this so they tokenized the user’s share of the pool. The cToken represents your participation in that pool.
cTokens make the programatic ability to transfer and manage balances much easier. It is simpler and easier to understand and makes Compound more easily adapted as a building block in other DeFi products.
But cTokens offer way more than purely making programming simple.
How does the process work?
When a new supplier enters a pool new cTokens created. So if I supply DAI I get cDAI in return.
This process is baked into the smart contract and is how new cDAI gets minted. When you withdraw your DAI the cDAI is burnt.
The way a token gets burnt is that it gets sent to an unusable smart contract. It just sits there and noone can touch it. Effectively it has removed itself from supply.
So your cDAI is now collateralized (backed up) by the pool of DAI.
What is cool is that your cDAI can now be used as collateral themselves. This results in a multiplier kind of effect whereby you cDAI can be used in other DeFi protocols.
You can get very creative if you start thinking of all the potential combinations and things you can do. This is where crypto-Twitter often goes mental with people recommending complicated ways routing of such tokens across various protocols to earn a yield.
How Compound was founded
Compound Labs was founded by Robert Leshner and Geoff Hayes in 2017.
Prior to Compound the two of them had founded two companies.
When they entered the blockchain space most of the focus was on price speculation and less on the utility that tokens and DeFi could offer.
Attracted by the DeFi vision and ethos they decides to focus on lending and borrowing which are fundamental ingredients for a healthy financial ecosystem. At the time they did not see that need being fulfilled.
From the beginning they were clear that they wanted to set up a functioning system and then hand it over to the community.
And this is exactly what they did.
With strong buy-in from an enthusiastic community Compound is now fully decentralized.
This means there is no central authority and no key point of failure. Decisions are made based on voting and Robert and Geoff are now have gone on to build other apps that sit on top Compound.
From the beginning their vision was for Compound to be an enabler and tool for other developers to build innovative financial products in the DeFi space. Kind of like a money lego block.
On their website they write:”Compound is an algorithmic, autonomous interest rate protocol built for developers, to unlock a universe of open financial applications.”
So Compound has become an interest rate mechanism that anyone can use to build better and larger applications with a smoother user experience for consumers.
Both centralized and decentralized apps currently use it. While you can still use it as an individual it is mostly developers who use it to build apps upon.
How Compound Governance works
All the Compound parameters: collateral factor, base rate, slope, kink etc. are all fine-tuned by decentralized governance.
The governance token used on Compound is called COMP.
COMP does not have any other economic value other than allowing holders to vote on proposals put forward by other COMP holders.
Unlike other tokens where a significant proportion of the governance token is retained by the founding team, Compound Labs issued all its tokens at once. They distributed the 10Mn COMP tokens as follows:
- 50% to 60 stakeholders who built the protocol
- 50% to the 20-30,000 suppliers and borrowers who were active on the protocol at the time. The airdrop (distribution) of Comp was proportional to the volume of what they were doing on the platform.
COMP holders are incentivized to do the best things for the protocol otherwise they will lose out to the competition. The protocol is open to everybody which means that they cannot block someone.
At the same time, there is no central authority and no parameter to allow the diversion of funds. No one can make an arbitrary move, like the blocking of certain addresses, unless the community votes on it.
The governance mechanism relies on quorum voting. This means you need to have a minimum threshold to change parameters.
COMP is also used to incentivize borrowers and lenders. Suppliers can view this as extra bonus interest earned on their funds.
Borrowers view it as a subsidy on the interest that they pay. In fact, the first borrowers got paid so much COMP that it was as if someone had been paying them to borrow.
Governance follows two principles:
- The protocol must be able to run for ever. So no one person can remove it willingly or by mistake e.g. keys go missing.
- It should lead to increasing the upgradability of the protocol. This means it should be easy for a vibrant community to add new assets or functionality.
COMP token holders come together to vote on changes and upgrades. You can vote with your own COMP or you can delegate.
Most will delegate as there are very few who want to stay up all night. There is a small group that is wildly fanatical who usually monitor things more closely.
The bottom line is that proposals are created by the community and anyone with meaningful COMP votes can propose.
In this sense, Compound resembles a public utility as opposed to private for-profit entity.
Compound is truly decentralized
- No one address can destroy the protocol. It is upgradable by a large number of people.
- There are no other design goals. With half the COMP given to key stakeholders and half to users the COMP tokens can evolve from there on.
- Compound Labs that originally built the product retains 0 tokens.
- Compound expects to follow a system of slow governance. Standards are strict and they expect changes to follow the same pattern as Bitcoin where changes are made every two years or so.
Compound vs. BlockFi and other centralized crypto banks
Crypto banks such as BlockFi and Celsius are similar to centralized exchanges. Compound on the other hand is entirely on the blockchain.
Everything is fully transparent and runs on smart contracts. You can see everything that has ever occurred and the amount which is lent and borrowed.
BlockFi, for example, is run like traditional business using spreadsheets and custom software. From a user perspective it is similar to Compound in that you that you can lend and borrow.
The biggest difference however is automation and transparency.
In contrast to the full transparency offered by Compound, BlockFi is a black box: you can’t see what assets are backing the loans and you have to trust the team that they are not going to mess things up.
In a recent podcast, Compound Labs founder, Robert Leshner claims the main advantage is that Compound is auditable by anyone. “You will never get this level of comfort from a bank or crypto bank” he says.
This, he claims, leads to radically different outcomes. It is safer to build your business on top of Compound than a system you don’t know where the money is or if the business is solvent.
The main next step for Compound is to make it compatible with other blockchains beyond Ethereum. They hope to bridge with other chains such as Cosmos, Bitcoin and more.
What is Compound Treasury
Compound Treasury is a separate and new business being developed by Compound Labs to serve institutional clients. Remember Compound Labs has removed itself from the picture on the governance of the Compound protocol.
They are now just another team of developers building on top of Compound.
Compound Treasury is essentially Compound repackaged without the complexity. It abstracts away from the protocol so that clients do not have to touch crypto or interact with smart contracts.
As such, it is a simple dollar-in and dollar-out system with a fixed interest rate.
Also, liquidity is daily, as opposed to instant, to match what traditional finance is used to working with. This makes it more familiar as a product to institutional clients.
The way it works is they estimate what they expect the long term average interest rate for Compound to be.
Because changes happen very often the treasury estimates and offers 4%. If in the long term they make more than that then they are profitable. If they make less than 4% then subsidize via the Compound Treasury.
Wrapping up Compound
Compound is a key ingredient in the DeFi world and one of the first serious decentralized applications.
Its primitive simplicity makes it intuitive to understand and easy to build on. As a protocol it is used by multiple platforms from dapps that want to innovate to centralized exchanges that want to offer loans and savings products.