Full Report
Compound is a borrowing and lending protocol built on Ethereum. Naturally, Compound needs funds to lend out. This is done via liquidity providers (LP). When an LP deposits funds, they are put into a huge pool and receive the ERC-20 token cToken. This cToken represents a portion of the total pool. As the pool earns interest, the amount of funds a user can claim grows. cTokens represent ownership of a loan to be taken out. The value of the cTokens increases over time as borrowers make payments. The cTokens allow a user to take loans by using them as collateral. This means that the funds a user deposits as an LP to get cToken can directly be used to get another asset. cTokens are generic. For instance, cDAI is the DAI token cToken. How does it know how much a token is worth or what the exchange rate is? They use a Chainlink pricefeed in order to do this. This oracle is used to determine collateral requirements and all of the other fund work. The Controller manages risk within the protocol. This is done by setting collateral requirements and liquidation thresholds based on risk weights, user balances and prices from the oracle. Naturally, loans need to be overcollaterized in DeFi in order to work. This logic ensures that the protocol never loses funds on a loan when the market goes down. How does the protocol remain solvent - or have enough funds? Either too many people are borrowing or there are not enough funds being lent. To solve this problem, Compound has a formula known as the utilization rate for a pool. The higher the current utilization rate, the higher the interest on the loan is. Naturally, if the utilization rate is high, less loans will be taken out. Additionally, it will have high interest rates, leading to more LPs to provide value. The interest rate is calculated using the utilization rate, the profits to the protocol and the general borrowing interesting rate. This final value is calculated using an interest rate model to determine the cost of it. In particular, it has a flat fee and a yearly multiplier. This makes the interest linear. The graphs in the article use the purple line as what the borrower pays and the green line as what the LP receives. Most borrowed assets use the Jump Rate model. It's exactly like the previous model with two additional parameters: kink and jump multiplier. The kink is the point on the graph that the jump multiplier is used. The jump multiplier is the rate of increase once the kink has been hit. This makes a very steep climb once a particular threshold of utilization has been hit. The goal is that a high APY will incentivize users to deposit more to ensure there is always liquidity for withdrawal. With these values in mind, it is possible to calculate the amount of interest that would be paid for a loan over a given time period. Overall, good explanation on Compound! I had a lot of misconceptions cleared up.
Analysis Summary
# Research: Analysis of the Compound Protocol: Algorithmic Interest Rate Models and Liquidity Management
## Metadata
- **Authors:** Internal Technical Analysis (Based on provided documentation)
- **Institution:** Decentralized Finance (DeFi) Research Initiative
- **Publication:** Technical Protocol Review
- **Date:** October 2023 (Approximate)
## Abstract
This analysis examines the Compound protocol, a decentralized Ethereum-based borrowing and lending framework. It details the mechanisms of liquidity provision through cTokens, the role of decentralized oracles in risk management, and the algorithmic models used to maintain protocol solvency. The study focuses specifically on how the protocol utilizes variable interest rate models—Linear and Jump Rate—to balance supply and demand dynamically.
## Research Objective
The objective of this research is to demystify the internal mechanics of the Compound protocol, specifically addressing how it maintains solvency, manages collateralization, and calculates interest rates algorithmically to ensure continuous liquidity for users.
## Methodology
### Approach
A structural analysis of the protocol’s smart contract logic, focusing on the "Comptroller" risk engine and the "cToken" ERC-20 implementation.
### Dataset/Environment
The Ethereum blockchain environment, specifically focusing on cToken pools (e.g., cDAI) and their interaction with Chainlink price feeds.
### Tools & Technologies
- **Smart Contracts:** Solidity-based ERC-20 tokens (cTokens).
- **Oracles:** Chainlink Price Feeds.
- **Risk Management:** The Comptroller contract.
## Key Findings
### Primary Results
1. **Tokenization of Debt/Credit:** Compound utilizes cTokens to represent a user's share of a liquidity pool, where the exchange rate between the underlying asset and the cToken increases over time as interest accrues.
2. **Dynamic Solvency Management:** The protocol relies on a "Utilization Rate" formula. High utilization triggers higher interest rates to discourage borrowing and encourage lending.
3. **Multi-Model Interest Rates:** The protocol employs two primary models: a Linear model for standard assets and a Jump Rate model for highly volatile or high-demand assets.
### Supporting Evidence
- **The Kink Mechanism:** In the Jump Rate model, the "kink" serves as a critical threshold. Beyond this point, the "jump multiplier" causes a non-linear spike in interest rates to protect protocol liquidity.
### Novel Contributions
- **Algorithmic Liquidity Incentivization:** Unlike traditional banking, the protocol requires no manual intervention to adjust rates; it reacts purely to pool utilization ratios.
- **Generic Collateralization:** The introduction of cTokens as both a receipt of deposit and a collateral asset for further borrowing.
## Technical Details
The protocol's risk management is governed by the **Comptroller**. It calculates the "Account Liquidity" of users by fetching prices from **Chainlink Oracles**. To prevent insolvency, the protocol enforces **Overcollateralization**, meaning the value of the collateral must always exceed the value of the loan by a specific margin (the Collateral Factor).
Interest is calculated as:
- **Base Rate + (Utilization Rate * Multiplier)**
- For Jump Rate models: **Base Rate + (Utilization Rate * Multiplier) + (Excess Utilization * Jump Multiplier)** once the Kink is surpassed.
## Practical Implications
### For Security Practitioners
- **Oracle Dependency:** Security depends heavily on the accuracy of Chainlink feeds. A "stale" or manipulated price feed could lead to improper liquidations or undercollateralized loans.
- **Smart Contract Risk:** As cTokens are generic and interactive, vulnerabilities in the Comptroller could impact all associated pools.
### For Defenders
- **Monitoring Utilization:** Sudden spikes toward the "Kink" in the Jump Rate model can indicate liquidity crunches or potential exploit attempts (e.g., flash loan attacks).
- **Liquidation Thresholds:** Ensuring liquidation bots are functional is essential for protocol health.
### For Researchers
- **Future Research Directions:** Investigation into the optimal placement of the "Kink" to maximize protocol revenue while minimizing the risk of a liquidity bank run.
## Limitations
- **Ethereum Scalability:** The protocol is limited by the transaction throughput and gas costs of the Ethereum mainnet.
- **Market Volatility:** Extreme market crashes can happen faster than liquidations can be processed, potentially leading to bad debt.
## Comparison to Prior Work
Unlike Peer-to-Peer lending, Compound uses **Peer-to-Pool** lending. This removes the need for borrowers and lenders to match individually, providing instant liquidity at the cost of variable interest rates.
## Real-world Applications
- **Yield Farming:** LPs use cTokens to earn passive interest on idle assets.
- **Leveraged Longing:** Users can deposit an asset, borrow a stablecoin against it, and buy more of the original asset.
## Future Work
- Analysis of the transition to **Compound III**, which moves toward a more isolated collateral model to limit cross-asset contagion.
- Integration of cross-chain liquidity bridges.
## References
- Compound Whitepaper: `https://compound[.]finance/documents/Compound.Whitepaper.pdf`
- Chainlink Documentation: `https://docs[.]chain[.]link/data-feeds`
- Ethereum ERC-20 Standard: `https://eips[.]ethereum[.]org/EIPS/eip-20`