Smart Contract:
solidity

pragma solidity ^0.8.0;

contract CrowdFund {
address public owner;
mapping(address => uint) public contributions;
uint public deadline;
uint public goal;
uint public raisedAmount;

constructor(uint _goal, uint _duration) {
owner = msg.sender;
goal = _goal;
deadline = block.timestamp + _duration;
}

function contribute() public payable {
require(block.timestamp < deadline, “Deadline passed”);
contributions[msg.sender] += msg.value;
raisedAmount += msg.value;
}

function getRefund() public {
require(block.timestamp > deadline && raisedAmount < goal, “No refund”);
uint amount = contributions[msg.sender];
contributions[msg.sender] = 0;
payable(msg.sender).transfer(amount);
}
}

Applications:
Launch Kickstarter-style DApps

NFT pre-sales

DAO funding rounds

 

🧠 Summary:
Built and deployed a token, voting system, and crowdfunding smart contract.

Practiced contract customization and front-end interaction.

Explored real-world blockchain business use cases.

 

📝 Workbook Activities:
Customize the ERC-20 token name and supply.

Add an admin-only restriction to the voting contract.

Simulate a failed funding and call getRefund().

Write your dApp idea using a combination of these templates.