Skip to content

TrustFlow is a decentralized application (dApp) built on Base that ensures every donation reaches its destination. By leveraging smart contracts for milestone-based fund releases and IPFS for immutable impact reporting, TrustFlow provides donors with real-time visibility and voting power over how their ETH and USDC are utilized.

License

Notifications You must be signed in to change notification settings

chain-mint/TrustFlow

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

164 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🌍 Transparent Charity Tracker (TCT)

Building a more accountable future on Base

Built on Base Next.js Wagmi TypeScript License

🌐 Live Demo β€’ πŸ“– Documentation β€’ πŸš€ Quick Start β€’ πŸ’‘ Features β€’ 🀝 Contributing


πŸ“‹ Table of Contents


🎯 Project Overview

Transparent Charity Tracker is a production-ready decentralized application (dApp) that revolutionizes charity transparency by leveraging blockchain technology on Base L2. Every donation, milestone, and fund release is recorded immutably on-chain, ensuring complete accountability and trust.

The Problem We Solve

Traditional charity platforms lack transparency. Donors lose track of funds once they leave their bank account, leading to:

  • ❌ Donor fatigue and distrust
  • ❌ Lack of accountability
  • ❌ No way to verify fund usage
  • ❌ Limited donor engagement

Our Solution

βœ… Immutable Tracking: Every dollar (ETH/USDC) tracked on-chain from donation to expenditure
βœ… Milestone Governance: Funds locked in smart contracts, released only after donor approval
βœ… Weighted Voting: Donors vote based on contribution amount (1 token = 1 vote)
βœ… Radical Transparency: All receipts and impact reports hashed on-chain via IPFS
βœ… Low Fees: Built on Base L2 for affordable transactions
βœ… Social Discovery: Farcaster Mini App integration for viral growth


✨ Key Features

πŸ” Core Functionality

  • Multi-Token Donations: Support for ETH and ERC20 tokens (USDC, etc.)
  • Milestone-Based Funding: Projects broken into verifiable milestones
  • Weighted Voting System: Donors vote on milestone releases based on contribution weight
  • NGO Verification: Only verified NGOs can create projects
  • Real-Time Updates: React Query for efficient data fetching and caching
  • Emergency Controls: Pausable contracts with owner controls

πŸš€ Base Ecosystem Integration

  • Farcaster Mini App: Native integration for social discovery and viral growth
  • Base L2 Benefits: Ultra-low fees, fast transactions, Ethereum security
  • Modern Web3 Stack: Wagmi v3, Viem, latest React patterns

🎨 User Experience

  • Responsive Design: Works seamlessly on desktop and mobile
  • Wallet Integration: MetaMask, WalletConnect, and more
  • Network Switching: Automatic Base network detection and switching
  • Error Handling: Comprehensive error messages and recovery flows

πŸ“Š Transparency Features

  • On-Chain Records: All transactions permanently recorded
  • Donation History: Complete donation tracking per project
  • Milestone Tracking: Real-time milestone status and voting progress
  • Project Analytics: Funding progress, donor counts, and more

πŸ—οΈ Why Base?

We chose Base as our platform because:

  1. Ultra-Low Fees: Perfect for micro-donations and frequent transactions
  2. Ethereum Security: Inherits security from Ethereum mainnet
  3. Fast Transactions: Near-instant confirmation times
  4. Growing Ecosystem: Active community and strong developer support
  5. Farcaster Integration: Native social layer for discovery and engagement
  6. OP Stack: Built on proven, open-source technology

πŸ› οΈ Tech Stack

Frontend

Smart Contracts

  • Language: Solidity ^0.8.24
  • Framework: Foundry
  • Security: OpenZeppelin Contracts (ReentrancyGuard, Pausable, Ownable)
  • Testing: Comprehensive Foundry test suite

Infrastructure

  • Deployment: Vercel (Frontend), Base Mainnet (Contracts)
  • RPC: Base RPC endpoints
  • IPFS: For milestone proofs and receipts (future)

Integrations

  • Farcaster Mini App SDK: Social discovery and engagement
  • WalletConnect: Multi-wallet support
  • Etherscan: Contract verification

🌐 Live Demo

Contract Addresses

Base Sepolia (Testnet):

  • CharityTracker: 0x46c17579afF1635b9d983603ED0b4A1c0823bF3d
  • NGO Registry: 0xc7b93b317634c08D14D806057F9B4C0EB9E62059

Base Mainnet:


πŸš€ Getting Started

Prerequisites

  • Node.js 18+ and npm/yarn/pnpm
  • Web3 Wallet (MetaMask, Coinbase Wallet, etc.)
  • Base Sepolia ETH (for testing) - Get from Base Sepolia Faucet
  • Git

Installation

  1. Clone the repository:
git clone <repository-url>
cd tct
  1. Install dependencies:
npm install
# or
yarn install
# or
pnpm install
  1. Set up environment variables:
cp .env.example .env.local

Edit .env.local with your configuration:

# Application
NEXT_PUBLIC_APP_URL=http://localhost:3000

# Base Network
NEXT_PUBLIC_CHAIN_ID=84532  # 84532 for Base Sepolia, 8453 for Base Mainnet
NEXT_PUBLIC_BASE_SEPOLIA_RPC_URL=https://sepolia.base.org
# Or use a dedicated provider: https://www.alchemy.com/base

# Contracts
NEXT_PUBLIC_CHARITY_TRACKER_ADDRESS=0x46c17579afF1635b9d983603ED0b4A1c0823bF3d

# WalletConnect (Optional but recommended)
NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID=your_project_id_here
# Get from: https://cloud.reown.com/

# USDC Token (Optional)
NEXT_PUBLIC_USDC_ADDRESS=0x036CbD53842c5426634e7929541eC2318f3dCF7e
  1. Run the development server:
npm run dev
# or
yarn dev
# or
pnpm dev
  1. Open http://localhost:3000 in your browser

Smart Contract Development

See the contract README for detailed instructions on:

  • Building and testing contracts
  • Deploying to Base networks
  • Running tests
  • Gas optimization

πŸ“œ Smart Contracts

Key Contracts

  1. CharityTracker.sol: Main contract handling projects, donations, voting, and fund releases
  2. NGO Registry: Verified NGO management system

Key Features

  • βœ… Reentrancy protection (OpenZeppelin ReentrancyGuard)
  • βœ… Pausable for emergency situations
  • βœ… Owner-only functions for NGO management
  • βœ… Milestone-based fund locking
  • βœ… Weighted voting system (>50% quorum)
  • βœ… Multi-token support (ETH + ERC20)

Security

  • Comprehensive test coverage
  • OpenZeppelin battle-tested contracts
  • CEI (Checks-Effects-Interactions) pattern
  • Custom errors for gas efficiency
  • Access control mechanisms

See contract documentation for more details.


πŸ›οΈ Architecture

Frontend Architecture

app/
β”œβ”€β”€ page.tsx              # Home page with project listing
β”œβ”€β”€ project/
β”‚   β”œβ”€β”€ [id]/            # Project detail page
β”‚   └── create/          # Create project page
β”œβ”€β”€ ngo/
β”‚   β”œβ”€β”€ dashboard/       # NGO dashboard
β”‚   └── register/        # NGO registration
β”œβ”€β”€ admin/
β”‚   └── ngos/            # Admin panel for NGO management
└── donate/
    └── [id]/            # Donation page

components/
β”œβ”€β”€ project/             # Project-related components
β”œβ”€β”€ donation/            # Donation components
β”œβ”€β”€ web3/                # Web3 wallet components
└── ui/                  # Reusable UI components

hooks/
β”œβ”€β”€ useProject.ts        # Project data fetching
β”œβ”€β”€ useDonation.ts       # Donation logic
β”œβ”€β”€ useVoting.ts         # Voting logic
└── useNGO.ts            # NGO verification

Smart Contract Architecture

contracts/
β”œβ”€β”€ CharityTracker.sol   # Main contract
β”œβ”€β”€ interfaces/          # Contract interfaces
β”œβ”€β”€ libraries/           # Shared libraries
└── types/              # Data structures

πŸ”’ Security

Security Features

  • Reentrancy Protection: OpenZeppelin ReentrancyGuard
  • Access Control: Owner-only functions for critical operations
  • Pausable: Emergency pause functionality
  • Input Validation: Comprehensive checks on all inputs
  • Gas Optimization: Custom errors, packed structs
  • Upgrade Path: Designed for future upgradeability

Audit Status

  • βœ… Internal security review completed
  • βœ… OpenZeppelin contracts used (audited)
  • ⏳ External audit planned

Reporting Security Issues

If you discover a security vulnerability, please email [security@yourdomain.com] instead of using the issue tracker.


πŸ“š Documentation


🀝 Contributing

We welcome contributions! Please see our Contributing Guide for details.

Quick Contribution Steps

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Development Guidelines

  • Follow TypeScript best practices
  • Write tests for new features
  • Update documentation
  • Follow the existing code style
  • Add comments for complex logic

πŸ“Š Project Status

βœ… Completed

  • Smart contract development and testing
  • Frontend application (Next.js)
  • Wallet integration (Wagmi v3)
  • NGO registration system
  • Donation system (ETH + ERC20)
  • Voting system
  • Milestone management
  • Admin panel
  • Farcaster Mini App integration

🚧 In Progress

  • Mainnet deployment
  • Production frontend deployment
  • IPFS integration for milestone proofs
  • Analytics dashboard

πŸ“‹ Planned

  • Mobile app (React Native)
  • Additional token support
  • Governance token
  • Staking mechanisms
  • Multi-language support

πŸ“ˆ Metrics & Impact

On-Chain Metrics

  • Total Projects: [Update with live data]
  • Total Donations: [Update with live data]
  • Active NGOs: [Update with live data]
  • Total Votes Cast: [Update with live data]

GitHub Metrics

  • Stars: [Update]
  • Forks: [Update]
  • Contributors: [Update]

🌟 Acknowledgments

  • Base for the amazing L2 platform
  • OpenZeppelin for secure contract libraries
  • Wagmi for excellent Web3 React hooks
  • Farcaster for social infrastructure
  • The entire Web3 community for inspiration and support

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


πŸ”— Links


πŸ™ Support

If you find this project useful, please consider:

  • ⭐ Starring the repository
  • πŸ› Reporting bugs
  • πŸ’‘ Suggesting new features
  • 🀝 Contributing code
  • πŸ“’ Sharing with others

Built with ❀️ on Base

Base β€’ Wagmi β€’ Next.js β€’ Farcaster

About

TrustFlow is a decentralized application (dApp) built on Base that ensures every donation reaches its destination. By leveraging smart contracts for milestone-based fund releases and IPFS for immutable impact reporting, TrustFlow provides donors with real-time visibility and voting power over how their ETH and USDC are utilized.

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •