A DeFi-powered donation platform built on Base Network that uses yield-generating vaults to create sustainable funding for cancer patients.
HopeChain is a revolutionary donation platform that combines the transparency of blockchain technology with the power of DeFi yield generation. Every USDC donation is automatically deposited into secure Morpho vaults, where it earns yield and grows over time, creating a sustainable fund for cancer patients.
- 🔄 Yield Generation: Donations automatically earn interest in Morpho Protocol vaults
- 🎖️ Soulbound Badges: Dynamic NFTs that evolve with each donation
- 📊 Live Transparency: Real-time on-chain metrics and donor leaderboards
- 🔒 100% Transparent: Every transaction is publicly verifiable
- 💎 No Middlemen: Direct patient funding with zero hidden fees
- 🌐 Multi-Wallet Support: Coinbase Pay, WalletConnect, MetaMask, and more
- Framework: Next.js 15 with App Router
- Styling: Tailwind CSS with custom components
- Web3: Wagmi v2 + Viem for blockchain interactions
- UI Components: Radix UI primitives
- Animations: Framer Motion
- State Management: React Query (TanStack Query)
- DonationVault: Core donation management and yield generation
- DonationSBT: Dynamic soulbound donor badges
- MockMorphoVault: Yield vault simulation (testnet)
- Primary: Base Network (Ethereum L2)
- Testnet: Base Sepolia
- Token: USDC (6 decimals)
- Node.js 18+
- npm or yarn
- Git
- Clone the repository:
git clone https://github.com/Mr-Web3/HopeChain.git
cd hopechain- Install dependencies:
npm install
# or
yarn install- Set up environment variables:
Create a
.env.localfile in the root directory:
# Base Sepolia RPC
NEXT_PUBLIC_BASE_SEPOLIA_RPC=https://sepolia.base.org
# Base Mainnet RPC (optional)
NEXT_PUBLIC_BASE_RPC=https://mainnet.base.org
# Coinbase Developer API Key
NEXT_PUBLIC_COINBASE_API_KEY=your_coinbase_api_key
# Neynar API Key (for Farcaster integration)
NEXT_PUBLIC_NEYNAR_API_KEY=your_neynar_api_key
# App URL (for metadata)
NEXT_PUBLIC_APP_URL=https://your-domain.com- Run the development server:
npm run dev
# or
yarn dev- Open your browser: Navigate to http://localhost:3000
- Hero section with mission statement
- How it works explanation
- Live transparency dashboard
- Top donor leaderboard
- Personal story and mission
- USDC donation interface
- Real-time vault metrics
- Donor leaderboard
- Transaction status tracking
- Network validation
- Live statistics and metrics
- Patient stories and testimonials
- Research funding information
- Trusted partners showcase
- Personal donation history
- Dynamic badge display
- Donation progress tracking
- Achievement system
- Patient application form
- Document upload system
- Privacy and security notices
- Application status tracking
| Script | Description |
|---|---|
npm run dev |
Start development server |
npm run build |
Build for production |
npm run start |
Start production server |
npm run lint |
Run ESLint |
npm run format |
Format code with Prettier |
├── app/ # Next.js App Router
│ ├── api/ # API routes
│ │ ├── auth/ # Authentication endpoints
│ │ ├── metadata/ # NFT metadata API
│ │ └── notify/ # Notification endpoints
│ ├── components/ # React components
│ │ ├── donate/ # Donation-related components
│ │ ├── profile/ # Profile components
│ │ ├── ui/ # Reusable UI components
│ │ └── wallet/ # Wallet connection components
│ ├── donate/ # Donation page
│ ├── impact/ # Impact page
│ ├── profile/ # Profile page
│ └── apply/ # Application page
├── contracts/ # Deployed contract addresses
├── lib/ # Utility functions
├── public/ # Static assets
└── utils/ # Helper utilities
- DonationCard: Main donation interface
- DonorLeaderboard: Live donor rankings
- DynamicBadge: Evolving donor NFT display
- NetworkAlert: Network validation warnings
- UserDonationSummary: Personal donation stats
- ThemeToggle: Dark/light mode switcher
- ConnectButton: Wallet connection interface
- ProgressIndicator: Loading and progress states
- PersonalStory: Mission and story sections
Contract addresses are automatically generated and stored in contracts/deployedContracts.ts:
export const deployedContracts = {
84532: { // Base Sepolia
DonationVault: {
address: "0x...",
abi: [...]
},
DonationSBT: {
address: "0x...",
abi: [...]
},
USDC: {
address: "0x...",
abi: [...]
}
}
}- Donation:
donate(uint256 amount) - Vault Summary:
getVaultSummary(address donor) - Donor List:
getAllDonors() - SBT Minting:
mintOrUpdateBadge(address donor, uint256 amount)
- Colors: Custom color palette with dark/light mode support
- Typography: Geist font family
- Spacing: Tailwind's spacing scale
- Components: Radix UI primitives with custom styling
- Automatic dark/light mode detection
- System preference respect
- Manual theme toggle
- Persistent theme storage
- Total donated amount
- Yield earned from vaults
- Number of unique donors
- Lives changed count
- Vault balance tracking
- Automatic data refresh every 10 seconds
- Transaction status monitoring
- Donor leaderboard updates
- Vault balance changes
- Multiple wallet support
- Network validation
- Transaction confirmation
- Error handling and recovery
- No private key storage
- Secure API endpoints
- Input validation
- XSS protection
- Connect your GitHub repository to Vercel
- Set environment variables in Vercel dashboard
- Deploy automatically on push to main branch
Required environment variables for production:
NEXT_PUBLIC_BASE_SEPOLIA_RPC
NEXT_PUBLIC_COINBASE_API_KEY
NEXT_PUBLIC_APP_URLUpdate the baseURI in your smart contracts to point to your custom domain:
// In Hardhat/scripts/fixBaseURI.ts
const BASE_URI = 'https://your-domain.com/api/metadata';npm run testnpm run test:e2enpm run type-check- Next.js Image optimization
- Automatic code splitting
- Static generation where possible
- Efficient re-rendering with React Query
- Optimized bundle size
- LCP: < 2.5s
- FID: < 100ms
- CLS: < 0.1
- 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
- Follow the existing code style
- Add tests for new features
- Update documentation
- Ensure all tests pass
- Follow conventional commits
This project is licensed under the MIT License - see the LICENSE file for details.
- Documentation: GitHub Wiki
- Issues: GitHub Issues
- Discord: Join our community
- Twitter: @DecentralBros_
- Base Network for the L2 infrastructure
- Morpho Protocol for yield generation
- Coinbase for Web3 platform support
- OpenZeppelin for secure smart contract libraries
- Vercel for hosting and deployment
Built with ❤️ by Decentral Bros
Transparent Giving. Real Healing. Built on Base.