├── .github └── ISSUE_TEMPLATE │ ├── code_mistake.yml │ ├── config.yml │ ├── repo_enhancement.yml │ └── video_mistake.yml ├── .gitignore ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── README.md ├── chronological-updates.md ├── how-to-answer-a-question.md ├── how-to-ask-a-question.md └── img ├── blockchain1.png ├── ganache-windows.png └── hh-fcc-background.png /.github/ISSUE_TEMPLATE/code_mistake.yml: -------------------------------------------------------------------------------- 1 | name: Code Mistake 2 | description: File an issue with one of the code repositories. 3 | labels: ["code-bug"] 4 | body: 5 | - type: markdown 6 | attributes: 7 | value: | 8 | Please ensure that the bug has not already been filed in the issue tracker. 9 | 10 | Thanks for taking the time to report this bug! 11 | - type: dropdown 12 | attributes: 13 | label: Lesson 14 | description: Which lesson is this an issue for? 15 | multiple: false 16 | options: 17 | - Lesson 1 18 | - Lesson 2 19 | - Lesson 3 20 | - Lesson 4 21 | - Lesson 5 22 | - Lesson 6 23 | - Lesson 7 24 | - Lesson 8 25 | - Lesson 9 26 | - Lesson 10 27 | - Lesson 11 28 | - Lesson 12 29 | - Lesson 13 30 | - Lesson 14 31 | - Lesson 15 32 | - Lesson 16 33 | - Lesson 17 34 | - Lesson 18 35 | - Other (please describe) 36 | validations: 37 | required: true 38 | - type: input 39 | attributes: 40 | label: Could you please leave a link to the timestamp in the video where this error occurs? (You can right click a video and "copy video URL at current time") 41 | placeholder: "https://www.youtube.com/watch?v=M576WGiDBdQ&t=21247s" 42 | - type: dropdown 43 | attributes: 44 | label: Operating System 45 | description: What operating system are you on? 46 | options: 47 | - Windows 48 | - macOS (Intel) 49 | - macOS (Apple Silicon) 50 | - Linux 51 | - type: textarea 52 | attributes: 53 | label: Describe the bug 54 | description: Please include relevant code snippets as well if relevant. Remember to format! 55 | validations: 56 | required: true 57 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: true 2 | contact_links: 3 | - name: Anything Else 4 | url: https://github.com/smartcontractkit/full-blockchain-solidity-course-js/discussions 5 | about: For anything else that is a question about the course, looking to show off something cool, connect with other developers, or looking for support, please head over to the discussions tab! 6 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/repo_enhancement.yml: -------------------------------------------------------------------------------- 1 | name: Repo Enhancement 2 | description: If you have a suggestion on how to make this repository better, please let us know! 3 | labels: ["enhancement"] 4 | body: 5 | - type: textarea 6 | attributes: 7 | label: Describe the enhancement 8 | description: The more information the better! Thanks for making this issue! 9 | validations: 10 | required: true 11 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/video_mistake.yml: -------------------------------------------------------------------------------- 1 | name: Video Mistake 2 | description: File an issue when Patrick made a mistake in the video. 3 | labels: ["video-bug"] 4 | body: 5 | - type: markdown 6 | attributes: 7 | value: | 8 | Please ensure that the bug has not already been filed in the issue tracker. 9 | 10 | Thanks for taking the time to report this bug! 11 | - type: dropdown 12 | attributes: 13 | label: Lesson 14 | description: Which lesson is this an issue for? 15 | multiple: false 16 | options: 17 | - Lesson 1 18 | - Lesson 2 19 | - Lesson 3 20 | - Lesson 4 21 | - Lesson 5 22 | - Lesson 6 23 | - Lesson 7 24 | - Lesson 8 25 | - Lesson 9 26 | - Lesson 10 27 | - Lesson 11 28 | - Lesson 12 29 | - Lesson 13 30 | - Lesson 14 31 | - Lesson 15 32 | - Lesson 16 33 | - Lesson 17 34 | - Lesson 18 35 | - Other (please describe) 36 | validations: 37 | required: true 38 | - type: input 39 | attributes: 40 | label: Could you please leave a link to the timestamp in the video where this error occurs? (You can right click a video and "copy video URL at current time") 41 | placeholder: "https://www.youtube.com/watch?v=M576WGiDBdQ&t=21247s" 42 | - type: textarea 43 | attributes: 44 | label: Describe the bug 45 | description: Please include relevant code snippets as well if relevant. Remember to format! 46 | validations: 47 | required: true 48 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | script.md 2 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | We as members, contributors, and leaders pledge to make participation in our 6 | community a harassment-free experience for everyone, regardless of age, body 7 | size, visible or invisible disability, ethnicity, sex characteristics, gender 8 | identity and expression, level of experience, education, socio-economic status, 9 | nationality, personal appearance, race, religion, or sexual identity 10 | and orientation. 11 | 12 | We pledge to act and interact in ways that contribute to an open, welcoming, 13 | diverse, inclusive, and healthy community. 14 | 15 | ## Our Standards 16 | 17 | Examples of behavior that contributes to a positive environment for our 18 | community include: 19 | 20 | * Demonstrating empathy and kindness toward other people 21 | * Being respectful of differing opinions, viewpoints, and experiences 22 | * Giving and gracefully accepting constructive feedback 23 | * Accepting responsibility and apologizing to those affected by our mistakes, 24 | and learning from the experience 25 | * Focusing on what is best not just for us as individuals, but for the 26 | overall community 27 | 28 | Examples of unacceptable behavior include: 29 | 30 | * The use of sexualized language or imagery, and sexual attention or 31 | advances of any kind 32 | * Trolling, insulting or derogatory comments, and personal or political attacks 33 | * Public or private harassment 34 | * Publishing others' private information, such as a physical or email 35 | address, without their explicit permission 36 | * Other conduct which could reasonably be considered inappropriate in a 37 | professional setting 38 | 39 | ## Enforcement Responsibilities 40 | 41 | Community leaders are responsible for clarifying and enforcing our standards of 42 | acceptable behavior and will take appropriate and fair corrective action in 43 | response to any behavior that they deem inappropriate, threatening, offensive, 44 | or harmful. 45 | 46 | Community leaders have the right and responsibility to remove, edit, or reject 47 | comments, commits, code, wiki edits, issues, and other contributions that are 48 | not aligned to this Code of Conduct, and will communicate reasons for moderation 49 | decisions when appropriate. 50 | 51 | ## Scope 52 | 53 | This Code of Conduct applies within all community spaces, and also applies when 54 | an individual is officially representing the community in public spaces. 55 | Examples of representing our community include using an official e-mail address, 56 | posting via an official social media account, or acting as an appointed 57 | representative at an online or offline event. 58 | 59 | ## Enforcement 60 | 61 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 62 | reported to the community leaders responsible for enforcement at 63 | . 64 | All complaints will be reviewed and investigated promptly and fairly. 65 | 66 | All community leaders are obligated to respect the privacy and security of the 67 | reporter of any incident. 68 | 69 | ## Enforcement Guidelines 70 | 71 | Community leaders will follow these Community Impact Guidelines in determining 72 | the consequences for any action they deem in violation of this Code of Conduct: 73 | 74 | ### 1. Correction 75 | 76 | **Community Impact**: Use of inappropriate language or other behavior deemed 77 | unprofessional or unwelcome in the community. 78 | 79 | **Consequence**: A private, written warning from community leaders, providing 80 | clarity around the nature of the violation and an explanation of why the 81 | behavior was inappropriate. A public apology may be requested. 82 | 83 | ### 2. Warning 84 | 85 | **Community Impact**: A violation through a single incident or series 86 | of actions. 87 | 88 | **Consequence**: A warning with consequences for continued behavior. No 89 | interaction with the people involved, including unsolicited interaction with 90 | those enforcing the Code of Conduct, for a specified period of time. This 91 | includes avoiding interactions in community spaces as well as external channels 92 | like social media. Violating these terms may lead to a temporary or 93 | permanent ban. 94 | 95 | ### 3. Temporary Ban 96 | 97 | **Community Impact**: A serious violation of community standards, including 98 | sustained inappropriate behavior. 99 | 100 | **Consequence**: A temporary ban from any sort of interaction or public 101 | communication with the community for a specified period of time. No public or 102 | private interaction with the people involved, including unsolicited interaction 103 | with those enforcing the Code of Conduct, is allowed during this period. 104 | Violating these terms may lead to a permanent ban. 105 | 106 | ### 4. Permanent Ban 107 | 108 | **Community Impact**: Demonstrating a pattern of violation of community 109 | standards, including sustained inappropriate behavior, harassment of an 110 | individual, or aggression toward or disparagement of classes of individuals. 111 | 112 | **Consequence**: A permanent ban from any sort of public interaction within 113 | the community. 114 | 115 | ## Attribution 116 | 117 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], 118 | version 2.0, available at 119 | https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. 120 | 121 | Community Impact Guidelines were inspired by [Mozilla's code of conduct 122 | enforcement ladder](https://github.com/mozilla/diversity). 123 | 124 | [homepage]: https://www.contributor-covenant.org 125 | 126 | For answers to common questions about this code of conduct, see the FAQ at 127 | https://www.contributor-covenant.org/faq. Translations are available at 128 | https://www.contributor-covenant.org/translations. 129 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # How do I make a contribution? 2 | 3 | Never made an open-source contribution before? Wondering how contributions work in this project? Here's a quick run-down! 4 | 5 | - Find an issue that you want to address or a feature that you want to add. 6 | 7 | - Fork the repository associated with the issue to your local GitHub organization. This means that you will have a copy of the repository under `your-GitHub-username/repository-name`. 8 | 9 | - Clone the forked repository to your local machine using `git clone https://github.com/github-username/repository-name.git`. E.g. for a repo named "xyzRepo", the user can run https://github.com/github-username/xyzRepo.git. 10 | 11 | - Create a new branch for your fix using `git checkout -b branch-name-here`. E.g `git checkout -b main` 12 | 13 | - Make the appropriate changes for the issue you are trying to address or the feature that you want to add. 14 | 15 | - Use `git add insert-paths-of-changed-files-here` to add the file contents of the changed files to the "snapshot" git uses to manage the state of the project, also known as the index. 16 | 17 | - Use `git commit -m "Insert a short message of the changes made here"` to store the contents of the index with a descriptive message. 18 | 19 | - Push the changes to the remote repository using `git push origin branch-name-here`. 20 | 21 | - Submit a pull request to the upstream repository. 22 | 23 | - Title the pull request with a short description of the changes made and the issue or bug number associated with your change. For example, you can title an issue like so **"Added more log outputting to resolve #4352"**. 24 | 25 | - In the description of the pull request, explain the changes that you made, any issues you think exist with the pull request you made, and any questions you have for the maintainer. It's OK if your pull request is not perfect (no pull request is), the reviewer will be able to help you fix any problems and improve it! 26 | 27 | - Wait for the pull request to be reviewed by a maintainer. 28 | 29 | - Make changes to the pull request if the reviewing maintainer recommends them. 30 | 31 | - Celebrate your success after your pull request is merged! 32 | 33 | # Where can I go for help? 34 | 35 | If you need help, you can ask questions on our **discussions** tab. 36 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Update: Head to Cyfrin Updraft 2 | 3 | > **ℹ️ Important:** 4 | > This repo is no longer actively maintained as there have been changes in Hardhat tooling. The video is out of sync with the code, and you can still follow along with the video, but you will likely need to troubleshoot the changes in the tooling and dependencies. Note also that best practices have evolved since this video was made. 5 | > If you'd like to continue your training with more up-to-date material, you can take a look at [Cyfrin Updraft](https://updraft.cyfrin.io/). That content is developed with love by Patrick & Cyfrin <3. However note that Cyfrin Updraft training uses Foundry, not Hardhat, so there will be tooling changes involved. 6 | 7 | # Web3, Full Stack Solidity, Smart Contract & Blockchain - Beginner to Expert ULTIMATE Course | Javascript Edition 8 | 9 |
10 |

11 | 12 | Solidity, Blockchain, and Smart Contract Course – Beginner to Expert Javascript Tutorial 13 | 14 |

15 |
16 | 17 | Welcome to the repository for the Ultimate Web3, Full Stack Solidity, and Smart Contract - Beginner to Expert Full Course | Javascript Edition FreeCodeCamp Course! 18 | 19 | # Link to video: https://www.youtube.com/watch?v=gyMwXuJrbJQ 20 | 21 | All code references have both a javascript and a typescript edition. 22 | 23 | Recommended Testnet: Sepolia 24 | 25 | _We have updated the repos to work with Sepolia due to Rinkeby and Kovan being sunset, and Goerli being a disaster. Let us know if any of the changes break stuff!_ 26 | 27 | # [Testnet Faucets](https://faucets.chain.link) 28 | 29 | Main Faucet: https://faucets.chain.link 30 | Backup Faucet: https://sepoliafaucet.com/ 31 | 32 | > ⚠️ 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. 33 | 34 | # Resources For This Course 35 | 36 | ### Questions 37 | 38 | - [Github Discussions](https://github.com/smartcontractkit/full-blockchain-solidity-course-js/discussions) 39 | - Ask questions and chat about the course here! 40 | - [Stack Exchange Ethereum](https://ethereum.stackexchange.com/) 41 | - Great place for asking technical questions about Ethereum 42 | - [StackOverflow](https://stackoverflow.com/) 43 | - Great place for asking technical questions overall 44 | 45 | # Table of Contents 46 | 47 |
48 | Resources 49 |
    50 |
  1. Testnet Faucets
  2. 51 |
  3. Resources For This Course 54 |
  4. 55 |
  5. Table of Contents
  6. 56 |
57 |
58 |
59 | Lesson 0: The Edge of the Rabbit Hole 60 |
    61 |
  1. 62 | Welcome to the course! 63 |
  2. 64 |
  3. 65 | Best Practices 66 |
  4. 67 |
68 |
69 |
70 | Lesson 1: Blockchain Basics 71 |
    72 |
  1. 73 | What is a Blockchain? What does a blockchain do? 74 |
  2. 75 |
  3. The Purpose Of Smart Contracts
  4. 76 |
  5. Other Blockchain Benefits
  6. 77 |
  7. What have Smart Contracts done so far?
  8. 78 |
  9. Making Your First Transaction
  10. 79 |
  11. Gas I: Introduction to Gas
  12. 80 |
  13. How Do Blockchains Work?
  14. 81 |
  15. Signing Transactions
  16. 82 |
  17. Gas II
  18. 83 |
  19. High-Level Blockchain Fundamentals
  20. 84 |
85 |
86 |
87 | Lesson 2: Welcome to Remix! Simple Storage 88 |
    89 |
  1. Introduction
  2. 90 |
  3. Setting Up Your First Contract
  4. 91 |
  5. Basic Solidity: Types
  6. 92 |
  7. Basic Solidity: Functions
  8. 93 |
  9. Basic Solidity: Arrays & Structs
  10. 94 |
  11. Basic Solidity: Compiler Errors and Warnings
  12. 95 |
  13. Memory, Storage, Calldata (Intro)
  14. 96 |
  15. Mappings
  16. 97 |
  17. Deploying your First Contract
  18. 98 |
  19. The EVM & A Recap of Lesson 2
  20. 99 |
100 |
101 |
102 | Lesson 3: Remix Storage Factory 103 |
    104 |
  1. Introduction
  2. 105 |
  3. Basic Solidity: Importing Contracts into other Contracts
  4. 106 |
  5. Basic Solidity: Interacting with other Contracts
  6. 107 |
  7. Basic Solidity: Inheritance & Overrides
  8. 108 |
  9. Lesson 3 Recap
  10. 109 |
110 |
111 |
112 | Lesson 4: Remix Fund Me 113 |
    114 |
  1. Introduction
  2. 115 |
  3. Sending ETH Through a Function & Reverts
  4. 116 |
  5. Chainlink & Oracles
  6. 117 |
  7. Review of Sending ETH and working with Chainlink
  8. 118 |
  9. Interfaces & Price Feeds
  10. 119 |
  11. Importing from GitHub & NPM
  12. 120 |
  13. Floating Point Math in Solidity
  14. 121 |
  15. Basic Solidity: Arrays & Structs II
  16. 122 |
  17. Review of Interfacs, Importing from GitHub, & Math in Solidity
  18. 123 |
  19. Libraries
  20. 124 |
  21. SafeMath, Overflow Checking, and the "unchecked" keywork
  22. 125 |
  23. Basic Solidity: For Loop
  24. 126 |
  25. Basic Solidity: Resetting an Array
  26. 127 |
  27. Sending ETH from a Contract
  28. 128 |
  29. Basic Solidity: Constructor
  30. 129 |
  31. Basic Solidity: Modifiers
  32. 130 |
  33. Testnet Demo
  34. 131 |
  35. Advanced Solidity
137 |
138 |
139 | Lesson 5: Ethers.js Simple Storage 140 |
    141 |
  1. Effective Debugging Strategies & Getting Help 144 |
  2. 145 |
  3. Installation & Setup 150 |
  4. 151 |
  5. Local Development Introduction 154 |
  6. 155 |
  7. Tiny Javascript Refresher
  8. 156 |
  9. Asynchronous Programming in Javascript
  10. 157 |
  11. Compiling our Solidity
  12. 158 |
  13. Ganache & Networks
  14. 159 |
  15. Introduction to Ethers.js 162 |
  16. 163 |
  17. Adding Transaction Overrides
  18. 164 |
  19. Transaction Receipts
  20. 165 |
  21. Sending a "raw" Transaction in Ethersjs
  22. 166 |
  23. Interacting with Contracts in Ethersjs
  24. 167 |
  25. Environment Variables
  26. 168 |
  27. Better Private Key Management
  28. 169 |
  29. Optional Prettier Formatting
  30. 170 |
  31. Deploying to a Testnet or a Mainnet
  32. 171 |
  33. Verifying on Block Explorers from the UI
  34. 172 |
  35. Alchemy Dashboard & The Mempool
  36. 173 |
  37. Lesson 5 Recap 176 |
  38. 177 |
178 |
179 |
180 | Lesson 6: Hardhat Simple Storage 181 |
    182 |
  1. Introduction
  2. 183 |
  3. Hardhat Setup 186 |
  4. 187 |
  5. Hardhat Setup Continued
  6. 188 |
  7. Deploying SimpleStorage from Hardhat
  8. 189 |
  9. Networks in Hardhat
  10. 190 |
  11. Programatic Verification
  12. 191 |
  13. Interacting with Contracts in Hardhat
  14. 192 |
  15. Artifacts Troubleshooting
  16. 193 |
  17. Custom Hardhat Tasks
  18. 194 |
  19. Hardhat Localhost Node
  20. 195 |
  21. The Hardhat Console
  22. 196 |
  23. Hardhat Tests
  24. 197 |
  25. Hardhat Gas Reporter
  26. 198 |
  27. Solidity Coverage
  28. 199 |
  29. Hardhat Waffle
  30. 200 |
  31. Lesson 6 Recap 203 |
  32. 204 |
205 |
206 |
207 | Lesson 7: Hardhat Fund Me 208 |
    209 |
  1. Introduction
  2. 210 |
  3. Hardhat Setup - Fund Me
  4. 211 |
  5. Linting
  6. 212 |
  7. Hardhat Setup - Fund Me - Continued
  8. 213 |
  9. Importing from NPM
  10. 214 |
  11. Hardhat Deploy
  12. 215 |
  13. Mocking
  14. 216 |
  15. Utils Folder
  16. 217 |
  17. Testnet Demo - Hardhat Fund Me
  18. 218 |
  19. Solidity Style Guide
  20. 219 |
  21. Testing Fund Me
  22. 220 |
  23. Breakpoints & Debugging
  24. 221 |
  25. Gas III:
  26. 222 |
  27. console.log & Debugging
  28. 223 |
  29. Testing Fund Me II
  30. 224 |
  31. Storage in Solidity
  32. 225 |
  33. Gas Optimizations using Storage Knowledge
  34. 226 |
  35. Solidity Chainlink Style Guide
  36. 227 |
  37. Storage Review
  38. 228 |
  39. Staging Tests
  40. 229 |
  41. Running Scripts on a Local Node
  42. 230 |
  43. Adding Scripts to your package.json
  44. 231 |
  45. Pushing to GitHub
  46. 232 |
  47. 🐸🐦 Tweet Me (add your repo in)!
  48. 233 |
234 |
235 |
236 | Lesson 8: HTML / Javascript Fund Me (Full Stack / Front End) 237 |
    238 |
  1. Introduction
  2. 239 |
  3. How Websites work with Web3 Wallets
  4. 240 |
  5. HTML Setup
  6. 241 |
  7. Connecting HTML to Metamask
  8. 242 |
  9. Javascript in it's own file
  10. 243 |
  11. ES6 vs Nodejs
  12. 244 |
  13. Sending a transaction from a Website
  14. 245 |
  15. Resetting an Account in Metamask
  16. 246 |
  17. Listening for Events and Completed Transactions
  18. 247 |
  19. Input Forms
  20. 248 |
  21. Reading from the Blockchain
  22. 249 |
  23. Withdraw Function
  24. 250 |
  25. Lesson 8 Recap 253 |
  26. 254 |
255 |
256 |
257 | Lesson 9: Hardhat Smart Contract Lottery 258 |
    259 |
  1. Introduction
  2. 260 |
  3. Hardhat Setup - Smart Contract Lottery
  4. 261 |
  5. Raffle.sol Setup
  6. 262 |
  7. Introduction to Events
  8. 263 |
  9. Events in Raffle.sol
  10. 264 |
  11. Introduction to Chainlink VRF 267 |
  12. 268 |
  13. Implementing Chainlink VRF - Introduction 271 |
  14. 272 |
  15. Implementing Chainlink VRF - The Request
  16. 273 |
  17. Implementing Chainlink VRF - The FulFill 276 |
  18. 277 |
  19. Introduction to Chainlink Keepers
  20. 278 |
  21. Implementing Chainlink Keepers - checkUpkeep 281 |
  22. 282 |
  23. Implementing Chainlink Keepers - checkUpkeep continued
  24. 283 |
  25. Implementing Chainlink Keepers - performUpkeep
  26. 284 |
  27. Code Cleanup
  28. 285 |
  29. Deploying Raffle.sol 289 |
  30. 290 |
  31. Raffle.sol Unit Tests 294 |
  32. 295 |
  33. Hardhat Methods & Time Travel 298 |
  34. 299 |
  35. Callstatic 304 |
  36. 305 |
  37. Raffle.sol Staging Tests
  38. 306 |
  39. Testing on a Testnet 309 |
  40. 310 |
  41. Conclusion
  42. 311 |
  43. Typescript - Smart Contract Lottery
  44. 312 |
313 |
314 |
315 | Lesson 10: NextJS Smart Contract Lottery (Full Stack / Front End) 316 |
    317 |
  1. Introduction 320 |
  2. 321 |
  3. NextJS Setup
  4. 322 |
  5. Manual Header I 325 |
  6. 326 |
  7. Manual Header II
  8. 327 |
  9. useEffect Hook
  10. 328 |
  11. Local Storage
  12. 329 |
  13. isWeb3EnabledLoading
  14. 330 |
  15. web3uikit
  16. 331 |
  17. Introduction to Calling Functions in Nextjs 335 |
  18. 336 |
  19. useState
  20. 337 |
  21. Calling Functions in NextJS
  22. 338 |
  23. useNotification
  24. 339 |
  25. Reading & Displaying Contract Data
  26. 340 |
  27. A Note about onSuccess
  28. 341 |
  29. A Challenge to You
  30. 342 |
  31. Tailwind & Styling
  32. 343 |
  33. Introduction to Hosting your Site
  34. 344 |
  35. IPFS
  36. 345 |
  37. Hosting on IPFS
  38. 346 |
  39. Hosting on IPFS & Filecoin using Fleek
  40. 347 |
  41. Filecoin Overview
  42. 348 |
  43. Lesson 10 Recap
  44. 349 |
350 |
351 |
352 | Lesson 11: Hardhat Starter Kit 353 |
    354 |
355 |
356 | Lesson 12: Hardhat ERC20s 357 |
    358 |
  1. What is an ERC? What is an EIP?
  2. 359 |
  3. What is an ERC20?
  4. 360 |
  5. Manually Creating an ERC20 Token
  6. 361 |
  7. Creating an ERC20 Token with Openzeppelin
  8. 362 |
  9. Lesson 12 Recap
  10. 363 | 364 |
365 |
366 |
367 | Lesson 13: Hardhat DeFi & Aave 368 |
    369 |
  1. What is DeFi?
  2. 370 |
  3. What is Aave?
  4. 371 |
  5. Programatic Borrowing & Lending
  6. 372 |
  7. WETH - Wrapped ETH
  8. 373 |
  9. Forking Mainnet
  10. 374 |
  11. Depositing into Aave
  12. 375 |
  13. Borrowing from Aave
  14. 376 |
  15. Repaying with Aave
  16. 377 |
  17. Visualizing the Transactions
  18. 378 |
  19. Lesson 13 Recap
  20. 379 |
  21. Happy Bow-Tie Friday with Austin Griffith 382 |
  22. 383 | 384 |
385 |
386 |
387 | Lesson 14: Hardhat NFTs (EVERYTHING you need to know about NFTs) 388 |
    389 |
  1. What is an NFT?
  2. 390 |
  3. Code Overview
  4. 391 |
  5. Hardhat Setup
  6. 392 |
  7. Basic NFT 395 |
  8. 396 |
  9. Random IPFS NFT 407 |
  10. 408 |
  11. Dynamic SVG On-Chain NFT 413 |
  12. 414 |
  13. Advanced: EVM Opcodes, Encoding, and Calling 423 |
  14. 424 |
  15. Deploying the NFTs to a Testnet
  16. 425 |
  17. Lesson 14 Recap
  18. 426 | 427 |
428 |
429 |
430 | Lesson 15: NextJS NFT Marketplace (If you finish this lesson, you are a full-stack MONSTER!) 431 |
    432 |
  1. Introduction
  2. 433 |
  3. Part I: NFT Marketplace Contracts 437 |
  4. 438 |
  5. Reentrancy 444 |
  6. 445 |
  7. Part II: Moralis Front End 466 |
  8. 467 |
  9. Part III: TheGraph Front End 475 |
  10. 476 | 477 |
478 |
479 |
480 | Lesson 16: Hardhat Upgrades 481 |
    482 |
  1. Upgradeable Smart Contracts Overview
  2. 483 |
  3. Types of Upgrades
  4. 484 |
  5. Delegatecall
  6. 485 |
  7. Small Proxy Example
  8. 486 |
  9. Transparent Upgradeable Smart Contract
  10. 487 | 488 |
489 |
490 |
491 | Lesson 17: Hardhat DAOs 492 |
    493 |
  1. Introduction
  2. 494 |
  3. What is a DAO?
  4. 495 |
  5. How to build a DAO
  6. 496 |
497 |
498 |
499 | Lesson 18: Security & Auditing 500 |
    501 |
  1. Introduction
  2. 502 |
  3. Slither
  4. 503 |
  5. Fuzzing and Eth Security Toolbox
  6. 504 |
  7. Closing Thoughts
  8. 505 |
506 |
507 |
508 | More Resources 509 | 520 | 521 |
522 | 523 | # Lesson 0: The Edge of the Rabbit Hole 524 | 525 | ## Welcome to the course! 526 | 527 | _[⌨️ (00:00:00) Lesson 0: Welcome To Blockchain](https://www.youtube.com/watch?v=gyMwXuJrbJQ&t=0s)_ 528 | 529 | ## Best Practices 530 | 531 | - **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. 532 | - **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 :) 533 | - **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 534 | - **Take Breaks:** You will exhaust your mind and recall less if you go all out and watch the entire course in one sitting. 535 | **Suggested Strategy** every 25 minutes take a 5 min break, and every 2 hours take a longer 30 min break 536 | - **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. 537 | 538 | # Lesson 1: Blockchain Basics 539 | 540 | _[⌨️ (00:09:05) Lesson 1: Blockchain Basics](https://www.youtube.com/watch?v=gyMwXuJrbJQ&t=545s)_ 541 | 542 | ## What is a Blockchain? What does a blockchain do? 543 | 544 | - [Bitcoin Whitepaper](https://bitcoin.org/bitcoin.pdf) 545 | - [Satoshi Nakamoto](https://en.wikipedia.org/wiki/Satoshi_Nakamoto) 546 | - [Ethereum Whitepaper](https://ethereum.org/en/whitepaper/) 547 | - [Vitalik Buterin](https://en.wikipedia.org/wiki/Vitalik_Buterin) 548 | - [What is a Smart Contract?](https://chain.link/education/smart-contracts) 549 | - [Nick Szabo](https://en.wikipedia.org/wiki/Nick_Szabo) 550 | - [Hybrid Smart Contracts](https://blog.chain.link/hybrid-smart-contracts-explained/) 551 | - [Blockchain Oracles](https://betterprogramming.pub/what-is-a-blockchain-oracle-f5ccab8dbd72?source=friends_link&sk=d921a38466df8a9176ed8dd767d8c77d) 552 | - [Terminology](https://connect.comptia.org/content/articles/blockchain-terminology) 553 | - [Web3](https://en.wikipedia.org/wiki/Web3) 554 | - [What is a blockchain](https://www.investopedia.com/terms/b/blockchain.asp) 555 | 556 | ## The Purpose Of Smart Contracts 557 | 558 | _[⌨️ (00:18:27) The Purpose of Smart Contracts](https://youtu.be/gyMwXuJrbJQ?t=1107)_ 559 | 560 | - 🎥 [Original Video](https://www.youtube.com/watch?v=_JeRq7Gwj5Y&feature=youtu.be) 561 | - 🦬 [My ETH Denver Talk](https://www.youtube.com/watch?v=06hXCX_jj2E) 562 | - 🍔 [McDonalds Scandal](https://www.chicagotribune.com/sns-mcdonalds-story.html) 563 | - ⛓ [More on the evolution of agreements](https://www.youtube.com/watch?v=ufVyX7JDCgg) 564 | - ✍️ [What is a Smart Contract?](https://www.youtube.com/watch?v=ZE2HxTmxfrI) 565 | - 🧱 [How does a blockchain work?](https://www.youtube.com/watch?v=SSo_EIwHSd4) 566 | - 🔮 [Chainlink & Oracles](https://www.youtube.com/watch?v=tIUHQ7sDoaU) 567 | 568 | ## Other Blockchain Benefits 569 | 570 | _[⌨️ (00:30:41) Other Blockchain Benefits](https://youtu.be/gyMwXuJrbJQ?t=1841)_ 571 | 572 | - Decentralized 573 | - Transparency & Flexibility 574 | - Speed & Efficiency 575 | - Security & Immutability 576 | - Counterparty Risk Removal 577 | - Trust Minimized Agreements 578 | 579 | ## What have Smart Contracts done so far? 580 | 581 | _[⌨️ (00:36:36) What have Smart Contracts done so far?](https://youtu.be/gyMwXuJrbJQ?t=2196)_ 582 | 583 | - [DeFi](https://chain.link/education/defi) 584 | - [Defi Llama](https://defillama.com/) 585 | - [Why DeFi is Important](https://medium.com/the-capital/why-defi-1519cc4d4bd3) 586 | - [DAOs](https://betterprogramming.pub/what-is-a-dao-what-is-the-architecture-of-a-dao-how-to-build-a-dao-high-level-d096a97162cc) 587 | - [NFTs](https://www.youtube.com/watch?v=9yuHz6g_P50) 588 | 589 | ## Making Your First Transaction 590 | 591 | _[⌨️ (00:39:17) Making Your First Transaction](https://youtu.be/gyMwXuJrbJQ?t=2357)_ 592 | 593 | - [Metamask Download Link](https://metamask.io/) 594 | - [What is a Private Key?](https://www.coinbase.com/learn/crypto-basics/what-is-a-private-key) 595 | - [What is a Secret Phrase?](https://metamask.zendesk.com/hc/en-us/articles/360060826432-What-is-a-Secret-Recovery-Phrase-and-how-to-keep-your-crypto-wallet-secure) 596 | - [Etherscan](https://etherscan.io/) 597 | - [Sepolia Etherscan](https://sepolia.etherscan.io/) 598 | - Sepolia Faucet (Check the [link token contracts page](https://docs.chain.link/docs/link-token-contracts/#sepolia)) 599 | - NOTE: The Chainlink documentation always has the most up to date faucets on their [link token contracts page](https://docs.chain.link/docs/link-token-contracts/#sepolia). If the faucet above is broken, check the chainlink documentation for the most up to date faucet. 600 | - OR, use the [Sepolia ETH Faucet](https://faucets.chain.link/), just be sure to swap your metamask to Sepolia! 601 | 602 | ## Gas I: Introduction to Gas 603 | 604 | _[⌨️ (00:58:59) Gas I: Introduction to Gas](https://youtu.be/gyMwXuJrbJQ?t=3539)_ 605 | 606 | - [Gas and Gas Fees](https://ethereum.org/en/developers/docs/gas/) 607 | - [Wei, Gwei, and Ether Converter](https://eth-converter.com/) 608 | - [ETH Gas Station](https://ethgasstation.info/) 609 | 610 | ## How Do Blockchains Work? 611 | 612 | _[⌨️ (01:05:32) How Do Blockchains Work](https://youtu.be/gyMwXuJrbJQ?t=3932)_ 613 | 614 | - [What is a hash?](https://techjury.net/blog/what-is-cryptographic-hash/) 615 | - [Blockchain Demo](https://andersbrownworth.com/blockchain/) 616 | - [Summary](https://ethereum.org/en/developers/docs/intro-to-ethereum/) 617 | 618 | ## Signing Transactions 619 | 620 | _[⌨️ (01:22:55) Signing Transactions](https://youtu.be/gyMwXuJrbJQ?t=4975)_ 621 | 622 | - [Public / Private Keys](https://andersbrownworth.com/blockchain/public-private-keys/keys) 623 | - [Layer 2 and Rollups](https://ethereum.org/en/developers/docs/scaling/layer-2-rollups/) 624 | - [Decentralized Blockchain Oracles](https://blog.chain.link/what-is-the-blockchain-oracle-problem/) 625 | 626 | ## Gas II 627 | 628 | _[⌨️ (01:30:22) Gas II: Block Rewards & EIP 1559](https://youtu.be/gyMwXuJrbJQ?t=5422)_ 629 | 630 | - [Block Rewards](https://www.investopedia.com/terms/b/block-reward.asp) 631 | - Advanced Gas 632 | - [EIP 1559](https://www.youtube.com/watch?v=MGemhK9t44Q) 633 | - GWEI, WEI, and ETH 634 | - [ETH Converter](https://eth-converter.com/) 635 | 636 | ## Gas II Summary 637 | 638 | _[⌨️ (01:36:44) Gas II Summary](https://youtu.be/gyMwXuJrbJQ?t=5804)_ 639 | 640 | - [Run Your Own Ethereum Node](https://geth.ethereum.org/docs/getting-started) 641 | 642 | ## High-Level Blockchain Fundamentals 643 | 644 | _[⌨️ (01:39:32) High-Level Blockchain Fundamentals]https://www.youtube.com/watch?v=gyMwXuJrbJQ&t=5972s()_ 645 | 646 | - [Consensus](https://wiki.polkadot.network/docs/learn-consensus) 647 | - [Proof of Stake](https://ethereum.org/en/developers/docs/consensus-mechanisms/pos/) 648 | - [Proof of Work](https://ethereum.org/en/developers/docs/consensus-mechanisms/pow/) 649 | - [Nakamoto Consensus](https://blockonomi.com/nakamoto-consensus/) 650 | - [Ethereum 2 (the merge)](https://ethereum.org/en/eth2/) 651 | 652 | 🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊 Completed Blockchain Basics! 🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊 653 | 654 | # Lesson 2: [Welcome to Remix! Simple Storage](https://github.com/PatrickAlphaC/simple-storage-fcc) 655 | 656 | _[⌨️ (02:01:16) Lesson 2: Welcome to Remix! Simple Storage](https://www.youtube.com/watch?v=gyMwXuJrbJQ&t=7276s)_ 657 | 658 | 💻 Code: https://github.com/PatrickAlphaC/simple-storage-fcc 659 | 660 | ## Introduction 661 | 662 | _[⌨️ (02:03:05) Introduction](https://youtu.be/gyMwXuJrbJQ?t=7385)_ 663 | 664 | - [Remix](https://remix.ethereum.org/) 665 | - [Solidity Documentation](https://docs.soliditylang.org/en/latest/index.html) 666 | 667 | ## Setting Up Your First Contract 668 | 669 | _[⌨️ (02:05:18) Setting Up Your First Contract](https://youtu.be/gyMwXuJrbJQ?t=7518)_ 670 | 671 | - Versioning 672 | - Take notes in your code! 673 | - [What is a software license](https://snyk.io/learn/what-is-a-software-license/) 674 | - SPDX License 675 | - Compiling 676 | - Contract Declaration 677 | 678 | ## Basic Solidity: Types 679 | 680 | _[⌨️ (02:12:28) Basic Solidity Types](https://youtu.be/gyMwXuJrbJQ?t=7948)_ 681 | 682 | - [Types & Declaring Variables](https://docs.soliditylang.org/en/v0.8.13/) 683 | - `uint256`, `int256`, `bool`, `string`, `address`, `bytes32` 684 | - [Solidity Types](https://docs.soliditylang.org/en/latest/types.html) 685 | - [Bits and Bytes](https://www.youtube.com/watch?v=Dnd28lQHquU) 686 | - Default Initializations 687 | - Comments 688 | 689 | ## Basic Solidity: Functions 690 | 691 | _[⌨️ (02:18:40) Basic Solidity Functions](https://youtu.be/gyMwXuJrbJQ?t=8320)_ 692 | 693 | - Functions 694 | - Deploying a Contract 695 | - Smart Contracts have addresses just like our wallets 696 | - Calling a public state-changing Function 697 | - [Visibility](https://docs.soliditylang.org/en/latest/contracts.html#visibility-and-getters) 698 | - Gas III | An example 699 | - Scope 700 | - View & Pure Functions 701 | 702 | ## Basic Solidity: Arrays & Structs 703 | 704 | _[⌨️ (02:35:30) Basic Solidity Arrays & Structs](https://youtu.be/gyMwXuJrbJQ?t=9331)_ 705 | 706 | - Structs 707 | - Intro to Storage 708 | - Arrays 709 | - Dynamic & Fixed Sized 710 | - `push` array function 711 | 712 | ## Basic Solidity: Compiler Errors and Warnings 713 | 714 | _[⌨️ (02:45:35) Basic Solidity Errors & Warnings](https://youtu.be/gyMwXuJrbJQ?t=9935)_ 715 | 716 | - Yellow: Warnings are Ok 717 | - Red: Errors are not Ok 718 | 719 | ## Memory, Storage, Calldata (Intro) 720 | 721 | _[⌨️ (02:46:34) Basic Solidity Memory, Storage, & Calldata (Intro)](https://youtu.be/gyMwXuJrbJQ?t=9994)_ 722 | 723 | - 6 Places you can store and access data 724 | - calldata 725 | - memory 726 | - storage 727 | - code 728 | - logs 729 | - stack 730 | 731 | ## Mappings 732 | 733 | _[⌨️ (02:50:17) Basic Solidity Mappings](https://youtu.be/gyMwXuJrbJQ?t=10217)_ 734 | 735 | - [Mappings](https://solidity-by-example.org/mapping) 736 | 737 | ## Deploying your First Contract 738 | 739 | _[⌨️ (02:53:38) Deploying your First Contract](https://youtu.be/gyMwXuJrbJQ?t=10418)_ 740 | 741 | - A testnet or mainnet 742 | - Connecting Metamask 743 | - [Find a faucet here](https://docs.chain.link/docs/link-token-contracts/#Sepolia) 744 | - See the faucets at the top of this readme! 745 | - Interacting with Deployed Contracts 746 | 747 | ## The EVM & A Recap of Lesson 2 748 | 749 | _[⌨️ (03:03:07) The EVM & A Recap of Lesson 2](https://youtu.be/gyMwXuJrbJQ?t=10987)_ 750 | 751 | - The EVM 752 | 753 | # Lesson 3: Remix Storage Factory 754 | 755 | _[⌨️ (03:05:34) Lesson 3: Remix Storage Factory](https://www.youtube.com/watch?v=gyMwXuJrbJQ&t=11134s)_ 756 | 757 | 💻 Code: https://github.com/PatrickAlphaC/storage-factory-fcc 758 | 759 | ## Introduction 760 | 761 | _[⌨️ (03:06:06) Introduction](https://youtu.be/gyMwXuJrbJQ?t=11166)_ 762 | 763 | - [Factory Pattern](https://betterprogramming.pub/learn-solidity-the-factory-pattern-75d11c3e7d29) 764 | 765 | ## Basic Solidity: Importing Contracts into other Contracts 766 | 767 | _[⌨️ (03:07:29) Importing Contracts into other Contracts](https://youtu.be/gyMwXuJrbJQ?t=11249)_ 768 | 769 | - [Composibility](https://chain.link/techtalks/defi-composability) 770 | - [Solidity new keyword](https://docs.soliditylang.org/en/latest/control-structures.html?highlight=new#creating-contracts-via-new) 771 | - [Importing Code in solidity](https://solidity-by-example.org/import) 772 | 773 | ## Basic Solidity: Interacting with other Contracts 774 | 775 | _[⌨️ (03:16:36) Interacting with other contracts](https://youtu.be/gyMwXuJrbJQ?t=11796)_ 776 | 777 | - To interact, you always need: ABI + Address 778 | - [ABI](https://docs.soliditylang.org/en/latest/abi-spec.html?highlight=abi) 779 | 780 | ## Basic Solidity: Inheritance & Overrides 781 | 782 | _[⌨️ (03:25:23) Inheritance & Overrides](https://youtu.be/gyMwXuJrbJQ?t=12323)_ 783 | 784 | - [Inheritance](https://solidity-by-example.org/inheritance) 785 | - [Override & Virtual Keyword](https://docs.soliditylang.org/en/latest/contracts.html?highlight=override#function-overriding) 786 | 787 | ## Lesson 3 Recap 788 | 789 | _[⌨️ (03:30:29) Lesson 3 Recap](https://youtu.be/gyMwXuJrbJQ?t=12629)_ 790 | 791 | # Lesson 4: Remix Fund Me 792 | 793 | _[⌨️ (03:31:55) Lesson 4: Remix Fund Me](https://www.youtube.com/watch?v=gyMwXuJrbJQ&t=12715s)_ 794 | 795 | 💻 Code: https://github.com/PatrickAlphaC/fund-me-fcc 796 | 797 | ## Introduction 798 | 799 | ## Sending ETH Through a Function & Reverts 800 | 801 | - [Fields in a Transaction](https://ethereum.org/en/developers/docs/transactions/) 802 | - [More on v,r,s](https://ethereum.stackexchange.com/questions/15766/what-does-v-r-s-in-eth-gettransactionbyhash-mean) 803 | - [payable](https://solidity-by-example.org/payable) 804 | - [msg.value & Other global keywords](https://docs.soliditylang.org/en/latest/cheatsheet.html?highlight=cheatsheet#global-variables) 805 | - [require](https://codedamn.com/news/solidity/what-is-require-in-solidity) 806 | - [revert](https://medium.com/blockchannel/the-use-of-revert-assert-and-require-in-solidity-and-the-new-revert-opcode-in-the-evm-1a3a7990e06e) 807 | 808 | ## Chainlink & Oracles 809 | 810 | - [What is a blockchain oracle?](https://chain.link/education/blockchain-oracles) 811 | - [What is the oracle problem?](https://blog.chain.link/what-is-the-blockchain-oracle-problem/) 812 | - [Chainlink](https://chain.link/) 813 | - [Chainlink Price Feeds (Data Feeds)](https://docs.chain.link/docs/get-the-latest-price/) 814 | - [data.chain.link](https://data.chain.link/) 815 | - [Chainlink VRF](https://docs.chain.link/docs/chainlink-vrf/) 816 | - [Chainlink Keepers](https://docs.chain.link/docs/chainlink-keepers/introduction/) 817 | - [Chainlink API Calls](https://docs.chain.link/docs/request-and-receive-data/) 818 | - [Importing Tokens into your Metamask](https://consensys.net/blog/metamask/how-to-add-your-custom-tokens-in-metamask/) 819 | - [Request and Receive Chainlink Model](https://docs.chain.link/docs/architecture-request-model/) 820 | 821 | ## Review of Sending ETH and working with Chainlink 822 | 823 | ## Interfaces & Price Feeds 824 | 825 | - [Chainlink Price Feeds (Data Feeds)](https://docs.chain.link/docs/get-the-latest-price/) 826 | - [Chainlink GitHub](https://github.com/smartcontractkit/chainlink) 827 | - [Interface](https://solidity-by-example.org/interface) 828 | 829 | ## Importing from GitHub & NPM 830 | 831 | - [Chainlink NPM Package](https://www.npmjs.com/package/@chainlink/contracts) 832 | 833 | ## Floating Point Math in Solidity 834 | 835 | - [tuple](https://docs.soliditylang.org/en/latest/abi-spec.html?highlight=tuple#handling-tuple-types) 836 | - [Floating Point Numbers in Solidity](https://stackoverflow.com/questions/58277234/does-solidity-supports-floating-point-number) 837 | - [Type Casting](https://ethereum.stackexchange.com/questions/6891/type-casting-in-solidity) 838 | - Gas Estimation Failed 839 | - Someone should make an article explaining this error 840 | 841 | ## Basic Solidity: Arrays & Structs II 842 | 843 | - [msg.sender](https://docs.soliditylang.org/en/latest/cheatsheet.html?highlight=msg.sender) 844 | 845 | ## Review of Interfaces, Importing from GitHub, & Math in Solidity 846 | 847 | ## Libraries 848 | 849 | - [Library](https://docs.soliditylang.org/en/v0.8.14/contracts.html?highlight=library#libraries) 850 | - [Solidity-by-example Library](https://solidity-by-example.org/library) 851 | 852 | ## SafeMath, Overflow Checking, and the "unchecked" keyword 853 | 854 | - [Openzeppelin Safemath](https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/math/SafeMath.sol) 855 | - [unchecked vs. checked](https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic) 856 | 857 | ## Basic Solidity: For Loop 858 | 859 | - [For Loop](https://solidity-by-example.org/loop) 860 | - `/* */` is another way to make comments 861 | 862 | ## Basic Solidity: Resetting an Array 863 | 864 | ## Sending ETH from a Contract 865 | 866 | - [Transfer, Send, Call](https://solidity-by-example.org/sending-ether/) 867 | - [this keyword](https://ethereum.stackexchange.com/questions/1781/what-is-the-this-keyword-in-solidity) 868 | 869 | ## Basic Solidity: Constructor 870 | 871 | - [Constructor](https://solidity-by-example.org/constructor) 872 | 873 | ## Basic Solidity: Modifiers 874 | 875 | - [Double equals](https://www.geeksforgeeks.org/solidity-operators/) 876 | - [Modifier](https://solidity-by-example.org/function-modifier) 877 | 878 | ## Testnet Demo 879 | 880 | - [Disconnecting Metamask](https://help.1inch.io/en/articles/4666771-metamask-how-to-connect-disconnect-and-switch-accounts-with-metamask-on-1inch-network) 881 | 882 | ## Advanced Solidity 883 | 884 | ### Immutable & Constant 885 | 886 | - [Immutable](https://solidity-by-example.org/immutable) 887 | - [Constant](https://solidity-by-example.org/constants) 888 | - [Current ETH Gas Prices](https://etherscan.io/gastracker) 889 | - Don't stress about gas optimizations! (yet) 890 | - Naming Conventions 891 | - [Someone make this!](https://github.com/smartcontractkit/full-blockchain-solidity-course-js/issues/13) 892 | 893 | ### Custom Errors 894 | 895 | - [Custom Errors Introduction](https://blog.soliditylang.org/2021/04/21/custom-errors/) 896 | 897 | ### Receive & Fallback Functions 898 | 899 | - [Solidity Docs Special Functions](https://docs.soliditylang.org/en/latest/contracts.html?highlight=fallback#special-functions) 900 | - [Fallback](https://solidity-by-example.org/fallback) 901 | - [Receive](https://docs.soliditylang.org/en/latest/contracts.html?highlight=fallback#receive-ether-function) 902 | 903 | ## Lesson 4 Recap 904 | 905 | 🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊 Completed Solidity Basics! 🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊 906 | 907 | # Lesson 5: Ethers.js Simple Storage 908 | 909 | _[⌨️ (05:30:42) Lesson 5: Ethers.js Simple Storage](https://www.youtube.com/watch?v=gyMwXuJrbJQ&t=19842s)_ 910 | 911 | 💻 Code: https://github.com/PatrickAlphaC/ethers-simple-storage-fcc 912 | 913 | 🧪 [Alchemy: https://alchemy.com/?a=673c802981](https://alchemy.com/?a=673c802981) 914 | 915 | ## Effective Debugging Strategies & Getting Help 916 | 917 | _[⌨️ (5:30:46) Effective Debugging Stategies & Getting Help](https://youtu.be/gyMwXuJrbJQ?t=19846)_ 918 | 919 | 1. Tinker and isolate problem 920 | 1. For this course, take at LEAST 15 minutes to figure out a bug. 921 | 2. Google / Web Search the Exact problem 922 | 1. Go to this GitHub Repo / Discussions 923 | 3. Ask a question on a Forum like Stack Exchange Ethereum or Stack Overflow 924 | 1. Format your questions!! 925 | 2. Use [Markdown](https://www.markdowntutorial.com/) 926 | 927 | ### How to Debug Anything Video 928 | 929 | - [Patrick's Original Video](https://www.youtube.com/watch?v=XT8STflvwNo) 930 | 931 | ## Installation & Setup 932 | 933 | - [Visual Studio Code](https://code.visualstudio.com/) 934 | - [Crash Course](https://www.youtube.com/watch?v=WPqXP_kLzpo) 935 | - [NodeJS](https://nodejs.org/en/) 936 | - [VSCode Keybindings](https://code.visualstudio.com/docs/getstarted/keybindings) 937 | - [Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) 938 | - [What is a terminal?](https://code.visualstudio.com/docs/editor/integrated-terminal) 939 | 940 | ### Mac & Linux Setup 941 | 942 | ### Windows Setup 943 | 944 | - [WSL](https://docs.microsoft.com/en-us/windows/wsl/install) 945 | - When working in WSL, use Linux commands instead of Windows commands 946 | - [TroubleShooting](https://docs.microsoft.com/en-us/windows/wsl/troubleshooting) 947 | - `curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash` 948 | 949 | > ⚠️ Please use Gitpod as an absolute last resort 950 | 951 | ### Gitpod 952 | 953 | - [Gitpod](https://www.gitpod.io/) 954 | - **If using this, NEVER share a private key with real money on Gitpod** 955 | - Ideally you figure out the MacOS, Linux, or Windows install though 956 | 957 | ## Local Development Introduction 958 | 959 | - `CMD + K` or `CTRL + K` clears the terminal 960 | - `mkdir ethers-simple-storage-fcc` 961 | - `code .` to open VSCode in a new VSCode window 962 | 963 | ### Optional Javascript Crash Courses 964 | 965 | - [NodeJS Course](https://www.youtube.com/watch?v=RLtyhwFtXQA) 966 | - [Javascript Course](https://www.youtube.com/watch?v=jS4aFq5-91M) 967 | - Import your `SimpleStorage.sol` 968 | - [Solidity + Hardhat VSCode Extension](https://marketplace.visualstudio.com/items?itemName=NomicFoundation.hardhat-solidity) 969 | 970 | - Format your solidity code with: 971 | 972 | ``` 973 | "[solidity]": { 974 | "editor.defaultFormatter": "NomicFoundation.hardhat-solidity" 975 | }, 976 | "[javascript]":{ 977 | "editor.defaultFormatter": "esbenp.prettier-vscode" 978 | } 979 | ``` 980 | 981 | In your `.vscode/settings.json` file. 982 | 983 | - [Prettier Extension](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) 984 | 985 | ## Tiny Javascript Refresher 986 | 987 | - [Javascript Tips](https://www.freecodecamp.org/news/learn-javascript-free-js-courses-for-beginners/) 988 | 989 | ## Asynchronous Programming in Javascript 990 | 991 | - [Asynchronous Programming](https://www.bmc.com/blogs/asynchronous-programming/) 992 | - [async keyword](https://www.w3schools.com/JS//js_async.asp) 993 | - [Promise in Javascript](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) 994 | - [await keyword](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/await) 995 | 996 | ## Compiling our Solidity 997 | 998 | - [Yarn Install](https://yarnpkg.com/getting-started/install) 999 | - [solc-js](https://github.com/ethereum/solc-js) 1000 | - `yarn add solc@0.8.7-fixed` 1001 | - [yarn scripts](https://classic.yarnpkg.com/lang/en/docs/cli/run/) 1002 | 1003 | ## Ganache & Networks 1004 | 1005 | - [Ganache](https://trufflesuite.com/ganache/) 1006 | - Networks in Metamask 1007 | - RPC URL 1008 | - [Geth](https://github.com/ethereum/go-ethereum) 1009 | - [JSON RPC Spec Playground](https://playground.open-rpc.org/?schemaUrl=https://raw.githubusercontent.com/ethereum/execution-apis/assembled-spec/openrpc.json&uiSchema%5BappBar%5D%5Bui:splitView%5D=false&uiSchema%5BappBar%5D%5Bui:input%5D=false&uiSchema%5BappBar%5D%5Bui:examplesDropdown%5D=false) 1010 | 1011 | ## Introduction to Ethers.js 1012 | 1013 | - [Ethers.js](https://docs.ethers.io/v5/getting-started/) 1014 | - [prettier-plugin-solidity](https://github.com/prettier-solidity/prettier-plugin-solidity) 1015 | 1016 | ### A Note on the await Keyword 1017 | 1018 | ## Adding Transaction Overrides 1019 | 1020 | ## Transaction Receipts 1021 | 1022 | ## Sending a "raw" Transaction in Ethers.js 1023 | 1024 | ## Interacting with Contracts in Ethers.js 1025 | 1026 | - [EVM Decompiler](https://ethervm.io/decompile) 1027 | - [BigNumber](https://docs.ethers.io/v5/api/utils/bignumber/) 1028 | 1029 | ## Environment Variables 1030 | 1031 | - [dotenv](https://www.npmjs.com/package/dotenv) 1032 | - [.gitignore](https://www.atlassian.com/git/tutorials/saving-changes/gitignore) 1033 | 1034 | ## Better Private Key Management 1035 | 1036 | - [wallet.encrypt](https://docs.ethers.io/v5/api/signer/#Wallet-encrypt) 1037 | - [THE .ENV PLEDGE](https://github.com/smartcontractkit/full-blockchain-solidity-course-js/discussions/5) 1038 | 1039 | ## Optional Prettier Formatting 1040 | 1041 | - [Prettier](https://prettier.io/docs/en/index.html) 1042 | - [Best README Template](https://github.com/othneildrew/Best-README-Template) 1043 | 1044 | ## Deploying to a Testnet or a Mainnet 1045 | 1046 | - [Alchemy](https://alchemy.com/?a=673c802981) 1047 | - [Getting your private key from Metamask](https://metamask.zendesk.com/hc/en-us/articles/360015289632-How-to-Export-an-Account-Private-Key) 1048 | - `CTRL + C` stops any terminal command 1049 | 1050 | ## Verifying on Block Explorers from the UI 1051 | 1052 | ## Alchemy Dashboard & The Mempool 1053 | 1054 | - [Special Guest Albert Hu](https://twitter.com/thatguyintech) 1055 | - [Mempool](https://ethereum.org/en/developers/tutorials/sending-transactions-using-web3-and-alchemy/#see-your-transaction-in-the-mempool) 1056 | 1057 | ## Lesson 5 Recap 1058 | 1059 | ### Typescript Ethers Simple Storage 1060 | 1061 | # Lesson 6: Hardhat Simple Storage 1062 | 1063 | _[⌨️ (08:20:17) Lesson 6: Hardhat Simple Storage](https://www.youtube.com/watch?v=gyMwXuJrbJQ&t=30017s)_ 1064 | 1065 | 💻 Code: https://github.com/PatrickAlphaC/hardhat-simple-storage-fcc 1066 | 1067 | ## Introduction 1068 | 1069 | _[⌨️ (08:20:19) Introduction](https://youtu.be/gyMwXuJrbJQ?t=30019)_ 1070 | 1071 | ## Hardhat Setup 1072 | 1073 | _[⌨️ (08:22:47) Hardhat Setup](https://youtu.be/gyMwXuJrbJQ?t=30167)_ 1074 | 1075 | - [Hardhat Documentation](https://hardhat.org/) 1076 | - [DevDependencies vs Dependencies](https://stackoverflow.com/questions/18875674/whats-the-difference-between-dependencies-devdependencies-and-peerdependencies) 1077 | - [@ Sign node modules](https://stackoverflow.com/questions/36667258/what-is-the-meaning-of-the-at-prefix-on-npm-packages) 1078 | 1079 | ### Troubleshooting Hardhat Setup 1080 | 1081 | _[⌨️ (08:29:43) Troubleshooting Hardhat Setup](https://youtu.be/gyMwXuJrbJQ?t=30583)_ 1082 | 1083 | - [Special Guest Cami Ramos Garzon](https://twitter.com/camiinthisthang) 1084 | 1085 | ## Hardhat Setup Continued 1086 | 1087 | _[⌨️ (08:31:48) Hardhat Setup Continued](https://youtu.be/gyMwXuJrbJQ?t=30708)_ 1088 | 1089 | ## Deploying SimpleStorage from Hardhat 1090 | 1091 | _[⌨️ (08:33:10) Deploying SimpleStorage from Hardhat](https://youtu.be/gyMwXuJrbJQ?t=30790)_ 1092 | 1093 | ## Networks in Hardhat 1094 | 1095 | _[⌨️ (08:41:44) Networks in Hardhat](https://youtu.be/gyMwXuJrbJQ?t=31304)_ 1096 | 1097 | - [The Hardhat Network](https://hardhat.org/hardhat-network/) 1098 | - [Hardhat configuration](https://hardhat.org/config/#configuration) 1099 | - [Chain ID List](https://chainlist.org/) 1100 | 1101 | ## Programmatic Verification 1102 | 1103 | _[⌨️ (08:51:16) Programmatic Verification](https://youtu.be/gyMwXuJrbJQ?t=31876)_ 1104 | 1105 | - [Etherscan Verify Tutorial](https://docs.etherscan.io/tutorials/verifying-contracts-programmatically) 1106 | - [Etherscan Docs](https://docs.etherscan.io/) 1107 | - [Hardhat-Etherscan](https://hardhat.org/plugins/nomiclabs-hardhat-etherscan.html) 1108 | - [Etherscan API Keys](https://info.etherscan.com/api-keys/) 1109 | - [Javascript == vs ===](https://stackoverflow.com/questions/359494/which-equals-operator-vs-should-be-used-in-javascript-comparisons) 1110 | 1111 | ## Interacting with Contracts in Hardhat 1112 | 1113 | _[⌨️ (09:06:37) Interacting with Contracts in Hardhat](https://youtu.be/gyMwXuJrbJQ?t=32797)_ 1114 | 1115 | ## Artifacts Troubleshooting 1116 | 1117 | _[⌨️ (09:09:42) Artifacts Troubleshooting](https://youtu.be/gyMwXuJrbJQ?t=32982)_ 1118 | 1119 | ## Custom Hardhat Tasks 1120 | 1121 | _[⌨️ (09:10:52) Custom Hardhat Tasks](https://youtu.be/gyMwXuJrbJQ?t=33052)_ 1122 | 1123 | - [Hardhat Tasks](https://hardhat.org/guides/create-task.html) 1124 | - [Javascript Arrow Functions](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions) 1125 | 1126 | ## Hardhat Localhost Node 1127 | 1128 | _[⌨️ (09:18:12) Hardhat Localhost Node](https://youtu.be/gyMwXuJrbJQ?t=33492)_ 1129 | 1130 | ## The Hardhat Console 1131 | 1132 | _[⌨️ (09:23:11) The Hardhat Console](https://youtu.be/gyMwXuJrbJQ?t=33791)_ 1133 | 1134 | - [Hardhat Console](https://hardhat.org/guides/hardhat-console.html) 1135 | 1136 | ## Hardhat Tests 1137 | 1138 | _[⌨️ (09:26:13) Hardhat Tests](https://youtu.be/gyMwXuJrbJQ?t=33973)_ 1139 | 1140 | - [Hardhat Tests](https://hardhat.org/tutorial/testing-contracts.html#_5-testing-contracts) 1141 | - [Mocha Style Tests](https://mochajs.org/) 1142 | - [Chai](https://www.npmjs.com/package/chai) 1143 | - [Waffle Tests](https://ethereum-waffle.readthedocs.io/en/latest/) 1144 | 1145 | ## Hardhat Gas Reporter 1146 | 1147 | _[⌨️ (09:38:10) Hardhat Gas Reporter](https://youtu.be/gyMwXuJrbJQ?t=34690)_ 1148 | 1149 | - [Hardhat Gas Reporter](https://www.npmjs.com/package/hardhat-gas-reporter) 1150 | - [Coinmarketcap API](https://coinmarketcap.com/api/) 1151 | 1152 | ## Solidity Coverage 1153 | 1154 | _[⌨️ (09:44:40) Solidity Coverage](https://youtu.be/gyMwXuJrbJQ?t=35080)_ 1155 | 1156 | - [Solidity Coverage](https://github.com/sc-forks/solidity-coverage) 1157 | 1158 | ## Hardhat Waffle 1159 | 1160 | _[⌨️ (09:47:02) Hardhat Waffle](https://youtu.be/gyMwXuJrbJQ?t=35222)_ 1161 | 1162 | - [Hardhat-Waffle](https://npm.io/package/@nomiclabs/hardhat-waffle) 1163 | 1164 | ## Lesson 6 Recap 1165 | 1166 | _[⌨️ (09:47:37) Lesson 6 Recap](https://youtu.be/gyMwXuJrbJQ?t=35257)_ 1167 | 1168 | ### Typescript Hardhat Simple Storage 1169 | 1170 | _[⌨️ (09:52:15) Typescript Hardhat Simple Storage](https://youtu.be/gyMwXuJrbJQ?t=35535)_ 1171 | 1172 | - [Typechain](https://github.com/dethcrypto/TypeChain) 1173 | 1174 | ``` 1175 | yarn add --dev @typechain/ethers-v5 @typechain/hardhat @types/chai @types/node @types/mocha ts-node typechain typescript 1176 | ``` 1177 | 1178 | # Lesson 7: Hardhat Fund Me 1179 | 1180 | _[⌨️ (10:00:48) Lesson 7: Hardhat Fund Me](https://www.youtube.com/watch?v=gyMwXuJrbJQ&t=36048s)_ 1181 | 1182 | 💻 Code: https://github.com/PatrickAlphaC/hardhat-fund-me-fcc 1183 | 1184 | ## Introduction 1185 | 1186 | _[⌨️ (10:00:50) Introduction](https://youtu.be/gyMwXuJrbJQ?t=36050)_ 1187 | 1188 | ## Hardhat Setup - Fund Me 1189 | 1190 | _[⌨️ (10:03:41) Hardhat Setup - Fund Me](https://youtu.be/gyMwXuJrbJQ?t=36221)_ 1191 | 1192 | ## Linting 1193 | 1194 | _[⌨️ (10:06:20) Linting](https://youtu.be/gyMwXuJrbJQ?t=36380)_ 1195 | 1196 | - [Eslint](https://eslint.org/) 1197 | - [Solhint](https://github.com/protofire/solhint) 1198 | - [Linting Code](https://www.perforce.com/blog/qac/what-lint-code-and-why-linting-important) 1199 | 1200 | ## Hardhat Setup - Fund Me - Continued 1201 | 1202 | _[⌨️ (10:07:47) Hardhat Setup - Fund Me - Continued](https://youtu.be/gyMwXuJrbJQ?t=36467)_ 1203 | 1204 | ## Importing from NPM 1205 | 1206 | _[⌨️ (10:09:38) Importing from NPM](https://youtu.be/gyMwXuJrbJQ?t=36578)_ 1207 | 1208 | - [@chainlink/contracts](https://www.npmjs.com/package/@chainlink/contracts) 1209 | 1210 | ## Hardhat Deploy 1211 | 1212 | _[⌨️ (10:10:43) Hardhat Deploy](https://youtu.be/gyMwXuJrbJQ?t=36643)_ 1213 | 1214 | - [Hardhat Deploy](https://github.com/wighawag/hardhat-deploy) 1215 | 1216 | ## Mocking 1217 | 1218 | _[⌨️ (10:21:05) Mocking](https://youtu.be/gyMwXuJrbJQ?t=37265)_ 1219 | 1220 | - [Mocking](https://stackoverflow.com/questions/2665812/what-is-mocking) 1221 | - [Aave Github](https://github.com/aave/aave-v3-core) 1222 | - [Chainlink Github](https://github.com/smartcontractkit/chainlink) 1223 | - Multiple Versions of Solidity 1224 | - Tags in hardhat 1225 | 1226 | ## Utils Folder 1227 | 1228 | _[⌨️ (10:52:51) Utils Folder](https://youtu.be/gyMwXuJrbJQ?t=39171)_ 1229 | 1230 | ## Testnet Demo - Hardhat Fund Me 1231 | 1232 | _[⌨️ (10:55:45) Testnet Demo - Hardhat Fund Me](https://youtu.be/gyMwXuJrbJQ?t=39345)_ 1233 | 1234 | - Hardhat Deploy Block Confirmations 1235 | 1236 | ### TypeScript 1237 | 1238 | - [Code file](https://github.com/PatrickAlphaC/hardhat-fund-me-fcc/blob/84271e7002e55d86c90b26466ff27bc067f25de0/deploy/01-deploy-fund-me.ts#L29) (TypeScript edition) 1239 | - Define blockConfirmations in the `helper-hardhat-config.ts` file instead of `hardhat-config.js`. 1240 | 1241 | ## Solidity Style Guide 1242 | 1243 | _[⌨️ (11:00:10) Solidity Style Guide](https://youtu.be/gyMwXuJrbJQ?t=39610)_ 1244 | 1245 | - [Style Guide](https://docs.soliditylang.org/en/latest/style-guide.html) 1246 | - [NatSpec](https://docs.soliditylang.org/en/latest/natspec-format.html) 1247 | 1248 | ## Testing Fund Me 1249 | 1250 | _[⌨️ (11:08:36) Testing Fund Me](https://youtu.be/gyMwXuJrbJQ?t=40116)_ 1251 | 1252 | - [Unit Testing](https://en.wikipedia.org/wiki/Unit_testing) 1253 | - [Hardhat Deploy Fixtures](https://github.com/wighawag/hardhat-deploy#creating-fixtures) 1254 | - [ethers.getContract](https://github.com/wighawag/hardhat-deploy-ethers) 1255 | - [expect](https://ethereum-waffle.readthedocs.io/en/latest/matchers.html) 1256 | - [ethers.utils.parseUnits](https://docs.ethers.io/v5/api/utils/display-logic/#utils-parseUnits) 1257 | - [Waffle Chai Matchers](https://ethereum-waffle.readthedocs.io/en/latest/matchers.html) 1258 | 1259 | ## Breakpoints & Debugging 1260 | 1261 | _[⌨️ (11:30:39) Breakpoints & Debugging](https://youtu.be/gyMwXuJrbJQ?t=41439)_ 1262 | 1263 | - [VSCode Breakpoints](https://code.visualstudio.com/Docs/editor/debugging) 1264 | 1265 | ## Gas III 1266 | 1267 | _[⌨️ (11:33:40) Gas III](https://youtu.be/gyMwXuJrbJQ?t=41620)_ 1268 | 1269 | - [Transaction Response](https://docs.ethers.io/v5/api/providers/types/#providers-TransactionResponse) 1270 | - [Transaction Receipt](https://docs.ethers.io/v5/api/providers/types/#providers-TransactionReceipt) 1271 | 1272 | ## console.log & Debugging 1273 | 1274 | _[⌨️ (11:36:35) console.log & Debugging](https://youtu.be/gyMwXuJrbJQ?t=41795)_ 1275 | 1276 | - [Hardhat console.log](https://hardhat.org/hardhat-network/reference/#console-log) 1277 | 1278 | ## Testing Fund Me II 1279 | 1280 | _[⌨️ (11:37:31) Testing Fund Me II](https://youtu.be/gyMwXuJrbJQ?t=41851)_ 1281 | 1282 | ## Storage in Solidity 1283 | 1284 | _[⌨️ (11:44:34) Storage in Solidity](https://youtu.be/gyMwXuJrbJQ?t=42274)_ 1285 | 1286 | - [Storage Layout](https://docs.soliditylang.org/en/latest/internals/layout_in_storage.html) 1287 | - [Purpose of the memory keyword](https://stackoverflow.com/questions/33839154/in-ethereum-solidity-what-is-the-purpose-of-the-memory-keyword) 1288 | - [getStorageAt](https://docs.ethers.io/v5/api/providers/provider/#Provider-getStorageAt) 1289 | 1290 | ## Gas Optimizations using Storage Knowledge 1291 | 1292 | _[⌨️ (11:52:38) Gas Optimizations using Storage Knowledge](https://youtu.be/gyMwXuJrbJQ?t=42758)_ 1293 | 1294 | - [Opcodes](https://ethereum.org/en/developers/docs/evm/opcodes/) 1295 | - [Opcodes by Gas](https://github.com/crytic/evm-opcodes) 1296 | - [Opcodes by Gas](https://evm.codes/) 1297 | - Append `s_` to storage variables 1298 | - Append `i_` to immutable variables 1299 | - Caps lock and underscore constant variables 1300 | 1301 | ## Solidity Chainlink Style Guide 1302 | 1303 | _[⌨️ (12:05:29) Solidity Chainlink Style Guide](https://youtu.be/gyMwXuJrbJQ?t=43529)_ 1304 | 1305 | - [Chainlink Solidity Style Guide](https://github.com/smartcontractkit/full-blockchain-solidity-course-js/issues/13) 1306 | 1307 | ## Storage Review 1308 | 1309 | _[⌨️ (12:09:59) Storage Review](https://youtu.be/gyMwXuJrbJQ?t=43799)_ 1310 | 1311 | ## Staging Tests 1312 | 1313 | _[⌨️ (12:11:43) Staging Tests](https://youtu.be/gyMwXuJrbJQ?t=43903)_ 1314 | 1315 | - [Ternary](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Conditional_Operator) 1316 | 1317 | ## Running Scripts on a Local Node 1318 | 1319 | _[⌨️ (12:17:58) Running Scripts on a Local Node](https://youtu.be/gyMwXuJrbJQ?t=44278)_ 1320 | 1321 | ## Adding Scripts to your package.json 1322 | 1323 | _[⌨️ (12:22:00) Adding Scripts to your package.json](https://youtu.be/gyMwXuJrbJQ?t=44520)_ 1324 | 1325 | ## Pushing to GitHub 1326 | 1327 | _[⌨️ (12:25:17) Pushing to GitHub](https://youtu.be/gyMwXuJrbJQ?t=44717)_ 1328 | 1329 | - [Github Quickstart](https://docs.github.com/en/get-started/quickstart) 1330 | - [What is Git?](https://www.git-scm.com/book/en/v2/Getting-Started-What-is-Git%3F) 1331 | - [The quickstart that we follow in the video](https://docs.github.com/en/get-started/importing-your-projects-to-github/importing-source-code-to-github/adding-locally-hosted-code-to-github#adding-a-local-repository-to-github-using-git) 1332 | - [Learn about git and GitHub](https://www.youtube.com/watch?v=RGOj5yH7evk) 1333 | 1334 | ## 🐸🐦 [Tweet Me (add your repo in)!](https://twitter.com/intent/tweet?text=I%20just%20made%20my%20first%20Smart%20Contract%20repo%20using%20@solidity_lang,%20@HardhatHQ,%20@chainlink,%20@AlchemyPlatform,%20and%20more!%0a%0aThanks%20@PatrickAlphaC!!) 1335 | 1336 | # Lesson 8: HTML / Javascript Fund Me (Full Stack / Front End) 1337 | 1338 | _[⌨️ (12:32:57) Lesson 8: HTML / Javascript Fund Me (Full Stack / Front End)](https://www.youtube.com/watch?v=gyMwXuJrbJQ&t=45177s)_ 1339 | 1340 | 💻 Code: https://github.com/PatrickAlphaC/html-fund-me-fcc 1341 | 1342 | ## Introduction 1343 | 1344 | ## How Websites work with Web3 Wallets 1345 | 1346 | - [How to Connect your Smart Contracts to Metamask](https://www.youtube.com/watch?v=pdsYCkUWrgQ) 1347 | - 💻 Code from Video: https://github.com/PatrickAlphaC/full-stack-web3-metamask-connectors 1348 | - ✍️ Article from Video: https://betterprogramming.pub/everything-you-need-to-know-about-fullstack-web3-94c0f1b18019?sk=a2764bcbdae98bf05e1052931de77982 1349 | 1350 | ## HTML Setup 1351 | 1352 | - Live Server: ExtensionID: ritwickdey.LiveServer 1353 | 1354 | ## Connecting HTML to Metamask 1355 | 1356 | - [Metamask Docs](https://docs.metamask.io/guide/) 1357 | 1358 | ## Javascript in it's own file 1359 | 1360 | ## ES6 vs Nodejs 1361 | 1362 | - [ES6 vs Nodesjs](https://stackoverflow.com/questions/31354559/using-node-js-require-vs-es6-import-export#31367852) 1363 | - [Ethers docs for web browser](https://docs.ethers.io/v5/getting-started/#getting-started--importing--web-browser) 1364 | - [module vs text/javascript](https://stackoverflow.com/questions/51418964/script-type-text-javascript-vs-script-type-module) 1365 | 1366 | ## Sending a transaction from a Website 1367 | 1368 | - [Web3Provider](https://docs.ethers.io/v5/api/providers/other/#Web3Provider) 1369 | - [Adding a network to metamask](https://metamask.zendesk.com/hc/en-us/articles/360043227612-How-to-add-a-custom-network-RPC) 1370 | 1371 | ## Resetting an Account in Metamask 1372 | 1373 | ``` 1374 | MetaMask - RPC Error: 1375 | [ethjs-query] while formatting ouputs from RPC '{"value":{"code":-32603,"data":{"code":-32000,"message":"Nonce too high. Expected nonce to be 2 but got 4. Note that transactions can't be queued when automining."}}}' 1376 | ``` 1377 | 1378 | ## Listening for Events and Completed Transactions 1379 | 1380 | - [provider.once](https://docs.ethers.io/v5/api/providers/provider/#Provider-once) 1381 | - [Anonymous function](https://www.geeksforgeeks.org/javascript-anonymous-functions/) 1382 | - [Javascript Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) 1383 | 1384 | ## Input Forms 1385 | 1386 | ## Reading from the Blockchain 1387 | 1388 | ## Withdraw Function 1389 | 1390 | ## Lesson 8 Recap 1391 | 1392 | ### Optional Links: 1393 | 1394 | - [Browserify](https://browserify.org/) 1395 | - [Watchify](https://www.npmjs.com/package/watchify) 1396 | 1397 | # Lesson 9: Hardhat Smart Contract Lottery 1398 | 1399 | _[⌨️ (13:41:02) Lesson 9: Hardhat Smart Contract Lottery](https://www.youtube.com/watch?v=gyMwXuJrbJQ&t=49262s)_ 1400 | 1401 | 💻 Code: https://github.com/PatrickAlphaC/hardhat-smartcontract-lottery-fcc 1402 | 1403 | ## Introduction 1404 | 1405 | ## Hardhat Setup - Smart Contract Lottery 1406 | 1407 | _[⌨️ (13:43:43) Hardhat Setup](https://youtu.be/gyMwXuJrbJQ?t=49423)_ 1408 | 1409 | - Install dependencies: 1410 | 1411 | ```bash 1412 | yarn add --dev @nomiclabs/hardhat-ethers@npm:hardhat-deploy-ethers ethers @nomiclabs/hardhat-etherscan @nomiclabs/hardhat-waffle chai ethereum-waffle hardhat hardhat-contract-sizer hardhat-deploy hardhat-gas-reporter prettier prettier-plugin-solidity solhint solidity-coverage dotenv 1413 | ``` 1414 | 1415 | - Install dependencies (Typescript version): 1416 | 1417 | ```bash 1418 | yarn add --dev @nomiclabs/hardhat-ethers@npm:hardhat-deploy-ethers ethers @nomiclabs/hardhat-etherscan @nomiclabs/hardhat-waffle chai ethereum-waffle hardhat hardhat-contract-sizer hardhat-deploy hardhat-gas-reporter prettier prettier-plugin-solidity solhint solidity-coverage dotenv @typechain/ethers-v5 @typechain/hardhat @types/chai @types/node ts-node typechain typescript 1419 | ``` 1420 | 1421 | ## Raffle.sol Setup 1422 | 1423 | _[⌨️ (13:46:55) Raffle.sol Setup](https://youtu.be/gyMwXuJrbJQ?t=49615)_ 1424 | 1425 | - [Custom Errors in Solidity](https://blog.soliditylang.org/2021/04/21/custom-errors/) 1426 | 1427 | ## Introduction to Events 1428 | 1429 | _[⌨️ (13:54:02) Introduction to Events](https://youtu.be/gyMwXuJrbJQ?t=50042)_ 1430 | 1431 | - [Events & Logging Video](https://www.youtube.com/watch?v=KDYJC85eS5M) 1432 | - [Events & Logging in Hardhat](https://github.com/PatrickAlphaC/hardhat-events-logs) 1433 | 1434 | ## Events in Raffle.sol 1435 | 1436 | _[⌨️ (14:00:47) Events in Raffle.sol](https://youtu.be/gyMwXuJrbJQ?t=50447)_ 1437 | 1438 | ## Introduction to Chainlink VRF 1439 | 1440 | _[⌨️ (14:02:30) Introduction to Chainlink VRF](https://youtu.be/gyMwXuJrbJQ?t=50550)_ 1441 | 1442 | - [Special Guest Stephen Fluin](https://twitter.com/stephenfluin) 1443 | 1444 | ### Sub-Lesson: Chainlink VRF 1445 | 1446 | > - [Chainlink VRFv2 Docs](https://docs.chain.link/docs/get-a-random-number/) 1447 | > - [Chainlink VRFv2 Walkthrough](https://www.youtube.com/watch?v=rdJ5d8j1RCg) 1448 | > - [Chainlink Contracts](https://github.com/smartcontractkit/chainlink/blob/develop/contracts/src/v0.8/VRFConsumerBase.sol) 1449 | 1450 | ## Implementing Chainlink VRF - Introduction 1451 | 1452 | _[⌨️ (14:09:53) Implementing Chainlink VRF](https://youtu.be/gyMwXuJrbJQ?t=50993)_ 1453 | 1454 | ### Hardhat Shorthand 1455 | 1456 | - [Hardhat Shorthand](https://hardhat.org/guides/shorthand.html) 1457 | 1458 | ## Implementing Chainlink VRF - The Request 1459 | 1460 | ## Implementing Chainlink VRF - The FulFill 1461 | 1462 | ### Modulo 1463 | 1464 | - [Modulo](https://docs.soliditylang.org/en/latest/types.html?highlight=modulo#modulo) 1465 | 1466 | ## Introduction to Chainlink Keepers 1467 | 1468 | - [Chainlink Keepers Docs](https://docs.chain.link/docs/chainlink-keepers/introduction/) 1469 | - [Chainlink Keepers Walkthrough](https://www.youtube.com/watch?v=-Wkw5JVQGUo) 1470 | 1471 | ## Implementing Chainlink Keepers - checkUpkeep 1472 | 1473 | ### Enums 1474 | 1475 | - [Enum](https://docs.soliditylang.org/en/latest/structure-of-a-contract.html?highlight=enum#enum-types) 1476 | 1477 | ## Implementing Chainlink Keepers - checkUpkeep continued 1478 | 1479 | - block.timestamp 1480 | 1481 | ## Implementing Chainlink Keepers - performUpkeep 1482 | 1483 | ## Code Cleanup 1484 | 1485 | ## Deploying Raffle.sol 1486 | 1487 | ### Mock Chainlink VRF Coordinator 1488 | 1489 | ### Continued 1490 | 1491 | - [LINK Token](https://docs.chain.link/docs/link-token-contracts/) 1492 | 1493 | ## Raffle.sol Unit Tests 1494 | 1495 | - We use `async function` in the describe blocks at the start, but we correctly take them out later. 1496 | 1497 | ### Testing Events & Chai Matchers 1498 | 1499 | - [Emit Chai Matcher](https://ethereum-waffle.readthedocs.io/en/latest/matchers.html#emitting-events) 1500 | 1501 | ### Continued I 1502 | 1503 | ## Hardhat Methods & Time Travel 1504 | 1505 | - [Make Hardhat do whatever you want it to](https://hardhat.org/hardhat-network/reference/) 1506 | - [Special debugging hardhat methods](https://hardhat.org/hardhat-network/reference/#special-testing-debugging-methods) 1507 | 1508 | ### Continued II 1509 | 1510 | ## Callstatic 1511 | 1512 | - [Callstatic](https://docs.ethers.io/v5/api/contract/contract/#contract-callStatic) 1513 | 1514 | ### Continued III 1515 | 1516 | ### Massive Promise Test 1517 | 1518 | ### Continued IV 1519 | 1520 | ## Raffle.sol Staging Tests 1521 | 1522 | ## Testing on a Testnet 1523 | 1524 | ### Recommended LINK amounts for Sepolia Staging Test: 1525 | 1526 | - Chainlink VRF: 2 LINK 1527 | - Chainlink Keepers: 8 LINK 1528 | 1529 | ## Conclusion 1530 | 1531 | ## Typescript - Smart Contract Lottery 1532 | 1533 | 🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊 Completed Hardhat Basics! 🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊 1534 | 1535 | # Lesson 10: NextJS Smart Contract Lottery (Full Stack / Front End) 1536 | 1537 | _[⌨️ (16:34:07) Lesson 10: NextJS Smart Contract Lottery (Full Stack / Front End)](https://www.youtube.com/watch?v=gyMwXuJrbJQ&t=59647s)_ 1538 | 1539 | 💻 Code: https://github.com/PatrickAlphaC/nextjs-smartcontract-lottery-fcc 1540 | 1541 | ⚡️⚡️ Live Demo IPFS: ipfs://QmXwACyjcS8tL7UkYwimpqMqW9sKzSHUjE4uSZBSyQVuEH 1542 | 1543 | ⚡️⚡️ Live Demo Fleek: https://fancy-dream-3458.on.fleek.co/ 1544 | 1545 | ## Introduction 1546 | 1547 | We move into using [NextJS](https://nextjs.org/) for our front end. NextJS is a [React framework](https://reactjs.org/) for building websites. 1548 | 1549 | ### Optional Sub-Lesson: Full Stack Development & Other Libraries 1550 | 1551 | - [6 Ways to connect your dapp to a wallet](https://www.youtube.com/watch?v=pdsYCkUWrgQ) 1552 | - [NextJS Crash Course](https://www.youtube.com/watch?v=mTz0GXj8NN0) 1553 | - Other React libraries: 1554 | - [Web3React](https://github.com/NoahZinsmeister/web3-react) 1555 | - [wagmi](https://github.com/tmm/wagmi) 1556 | - [react-moralis](https://www.npmjs.com/package/react-moralis) 1557 | - [useDapp](https://github.com/TrueFiEng/useDApp) 1558 | - [Web3Modal](https://github.com/Web3Modal/web3modal) 1559 | - [useMetamask](https://github.com/mdtanrikulu/use-metamask) 1560 | - Other Full Stack Web3 Templates 1561 | - [scaffold-eth](https://github.com/scaffold-eth/scaffold-eth) 1562 | - [ethereum-boilerplate](https://github.com/ethereum-boilerplate/ethereum-boilerplate) 1563 | - [create-eth-app](https://github.com/paulrberg/create-eth-app) 1564 | - [React being quite popular](https://insights.stackoverflow.com/survey/2021#section-most-popular-technologies-web-frameworks) 1565 | - [Why use react?](https://www.freecodecamp.org/news/why-use-react-for-web-development/) 1566 | 1567 | ## NextJS Setup 1568 | 1569 | - [NextJS Documentation](https://nextjs.org/learn/basics/create-nextjs-app) 1570 | - [NextJS Minimal Ethers Example For Lottery](https://github.com/PatrickAlphaC/nextjs-ethers-introduction) 1571 | 1572 | ``` 1573 | yarn create next-app . 1574 | ``` 1575 | 1576 | ## Manual Header I 1577 | 1578 | - [What is a component?](https://www.w3schools.com/react/react_components.asp) 1579 | - [jsx](https://reactjs.org/docs/introducing-jsx.html) 1580 | - [Moralis](https://moralis.io/) 1581 | - [React Moralis](https://github.com/MoralisWeb3/react-moralis) 1582 | 1583 | ### React Hooks 1584 | 1585 | - [What is a react hook?](https://reactjs.org/docs/hooks-overview.html) 1586 | 1587 | ## Manual Header II 1588 | 1589 | ## useEffect Hook 1590 | 1591 | - [useEffect Hook](https://reactjs.org/docs/hooks-effect.html) 1592 | - [More on useEffect](https://blog.logrocket.com/guide-to-react-useeffect-hook/) 1593 | - [React Context](https://www.freecodecamp.org/news/react-context-for-beginners/) 1594 | - [useEffect Firing Twice](https://stackoverflow.com/questions/60618844/react-hooks-useeffect-is-called-twice-even-if-an-empty-array-is-used-as-an-ar) 1595 | 1596 | ## Local Storage 1597 | 1598 | - [Local Storage](https://codinglead.co/javascript/what-is-localstorage) 1599 | 1600 | ## isWeb3EnabledLoading 1601 | 1602 | ## web3uikit 1603 | 1604 | - [web3uikit](https://github.com/web3ui/web3uikit) 1605 | - [web3uikit interactive docs](https://web3ui.github.io/web3uikit/?path=/story/1-web3-blockie--custom-seed) 1606 | - [web3uikit connect button](https://web3ui.github.io/web3uikit/?path=/story/1-web3-connectbutton--default) 1607 | 1608 | ## Introduction to Calling Functions in Nextjs 1609 | 1610 | - [useWeb3Contract](https://github.com/MoralisWeb3/react-moralis#useweb3contract) 1611 | 1612 | ### Automatic Constant Value UI Updater 1613 | 1614 | - [ethers.utils.FormatTypes](https://docs.ethers.io/v5/api/utils/abi/fragments/#fragments--formats) 1615 | 1616 | ### runContractFunction 1617 | 1618 | - [Moralis Provider](https://github.com/MoralisWeb3/react-moralis#wrap-your-app-in-a-moralisprovider) 1619 | - [useMoralis](https://github.com/MoralisWeb3/react-moralis#usemoralis) 1620 | - [parseInt](https://www.w3schools.com/JSREF/jsref_parseint.asp) 1621 | 1622 | ## useState 1623 | 1624 | - [useState Hook](https://reactjs.org/docs/hooks-state.html) 1625 | 1626 | ## Calling Functions in NextJS 1627 | 1628 | ## useNotification 1629 | 1630 | - Add `onError` to all your `runContractFunction` calls 1631 | 1632 | ## Reading & Displaying Contract Data 1633 | 1634 | ## A Note about `onSuccess` 1635 | 1636 | - `onSuccess` just checks to see if MetaMask sends the transaction, not 1637 | 1638 | ## A Challenge to You 1639 | 1640 | ## Tailwind & Styling 1641 | 1642 | - [Learn CSS](https://www.w3schools.com/css/) 1643 | - [Tailwindcss](https://tailwindcss.com/) 1644 | - [PostCSS Extension](https://marketplace.visualstudio.com/items?itemName=csstools.postcss) 1645 | - [Tailwind Extension](https://marketplace.visualstudio.com/items?itemName=bradlc.vscode-tailwindcss) 1646 | - [Install Tailwind into NextJS](https://tailwindcss.com/docs/guides/nextjs) 1647 | 1648 | ## Introduction to Hosting your Site 1649 | 1650 | _[⌨️ (18:12:50) Introdunction to Hosting your Site](https://youtu.be/gyMwXuJrbJQ?t=65570)_ 1651 | 1652 | - [Vercel](https://vercel.com/) 1653 | - [Moralis](https://moralis.io/) 1654 | - [Netilfy](https://www.netlify.com/) 1655 | - [IPFS](https://ipfs.io/) 1656 | 1657 | ## IPFS 1658 | 1659 | _[⌨️ (18:15:14) IPFS](https://youtu.be/gyMwXuJrbJQ?t=65714)_ 1660 | 1661 | - [What is IPFS](https://www.youtube.com/watch?v=5Uj6uR3fp-U) 1662 | - [IPFS](https://ipfs.io/) 1663 | 1664 | ## Hosting on IPFS 1665 | 1666 | _[⌨️ (18:18:51) Hosting on IPFS](https://youtu.be/gyMwXuJrbJQ?t=65931)_ 1667 | 1668 | - [IPFS Companion](https://chrome.google.com/webstore/detail/ipfs-companion/nibjojkomfdiaoajekhjakgkdhaomnch) 1669 | - [Brave Browser](https://brave.com/) 1670 | - `yarn build && yarn next export` 1671 | 1672 | ## Hosting on IPFS & Filecoin using Fleek 1673 | 1674 | _[⌨️ (18:25:45) Hosting on IPFS & Filecoin using Fleek](https://youtu.be/gyMwXuJrbJQ?t=66345)_ 1675 | 1676 | - [Fleek](https://fleek.co/) 1677 | 1678 | ## Filecoin Overview 1679 | 1680 | _[⌨️ (18:31:28) Filecoin Overview](https://youtu.be/gyMwXuJrbJQ?t=66688)_ 1681 | 1682 | - [Special Guest Ally Haire](https://twitter.com/DeveloperAlly) 1683 | - [IPFS URL of Ally's Video](ipfs://bafybeiasd6oxqiefoxgtskrokomexnb4zcq3fhwlcbyplx2paw65zmq2du) 1684 | 1685 | ## Lesson 10 Recap 1686 | 1687 | # Lesson 11: Hardhat Starter Kit 1688 | 1689 | _[⌨️ (18:51:36) Lesson 11: Hardhat Starter Kit](https://www.youtube.com/watch?v=gyMwXuJrbJQ&t=67896s)_ 1690 | 1691 | 💻 Code: https://github.com/smartcontractkit/hardhat-starter-kit 1692 | 1693 | # Lesson 12: Hardhat ERC20s 1694 | 1695 | _[⌨️ (18:59:24) Lesson 12: Hardhat ERC20s](https://www.youtube.com/watch?v=gyMwXuJrbJQ&t=68364s)_ 1696 | 1697 | 💻 Code: https://github.com/PatrickAlphaC/hardhat-erc20-fcc 1698 | 1699 | ## What is an ERC? What is an EIP? 1700 | 1701 | - [What is an EIP?](https://eips.ethereum.org/) 1702 | - [EIPs codebase](https://github.com/ethereum/EIPs) 1703 | 1704 | ## What is an ERC20? 1705 | 1706 | - [Video (using brownie/python)](https://youtu.be/8rpir_ZSK1g?t=39) 1707 | - [EIP-20](https://eips.ethereum.org/EIPS/eip-20) 1708 | - [ERC-677](https://github.com/ethereum/EIPs/issues/677) 1709 | - [EIP-777](https://eips.ethereum.org/EIPS/eip-777) 1710 | 1711 | ## Manually Creating an ERC20 Token 1712 | 1713 | ## Creating an ERC20 Token with Openzeppelin 1714 | 1715 | - [Openzeppelin](https://openzeppelin.com/) 1716 | - [Openzeppelin Contracts](https://github.com/OpenZeppelin/openzeppelin-contracts) 1717 | - [Solmate (Openzeppelin alternative)](https://github.com/Rari-Capital/solmate) 1718 | 1719 | ## Lesson 12 Recap 1720 | 1721 | # Lesson 13: Hardhat DeFi & Aave 1722 | 1723 | _[⌨️ (19:16:13) Lesson 13: Hardhat DeFi & Aave](https://www.youtube.com/watch?v=gyMwXuJrbJQ&t=69373s)_ 1724 | 1725 | 💻 Code: https://github.com/PatrickAlphaC/hardhat-defi-fcc 1726 | 1727 | ## What is DeFi? 1728 | 1729 | - [What is DeFi?](https://chain.link/education/defi) 1730 | - [DefiLlama](https://defillama.com/) 1731 | 1732 | ## What is Aave? 1733 | 1734 | - [Aave](https://aave.com/) 1735 | - [My Previous Aave Video on Shorting Assets](https://www.youtube.com/watch?v=TmNGAvI-RUA) 1736 | 1737 | ## Programmatic Borrowing & Lending 1738 | 1739 | - [DAI](https://makerdao.com/en/) 1740 | - [Uniswap](https://app.uniswap.org/) 1741 | 1742 | ## WETH - Wrapped ETH 1743 | 1744 | - [WETH Token Sepolia Etherscan](https://sepolia.etherscan.io/address/0xdd13E55209Fd76AfE204dBda4007C227904f0a81) 1745 | - [WETH Token Mainnet](https://etherscan.io/token/0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2) 1746 | 1747 | ## Forking Mainnet 1748 | 1749 | - [Mainnet Forking](https://hardhat.org/hardhat-network/guides/mainnet-forking.html) 1750 | 1751 | ## Depositing into Aave 1752 | 1753 | - [Aave V2 Docs](https://docs.aave.com/developers/v/2.0/) 1754 | - [Aave NPM](https://www.npmjs.com/package/@aave/protocol-v2) 1755 | 1756 | ## Borrowing from Aave 1757 | 1758 | - [Aave Borrowing FAQs](https://docs.aave.com/faq/borrowing) 1759 | - [Health Factor](https://docs.aave.com/faq/borrowing#what-is-the-health-factor) 1760 | - [Aave Risk Parameters](https://docs.aave.com/risk/asset-risk/risk-parameters) 1761 | 1762 | ## Repaying with Aave 1763 | 1764 | ## Visualizing the Transactions 1765 | 1766 | - [aTokens](https://docs.aave.com/developers/v/1.0/developing-on-aave/the-protocol/atokens) 1767 | 1768 | ## Lesson 13 Recap 1769 | 1770 | ## Happy Bow-Tie Friday with Austin Griffith 1771 | 1772 | - [Special Guest Austin Griffith](https://twitter.com/austingriffith)! 1773 | - [Speed Run Ethereum](https://speedrunethereum.com/) 1774 | 1775 | ### More DeFi Learnings: 1776 | 1777 | - [Defi-Minimal](https://github.com/smartcontractkit/defi-minimal/tree/main/contracts) 1778 | - [Defi Dad](https://www.youtube.com/channel/UCatItl6C7wJp9txFMbXbSTg) 1779 | 1780 | # Lesson 14: Hardhat NFTs (EVERYTHING you need to know about NFTs) 1781 | 1782 | _[⌨️ (20:28:51) Lesson 14: Hardhat NFTs ](https://www.youtube.com/watch?v=gyMwXuJrbJQ&t=73731s)_ 1783 | 1784 | 💻 Code: https://github.com/PatrickAlphaC/hardhat-nft-fcc 1785 | 1786 | ## What is an NFT? 1787 | 1788 | - [Video](https://www.youtube.com/watch?v=9yuHz6g_P50) 1789 | - [Optional: All on Chain SVG NFT](https://www.youtube.com/watch?v=9oERTH9Bkw0) 1790 | - [EIP-721](https://eips.ethereum.org/EIPS/eip-721) 1791 | 1792 | ## Code Overview 1793 | 1794 | - [Opensea Testnet](https://testnets.opensea.io/) 1795 | 1796 | ## Hardhat Setup 1797 | 1798 | ## Basic NFT 1799 | 1800 | ### Write Tests 1801 | 1802 | - [Openzeppelin NFT](https://docs.openzeppelin.com/contracts/4.x/) 1803 | 1804 | ## Random IPFS NFT 1805 | 1806 | ### Mapping Chainlink VRF Requests 1807 | 1808 | ### Creating Rare NFTs 1809 | 1810 | ### Setting the NFT Image 1811 | 1812 | ### Setting an NFT Mint Price 1813 | 1814 | ### Deploy Script 1815 | 1816 | ### Uploading Token Images with Pinata 1817 | 1818 | - [Pinata](https://pinata.cloud) 1819 | - [nft.storage](https://nft.storage) 1820 | - [Pinata NPM](https://www.npmjs.com/package/@pinata/sdk) 1821 | - [Pinata Docs](https://docs.pinata.cloud/) 1822 | 1823 | ### Uploading Token URIs (metadata) with Pinata 1824 | 1825 | ### Deploying 1826 | 1827 | ### Tests 1828 | 1829 | ## Dynamic SVG On-Chain NFT 1830 | 1831 | - [Patrick's Original Video](https://www.youtube.com/watch?v=9oERTH9Bkw0) 1832 | 1833 | ### What is an SVG? 1834 | 1835 | - [SVG Tutorial](https://www.w3schools.com/graphics/svg_intro.asp) 1836 | - [On-Chain SVG Example](https://opensea.io/assets/matic/0x291ff90b9c410f56e047599bfee6b585c0c484d7/2) 1837 | 1838 | ### Initial Code 1839 | 1840 | ### Base64 Encoding 1841 | 1842 | - [Base64 Encoding](https://en.wikipedia.org/wiki/Base64) 1843 | - [Example Encoder](https://base64.guru/converter/encode/image/svg) 1844 | - [base64-sol](https://www.npmjs.com/package/base64-sol/v/1.0.1) 1845 | 1846 | ## Advanced: EVM Opcodes, Encoding, and Calling 1847 | 1848 | ### abi.encode & abi.encodePacked 1849 | 1850 | - [abi.encode](https://docs.soliditylang.org/en/latest/cheatsheet.html?highlight=cheatsheet#global-variables) 1851 | - [abi.encodePacked](https://docs.soliditylang.org/en/latest/cheatsheet.html?highlight=cheatsheet#global-variables) 1852 | Thanks to [Alex Roan](https://twitter.com/alexroan) for his help on this session! 1853 | - [Example Contract Creation Transaction](https://etherscan.io/tx/0x112133a0a74af775234c077c397c8b75850ceb61840b33b23ae06b753da40490) 1854 | What REALLY is the ABI? 1855 | - [EVM Opcodes](https://www.evm.codes/) 1856 | - [More EVM Opcodes](https://github.com/crytic/evm-opcodes) 1857 | - [Solidity Cheatsheet](https://docs.soliditylang.org/en/latest/cheatsheet.html?highlight=encodewithsignature) 1858 | - [abi.encode vs abi.encodePacked](https://ethereum.stackexchange.com/questions/91826/why-are-there-two-methods-encoding-arguments-abi-encode-and-abi-encodepacked) 1859 | 1860 | ### Introduction to Encoding Function Calls Directly 1861 | 1862 | ### Introduction to Encoding Function Calls Recap 1863 | 1864 | ### Encoding Function Calls Directly 1865 | 1866 | - [Function Selector](https://blog.openzeppelin.com/deconstructing-a-solidity-contract-part-iii-the-function-selector-6a9b6886ea49/) 1867 | - [Function Signature](https://twitter.com/PatrickAlphaC/status/1517156225670078465) 1868 | 1869 | ### Creating an NFT TokenURI on-Chain 1870 | 1871 | ### Making the NFT Dynamic 1872 | 1873 | ### Deploy Script 1874 | 1875 | ## Deploying the NFTs to a Testnet 1876 | 1877 | ## Lesson 14 Recap 1878 | 1879 | Extra credit: 1880 | 1881 | - [Deconstructing Solidity](https://blog.openzeppelin.com/deconstructing-a-solidity-contract-part-ii-creation-vs-runtime-6b9d60ecb44c/) 1882 | - [Knowing and controlling your Smart Contract Address](https://www.youtube.com/watch?v=56K0FdosZ8g) 1883 | - [From Solidity to byte code](https://www.youtube.com/watch?v=RxL_1AfV7N4) 1884 | 1885 | # Lesson 15: NextJS NFT Marketplace (If you finish this lesson, you are a full-stack MONSTER!) 1886 | 1887 | _[⌨️ (23:37:03) Lesson 15: NextJS NFT Marketplace (Full Stack / Front End)](https://www.youtube.com/watch?v=gyMwXuJrbJQ&t=85023s)_ 1888 | 1889 | ## Large Update, please read 1890 | 1891 | Moralis has recently updated to a self-hosted server over their own server. For this, you can do one of the following: 1892 | 1893 | - [Learn how to run one yourself](https://www.youtube.com/watch?v=9GtysZs-FrA) 1894 | - Follow along to learn the concepts of this more interactive app, without actually coding along 1895 | - Skip to the section where we interact with the graph 1896 | 1897 | TL;DR: TheGraph code should work exactly the same as the video, however the Moralis code will not. 1898 | 1899 | 💻 Code: 1900 | 1901 | - Backend (Contracts): https://github.com/PatrickAlphaC/hardhat-nft-marketplace-fcc 1902 | - Frontend (Moralis Indexer): https://github.com/PatrickAlphaC/nextjs-nft-marketplace-moralis-fcc 1903 | - Frontend (TheGraph Indexer): https://github.com/PatrickAlphaC/nextjs-nft-marketplace-thegraph-fcc 1904 | - The Graph: https://github.com/PatrickAlphaC/graph-nft-marketplace-fcc 1905 | 1906 | Special thanks to [Matt Durkin](https://twitter.com/mdurkin92) for help with this section. 1907 | 1908 | ## Introduction 1909 | 1910 | - [Opensea](https://opensea.io/) 1911 | - [Artion](https://github.com/Fantom-foundation/Artion-Contracts) 1912 | 1913 | ## Part I: NFT Marketplace Contracts 1914 | 1915 | ### Hardhat Setup 1916 | 1917 | ### NftMarketplace.sol 1918 | 1919 | - [Pull Over Push](https://fravoll.github.io/solidity-patterns/pull_over_push.html) 1920 | 1921 | ## Reentrancy 1922 | 1923 | - [Reentrancy](https://solidity-by-example.org/hacks/re-entrancy) 1924 | - [Rekt.news](https://rekt.news/leaderboard/) 1925 | - [Openzeppelin NonReentrant](https://docs.openzeppelin.com/contracts/4.x/api/security#ReentrancyGuard) 1926 | 1927 | ### NftMarketplace.sol - Continued 1928 | 1929 | ### NftMarketplace.sol - Deploy Script 1930 | 1931 | ### NftMarketplace.sol - Tests 1932 | 1933 | ### NftMarketplace.sol - Scripts 1934 | 1935 | ## Part II: Moralis Front End 1936 | 1937 | ### What is Moralis? 1938 | 1939 | - [Special Guest Ivan Liljeqvist](https://twitter.com/IvanOnTech) 1940 | 1941 | ### NextJS Setup 1942 | 1943 | - [Link NextJS](https://nextjs.org/docs/api-reference/next/link) 1944 | 1945 | ### Adding Tailwind 1946 | 1947 | - [Tailwind with NextJS](https://tailwindcss.com/docs/guides/nextjs) 1948 | 1949 | ### Introduction to Indexing in Web3 1950 | 1951 | - [TheGraph](https://thegraph.com/en/) 1952 | - [Moralis](https://moralis.io/) 1953 | 1954 | ### Connecting Moralis to our Local Hardhat Node 1955 | 1956 | - [NextJS Environment Variables](https://nextjs.org/docs/basic-features/environment-variables) 1957 | - [Reverse Proxy FRP](https://github.com/fatedier/frp/releases) 1958 | - [Docs](https://docs.moralis.io/moralis-dapp/web3/setting-up-ganache) 1959 | - [Trouble Shooting](https://docs.moralis.io/faq#frpc) 1960 | - [Moralis Forum](https://forum.moralis.io/) 1961 | - [Moralis Admin CLI](https://docs.moralis.io/moralis-dapp/tools/moralis-admin-cli) 1962 | 1963 | ### Moralis Event Sync 1964 | 1965 | - [Moralis Add Event Sync From Code](https://docs.moralis.io/moralis-dapp/connect-the-sdk/connect-using-node#add-new-event-sync-from-code) 1966 | 1967 | #### Reset Local Chain 1968 | 1969 | ### Moralis Cloud Functions 1970 | 1971 | - [Moralis Cloud Functions](https://docs.moralis.io/moralis-dapp/cloud-code/cloud-functions) 1972 | - [Moralis Logging](https://docs.moralis.io/moralis-dapp/tools/moralis-admin-cli#get-logs) 1973 | - [Hardhat Network Reference](https://hardhat.org/hardhat-network/reference/) 1974 | - Moralis Database only confirms a transaction with a block confirmation - so we need to move blocks on our hardhat local node. 1975 | - [Moralis Triggers](https://docs.moralis.io/moralis-dapp/cloud-code/triggers) 1976 | 1977 | #### Practice Resetting the Local Chain 1978 | 1979 | ### Moralis Cloud Functions II 1980 | 1981 | ### Querying the Moralis Database 1982 | 1983 | - [Moralis Queries](https://docs.moralis.io/moralis-dapp/database/queries) 1984 | 1985 | ### Rendering the NFT Images 1986 | 1987 | - [useNFTBalance](https://github.com/MoralisWeb3/react-moralis#usenftbalances) 1988 | - [fetch](https://www.npmjs.com/package/node-fetch) 1989 | - [next/image](https://nextjs.org/docs/api-reference/next/image#loader-configuration) 1990 | 1991 | ### Update Listing Modal 1992 | 1993 | ### Buy NFT Listing 1994 | 1995 | ### Listing NFTs for Sale 1996 | 1997 | - [web3uikit Form](https://web3uikit.com/) 1998 | 1999 | ## Part III: TheGraph Front End 2000 | 2001 | ### Introduction 2002 | 2003 | ### What is The Graph? 2004 | 2005 | - [Special Guest Nader Dabit](https://twitter.com/dabit3) 2006 | 2007 | ### Building a Subgraph 2008 | 2009 | - [Example Subgraphs](https://thegraph.com/explorer/) 2010 | - [The Graph Studio](https://thegraph.com/studio/) 2011 | - [GraphQL VSCode Extension](https://marketplace.visualstudio.com/items?itemName=GraphQL.vscode-graphql) 2012 | - [GraphQL](https://graphql.org/) 2013 | 2014 | ### Deploying our Subgraph 2015 | 2016 | - [GraphQL Queries](https://www.tutorialspoint.com/graphql/graphql_query.htm) 2017 | 2018 | ### Reading from The Graph 2019 | 2020 | - [@apollo/client](https://www.npmjs.com/package/@apollo/client) 2021 | - [gql](https://www.npmjs.com/package/gql) 2022 | - [The Graph Docs](https://thegraph.com/docs/en/) 2023 | 2024 | ### Hosting our Dapp 2025 | 2026 | 🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊 Completed Front End Basics! 🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊 2027 | 2028 | # Lesson 16: Hardhat Upgrades 2029 | 2030 | _[⌨️ (28:53:11) Lesson 16: Hardhat Upgrades](https://www.youtube.com/watch?v=gyMwXuJrbJQ&t=103991s)_ 2031 | 2032 | 💻 Code: https://github.com/PatrickAlphaC/hardhat-upgrades-fcc 2033 | 2034 | ## Upgradable Smart Contracts Overview 2035 | 2036 | - [Optional Video](https://www.youtube.com/watch?v=bdXJmWajZRY) 2037 | - [Links from Video] 2038 | 2039 | ## Types of Upgrades 2040 | 2041 | 1. Parameter 2042 | 2. Social Migrate 2043 | 3. Proxy 2044 | 1. Proxy Gotchas 2045 | 1. [Function Collisions](https://blog.openzeppelin.com/the-state-of-smart-contract-upgrades/#diamonds) 2046 | 2. [Storage Collisions](https://blog.openzeppelin.com/the-state-of-smart-contract-upgrades/#diamonds) 2047 | 2. [Metamorphic Upgrades](https://github.com/PatrickAlphaC/hardhat-metamorphic-upgrades-fcc) 2048 | 3. [Transparent](https://blog.openzeppelin.com/the-transparent-proxy-pattern/) 2049 | 4. [UUPS](https://forum.openzeppelin.com/t/uups-proxies-tutorial-solidity-javascript/7786) 2050 | 5. [Diamond](https://eips.ethereum.org/EIPS/eip-2535) 2051 | 2052 | ## Delegatecall 2053 | 2054 | - [delegatecall (solidity-by-example)](https://solidity-by-example.org/delegatecall) 2055 | - [Yul](https://docs.soliditylang.org/en/latest/yul.html) 2056 | 2057 | ## Small Proxy Example 2058 | 2059 | - [EIP 1967](https://eips.ethereum.org/EIPS/eip-1967) 2060 | 2061 | ## Transparent Upgradable Smart Contract 2062 | 2063 | - [Hardhat-deploy Proxies](https://github.com/wighawag/hardhat-deploy#deploying-and-upgrading-proxies) 2064 | - [Openzeppelin Upgrades Plugin](https://docs.openzeppelin.com/upgrades-plugins/1.x/) 2065 | - [Openzeppelin upgrades tutorial](https://forum.openzeppelin.com/t/openzeppelin-upgrades-step-by-step-tutorial-for-hardhat/3580) 2066 | - [hardhat deploy upgrades examples](https://github.com/wighawag/template-ethereum-contracts/tree/examples/openzeppelin-proxies/deploy) 2067 | 2068 | # Lesson 17: Hardhat DAOs 2069 | 2070 | _[⌨️ (29:45:24) Lesson 17: Hardhat DAOs](https://www.youtube.com/watch?v=gyMwXuJrbJQ&t=107124s)_ 2071 | 2072 | ⬆️ Up-to-date code: https://github.com/PatrickAlphaC/dao-template 2073 | 2074 | 💻 Code from video: https://github.com/PatrickAlphaC/hardhat-dao-fcc 2075 | 2076 | ## Introduction 2077 | 2078 | ## What is a DAO? 2079 | 2080 | - [What is a DAO?](https://www.youtube.com/watch?v=X_QKZzd68ro) 2081 | 2082 | ## How to build a DAO 2083 | 2084 | - [How to build a DAO](https://www.youtube.com/watch?v=AhJtmUqhAqg) 2085 | - That's Patrick 2086 | - [PY Code](https://github.com/brownie-mix/dao-mix) 2087 | - [Python Video](https://www.youtube.com/watch?v=rD8AxZ_wBA4) 2088 | - [Openzeppelin Governance](https://docs.openzeppelin.com/contracts/4.x/api/governance) 2089 | - [Compound Governance](https://compound.finance/governance) 2090 | - [Contract Wizard](https://docs.openzeppelin.com/contracts/4.x/wizard) 2091 | - [CastVoteBySig](https://forum.openzeppelin.com/t/what-is-votecastbysig/17069/2) 2092 | 2093 | # Lesson 18: Security & Auditing 2094 | 2095 | _[⌨️ (31:28:32) Lesson 18: Security & Auditing ](https://www.youtube.com/watch?v=gyMwXuJrbJQ&t=113312s)_ 2096 | 2097 | 💻 Code: https://github.com/PatrickAlphaC/hardhat-security-fcc 2098 | 2099 | ## Introduction 2100 | 2101 | - [Readiness Guide](https://learn.openzeppelin.com/security-audits/readiness-guide) 2102 | 2103 | ## Slither 2104 | 2105 | - [Install python](https://www.python.org/downloads/) 2106 | - [Slither](https://github.com/crytic/slither#how-to-install) 2107 | - [solc-select](https://github.com/crytic/solc-select) 2108 | - [Fuzz testing](https://en.wikipedia.org/wiki/Fuzzing) 2109 | 2110 | ## Fuzzing and Eth Security Toolbox 2111 | 2112 | - [Echidna](https://github.com/crytic/echidna) 2113 | - [Docker Install](https://docs.docker.com/get-docker/) 2114 | - [Eth-Security-ToolBox](https://github.com/trailofbits/eth-security-toolbox) 2115 | 2116 | ## Closing Thoughts 2117 | 2118 | - [Best Practices](https://consensys.github.io/smart-contract-best-practices/) 2119 | - [Attacks](https://consensys.github.io/smart-contract-best-practices/attacks/) 2120 | - [Oracle Attacks](https://hackernoon.com/how-dollar100m-got-stolen-from-defi-in-2021-price-oracle-manipulation-and-flash-loan-attacks-explained-3n6q33r1) 2121 | - [Re-entrancy Attacks](https://quantstamp.com/blog/what-is-a-re-entrancy-attack) 2122 | - [Damn Vulnerable Defi](https://www.damnvulnerabledefi.xyz/) 2123 | - [Ethernaut](https://ethernaut.openzeppelin.com/) 2124 | - Some Auditors: 2125 | - [OpenZeppelin](https://openzeppelin.com/) 2126 | - [SigmaPrime](https://sigmaprime.io/) 2127 | - [Trail of Bits](https://www.trailofbits.com/) 2128 | 2129 | # Congratulations 2130 | 2131 | 🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊 Completed The Course! 🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊 2132 | 2133 | ## Where do I go now? 2134 | 2135 | ### Learning More 2136 | 2137 | - [CryptoZombies](https://cryptozombies.io/) 2138 | - [Patrick Collins](https://www.youtube.com/channel/UCn-3f8tw_E1jZvhuHatROwA) 2139 | - [Dapp University](https://www.youtube.com/channel/UCY0xL8V6NzzFcwzHCgB8orQ) 2140 | - [ChainShot](https://www.chainshot.com/courses) 2141 | - [Cami Ramos Garzon](https://twitter.com/camiinthisthang) 2142 | - [Albert Hu](https://twitter.com/thatguyintech) 2143 | - [Ivan Liljeqvist](https://twitter.com/IvanOnTech) 2144 | - [Ally Haire](https://twitter.com/DeveloperAlly) 2145 | - [Stephen Fluin](https://twitter.com/stephenfluin) 2146 | - [Eat the Blocks](https://www.youtube.com/channel/UCZM8XQjNOyG2ElPpEUtNasA) 2147 | - [Austin Griffith](https://www.youtube.com/channel/UC_HI2i2peo1A-STdG22GFsA) 2148 | - [Nader Dabit](https://www.youtube.com/user/boyindasouth) 2149 | - [Ethereum.org](https://ethereum.org/en/) 2150 | 2151 | ### Community 2152 | 2153 | - [Twitter](https://twitter.com/PatrickAlphaC) 2154 | - [Hardhat Discord](https://hardhat.org/discord) 2155 | - [Ethereum Python Community Discord](https://discord.gg/9zk7snTfWe) 2156 | - [Chainlink Discord](https://discord.gg/2YHSAey) 2157 | - [Ethereum Discord](https://ethereum.org/en/) 2158 | - [Reddit ethdev](https://www.reddit.com/r/ethdev/) 2159 | 2160 | ### Hackathons 2161 | 2162 | - [CL Hackathon](https://chain.link/hackathon) 2163 | - [ETHGlobal](https://ethglobal.com/) 2164 | - [ETHIndia](https://ethindia.co/) 2165 | 2166 | Be sure to check out project grant programs! 2167 | 2168 | And make today an amazing day! 2169 | 2170 | # Thank you 2171 | 2172 | 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 Chainlink Labs for encouraging this course to come to light-and to the many Chainlink Labs team members who helped with various assets! 2173 | 2174 | [![Patrick Collins Twitter](https://img.shields.io/badge/Twitter-1DA1F2?style=for-the-badge&logo=twitter&logoColor=white)](https://twitter.com/PatrickAlphaC) 2175 | [![Patrick Collins YouTube](https://img.shields.io/badge/YouTube-FF0000?style=for-the-badge&logo=youtube&logoColor=white)](https://www.youtube.com/channel/UCn-3f8tw_E1jZvhuHatROwA) 2176 | [![Patrick Collins Linkedin](https://img.shields.io/badge/LinkedIn-0077B5?style=for-the-badge&logo=linkedin&logoColor=white)](https://www.linkedin.com/in/patrickalphac/) 2177 | [![Patrick Collins Medium](https://img.shields.io/badge/Medium-000000?style=for-the-badge&logo=medium&logoColor=white)](https://medium.com/@patrick.collins_58673/) 2178 | -------------------------------------------------------------------------------- /chronological-updates.md: -------------------------------------------------------------------------------- 1 | # Chronological Updates 2 | 3 | This file will contain all updates to sections. 4 | 5 | # Lesson 5 6 | ## Windows, WSL, & Ganache 7 | - Per [this question](https://github.com/smartcontractkit/full-blockchain-solidity-course-js/discussions/34#discussioncomment-2846436), if you're using WSL, for the ganache UI you'll have to use a different endpoint. 8 | 9 | You have 4 options to fix this: 10 | 1. Use the WSL endpoint on the ganache UI (this sometimes doesn't work) 11 | 2. Use `ganache` from the command line 12 | 3. Use `ganache-cli` from the command line (not recommended) 13 | 4. Just use `hardhat` from the command line (you'll have to use hardhat at some point anyways!) 14 | 15 | ### Using the WSL Endpoint 16 | On the Ganache UI, you can select a different hostname and connect to whatever IP you see. In the example below, you'd connect to `172.24.224.1` 17 | 18 | ![img](./img/ganache-windows.png) 19 | 20 | You can also try to edit it by: 21 | 22 | 1. Inside Ganache in the top-right corner tap on the gear icon (settings). 23 | 2. Then in the server tab, change the HOSTNAME and select 0.0.0.0 - All Interfaces. 24 | 3. Now replace your RPC Server URL inside the code with this latest URL that will be something like: HTTP://0.0.0.0.7545. Recheck this from Ganache. 25 | 26 | ### Using `ganache` 27 | 28 | ``` 29 | yarn global add ganache 30 | ganache 31 | ``` 32 | 33 | Keep this running in it's own terminal, and use the endpoint it gives you. To kill it, press `CTRL` + `C`. 34 | 35 | [See the discussion here](https://github.com/smartcontractkit/full-blockchain-solidity-course-js/discussions/34) 36 | 37 | ### Using `ganache-cli` from the command line. 38 | Or, optionally, you can install `ganache-cli` [as this user did](https://github.com/smartcontractkit/full-blockchain-solidity-course-js/discussions/39#discussioncomment-2854165). 39 | 40 | ``` 41 | yarn global add ganache-cli 42 | ganache-cli 43 | ``` 44 | 45 | Keep this running in it's own terminal, and use the endpoint it gives you. To kill it, press `CTRL` + `C`. 46 | 47 | ### Using `hardhat` 48 | 49 | [See the discussion here](https://github.com/smartcontractkit/full-blockchain-solidity-course-js/discussions/90#discussioncomment-2871657) 50 | 51 | ``` 52 | yarn add --dev hardhat 53 | yarn hardhat 54 | ``` 55 | 56 | Then select the `Create an empty hardhat.config.js` 57 | 58 | Then run: 59 | 60 | ``` 61 | yarn hardhat node 62 | ``` 63 | 64 | Keep this running in it's own terminal, and use the endpoint it gives you. To kill it, press `CTRL` + `C`. 65 | 66 | 67 | -------- 68 | 69 | # Lesson 6 70 | 71 | ## New Hardhat Setup 72 | 73 | As of `2.10.0` version of hardhat, when you first run `yarn hardhat` you'll get something like this instead: 74 | 75 | ```bash 76 | 888 888 888 888 888 77 | 888 888 888 888 888 78 | 888 888 888 888 888 79 | 8888888888 8888b. 888d888 .d88888 88888b. 8888b. 888888 80 | 888 888 "88b 888P" d88" 888 888 "88b "88b 888 81 | 888 888 .d888888 888 888 888 888 888 .d888888 888 82 | 888 888 888 888 888 Y88b 888 888 888 888 888 Y88b. 83 | 888 888 "Y888888 888 "Y88888 888 888 "Y888888 "Y888 84 | 85 | 👷 Welcome to Hardhat v2.10.0 👷‍ 86 | 87 | ? What do you want to do? … 88 | ❯ Create a JavaScript project 89 | Create a TypeScript project 90 | Create an empty hardhat.config.js 91 | Quit 92 | ``` 93 | 94 | It's _roughly_ similar to the options in our video, but you can just pick the `JavaScript project` whenever we don't pick the `empty hardhat.config.js`. 95 | 96 | [You can read more about the changes here.](https://twitter.com/HardhatHQ/status/1545124474470760449) 97 | 98 | ---------- 99 | 100 | # Lesson 7 101 | 102 | ## New Hardhat Setup 103 | 104 | As the previous section has highlighted, changes in the hardhat version changed the hardhat startup menu. You can choose to go with the new menu but if you feel lost and still want to access the old one used in the video, you can do so by installing `hardhat v2.9.3` 105 | 106 | Run `yarn add --dev hardhat@2.9.3` 107 | 108 | --------- 109 | 110 | # Lesson 9 111 | 112 | ## Keepers new UI 113 | 114 | Per [this conversation](https://github.com/smartcontractkit/full-blockchain-solidity-course-js/discussions/606#discussioncomment-3037792), when you get to the new Keepers UI, select "Custom Logic" 115 | 116 | More information: https://github.com/smartcontractkit/full-blockchain-solidity-course-js/discussions/606#discussioncomment-3037792 117 | 118 | ## Keepers Not Kicking Off Troubleshooting 119 | 120 | If your keepers are not kicking off, run through this checklist to find out why. 121 | 122 | 1. Double check the subscription ID in your contract 123 | 2. Double check the subscription is funded with enough LINK 124 | 3. Is `checkUpkeep` returning true? 125 | 4. Can you call `performUpkeep` yourself? (If you can't the keeper can't!) 126 | 127 | 128 | ------- 129 | # Lesson 14 130 | 131 | ## Math on NFT Chance Array 132 | 133 | The ```getBreedFromModdedRng()``` function in RandomIpfsNft.sol gets the math wrong. 134 | 135 | line 104, 136 | ```solidity 137 | if (moddedRng >= cumulativeSum && moddedRng < cumulativeSum + chanceArray[i]) { 138 | return Breed(i); 139 | } 140 | cumulativeSum = cumulativeSum + chanceArray[i]; 141 | ``` 142 | needs to be changed to 143 | ```solidity 144 | if (moddedRng >= cumulativeSum && moddedRng < chanceArray[i]) { 145 | return Breed(i); 146 | } 147 | cumulativeSum = chanceArray[i]; 148 | ``` 149 | 150 | The chanceArray[] array already has a cumulative probability distribution, no need to keep adding cumulativeSum to it. 151 | 152 | According to the current algorithm: 153 | ``` 154 | moddedRng produced is between 0 and 99 155 | chanceArray=[10,30,100] 156 | ``` 157 | ``` 158 | PUG is produced if moddedRng is between [0,10) = span of 10 159 | SHIBA is produce if moddedRng is between [10,40) = span of 30 160 | BERNARD is produced if moddedRng is between [40,140] = span of 60 (since moddedRng<100) 161 | ``` 162 | So the actual probabilities according to the current algo is 163 | ``` [10%,30%,60%] ``` 164 | and not 165 | ``` [10%,20%,70%]``` 166 | as would be expected from a proper cumulative probability distribution function. 167 | 168 | ------- 169 | 170 | # Lesson 15 171 | 172 | ## Metamask Troubleshooting while using Gitpod 173 | 174 | - Remember if you are using gitpod then you cannot connect your local hardhat node with metamask. To resolve this you can use vs code or testnets instead of local node. 175 | 176 | # Large Update, please read 177 | Moralis has recently updated to a self-hosted server over their own server. For this, you can do one of the following: 178 | 179 | - Learn how to run one yourself 180 | - Follow along to learn the concepts of this more interactive app, without actually coding along 181 | - Skip to the section where we interact with the graph 182 | 183 | TL;DR: TheGraph code should work exactly the same as the video, however the Moralis code will not. 184 | 185 | -------- 186 | 187 | 188 | -------------------------------------------------------------------------------- /how-to-answer-a-question.md: -------------------------------------------------------------------------------- 1 | # How to answer questions 2 | 3 | Thank you for wanting to answer questions! This is how we grow as a community :) 4 | 5 | 1. Make sure the question follows the "how-to-ask-a-good-question" guide 6 | 2. Make sure your answer unblocks the user 7 | 3. Remember, this is living documentation! 8 | 4. Format your answers, like in the `how-to-ask-a-question` guide. 9 | 10 | 11 | # 1. Make sure the question follows the "how-to-ask-a-good-question" guide 12 | 13 | If the question is poorly formatted and you know how to reformat it reformat it and ask them next time to format their code. 14 | 15 | If the question is posted in the wrong place (like a theoretical question posted on stackoverflow) kindly let them know that it's in the wrong place. 16 | 17 | If the question has already been asked and answered, answer with a link to the question that has already been asked and answered and ask if that solves the problem. 18 | 19 | If the problem has a poor title, doesn't make sense to others, etc, feel free to edit the question to what does if you can understand it. If not, you can answer saying "I don't quite understand what you're asking, could you reformat your question following the "how to ask a question" guide? 20 | 21 | If they used screenshots, feel free to ask them to copy-paste the code. 22 | 23 | Or, feel free to ignore it. This is a community run forum and no one is "entitled to" answers! Be nice, be respectful, and have fun. But if you do know how to help someone, a little "could you please refactor your question" can go a long way! 24 | 25 | ### Don't feel obliged to help right away if they are not asking well-formatted questions. Make them ask a well-formatted question first before you answer! 26 | 27 | But don't be a jerk about it. If they just need a little formatting touch up, just touch up their question for them. 28 | 29 | # 2. Make sure your answer unblocks them 30 | 31 | Often times, people will ask questions where the answer might be X, but they are trying to do Y. Try to anticipate what people are trying to do. Answer the question at face value, and then maybe give more information on where to go next. 32 | 33 | Often, giving a summary of your answer at the top with copy pasteable code, and then a "more information" is a best practice. 34 | 35 | # 3. Remember this is living documentation! 36 | 37 | Treat it as such. Go back and update answers if you find them! 38 | 39 | # 4. Format your answers, like in the `how-to-ask-a-question` guide. 40 | 41 | See that guide for more information. -------------------------------------------------------------------------------- /how-to-ask-a-question.md: -------------------------------------------------------------------------------- 1 | # How to ask a question 2 | 3 | > Note: Before reading this, you might want to read my guide on [top 6 tips to solve any software engineering error](https://medium.com/better-programming/top-6-tips-to-solve-any-software-engineering-error-a794a162fcaf). 4 | 5 | Also note, take this pledge: "I solemnly swear that after asking a question I will spend at least 5 minutes trying to answer someone else's question. I will consult the 'How to answer a question' page before I do so. " 6 | 7 | The internet is our documentation, and we want to treat is as such. **Every** *specific* question we have *should* be able to be found by typing it into a web search bar. 8 | 9 | Now, there are no "bad" questions, but there are poorly-formatted questions. A poorly formatted question has a low chance of being answered, poor chance of being discovered, and can "clutter up" forums and discussion boards. So let's make sure we strive for well-formatted questions! 10 | 11 | # Full Examples at the bottom! 12 | 13 | Here are the steps to ask a well-formatted question: 14 | 15 | 1. Search to see if the question has already been asked 16 | 2. Know where to post your question 17 | 3. Make a title that summarizes the problem 18 | 4. Introduce the problem before writing any code 19 | 5. Make sure you format code using backticks (```) and a language tag 20 | 6. Make sure you copy paste your code instead of using screenshots 21 | 7. Make sure your code is a minimal example 22 | 23 | 24 | # 1. Search to see if the question has already been asked 25 | 26 | ## Do not skip this step! 27 | 28 | We should think of the internet as one giant document. If a question has already been asked and you can find it on the first page of your search engine, it's good! Don't ask the question again! 29 | 30 | And if it's not on the first page of your search results, then **yes, you should 100% ask the question on a forum even if you know the answer.** 31 | 32 | We want every tech question ever to be: 33 | 34 | 1. Indexed by search engines 35 | 2. Easy to find 36 | 3. Easy to reproduce 37 | 38 | So that in 6 months when you forget the answer, you can just google it and it'll show up! 39 | 40 | We don't want there to be multiple questions, because that can fragment where people look! We want to add answers, comments, etc all in one place 41 | 42 | # 2. Know where to post your question 43 | 44 | I categorize questions into one of three: 45 | 46 | - Specific code based questions 47 | - Generic theoretical questions 48 | - "In the know", support, or emergency questions 49 | 50 | ## Specific code based questions 51 | 52 | These are what we strive for. These are reproducible questions that help the world. You'll want to put these questions in places like: 53 | 54 | - The "Q&A" discussions section of this course 55 | - stackoverflow 56 | - stack exchange ETH. 57 | 58 | These are questions that typically can have a "right" or "many right answers". Generally, these are not very opinionated questions. 59 | 60 | These are questions like "How to convert bytes32 to uint256". 61 | 62 | ## Generic Theoretical Questions 63 | 64 | These are questions that likely do not have a canonical answer. These are questions like "which blockchain should I deploy to?" or "How could I make a game that involves many random characters?". They belong in places like: 65 | 66 | - The "General" discussions section of this course 67 | - A generic forum like Reddit, Twitter 68 | - Discord (like some of the ones people have started here) 69 | 70 | Ideally, you put these on an indexed forum like reddit and the general discussions section instead of discord so others can do a web search for the problems. 71 | 72 | ## "In the know", support, or emergency questions 73 | 74 | These are very specific use cases and 99% of your questions will not be these kinds. These are questions like "we just got hacked, can you help us?", "Want to join my team", etc. They are questions that likely only apply to your situation and what you are doing. They belong in: 75 | 76 | - Discord DMs 77 | - Email 78 | - etc 79 | 80 | And should be used *very* sparingly. 81 | 82 | # 3. Make a title that summarizes the problem 83 | 84 | It should be minimal, searchable, indexable (by search engines). 85 | 86 | ## Examples: 87 | Bad: 88 | - I'm stuck, please help 89 | 90 | Good: 91 | - Could Not Detect Network using WSL & Ganache 92 | 93 | Bad: 94 | - hardhat error 95 | 96 | Good: 97 | - TypeError: Cannot read property 'length' of undefined - when deploying contract 98 | 99 | # 4. Introduce the problem before writing any code 100 | 101 | In the body of the question, say what you're trying to do, what you've done, and give a summary of your problem. 102 | 103 | With this course in the discussions tab, you may also give a timestamp of where you're getting the issue (in fact, please give a timestamp with a link to the location in the video). 104 | 105 | # 5. Make sure you format code using backticks (```) and a language tag 106 | 107 | You'll want to format your question so it's as easy as possible to read! Especially with your code snippets. 108 | 109 | Your code should show up like this: 110 | 111 | ```javascript 112 | // my code here 113 | ``` 114 | 115 | In your question, you'll type it like this: 116 | 117 | ```` 118 | ```javascript 119 | // my code here 120 | ``` 121 | ```` 122 | 123 | If it doesn't get formatted, you can edit your question (usually, you can click the three little dots at the top right of your question) to make it formatted nicely. 124 | 125 | # 6. Make sure you copy paste your code instead of using screenshots 126 | 127 | We want web crawlers to index every word you write, so even copy paste errors (and format them with 3 backticks!) 128 | 129 | 130 | # 7. Make sure your code is a minimal example 131 | 132 | There are two types of code questions: 133 | 134 | - Debug me 135 | - Specific questions 136 | 137 | Don't be a "Debug Me" 138 | 139 | ## Example of a poorly formatted question (a debug me question): 140 | 141 | Hi I'm confused my code isn't working here is all my code 142 | 143 | ```javascript 144 | // pretend I pasted like 300 lines of code here 145 | ``` 146 | 147 | ## Example of a much better question 148 | 149 | I'm getting `error x` on line 42 of my code: 150 | 151 | ```javascript 152 | const some_var = "dog" 153 | // this is the line that is erroring 154 | ``` 155 | 156 | [More information on reproducible code.](https://stackoverflow.com/help/minimal-reproducible-example) 157 | 158 | 159 | 160 | -------------------------------------------------------------------------------- /img/blockchain1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartcontractkit/full-blockchain-solidity-course-js/3e1b1d8bc558df64d19fd31ac363089a2e5d69ff/img/blockchain1.png -------------------------------------------------------------------------------- /img/ganache-windows.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartcontractkit/full-blockchain-solidity-course-js/3e1b1d8bc558df64d19fd31ac363089a2e5d69ff/img/ganache-windows.png -------------------------------------------------------------------------------- /img/hh-fcc-background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartcontractkit/full-blockchain-solidity-course-js/3e1b1d8bc558df64d19fd31ac363089a2e5d69ff/img/hh-fcc-background.png --------------------------------------------------------------------------------