A hands-on Web3 frontend bootcamp project that teaches students how to build decentralized applications (dApps) using modern Web3 technologies. This project demonstrates a complete DeFi (Decentralized Finance) application with wallet integration, token faucet, and vault operations.
By completing this bootcamp, students will learn:
- Wallet Integration: Connect and interact with Web3 wallets (MetaMask, WalletConnect, etc.)
- Smart Contract Interaction: Read from and write to blockchain smart contracts
- Transaction Management: Handle transaction states, confirmations, and error handling
- Token Operations: Work with ERC-20 tokens (USDC Mock)
- DeFi Mechanics: Understand deposit, mint, redeem, and withdraw operations in a vault system
- React 19 with TypeScript for type-safe development
- Wagmi v3: Modern React hooks for Ethereum development
- Viem: Low-level Ethereum interactions and utilities
- RainbowKit: Beautiful wallet connection UI
- TanStack Query: Efficient data fetching and caching
- Tailwind CSS v4: Modern utility-first styling
- React Router: Client-side routing in SPAs
- Faucet Page: Mint test USDC tokens for development
- Earn Page: Interact with a vault contract
- Deposit USDC into the vault
- Mint vault shares
- Redeem shares for USDC
- Withdraw USDC from the vault
- Node.js 22+ installed
- pnpm package manager (
corepack enable pnpm) - MetaMask or another Web3 wallet
- Some Base Sepolia testnet ETH for gas fees
- Clone the repository:
git clone https://github.com/DevWeb3Jogja/batch-5-fe.git
cd batch-5-fe- Install dependencies:
pnpm install- Create a
.envfile in the root directory:
VITE_WALLETCONNECT_PROJECT_ID=your_walletconnect_project_idGet your WalletConnect Project ID from WalletConnect Cloud
- Start the development server:
pnpm dev- Open your browser and navigate to
http://localhost:5173
src/
βββ components/
β βββ pages/
β β βββ earn/ # Vault operations (deposit, mint, redeem, withdraw)
β β βββ faucet/ # Token faucet for testing
β βββ shared/ # Reusable components
β βββ ui/ # UI primitives (buttons, cards, inputs)
βββ lib/
β βββ wagmi-config.ts # Wagmi and blockchain configuration
β βββ usdc-mock-abi.ts # Smart contract ABI
β βββ utils.ts # Utility functions
βββ pages/ # Page components
Wagmi provides React hooks for Ethereum interactions:
useConnect/useDisconnect: Wallet connection managementuseReadContract: Read data from smart contractsuseWriteContract: Execute transactionsuseWaitForTransactionReceipt: Wait for transaction confirmations
Beautiful, customizable wallet connection UI that supports:
- MetaMask
- WalletConnect
- Coinbase Wallet
- And many more...
TypeScript library for Ethereum that provides:
- Type-safe contract interactions
- Utility functions (
formatUnits,parseUnits) - Lower-level blockchain operations
This project interacts with two main contracts on Base Sepolia:
- USDC Mock:
0xF6f2377B59c2c316537a64F5c366DE38f3FB0796 - Vault Contract:
0x613148C5e1A27c99B28Cb01A5954C5dD3b2c9abf
The main branch contains the complete implementation with all features working. Use this as a reference.
This branch will demonstrate wallet integration using Privy.io as an alternative to RainbowKit. Students will:
- See how Privy.io wallet connection works
- Complete the remaining features (earn page operations)
- Learn how to swap between different wallet providers
- Understanding Web3 wallets
- Implementing wallet connect/disconnect
- Managing connection states
- Displaying wallet address and balance
- Using
useReadContracthook - Fetching token balances
- Understanding contract ABIs
- Formatting blockchain data
- Using
useWriteContracthook - Handling transaction states
- Error handling and user feedback
- Transaction confirmations
- Token approvals
- Deposit/Withdraw mechanics
- Mint/Redeem share calculations
- Percentage-based operations
pnpm dev- Start development serverpnpm build- Build for productionpnpm preview- Preview production buildpnpm lint- Run ESLint
The app is configured to work with Base Sepolia testnet. To get testnet ETH:
- Visit Base Sepolia Faucet
- Enter your wallet address
- Receive testnet ETH for gas fees
This is a bootcamp project for educational purposes. Students are encouraged to:
- Fork the repository
- Experiment with the code
- Add new features
- Add a new token: Integrate another ERC-20 token into the faucet
- Improve UI/UX: Add loading skeletons, better error messages
- Add features: Implement transaction history, token swap preview
- Multi-chain support: Add support for another testnet
- Wallet abstraction: Implement the Privy.io integration in the
privy-iobranch
Wallet won't connect
- Ensure MetaMask is installed and unlocked
- Check that you're on Base Sepolia network
- Clear browser cache and reload
Transaction fails
- Ensure you have enough testnet ETH for gas
- Check if you have sufficient USDC balance
- Verify contract approval for token transfers
Balance not updating
- Wait for transaction confirmation
- Manually refresh the page
- Check transaction on Sepolia Basescan
- Wagmi Documentation
- Viem Documentation
- RainbowKit Documentation
- Base Documentation
- Ethereum Development Documentation
MIT License - feel free to use this project for learning and teaching purposes.
Organizer: DevWeb3Jogja
Repository: batch-5-fe
Branch for Learning: privy-io (wallet integration demo)
Happy coding! π If you have questions, feel free to open an issue or reach out to the bootcamp instructors.