Cyfrin/foundry-full-course-cu
Cyfrin/foundry-full-course-cu has 5,885 GitHub stars and 1,437 forks. GitHot measured 0 stars in 24 hours and +5 in 7 days. Last checked 2026-11-11 01:18 UTC. Last push 2026-07-08.
Welcome to the repository for the Blockchain Developer, Smart Contract, & Solidity Cyfrin Updraft - Career Path | Powered By AI || Beginner to Expert Path || Foundry Edition 2024 |
Measured star growth
- in 24h
- 0
- in 7 days
- +5
- in 15 days
- Update delayed
- in 1 month
- Update delayed
Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.
README.md
OriginalEntire course and video content updated June 15, 2024
Blockchain Developer, Smart Contract, & Solidity Career Path - Powered By AI - Beginner to Expert Course
| Foundry Edition 2024 |
Learn smart contract development, and level up your career
Welcome to the repository for the Blockchain Developer, Smart Contract, & Solidity Cyfrin Updraft - Career Path
| Powered By AI |
| Beginner to Expert Path |
| Foundry Edition 2024 |
This repository houses course resources and discussions for the course.
Please refer to this for an in-depth explanation of the content:
- Website - Join Cyfrin Updraft and enjoy 50+ hours of smart contract development courses
- Twitter - Stay updated with the latest course releases
- LinkedIn - Add Updraft to your learning experiences
- Discord - Join a community of 3000+ developers and auditors
- Newsletter - Weekly security research tips and resources to level up your career
- Codehawks - Smart contracts auditing competitions to help secure web3
Cyfrin Updraft Courses:
- Cyfrin Updraft - Blockchain basics
- Cyfrin Updraft - Solidity basics
- Cyfrin Updraft - Foundry Fundamentals
- Cyfrin Updraft - Advanced Foundry
Table of Contents
All the sections on this repo are for several courses on the Solidity Developer Career path of Cyfrin Updraft.
Resources
Solidity 101 Section 3: Remix Fund Me
- Introduction
- Setup
- Sending ETH through a function
- Reverts
- Getting real world price data (Chainlink)
- Quick recap I
- Interfaces
- AI Help III
- Importing from NPM / GitHub
- Getting Prices from Chainlink
- More solidity math
- msg.sender
- Quick recap II
- Library
- SafeMath
- For Loop
- Resetting an array
- Transfer, Send, and Call
- Constructor
- Modifiers
- Testnet Demo
- Advanced Solidity
- Section 4 Recap
Foundry Fundamentals Section 1: Foundry Simple Storage
- Introduction
- Installation & Setup (MacOS & Linux)
- Local Development Introduction
- Foundry Install
- VSCode Setup II
- Foundry Setup
- Formatting Solidity in VSCode
- Compiling in Foundry
- Deploying to a local chain I (Anvil or Ganache)
- Adding another network to metamask
- Deploying to a local chain II (Forge Create)
- Private Key Rant I
- Deploying to a local chain III (Forge Script)
- What is a transaction (But actually)
- Private Key Rant II
- Can you Encrypt a Private Key -> a keystore in foundry yet??
- ThirdWeb Deploy
- Private Key Rant Summary:
- Cast Send
- Deploying to a testnet or a mainnet
- Verifying a contract the manual way
- Cleaning up the project
- Alchemy and the mempool
- Summary
Foundry Fundamentals Section 2: Foundry Fund Me
- Introduction
- Setup
- Testing Introduction
- Setup Continued
- Tests
- Debugging Tests I
- Advanced Deploy Scripts I
- Forked Tests
- Refactoring I: Testing Deploy Scripts
- Refactoring II: Helper Config
- Refactoring III: Mocking (continued)
- Magic Numbers
- Break time!
- More Cheatcodes
- More Coverage
- Chisel
- Gas: Cheaper Withdraw
- Storage
- Gas: Cheaper Withdraw (continued)
- Interactions.s.sol
- Makefile
- Pushing to GitHub
- Recap
Foundry Fundamentals Section 4: Foundry Smart Contract Lottery
- Introduction
- Raffle.sol Setup
- Solidity Contract Layout
- Custom Errors
- Events
- block.timestamp
- Chainlink VRF
- Implementing Chainlink VRF - Introduction
- Modulo
- Enum
- Resetting an array
- Note on building
- CEI
- Introduction to Chainlink Automation
- Implementing Chainlink Keepers - checkUpkeep
- Implementing Chainlink Keepers - checkUpkeep continued
- Implementing Chainlink Keepers - performUpkeep
- Mid-Section Recap
- Tests & Deploy Script Setup
- Tests & Deploy Script Continued
- Lots of Tests
- Create Subscription Script
- Create Subscription from the UI
- Fund Subscription Script
- Add Consumer Script
- More Tests
- PerformUpkeep Tests
- Getting Event Data into Foundry Scripts
- Intro to Fuzz tests
- One Big Test
- Passing the private key to vm.startBroadcast
- Integrations Test
- Testnet Demo - Makefile setup
- Testnet Demo - The Demo
- Console.log Debugging
- forge test --debug
- Recap
Advanced Foundry Section 2: Foundry NFTs | MoodNFT
- Introduction
- What is an NFT?
- Foundry Setup
- IPFS
- Using IPFS
- Basic NFT: Deploy Script
- Basic NFT: Tests
- Basic NFT: Interactions
- Basic NFT: Testnet Demo
- The issue with IPFS & HTTPS TokenURI NFTs
- What is an SVG?
- SVG NFT: Introduction
- SVG NFT: Encoding the NFT
- SVG NFT: Flipping the mood
- SVG NFT: Deploy Script
- SVG NFT: Debugging practice & some notes
- SVG NFT: Anvil Demo
- Advanced: EVM Opcodes, Encoding, and Calling
- Verifying Metamask Transactions
- Filecoin & Arweave
- Section 11 Recap
Advanced Foundry Section 3: Foundry DeFi | Stablecoin (The PINNACLE PROJECT!! GET HERE!)
- What is DeFi?
- Code Walkthrough
- What is a stablecoin (But actually)
- DecentralizedStableCoin.sol
- DSCEngine.sol Setup
- Deposit Collateral
- Mint DSC
- Testing while developing
- depositCollateralAndMintDsc
- redeemCollateral
- Liquidate
- Leveling up your testing skillz
- Fuzz (Invariant) Testing
- Open-based Fuzz tests
- Handler-based Fuzz tests
- Price Feed Handling
- OracleLib
- Note on audit preparedness
- Recap
- Lens Protocol
Advanced Foundry Section 5: Foundry Merkle Airdrop and Signatures
- Introduction to Merkle Airdrops and Code Walkthrough
- Project Setup
- Merkle Proofs
- Base Airdrop Contract
- Already Claimed Check
- Merkle Tree Scripts
- Writing the Tests
- Deployment Script
- Adding Signature Verification
- Signature Standards
- ECDSA Signatures
- Transaction Types Introduction
- Transaction Types
- Blob Transactions
- Type 113 Transactions
- Implementing Signatures
- Modifying the Tests
- Test on ZKsync (optional)
- Create Claiming Script
- Creating a Signature
- Splitting a Signature
- Executing the Anvil Script
- Deploy and Claim on ZKsync Local Node
- Deploy and Claim on ZKsync Sepolia
- Summary
Advanced Foundry Section 7: Foundry Account Abstraction
- What is account abstraction?
- Code Overview
- Ethereum Setup
- PackedUserOperation
- Validate UserOp
- EntryPoint Contract
- Execute Function Ethereum
- Deployment Script for an Ethereum Account
- Tests Owner can Execute
- Unsigned PackedUserOperation Test
- Signed UserOp Test
- Using unlocked accounts for local development
- Test Validation of User Ops
- Test Entry Point
- Advanced Debugging
- Mid-session Recap
- Live Demo on Arbitrum
- ZKsync Native Account Abstraction
- IAccount
- System Contracts
- Type 113 LifeCycle
- Mid-ZKsync Recap
- System Contract Call ZKsync Simulations
- Validate Transaction ZKsync
- Execute Function ZKsync
- Pay For Transaction ZKsync
- Execute Transaction From Outside
- ZKsync Tests
- Building a Transaction Struct
- Via Ir
- Validate Transaction Test
- Clean Up ZKsync
- Testnet ZKsync Demo
- Recap & End
Recommended Tools
- Recommended Testnet: Sepolia
- Recommended DevOps: foundry-devops
Testnet Faucets
If you receive a flag pop-up requiring you to have 0.001 ETH on mainnet, you may be able to wait 10 to 20 minutes and try again to avoid adding the 0.001 ETH on the mainnet.
- Tenderly Virtual Signup: https://dashboard.tenderly.co/accept-coupon?promo_code=CYFRIN1
- Main (Sepolia): Sepolia GCP Faucet
- Alchemy Faucet (Sepolia): https://sepoliafaucet.com/
- Infura Faucet (Sepolia): https://docs.metamask.io/developer-tools/faucet
- Chainlink Faucet (Sepolia): https://faucets.chain.link/sepolia
- No need for 0.001 ETH on mainnet
- ZKsync Faucets (ZKsync Sepolia): https://docs.zksync.io/zksync-era/ecosystem/network-faucets
- ZKsync Bridge: https://portal.zksync.io/bridge/
⚠️ All code associated with this course is for demo purposes only. They have not been audited and should not be considered production ready. Please use at your own risk.
Chainlist
Resources For This Course
- AI Frens
- claude.ai
- ChatGPT
- Phind
- Like ChatGPT, but it searches the web
- Gemini
- Other AI extensions
- Github Discussions
- Ask questions and chat about the course here!
- Stack Exchange Ethereum
- Great place for asking technical questions about Ethereum
- Peeranha
- Decentralized Stack Exchange!
- Cookbook
- A smart contract registry and co-pilot
**Note: Given the frequency of exploits through Cursor extensions, we cannot recommend the IDE, at this time.
Bonus NFTs
These are 100% optional to do.
After every section, in this GitHub repo will be a link to a contract on Sepolia or ZKsync. They contain a challenge for you to solve, and in return, you'll be given an AWESOME NFT.
Important Notes for ZKsync
IF YOU DECIDE TO MINT THE REAL NFT:
- We didn't audit the NFT, so if you want to make sure you'll be safe, interact with the contract using a burner wallet (a wallet with very little money that you don't use for anything else)
- In fact... Get good at interacting with wallets from a burner wallet
- Read my Tweet thread on basic wallet safety
- It might be a good idea to wait till later in the course when we teach you about verifying metamask transactions.
- Feel free to mint NFTs on sepolia without worrying about the above
Bridging to ZKsync
- The process for bridging looks like the following:
- Send ETH -> one of your wallets like:
- Use the ZKsync Bridge
Welcome to the Course Repo
Welcome to Ultimate Smart Contract Development Course!
Best Practices
- Follow the repository: While going through the course be 100% certain to follow along with the github repository. If you run into an issue check the chronological-updates in the repo.
- Be Active in the community: Ask questions and engage with other developers going through the course in the discussions tab, be sure to go and say hello or gm! This space is different from the other industries, you don't have to be secretive; communicate, network and learn with others :)
- Learn at your own pace: It doesn't matter if it takes you a day, a week, a month or even a year. Progress >>> Perfection
- Take Breaks: You will exhaust your mind and recall less if you go all out and watch the entire course in one sitting. Suggested Strategy every 25 minutes take a 5 min break, and every 2 hours take a longer 30 min break
- Refer to Documentation: Things are constantly being updated, so whenever Patrick opens up some documentation, open it on your end and maybe even have the code sample next to you.
- Use ChatGPT and/or the course chat
(back to top) ⬆️
Course: Blockchain Basics
The Blockchain Basics has it's own GitHub repository (aka, codebase). You can find it here: https://github.com/Cyfrin/blockchain-basics-cu?tab=readme-ov-file
Solidity 101 Section 1: Simple Storage
💻 Code: https://github.com/cyfrin/remix-simple-storage-cu
Introduction
⭐️ Welcome to Remix - Simple Storage
- Remix
- Remix now has the ability to link your workspace with your github repository. The icon is below the search icon on the left side bar (the second icon). This process involves authenticating against an EMPTY repository and setting up the git remote. After completing this process, you can push all your work directly from remix to your repo.
- Solidity Documentation
Setting Up Your First Contract
⌨️ Setting Up Your First Contract
- Versioning
- Take notes in your code!
- What is a software license
- SPDX License
- Compiling
- Contract Declaration
Basic Solidity: Types
- Types & Declaring Variables
uint256,int256,bool,string,address,bytes32- Solidity Types
- Bits and Bytes
- Default Initializations
- Comments
Basic Solidity: Functions
- Functions
- Deploying a Contract
- Smart Contracts have addresses just like our wallets
- Calling a public state-changing Function
- Visibility
- Gas III | An example
- Scope
- View & Pure Functions
Basic Solidity: Arrays & Structs
⌨️ Basic Solidity Arrays & Structs
- Structs
- Intro to Storage
- Arrays
- Dynamic & Fixed Sized
pusharray function
Basic Solidity: Compiler Errors and Warnings
⌨️ Basic Solidity Errors & Warnings
- Yellow: Warnings are Ok
- Red: Errors are not Ok
Memory, Storage, Calldata (Intro)
⌨️ Basic Solidity Memory, Storage, & Calldata (Intro)
- 6 Places you can store and access data
- calldata
- memory
- storage
- code
- logs
- stack
Mappings
Deploying your First Contract
⌨️ Deploying your First Contract
- A testnet or mainnet
- Connecting Metamask
- Find faucets here!
- See the faucets at the top of this readme!
- Interacting with Deployed Contracts
🐸🐦 Tweet Me (add your contract in)!
The EVM & A Recap of the section
⌨️ The EVM & A Recap of Section 2
- The EVM
Solidity 101 Section 1 NFTs
(back to top) ⬆️
Solidity 101 Section 2 | Remix Storage Factory
💻 Code: https://github.com/cyfrin/remix-storage-factory-cu
Introduction
⭐️ Section 2 | Storage Factory
Basic Solidity: Importing Contracts into other Contracts
⌨️ Importing Contracts into other Contracts
Basic Solidity: Interacting with other Contracts
⌨️ Interacting with other contracts
- To interact, you always need: ABI + Address
- ABI
Basic Solidity: Inheritance & Overrides
Section 2 Recap
Solidity 101 Section 2 NFTs
(back to top) ⬆️
Solidity 101 Section 3: Remix Fund Me
💻 Code: https://github.com/Cyfrin/remix-fund-me-cu
Introduction
Setup
Sending ETH through a function
⌨️ Sending ETH through a function
- Ethereum Unit Converter
- Fields in a Transaction
- More on v,r,s
- payable
- msg.value & Other global keywords
- require
- revert
Reverts
Getting real world price data (Chainlink)
⌨️ Getting real world price data (Chainlink)
- What is a blockchain oracle?
- What is the oracle problem?
- Chainlink
- Chainlink Price Feeds (Data Feeds)
- Chainlink VRF
- Chainlink Keepers (Automation)
- Chainlink API Calls (AnyAPI)
- Importing Tokens into your Metamask
- Request and Receive Chainlink Model
Quick recap I
Interfaces
- For reference - ChainLink Interface's Repo
AI Help III
Importing from NPM / GitHub
⌨️ Importing from NPM / GitHub
Getting Prices from Chainlink
⌨️ Getting Prices from Chainlink
More Solidity math
- Multiply before you divide
- tuple
- Floating Point Numbers in Solidity
- Type Casting
- Gas Estimation Failed
- Someone should make an article explaining this error
msg.sender
- msg.sender
- named mappings
Quick recap II
Library
SafeMath
For Loop
- For Loop
/* */is another way to make comments
Resetting an array
Transfer, Send, and Call
Constructor
Modifiers
Testnet Demo
Immutable & Constant
- Immutable
- Constant
- Current ETH Gas Prices
- Don't stress about gas optimizations! (yet)
- Naming Conventions
Custom Errors
Receive & Fallback Functions
⌨️ Receive & Fallback Functions
Section 3 Recap
Solidity 101 Section 3 NFTs
(back to top) ⬆️
Solidity 101 Section 4: AI Prompting, Asking Questions, and Getting Help
DO NOT SKIP THIS!!
Intro
7 Tips for this Course
Setting up GitHub
Formatting a question
- It's a good idea to ask your AI buddy to format your questions in markdown *
SpeedRunEthereum
- Special Guest Austin
Solidity 101 Section 4 NFTs
(back to top) ⬆️
Course: Foundry Fundamentals
Foundry Fundamentals Section 1: Foundry Simple Storage
💻 Code: https://github.com/Cyfrin/foundry-simple-storage-cu
Introduction
⭐️ Foundry Simple Storage Introduction
Installation & Setup (MacOS & Linux)
⌨️ Installation & Setup (MacOS & Linux)
Windows Setup (WSL)
- Special Guest Vasiliy
- WSL
- When working in WSL, use Linux commands instead of Windows commands
- TroubleShooting
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash
⚠️ Please use Gitpod as an absolute last resort
Gitpod
- Gitpod
- If using this, NEVER share a private key with real money on Gitpod
- Ideally you figure out the MacOS, Linux, or Windows install though
Local Development Introduction
CMD + KorCTRL + Kclears the terminalcode .to open VSCode in a new VSCode window
Foundry Install
VSCode Setup II
- CoPilot
- Hardhat Solidity Extension
- VSCodium
mkdir foundry-cucd foundry-cumkdir foundry-simple-storage-cu
Foundry Setup
⌨️ Foundry Setup ⌨️ Foundry Setup II (WSL)
- FreeCodeCamp Bash
Formatting Solidity in VSCode
⌨️ Formatting Solidity in VSCode
- Format your solidity code within your
settings.json
"[solidity]": {
"editor.defaultFormatter": "NomicFoundation.hardhat-solidity"
},
"[javascript]":{
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
Compiling in Foundry
Compiling to ZKsync in foundry-zksync
Deploying to a local chain I (Anvil or Ganache)
⌨️ Deploying to a local chain I (Anvil or Ganache)
Adding another network to Metamask
⌨️ Adding another network to Metamask
Deploying to a local chain II (Forge Create)
⌨️ Deploying to a local chain II (Forge Create)
- 2 Ways to deploy:
forge create
forge script
Private Key Rant I
history -c
Deploying to a local chain III (Forge Script)
⌨️ Deploying to a local chain III (Forge Script)
What is a transaction (But actually)
⌨️ What is a transaction (But actually)
cast --to-base 0x01 dec
Private Key Rant II
cast sendsource .env
Can you Encrypt a Private Key -> a keystore in foundry yet??
Can you Encrypt a Private Key -> a keystore in foundry yet??
- A: No Yes, try the new feature by
cast wallet import your-account-name --interactive
Enter private key:
Enter password:
`your-account-name` keystore was saved successfully. Address: address-corresponding-to-private-key
forge script <script> --rpc-url <rpc_url> --account <account_name> --sender <address> --broadcast
Never use a Env File
Private Key Rant Summary:
Private Key Rant Summary
Summary:
When you look to deploy
with real money, you should use either:
1. A password encrypted keystore
2. Something like thirdweb deploy
The idea is you never want to have
your private key or password
ANYWHERE written in plain text
(Aka, you always want it encrypted)
Deploying to a testnet or a mainnet
⌨️ Deploying to a testnet Sepolia
Verifying a contract the manual way
⌨️ Verifying a contract the manual way
Cleaning up the project
forge fmtREADME.md
Foundry ZKsync
- ⌨️ Foundry ZKsync
- ⌨️ Compiling Foundry ZKsync
- ⌨️ ZKsync Local Node
- ⌨️ ZKsync Local Deploy
- ⌨️ Tx Types
- ⌨️ Why L2
Alchemy and the mempool
Summary
Foundry Fundamentals Section 1 NFTs
(back to top) ⬆️
Foundry Fundamentals Section 2: Foundry Fund Me
💻 Code: https://github.com/Cyfrin/foundry-fund-me-cu
Introduction
Setup
Testing Introduction
Setup Continued
- Chainlink Brownie Contracts Github Repo
forge install smartcontractkit/[email protected] - Dependencies
- remappings
- Chainlink Brownie Contracts
Tests
Debugging Tests I
Advanced Deploy Scripts I
Forked Tests
- The test option
-mregex is deprecated. Please use--match-testor--mtinstead.
forge test -m testPriceFeedVersionIsAccurate -vvv
is deprecated. Please use
forge test --match-test testPriceFeedVersionIsAccurate -vvv
- 4 types of testing:
1. Unit: Testing a single function
2. Integration: Testing multiple functions
3. Forked: Testing on a forked network
4. Staging: Testing on a live network (testnet or mainnet)
Refactoring I: Testing Deploy Scripts
⌨️ Refactoring I: Testing Deploy Scripts
Refactoring II: Helper Config
⌨️ Refactoring II: Helper Config
- block.chainid
- Chain ID List
- 11155111 is ETH Sepolia
- 1 is ETH Mainnet
Refactoring III: Mocking
- Mocking
- Chainlink Github
- Multiple Versions of Solidity
Magic Numbers
Refactoring III: Mocking (continued)
⌨️ Refactoring III: Mocking (continued)
More Cheatcodes
More Coverage
- State tree testing
- Arrange, Act, Assert
- hoax
- uint160 -> address
- vm.startPrank
Chisel
Gas: Cheaper Withdraw
- Gas Reporter
forge snapshotvm.txGasPricegasLeft()tx.getprice
Storage
- ** Advanced **
- Storage Layout
- Purpose of the memory keyword
cast storage
- Opcodes
- Opcodes by Gas
- Opcodes by Gas
- Append
s_to storage variables - Append
i_to immutable variables - Caps lock and underscore constant variables
- Chainlink Solidity Style Guide
Gas: Cheaper Withdraw (continued)
⌨️ Gas: Cheaper Withdraw (continued)
Interactions.s.sol
Makefile
ZKsync Devops
Pushing to GitHub
- Add these to your
.gitignore.envlib/broadcast/
- Git Docs
- GitHub docs
- Github Quickstart
- What is Git?
- The quickstart that we follow in the video
- Learn about git and GitHub
🐸🐦 Tweet Me (add your repo in)!
⌨️ (2:34:56) | Tweet Me (add your repo in)!
Section 2: Recap
Foundry Fundamentals Section 2 NFTs
(back to top) ⬆️
Foundry Fundamentals Section 3: Html/Js Fund Me (Quick Fullstack / Front End Tutorial)
💻 Code: https://github.com/Cyfrin/html-fund-me-cu
Introduction
Setup
How Metamask works with your browser
⌨️ How Metamask works with your browser
Introduction to function selectors
⌨️ Introduction to function selectors
Recap
Foundry Fundamentals Section 3 NFTs
- IPFS hash for website - ipfs://QmdCBj5B188qzXgG1LUCD6aKe6RJHqbSgu7YfPyncDirzh
(back to top) ⬆️
Foundry Fundamentals Section 4: Foundry Smart Contract Lottery
⭐️ Section 4: Smart Contract Lottery
💻 Code: https://github.com/Cyfrin/foundry-smart-contract-lottery-cu
Introduction
Raffle.sol Setup
- Raffle.sol Setup
Solidity Contract Layout
// Layout of Contract:
// license
// version
// imports
// errors
// interfaces, libraries, contracts
// Type declarations
// State variables
// Events
// Modifiers
// Functions
// Layout of Functions:
// constructor
// receive function (if exists)
// fallback function (if exists)
// external
// public
// internal
// private
// internal & private view & pure functions
// external & public view & pure functions
Custom Errors
- Custom Errors in Solidity
Events
- Introduction to Events
- Events & Logging Video
- Events & Logging in Hardhat
block.timestamp
Chainlink VRF
- Introduction to Chainlink VRF
- Special Guest Richard
Sub-Section: Chainlink VRF
- Chainlink VRFv2 Docs
- Chainlink VRFv2 Walkthrough
- Chainlink Contracts
Implementing Chainlink VRF - Introduction
⌨️ Implementing Chainlink VRF - Introduction
- Implementing Chainlink VRF
forge install smartcontractkit/[email protected]
Modulo
- Modulo
Enum
Resetting an array
Note on building
CEI (Checks, Effects, Interactions)
⌨️ CEI (Checks, Effects, Interactions)
Introduction to Chainlink Automation
⌨️ Introduction to Chainlink Automation
- Chainlink Automation Docs
- Chainlink Automation Walkthrough
Implementing Chainlink Keepers - checkUpkeep
⌨️ Implementing Chainlink Keepers - checkUpkeep
Enums
- Enum
Implementing Chainlink Keepers - checkUpkeep continued
- block.timestamp
Custom Error
Mid-Section Recap
Tests & Deploy Script Setup
⌨️ Tests & Deploy Script Setup
Deploy Script
Mock Chainlink VRF Coordinator
⌨️ Mock Chainlink VRF Coordinator
Tests & Deploy Script Continued
⌨️ Tests & Deploy Script Continued
Lots of Tests
Headers
Adding more tests.
Testing Events in Foundry
vm.roll & vm.warp
Create Subscription Script
Create Subscription from the UI
⌨️ Create Subscription from the UI
Fund Subscription Script
Add Consumer Script
More Tests
forge coverage --report debug
Coverage Report
PerformUpkeep Tests
- Expecting Custom Errors
Getting Event Data into Foundry Scripts
⌨️ Getting Event Data into Foundry Scripts
vm.recordLogs
Intro to Fuzz tests
One Big Test
Passing the private key to vm.startBroadcast
⌨️ Passing the private key to vm.startBroadcast
Integrations Test
Testnet Demo - Optional
Console.log Debugging
forge test --debug
Recap
Recommended LINK amounts for Sepolia Staging Test:
- Chainlink VRF: 2 LINK
- Chainlink Keepers: 8 LINK
Foundry Fundamentals Section 4 NFTs
(back to top) ⬆️
🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊
Completed Foundry Fundamentals
🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊
Course: Advanced Foundry
Advanced Foundry Section 1: Foundry ERC20s
💻 Code: https://github.com/Cyfrin/foundry-erc20-cu
Learn how to build your own ERC20 like DAI, USDC, or WETH!
What is an ERC? What is an EIP?
- What is an EIP?
- EIPs codebase
What is an ERC20?
- Video (using brownie/python)
- EIP-20
- ERC-677
- EIP-777
Manually Creating an ERC20 Token
⌨️ Manually Creating an ERC20 Token
.github
ERC20 Token - Openzeppelin
Deploy Script
AI Tests
Advanced Foundry Section 1 NFTs
(back to top) ⬆️
Advanced Foundry Section 2: Foundry NFTs | MoodNFT
💻 Code: https://github.com/Cyfrin/foundry-nft-cu
Introduction
What is an NFT?
- Video
- Optional: All on Chain SVG NFT
- EIP-721
Foundry Setup
- TokenURI
- Pudgy Penguin Example
IPFS
Using IPFS
Basic NFT: Deploy Script
Basic NFT: Tests
- Comparing strings in solidity
chisel
Basic NFT: Interactions
Basic NFT: Testnet Demo
The issue with IPFS & HTTPS TokenURI NFTs
⌨️ The issue with IPFS & HTTPS TokenURI NFTs
What is an SVG?
SVG NFT: Introduction
SVG NFT: Encoding the NFT
SVG NFT: Flipping the mood
SVG NFT: Deploy Script
SVG NFT: Debugging practice & some notes
⌨️ SVG NFT: Debugging practice & some notes
SVG NFT: Anvil Demo
NFTS: Filecoin & Arweave
Advanced: EVM Opcodes, Encoding, and Calling
⌨️ Advanced: EVM Opcodes, Encoding, and Calling
abi.encode & abi.encodePacked
- abi.encode
- abi.encodePacked Thanks to Alex Roan for his help on this session!
- Example Contract Creation Transaction What REALLY is the ABI?
- EVM Opcodes
- More EVM Opcodes
- Solidity Cheatsheet
- abi.encode vs abi.encodePacked
Introduction to Encoding Function Calls Directly
⌨️ Introduction to Encoding Function Calls Directly
Introduction to Encoding Function Calls Recap
⌨️ Introduction to Encoding Function Calls Recap
Encoding Function Calls Directly
⌨️ Encoding Function Calls Directly
- Function Selector
- Function Signature
Verifying Metamask Transactions
⌨️ Verifying Metamask Transactions
- Check the address
- Check the function selector
- Decode the calldata
Section 2 Recap
⌨️ (10:36:31) | Section 2 Recap
Advanced Foundry Section 2 NFTs
(back to top) ⬆️
Advanced Foundry Section 3: Foundry DeFi | Stablecoin (The PINNACLE PROJECT!! GET HERE!)
💻 Code: https://github.com/Cyfrin/foundry-defi-stablecoin-cu
This is one of the top projects you can build in the blockchain space. A decentralized stablecoin! We will teach you about the differences between DAI, USDC, RAI, and other stablecoins, and allow you to build your own.
Introduction
⭐️ Section 3: DeFi Stablecoins
What is DeFi?
- What is DeFi?
- DefiLlama
- Bankless
- MEV
- Aave
- My Previous Aave Video on Shorting Assets
- DAI
- Uniswap
- Maximal Extractable Value (MEV)
Code Walkthrough
What is a stablecoin (But actually)
⌨️ What is a stablecoin (But actually)
DecentralizedStableCoin.sol
⌨️ DecentralizedStableCoin.sol
DSCEngine.sol Setup
Deposit Collateral
- Other DeFi Examples:
Mint DSC
Getting the value of our collateral
⌨️ Getting the value of our collateral
Health Factor
Minting the DSC
Testing while developing
Deploy Script
Tests
depositCollateralAndMintDsc
⌨️ depositCollateralAndMintDsc
redeemCollateral
Liquidate
Setup
Refactoring
Leveling up your testing skillz
⌨️ Leveling up your testing skillz
Challenge: Get DSCEngine.sol test coverage above 85%
Fuzz (Invariant) Testing
Open-based Fuzz tests
Handler-based Fuzz tests
revert_on_fail = true
Create the collateral redeemal handler
⌨️ Create the collateral redeemal handler
DeFi Handler Deposit Collateral
⌨️ DeFi Handler Deposit Collateral
Minting DSC
Debugging Fuzz Tests
Challenge: Find out why mintDsc is never being called on our Handler.sol
Price Feed Handling
OracleLib
Note on audit preparedness
Recap
Lens Protocol
- Special Guest Nader
- Lens Protocol
More DeFi Learnings:
Advanced Foundry Section 3 NFTs
(back to top) ⬆️
Advanced Foundry Section 4: Foundry Cross Chain Rebase Token
💻 Code: https://github.com/Cyfrin/foundry-cross-chain-rebase-token-cu
Introduction and Code Walkthrough
⌨️ Introduction and Code Walkthrough
What is a rebase token
Rebase token code structure
⌨️ Rebase token code structure
Writing the rebase token contract
⌨️ Writing the rebase token contract
mintInterest and burn functions
⌨️ mintInterest and burn functions
Finish rebase token contract
⌨️ Finish rebase token contract
Access control
Vault and NATSPEC
Rebase token tests part 1
Rebase token tests part 2
Vulnerabilities and cross-chain intro
⌨️ Vulnerabilities and cross-chain intro
Bridging
CCIP
The CCT standard
Circle CCTP
Pool contract
Finish pool contract
📦 Dependency Update Notice
🔄 Update: This project previously used the smartcontractkit/ccip repository.
🆕 You should now use the updated, more actively maintained smartcontractkit/chainlink repository instead.
🔁 Remappings
To ensure clean and maintainable import paths, use the following remappings in your foundry.toml or a separate remappings.txt file:
remappings = [
'@openzeppelin/=lib/openzeppelin-contracts/',
'@chainlink/=lib/chainlink/',
]
Chainlink local and fork testing
⌨️ Chainlink local and fork testing
Deploy token test
CCIP setup test
Configure pool test
Bridge function test
First cross chain test
Vault deployer script
Token and pool deployer script
⌨️ Token and pool deployer script
Pool config script
Bridging script
Build scripts
Run scripts on testnet
Cross chain message received
⌨️ Cross chain message received
Outro
Advanced Foundry Section 5: Foundry Merkle Airdrop and Signatures
💻 Code: https://github.com/Cyfrin/foundry-merkle-airdrop-cu
Introduction to Merkle Airdrops and Code Walkthrough
Project Setup
Merkle Proofs
Base Airdrop Contract
Already Claimed Check
Merkle Tree Scripts
Writing the Tests
Deployment Script
Adding Signature Verification
⌨️ Adding Signature Verification
Signature Standards
ECDSA Signatures
Transaction Types Introduction
⌨️ Transaction Types Introduction
Transaction Types
Blob Transactions
- Type 113 Transactions
- Implementing Signatures
- Modifying the Tests
- Test on ZKsync (optional)
- Create Claiming Script
- Creating a Signature
- Splitting a Signature
- Executing the Anvil Script
- Deploy and Claim on ZKsync Local Node
- Deploy and Claim on ZKsync Sepolia
- Summary
Advanced Foundry Section 5 NFTs (TBD)
Advanced Foundry Section 6: Foundry Upgrades
💻 Code: https://github.com/Cyfrin/foundry-upgrades-cu
Introduction
⭐️ Section 5: Upgradable Contracts & Proxies
Upgradable Smart Contracts Overview
Types of Upgrades
- Parameter
- Social Migrate
- Proxy
Delegatecall
Small Proxy Example
Universal Upgradable Smart Contract
Setup
- UUPS vs Transparent
- Abstract Contracts
Deploy
UpgradeBox
Test/Demo
Testnet Demo
Advanced Foundry Section 6 NFTs
(back to top) ⬆️
Advanced Foundry Section 7: Foundry Account Abstraction
💻 Code: https://github.com/Cyfrin/minimal-account-abstraction
What is account abstraction?
⌨️ Account Abstraction Introduction
- What is native account abstraction?
- How does ZKsync do account abstraction?
- What is EIP-4337?
- What are ZKsync system contracts?
Code Overview
Ethereum Setup
⌨️ Ethereum Account Abstraction
PackedUserOperation
Validate UserOp
EntryPoint Contract
Execute Function Ethereum
Deployment Script for an Ethereum Account
Tests Owner can Execute
Unsigned PackedUserOperation Test
⌨️ Get Unsigned PackedUserOperation
Signed UserOp Test
Using unlocked accounts for local development
Test Validation of User Ops
Test Entry Point
Advanced Debugging
Mid-session Recap
Live Demo on Arbitrum
ZKsync Native Account Abstraction
IAccount
System Contracts
Type 113 LifeCycle
Mid-ZKsync Recap
System Contract Call ZKsync Simulations
⌨️ ZKsync Transaction Simulations
Validate Transaction ZKsync
Execute Function ZKsync
Pay For Transaction ZKsync
Execute Transaction From Outside
⌨️ executeTransactionFromOutside
ZKsync Tests
Building a Transaction Struct
Via Ir
Validate Transaction Test
Clean Up ZKsync
Testnet ZKsync Demo
Recap & End
Advanced Foundry Section 7 NFTs (TBD)
Advanced Foundry Section 8: Foundry DAO / Governance
Plutocracy is bad! Don't default to ERC20 token voting!!
💻 Code: https://github.com/Cyfrin/foundry-dao-cu
Introduction
⭐️ Section 14 | DAOs & Governance
What is a DAO?
- What is a DAO?
- Special Guest Juliette
How to build a DAO
DAOs toolings - Introduction to Aragon
⌨️ DAOs tooling - Special Guest from Aragon
Project Setup
- How to build a DAO
- That's Patrick
- PY Code
- Python Video
Governance Token
Governor
⌨️ Creating the Governor Contract
Tests
⌨️ Testing the Governor Contract
Wrap up
Bonus: Gas optimization tips
- Special Guest Harrison
Advanced Foundry Section 8 NFTs
(back to top) ⬆️
Advanced Foundry Section 9: Smart Contract Security & Auditing (For developers)
Developers 100% should know all about this! Don't leave the course without at least watching this section!
[!IMPORTANT] PLEASE AT LEAST WATCH THE DOCKER CONTAINER SECTION OF THIS CURRICULUM!! You can find a shorter video of the docker curriculum here. We highly recommend you head over to the end-to-end Cyfrin Updraft Security and Auditing Curriculum.
🖥️ Code: https://github.com/PatrickAlphaC/denver-security
Introduction
⭐️ Section 6 | Security & Auditing
What is a smart contract audit?
⌨️ What is a smart contract audit?
Tools
⌨️ What tools do security professionals use?
Manual Review
Static Analysis
Dynamic Analysis
Formal Verification
Symbolic Execution
Fuzzing
Formal Verification (& Symbolic Execution)
Other security stuff
What does the process of manual review look like?
Formal Verification
Isolated Development Environments
Closing Thoughts
- Common Attacks
- Best Practices
- Attacks
- Damn Vulnerable Defi
- Ethernaut
- Top Smart Contract Auditors
- Some Smart Contract Auditors:
Advanced Foundry Section 9 NFTs
(back to top) ⬆️
Congratulations
🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊 Completed all The Course! 🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊
Where do I go now?
Learning More
- Top 10 learning resources
- Patrick Collins
- CryptoZombies
- Alchemy University
- Speed Run Ethereum
- Ethereum.org
Community
Hackathons
Be sure to check out project grant programs!
And make today an amazing day!
(back to top) ⬆️
Disclosures
Transparency is important! So we want to disclose any potential conflicts that might have affected my judgement so you can pick tools that are right for you. Patrick is co-founder of Alpha Chain, a blockchain infrastructure company. Alpha Chain runs Chainlink, Ethereum, Binance, Polygon, Harmony, Solana, Moonbeam, and Moonriver blockchain services. Alpha Chain often works with Alchemy and receives discounted services. Patrick is the co-founder of Cyfrin, and they do smart contract security & auditing services. Patrick is also the co-founder of Chain Accel, who is an advisor on the Peeranha project.
Because of all this, I have added alternatives to each section where we suggest a tool.
(back to top) ⬆️
Sponsors
A huge thank you to our sponsors. These are the groups and technologies:
(back to top) ⬆️
Thank you
Thanks to everyone who is taking, participating in, and working on this course. It's been a passion project and a data dump of everything I've learnt in the web3 space to get you up to speed quickly. Also, a big thank you to Cyfrin & Chain Accel for encouraging this course to come to light, and many, many, many people from the community.
And thanks to the Cyfrin team for making this possible!
License
Cyfrin Updraft content is open-sourced licensed as GPLv3.
(back to top) ⬆️
Explore related projects
codecrafters-io/build-your-own-x
Master programming by recreating your favorite technologies from scratch.
561,945 starspublic-apis/public-apis
A collective list of free APIs
498,332 starsmorluto/rea
Reverse engineer anything with agents, from app behavior down to native binaries.
453,432 starsopenclaw/openclaw
The AI that really does things. Any OS. Any Platform. The lobster way. 🦞
394,376 stars
