📅 DAY 4 (Oct 27 - Monday): REAL CODE ANALYSIS (5-6 hours)
Morning Session (2-3 hours)
WATCH: Patrick Collins Solidity Course (First 4 Hours at 2x Speed)
- Link: https://www.youtube.com/watch?v=umepbfKp5rI
- Time: 2 hours (watching at 2x speed, but PAUSE when confused)
- Focus Sections:
- Introduction & Setup (watch at 2x, you don’t need local setup yet)
- Blockchain Basics (skim, you know this from Days 1-2)
- Remix IDE walkthrough (IMPORTANT - pause and follow along)
- First Smart Contract (PAUSE - actually code along)
- Storage Factory (PAUSE - code along)
- Fund Me project intro (understand the concept)
What to Focus On:
- How to use Remix (browser-based Solidity IDE)
- Deploying contracts to JavaScript VM (local test environment)
- Calling functions and seeing results
- Reading transaction details
- Understanding constructor functions
- Contract-to-contract interactions
Pro Tip: Don’t try to memorize syntax. Focus on CONCEPTS. Syntax you can always Google.
Afternoon Session (2.5-3 hours)
DO: Read 5 Real Contracts on Etherscan
This is where it gets REAL. You’ll read actual production code handling millions of dollars.
Contract #1: Simple ERC-20 Token
- Link: https://etherscan.io/address/0x6b175474e89094c44da98b954eedeac495271d0f#code
- Token: DAI Stablecoin (scroll to “Contract” tab, click “Code”)
- Time: 30 minutes
- What to Look For:
- totalSupply variable
- balanceOf mapping (address → amount)
- transfer() function
- approve() and transferFrom() pattern
- Events (Transfer, Approval)
Don’t understand everything! Focus on:
- Can you identify state variables?
- Can you find the transfer logic?
- What checks does it do before transferring?
Contract #2: Uniswap V2 Pair
- Link: https://etherscan.io/address/0xb4e16d0168e52d35cacd2c6185b44281ec28c9dc#code
- What: This is a liquidity pool (USDC/ETH)
- Time: 30 minutes
- What to Look For:
- reserve0, reserve1 (how much of each token is in the pool)
- swap() function (complex math, don’t worry about details)
- mint() and burn() (adding/removing liquidity)
- The famous x * y = k formula in comments
Key Insight: Notice how much MATH is in here. DeFi = financial engineering in code.
Contract #3: Simple Multisig Wallet
- Link: https://etherscan.io/address/0x10E6593CDda8c58a1d0f14C5164B376352a55f2F#code
- What: Gnosis Safe (requires multiple signatures to send funds)
- Time: 30 minutes
- What to Look For:
- Array of owners
- Threshold (how many signatures needed)
- Approval tracking
- Execute transaction logic
Key Insight: See how smart contracts can encode governance rules.
Contract #4: NFT Contract (ERC-721)
- Link: https://etherscan.io/address/0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d#code
- Token: Bored Ape Yacht Club
- Time: 30 minutes
- What to Look For:
- tokenURI() function (links to metadata/image)
- ownerOf() mapping
- Minting logic
- How it inherits from OpenZeppelin contracts
Key Insight: NFTs are just tokens with unique IDs. The “image” isn’t stored on-chain - just a link to it.
Contract #5: Simple Oracle (Chainlink Example)
- Link: https://etherscan.io/address/0x5f4ec3df9cbd43714fe2740f5e3616155c5b8419#code
- What: Chainlink ETH/USD Price Feed
- Time: 30 minutes
- What to Look For:
- latestRoundData() function
- How price is stored
- Aggregation logic (multiple oracles report, median is taken)
Key Insight: This is how smart contracts get external data. They can’t fetch it themselves - they PULL from oracle contracts.
Evening Synthesis (30-45 min)
WRITE THIS OUT: Smart Contract Mental Model
Answer these in your own words:
- What IS a smart contract? (Hint: It’s not just “code on blockchain” - what makes it SMART?)
- Give 3 examples of what smart contracts CAN do well (Financial logic, transparent rules, composability…)
- Give 3 examples of what smart contracts CANNOT do (Access APIs, generate randomness, execute on schedule…)
- What is the biggest risk of smart contracts? (Hint: Immutability + bugs = ?)
- Why do people say “code is law” in Web3?