Context and goal
This ENSA Béni Mellal course project explores how a crowdfunding application can combine ETH funding with token-weighted governance. Campaign owners create campaigns, contributors fund them and receive CFD governance tokens, and token holders vote on fund releases or disputed campaigns.
Architecture
The application has two main Solidity contracts. CFDToken implements the governance token with vote checkpoints and transfer locking. Crowdfunding manages campaign balances, contributions, refunds, proposals, voting, and payouts. A React/Vite interface uses Ethers.js and MetaMask to read contract state and submit transactions. Campaign descriptions and optional images are stored through IPFS; only the metadata CID is recorded on-chain.
Engineering decisions
- Contributions mint CFD at a documented rate. Tokens remain locked until a successful campaign payout, while still counting toward voting power.
- Voting uses a snapshot of token holdings, a delay and voting window, and quorum and majority rules. Governance can approve a release, freeze, unfreeze, or cancel a campaign.
- Failed or cancelled campaigns allow contributors to claim refunds. ETH withdrawal paths update accounting before external calls and use reentrancy protection.
- Larger campaign payouts require approval from two of three trustees in addition to governance approval. Emergency pause blocks contributions and ETH withdrawal paths.
- A separate read-only Python script can flag unusual contribution patterns for human review; its signals are not automatic fraud verdicts.
Verification and limits
The repository documents 20 contract tests, including a failed reentrancy attempt and a randomized campaign-balance property, plus tests for the off-chain analyzer. Its automated browser walkthrough uses a simulated wallet and IPFS service on a local Hardhat chain. Those checks do not establish compatibility with a real MetaMask extension, persistent IPFS hosting, or a Sepolia deployment. This is a course project, not a live crowdfunding service.
