Entire 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
[![Stargazers][stars-shield]][stars-url] [![Forks][forks-shield]][forks-url]
[![Contributors][contributors-shield]][contributors-url]
[![Issues][issues-shield]][issues-url]
[![MIT License][license-shield]][license-url]
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:
YouTube Link
Table of Contents
All the sections on this repo are for several courses on the Solidity Developer Career path of Cyfrin Updraft.
Resources
- Blockchain Developer, Smart Contract, & Solidity Course - Powered By AI - Beginner to Expert Course | Foundry Edition 2024
- Table of Contents
- Testnet Faucets
- Resources For This Course
- Bonus NFTs
Welcome to the Course Repo!
-
Welcome to the course!
-
Best Practices
Course: Blockchain Basics Section 1
- What is a Blockchain? What does a blockchain do?
- The Purpose Of Smart Contracts
- Other Blockchain Benefits
- What have Smart Contracts done so far?
- Making Your First Transaction
- Gas I: Introduction to Gas
- How Do Blockchains Work?
- Signing Transactions
- Gas II
- Gas II Summary
- High-Level Blockchain Fundamentals
- L1s L2s and Rollups
- Rollup Stages
- Making your First Transaction on ZKsync
- Why ZKsync is our Recommended Chain
Solidity 101 Section 1: Simple Storage
- Introduction
- Setting Up Your First Contract
- Basic Solidity: Types
- Basic Solidity: Functions
- Basic Solidity: Arrays & Structs
- Basic Solidity: Compiler Errors and Warnings
- Memory, Storage, Calldata (Intro)
- Mappings
- Deploying your First Contract
- The EVM & A Recap of Section 2
Solidity 101 Section 2: Remix Storage Factory
- Introduction
- Basic Solidity: Importing Contracts into other Contracts
- Basic Solidity: Interacting with other Contracts
- Basic Solidity: Inheritance & Overrides
- Section 3 Recap
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
Solidity 101 Section 4: AI Prompting, Asking Questions, and Getting Help
- Intro
- 7 Tips for this Course
- Setting up GitHub
- Formatting a question
- SpeedRunEthereum
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 3: Html/Js Fund Me (Quick Fullstack / Front End Tutorial)
- Introduction
- Setup
- How metamask works with your browser
- Introduction to function selectors
- 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 1: Foundry ERC20s
- What is an ERC? What is an EIP?
- What is an ERC20?
- Manually Creating an ERC20 Token
- ERC20 Token - Openzeppelin
- Deploy Script
- AI Tests
- Section 10 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 4: 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 5: Foundry Upgrades
- Introduction
- Upgradable Smart Contracts Overview
- Types of Upgrades
- Delegatecall
- Small Proxy Example
- Universal Upgradable Smart Contract
- Testnet Demo
Advanced Foundry Section 6: Foundry Account Abstraction
Advanced Foundry Section 7: Foundry DAO / Governance
- Introduction
- What is a DAO?
- How to build a DAO
- Wrap up
- Bonus: Gas optimization tips
Advanced Foundry Section 8: Smart Contract Security & Auditing (For developers)
- Introduction
- What is a smart contract audit?
- Tools
- What does the process of manual review look like?
- Formal Verification
- Closing Thoughts
Congratulations
- Where do I go now?
Disclosures
Thank you
Recommended Tools
⚠️ 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
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:
- Buy ETH (On an exchange like Coinbase or Kraken)
- Send ETH -> one of your wallets like:
- Metamask
- Frame
- Rainbow
- Argent
- Coinbase Wallet
- 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
⭐️ Blockchain Basics Course
Blockchain Basics Section 1: What is a Blockchain? What does a blockchain do?
⌨️ What is a Blockchain?
The Purpose Of Smart Contracts
_⌨️ The Purpose Of Smart Contracts_
Other Blockchain Benefits
⌨️ Other Blockchain Benefits
- Decentralized
- Transparency & Flexibility
- Speed & Efficiency
- Security & Immutability
- Counterparty Risk Removal
- Trust Minimized Agreements
What have Smart Contracts done so far?
Making Your First Transaction
⌨️ Making Your First Transaction
Gas I: Introduction to Gas
⌨️ Gas I: Introduction to Gas
How Do Blockchains Work?
⌨️ How Do Blockchains Work?
Signing Transactions
⌨️ Signing Transactions
Gas II
⌨️ Gas II: Block Rewards & EIP 1559
Gas II Summary
High-Level Blockchain Fundamentals
⌨️ High-Level Blockchain Fundamentals
L1s L2s and Rollups
Rollup Stages
Making your First Transaction on ZKsync
Why ZKsync is our Recommended Chain
Blockchain Basics Section 1 NFTs
(back to top) ⬆️
Course: Solidity & Smart Contract Developmnet
⭐️ Learn Solidity & Smart Contract Development
💻 Code: https://github.com/cyfrin/remix-simple-storage-cu
Solidity 101 Section 1: Simple Storage
Introduction
_⭐️ Welcome to Remix - Simple Storage_
Setting Up Your First Contract
⌨️ Setting Up Your First Contract
Basic Solidity: Types
⌨️ Basic Solidity Types
Basic Solidity: Functions
⌨️ 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
push
array 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
⌨️ Basic Solidity 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
ZKsync L2 deploy
⌨️ Deploying to ZKsync
- ZKsync compiler edition: 0.8.24
The EVM & A Recap of the section
⌨️ The EVM & A Recap of Section 2
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
⌨️ Inheritance & Overrides
Section 2 Recap
⌨️ 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
⭐️ Section 3 | Fund Me
Setup
⌨️ Setup
Sending ETH through a function
⌨️ Sending ETH through a function
Reverts
⌨️ Reverts
Getting real world price data (Chainlink)
⌨️ Getting real world price data (Chainlink)
Quick recap I
⌨️ Quick recap I
Interfaces
⌨️ Interfaces
AI Help III
⌨️ AI Help III
Importing from NPM / GitHub
⌨️ Importing from NPM / GitHub
Getting Prices from Chainlink
⌨️ Getting Prices from Chainlink
More Solidity math
⌨️ More Solidity math
msg.sender
⌨️ msg.sender
Quick recap II
⌨️ Quick recap II
Library
⌨️ Library
SafeMath
⌨️ SafeMath
For Loop
⌨️ For Loop
- For Loop
/* */
is another way to make comments
Resetting an array
⌨️ (Resetting an array
Transfer, Send, and Call
⌨️ Transfer, Send, and Call
Constructor
⌨️ Constructor
Modifiers
⌨️ Modifiers
Testnet Demo
⌨️ Tesnet Demo
Immutable & Constant
⌨️ Immutable & Constant
Custom Errors
⌨️ Custom Errors
Receive & Fallback Functions
⌨️ Receive & Fallback Functions
Section 3 Recap
⌨️ 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!!
⭐️ Section 4 | AI Prompting
Intro
7 Tips for this Course
Setting up GitHub
⌨️ Setting up GitHub
Formatting a question
⌨️ Formatting a question
SpeedRunEthereum
⌨️ SpeedRunEthereum
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)
⌨️ (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.39.1/install.sh | bash
⚠️ Please use Gitpod as an absolute last resort
Gitpod
⌨️ 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 + K
or CTRL + K
clears the terminal
code .
to open VSCode in a new VSCode window
Foundry Install
⌨️ Foundry Install
VSCode Setup II
⌨️ VSCode Setup II
- CoPilot
- Copilot labs
- Hardhat Solidity Extension
- VSCodium
mkdir foundry-cu
cd foundry-cu
mkdir foundry-simple-storage-cu
Foundry Setup
⌨️ Foundry Setup
⌨️ Foundry Setup II (WSL)
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 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
⌨️ Private Key Rant I
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
⌨️ Private Key Rant II
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
⌨️ 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
⌨️ Cleaning up the project
Foundry ZKsync
Alchemy and the mempool
⌨️ Alchemy and the mempool
Summary
_⌨️ Summary _
Foundry Fundamentals Section 1 NFTs
(back to top) ⬆️
Foundry Fundamentals Section 2: Foundry Fund Me
⭐️ Foundry Fund Me
💻 Code: https://github.com/Cyfrin/foundry-fund-me-cu
Introduction
⌨️ Introduction
Setup
⌨️ Setup
Testing Introduction
⌨️ Testing Introduction
Setup Continued
⌨️ Setup Continued
Tests
⌨️ Tests
Debugging Tests I
⌨️ Debugging Tests I
Advanced Deploy Scripts I
⌨️ Advanced Deploy Scripts I
Forked Tests
⌨️ Forked Tests
- The test option
-m
regex is deprecated. Please use --match-test
or --mt
instead.
forge test -m testPriceFeedVersionIsAccurate -vvv
is deprecated. Please use
forge test --match-test testPriceFeedVersionIsAccurate -vvv
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
Refactoring III: Mocking
⌨️ Refactoring III: Mocking
Magic Numbers
⌨️ Magic Numbers
Refactoring III: Mocking (continued)
⌨️ Refactoring III: Mocking (continued)
More Cheatcodes
⌨️ More Cheatcodes
More Coverage
⌨️ More Coverage
Chisel
⌨️ Chisel
Gas: Cheaper Withdraw
⌨️ Gas: Cheaper Withdraw
- Gas Reporter
forge snapshot
vm.txGasPrice
gasLeft()
tx.getprice
Storage
⌨️ Storage
cast storage
Gas: Cheaper Withdraw (continued)
⌨️ Gas: Cheaper Withdraw (continued)
Interactions.s.sol
⌨️ Interactions.s.sol
Makefile
⌨️ Makefile
ZKsync Devops
⌨️ ZKsync Devops
Pushing to GitHub
⌨️ Pushing to GitHub
⌨️ (2:34:56) | Tweet Me (add your repo in)!
Section 2: Recap
⌨️ Section 2: Recap
Foundry Fundamentals Section 2 NFTs
(back to top) ⬆️
Foundry Fundamentals Section 3: Html/Js Fund Me (Quick Fullstack / Front End Tutorial)
⭐️ Section 3: HTML Fund Me
💻 Code: https://github.com/Cyfrin/html-fund-me-cu
Introduction
Setup
⌨️ Setup
How Metamask works with your browser
[⌨️ How Metamask works with your browser ]()
Introduction to function selectors
[⌨️ Introduction to function selectors ]()
Recap
[⌨️ 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
_⌨️ Introduction _
Raffle.sol Setup
⌨️ Raffle.sol Setup
Solidity Contract Layout
⌨️ Solidity Contract Layout
// Layout of Contract:
// 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
- Custom Errors in Solidity
Events
⌨️ Events
block.timestamp
⌨️ block.timestamp
Chainlink VRF
⌨️ Chainlink VRF
Sub-Section: Chainlink VRF
- Chainlink VRFv2 Docs
- Chainlink VRFv2 Walkthrough
- Chainlink Contracts
Implementing Chainlink VRF - Introduction
⌨️ Implementing Chainlink VRF - Introduction
forge install smartcontractkit/chainlink-brownie-contracts@0.6.1 --no-commit
Modulo
⌨️ Modulo
Enum
⌨️ Enum
Resetting an array
⌨️ Resetting an array
Note on building
⌨️ 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
Implementing Chainlink Keepers - checkUpkeep continued
Custom Error
⌨️ Custom Error
Mid-Section Recap
⌨️ Mid-Section Recap
Tests & Deploy Script Setup
⌨️ Tests & Deploy Script Setup
Deploy Script
⌨️ Script Setup
Mock Chainlink VRF Coordinator
⌨️ Mock Chainlink VRF Coordinator
Tests & Deploy Script Continued
⌨️ Tests & Deploy Script Continued
Lots of Tests
⌨️ Lots of Tests
Headers
⌨️ Headers
Adding more tests.
⌨️ Adding more tests
Testing Events in Foundry
⌨️ Testing Events in Foundry
vm.roll & vm.warp
⌨️ vm.roll & vm.warp
Create Subscription Script
⌨️ Create Subscription Script
Create Subscription from the UI
⌨️ Create Subscription from the UI
Fund Subscription Script
⌨️ Fund Subscription Script
Add Consumer Script
⌨️ Add Consumer Script
More Tests
⌨️ More Tests
forge coverage --report debug
Coverage Report
⌨️ Coverage Report
PerformUpkeep Tests
⌨️ PerformUpkeep Tests
Getting Event Data into Foundry Scripts
⌨️ Getting Event Data into Foundry Scripts
Intro to Fuzz tests
⌨️ Intro to Fuzz tests
One Big Test
⌨️ One Big Test
Passing the private key to vm.startBroadcast
⌨️ Passing the private key to vm.startBroadcast
Integrations Test
⌨️ Integrations Test
Testnet Demo - Optional
⌨️ Testnet Demo - Optional
Console.log Debugging
⌨️ Console.log Debugging
forge test --debug
⌨️ forge test --debug
Recap
⌨️ 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
⭐️ Section 1: ERC20s
💻 Code: https://github.com/Cyfrin/foundry-erc20-cu
What is an ERC? What is an EIP?
- What is an EIP?
- EIPs codebase
What is an ERC20?
⌨️ What is an ERC20?
Manually Creating an ERC20 Token
⌨️ Manually Creating an ERC20 Token
ERC20 Token - Openzeppelin
⌨️ ERC20 Token - Openzeppelin
Deploy Script
⌨️ Deploy Script
AI Tests
⌨️ AI Tests
Advanced Foundry Section 1 NFTs
(back to top) ⬆️
Advanced Foundry Section 2: Foundry NFTs | MoodNFT
⭐️ Section 2: NFTs
💻 Code: https://github.com/Cyfrin/foundry-nft-cu
Introduction
What is an NFT?
⌨️ What is an NFT?
- Video
- Optional: All on Chain SVG NFT
- EIP-721
Foundry Setup
⌨️ Foundry Setup
- TokenURI
- Pudgy Penguin Example
IPFS
⌨️ IPFS
Using IPFS
⌨️ Using IPFS
Basic NFT: Deploy Script
⌨️ Basic NFT: Deploy Script
Basic NFT: Tests
⌨️ Basic NFT: Tests
- Comparing strings in solidity
chisel
Basic NFT: Interactions
⌨️ Basic NFT: Interactions
Basic NFT: Testnet Demo
⌨️ Basic NFT: Testnet Demo
The issue with IPFS & HTTPS TokenURI NFTs
⌨️ The issue with IPFS & HTTPS TokenURI NFTs
What is an SVG?
⌨️ What is an SVG?
SVG NFT: Introduction
⌨️ SVG NFT: Introduction
SVG NFT: Encoding the NFT
⌨️ SVG NFT: Encoding the NFT
SVG NFT: Flipping the mood
⌨️ SVG NFT: Flipping the mood
SVG NFT: Deploy Script
⌨️ SVG NFT: Deploy Script
SVG NFT: Debugging practice & some notes
⌨️ SVG NFT: Debugging practice & some notes
SVG NFT: Anvil Demo
⌨️ SVG NFT: Anvil Demo
NFTS: Filecoin & Arweave
⌨️ 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
Introduction
⭐️ Section 3: DeFi Stablecoins
What is DeFi?
Code Walkthrough
⌨️ Code Walkthrough
What is a stablecoin (But actually)
⌨️ What is a stablecoin (But actually)
DecentralizedStableCoin.sol
⌨️ DecentralizedStableCoin.sol
DSCEngine.sol Setup
⌨️ DSCEngine.sol Setup
Deposit Collateral
⌨️ Deposit Collateral
Mint DSC
Getting the value of our collateral
⌨️ Getting the value of our collateral
Health Factor
⌨️ Health Factor
Minting the DSC
⌨️ Minting the DSC
Testing while developing
Deploy Script
⌨️ Deploy Script
Tests
⌨️ Tests
depositCollateralAndMintDsc
⌨️ depositCollateralAndMintDsc
redeemCollateral
⌨️ redeemCollateral
Liquidate
Setup
⌨️ Setup
Refactoring
⌨️ Refactoring
Leveling up your testing skillz
⌨️ Leveling up your testing skillz
Challenge: Get DSCEngine.sol test coverage above 85%
Fuzz (Invariant) Testing
⌨️ Fuzz (Invariant) Testing
Open-based Fuzz tests
⌨️ Open-based Fuzz tests
Handler-based Fuzz tests
revert_on_fail = true
_⌨️ revert_on_fail = true _
Create the collateral redeemal handler
⌨️ Create the collateral redeemal handler
DeFi Handler Deposit Collateral
⌨️ DeFi Handler Deposit Collateral
Minting DSC
⌨️ Minting DSC
Debugging Fuzz Tests
⌨️ Debugging Fuzz Tests
Challenge: Find out why mintDsc
is never being called on our Handler.sol
Price Feed Handling
⌨️ Price Feed Handling
OracleLib
⌨️ OracleLib
Note on audit preparedness
⌨️ Note on audit preparedness
Recap
⌨️ Recap
Lens Protocol
⌨️ Lens Protocol
More DeFi Learnings:
Advanced Foundry Section 3 NFTs
(back to top) ⬆️
Advanced Foundry Section 4: Foundry Merkle Airdrop and Signatures
💻 Code: https://github.com/Cyfrin/foundry-merkle-airdrop-cu
Introduction to Merkle Airdrops and Code Walkthrough
⌨️ Introduction
Project Setup
⌨️ Project Setup
Merkle Proofs
⌨️ Merkle Proofs
Base Airdrop Contract
⌨️ Base Airdrop Contract
- Second preimage attack articles [1, 2]
Already Claimed Check
⌨️ Already Claimed Check
Merkle Tree Scripts
⌨️ Merkle Tree Scripts
Writing the Tests
⌨️ Writing the Tests
Deployment Script
⌨️ Deployment Script
Adding Signature Verification
⌨️ Adding Signature Verification
Signature Standards
⌨️ Signature Standards
ECDSA Signatures
⌨️ ECDSA Signatures
Transaction Types Introduction
⌨️ Transaction Types Introduction
Transaction Types
⌨️ Transaction Types
Blob Transactions
⌨️ 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 4 NFTs (TBD)
Advanced Foundry Section 5: 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
- Proxy Gotchas
- Function Collisions
- Storage Collisions
- Metamorphic Upgrades
- Transparent
- UUPS
- Diamond
Delegatecall
⌨️ Delegatecall
Small Proxy Example
⌨️ Small Proxy Example
Universal Upgradable Smart Contract
Setup
⌨️ UUPS Setup
Deploy
⌨️ Deploy
UpgradeBox
⌨️ Upgradebox
Test/Demo
⌨️ (5:53:48) | Test/Demo
Testnet Demo
⌨️ Testnet Demo
Advanced Foundry Section 5 NFTs
(back to top) ⬆️
Advanced Foundry Section 6: 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
⌨️ Code Overview
Ethereum Setup
⌨️ Etheren Account Abstraction
PackedUserOperation
⌨️ PackedUserOperation
Validate UserOp
⌨️ Validate UserOp
EntryPoint Contract
⌨️ EntryPoint Contract
Execute Function Ethereum
⌨️ Execute
Deployment Script for an Ethereum Account
⌨️ Deploy Script
Tests Owner can Execute
⌨️ Tests Owner can Execute
Unsigned PackedUserOperation Test
⌨️ Get Unsigened PackedUserOperation
Signed UserOp Test
⌨️ Signed PackedUserOperation
Using unlocked accounts for local development
⌨️ Local Dev Unlocked
Test Validation of User Ops
⌨️ Test Validate UserOps
Test Entry Point
⌨️ Test Entry Point
Advanced Debugging
⌨️ Advanced Debugging
Mid-session Recap
⌨️ Mid Session Recap
Live Demo on Arbitrum
⌨️ Live Demo
ZKsync Native Account Abstraction
⌨️ ZKsync Setup
IAccount
⌨️ IAccount
System Contracts
⌨️ System Contracts
Type 113 LifeCycle
⌨️ TxType 113 Lifecycle
Mid-ZKsync Recap
⌨️ ZKsync Accounts Recap
System Contract Call ZKsync Simulations
⌨️ ZKsync Transaction Simulations
Validate Transaction ZKsync
⌨️ ValidateTransaction
Execute Function ZKsync
⌨️ executeTransaction
Pay For Transaction ZKsync
⌨️ payForTransaction
Execute Transaction From Outside
⌨️ executeTransactionFromOutside
ZKsync Tests
⌨️ ZKsync Tests
Building a Transaction Struct
⌨️ Transaction Struct
Via Ir
⌨️ --via-ir
Validate Transaction Test
⌨️ Validate Transaction Test
Clean Up ZKsync
⌨️ Clean up
Testnet ZKsync Demo
⌨️ Testnet Demo
Rcap & End
⌨️ Recap End
Advanced Foundry Section 6 NFTs (TBD)
Advanced Foundry Section 7: 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?
How to build a DAO
DAOs toolings - Introduction to Aragon
⌨️ DAOs tooling - Special Guest from Aragon
Project Setup
⌨️ Build your own DAO Setup
Governance Token
⌨️ Governance Tokens
Governor
⌨️ Creating the Governor Contract
Tests
⌨️ Testing the Governor Contract
Wrap up
⌨️ Section Recap
Bonus: Gas optimization tips
Advanced Foundry Section 7 NFTs
(back to top) ⬆️
Advanced Foundry Section 8: 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]
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
⌨️ Intro to 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?
⌨️ Manual Review with Tincho
Formal Verification
⌨️ Formal Verification
Closing Thoughts
⌨️ Wrap. Up
Advanced Foundry Section 8 NFTs
(back to top) ⬆️
Congratulations
🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊 Completed all The Course! 🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊
Where do I go now?
Learning More
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) ⬆️