Exercises: DeFi Foundations

Conceptual Exercises

Exercise 21.1: The Five Pillars

For each of the five pillars of the DeFi thesis (permissionless access, transparency, composability, 24/7 operation, programmable money), do the following:

a) Describe a specific scenario in traditional finance where this pillar's absence causes real harm to a real category of users.

b) Describe how DeFi addresses that harm.

c) Identify at least one limitation or risk introduced by DeFi's approach to solving the problem.

d) Evaluate whether the net effect is positive, negative, or ambiguous. Justify your answer.


Exercise 21.2: The DeFi Stack

Draw a diagram of the DeFi stack (settlement layer, asset layer, protocol layer, aggregation layer, interface layer) and place the following in the correct layer:

  • Ethereum mainnet
  • USDC
  • Uniswap
  • MetaMask
  • 1inch
  • Aave
  • ERC-20 standard
  • Arbitrum
  • Wrapped Bitcoin (WBTC)
  • Zapper

For each item, write one sentence explaining why it belongs in that layer.


Exercise 21.3: Composability Trace

Consider the following multi-protocol DeFi strategy:

  1. A user deposits 10 ETH into Lido and receives 10 stETH (liquid staking token)
  2. The user deposits the 10 stETH into Aave as collateral
  3. The user borrows 15,000 USDC against the stETH collateral on Aave
  4. The user deposits the 15,000 USDC into a Curve USDC/USDT/DAI pool and receives LP tokens
  5. The user deposits the Curve LP tokens into Convex Finance for boosted yield

a) Identify every protocol involved and the layer of the DeFi stack it occupies.

b) How many distinct tokens does the user hold or interact with during this process? List them all.

c) If the price of ETH drops 30% in one hour, trace the cascade effects through this strategy. Which step is most vulnerable? What happens to the user's positions?

d) Calculate the TVL impact. If this user's 10 ETH is worth $30,000, how much TVL is "created" across all protocols? Is any of it double-counted?

e) Explain why this strategy is impossible to replicate in the traditional financial system. Be specific about which institutional boundaries would prevent it.


Exercise 21.4: TVL Decomposition

You are analyzing a DeFi protocol that reports $500 million in TVL. Investigation reveals the following:

  • $200 million is native stablecoin deposits from users who are actively borrowing against them
  • $150 million is wrapped versions of tokens already counted in other protocols' TVL
  • $100 million entered the protocol during a liquidity mining campaign offering 200% APY in governance tokens
  • $50 million is from a single whale wallet that deposits and withdraws large amounts daily

a) Estimate the "real" TVL — capital genuinely committed to using the protocol's financial services. Justify your adjustments.

b) What additional metrics would you want to see to evaluate this protocol's health?

c) The protocol's governance token has a market cap of $80 million. Is the $500 million TVL figure consistent with this? What might the discrepancy suggest?


Exercise 21.5: Innovation or Repackaging?

For each of the following, determine whether it is a genuine DeFi innovation (something that requires blockchain infrastructure) or a repackaging of something traditional finance already offers. Justify your answer.

a) A protocol that allows users to earn 4% APY on stablecoin deposits

b) A flash loan used to arbitrage price differences between two DEXs in a single transaction

c) A DEX that allows anyone to list any ERC-20 token without permission

d) A yield aggregator that automatically moves deposits between lending protocols to maximize returns

e) A protocol that tokenizes real-world assets (real estate, invoices) and sells fractional shares

f) A prediction market where users bet on election outcomes using cryptocurrency

g) A protocol that allows streaming payments — salary paid per second rather than biweekly


Analytical Exercises

Exercise 21.6: Promise vs. Reality Audit

Choose one of the following DeFi claims and write a 500-word critical analysis:

a) "DeFi is the future of banking for the 1.4 billion unbanked."

b) "DeFi eliminates the need to trust financial institutions."

c) "DeFi is more efficient than traditional finance because it eliminates intermediaries."

Your analysis must include: - Evidence supporting the claim - Evidence contradicting the claim - Specific data points (you may need to research current statistics) - Your overall assessment with conditions under which the claim might become true


Exercise 21.7: Risk Mapping

Create a risk map for a DeFi user who has: - 50% of their crypto portfolio in a lending protocol earning yield - 30% providing liquidity on a DEX - 20% staked in a liquid staking protocol

For each position, identify at least three distinct risk categories (smart contract risk, oracle risk, liquidation risk, impermanent loss, regulatory risk, etc.). Rate each risk as High/Medium/Low and explain your rating. Which risks are correlated (i.e., if one materializes, others become more likely)?


Exercise 21.8: Comparative Analysis

Compare DeFi lending (e.g., Aave) with traditional bank lending across the following dimensions. For each, explain which system performs better and why:

Dimension DeFi Lending Traditional Lending
Access requirements
Speed of loan origination
Transparency of terms
Interest rate determination
Collateral requirements
Default/liquidation process
Regulatory protection for borrowers
Ability to serve credit needs (mortgage, business loan)
Risk of total loss
Geographic accessibility

After completing the table, write a paragraph summarizing when DeFi lending is genuinely superior and when traditional lending is genuinely superior.


Programming Exercises

Exercise 21.9: TVL Analysis (Python)

Using the code/tvl_analysis.py script as a starting point:

a) Modify the script to calculate the Herfindahl-Hirschman Index (HHI) for DeFi TVL concentration across protocols. The HHI is the sum of squared market shares. An HHI above 2,500 is considered highly concentrated. What does the current HHI tell you about DeFi's competitive landscape?

b) Add a function that calculates "TVL velocity" — how quickly TVL changes over rolling 7-day and 30-day windows. Plot the velocity over time. Does high TVL velocity correlate with market events (crashes, protocol launches, exploit announcements)?

c) Compare TVL-to-revenue ratios across the top 10 protocols. Which protocols generate the most revenue per dollar of TVL? What does this suggest about the difference between "capital parked" and "capital working"?


Exercise 21.10: Composability Simulation (Python)

Using the code/composability_demo.py script as a starting point:

a) Add a "market crash" simulation: what happens to the composed strategy when ETH price drops 40% in one hour? Track the state of each position through the cascade.

b) Implement a "gas cost" parameter. At various gas price levels ($1, $5, $20, $50, $100 per transaction), calculate the minimum position size needed for the composed strategy to be profitable. What does this tell you about who can actually benefit from DeFi composability?

c) Add a flash loan step to the simulation. Demonstrate how a user could use a flash loan to unwind the entire composed position in a single transaction if market conditions change.


Discussion Questions

Discussion 21.1

DeFi proponents argue that code is more trustworthy than institutions because code is deterministic and auditable. DeFi critics argue that institutions are more trustworthy than code because institutions are accountable to regulators and can exercise judgment. Which argument do you find more compelling, and under what conditions? Is there a synthesis that combines the strengths of both?

Discussion 21.2

If DeFi succeeds in its vision of replacing traditional financial intermediaries, what happens to the people who currently work in those intermediaries — loan officers, bank tellers, compliance officers, financial advisors? Is this different from previous waves of automation (ATMs replacing tellers, online banking reducing branch visits)? What obligations, if any, does the DeFi ecosystem have to the workers it aims to displace?

Discussion 21.3

MEV (Maximal Extractable Value) means that validators can profit by reordering transactions at the expense of ordinary users. Some argue this is an inevitable feature of blockchain architecture. Others argue it is a form of structural theft that must be solved. Who is right? Is MEV fundamentally different from high-frequency trading's speed advantages in traditional markets?

Discussion 21.4

DeFi's composability is both its greatest strength and its greatest vulnerability. The same openness that enables innovation also enables exploits. If you were designing DeFi from scratch, would you change this tradeoff? How? Is there a way to preserve composability while reducing systemic risk?