A secure and transparent crowdfunding smart contract built in Solidity. It allows users to contribute ETH toward a campaign with a set goal and deadline. If the funding goal is met within the time limit, the project owner can withdraw the funds. Otherwise, contributors can claim refunds.
- 🧑💼 Owner can start a campaign with goal and deadline
- 🪙 Users can contribute ETH to support the project
- 🔐 Owner can withdraw only if the funding goal is met before deadline
- 🧾 Contributors can claim a refund if the goal is not reached
- 📝 Event logs for contributions, withdrawals, and refunds
- Solidity
^0.8.20 - Remix IDE or Hardhat for development
- MetaMask for interacting with contract
- Goerli or Sepolia Testnet for deployment
Initializes the campaign with a funding goal and duration in seconds.
Allows users to send ETH to support the campaign.
Lets the owner withdraw ETH if the goal is met and time hasn't expired.
Allows contributors to get refunds if the goal wasn’t reached by the deadline.
Returns the total ETH held in the contract.
Returns time left before the campaign expires.
- Deploy using Remix with a goal (in wei) and duration (in seconds).
- Use multiple wallets to call
contribute()with ETH. - Once the campaign ends, test
withdrawFunds()orclaimRefund()as appropriate.
Contributed(address indexed contributor, uint amount)Withdrawn(address indexed owner, uint amount)Refunded(address indexed contributor, uint amount)
MIT License
Hilmi KT
Blockchain Developer | Web3 Explorer | Solidity Builder
LinkedIn