0/5
_You can follow along with the video course from here._ ### Introduction Let's begin by coding `FundMe`, a crowdfunding contract allowing users to send funds, which the owner can later withdraw. Before we start, let's clean up our Remix IDE workspace ### Setting up the project Start from scratch by opening your [Remix IDE](https://remix.ethereum.org/) and deleting all existing contracts. Next, create a new contract named `FundMe`. > 👀❗**IMPORTANT**:br > Before you start coding, try to write down in plain English what you want your code to achieve. This helps clarify your goals and structure your approach. We want `FundMe` to perform the following tasks: 1. **Allow users to send funds into the contract:** users should be able to deposit funds into the 'FundMe' contract 2. **Enable withdrawal of funds by the contract owner:** the account that owns `FundMe` should have the ability to withdraw all deposited funds 3. **Set a minimum funding value in USD:** there should be a minimum amount that can be deposited into the contract Let's outline the core structure of the contract: ```solidity // SPDX-License-Identifier: MIT pragma solidity ^0.8.18; contract FundMe {} ``` ### fund and withdraw functions The FundMe contract will have two primary functions that serve as the main interaction points: 1. **`fund`:** allows users to deposit funds into the contract 2. **`withdraw`:** grants the contract owner the ability to withdraw the funds that have been previously deposited First, let's code the `fund` function and leave the `withdraw` function commented out for the moment. ```solidity contract FundMe { // send funds into our contract function fund() public {} // owner can withdraw funds /*function withdraw() public {}*/ } ``` ### Conclusion In this lesson, we created a new `FundMe` contract and broadly defined the logic that will be performed. ### 🧑💻 Test yourself 1. 📕 Why should a developer always outline his coding goals before starting to code?
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.
Previous lesson
Previous
Next lesson
Next
Give us feedback
Course Overview
About the course
Blockchain developer fundamentals
Introduction to blockchain gas
Transaction signatures
Smart contract development
Solidity gas optimization techniques
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)
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.
Last updated on November 25, 2024
Solidity Developer
Solidity Smart Contract DevelopmentDuration: 1h 46min
Duration: 38min
Duration: 2h
Duration: 23min
Course Overview
About the course
Blockchain developer fundamentals
Introduction to blockchain gas
Transaction signatures
Smart contract development
Solidity gas optimization techniques
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)
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.
Last updated on November 25, 2024
Testimonials
Read what our students have to say about this course.
Chainlink
Chainlink
Gustavo Gonzalez
Solutions Engineer at OpenZeppelin
Francesco Andreoli
Lead Devrel at Metamask
Albert Hu
DeForm Founding Engineer
Radek
Senior Developer Advocate at Ceramic
Boidushya
WalletConnect
Idris
Developer Relations Engineer at Axelar