Coder Social home page Coder Social logo

foundry-full-course-f23's Introduction

Blockchain Developer, Smart Contract, & Solidity Career Path - Powered By AI - Beginner to Expert Course
| Foundry Edition 2023 |

Learn smart contract development, and level up your career

Stargazers Forks Contributors Issues MIT License



Welcome to the repository for the Blockchain Developer, Smart Contract, & Solidity Cyfrin Updraft - Career Path
| Powered By AI |
| Beginner to Expert Path |
| Foundry Edition 2023 |

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

Lessons 0 - 6 Lessons 7 - 11 Lessons 12 - 15
Blockchain Developer, Smart Contract, & Solidity Course - Powered By AI 1 Blockchain Developer, Smart Contract, & Solidity Course - Powered By AI 2 Blockchain Developer, Smart Contract, & Solidity Course - Powered By AI 3

YouTube Playlist

YouTube Playlist of each section

Table of Contents

All the lessons for on this repo are for several courses on the Solidity Developer Career path of Cyfrin Updraft.

Resources
  1. Blockchain Developer, Smart Contract, & Solidity Course - Powered By AI - Beginner to Expert Course | Foundry Edition 2023
  2. Table of Contents
  3. Testnet Faucets
  4. Resources For This Course
  5. Bonus NFTs
Lesson 0: Welcome to the Course!
  1. Welcome to the course!
  2. Best Practices
Lesson 1: Blockchain Basics
  1. What is a Blockchain? What does a blockchain do?
  2. The Purpose Of Smart Contracts
  3. Other Blockchain Benefits
  4. What have Smart Contracts done so far?
  5. Making Your First Transaction
  6. Gas I: Introduction to Gas
  7. How Do Blockchains Work?
  8. Signing Transactions
  9. Gas II
  10. Gas II Summary
  11. High-Level Blockchain Fundamentals
Lesson 2: Welcome to Remix - Remix Simple Storage
  1. Introduction
  2. Setting Up Your First Contract
  3. Basic Solidity: Types
  4. Basic Solidity: Functions
  5. Basic Solidity: Arrays & Structs
  6. Basic Solidity: Compiler Errors and Warnings
  7. Memory, Storage, Calldata (Intro)
  8. Mappings
  9. Deploying your First Contract
  10. The EVM & A Recap of Lesson 2
Lesson 3: Remix Storage Factory
  1. Introduction
  2. Basic Solidity: Importing Contracts into other Contracts
  3. Basic Solidity: Interacting with other Contracts
  4. Basic Solidity: Inheritance & Overrides
  5. Lesson 3 Recap
Lesson 4: Remix Fund Me
  1. Introduction
  2. Setup
  3. Sending ETH through a function
  4. Reverts
  5. Getting real world price data (Chainlink)
  6. Quick recap I
  7. Interfaces
  8. AI Help III
  9. Importing from NPM / GitHub
  10. Getting Prices from Chainlink
  11. More solidity math
  12. msg.sender
  13. Quick recap II
  14. Library
  15. SafeMath
  16. For Loop
  17. Resetting an array
  18. Transfer, Send, and Call
  19. Constructor
  20. Modifiers
  21. Testnet Demo
  22. Advanced Solidity
Lesson 5: AI Prompting, Asking Questions, and Getting Help
  1. Intro
  2. 7 Tips for this Course
  3. Setting up GitHub
  4. Formatting a question
  5. SpeedRunEthereum
Lesson 6: Foundry Simple Storage
  1. Introduction
  2. Installation & Setup (MacOS & Linux)
  3. Local Development Introduction
  4. Foundry Install
  5. VSCode Setup II
  6. Foundry Setup
  7. Formatting Solidity in VSCode
  8. Compiling in Foundry
  9. Deploying to a local chain I (Anvil or Ganache)
  10. Adding another network to metamask
  11. Deploying to a local chain II (Forge Create)
  12. Private Key Rant I
  13. Deploying to a local chain III (Forge Script)
  14. What is a transaction (But actually)
  15. Private Key Rant II
  16. Can you Encrypt a Private Key -> a keystore in foundry yet??
  17. ThirdWeb Deploy
  18. Private Key Rant Summary:
  19. Cast Send
  20. Deploying to a testnet or a mainnet
  21. Verifying a contract the manual way
  22. Cleaning up the project
  23. Alchemy
  24. Summary
Lesson 7: Foundry Fund Me
  1. Introduction
  2. Setup
  3. Testing Introduction
  4. Setup Continued
  5. Tests
  6. Debugging Tests I
  7. Advanced Deploy Scripts I
  8. Forked Tests
  9. Refactoring I: Testing Deploy Scripts
  10. Refactoring II: Helper Config
  11. Refactoring III: Mocking (continued)
  12. Magic Numbers
  13. Break time!
  14. More Cheatcodes
  15. More Coverage
  16. Chisel
  17. Gas: Cheaper Withdraw
  18. Storage
  19. Gas: Cheaper Withdraw (continued)
  20. Interactions.s.sol
  21. Makefile
  22. Pushing to GitHub
  23. ๐Ÿธ๐Ÿฆ Tweet Me (add your repo in)!
  24. Recap
Lesson 8: Html/Js Fund Me (Quick Fullstack / Front End Tutorial)
  1. Introduction
  2. Setup
  3. How metamask works with your browser
  4. Introduction to function selectors
  5. Recap
Lesson 9: Foundry Smart Contract Lottery
  1. Introduction
  2. Raffle.sol Setup
  3. Solidity Contract Layout
  4. Custom Errors
  5. Events
  6. block.timestamp
  7. Chainlink VRF
  8. Implementing Chainlink VRF - Introduction
  9. Implementing Chainlink VRF - The Request
  10. Implementing Chainlink VRF - The FulFill
  11. Chainlink VRF Recap
  12. Enum
  13. Resetting an array
  14. Note on building
  15. CEI
  16. Introduction to Chainlink Automation
  17. Implementing Chainlink Keepers - checkUpkeep
  18. Implementing Chainlink Keepers - checkUpkeep continued
  19. Implementing Chainlink Keepers - performUpkeep
  20. Mid-Lesson Recap
  21. Tests & Deploy Script Setup
  22. Tests & Deploy Script Continued
  23. Lots of Tests
  24. Create Subscription Script
  25. Create Subscription from the UI
  26. Fund Subscription Script
  27. Add Consumer Script
  28. More Tests
  29. PerformUpkeep Tests
  30. Getting Event Data into Foundry Scripts
  31. Intro to Fuzz tests
  32. One Big Test
  33. Passing the private key to vm.startBroadcast
  34. Integrations Test
  35. Testnet Demo - Makefile setup
  36. Testnet Demo - The Demo
  37. Console.log Debugging
  38. forge test --debug
  39. Recap
Lesson 10: Foundry ERC20s
  1. What is an ERC? What is an EIP?
  2. What is an ERC20?
  3. Manually Creating an ERC20 Token
  4. ERC20 Token - Openzeppelin
  5. Deploy Script
  6. AI Tests
  7. Lesson 10 Recap
Lesson 11: Foundry NFTs | MoodNFT
  1. Introduction
  2. What is an NFT?
  3. Foundry Setup
  4. IPFS
  5. Using IPFS
  6. Basic NFT: Deploy Script
  7. Basic NFT: Tests
  8. Basic NFT: Interactions
  9. Basic NFT: Testnet Demo
  10. The issue with IPFS & HTTPS TokenURI NFTs
  11. What is an SVG?
  12. SVG NFT: Introduction
  13. SVG NFT: Encoding the NFT
  14. SVG NFT: Flipping the mood
  15. SVG NFT: Deploy Script
  16. SVG NFT: Debugging practice & some notes
  17. SVG NFT: Anvil Demo
  18. Advanced: EVM Opcodes, Encoding, and Calling
  19. Verifying Metamask Transactions
  20. Filecoin & Arweave
  21. Lesson 11 Recap
Lesson 12: Foundry DeFi | Stablecoin (The PINNACLE PROJECT!! GET HERE!)
  1. What is DeFi?
  2. Code Walkthrough
  3. What is a stablecoin (But actually)
  4. DecentralizedStableCoin.sol
  5. DSCEngine.sol Setup
  6. Deposit Collateral
  7. Mint DSC
  8. Testing while developing
  9. depositCollateralAndMintDsc
  10. redeemCollateral
  11. Liquidate
  12. Leveling up your testing skillz
  13. Challenge: Code coverage above 80% for DSCEngine.sol
  14. Fuzz (Invariant) Testing
  15. Open-based Fuzz tests
  16. Handler-based Fuzz tests
  17. Price Feed Handling
  18. OracleLib
  19. Note on audit preparedness
  20. Recap
  21. Lens Protocol
Lesson 13: Foundry Upgrades
  1. Upgradable Smart Contracts Overview
  2. Types of Upgrades
  3. Delegatecall
  4. Small Proxy Example
  5. Universal Upgradable Smart Contract
  6. Testnet Demo
Lesson 14: Foundry DAO / Governance
  1. Introduction
  2. What is a DAO?
  3. How to build a DAO
  4. Wrap up
  5. Bonus: Gas optimization tips
Lesson 15: Smart Contract Security & Auditing (For developers)
  1. Introduction
  2. What is a smart contract audit?
  3. Tools
  4. What does the process of manual review look like?
  5. Formal Verification
  6. Closing Thoughts
Congratulations
  1. 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.

Resources For This Course

  • AI Frens
  • 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!

Bonus NFTs

These are 100% optional to do.

After every lesson, you'll see two QR codes. Those codes will send you to an NFT deployed to Sepolia or Arbitrum. They contain a challenge for you to solve, and in return, you'll be given an AWESOME NFT.

Important Notes for Arbitrum

IF YOU DECIDE TO MINT THE REAL NFT:

  1. 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)
    1. In fact... Get good at interacting with wallets from a burner wallet
  2. Read my Tweet thread on basic wallet safety
  3. It might be a good idea to wait till later in the course when we teach you about verifying metamask transactions.
  4. Feel free to mint NFTs on sepolia without worrying about the above

Bridging to Arbitrum

  1. We didn't show you how to bring ETH -> Arbitrum, but the process would be:
    1. Buy ETH (On an exchange like Coinbase or Kraken)
  2. Send ETH -> one of your wallets like:
    1. Metamask
    2. Frame
    3. Rainbow
    4. Argent
    5. Coinbase Wallet
  3. Use the Arbitrum Bridge

Video 1


Solidity, Blockchain Developer, Smart Contract, & Solidity Course - Powered By AI - Beginner to Expert Course


Lesson 0: Welcome to the Course!

Welcome to the Course!

โญ๏ธ (0:00:00) | Lesson 0: Welcome!

Best Practices

  • Follow the repository: While going through the course be 100% certain to follow along with the github repository. If you run into in 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 your end and maybe even have the code sample next to you.
  • Use ChatGPT and/or the course chat

(back to top) โฌ†๏ธ

Lesson 1: Blockchain Basics

โญ๏ธ (0:13:54) | Lesson 1: Blockchain Basics

What is a Blockchain? What does a blockchain do?

The Purpose Of Smart Contracts

โŒจ๏ธ (0:24:26) | The Purpose Of Smart Contracts

Other Blockchain Benefits

โŒจ๏ธ (0:39:53) | Other Blockchain Benefits

  • Decentralized
  • Transparency & Flexibility
  • Speed & Efficiency
  • Security & Immutability
  • Counterparty Risk Removal
  • Trust Minimized Agreements

What have Smart Contracts done so far?

โŒจ๏ธ (0:44:20) | What have Smart Contracts done so far?

Making Your First Transaction

โŒจ๏ธ (0:46:55) | Making Your First Transaction

Gas I: Introduction to Gas

โŒจ๏ธ (1:06:16) | Gas I: Introduction to Gas

How Do Blockchains Work?

โŒจ๏ธ (1:15:39) | How Do Blockchains Work?

Signing Transactions

โŒจ๏ธ (1:33:09) | Signing Transactions

Gas II

โŒจ๏ธ (1:42:15) | Gas II

Gas II Summary

โŒจ๏ธ (1:48:40) | Gas II Summary

High-Level Blockchain Fundamentals

โŒจ๏ธ (1:51:36) | High-Level Blockchain Fundamentals

(back to top) โฌ†๏ธ

Lesson 2: Welcome to Remix - Remix Simple Storage

๐Ÿ’ป Code: https://github.com/cyfrin/remix-simple-storage-f23

Introduction

โญ๏ธ (2:10:42) | Lesson 2: Welcome to Remix - Simple Storage

Setting Up Your First Contract

โŒจ๏ธ (2:16:40) | Setting Up Your First Contract

Basic Solidity: Types

โŒจ๏ธ (2:24:09) | Basic Solidity Types

Basic Solidity: Functions

โŒจ๏ธ (2:31:57) | 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

โŒจ๏ธ (2:51:29) | Basic Solidity Arrays & Structs

  • Structs
  • Intro to Storage
  • Arrays
  • Dynamic & Fixed Sized
  • push array function

Basic Solidity: Compiler Errors and Warnings

โŒจ๏ธ (3:03:31) | Basic Solidity Errors & Warnings

  • Yellow: Warnings are Ok
  • Red: Errors are not Ok

Memory, Storage, Calldata (Intro)

โŒจ๏ธ (3:08:13) | Basic Solidity Memory, Storage, & Calldata (Intro)

  • 6 Places you can store and access data
    • calldata
    • memory
    • storage
    • code
    • logs
    • stack

Mappings

โŒจ๏ธ (3:14:37) | Basic Solidity Mappings

Deploying your First Contract

โŒจ๏ธ (3:17:46) | Deploying your First Contract

  • A testnet or mainnet
  • Connecting Metamask
  • Find a faucet here
  • See the faucets at the top of this readme!
  • Interacting with Deployed Contracts

The EVM & A Recap of Lesson 2

โŒจ๏ธ (3:27:07) | The EVM & A Recap of Lesson 2

  • The EVM

(back to top) โฌ†๏ธ

Lesson 3: Remix Storage Factory

๐Ÿ’ป Code: https://github.com/cyfrin/remix-storage-factory-f23

Introduction

โญ๏ธ (3:29:58) | Lesson 3 | Storage Factory

Basic Solidity: Importing Contracts into other Contracts

โŒจ๏ธ (3:41:30) | Importing Contracts into other Contracts

Basic Solidity: Interacting with other Contracts

โŒจ๏ธ (3:52:49) | Interacting with other contracts

  • To interact, you always need: ABI + Address
  • ABI

Basic Solidity: Inheritance & Overrides

โŒจ๏ธ (4:00:44) | Inheritance & Overrides

Lesson 3 Recap

โŒจ๏ธ (4:07:37) | Lesson 3 Recap

(back to top) โฌ†๏ธ

Lesson 4: Remix Fund Me

๐Ÿ’ป Code: https://github.com/Cyfrin/remix-fund-me-f23

Introduction

โญ๏ธ (4:09:08) | Lesson 4 | Fund Me

Setup

โŒจ๏ธ (4:12:20) | Setup

Sending ETH through a function

โŒจ๏ธ (4:14:00) | Sending ETH through a function

Reverts

โŒจ๏ธ (4:18:15) | Reverts

Getting real world price data (Chainlink)

โŒจ๏ธ (4:22:06) | Getting real world price data (Chainlink)

Quick recap I

โŒจ๏ธ (4:36:22) | Quick recap I

Interfaces

โŒจ๏ธ (4:37:08) | Interfaces

AI Help III

โŒจ๏ธ (4:43:31) | AI Help III

Importing from NPM / GitHub

โŒจ๏ธ (4:46:03) | Importing from NPM / GitHub

Getting Prices from Chainlink

โŒจ๏ธ (4:48:07) | Getting Prices from Chainlink

More Solidity math

โŒจ๏ธ (4:52:00) | More Solidity math

msg.sender

โŒจ๏ธ (4:58:07) | msg.sender

Quick recap II

โŒจ๏ธ (4:59:53) | Quick recap II

Library

โŒจ๏ธ (5:00:46) | Library

SafeMath

โŒจ๏ธ (5:05:45) | SafeMath

For Loop

โŒจ๏ธ (5:10:48) | For Loop

  • For Loop
  • /* */ is another way to make comments

Resetting an array

โŒจ๏ธ (5:15:32) | Resetting an array

Transfer, Send, and Call

โŒจ๏ธ (5:16:32) | Transfer, Send, and Call

Constructor

โŒจ๏ธ (5:24:23) | Constructor

Modifiers

โŒจ๏ธ (5:27:37) | Modifiers

Testnet Demo

โŒจ๏ธ (5:29:54) | Tesnet Demo

Advanced Solidity

โŒจ๏ธ (5:34:01) | Advanced Solidity

Immutable & Constant

โŒจ๏ธ (5:34:53) | Immutable & Constant

Custom Errors

โŒจ๏ธ (5:42:08) | Custom Errors

Receive & Fallback Functions

โŒจ๏ธ (5:44:56) | Receive & Fallback Functions

Lesson 4 Recap

โŒจ๏ธ (5:57:10) | Lesson 4 Recap

(back to top) โฌ†๏ธ

Lesson 5: AI Prompting, Asking Questions, and Getting Help

DO NOT SKIP THIS!!

โญ๏ธ (6:00:00) | Lesson 5 | AI Prompting

Intro

7 Tips for this Course

Setting up GitHub

โŒจ๏ธ (6:12:57) | Setting up GitHub

Formatting a question

โŒจ๏ธ (6:14:24) | Formatting a question

  • It's a good idea to ask your AI buddy to format your questions in markdown *

SpeedRunEthereum

โŒจ๏ธ (6:19:58) | SpeedRunEthereum

(back to top) โฌ†๏ธ

Lesson 6: Foundry Simple Storage

๐Ÿ’ป Code: https://github.com/Cyfrin/foundry-simple-storage-f23

Introduction

โญ๏ธ (6:23:59) | Lesson 6 | Foundry Simple Storage

Installation & Setup (MacOS & Linux)

โŒจ๏ธ (6:29:44) | Installation & Setup (MacOS & Linux)

Windows Setup (WSL)

โŒจ๏ธ (6:32:26) | 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

โŒจ๏ธ (6:40:19) | 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

โŒจ๏ธ (6:44:37) | Foundry Install

VSCode Setup II

โŒจ๏ธ (6:52:00) | VSCode Setup II

  • CoPilot
  • Copilot labs
  • Hardhat Solidity Extension
  • VSCodium
  • mkdir foundry-f23
  • cd foundry-f23
  • mkdir foundry-simple-storage-f23

Foundry Setup

โŒจ๏ธ (6:57:17) | Foundry Setup

  • FreeCodeCamp Bash

Formatting Solidity in VSCode

โŒจ๏ธ (7:04:19) | Formatting Solidity in VSCode

  • Format your solidity code with in your settings.json
    "[solidity]": {
        "editor.defaultFormatter": "NomicFoundation.hardhat-solidity"
    },
    "[javascript]":{
      "editor.defaultFormatter": "esbenp.prettier-vscode"
    }

Compiling in Foundry

โŒจ๏ธ (7:08:31) | Compiling in Foundry

Deploying to a local chain I (Anvil or Ganache)

โŒจ๏ธ (7:09:49) | Deploying to a local chain I (Anvil or Ganache)

Adding another network to Metamask

โŒจ๏ธ (7:17:44) | Adding another network to Metamask

Deploying to a local chain II (Forge Create)

โŒจ๏ธ (7:19:41) | Deploying to a local chain II (Forge Create)

  • 2 Ways to deploy:
      1. forge create
      1. forge script

Private Key Rant I

โŒจ๏ธ (7:23:45) | Private Key Rant I

  • history -c

Deploying to a local chain III (Forge Script)

โŒจ๏ธ (7:26:17) | Deploying to a local chain III (Forge Script)

What is a transaction (But actually)

โŒจ๏ธ (7:36:02) | What is a transaction (But actually)

cast --to-base 0x01 dec

Private Key Rant II

โŒจ๏ธ (7:41:41) | Private Key Rant II

  • cast send
  • source .env

Can you Encrypt a Private Key -> a keystore in foundry yet??

โŒจ๏ธ (7:45:00) | 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

ThirdWeb Deploy

โŒจ๏ธ (7:51:44) | ThirdWeb Deploy

Private Key Rant Summary:

โŒจ๏ธ (7:56:25) | 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)

Cast Send

โŒจ๏ธ (7:56:40) | Cast Send

Deploying to a testnet or a mainnet

โŒจ๏ธ (8:00:26) | Deploying to a testnet or a mainnet

Verifying a contract the manual way

โŒจ๏ธ (8:06:06) | Verifying a contract the manual way

Cleaning up the project

โŒจ๏ธ (8:07:43) | Cleaning up the project

  • forge fmt
  • README.md

Alchemy & the mempool

โŒจ๏ธ (8:10:28) | Alchemy & the mempool

Summary

โŒจ๏ธ (8:21:28) | Summary

(back to top) โฌ†๏ธ

๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ

Completed Video 1!!

๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ


Solidity, Blockchain Developer, Smart Contract, & Solidity Course - Powered By AI - Beginner to Expert Course


Lesson 7: Foundry Fund Me

โญ๏ธ (0:00:00) | Lesson 7: Foundry Fund Me

๐Ÿ’ป Code: https://github.com/Cyfrin/foundry-fund-me-f23

Introduction

โŒจ๏ธ (0:09) | Introduction

Setup

โŒจ๏ธ (2:51) | Setup

Testing Introduction

โŒจ๏ธ (4:40) | Testing Introduction

Setup Continued

โŒจ๏ธ (6:14) | Setup Continued

Tests

โŒจ๏ธ (11:54) | Tests

Debugging Tests I

โŒจ๏ธ (20:45) | Debugging Tests I

Advanced Deploy Scripts I

โŒจ๏ธ (23:16) | Advanced Deploy Scripts I

Forked Tests

โŒจ๏ธ (25:47) | Forked Tests

  • The test option -m regex is deprecated. Please use --match-test or --mt instead.
forge test -m testPriceFeedVersionIsAccurate -vvv

is depreciated. 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

โŒจ๏ธ (34:17) | Refactoring I: Testing Deploy Scripts

Refactoring II: Helper Config

โŒจ๏ธ (41:28) | Refactoring II: Helper Config

Refactoring III: Mocking

โŒจ๏ธ (54:32) | Refactoring III: Mocking

Magic Numbers

โŒจ๏ธ (58:40) | Magic Numbers

Refactoring III: Mocking (continued)

โŒจ๏ธ (1:00:45) | Refactoring III: Mocking (continued)

Break time!

โŒจ๏ธ (1:05:02) | Break time!


Take a break!


More Cheatcodes

โŒจ๏ธ (1:05:06) | More Cheatcodes

More Coverage

โŒจ๏ธ (1:17:36) | More Coverage

Chisel

โŒจ๏ธ (1:32:26) | Chisel

Gas: Cheaper Withdraw

โŒจ๏ธ (1:33:50) | Gas: Cheaper Withdraw

  • Gas Reporter
  • forge snapshot
  • vm.txGasPrice
  • gasLeft()
  • tx.getprice

Storage

โŒจ๏ธ (1:38:37) | Storage

cast storage

Gas: Cheaper Withdraw (continued)

โŒจ๏ธ (1:48:20) | Gas: Cheaper Withdraw (continued)

Interactions.s.sol

โŒจ๏ธ (1:56:11) | Interactions.s.sol

Makefile

โŒจ๏ธ (2:10:56) | Makefile

Pushing to GitHub

โŒจ๏ธ (2:19:17) | Pushing to GitHub

๐Ÿธ๐Ÿฆ Tweet Me (add your repo in)!

โŒจ๏ธ (2:34:56) | Tweet Me (add your repo in)!

Lesson 7: Recap

โŒจ๏ธ (2:35:13) | Lesson 7: Recap

(back to top) โฌ†๏ธ

Lesson 8: Html/Js Fund Me (Quick Fullstack / Front End Tutorial)

โญ๏ธ (2:37:02) | Lesson 8: HTML Fund Me

๐Ÿ’ป Code: https://github.com/Cyfrin/html-fund-me-f23

Introduction

Setup

โŒจ๏ธ (2:38:59) | Setup

How Metamask works with your browser

โŒจ๏ธ (2:40:25) | How Metamask works with your browser

Introduction to function selectors

โŒจ๏ธ (2:52:34) | Introduction to function selectors

Recap

โŒจ๏ธ (3:00:00) | Recap

(back to top) โฌ†๏ธ

Lesson 9: Foundry Smart Contract Lottery

โญ๏ธ (3:04:09) | Lesson 9: Smart Contract Lottery

๐Ÿ’ป Code: https://github.com/Cyfrin/foundry-smart-contract-lottery-f23

Introduction

Raffle.sol Setup

โŒจ๏ธ (3:08:16) | Raffle.sol Setup

  • Raffle.sol Setup

Solidity Contract Layout

โŒจ๏ธ (3:15:53) | 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

โŒจ๏ธ (3:17:37) | Custom Errors

  • Custom Errors in Solidity

Events

โŒจ๏ธ 3:22:00 | Events

  • Introduction to Events
  • Events & Logging Video
  • Events & Logging in Hardhat

block.timestamp

โŒจ๏ธ (3:33:29) | block.timestamp

Chainlink VRF

โŒจ๏ธ (3:37:13) | Chainlink VRF

  • Introduction to Chainlink VRF

Sub-Lesson: Chainlink VRF

  • Chainlink VRFv2 Docs
  • Chainlink VRFv2 Walkthrough
  • Chainlink Contracts

Implementing Chainlink VRF - Introduction

โŒจ๏ธ (3:47:21) | Implementing Chainlink VRF - Introduction

  • Implementing Chainlink VRF
forge install smartcontractkit/[email protected] --no-commit

Implementing Chainlink VRF - The Request

Implementing Chainlink VRF - The FulFill

Chainlink VRF Recap

Modulo

โŒจ๏ธ (4:03:32) | Modulo

  • Modulo

Enum

โŒจ๏ธ (4:08:57) | Enum

Resetting an array

โŒจ๏ธ (4:13:04) | Resetting an array

Note on building

โŒจ๏ธ (4:14:31) | Note on building

CEI (Checks, Effects, Interactions)

โŒจ๏ธ (4:16:00) | CEI (Checks, Effects, Interactions)

Introduction to Chainlink Automation

โŒจ๏ธ (4:18:31) | Introduction to Chainlink Automation

  • Chainlink Automation Docs
  • Chainlink Automation Walkthrough

Implementing Chainlink Keepers - checkUpkeep

โŒจ๏ธ (4:33:47) | Implementing Chainlink Keepers - checkUpkeep

Enums

  • Enum

Implementing Chainlink Keepers - checkUpkeep continued

  • block.timestamp

Implementing Chainlink Keepers - performUpkeep

โŒจ๏ธ (4:40:10) | Implementing Chainlink Keepers - performUpkeep

Mid-Lesson Recap

โŒจ๏ธ (4:43:00) | Mid-Lesson Recap

Tests & Deploy Script Setup

โŒจ๏ธ (4:44:08) | Tests & Deploy Script Setup

Mock Chainlink VRF Coordinator

โŒจ๏ธ (4:52:02) | Mock Chainlink VRF Coordinator

Tests & Deploy Script Continued

โŒจ๏ธ (4:56:25) | Tests & Deploy Script Continued

Lots of Tests

โŒจ๏ธ (5:04:50) | Lots of Tests

Testing Events in Foundry

โŒจ๏ธ (5:09:37) | Testing Events in Foundry

vm.roll & vm.warp

โŒจ๏ธ (5:12:37) | vm.roll & vm.warp

Create Subscription Script

โŒจ๏ธ (5:15:21) | Create Subscription Script

Create Subscription from the UI

โŒจ๏ธ (5:26:41) | Create Subscription from the UI

Fund Subscription Script

โŒจ๏ธ (5:30:19) | Fund Subscription Script

Add Consumer Script

โŒจ๏ธ (5:42:29) | Add Consumer Script

More Tests

โŒจ๏ธ (5:52:44) | More Tests

  • forge coverage --report debug

PerformUpkeep Tests

โŒจ๏ธ (5:59:12) | PerformUpkeep Tests

  • Expecting Custom Errors

Getting Event Data into Foundry Scripts

โŒจ๏ธ (6:03:23) | Getting Event Data into Foundry Scripts

  • vm.recordLogs

Intro to Fuzz tests

โŒจ๏ธ (6:11:48) | Intro to Fuzz tests

One Big Test

โŒจ๏ธ (6:15:41) | One Big Test

Passing the private key to vm.startBroadcast

โŒจ๏ธ (6:26:30) | Passing the private key to vm.startBroadcast

Integrations Test

โŒจ๏ธ (6:41:08) | Integrations Test

Testnet Demo - Makefile setup

โŒจ๏ธ (6:44:42) | Testnet Demo - Makefile setup

Testnet Demo - The Demo

โŒจ๏ธ (6:52:33) | Testnet Demo - The Demo

Console.log Debugging

โŒจ๏ธ (6:59:30) | Console.log Debugging

forge test --debug

โŒจ๏ธ (7:01:06) | forge test --debug

Recap

โŒจ๏ธ (7:02:07) | Recap

Recommended LINK amounts for Sepolia Staging Test:

  • Chainlink VRF: 2 LINK
  • Chainlink Keepers: 8 LINK

(back to top) โฌ†๏ธ

Lesson 10: Foundry ERC20s

โญ๏ธ (7:08:04) | Lesson 10: ERC20s

๐Ÿ’ป Code: https://github.com/Cyfrin/foundry-erc20-f23

What is an ERC? What is an EIP?

  • What is an EIP?
  • EIPs codebase

What is an ERC20?

โŒจ๏ธ (7:10:42) | What is an ERC20?

Manually Creating an ERC20 Token

โŒจ๏ธ (7:12:06) | Manually Creating an ERC20 Token

  • .github

ERC20 Token - Openzeppelin

โŒจ๏ธ (7:19:01) | ERC20 Token - Openzeppelin

Deploy Script

โŒจ๏ธ 7:22:58 | Deploy Script

AI Tests

โŒจ๏ธ (7:25:48) | AI Tests

Lesson 10 Recap

(back to top) โฌ†๏ธ

Lesson 11: Foundry NFTs | MoodNFT

โญ๏ธ (7:40:56) | Lesson 11: NFTs

๐Ÿ’ป Code: https://github.com/Cyfrin/foundry-nft-f23

Introduction

What is an NFT?

โŒจ๏ธ (7:43:21) | What is an NFT?

  • Video
  • [Optional: All on Chain SVG NFT]
  • EIP-721

Foundry Setup

โŒจ๏ธ (7:49:54) | Foundry Setup

  • TokenURI
  • Pudgy Penguin Example

IPFS

โŒจ๏ธ (8:00:24) | IPFS

Using IPFS

โŒจ๏ธ (8:07:30) | Using IPFS

Basic NFT: Deploy Script

โŒจ๏ธ (8:13:59) | Basic NFT: Deploy Script

Basic NFT: Tests

โŒจ๏ธ (8:15:25) | Basic NFT: Tests

  • Comparing strings in solidity
  • chisel

Basic NFT: Interactions

โŒจ๏ธ (8:25:31) | Basic NFT: Interactions

Basic NFT: Testnet Demo

โŒจ๏ธ (8:28:24) | Basic NFT: Testnet Demo

The issue with IPFS & HTTPS TokenURI NFTs

โŒจ๏ธ (8:34:32) | The issue with IPFS & HTTPS TokenURI NFTs

What is an SVG?

โŒจ๏ธ (8:38:30) | What is an SVG?

SVG NFT: Introduction

โŒจ๏ธ (8:45:54) | SVG NFT: Introduction

SVG NFT: Encoding the NFT

โŒจ๏ธ (8:50:03) | SVG NFT: Encoding the NFT

SVG NFT: Flipping the mood

โŒจ๏ธ (9:06:41) | SVG NFT: Flipping the mood

SVG NFT: Deploy Script

โŒจ๏ธ (9:08:44) | SVG NFT: Deploy Script

SVG NFT: Debugging practice & some notes

โŒจ๏ธ (9:25:46) | SVG NFT: Debugging practice & some notes

SVG NFT: Anvil Demo

โŒจ๏ธ (9:31:29) | SVG NFT: Anvil Demo

Filecoin & Arweave

โŒจ๏ธ (9:36:58) | Filecoin & Arweave

  • Special Guest Ally

Advanced: EVM Opcodes, Encoding, and Calling

โŒจ๏ธ (9:44:02) | 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

โŒจ๏ธ (10:06:27) | Introduction to Encoding Function Calls Directly

Introduction to Encoding Function Calls Recap

โŒจ๏ธ (10:12:16) | Introduction to Encoding Function Calls Recap

Encoding Function Calls Directly

โŒจ๏ธ (10:14:15) | Encoding Function Calls Directly

  • Function Selector
  • Function Signature

Verifying Metamask Transactions

โŒจ๏ธ (10:28:45) | Verifying Metamask Transactions

  1. Check the address
  2. Check the function selector
  3. Decode the calldata

Lesson 11 Recap

โŒจ๏ธ (10:36:31) | Lesson 11 Recap

(back to top) โฌ†๏ธ

๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ

Completed Video 2!!

๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ


Solidity, Blockchain Developer, Smart Contract, & Solidity Course - Powered By AI - Beginner to Expert Course


Lesson 12: Foundry DeFi | Stablecoin (The PINNACLE PROJECT!! GET HERE!)

๐Ÿ’ป Code: https://github.com/Cyfrin/foundry-defi-stablecoin-f23

Introduction

โญ๏ธ (0:00:00) | Lesson 12: DeFi Stablecoins

What is DeFi?

Code Walkthrough

โŒจ๏ธ (0:09:17) | Code Walkthrough

What is a stablecoin (But actually)

โŒจ๏ธ (0:12:23) | What is a stablecoin (But actually)

DecentralizedStableCoin.sol

โŒจ๏ธ (0:40:41) | DecentralizedStableCoin.sol

DSCEngine.sol Setup

โŒจ๏ธ (0:54:44) | DSCEngine.sol Setup

Deposit Collateral

โŒจ๏ธ (1:04:49) | Deposit Collateral

Mint DSC

Getting the value of our collateral

โŒจ๏ธ (1:22:51) | Getting the value of our collateral

Health Factor

โŒจ๏ธ (1:39:11) | Health Factor

Minting the DSC

โŒจ๏ธ (1:46:02) | Minting the DSC

Testing while developing

Deploy Script

โŒจ๏ธ (1:47:28) | Deploy Script

Tests

โŒจ๏ธ (2:02:24) | Tests

depositCollateralAndMintDsc

โŒจ๏ธ (2:13:45) | depositCollateralAndMintDsc

redeemCollateral

โŒจ๏ธ (2:16:12) | redeemCollateral

Liquidate

Setup

โŒจ๏ธ (2:27:49) | Setup

Refactoring

โŒจ๏ธ (2:44:45) | Refactoring

Leveling up your testing skillz

โŒจ๏ธ (2:56:55) | Leveling up your testing skillz

Challenge: Get DSCEngine.sol test coverage above 85%

Fuzz (Invariant) Testing

โŒจ๏ธ (3:13:50) | Fuzz (Invariant) Testing

Open-based Fuzz tests

โŒจ๏ธ (3:27:18) | Open-based Fuzz tests

Handler-based Fuzz tests

revert_on_fail = true

โŒจ๏ธ (3:46:55) | revert_on_fail = true

Redeeming Collateral

โŒจ๏ธ (4:03:57) | Redeeming Collateral

Minting DSC

โŒจ๏ธ (4:09:42) | Minting DSC

Debugging Fuzz Tests

โŒจ๏ธ (4:15:01) | Debugging Fuzz Tests

Challenge: Find out why mintDsc is never being called on our Handler.sol

Price Feed Handling

โŒจ๏ธ (4:23:30) | Price Feed Handling

OracleLib

โŒจ๏ธ (4:31:28) | OracleLib

Note on audit preparedness

โŒจ๏ธ (4:39:57) | Note on audit preparedness

Recap

โŒจ๏ธ (4:41:06) | Recap

Lens Protocol

โŒจ๏ธ (4:44:38) | Lens Protocol

More DeFi Learnings:

QR Code for Lesson 12 Arbitrum:

Solidity, Blockchain Developer, Smart Contract, & Solidity Course - Powered By AI - Beginner to Expert Course


QR Code for Lesson 12 Sepolia:

Solidity, Blockchain Developer, Smart Contract, & Solidity Course - Powered By AI - Beginner to Expert Course


(back to top) โฌ†๏ธ

Lesson 13: Foundry Upgrades

๐Ÿ’ป Code: https://github.com/Cyfrin/foundry-upgrades-f23

Introduction

โญ๏ธ (4:47:00) | Lesson 13: Upgradable Contracts & Proxies

Upgradable Smart Contracts Overview

Types of Upgrades

  1. Parameter
  2. Social Migrate
  3. Proxy
    1. Proxy Gotchas
      1. Function Collisions
      2. Storage Collisions
    2. Metamorphic Upgrades
    3. Transparent
    4. UUPS
    5. Diamond

Delegatecall

โŒจ๏ธ (5:02:20) | Delegatecall

Small Proxy Example

โŒจ๏ธ (5:10:24) | Small Proxy Example

Universal Upgradable Smart Contract

Setup

โŒจ๏ธ (5:21:53) | UUPS Setup

Initializer

โŒจ๏ธ (5:34:24) | Initializer

Deploy

โŒจ๏ธ (5:43:34) | Deploy

UpgradeBox

โŒจ๏ธ (5:48:29) | Upgradebox

Test/Demo

โŒจ๏ธ (5:53:48) | Test/Demo

Testnet Demo

โŒจ๏ธ (5:59:40) | Testnet Demo

(back to top) โฌ†๏ธ

Lesson 14: Foundry DAO / Governance

Plutocracy is bad! Don't default to ERC20 token voting!!

๐Ÿ’ป Code: https://github.com/Cyfrin/foundry-dao-f23

Introduction

โญ๏ธ (6:05:45) | Lesson 14 | DAOs & Governance

What is a DAO?

How to build a DAO

Setup

Governance Token

Governor

Tests

Wrap up

Bonus: Gas optimization tips

(back to top) โฌ†๏ธ

Lesson 15: Smart Contract Security & Auditing (For developers)

Developers 100% should know all about this! Don't leave the course without at least watching this section!

๐Ÿ–ฅ๏ธ Code: https://github.com/PatrickAlphaC/denver-security

Introduction

โญ๏ธ (7:21:12) | Lesson 15 | Security & Auditing

What is a smart contract audit?

โŒจ๏ธ (7:24:47) | What is a smart contract audit?

Tools

โŒจ๏ธ (7:31:11) | 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?

โŒจ๏ธ (7:42:32) | Manual Review with Tincho

Formal Verification

โŒจ๏ธ (7:56:35) | Formal Verification

Closing Thoughts

โŒจ๏ธ (8:10:56) | Wrap. Up

(back to top) โฌ†๏ธ

Congratulations

๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ Completed 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. Patrick is an advisor on the Chainlink project. The Cyfrin team often does buisness on the Arbitrum L2.

Because of all this, I have added alternatives to each section where we suggest a tool. This video & course was created and sponsored solely by the Cyfrin team.

(back to top) โฌ†๏ธ

Donations

BadgerDAO

We are THRILLED to have received donations from the BadgerDAO protocol.

BadgerDAO is a decentralized collective of builders supporting community driven growth for Bitcoin across DeFi. Deposit to earn Yield-Bearing Rewards that automate and optimize yield from Aura and Convex positions.

Blockchain Developer, Smart Contract, & Solidity Course - Powered By AI 3

(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.

Cyfrin Twitter Cyfrin YouTube Cyfrin LinkedIn

(back to top) โฌ†๏ธ

foundry-full-course-f23's People

Contributors

0xjarix avatar 0xosiris avatar aayush-gupta-coder avatar anaarsonist avatar asobiesk avatar chefaharoni avatar cromewar avatar devblixt avatar devswayam avatar egeaybars123 avatar ethanol48 avatar eversmile12 avatar f3d0ss avatar finessevanes avatar harshh18 avatar lostintime101 avatar osneue avatar pacelliv avatar palmcivet7 avatar patrickalphac avatar robocrypter avatar shikhar229169 avatar sunnystefi avatar thejus-m avatar usmanfarooq91 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.