hackquest logo
 

CrowdFund

Perhaps you're familiar with ICOs (Initial Coin Offerings)? This is a method that allows project initiators to raise funds from global investors and offer rewards in the form of tokens. In the blockchain world, using tokens for crowdfunding not only enhances the liquidity of funds but also increases the visibility and participation of the project. In this course, we will use the Solidity to build a basic crowdfunding project, simulating the entire process from launching the crowdfunding to claiming funds or refunds.

Language

Solidity

Total Length

1.5h

Part of Learning Track

Build on Ethereum + 1

What You’ll Learn

Syllabus

Define the Contract

In this section, we will construct the framework for the crowdfunding contract, including defining the IERC20 interface and initializing the token contract through the constructor.

Unit 2 - Define the data structures

To support the initiation and management of crowdfunding activities, we need to introduce specialized data structures to store information related to crowdfunding. In this chapter, we will define these key data structures in detail.

Unit 3 - Launch a Crowdfunding Campaign

This chapter explains how to initiate a crowdfunding campaign through the launch function, including recording campaign information and triggering events.

Unit 4 - Cancel a Crowdfunding Campaign

In this section, we will cover how to define the cancel function, a feature that allows the initiator of a crowdfunding campaign to cancel the campaign before it begins

Unit 5 - Pledge

This chapter primarily focuses on writing the pledging process within the crowdfunding contract, including how to allow users to pledge tokens to a specific campaign, update pledge records, and notify the crowdfunding progress through events.

Unit 6 - Cancel a pledge

This chapter explains how to implement the functionality to cancel a pledge, including updating pledge records, returning tokens to the user, and notifying the cancellation of the pledge through an event.

Unit 7 - Claim

This chapter explains the process for project initiators to safely withdraw the funds raised after a successful crowdfunding campaign, including verifying conditions, updating the status, and executing the fund transfer.

Unit 8 - Refund

Complete the refund function

Interaction

Try to interact with the contract to simulate the on-chain crowdfunding process