Democratizing Public Goods Funding Through Quadratic Matching
EquiFund is a decentralized quadratic funding platform built on Base Sepolia that amplifies the impact of small donations through mathematical fairness. Where your voice matters more than your wallet size.
Quadratic Funding (QF) is a mathematically optimal way to fund public goods in democratic communities. It works by:
- Amplifying Small Donations: A project with 100 people donating $1 receives more matching funds than one person donating $100
- Preventing Whale Dominance: Large donors can't monopolize the matching pool
- Community Signal: Broad support matters more than total capital
- Math-Enforced Fairness: The quadratic formula ensures democratic distribution
Project Match = (Ξ£βcontribution_i)Β²
Each project's share of the matching pool is proportional to the square of the sum of square roots of contributions.
- β Funding Rounds: Time-bound contribution periods with matching pools
- β Project Registry: Verified projects eligible for funding
- β Quadratic Matching: Automated calculation and distribution
- β Sybil Resistance: Basic cooldown mechanism to prevent gaming
- β Transparent: All contributions and matches on-chain
- β Base Sepolia: Deployed on L2 for low gas fees
- π Multi-token support (ERC20)
- π Advanced Sybil resistance (BrightID/Gitcoin Passport integration)
- π Governance voting on project eligibility
- π Automated round scheduling
- π Grant streaming/vesting
- π Multi-chain deployment
src/
βββ EquiFundPool.sol # Main funding pool & round management
βββ ProjectRegistry.sol # Whitelisted projects registry
βββ QuadraticMath.sol # QF formula implementation
βββ SybilGuard.sol # Anti-gaming mechanisms
| Contract | Purpose | Key Functions |
|---|---|---|
| EquiFundPool | Manages funding rounds, contributions, and matching distribution | contribute(), finalizeRound(), withdrawMatching() |
| ProjectRegistry | Maintains verified projects list | registerProject(), isProjectActive() |
| QuadraticMath | Pure math library for QF calculations | calculateMatch(), sqrt() |
| SybilGuard | Prevents multiple contributions from same entity | checkEligibility(), recordContribution() |
- Foundry installed
- Node.js v18+ (for frontend)
- Base Sepolia ETH (faucet)
- MetaMask or compatible wallet
# Clone the repository
git clone https://github.com/yourusername/equifund.git
cd equifund
# Install Foundry dependencies
forge install
# Install OpenZeppelin contracts
forge install OpenZeppelin/openzeppelin-contracts
# Install frontend dependencies (if applicable)
cd frontend
npm installCreate a .env file in the project root:
# Network
BASE_SEPOLIA_RPC_URL=https://sepolia.base.org
CHAIN_ID=84532
# Deployment
PRIVATE_KEY=your_private_key_here
ETHERSCAN_API_KEY=your_basescan_api_key
# Contract Addresses (after deployment)
EQUIFUND_POOL=0x...
PROJECT_REGISTRY=0x...
SYBIL_GUARD=0x...forge build# Run all tests
forge test
# Run with verbosity
forge test -vvv
# Run specific test
forge test --match-test testContribution
# Generate gas report
forge test --gas-reportforge coverage# Deploy all contracts
forge script script/Deploy.s.sol --rpc-url $BASE_SEPOLIA_RPC_URL --broadcast --verify
# Deploy with mock data for testing
forge script script/MockSetup.s.sol --rpc-url $BASE_SEPOLIA_RPC_URL --broadcast# Start local Anvil node
anvil
# Deploy to local node (new terminal)
forge script script/Deploy.s.sol --rpc-url http://localhost:8545 --broadcast- Connect Wallet: Connect to Base Sepolia network
- Browse Projects: View active projects in current round
- Contribute: Donate ETH to projects you support
- Track Impact: See your contribution + projected match amount
- Register: Submit project for admin approval
- Get Verified: Admin verifies project legitimacy
- Receive Funds: Collect contributions during round
- Claim Match: Withdraw matched funds after round finalization
- Create Round: Set duration and add matching pool
- Register Projects: Approve eligible projects
- Finalize Round: Calculate and distribute matches
- Monitor: Track participation and prevent abuse
- β Single vs multiple contributors
- β Whale dominance prevention (1 donor $100 vs 100 donors $1)
- β Quadratic formula accuracy
- β Sybil guard cooldown enforcement
- β Round finalization idempotency
- β Access control (admin-only functions)
- β Edge cases (zero contributions, single project)
- β Reentrancy protection
- β Emergency withdrawal
function testQuadraticAmplification() public {
// 1 whale donates 100 ETH
vm.prank(whale);
pool.contribute{value: 100 ether}(projectA);
// 100 smols donate 1 ETH each
for(uint i = 0; i < 100; i++) {
vm.prank(smols[i]);
pool.contribute{value: 1 ether}(projectB);
}
pool.finalizeRound();
// ProjectB should receive more matching funds
assert(pool.getProjectMatchAmount(1, projectB) >
pool.getProjectMatchAmount(1, projectA));
}The frontend is built with modern web3 tooling:
- Framework: React + Vite / Next.js
- Styling: Tailwind CSS + Framer Motion
- Web3: wagmi + viem
- UI: Glass-morphism design with animated elements
- Charts: Recharts for data visualization
cd frontend
npm run devVisit http://localhost:5173
β οΈ Not audited yet - MVP for testnet only- DO NOT use on mainnet without professional audit
- OpenZeppelin battle-tested contracts
- ReentrancyGuard on all payable functions
- Access control (Ownable pattern)
- Pausable emergency stops
- Checks-effects-interactions pattern
- SafeMath for overflow protection
- Basic Sybil resistance (time-based cooldown only)
- Centralized admin control
- No dispute resolution mechanism
- Single token support (ETH only)
We welcome contributions! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Write tests for new features
- Follow Solidity style guide
- Comment complex logic
- Update documentation
- Run
forge fmtbefore committing
This project is licensed under the MIT License - see the LICENSE file for details.
- Gitcoin: For pioneering quadratic funding in crypto
- Vitalik Buterin: For the quadratic funding mechanism
- Base: For the scalable L2 infrastructure
- OpenZeppelin: For secure smart contract libraries
- Foundry: For the blazing fast development toolkit
- Twitter: @EquiFund
- Discord: Join our community
- GitHub: github.com/yourusername/equifund
- Email: hello@equifund.xyz
"In traditional funding, $1 from a billionaire equals $1 from a student. In EquiFund, community consensus matters more than capital size. We're building a funding mechanism where democracy meets math."
Built with β€οΈ for public goods
- Live Demo (coming soon)
- Documentation (coming soon)
- Contract Addresses
- Roadmap
- Bug Bounty (post-audit)
Star β this repo if you believe in democratizing public goods funding!