A full-stack Web3 application that allows users to mint NFTs as proof of attending social events. Built with Next.js, Solidity, and modern Web3 technologies.
- Smart Contract: ERC721 NFT contract with event management
- Event Creation: Contract owner can create events with name, description, and image
- One-time Minting: Users can only mint once per event
- Friendship Points: Track how many unique events a user has attended
- Modern UI: Beautiful, responsive design with animations
- Wallet Integration: Seamless MetaMask and WalletConnect support
- Mobile-First: Optimized for all device sizes
- Next.js 15 - React framework with App Router
- TypeScript - Type safety
- Tailwind CSS - Styling
- Framer Motion - Animations
- Wagmi - Web3 React hooks
- Viem - Ethereum client
- Lucide React - Icons
- Solidity ^0.8.19 - Smart contract language
- OpenZeppelin - ERC721 and security contracts
- Foundry - Development framework
pof/
βββ contracts/ # Smart contracts
β βββ src/
β β βββ ProofOfFriendship.sol
β βββ test/
β β βββ ProofOfFriendship.t.sol
β βββ script/
β β βββ Deploy.s.sol
β βββ foundry.toml
βββ src/
β βββ app/ # Next.js App Router
β β βββ page.tsx # Homepage
β β βββ events/[id]/ # Event detail pages
β β βββ layout.tsx # Root layout
β βββ components/ # React components
β β βββ ui/ # UI components
β βββ hooks/ # Custom hooks
β β βββ useContract.ts # Web3 contract hooks
β βββ lib/ # Utilities
β β βββ wagmi.ts # Wagmi configuration
β β βββ utils.ts # Utility functions
β β βββ contract-abi.json
β βββ config/ # Configuration files
βββ package.json
- Node.js 18+ and Bun
- Foundry (for smart contract development)
-
Clone the repository
git clone <repository-url> cd pof
-
Install dependencies
# Install frontend dependencies bun install # Install Foundry (if not already installed) curl -L https://foundry.paradigm.xyz | bash foundryup
-
Install contract dependencies
cd contracts forge install
-
Build contracts
cd contracts forge build -
Run tests
forge test -
Deploy to local network
# Start local node anvil # In another terminal, deploy forge script script/Deploy.s.sol --rpc-url http://localhost:8545 --broadcast
-
Deploy to testnet
# Set your private key export PRIVATE_KEY=your_private_key_here # Deploy to Sepolia forge script script/Deploy.s.sol --rpc-url $SEPOLIA_RPC_URL --broadcast --verify
-
Update contract address After deploying, update the contract address in
src/hooks/useContract.ts:const CONTRACT_ADDRESS = '0x...' // Your deployed contract address
-
Start development server
bun dev
-
Open your browser Navigate to
http://localhost:3000
createEvent(name, description, imageURI)- Create a new event
mintForEvent(eventId)- Mint NFT for a specific eventcountEventsAttended(user)- Get user's total events attendedhasUserMintedForEvent(user, eventId)- Check if user minted for event
getEvent(eventId)- Get event detailsgetAllEvents()- Get all eventstotalEvents()- Get total number of events
- Responsive Design: Mobile-first approach
- Smooth Animations: Framer Motion for delightful interactions
- Modern Icons: Lucide React icons
- Glassmorphism: Beautiful backdrop blur effects
- Gradient Backgrounds: Purple to pink gradients
Create a .env.local file in the root directory:
# For contract deployment
PRIVATE_KEY=your_private_key_here
SEPOLIA_RPC_URL=your_sepolia_rpc_url
ETHERSCAN_API_KEY=your_etherscan_api_key
# For WalletConnect (optional)
NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID=your_project_idUpdate the contract address in src/hooks/useContract.ts after deployment.
cd contracts
forge testbun test- Deploy to your preferred network using Foundry
- Update the contract address in the frontend
- Verify the contract on Etherscan
-
Build the application:
bun run build
-
Deploy to Vercel:
vercel --prod
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
This project is licensed under the MIT License.
- OpenZeppelin for secure smart contract libraries
- Foundry for excellent development tools
- Wagmi for Web3 React hooks
- Framer Motion for animations
- Unsplash for beautiful images
If you have any questions or need help, please open an issue on GitHub.