Entire course and video content updated June 15, 2024
Learn smart contract development, and level up your career
Welcome to the repository for the Blockchain Developer, Smart Contract, & Solidity Cyfrin Updraft - Career Path
| Powered By AI |
| Beginner to Expert Path |
| Foundry Edition 2024 |
This repository houses course resources and discussions for the course.
Please refer to this for an in-depth explanation of the content:
Cyfrin Updraft Courses:
All the sections on this repo are for several courses on the Solidity Developer Career path of Cyfrin Updraft.
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.
⚠️ 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.
**Note: Given the frequency of exploits through Cursor extensions, we cannot recommend the IDE, at this time.
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.
IF YOU DECIDE TO MINT THE REAL NFT:
(back to top) ⬆️
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
💻 Code: https://github.com/cyfrin/remix-simple-storage-cu
⭐️ Welcome to Remix - Simple Storage
⌨️ Setting Up Your First Contract
uint256, int256, bool, string, address, bytes32⌨️ Basic Solidity Arrays & Structs
push array function⌨️ Basic Solidity Errors & Warnings
⌨️ Basic Solidity Memory, Storage, & Calldata (Intro)
⌨️ Deploying your First Contract
⌨️ The EVM & A Recap of Section 2
(back to top) ⬆️
💻 Code: https://github.com/cyfrin/remix-storage-factory-cu
⭐️ Section 2 | Storage Factory
⌨️ Importing Contracts into other Contracts
⌨️ Interacting with other contracts
(back to top) ⬆️
💻 Code: https://github.com/Cyfrin/remix-fund-me-cu
⌨️ Sending ETH through a function
⌨️ Getting real world price data (Chainlink)
⌨️ Importing from NPM / GitHub
⌨️ Getting Prices from Chainlink
/* */ is another way to make comments⌨️ Receive & Fallback Functions
(back to top) ⬆️
DO NOT SKIP THIS!!
(back to top) ⬆️
💻 Code: https://github.com/Cyfrin/foundry-simple-storage-cu
⭐️ Foundry Simple Storage Introduction
⌨️ Installation & Setup (MacOS & Linux)
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash⚠️ Please use Gitpod as an absolute last resort
CMD + K or CTRL + K clears the terminalcode . to open VSCode in a new VSCode windowmkdir foundry-cucd foundry-cumkdir foundry-simple-storage-cu⌨️ Foundry Setup ⌨️ Foundry Setup II (WSL)
⌨️ Formatting Solidity in VSCode
settings.json "[solidity]": {
"editor.defaultFormatter": "NomicFoundation.hardhat-solidity"
},
"[javascript]":{
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
⌨️ Deploying to a local chain I (Anvil or Ganache)
⌨️ Adding another network to Metamask
⌨️ Deploying to a local chain II (Forge Create)
forge createforge scripthistory -c⌨️ Deploying to a local chain III (Forge Script)
⌨️ What is a transaction (But actually)
cast --to-base 0x01 dec
cast sendsource .envCan you Encrypt a Private Key -> a keystore in foundry yet??
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
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 Sepolia
⌨️ Verifying a contract the manual way
forge fmtREADME.md(back to top) ⬆️
💻 Code: https://github.com/Cyfrin/foundry-fund-me-cu
forge install smartcontractkit/chainlink-brownie-contracts@0.6.1
-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 II: Helper Config
⌨️ Refactoring III: Mocking (continued)
forge snapshotvm.txGasPricegasLeft()tx.getpricecast storage
s_ to storage variablesi_ to immutable variables⌨️ Gas: Cheaper Withdraw (continued)
.gitignore
.envlib/broadcast/⌨️ (2:34:56) | Tweet Me (add your repo in)!
(back to top) ⬆️
💻 Code: https://github.com/Cyfrin/html-fund-me-cu
⌨️ How Metamask works with your browser
⌨️ Introduction to function selectors
(back to top) ⬆️
⭐️ Section 4: Smart Contract Lottery
💻 Code: https://github.com/Cyfrin/foundry-smart-contract-lottery-cu
// Layout of Contract:
// license
// version
// imports
// errors
// interfaces, libraries, contracts
// Type declarations
// State variables
// Events
// Modifiers
// Functions
// Layout of Functions:
// constructor
// receive function (if exists)
// fallback function (if exists)
// external
// public
// internal
// private
// internal & private view & pure functions
// external & public view & pure functions
- Chainlink VRFv2 Docs
- Chainlink VRFv2 Walkthrough
- Chainlink Contracts
⌨️ Implementing Chainlink VRF - Introduction
forge install smartcontractkit/chainlink-brownie-contracts@1.1.1
⌨️ CEI (Checks, Effects, Interactions)
⌨️ Introduction to Chainlink Automation
⌨️ Implementing Chainlink Keepers - checkUpkeep
⌨️ Tests & Deploy Script Setup
⌨️ Mock Chainlink VRF Coordinator
⌨️ Tests & Deploy Script Continued
⌨️ Create Subscription from the UI
forge coverage --report debug⌨️ Getting Event Data into Foundry Scripts
vm.recordLogs⌨️ Passing the private key to vm.startBroadcast
(back to top) ⬆️
🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊
🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊
💻 Code: https://github.com/Cyfrin/foundry-erc20-cu
Learn how to build your own ERC20 like DAI, USDC, or WETH!
⌨️ Manually Creating an ERC20 Token
.github(back to top) ⬆️
💻 Code: https://github.com/Cyfrin/foundry-nft-cu
chisel⌨️ The issue with IPFS & HTTPS TokenURI NFTs
⌨️ SVG NFT: Debugging practice & some notes
⌨️ Advanced: EVM Opcodes, Encoding, and Calling
⌨️ Introduction to Encoding Function Calls Directly
⌨️ Introduction to Encoding Function Calls Recap
⌨️ Encoding Function Calls Directly
⌨️ Verifying Metamask Transactions
⌨️ (10:36:31) | Section 2 Recap
(back to top) ⬆️
💻 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.
⭐️ Section 3: DeFi Stablecoins
⌨️ What is a stablecoin (But actually)
⌨️ DecentralizedStableCoin.sol
⌨️ Getting the value of our collateral
⌨️ depositCollateralAndMintDsc
⌨️ Leveling up your testing skillz
⌨️ Create the collateral redeemal handler
⌨️ DeFi Handler Deposit Collateral
mintDsc is never being called on our Handler.sol(back to top) ⬆️
💻 Code: https://github.com/Cyfrin/foundry-cross-chain-rebase-token-cu
⌨️ Introduction and Code Walkthrough
⌨️ Rebase token code structure
⌨️ Writing the rebase token contract
⌨️ mintInterest and burn functions
⌨️ Finish rebase token contract
⌨️ Vulnerabilities and cross-chain intro
## Circle CCTP
🔄 Update: This project previously used the smartcontractkit/ccip repository.
🆕 You should now use the updated, more actively maintained smartcontractkit/chainlink repository instead.
To ensure clean and maintainable import paths, use the following remappings in your foundry.toml or a separate remappings.txt file:
remappings = [
'@openzeppelin/=lib/openzeppelin-contracts/',
'@chainlink/=lib/chainlink/',
]
⌨️ Chainlink local and fork testing
⌨️ Token and pool deployer script
⌨️ Cross chain message received
💻 Code: https://github.com/Cyfrin/foundry-merkle-airdrop-cu
⌨️ Adding Signature Verification
⌨️ Transaction Types Introduction
💻 Code: https://github.com/Cyfrin/foundry-upgrades-cu
⭐️ Section 5: Upgradable Contracts & Proxies
(back to top) ⬆️
💻 Code: https://github.com/Cyfrin/minimal-account-abstraction
⌨️ Account Abstraction Introduction
⌨️ Ethereum Account Abstraction
⌨️ Get Unsigned PackedUserOperation
⌨️ ZKsync Transaction Simulations
⌨️ executeTransactionFromOutside
Plutocracy is bad! Don't default to ERC20 token voting!!
💻 Code: https://github.com/Cyfrin/foundry-dao-cu
⭐️ Section 14 | DAOs & Governance
⌨️ DAOs tooling - Special Guest from Aragon
⌨️ Creating the Governor Contract
⌨️ Testing the Governor Contract
(back to top) ⬆️
Developers 100% should know all about this! Don't leave the course without at least watching this section!
[!IMPORTANT] PLEASE AT LEAST WATCH THE DOCKER CONTAINER SECTION OF THIS CURRICULUM!! You can find a shorter video of the docker curriculum here. We highly recommend you head over to the end-to-end Cyfrin Updraft Security and Auditing Curriculum.
🖥️ Code: https://github.com/PatrickAlphaC/denver-security
⭐️ Section 6 | Security & Auditing
⌨️ What is a smart contract audit?
⌨️ What tools do security professionals use?
(back to top) ⬆️
🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊 Completed all The Course! 🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊
Be sure to check out project grant programs!
And make today an amazing day!
(back to top) ⬆️
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) ⬆️
A huge thank you to our sponsors. These are the groups and technologies:
(back to top) ⬆️
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!
Cyfrin Updraft content is open-sourced licensed as GPLv3.
(back to top) ⬆️
44 followers · starred Sep 2023
65 followers · starred Dec 2023
55 followers · starred Aug 2024
44 followers · starred Dec 2023
Entire course and video content updated June 15, 2024
Learn smart contract development, and level up your career
Welcome to the repository for the Blockchain Developer, Smart Contract, & Solidity Cyfrin Updraft - Career Path
| Powered By AI |
| Beginner to Expert Path |
| Foundry Edition 2024 |
This repository houses course resources and discussions for the course.
Please refer to this for an in-depth explanation of the content:
Cyfrin Updraft Courses:
All the sections on this repo are for several courses on the Solidity Developer Career path of Cyfrin Updraft.
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.
⚠️ 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.
**Note: Given the frequency of exploits through Cursor extensions, we cannot recommend the IDE, at this time.
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.
IF YOU DECIDE TO MINT THE REAL NFT:
(back to top) ⬆️
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
💻 Code: https://github.com/cyfrin/remix-simple-storage-cu
⭐️ Welcome to Remix - Simple Storage
⌨️ Setting Up Your First Contract
uint256, int256, bool, string, address, bytes32⌨️ Basic Solidity Arrays & Structs
push array function⌨️ Basic Solidity Errors & Warnings
⌨️ Basic Solidity Memory, Storage, & Calldata (Intro)
⌨️ Deploying your First Contract
⌨️ The EVM & A Recap of Section 2
(back to top) ⬆️
💻 Code: https://github.com/cyfrin/remix-storage-factory-cu
⭐️ Section 2 | Storage Factory
⌨️ Importing Contracts into other Contracts
⌨️ Interacting with other contracts
(back to top) ⬆️
💻 Code: https://github.com/Cyfrin/remix-fund-me-cu
⌨️ Sending ETH through a function
⌨️ Getting real world price data (Chainlink)
⌨️ Importing from NPM / GitHub
⌨️ Getting Prices from Chainlink
/* */ is another way to make comments⌨️ Receive & Fallback Functions
(back to top) ⬆️
DO NOT SKIP THIS!!
(back to top) ⬆️
💻 Code: https://github.com/Cyfrin/foundry-simple-storage-cu
⭐️ Foundry Simple Storage Introduction
⌨️ Installation & Setup (MacOS & Linux)
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash⚠️ Please use Gitpod as an absolute last resort
CMD + K or CTRL + K clears the terminalcode . to open VSCode in a new VSCode windowmkdir foundry-cucd foundry-cumkdir foundry-simple-storage-cu⌨️ Foundry Setup ⌨️ Foundry Setup II (WSL)
⌨️ Formatting Solidity in VSCode
settings.json "[solidity]": {
"editor.defaultFormatter": "NomicFoundation.hardhat-solidity"
},
"[javascript]":{
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
⌨️ Deploying to a local chain I (Anvil or Ganache)
⌨️ Adding another network to Metamask
⌨️ Deploying to a local chain II (Forge Create)
forge createforge scripthistory -c⌨️ Deploying to a local chain III (Forge Script)
⌨️ What is a transaction (But actually)
cast --to-base 0x01 dec
cast sendsource .envCan you Encrypt a Private Key -> a keystore in foundry yet??
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
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 Sepolia
⌨️ Verifying a contract the manual way
forge fmtREADME.md(back to top) ⬆️
💻 Code: https://github.com/Cyfrin/foundry-fund-me-cu
forge install smartcontractkit/chainlink-brownie-contracts@0.6.1
-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 II: Helper Config
⌨️ Refactoring III: Mocking (continued)
forge snapshotvm.txGasPricegasLeft()tx.getpricecast storage
s_ to storage variablesi_ to immutable variables⌨️ Gas: Cheaper Withdraw (continued)
.gitignore
.envlib/broadcast/⌨️ (2:34:56) | Tweet Me (add your repo in)!
(back to top) ⬆️
💻 Code: https://github.com/Cyfrin/html-fund-me-cu
⌨️ How Metamask works with your browser
⌨️ Introduction to function selectors
(back to top) ⬆️
⭐️ Section 4: Smart Contract Lottery
💻 Code: https://github.com/Cyfrin/foundry-smart-contract-lottery-cu
// Layout of Contract:
// license
// version
// imports
// errors
// interfaces, libraries, contracts
// Type declarations
// State variables
// Events
// Modifiers
// Functions
// Layout of Functions:
// constructor
// receive function (if exists)
// fallback function (if exists)
// external
// public
// internal
// private
// internal & private view & pure functions
// external & public view & pure functions
- Chainlink VRFv2 Docs
- Chainlink VRFv2 Walkthrough
- Chainlink Contracts
⌨️ Implementing Chainlink VRF - Introduction
forge install smartcontractkit/chainlink-brownie-contracts@1.1.1
⌨️ CEI (Checks, Effects, Interactions)
⌨️ Introduction to Chainlink Automation
⌨️ Implementing Chainlink Keepers - checkUpkeep
⌨️ Tests & Deploy Script Setup
⌨️ Mock Chainlink VRF Coordinator
⌨️ Tests & Deploy Script Continued
⌨️ Create Subscription from the UI
forge coverage --report debug⌨️ Getting Event Data into Foundry Scripts
vm.recordLogs⌨️ Passing the private key to vm.startBroadcast
(back to top) ⬆️
🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊
🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊
💻 Code: https://github.com/Cyfrin/foundry-erc20-cu
Learn how to build your own ERC20 like DAI, USDC, or WETH!
⌨️ Manually Creating an ERC20 Token
.github(back to top) ⬆️
💻 Code: https://github.com/Cyfrin/foundry-nft-cu
chisel⌨️ The issue with IPFS & HTTPS TokenURI NFTs
⌨️ SVG NFT: Debugging practice & some notes
⌨️ Advanced: EVM Opcodes, Encoding, and Calling
⌨️ Introduction to Encoding Function Calls Directly
⌨️ Introduction to Encoding Function Calls Recap
⌨️ Encoding Function Calls Directly
⌨️ Verifying Metamask Transactions
⌨️ (10:36:31) | Section 2 Recap
(back to top) ⬆️
💻 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.
⭐️ Section 3: DeFi Stablecoins
⌨️ What is a stablecoin (But actually)
⌨️ DecentralizedStableCoin.sol
⌨️ Getting the value of our collateral
⌨️ depositCollateralAndMintDsc
⌨️ Leveling up your testing skillz
⌨️ Create the collateral redeemal handler
⌨️ DeFi Handler Deposit Collateral
mintDsc is never being called on our Handler.sol(back to top) ⬆️
💻 Code: https://github.com/Cyfrin/foundry-cross-chain-rebase-token-cu
⌨️ Introduction and Code Walkthrough
⌨️ Rebase token code structure
⌨️ Writing the rebase token contract
⌨️ mintInterest and burn functions
⌨️ Finish rebase token contract
⌨️ Vulnerabilities and cross-chain intro
## Circle CCTP
🔄 Update: This project previously used the smartcontractkit/ccip repository.
🆕 You should now use the updated, more actively maintained smartcontractkit/chainlink repository instead.
To ensure clean and maintainable import paths, use the following remappings in your foundry.toml or a separate remappings.txt file:
remappings = [
'@openzeppelin/=lib/openzeppelin-contracts/',
'@chainlink/=lib/chainlink/',
]
⌨️ Chainlink local and fork testing
⌨️ Token and pool deployer script
⌨️ Cross chain message received
💻 Code: https://github.com/Cyfrin/foundry-merkle-airdrop-cu
⌨️ Adding Signature Verification
⌨️ Transaction Types Introduction
💻 Code: https://github.com/Cyfrin/foundry-upgrades-cu
⭐️ Section 5: Upgradable Contracts & Proxies
(back to top) ⬆️
💻 Code: https://github.com/Cyfrin/minimal-account-abstraction
⌨️ Account Abstraction Introduction
⌨️ Ethereum Account Abstraction
⌨️ Get Unsigned PackedUserOperation
⌨️ ZKsync Transaction Simulations
⌨️ executeTransactionFromOutside
Plutocracy is bad! Don't default to ERC20 token voting!!
💻 Code: https://github.com/Cyfrin/foundry-dao-cu
⭐️ Section 14 | DAOs & Governance
⌨️ DAOs tooling - Special Guest from Aragon
⌨️ Creating the Governor Contract
⌨️ Testing the Governor Contract
(back to top) ⬆️
Developers 100% should know all about this! Don't leave the course without at least watching this section!
[!IMPORTANT] PLEASE AT LEAST WATCH THE DOCKER CONTAINER SECTION OF THIS CURRICULUM!! You can find a shorter video of the docker curriculum here. We highly recommend you head over to the end-to-end Cyfrin Updraft Security and Auditing Curriculum.
🖥️ Code: https://github.com/PatrickAlphaC/denver-security
⭐️ Section 6 | Security & Auditing
⌨️ What is a smart contract audit?
⌨️ What tools do security professionals use?
(back to top) ⬆️
🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊 Completed all The Course! 🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊
Be sure to check out project grant programs!
And make today an amazing day!
(back to top) ⬆️
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) ⬆️
A huge thank you to our sponsors. These are the groups and technologies:
(back to top) ⬆️
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!
Cyfrin Updraft content is open-sourced licensed as GPLv3.
(back to top) ⬆️
44 followers · starred Sep 2023
65 followers · starred Dec 2023
55 followers · starred Aug 2024
44 followers · starred Dec 2023