Smart contract constructor

This lesson focuses on using the constructor function in Solidity for role assignment, particularly for setting a contract owner. It discusses the security implications and demonstrates how to restrict certain functionalities, like fund withdrawal, to the owner.

1. Fund me introduction
Introduction to decentralized crowdfunding contract 'FundMe.sol', allowing users to send native blockchain cryptocurrency, with the owner being able to withdraw the funds. The lesson covers deploying on a testnet and handling transactions in Ethereum, Polygon, or Avalanche. Duration: 3min
2. Project setup
This lesson guides through the initial steps in coding the 'FundMe' contract, which allows users to send funds and an owner to withdraw them. It involves setting up the Remix IDE workspace, outlining the contract functions, and focusing on the 'fund' function. Duration: 2min
3. Sending ETH through a function
This chapter explains how to create a function in a smart contract that requires a minimum amount of Ethereum (ETH) to be sent Duration: 4min
4. Solidity reverts
The lesson focuses on understanding 'reverts' and 'gas' in Ethereum transactions. It covers the concept of reverting transactions, checking gas usage, and how gas is used and refunded in failed transactions. The lesson also explores transaction fields and gas limits. Duration: 4min
5. Intro to oracles - getting real world price data
This lesson introduces the concept of decentralized oracles and Chainlink for getting real-world price data into smart contracts. It explains how to update contracts for currency conversion, use Chainlink data feeds, and discusses Chainlink's role in blockchain oracles. Duration: 14min
6. Quiz: Fund Me Intro Quiz
Questions: 3
7. Mid section recap
A recap of key concepts covered so far, including marking functions as payable for transactions, using 'require' statements, handling values with 'msg.value', and integrating external data using Chainlink for accurate real-world asset pricing in smart contracts. Duration: 1min
8. Solidity interfaces
This lesson delves into using Solidity interfaces for converting Ethereum into USD and interacting with contracts. It explains how interfaces work, the importance of contract addresses and ABIs, and demonstrates interfacing with the Chainlink Aggregator V3 for price feeds. Duration: 7min
9. Use AI to help pt.2
A lesson on using AI models like ChatGPT for understanding complex programming concepts in Solidity, focusing on the function of returning values without logic defined in interfaces. It explores the interaction between functions, contracts, and addresses using AI insights. Duration: 3min
10. Importing libaries from NPM and Github
This chapter explores how to import libraries and interfaces directly from GitHub or NPM in Ethereum contract development. It covers the benefits of direct imports for managing interfaces, using the Chainlink AggregatorV3Interface as an example. Duration: 3min
11. Getting real world price data from Chainlink
The lesson focuses on extracting real-world pricing information using the Aggregator V3 interface from Chainlink. It covers creating contract instances, summoning 'latestRoundData', dealing with decimals in Solidity, and typecasting for price and value compatibility. Duration: 4min
12. Solidity math
This lesson provides insights into converting Ethereum value to USD using Solidity. It covers the implementation of 'getPrice' and 'getConversionRate' functions, understanding decimal places, value validation, and deployment on a testnet. Duration: 6min
13. Msg sender explained
The lesson introduces the use of Solidity's global variables, arrays, and mappings to track users sending money to a contract. It covers creating a mechanism to record addresses and amounts sent by users using 'msg.sender' and mappings. Duration: 2min
14. Quick section recap
A comprehensive refresher on key concepts in Advanced Solidity, covering contract addresses and ABIs, interfacing with contracts, using Chainlink Price Feeds, handling decimals and global units in Solidity, and the importance of these elements in smart contract development. Duration: 1min
15. Creating your own libraries
This lesson covers the creation and use of Solidity Libraries to streamline code and avoid redundancy. It demonstrates how to create a library, transfer functions to it, and utilize the library in contracts for efficient code management and functionality enhancement. Duration: 5min
16. Using Safemath
An introduction to the SafeMath library in Solidity, explaining its significance before Solidity 0.8 and the reasons for its reduced usage post Solidity 0.8. The lesson covers integer overflow issues and the implementation of automatic checks in newer Solidity versions. Duration: 5min
17. Solidity for Loop
This lesson teaches the concept of for loops in Solidity, demonstrating how they can be used to access and manipulate arrays. It focuses on practical applications in a smart contract, particularly for iterating over arrays and resetting mappings. Duration: 5min
18. Quiz: Fund Me Mid Section Recap Quiz
Questions: 8
19. Resetting an Array
A guide on effectively resetting arrays in Solidity, particularly within the context of smart contracts. The lesson addresses the importance of resetting arrays for managing and updating contract states, and demonstrates the process using practical examples. Duration: 1min
20. Sending ETH from a contract
An exploration of three methods for sending Ether from a contract in Solidity: transfer, send, and call. The lesson compares these methods, discussing their syntax, behavior, and appropriate use cases, with a focus on their gas usage and security implications. Duration: 8min
21. Smart contract constructor
This lesson focuses on using the constructor function in Solidity for role assignment, particularly for setting a contract owner. It discusses the security implications and demonstrates how to restrict certain functionalities, like fund withdrawal, to the owner. Duration: 3min
22. Solidity function modifiers
A deep dive into the use of function modifiers in Solidity. The lesson covers how modifiers can streamline code, especially for administrative functions, and includes practical examples to illustrate the implementation and benefits of using modifiers in contracts. Duration: 2min
23. Test the smart contract with a testnet
A guide to testing Solidity contracts and deploying to a testnet, focusing on compiling, deploying, and interacting with the 'FundMe.sol' contract. The lesson includes steps for using MetaMask, tracking transactions, and ensuring successful contract interaction. Duration: 4min
24. Immutability and constants
A tutorial on optimizing Solidity smart contracts for gas efficiency using custom errors. The lesson explains the concept of custom errors and demonstrates how to use them for efficient error handling and reverts in smart contracts. Duration: 8min
25. Creating custom errors
A tutorial on optimizing Solidity smart contracts for gas efficiency using custom errors. The lesson explains the concept of custom errors and demonstrates how to use them for efficient error handling and reverts in smart contracts. Duration: 3min
26. Implementing the receive fallback
This lesson covers the implementation of '_receive_' and '_fallback_' functions in Solidity. It explains their significance in handling Ether sent directly to a contract and demonstrates their practical application in a 'FundMe' contract scenario. Duration: 12min
27. Quiz: Fund Me Section Recap Quiz
Questions: 6
28. Zksync Plugin Fix
A quick fix to a bug with the zkSync plugin. This lesson covers a simple solution to a bug that occurs when using the zkSync plugin in Remix IDE. Duration: 1min
29. Deploying To Zksync
A detailed guide to deploying FundMe on zkSync testnet - This lesson covers how to deploy a FundMe smart contract to the zkSync Sepollia testnet. The guide covers selecting the correct price feed address for zkSync Sepollia testnet from Chainlink, updating the contract and library with the latest solidity version, and deploying and verifying the contract. Duration: 6min
30. Congratulations
A recap of the advanced aspects of Solidity covered in previous lessons, highlighting the transition from using Remix to a code editor. The lesson congratulates learners on mastering Solidity basics and introduces upcoming advanced topics for further exploration. Duration: 3min

Course Overview

About the course

What you'll learn

Blockchain developer fundamentals

Introduction to blockchain gas

Transaction signatures

Smart contract development

Solidity gas optimization techniques

Course Description

Who is this course for?

  • Software engineers
  • Web3 developers
  • Finance professionals
  • Security researchers
  • CTOs

Potential Careers

Smart Contract Auditor

$100,000 - $200,000 (avg. salary)

Smart Contract Engineer

$100,000 - $150,000 (avg. salary)

Web3 Developer Relations

$85,000 - $125,000 (avg. salary)

Web3 developer

$60,000 - $150,000 (avg. salary)

Meet your instructors

Patrick Collins

Patrick Collins

Founder at Cyfrin

Web3 engineer, educator, and Cyfrin co-founder. Patrick's smart contract development and security courses have helped hundreds of thousands of engineers kickstarting their careers into web3.

Austin Griffith

Austin Griffith

Builder at Buidl Guidl

Builder, Educator, and creator of the Buidl Guild where, with the Ethereum Foundation, succesfully taught Web3 development to thousands of developers world-wide.

Last updated on November 25, 2024

Testimonials

Students Reviews

Read what our students have to say about this course.

Chainlink

Chainlink

Chainlink

Gustavo Gonzalez

Gustavo Gonzalez

Solutions Engineer at OpenZeppelin

Francesco Andreoli

Francesco Andreoli

Lead Devrel at Metamask

Albert Hu

Albert Hu

DeForm Founding Engineer

Radek

Radek

Senior Developer Advocate at Ceramic

Boidushya

Boidushya

WalletConnect

Idris

Idris

Developer Relations Engineer at Axelar

Cyfrin
Updraft
CodeHawks
Solodit
Resources