Decentralized Finance, better known as DeFi, is predicated on the tenants of non-custodial, trustless and secure systems with 100% uptime. This means:
- Companies do not store funds on behalf of their users
- Issuing entities are not needed to process transactions
- Products are highly secure (thanks to protocols like Ethereum)
- 24/7 accessibility from anywhere in the world.
Systems designed with these tenants favor efficiency and inclusivity as the companies issuing DeFi products largely automate their service. Smart contracts handle the majority of logic that has historically been handled by human inputs, vastly optimizing transaction time and cost.
An example of a DeFi company designed with these tenants is Compound Finance.
What is Compound Finance?
At a high level, Compound Finance is a permissionless lending system built on Ethereum. Compound enables users to lend and borrow popular cryptocurrencies like Ether in exchange for interest or debt.
Compound leverages audited smart contracts which are responsible for the storage, management and facilitation of all funds. This means that users do not have a Compound login, but rather connect to the Ethereum system and its benefits through web3 wallets like MetaMask.
Despite being based in San Francisco, Compound Markets are always on, meaning that anyone can lend or borrow their assets in minutes without any intervention or permission from the company itself.
How does it work?
To get started with Compound, head over to app.compound.finance. From here, users are prompted to connect with their web3 wallet of choice.
Upon confirming the prompt for Compound’s contracts to interact with the web3 wallet, users are brought to a dashboard which displays all the currently supported assets. In order to lend or borrow any of these assets, users must click on that asset’s page to “unlock” it. We’ll use the Dai stablecoin as an example.
Once an asset has been unlocked (granting permissions to the smart contract to handle these funds), users can then proceed to lend that asset at the predefined supply APR highlighted in green. It’s important to note that in order to borrow an asset, assets must first be supplied to obtain “Borrowing Power“. Borrowing Power is a metric unique to Compound that represents the amount that can be borrowed and increases with the amount of collateral supplied. As an aside, Ethereum DeFi systems are currently built around collateral rather than identity/reputation and so borrowers must use collateral to back any form of borrowing.
Here’s a look at how the supply balance looks after the transaction has processed:
Upon your assets being supplied, your wallet will receive – in this instance – Compound Dai (cDai). cDai is one of many “cTokens”, a modified version of its original token that represents the tokens being supplied through Compound smart contracts. cTokens are elaborated on further below in this guide.
To redeem supplied assets (plus any interest that has been earned), a user simply clicks the “withdraw” button to approve the transaction and return funds from Compound’s smart contract.
Borrowing on Compound Finance
In order to borrow, users must “Enable Borrowing” by submitting one more transaction.
Assuming that the user has already completed the previous steps to generate “Borrowing Power”, it is now possible to borrow assets using Compound’s borrowing dashboard.
Why all the unlocks and prompts?
Compound must receive permission from a web3 wallet for their smart contracts to perform actions on your wallets behalf. This establishes a bridge for Compound’s smart contracts to interact with a web3 wallet. Permissions need only be granted once and, because permission changes require Ethereum computation, they each require a small gas fee – usually between $0.01 and $0.05.
After choosing a supported asset on the right hand side of the dashboard, users can then select how much they would like to borrow. When making this selection, the decision on how much to borrow will be facilitated by a “Safe Max” metric. The Safe Max ensures that the borrower will not find themselves having their supplied assets (collateral) liquidated in the event of a decline in the collateral’s value.
Upon submitting the transaction, the borrowed asset (in this example, Ether) is deposited into the web3 wallet that is connected.
Debt begins accruing at the predefined interest rate and can be repaid at any time by pressing “repay” button.
Interest rates vary relative to the amount of liquidity present in each market and fluctuate in real-time based on supply and demand. When liquidity is plentiful, interest rates are low. A drop in liquidity leads to an increase in interest rates, incentivizing new supply and the repayment of debt.
Interest rates are variable over the course of a loan, meaning a quoted rate is likely to change during the lifetime of a loan or debt. Interest is quoted as an annual rate and accrues with each Ethereum block (roughly every 15 seconds); meaning the amount of interest (or debt) will increase (or decrease) every time a block is processed on chain.
A user’s Borrowing Power is directly correlated to the amount of collateral provided on the supply side. Each asset has a unique “Collateral Factor“, meaning that the amount of Borrowing Power unlocked by each asset varies.
This is due to the inherent volatility of an asset. For example, Basic Attention Token (BAT), which has a Collateral Factor of 50% would generate less borrowing power than the stablecoin Dai, which has a higher Collateral Factor (reflecting its lower risk) of 75%. This means that supplying $100 worth of BAT will enable up to $50 of Borrowing Power while supplying $100 worth of DAI will enable up to $75 of Borrowing Power.
Seeing as multiple assets can be lent at one time, the Collateral Rate takes into account the Collateral Factors of all assets being supplied, ultimately providing a benchmark for the maximum amount of funds that can be borrowed relative to the amount of unique assets being supplied.
The Collateral Factor for each asset is determined by Compound Finance’s governance mechanism.
In the event that the size of your debt outpaces your maximum borrowing factor, Compound exchanges the over-borrowed asset for the borrower’s supplied collateral, at a slightly lower than market rate. This acts as an incentive for the user to manage their debt effectively – poor management and an under-collateralized loan would incur a cost as the borrower’s collateral is sold off at an unfavorable rate. This incentive mechanism ensures that debt remains fully collateralized (as determined by Compound governance) and reduces systemic risk.
Compound allows community members to act as liquidators using tools like the Compounder Liquidator (requires web3 browser/extension), allowing them to repay other user’s loans in return for ETH at a better market rate.
For example, a 10 ETH loan that no longer had enough collateral to back it, could be repaid (re-collateralized) by another user. This user would be benefited by receiving the underlying collateral of this loan (paid in ETH) at a 5% or more discount.
To prevent liquidation, Compound also offers an Account Service API to monitor at-risk addresses.
When it comes to updating risk parameters of the Compound Finance system, such as APR or Collateral Factors for an individual asset, Compound leverages an account called “Timelock”. This account has the power to adjust parameters within the system but with a time-delay, ensuring that any nefarious activity may be spotted and mitigated before it is deployed.
From the Compound.finance website:
“Each proposed governance action will be published with an ETA at least 2 days in the future from the time of announcement. For instance, major upgrades, such as changing the risk system, may have a 14 day delay. The Timelock is administered by a designated address. Currently, the Compound team controls the Timelock administrator address.”
At this stage, Compound – the company – is in control of that platform’s risk parameters (albeit with a time-delay). However, by using this Timelock smart contract to handle these actions, it’s entirely possible for Compound to eventually turn access to Timelock over to a distributed board of community members. This set Compound Finance on a path to becoming a “Decentralized Autonomous Organization” (DAO), not too dissimilar to that of MakerDAO.
Proposals are currently posted by Compound and given a window of time for the community to reflect and comment on any major issues prior to integrating those changes into the protocol.
cTokens are tokenized representations of a user’s outstanding balance on Compound assets. Each cToken has a unique ERC20 address which can be viewed on Ethereum blockchain explorers like Etherscan.io.
Instead of constantly distributing payouts (which would incur an unfathomable amount of gas), cTokens allow users to accumulate interest without having to have the amount paid out in each and every block.
Upon the supply of assets to Compound, users receive an equivalent cToken in return. The amount of cTokens is fixed at issuance, with the amount of underlying assets representing one cToken gradually increasing relative to the Supply APR. Let’s look at an example:
Assuming a cDAI/DAI rate of 0.020070, a user who supplied 1000 DAI to the Compound system would generate 49825.61 cDAI (1000 / 0.020070) in return.
A year later, imagine the cDAI/DAI rate had increased to 0.021591. The cDAI created (49825.61) is now worth 1075.78 DAI (1000 * 0.021591) – an increase of 75.78 DAI.
One of the major benefits of cTokens is that they are transferable and earn interest regardless of where they are held. It’s important to note however, that cTokens inherit the Borrowing Power of the wallet they reside – a transfer of cTokens to a under-collateralized wallet could lead to liquidation.
Like the rest of DeFi, Compound Finance offers a unique system for further leveraging Ethereum-based cryptocurrencies. By supplying assets to Compound, users can earn a passive income knowing that the smart contracts that operate it are highly secure. Rather than having to worry about constantly collecting interest, users simply hold cTokens which accrue in value at every block.
Similarly, Compound can be used as a form of risk-averse leverage. By supplying an asset, a user is able to borrow an asset (gaining price exposure) while paying very little (or even earning) interest on their supplied collateral. This type of decentralized leverage provides, arguably, more control and security than a leveraged position at a centralized exchange. The one major downside to the decentralized approach is that – to avoid incurring significant interest fees – a user would only be able to leverage a small proportion of what they supply as collateral.
Compound does not require any KYC, meaning that anyone from anywhere in the world can earn favorable interest rates on their platform.
Compound offers a wide variety of assets and can be accessed through multiple interfaces such as Instadapp and Zerion, all of which leverage the same suite of smart contracts. Other products and companies leveraging Compound (and there are many) can be found here.
Can Compound Finance be trusted?
Compound has also had its cTokens and smart contracts integrated with other reputable systems such as InstaDapp and others. While social factors like these don’t account for systemic risk or black swan events, they imply a certain degree of trust from other major players in the industry.
Compound’s collateral-based approach to lending and high Collateral Factor also provide a significant buffer in the event of a market crash. While Compound Finance has not yet weathered any major storms in the market, a similar platform, MakerDAO, which is also based on collateral, went from strength-to-strength during the 2017/18 bear market.
In a handful of situations where potential flaws were discovered, the Compound team were very transparent in addressing concerns, ultimately showing the community what went wrong, how it was fixed and how similar issues will be mitigated in the future.