Awesome
Entire course and video content updated June 15, 2024
<div align="center"> <h1> Blockchain Developer, Smart Contract, & Solidity Career Path - Powered By AI - Beginner to Expert Course <br>| Foundry Edition 2024 |</h1> <p align="center"><strong>Learn smart contract development, and level up your career </strong></p> <p align="center"> <br /> <a href="https://cyfrin.io/"> <img src=".github/images/poweredbycyfrinbluehigher.png" width="145" alt=""/></a> <a href="https://updraft.cyfrin.io/courses/foundry"> <img src=".github/images/coursebadge.png" width="242.3" alt=""/></a> <br /> </p>Welcome to the repository for the Blockchain Developer, Smart Contract, & Solidity Cyfrin Updraft - Career Path <br>| Powered By AI |<br>| Beginner to Expert Path |<br>| Foundry Edition 2024 |
</div>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
<details> <summary>Resources</summary> <ol> <li><a href="#blockchain-developer-smart-contract--solidity-course---powered-by-ai---beginner-to-expert-course--foundry-edition-2024">Blockchain Developer, Smart Contract, & Solidity Course - Powered By AI - Beginner to Expert Course | Foundry Edition 2024</a></li> <li><a href="#table-of-contents">Table of Contents</a> <ul> <li><a href="#recommended-tools">Recommended Tools</a></li> </ul> </li> <li><a href="#testnet-faucets">Testnet Faucets</a></li> <li><a href="#resources-for-this-course">Resources For This Course</a></li> <li><a href="#bonus-nfts">Bonus NFTs</a> <ul> <li><a href="#important-notes-for-zksync">Important Notes for ZKsync</a></li> <li><a href="#bridging-to-zksync">Bridging to ZKsync</a></li> </ul> </li> </ol> </details> <details> <summary> <a href="#welcome-to-the-course-repo">Welcome to the Course Repo!</a></summary> <ol> <li> <a href="#welcome-to-the-course">Welcome to the course! </a> </li> <li> <a href="#best-practices">Best Practices </a> </li> </ol> </details> <details> <summary> <a href="#blockchain-basics-section-1-what-is-a-blockchain-what-does-a-blockchain-do">Course: Blockchain Basics Section 1</a> </summary> </details> <details> <summary> <a href="#solidity-101-section-1-simple-storage">Solidity 101 Section 1: Simple Storage</a> </summary> <ol> <li><a href="#introduction">Introduction</a></li> <li><a href="#setting-up-your-first-contract">Setting Up Your First Contract</a></li> <li><a href="#basic-solidity-types">Basic Solidity: Types</a></li> <li><a href="#basic-solidity-functions">Basic Solidity: Functions</a></li> <li><a href="#basic-solidity-arrays--structs">Basic Solidity: Arrays & Structs</a></li> <li><a href="#basic-solidity-compiler-errors-and-warnings">Basic Solidity: Compiler Errors and Warnings</a></li> <li><a href="#memory-storage-calldata-intro">Memory, Storage, Calldata (Intro)</a></li> <li><a href="#mappings">Mappings</a></li> <li><a href="#deploying-your-first-contract">Deploying your First Contract</a></li> <li><a href="#the-evm--a-recap-of-section-2">The EVM & A Recap of Section 2</a></li> </ol> </details> <details> <summary><a href="#solidity-101-section-2--remix-storage-factory">Solidity 101 Section 2: Remix Storage Factory</a></summary> <ol> <li><a href="#introduction-1">Introduction</a></li> <li><a href="#basic-solidity-importing-contracts-into-other-contracts">Basic Solidity: Importing Contracts into other Contracts</a></li> <li><a href="#basic-solidity-interacting-with-other-contracts">Basic Solidity: Interacting with other Contracts</a></li> <li><a href="#basic-solidity-inheritance--overrides">Basic Solidity: Inheritance & Overrides</a></li> <li><a href="#section-3-recap">Section 3 Recap</a></li> </ol> </details> <details> <summary> <a href="#solidity-101-section-3-remix-fund-me">Solidity 101 Section 3: Remix Fund Me</a> </summary> <ol> <li><a href="#introduction-2">Introduction</a></li> <li><a href="#setup">Setup</a></li> <li><a href="#sending-eth-through-a-function">Sending ETH through a function</a></li> <li><a href="#reverts">Reverts</a></li> <li><a href="#getting-real-world-price-data-chainlink">Getting real world price data (Chainlink)</a></li> <li><a href="#quick-recap-i">Quick recap I</a></li> <li><a href="#interfaces">Interfaces</a></li> <li><a href="#ai-help-iii">AI Help III</a></li> <li><a href="#importing-from-npm--github">Importing from NPM / GitHub</a></li> <li><a href="#getting-prices-from-chainlink">Getting Prices from Chainlink</a></li> <li><a href="#more-solidity-math">More solidity math</a></li> <li><a href="#msgsender">msg.sender</a></li> <li><a href="#quick-recap-ii">Quick recap II</a></li> <li><a href="#library">Library</a></li> <li><a href="#safemath">SafeMath</a></li> <li><a href="#for-loop">For Loop</a></li> <li><a href="#resetting-an-array">Resetting an array</a></li> <li><a href="#transfer-send-and-call">Transfer, Send, and Call</a></li> <li><a href="#constructor">Constructor</a></li> <li><a href="#modifiers">Modifiers</a></li> <li><a href="#testnet-demo">Testnet Demo</a></li> <li><a href="#advanced-solidity">Advanced Solidity</a> <ul> <li><a href="#immutable--constant">Immutable & Constant</a></li> <li><a href="#custom-errors">Custom Errors</a></li> <li><a href="#receive--fallback-functions">Receive & Fallback Functions</a></li> </ul> </li> <li><a href="#Section-4-Recap">Section 4 Recap</a></li> </ol> </details> <details> <summary><a href="#solidity-101-section-4-ai-prompting-asking-questions-and-getting-help">Solidity 101 Section 4: AI Prompting, Asking Questions, and Getting Help</a></summary> <ol> <li><a href="#intro">Intro</a></li> <li><a href="#7-tips-for-this-course">7 Tips for this Course</a></li> <li><a href="#setting-up-github">Setting up GitHub</a></li> <li><a href="#formatting-a-question">Formatting a question</a></li> <li><a href="#speedrunethereum">SpeedRunEthereum</a></li> </ul> </details> <details> <summary> <a href="#foundry-fundamentals-section-1-foundry-simple-storage">Foundry Fundamentals Section 1: Foundry Simple Storage</a> </summary> <ol> <li><a href="#introduction-3">Introduction</a></li> <li><a href="#installation--setup-macos--linux">Installation & Setup (MacOS & Linux)</a> <ul> <li><a href="#windows-setup">Windows Setup</a></li> <li><a href="#gitpod">Gitpod</a></li> </ul> </li> <li><a href="#local-development-introduction">Local Development Introduction</a></li> <li><a href="#foundry-install">Foundry Install</a></li> <li><a href="#vscode-setup-ii">VSCode Setup II</a></li> <li><a href="#foundry-setup">Foundry Setup</a></li> <li><a href="#formatting-solidity-in-vscode">Formatting Solidity in VSCode</a></li> <li><a href="#compiling-in-foundry">Compiling in Foundry</a></li> <li><a href="#deploying-to-a-local-chain-i-anvil-or-ganache">Deploying to a local chain I (Anvil or Ganache)</a></li> <li><a href="#adding-another-network-to-metamask">Adding another network to metamask</a></li> <li><a href="#deploying-to-a-local-chain-ii-forge-create">Deploying to a local chain II (Forge Create)</a></li> <li><a href="#private-key-rant-i">Private Key Rant I</a></li> <li><a href="#deploying-to-a-local-chain-iii-forge-script">Deploying to a local chain III (Forge Script)</a></li> <li><a href="#what-is-a-transaction-but-actually">What is a transaction (But actually)</a></li> <li><a href="#private-key-rant-ii">Private Key Rant II</a></li> <li><a href="#can-you-encrypt-a-private-key---a-keystore-in-foundry-yet">Can you Encrypt a Private Key -> a keystore in foundry yet??</a></li> <li><a href="#thirdweb-deploy">ThirdWeb Deploy</a></li> <li><a href="#private-key-rant-summary">Private Key Rant Summary:</a></li> <li><a href="#cast-send">Cast Send</a></li> <li><a href="#deploying-to-a-testnet-or-a-mainnet">Deploying to a testnet or a mainnet</a></li> <li><a href="#verifying-a-contract-the-manual-way">Verifying a contract the manual way</a></li> <li><a href="#cleaning-up-the-project">Cleaning up the project</a></li> <li><a href="#Alchemy-and-the-mempool">Alchemy and the mempool</a></li> <li><a href="#summary">Summary</a></li> </ol> </details> <details> <summary> <a href="#foundry-fundamentals-section-2-foundry-fund-me">Foundry Fundamentals Section 2: Foundry Fund Me</a> </summary> <ol> <li><a href="#introduction-4">Introduction</a></li> <li><a href="#setup-1">Setup</a></li> <li><a href="#testing-introduction">Testing Introduction</a></li> <li><a href="#setup-continued">Setup Continued</a></li> <li><a href="#tests">Tests</a></li> <li><a href="#debugging-tests-i">Debugging Tests I</a></li> <li><a href="#advanced-deploy-scripts-i">Advanced Deploy Scripts I</a></li> <li><a href="#forked-tests">Forked Tests</a></li> <li><a href="#refactoring-i-testing-deploy-scripts">Refactoring I: Testing Deploy Scripts</a></li> <li><a href="#refactoring-ii-helper-config">Refactoring II: Helper Config</a></li> <li><a href="#refactoring-iii-mocking-continued">Refactoring III: Mocking (continued)</a></li> <li><a href="#magic-numbers">Magic Numbers</a></li> <li><a href="#break-time">Break time!</a> <li><a href="#more-cheatcodes">More Cheatcodes</a></li> <li><a href="#more-coverage">More Coverage</a></li> <li><a href="#chisel">Chisel</a></li> <li><a href="#gas-cheaper-withdraw">Gas: Cheaper Withdraw</a></li> <li><a href="#storage">Storage</a></li> <li><a href="#gas-cheaper-withdraw-continued">Gas: Cheaper Withdraw (continued)</a></li> <li><a href="#interactionsssol">Interactions.s.sol</a></li> <li><a href="#makefile">Makefile</a></li> <li><a href="#pushing-to-github">Pushing to GitHub</a></li> <li><a href="#Section-7-Recap">Recap</a></li> </ol> </details> <details> <summary> <a href="#foundry-fundamentals-section-3-htmljs-fund-me-quick-fullstack--front-end-tutorial">Foundry Fundamentals Section 3: Html/Js Fund Me (Quick Fullstack / Front End Tutorial)</a> </summary> <ol> <li><a href="#introduction-5">Introduction</a></li> <li><a href="#setup-2">Setup</a></li> <li><a href="#how-metamask-works-with-your-browser">How metamask works with your browser</a></li> <li><a href="#introduction-to-function-selectors">Introduction to function selectors</a></li> <li><a href="#recap">Recap</a></li> </ol> </details> <details> <summary> <a href="#foundry-fundamentals-section-4-foundry-smart-contract-lottery">Foundry Fundamentals Section 4: Foundry Smart Contract Lottery</a> </summary> <ol> <li><a href="#introduction-6">Introduction</a></li> <li><a href="#rafflesol-setup">Raffle.sol Setup</a></li> <li><a href="#solidity-contract-layout">Solidity Contract Layout</a></li> <li><a href="#custom-errors-1">Custom Errors</a></li> <li><a href="#events">Events</a></li> <li><a href="#blocktimestamp">block.timestamp</a></li> <li><a href="#chainlink-vrf">Chainlink VRF</a> <ul> <li><a href="#sub-section-chainlink-vrf">Sub-Section: Chainlink VRF</a></li> </ul> </li> <li><a href="#implementing-chainlink-vrf---introduction">Implementing Chainlink VRF - Introduction</a></li> <li><a href="#modulo">Modulo</a></li> <li><a href="#enum">Enum</a></li> <li><a href="#resetting-an-array-1">Resetting an array</a></li> <li><a href="#note-on-building">Note on building</a></li> <li><a href="#CEI-Checks-Effects-Interactions">CEI</a></li> <li><a href="#introduction-to-chainlink-automation">Introduction to Chainlink Automation</a></li> <li><a href="#implementing-chainlink-keepers---checkupkeep">Implementing Chainlink Keepers - checkUpkeep</a> <ul> <li><a href="#enums">Enums</a></li> </ul> </li> <li><a href="#implementing-chainlink-keepers---checkupkeep-continued">Implementing Chainlink Keepers - checkUpkeep continued</a></li> <li><a href="#implementing-chainlink-keepers---performupkeep">Implementing Chainlink Keepers - performUpkeep</a></li> <li><a href="#mid-section-recap">Mid-Section Recap</a></li> <li><a href="#tests--deploy-script-setup">Tests & Deploy Script Setup</a> <ul> <li><a href="#mock-chainlink-vrf-coordinator">Mock Chainlink VRF Coordinator</a></li> </ul> </li> <li><a href="#tests--deploy-script-continued">Tests & Deploy Script Continued</a></li> <li><a href="#lots-of-tests">Lots of Tests</a> <ul> <li><a href="#testing-events-in-foundry">Testing Events in Foundry</a></li> <li><a href="#vmroll--vmwarp">vm.roll & vm.warp</a></li> </ul> </li> <li><a href="#create-subscription-script">Create Subscription Script</a></li> <li><a href="#create-subscription-from-the-ui">Create Subscription from the UI</a></li> <li><a href="#fund-subscription-script">Fund Subscription Script</a></li> <li><a href="#add-consumer-script">Add Consumer Script</a></li> <li><a href="#more-tests">More Tests</a></li> <li><a href="#performupkeep-tests">PerformUpkeep Tests</a></li> <li><a href="#getting-event-data-into-foundry-scripts">Getting Event Data into Foundry Scripts</a></li> <li><a href="#intro-to-fuzz-tests">Intro to Fuzz tests</a></li> <li><a href="#one-big-test">One Big Test</a></li> <li><a href="#passing-the-private-key-to-vmstartbroadcast">Passing the private key to vm.startBroadcast</a></li> <li><a href="#integrations-test">Integrations Test</a></li> <li><a href="#testnet-demo---makefile-setup">Testnet Demo - Makefile setup</a></li> <li><a href="#testnet-demo---the-demo">Testnet Demo - The Demo</a></li> <li><a href="#consolelog-debugging">Console.log Debugging</a></li> <li><a href="#forge-test---debug">forge test --debug</a></li> <li><a href="#recap-1">Recap</a> <ul> <li><a href="#recommended-link-amounts-for-sepolia-staging-test">Recommended LINK amounts for Sepolia Staging Test:</a></li> </ul> </li> </ol> </details> <details> <summary> <a href="#advanced-foundry-section-1-foundry-erc20s">Advanced Foundry Section 1: Foundry ERC20s</a> </summary> <ol> <li><a href="#what-is-an-erc-what-is-an-eip">What is an ERC? What is an EIP?</a></li> <li><a href="#what-is-an-erc20">What is an ERC20?</a></li> <li><a href="#manually-creating-an-erc20-token">Manually Creating an ERC20 Token</a></li> <li><a href="#erc20-token---openzeppelin">ERC20 Token - Openzeppelin</a></li> <li><a href="#deploy-script">Deploy Script</a></li> <li><a href="#ai-tests">AI Tests</a></li> <li><a href="#section-10-recap">Section 10 Recap</a></li> </ol> </details> <details> <summary> <a href="#advanced-foundry-section-2-foundry-nfts--moodnft">Advanced Foundry Section 2: Foundry NFTs | MoodNFT</a> </summary> <ol> <li><a href="#introduction-7">Introduction</a></li> <li><a href="#what-is-an-nft">What is an NFT?</a></li> <li><a href="#foundry-setup-1">Foundry Setup</a></li> <li><a href="#ipfs">IPFS</a></li> <li><a href="#using-ipfs">Using IPFS</a></li> <li><a href="#basic-nft-deploy-script">Basic NFT: Deploy Script</a></li> <li><a href="#basic-nft-tests">Basic NFT: Tests</a></li> <li><a href="#basic-nft-interactions">Basic NFT: Interactions</a></li> <li><a href="#basic-nft-testnet-demo">Basic NFT: Testnet Demo</a></li> <li><a href="#the-issue-with-ipfs--https-tokenuri-nfts">The issue with IPFS & HTTPS TokenURI NFTs</a></li> <li><a href="#what-is-an-svg">What is an SVG?</a></li> <li><a href="#svg-nft-introduction">SVG NFT: Introduction</a></li> <li><a href="#svg-nft-encoding-the-nft">SVG NFT: Encoding the NFT</a></li> <li><a href="#svg-nft-flipping-the-mood">SVG NFT: Flipping the mood</a></li> <li><a href="#svg-nft-deploy-script">SVG NFT: Deploy Script</a></li> <li><a href="#svg-nft-debugging-practice--some-notes">SVG NFT: Debugging practice & some notes</a></li> <li><a href="#svg-nft-anvil-demo">SVG NFT: Anvil Demo</a></li> <li><a href="#advanced-evm-opcodes-encoding-and-calling">Advanced: EVM Opcodes, Encoding, and Calling</a> <ul> <li><a href="#abiencode--abiencodepacked">abi.encode & abi.encodePacked</a></li> <li><a href="#introduction-to-encoding-function-calls-directly">Introduction to Encoding Function Calls Directly</a></li> <li><a href="#introduction-to-encoding-function-calls-recap">Introduction to Encoding Function Calls Recap</a></li> <li><a href="#encoding-function-calls-directly">Encoding Function Calls Directly</a></li> </ul> </li> <li><a href="#verifying-metamask-transactions">Verifying Metamask Transactions</a></li> <li><a href="#filecoin--arweave">Filecoin & Arweave</a></li> <li><a href="#section-11-recap">Section 11 Recap</a></li> </ol> </details> <details> <summary> <a href="#advanced-foundry-section-3-foundry-defi--stablecoin-the-pinnacle-project-get-here">Advanced Foundry Section 3: Foundry DeFi | Stablecoin (The PINNACLE PROJECT!! GET HERE!)</a> </summary> <ol> <li><a href="#what-is-defi">What is DeFi?</a></li> <li><a href="#code-walkthrough">Code Walkthrough</a></li> <li><a href="#what-is-a-stablecoin-but-actually">What is a stablecoin (But actually)</a></li> <li><a href="#decentralizedstablecoinsol">DecentralizedStableCoin.sol</a></li> <li><a href="#dscenginesol-setup">DSCEngine.sol Setup</a></li> <li><a href="#deposit-collateral">Deposit Collateral</a></li> <li><a href="#mint-dsc">Mint DSC</a> <ul> <li><a href="#getting-the-value-of-our-collateral">Getting the value of our collateral</a></li> <li><a href="#health-factor">Health Factor</a></li> <li><a href="#minting-the-dsc">Minting the DSC</a></li> </ul> </li> <li><a href="#testing-while-developing">Testing while developing</a> <ul> <li><a href="#deploy-script-1">Deploy Script</a></li> <li><a href="#tests-1">Tests</a></li> </ul> </li> <li><a href="#depositcollateralandmintdsc">depositCollateralAndMintDsc</a></li> <li><a href="#redeemcollateral">redeemCollateral</a></li> <li><a href="#liquidate">Liquidate</a> <ul> <li><a href="#setup-3">Setup</a></li> <li><a href="#refactoring">Refactoring</a></li> </ul> </li> <li><a href="#leveling-up-your-testing-skillz">Leveling up your testing skillz</a></li> <li><a href="#fuzz-invariant-testing">Fuzz (Invariant) Testing</a></li> <li><a href="#open-based-fuzz-tests">Open-based Fuzz tests</a></li> <li><a href="#handler-based-fuzz-tests">Handler-based Fuzz tests</a> <ul> <li><a href="#revert_on_fail--true">revert_on_fail = true</a></li> <li><a href="#redeeming-collateral">Redeeming Collateral</a></li> <li><a href="#minting-dsc">Minting DSC</a></li> <li><a href="#debugging-fuzz-tests">Debugging Fuzz Tests</a></li> <li><a href="#challenge-find-out-why-mintdsc-is-never-being-called-on-our-handlersol">Challenge: Find out why `mintDsc` is never being called on our Handler.sol</a></li> </ul> </li> <li><a href="#price-feed-handling">Price Feed Handling</a></li> <li><a href="#oraclelib">OracleLib</a></li> <li><a href="#note-on-audit-preparedness">Note on audit preparedness</a></li> <li><a href="#recap-2">Recap</a></li> <li><a href="#lens-protocol">Lens Protocol</a></li> <ul> <li><a href="#more-defi-learnings">More DeFi Learnings:</a></li> </ul> </ol> </details> <details> <summary> <a href="#advanced-foundry-section-4-foundry-merkle-airdrop-and-signatures">Advanced Foundry Section 4: Foundry Merkle Airdrop and Signatures</a> </summary> <ol> <li><a href="#introduction-to-merkle-airdrops-and-code-walkthrough">Introduction to Merkle Airdrops and Code Walkthrough</a></li> <li><a href="#project-setup">Project Setup</a></li> <li><a href="#merkle-proofs">Merkle Proofs</a></li> <li><a href="#base-airdrop-contract">Base Airdrop Contract</a></li> <li><a href="#already-claimed-check">Already Claimed Check</a></li> <li><a href="#merkle-tree-scripts">Merkle Tree Scripts</a></li> <li><a href="#writing-the-tests">Writing the Tests</a></li> <li><a href="#deployment-script">Deployment Script</a></li> <li><a href="#adding-signature-verification">Adding Signature Verification</a></li> <li><a href="#signature-standards">Signature Standards</a></li> <li><a href="#ecdsa-signatures">ECDSA Signatures</a></li> <li><a href="#transaction-types-introduction">Transaction Types Introduction</a></li> <li><a href="#transaction-types">Transaction Types</a></li> <li><a href="#blob-transactions">Blob Transactions</a></li> <li><a href="#type-113-transactions">Type 113 Transactions</a></li> <li><a href="#implementing-signatures">Implementing Signatures</a></li> <li><a href="#modifying-the-tests">Modifying the Tests</a></li> <li><a href="#test-on-zksync-optional">Test on ZKsync (optional)</a></li> <li><a href="#create-claiming-script">Create Claiming Script</a></li> <li><a href="#creating-a-signature">Creating a Signature</a></li> <li><a href="#splitting-a-signature">Splitting a Signature</a></li> <li><a href="#executing-the-anvil-script">Executing the Anvil Script</a></li> <li><a href="#Deploy-and-Claim-on-ZKsync-Local-Node">Deploy and Claim on ZKsync Local Node</a></li> <li><a href="#deploy-and-claim-on-zksync-sepolia">Deploy and Claim on ZKsync Sepolia</a></li> <li><a href="#summary-1">Summary</a></li> </ol> </details> <details> <summary> <a href="#advanced-foundry-section-5-foundry-upgrades">Advanced Foundry Section 5: Foundry Upgrades</a> </summary> <ol> <li><a href="#introduction-9">Introduction</a></li> <li><a href="#upgradable-smart-contracts-overview">Upgradable Smart Contracts Overview</a></li> <li><a href="#types-of-upgrades">Types of Upgrades</a></li> <li><a href="#delegatecall">Delegatecall</a></li> <li><a href="#small-proxy-example">Small Proxy Example</a></li> <li><a href="#universal-upgradable-smart-contract">Universal Upgradable Smart Contract</a> <ul> <li><a href="#setup-4">Setup</a></li> <li><a href="#initializer">Initializer</a></li> <li><a href="#deploy">Deploy</a></li> <li><a href="#upgradebox">UpgradeBox</a></li> <li><a href="#testdemo">Test / Demo</a></li> </ul> </li> <li><a href="#testnet-demo-1">Testnet Demo</a></li> </ol> </details> <details> <summary> <a href="#advanced-foundry-section-6-foundry-account-abstraction">Advanced Foundry Section 6: Foundry Account Abstraction</a> </summary> </details> <details> <summary> <a href="#advanced-foundry-section-7-foundry-dao--governance">Advanced Foundry Section 7: Foundry DAO / Governance</a> </summary> <ol> <li><a href="#introduction-10">Introduction</a></li> <li><a href="#what-is-a-dao">What is a DAO?</a></li> <li><a href="#how-to-build-a-dao">How to build a DAO</a> <ul> <li><a href="#setup-5">Setup</a></li> <li><a href="#governance-token">Governance Token</a></li> <li><a href="#governor">Governor</a></li> <li><a href="#tests-2">Tests</a></li> </ul> </li> <li><a href="#wrap-up">Wrap up</a></li> <li><a href="#bonus-gas-optimization-tips">Bonus: Gas optimization tips</a></li> </ol> </details> <details> <summary> <a href="#advanced-foundry-section-8-smart-contract-security--auditing-for-developers">Advanced Foundry Section 8: Smart Contract Security & Auditing (For developers)</a> </summary> <ol> <li><a href="#introduction-11">Introduction</a></li> <li><a href="#what-is-a-smart-contract-audit">What is a smart contract audit?</a></li> <li><a href="#tools">Tools</a> <ul> <li><a href="#manual-review">Manual Review</a></li> <li><a href="#static-analysis">Static Analysis</a></li> <li><a href="#dynamic-analysis">Dynamic Analysis</a></li> <li><a href="#formal-verification">Formal Verification</a></li> <li><a href="#symbolic-execution">Symbolic Execution</a></li> <li><a href="#fuzzing">Fuzzing</a></li> <li><a href="#formal-verification--symbolic-execution">Formal Verification (& Symbolic Execution)</a></li> <li><a href="#other-security-stuff">Other security stuff</a></li> </ul> </li> <li><a href="#what-does-the-process-of-manual-review-look-like">What does the process of manual review look like?</a></li> <li><a href="#formal-verification-1">Formal Verification</a></li> <li><a href="#closing-thoughts">Closing Thoughts</a></li> </ol> </details> <details> <summary> <a href="#congratulations">Congratulations</a> </summary> <ol> <li><a href="#where-do-i-go-now">Where do I go now?</a> <ul> <li><a href="#learning-more">Learning More</a></li> <li><a href="#community">Community</a></li> <li><a href="#hackathons">Hackathons</a></li> </ul> </ol> </details>All the sections on this repo are for several courses on the Solidity Developer Career path of Cyfrin Updraft.
<a href="#disclosures">Disclosures</a>
<a href="#thank-you">Thank you</a>
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: <a href="https://tenderly.co/?mtm_campaign=partner&mtm_kwd=cyfrin" target="_blank"> https://tenderly.co/?mtm_campaign=partner&mtm_kwd=cyfrin</a>
- Main (Sepolia): <a href="https://cloud.google.com/application/web3/faucet/ethereum/sepolia" target="_blank"> Sepolia GCP Faucet </a>
- Alchemy Faucet (Sepolia):<a href="https://sepoliafaucet.com/" target="_blank"> https://sepoliafaucet.com/</a>
- Infura Faucet (Sepolia):<a href="https://www.infura.io/faucet/sepolia" target="_blank" > https://www.infura.io/faucet/sepolia</a>
- Chainlink Faucet (Sepolia):<a href="https://faucets.chain.link/sepolia" target="_blank" > https://faucets.chain.link/sepolia</a>
- No need for 0.001 ETH on mainnet
- ZKsync Faucets (ZKsync Sepolia):<a href="https://docs.zksync.io/zksync-era/ecosystem/network-faucets" target="_blank"> https://docs.zksync.io/zksync-era/ecosystem/network-faucets</a>
- ZKsync Bridge:<a href="https://portal.zksync.io/bridge/" target="_blank"> https://portal.zksync.io/bridge/</a>
⚠️ 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
- cursor IDE
- 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
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!
<!-- _[ (0:00:00) | Section 0: Welcome!](https://www.youtube.com/watch?v=umepbfKp5rI&t=0s)_ -->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
Course: Blockchain Basics
<!-- _[⭐️ (0:13:54) | Section 1: Blockchain Basics](https://www.youtube.com/watch?v=umepbfKp5rI&t=834s)_ -->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
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
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
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
- ZKsync compiler edition: 0.8.24
🐸🐦 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
<p align="right">(<a href="#table-of-contents">back to top</a>) ⬆️</p>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
<p align="right">(<a href="#table-of-contents">back to top</a>) ⬆️</p>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
- Chainlink API Calls
- 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
<!-- - [Openzeppelin Safemath](https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/math/SafeMath.sol) doesn't seem to exist anymore? I couldn't find it.-->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
<p align="right">(<a href="#table-of-contents">back to top</a>) ⬆️</p>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
<p align="right">(<a href="#table-of-contents">back to top</a>) ⬆️</p>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.39.1/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 + K
orCTRL + K
clears the terminalcode .
to open VSCode in a new VSCode window
Foundry Install
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)
- 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 send
source .env
Can you Encrypt a Private Key -> a keystore in foundry yet??
Can you Encrypt a Private Key -> a keystore in foundry yet??
- A:
NoYes, 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 fmt
README.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
<p align="right">(<a href="#table-of-contents">back to top</a>) ⬆️</p>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/chainlink-brownie-contracts@0.6.1 --no-commit
- Dependencies
- remappings
- Chainlink Brownie Contracts
Tests
Debugging Tests I
Advanced Deploy Scripts I
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
- 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 snapshot
vm.txGasPrice
gasLeft()
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
.env
lib/
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
<p align="right">(<a href="#table-of-contents">back to top</a>) ⬆️</p>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
<!-- TODO: Replace with Correct updraft sections -->⌨️ 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
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:
// 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/chainlink-brownie-contracts@1.1.1 --no-commit
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
<p align="right">(<a href="#table-of-contents">back to top</a>) ⬆️</p>🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊
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
<p align="right">(<a href="#table-of-contents">back to top</a>) ⬆️</p>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
<p align="right">(<a href="#table-of-contents">back to top</a>) ⬆️</p>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
<p align="right">(<a href="#table-of-contents">back to top</a>) ⬆️</p>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
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 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
Delegatecall
Small Proxy Example
Universal Upgradable Smart Contract
Setup
- UUPS vs Transparent
- Abstract Contracts
Deploy
UpgradeBox
Test/Demo
Testnet Demo
Advanced Foundry Section 5 NFTs
<p align="right">(<a href="#table-of-contents">back to top</a>) ⬆️</p>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
Ethereum Setup
⌨️ Etheren Account Abstraction
PackedUserOperation
Validate UserOp
EntryPoint Contract
Execute Function Ethereum
Deployment Script for an Ethereum Account
Tests Owner can Execute
Unsigned PackedUserOperation Test
⌨️ Get Unsigened 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
Rcap & 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?
- 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 7 NFTs
<p align="right">(<a href="#table-of-contents">back to top</a>) ⬆️</p>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
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
Closing Thoughts
- Common Attacks
- Best Practices
- Attacks
- Damn Vulnerable Defi
- Ethernaut
- Top Smart Contract Auditors
- Some Smart Contract Auditors:
Advanced Foundry Section 8 NFTs
<p align="right">(<a href="#table-of-contents">back to top</a>) ⬆️</p>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!
<p align="right">(<a href="#table-of-contents">back to top</a>) ⬆️</p>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.
<p align="right">(<a href="#table-of-contents">back to top</a>) ⬆️</p>Sponsors
A huge thank you to our sponsors. These are the groups and technologies
<p align="right">(<a href="#table-of-contents">back to top</a>) ⬆️</p>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!
<a href="https://github.com/cyfrin/security-and-auditing-full-course-s23/graphs/contributors"> <img src="https://contrib.rocks/image?repo=cyfrin/foundry-full-course-cu" /> </a>License
Cyfrin Updraft content is open-sourced licensed as GPLv3.
<p align="right">(<a href="#table-of-contents">back to top</a>) ⬆️</p>