Weekly Exercises

Hands-on assignments to reinforce course concepts. Each exercise includes practical tasks with clear deliverables.

0%

Your Progress

0 of 12 exercises completed

12
Exercises
1200
Total Points
~40h
Total Time

Exercise Overview

Week Title Points Time Difficulty
1 Exploring the DeFi Ecosystem 100 2-3 hours easy
2 Ethereum Transaction Analysis 100 3-4 hours medium
3 Token Analysis and Tokenomics 100 3-4 hours medium
4 AMM Mechanics and Analysis 100 4-5 hours hard
5 Lending Protocol Analysis 100 4-5 hours hard
6 Stablecoin Stability Analysis 100 3-4 hours medium
7 Yield Farming Strategy Analysis 100 4-5 hours hard
8 DeFi Derivatives Analysis 100 4-5 hours hard
9 Oracle Security Analysis 100 3-4 hours medium
10 DAO Governance Analysis 100 3-4 hours medium
11 DeFi Security Assessment 100 4-5 hours hard
12 L2 and Cross-Chain Analysis 100 3-4 hours medium

## Week 1: Exploring the DeFi Ecosystem
100 Points 2-3 hours Easy

Analyze the DeFi ecosystem by exploring TVL data, identifying major protocols, and comparing DeFi with traditional finance.

Learning Objectives

  • Navigate DeFi data platforms (DeFiLlama, Dune)
  • Identify and categorize major DeFi protocols
  • Compare DeFi metrics with TradFi equivalents

Tasks

Task Points Description
TVL Analysis 30 Retrieve and visualize TVL data for the top 10 DeFi protocols over the past year
Protocol Categorization 35 Create a taxonomy of 20+ DeFi protocols by category (DEX, lending, stablecoin, etc.)
DeFi vs TradFi Comparison 35 Compare DeFi volumes and yields with traditional finance equivalents

## Week 2: Ethereum Transaction Analysis
100 Points 3-4 hours Medium

Analyze Ethereum transactions, understand gas mechanics, and interact with smart contracts using web3.py.

Learning Objectives

  • Read and interpret Ethereum transaction data
  • Calculate gas costs and optimize transactions
  • Interact with smart contracts programmatically

Tasks

Task Points Description
Transaction Decoding 25 Decode and explain 5 different types of DeFi transactions from Etherscan
Gas Analysis 25 Analyze gas prices over a week and identify patterns in network congestion
Contract Interaction 25 Write Python code to read state from 3 different DeFi protocols
ABI Exploration 25 Document the key functions in a Uniswap router contract

## Week 3: Token Analysis and Tokenomics
100 Points 3-4 hours Medium

Analyze ERC-20 token distributions, evaluate tokenomics models, and explore token standards.

Learning Objectives

  • Query token holder distributions
  • Evaluate tokenomics for fairness and sustainability
  • Compare different token standards

Tasks

Task Points Description
Holder Distribution 30 Analyze token holder distribution for 3 governance tokens (compute Gini coefficient)
Tokenomics Evaluation 35 Compare vesting schedules and emission rates for 3 DeFi protocols
Token Standard Comparison 35 Implement a simple analysis comparing ERC-20, ERC-721, and ERC-1155 use cases

## Week 4: AMM Mechanics and Analysis
100 Points 4-5 hours Hard

Implement AMM calculations, analyze price impact, and simulate liquidity pool dynamics.

Learning Objectives

  • Implement constant product AMM mathematics
  • Calculate price impact for various trade sizes
  • Simulate LP position changes over time

Tasks

Task Points Description
AMM Implementation 25 Implement x*y=k swap function with fee calculation in Python
Price Impact Calculator 25 Build a tool that calculates price impact given pool reserves and trade size
Historical Pool Analysis 25 Analyze a Uniswap V2 pool's reserve changes over 30 days
Arbitrage Detection 25 Identify price discrepancies between pools for the same token pair

## Week 5: Lending Protocol Analysis
100 Points 4-5 hours Hard

Analyze lending protocol mechanics, calculate health factors, and simulate liquidation scenarios.

Learning Objectives

  • Calculate collateralization ratios and health factors
  • Model interest rate curves
  • Simulate liquidation scenarios

Tasks

Task Points Description
Health Factor Calculator 25 Implement a health factor calculator for a multi-asset position
Interest Rate Modeling 25 Plot and compare interest rate models from Aave and Compound
Liquidation Simulation 25 Simulate when a position would be liquidated under various price scenarios
Flash Loan Analysis 25 Analyze 5 flash loan transactions and document their purposes

## Week 6: Stablecoin Stability Analysis
100 Points 3-4 hours Medium

Analyze stablecoin peg stability, compare mechanisms, and study historical depeg events.

Learning Objectives

  • Measure peg stability across stablecoins
  • Compare collateralization mechanisms
  • Analyze depeg events and recovery

Tasks

Task Points Description
Peg Stability Metrics 30 Calculate peg deviation statistics for 5 major stablecoins over 1 year
Collateralization Analysis 35 Compare backing assets and reserve ratios for USDC, DAI, and FRAX
Depeg Case Study 35 Analyze the UST collapse: timeline, mechanics, and lessons learned

## Week 7: Yield Farming Strategy Analysis
100 Points 4-5 hours Hard

Calculate impermanent loss, analyze yield opportunities, and build a yield aggregator simulator.

Learning Objectives

  • Quantify impermanent loss under various scenarios
  • Calculate real yields after accounting for all costs
  • Evaluate risk-adjusted returns

Tasks

Task Points Description
Impermanent Loss Calculator 25 Build an IL calculator and visualize IL vs price divergence
Yield Comparison 25 Compare yields across 5 similar pools after accounting for fees and IL
Historical LP Returns 25 Calculate actual returns for an LP position over 90 days including all factors
Strategy Backtester 25 Backtest a simple yield farming strategy with rebalancing

## Week 8: DeFi Derivatives Analysis
100 Points 4-5 hours Hard

Analyze perpetual futures, calculate funding rates, and explore synthetic asset mechanics.

Learning Objectives

  • Understand perpetual swap mechanics and funding
  • Analyze synthetic asset collateralization
  • Compare DeFi vs CeFi derivatives

Tasks

Task Points Description
Funding Rate Analysis 25 Analyze funding rate patterns on dYdX or GMX over 30 days
Perpetual vs Spot 25 Compare perpetual prices with spot prices and explain divergences
Synthetic Asset Mechanics 25 Document how Synthetix synths maintain their peg
Derivatives Risk Assessment 25 Analyze the risk parameters for a derivatives protocol

## Week 9: Oracle Security Analysis
100 Points 3-4 hours Medium

Analyze oracle mechanisms, identify attack vectors, and implement TWAP calculations.

Learning Objectives

  • Understand different oracle mechanisms
  • Identify oracle manipulation risks
  • Implement price feed validation

Tasks

Task Points Description
Oracle Comparison 30 Compare Chainlink, Uniswap TWAP, and Band Protocol architectures
TWAP Implementation 35 Implement a TWAP calculator and test with historical data
Attack Analysis 35 Analyze 3 historical oracle manipulation attacks and propose mitigations

## Week 10: DAO Governance Analysis
100 Points 3-4 hours Medium

Analyze DAO voting patterns, evaluate governance token distributions, and assess governance risks.

Learning Objectives

  • Analyze on-chain governance participation
  • Evaluate voting power concentration
  • Identify governance attack vectors

Tasks

Task Points Description
Voting Analysis 30 Analyze voting patterns for 10 proposals from a major DAO
Power Concentration 35 Calculate voting power distribution and identify whales
Governance Attack Simulation 35 Model how much capital would be needed to pass a malicious proposal

## Week 11: DeFi Security Assessment
100 Points 4-5 hours Hard

Analyze historical exploits, identify vulnerabilities, and assess protocol risk.

Learning Objectives

  • Understand common smart contract vulnerabilities
  • Analyze historical DeFi hacks
  • Develop risk assessment frameworks

Tasks

Task Points Description
Exploit Analysis 25 Deep dive into 3 major DeFi hacks: attack vector, impact, and fixes
MEV Analysis 25 Identify and analyze MEV transactions in a set of blocks
Risk Scoring 25 Develop a risk scoring framework for DeFi protocols
Audit Review 25 Review an audit report and summarize key findings and recommendations

## Week 12: L2 and Cross-Chain Analysis
100 Points 3-4 hours Medium

Compare Layer 2 solutions, analyze cross-chain bridges, and assess scaling approaches.

Learning Objectives

  • Compare L2 scaling solutions
  • Analyze bridge security models
  • Evaluate multi-chain DeFi

Tasks

Task Points Description
L2 Comparison 35 Compare Arbitrum, Optimism, and zkSync: cost, speed, security tradeoffs
Bridge Analysis 35 Analyze bridge volumes and assess security models for 3 major bridges
Cross-Chain DeFi 30 Map the DeFi ecosystem across 5 chains and identify key protocol differences

Submission Guidelines

Format

  • Submit all code in a Jupyter notebook (.ipynb)
  • Include markdown cells explaining your approach
  • Ensure all cells run without errors
  • Include visualizations where appropriate

Naming Convention

L{XX}_Exercise_{LastName}_{FirstName}.ipynb

Grading Criteria

Criteria Weight
Correctness 40%
Code Quality 20%
Analysis & Insights 25%
Presentation 15%

Late Policy

  • Up to 24 hours late: 10% penalty
  • Up to 48 hours late: 25% penalty
  • Beyond 48 hours: Not accepted without prior arrangement

Need Help?

If you're stuck on an exercise, try these resources:


Back to top

© 2025 Prof. Dr. Joerg Osterrieder | FHGR - University of Applied Sciences of the Grisons