A production-ready Farcaster Mini App that gamifies environmental cleanup through Impact Product NFTs, DCU points, and $bDCU token rewards on Base.
π Farcaster Mini App | π Web App | π Admin Guide | ποΈ Deployment Guide | π¨βπ» Developer Specs | π Security Audit | π Security Audit
DeCleanup Rewards is a fully functional, production-ready Farcaster Mini App that incentivizes environmental cleanup through:
- DCU Points System: Users earn points for cleanups, streaks, referrals, impact forms, and verifications
- Token Rewards: Points can be claimed for $bDCU tokens based on current market price
- Impact Product NFTs: Dynamic NFTs that evolve as users progress through 10 levels
- Verifier System: Users can stake tokens to become verifiers (51% of balance required)
- Admin Controls: Comprehensive admin functions for managing verifiers, fees, multipliers, and treasury
- Cleanup Submissions: Upload before/after photos with geotagging (max 10MB per image)
- Verification System: Team and community verifiers can approve/reject cleanups
- Impact Products: 10 progressive NFT levels (Newbie β Guardian)
- DCU Points: Earn points for various actions (cleanup: 10 pts, streak: 1 pt, referral: 3 pts, etc.)
- Token Claims: Convert DCU points to $bDCU tokens (requires Level 10 and minimum 100 points)
- Staking: Stake tokens to become a verifier (requires β₯51% of balance and Level 10)
- Add App Modal: Prompts users to add app to Farcaster or pin to Base after onboarding
- Bot Protection: Vercel Bot ID protection on sensitive routes (Edge-level, no user friction)
- Security Headers: Comprehensive CORS, CSP, and security headers for production
- Verifier Management: Manually add/remove verifiers (bypasses staking requirement)
- Verifier Slashing: Remove verifier status even with staked tokens (for misconduct)
- Point Multipliers: Adjust reward point values for all action types
- Price Management: Update token price and target reward values
- Fee Management: Configure submission and claim fees (optional, auto-withdraws to treasury)
- Level Management: Decrease user levels for inappropriate behavior
- Emergency Controls: Pause/unpause contracts, withdraw tokens
- Contract Upgrades: Upgrade contracts using UUPS pattern (preserves user data)
| Contract | Purpose | Admin Functions | Upgradeable |
|---|---|---|---|
| PointsRewardDistributor | Points tracking, token claims, staking | Update prices, multipliers, verifiers, slash | β UUPS |
| VerificationContract | Cleanup submissions, verification | Manage verifiers, fees, treasury, slash | β UUPS |
| ImpactProductNFT | Dynamic NFT levels | Update base URI, decrease levels | β UUPS |
| bDCU Token | ERC20 reward token | Standard ERC20 functions | β Standard |
DCU Points Structure:
- Cleanup (Level): 10 points
- Streak: 1 point
- Referral: 3 points (both parties)
- Impact Form: 3 points
- Verifier: 1 point
- Manual/Retroactive: Variable (admin-awarded)
Note: Points are converted to $bDCU tokens at claim time based on current token price and multipliers. The USD equivalent varies with market conditions.
Claim Formula:
usdValue = (points Γ targetRewardValueUSD) / LEVEL_POINTS
tokens = (usdValue Γ 1e18 Γ 1e8) / currentTokenPriceUSD
Minimum Requirements:
- Minimum 100 DCU points required to claim tokens
- User must reach Level 10 to claim tokens
Staking Rules:
- Users must reach level 10 to stake or claim tokens
- To become verifier: stake β₯51% of available token balance at time of staking
- Verifier status lost if unstaking reduces balance below 50% of original stake (unless manually added)
- Admin can manually add verifiers (bypasses staking requirement and persists after unstaking)
- Minimum 100 DCU points required to claim tokens
- Node.js 18+
- A Farcaster account
- A Base-compatible wallet
- Base Sepolia ETH for testing
- Clone and install:
git clone https://github.com/DeCleanup-Network/decleanup-mini-app-base.git
cd decleanup-mini-app-base
npm install
cd contracts && npm install- Set up environment variables:
cp .env.example .env.localEdit .env.local with:
- Contract addresses (see DEPLOYMENT.md)
- RPC URLs (Base Sepolia for testing, Base Mainnet for production)
- Pinata API keys (server-side only:
PINATA_API_KEYandPINATA_SECRET_KEY) - WalletConnect Project ID
- Farcaster Neynar API key
- Base App ID
- Bot Protection: Enabled via Vercel Bot ID (no environment variables needed - configured in Vercel dashboard)
See VERCEL_ENV_SETUP.md for complete environment variables guide.
- Run locally:
npm run devOpen http://localhost:3000 and connect your wallet.
- ADMIN_GUIDE.md - Complete guide to managing the system
- Verifier management
- Fee configuration
- Point multiplier adjustments
- Emergency procedures
- DEVELOPER_SPECS.md - Complete technical specifications
- DEPLOYMENT.md - Deployment and setup guide
- SYSTEM_ARCHITECTURE.md - Technical architecture
- LOCAL_TESTING.md - Local testing guide
- VERCEL_ENV_SETUP.md - Quick Vercel environment variables setup
- SECURITY_AUDIT.md - Comprehensive security audit and compliance
- ANALYSIS_SUMMARY.md - Recent improvements and fixes summary
- CHANGELOG.md - Changelog of recent updates
- docs/ - Additional technical documentation
- docs/user-guide.md - User guide
- TERMS_OF_SERVICE.md - Terms of Service
Check contract status:
cd contracts
npx hardhat run scripts/checkUserStatus.js --network baseSepolia <user_address>
npx hardhat run scripts/checkDistributorBalance.js --network baseSepoliaManage verifiers:
# Add verifier manually
npx hardhat run scripts/addVerifierToPointsDistributor.js --network baseSepolia <address>
# Check verifier status
npx hardhat run scripts/checkUserStatus.js --network baseSepolia <address>Update prices:
# Update token price (8 decimals, e.g., 77 = $0.00000077)
TOKEN_PRICE=77 npx hardhat run scripts/updateTokenPrice.js --network baseSepolia
# Update target reward value (cents, e.g., 50 = $0.50)
TARGET_REWARD_VALUE=50 npx hardhat run scripts/updateTargetRewardValue.js --network baseSepoliaTransfer tokens:
# Transfer from deployer wallet to contract
TRANSFER_AMOUNT=1000000 npx hardhat run scripts/transferFromDeployer.js --network baseSepoliaSee ADMIN_GUIDE.md for complete admin documentation.
- Framework: Next.js 14 (App Router) with TypeScript
- Blockchain: Wagmi v2 + Viem on Base
- Farcaster:
@farcaster/miniapp-sdk - Styling: Tailwind CSS + shadcn/ui
- Storage: IPFS (Pinata)
- Smart Contracts: Solidity 0.8.20, Hardhat
Proxy Addresses (use these in frontend):
- PointsRewardDistributor:
0x3adf82A2e4998938B87C885d1D11011851cBeCc4β ACTIVE - VerificationContract:
0x390bDa64D1523075E74673ed957B9Ed67a3D34aDβ ACTIVE - ImpactProductNFT:
0x45417FFD32986DA5Ba232cb3FdFB9b21aE6D3539β ACTIVE - bDCU Token:
0x85162f919Bf8cd09B8046F8EAd2ecD434841e044
Implementation Addresses (for upgrades only):
- PointsRewardDistributor Impl:
0x8f29111f7BA8D2D5345Ea683822cd0E37C6a15B6 - VerificationContract Impl:
0x74dc3CE94069027520C060FA2e94479a446c84B7 - ImpactProductNFT Impl:
0xdA614b090d26dd2e68cC1A8c5601D8f38eA6E96A
Note: All contracts use UUPS (Universal Upgradeable Proxy Standard) pattern for future upgrades.
See DEPLOYMENT.md for mainnet addresses
- Ownable Contracts: All contracts use OpenZeppelin's Ownable pattern
- ReentrancyGuard: Critical functions protected against reentrancy
- Pausable: Emergency pause functionality available
- Access Control: Verifier and admin roles properly managed
- Input Validation: All user inputs validated
- Bot Protection: Vercel Bot ID protection on sensitive routes (Edge-level, no user friction)
- Rate Limiting: All API endpoints rate-limited to prevent abuse
- CORS Security: Secure CORS with origin validation (no wildcard)
- CSP Headers: Comprehensive Content Security Policy
- Security Headers: HSTS, X-Content-Type-Options, Referrer-Policy, Permissions-Policy
- Input Validation: JSON depth and size limits to prevent DoS attacks
- API Key Security: Server-side secrets properly isolated
- Automated Security: Dependabot for dependency updates, CodeRabbit for PR reviews
See SECURITY_AUDIT.md for complete security analysis.
Contributions welcome! Please:
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a Pull Request
- Telegram: t.me/DecentralizedCleanup
- Farcaster: @decleanup
See LICENSE file for details.
β
Production Ready - All core features implemented and tested
β
Admin Controls - Comprehensive admin functions available
β
Documentation - Complete documentation for admins, developers, and users
β
Security - Contracts and application secured with best practices
β
Bot Protection - Vercel Bot ID integrated (Edge-level protection, no user friction)
β
CORS/CSP - Secure headers and policies configured
β
Automated Security - Dependabot and CodeRabbit configured
Built with β€οΈ for a cleaner planet