A13: Price-Tracking Worksheet
DeFi Builder: Deploy Your Own DEX
1. Contract Addresses
Record the addresses of your deployed contracts:
2. Initial Liquidity
Record the amounts you added as initial liquidity:
| Field | Value |
|---|---|
| Amount of Token A added | |
| Amount of Token B added | |
| Initial Reserve A (from DEX) | |
| Initial Reserve B (from DEX) | |
| Initial k = Reserve A x Reserve B |
3. Swap Results
Fill in each row after executing the corresponding swap. Use the post-previous-swap reserves for each new calculation.
| Swap | Direction | Amount In | Amount Out | Reserve A (after) |
Reserve B (after) |
k = R_A x R_B (after) |
Effective Price |
Price Impact |
|---|---|---|---|---|---|---|---|---|
| Initial | - | - | - | 1.0000 | - | |||
| Swap 1 (small) |
A → B | |||||||
| Swap 2 (medium) |
A → B | |||||||
| Swap 3 (large) |
A → B | |||||||
| Swap 4 (reverse) |
B → A |
Effective Price: Amount Out / Amount In (for A→B swaps, this is "B per A")
Price Impact: (1.0 - Effective Price) x 100% for A→B swaps (how much worse than the initial 1:1 rate)
k verification: Multiply Reserve A x Reserve B. It should be approximately the same as your initial k.
4. Analysis Questions
Q1: Why does a larger swap give a worse effective price? Explain using your data. (1.5 pts)
Q2: Does x x y = k hold exactly after each swap? If not, why? (1 pt)
Q3: What happened when you swapped in the reverse direction (B → A)? Why was the rate different from 1:1? (1.5 pts)
5. Summary Observations
In 2-3 sentences, describe the most important thing you learned from this experiment:
6. Bonus Extensions (Optional, +10 pts)
If you attempted a bonus challenge, describe what you did below.
Bonus A: Slippage Protection (+5 pts)
Did you add a _minOut parameter to the swap function?
Bonus B: Simple Escrow (+5 pts)
Did you deploy and demonstrate the Escrow contract?
© Joerg Osterrieder 2025-2026. All rights reserved.