An overview of the major protocols that form the backbone of Decentralized Finance, enabling lending, borrowing, and trading without traditional intermediaries.
An Overview of Major DeFi Protocols (AAVE, Uniswap, Compound)
Foundational DeFi Concepts
AAVE: Decentralized Lending
AAVE is a leading non-custodial liquidity protocol for lending and borrowing. Users can earn interest by supplying assets to liquidity pools or take out loans by using other crypto assets as collateral.
- Overcollateralized Loans: Borrowers must deposit crypto worth more than the loan to mitigate risk.
- Flash Loans: Unique uncollateralized loans that must be borrowed and repaid within a single transaction block, used for arbitrage.
- Interest Rate Model: Uses algorithmically determined rates based on pool utilization, balancing supply and demand.
- Real Use Case: A user can deposit ETH to earn yield and then borrow stablecoins like DAI against it to make other investments without selling their ETH.
Uniswap: Automated Market Making
Uniswap is a decentralized exchange (DEX) protocol that uses an Automated Market Maker (AMM) model instead of traditional order books. Liquidity providers (LPs) deposit pairs of tokens into pools, enabling instant swaps.
- Constant Product Formula (x*y=k): Determines prices algorithmically based on the ratio of tokens in a pool.
- Permissionless Listing: Anyone can create a market for any ERC-20 token pair by providing liquidity.
- Liquidity Provider Fees: LPs earn a 0.3% fee on all trades in their pool.
- Real Use Case: A trader can instantly swap ETH for a new DeFi token, while an LP earns passive income from the trading fees generated by that pair's pool.
Compound: Algorithmic Money Markets
Compound is a protocol that creates algorithmic, autonomous money markets for lending and borrowing crypto assets. It allows users to earn interest or obtain loans directly from the protocol's liquidity pools.
- cTokens: When a user supplies assets, they receive cTokens (e.g., cETH) which accrue interest in real-time and are redeemable for the underlying asset.
- Collateral Factors: Each asset has a set borrowing limit (e.g., 75% of collateral value) to ensure solvency.
- Governance Token (COMP): Holders can propose and vote on changes to the protocol, decentralizing control.
- Real Use Case: A DAO can deposit its treasury's USDC to earn yield, using the generated cUSDC as collateral to borrow another asset for operational expenses.
Liquidity & Yield Farming
Liquidity provision is the act of depositing crypto assets into a protocol's pool to facilitate trading or lending. Yield farming involves strategically moving these assets between protocols to maximize returns, often incentivized by additional governance tokens.
- Impermanent Loss: A risk for LPs where the value of deposited assets changes compared to simply holding them.
- Incentive Alignment: Protocols like Compound and AAVE distribute governance tokens (COMP, AAVE) to users to bootstrap liquidity.
- Farming Strategies: Users often "farm" by providing liquidity to a Uniswap pool and then staking the LP tokens in another protocol for extra rewards.
- Real Use Case: A farmer provides ETH/DAI liquidity on Uniswap, receives LP tokens, and then deposits them into a yield aggregator like Yearn to automatically compound rewards.
DeFi Composability (Money Legos)
Composability refers to the ability of DeFi protocols to seamlessly integrate and build upon each other like "money legos." This creates complex, interconnected financial products and services from simple, permissionless building blocks.
- Interoperable Protocols: Outputs from one protocol (like Uniswap's LP tokens) can be used as inputs in another (like AAVE as collateral).
- Innovation Layer: Enables the creation of yield aggregators, flash loan arbitrage strategies, and structured products.
- Systemic Risk: While powerful, tight coupling can lead to cascading failures if a major protocol is exploited.
- Real Use Case: A user takes a flash loan from AAVE, uses it for arbitrage across multiple DEXs via a aggregator like 1inch, and repays the loan—all in one transaction, profiting from price differences.
Protocol Architecture Deep Dive
Getting Started with DeFi Protocols
Decentralized Finance (DeFi) allows you to lend, borrow, and trade crypto assets without a bank, using smart contracts on blockchains like Ethereum. Protocols are the rulebooks these contracts follow.
Key Points
- Lending & Borrowing: Protocols like AAVE and Compound let you deposit crypto to earn interest or use it as collateral to borrow other assets. Your deposited funds are pooled for others to borrow.
- Automated Market Making: Uniswap enables token swaps without order books. It uses liquidity pools where users provide token pairs, and prices are set by a mathematical formula (x*y=k).
- Governance Tokens: Many protocols issue tokens (like AAVE or UNI) that let holders vote on upgrades, showing how DeFi is community-run.
Example
When using Uniswap to swap ETH for DAI, you connect your wallet, select the tokens, and the protocol automatically finds the best rate from its liquidity pools, executing the trade instantly via a smart contract.
End-User Interaction Flow
A practical walkthrough for interacting with major DeFi protocols to supply assets, borrow, or swap tokens.
Step 1: Connect Wallet & Fund with Base Assets
Set up a Web3 wallet and acquire the necessary cryptocurrency to begin.
Detailed Instructions
First, you must connect a non-custodial Web3 wallet like MetaMask to a DeFi platform's interface. Ensure your wallet is funded with base assets such as Ethereum (ETH) for gas fees and the specific tokens you intend to use. For example, to supply DAI to Aave, you need DAI in your wallet. Acquire these via a centralized exchange or a DEX like Uniswap. Gas fees (transaction costs on Ethereum) vary, so check current network conditions.
- Sub-step 1: Install and fund a MetaMask wallet. Ensure you have ETH for gas.
- Sub-step 2: Navigate to the protocol's official web app (e.g., app.aave.com).
- Sub-step 3: Click "Connect Wallet" and select your wallet provider.
- Sub-step 4: Verify your wallet's network is set to Ethereum Mainnet or the correct Layer 2.
Tip: Always use official links to avoid phishing sites. Consider using a hardware wallet for large sums.
Step 2: Supply Assets to Earn Yield or Enable Borrowing
Deposit your crypto assets into a lending protocol to start earning interest.
Detailed Instructions
On protocols like AAVE or Compound, you supply or deposit assets into a liquidity pool. This action mints a receipt token (like aTokens or cTokens) representing your share and accruing interest. For instance, supplying 100 DAI to Aave mints 100 aDAI in your wallet. This step is often prerequisite for borrowing. The Loan-to-Value (LTV) ratio determines how much you can borrow against your collateral. Always monitor the health factor, a safety metric; if it drops below 1, your position may be liquidated.
- Sub-step 1: On Aave's dashboard, select the asset (e.g., DAI) and click "Supply".
- Sub-step 2: Enter the amount (e.g., 100 DAI) and approve the token contract interaction.
- Sub-step 3: Confirm the transaction in your wallet, paying the gas fee.
- Sub-step 4: Verify your wallet balance now shows aDAI tokens and your supplied balance on the UI.
Tip: Start with a small amount to test. Interest rates are variable; check between protocols for the best APY.
Step 3: Execute a Token Swap on a DEX
Trade one cryptocurrency for another using an automated market maker (AMM).
Detailed Instructions
On Uniswap V3, you can swap tokens directly from your connected wallet. The protocol uses constant product market maker formulas and concentrated liquidity. You'll encounter slippage tolerance (the maximum price movement you accept) and swap fees (0.05%, 0.30%, or 1.00% per pool). Always check the quoted exchange rate. For a swap from 1 ETH to DAI, you might use a command in the interface to find the best route across multiple pools.
- Sub-step 1: Go to app.uniswap.org and connect your wallet.
- Sub-step 2: Select input token (ETH) and output token (DAI). Enter the amount.
- Sub-step 3: Set your slippage tolerance (e.g., 0.5%) and review the fee.
- Sub-step 4: Click "Swap", approve the token spend if it's your first time, then confirm.
code// Example Uniswap V3 SwapParameters struct core concept struct ExactInputSingleParams { address tokenIn; address tokenOut; uint24 fee; // e.g., 3000 for 0.30% address recipient; uint256 deadline; uint256 amountIn; uint256 amountOutMinimum; uint160 sqrtPriceLimitX96; }
Tip: Use the "Expert Mode" cautiously. For large swaps, consider splitting into smaller transactions to minimize slippage.
Step 4: Borrow Assets Against Collateral
Take out a loan using your supplied assets as collateral, managing risk parameters.
Detailed Instructions
After supplying assets (Step 2), you can borrow other assets on Aave or Compound, creating a leveraged or hedging position. Your borrowing power is limited by your collateral's LTV ratio. Borrowing accrues interest, which compounds. The critical metric is your health factor (HF). On Aave, an HF below 1 triggers liquidation. You can borrow stablecoins (like USDC) or volatile assets (like ETH). Always have a plan to repay or manage the debt.
- Sub-step 1: In the "Borrow" section, select the asset to borrow (e.g., 500 USDC).
- Sub-step 2: The interface shows your available borrowing power based on collateral. Confirm the variable or stable interest rate.
- Sub-step 3: Execute the borrow transaction. The borrowed assets are sent to your wallet.
- Sub-step 4: Immediately check your updated health factor on the dashboard.
code// Simplified view of a key Aave health factor calculation // Health Factor = (Total Collateral in ETH * Liquidation Threshold) / Total Borrows in ETH // Example: If collateral is 10 ETH (Threshold 80%) and borrows are 5 ETH: // Health Factor = (10 * 0.8) / 5 = 1.6
Tip: Borrow conservatively. A health factor above 2 is safer. Monitor interest rates, as they can change with market conditions.
Step 5: Monitor & Manage Positions
Actively track your DeFi investments and loans, making adjustments as needed.
Detailed Instructions
Active management is crucial in DeFi. You must regularly monitor your supplied assets' APY, borrowed assets' interest rate, and most importantly, your health factor. Use dashboards like Aave's "Dashboard" or DeFi portfolio trackers. You may need to add more collateral or repay part of your debt to avoid liquidation if prices move against you. You can also claim accrued rewards (like stkAAVE incentives) or withdraw your supplied assets (which requires repaying any outstanding borrows first on most protocols).
- Sub-step 1: Daily, check your positions on the protocol's dashboard for HF and rates.
- Sub-step 2: If HF nears 1.1, either repay some debt via the "Repay" tab or add collateral via "Supply".
- Sub-step 3: To withdraw, first ensure your HF remains safe after the withdrawal reduces your collateral.
- Sub-step 4: Claim any governance or liquidity mining rewards from the "Rewards" section.
Tip: Set up price alerts for your collateral assets. Use DeFi Saver or Instadapp for automated position management.
Step 6: Exit Positions & Withdraw Funds
Safely close out your DeFi interactions and return assets to your wallet.
Detailed Instructions
The final step involves repaying all borrowed funds and withdrawing your supplied collateral. On Aave, you must repay in the same asset you borrowed. After full repayment, your health factor becomes infinite, allowing you to withdraw all supplied assets by burning your aTokens. On Uniswap, simply ensure you have the desired token balance in your wallet. Always confirm transactions on-chain and verify final wallet balances. Remember that gas fees are required for each transaction.
- Sub-step 1: Navigate to the "Repay" section for each open borrow. Repay the full amount (plus accrued interest).
- Sub-step 2: After repayments are confirmed, go to the "Withdraw" section for your supplied assets.
- Sub-step 3: Select the asset and withdraw the maximum amount. This burns your aTokens/cTokens.
- Sub-step 4: Verify the native tokens (e.g., DAI, ETH) are back in your connected wallet address (e.g., 0x742d35Cc6634C0532925a3b844Bc9e...).
Tip: Perform exits during low network congestion to save on gas. Double-check that no tiny debt dust remains, as it can still be liquidated.
Protocol Comparison: Mechanisms & Economics
An Overview of Major DeFi Protocols (AAVE, Uniswap, Compound)
| Feature | AAVE | Uniswap V3 | Compound V2 |
|---|---|---|---|
Primary Function | Lending & Borrowing | Automated Market Maker (AMM) | Lending & Borrowing |
Governance Token | AAVE | UNI | COMP |
Interest Rate Model | Variable & Stable Rates | N/A (Trading Fees) | Jump Rate Model |
Liquidity Provision | Supplying Assets to Pools | Concentrated Liquidity Positions | Supplying Assets to Markets |
Fee Structure | Reserve Factor (e.g., 10% of interest) | 0.01%, 0.05%, 0.30%, 1.00% Tiers | Reserve Factor (e.g., 15% of interest) |
Collateralization | Over-collateralized Loans | N/A | Over-collateralized Loans |
Unique Mechanism | Flash Loans, Rate Switching | Concentrated Liquidity, Fee Tiers | cToken Interest Accrual |
Protocol-Specific Risks and Considerations
An overview of unique vulnerabilities and operational factors for AAVE, Uniswap, and Compound that users must evaluate before participating.
AAVE: Liquidation & Health Factor Risk
Liquidation risk is paramount when borrowing on AAVE. Your loan's Health Factor must stay above 1.0, or your collateral is partially sold at a penalty.
- Volatility spikes can rapidly drop collateral value, triggering liquidation.
- Example: Borrowing ETH against deposited WBTC; a sudden BTC crash could liquidate you.
- Liquidation penalties (up to 10%) and bad debt accumulation from undercollateralization are critical user considerations.
Uniswap: Impermanent Loss & Slippage
Impermanent Loss (IL) occurs when providing liquidity, as asset price ratios diverge from deposit time. You earn fees but may lose versus simply holding.
- High volatility pairs (e.g., ETH/MEME) experience severe IL.
- Slippage tolerance settings protect against front-running but can cause failed trades in fast markets.
- This matters for LPs weighing fee income against potential capital erosion from IL.
Compound: Interest Rate Model & Governance
Interest rate volatility is driven by Compound's algorithmic model, which adjusts based on pool utilization. Borrowing costs can surge unexpectedly.
- Example: High demand for USDC loans can spike APY from 5% to 30%+ rapidly.
- Governance token (COMP) proposals can alter critical parameters like collateral factors.
- Users must monitor both market conditions and governance votes that directly affect their positions.
Smart Contract & Upgrade Risks
All protocols face smart contract risk—bugs or exploits in immutable code. Upgrade mechanisms via admin keys or timelocks introduce centralization and implementation risks.
- AAVE's safety module and Uniswap's v2/v3 migrations are examples of upgrade processes.
- A governance attack or bug in a new implementation could freeze or drain funds.
- This underscores the need to audit not just code, but also governance structures.
Oracle Manipulation & Price Feeds
Oracle reliability is critical, as protocols use external price feeds for valuations and liquidations. Oracle manipulation attacks can cause systemic failures.
- Compound and AAVE primarily use Chainlink; Uniswap v3 pools can act as oracles.
- A flash loan attack could temporarily skew a price feed, triggering false liquidations.
- Users depend on the security and decentralization of these oracle networks for accurate pricing.
Protocol Tokenomics & Incentives
Incentive misalignment can arise from liquidity mining and governance token distributions designed to bootstrap usage but not long-term stability.
- Example: COMP or AAVE rewards attracting "mercenary capital" that exits after programs end.
- Token holder governance may prioritize speculative value over user safety in votes.
- This creates sustainability risks where protocol growth and security incentives may conflict.
Technical and Economic FAQ
Further Reading and Official Resources
Ready to Start Building?
Let's bring your Web3 vision to life.
From concept to deployment, ChainScore helps you architect, build, and scale secure blockchain solutions.