A decentralized application for participating in a lottery on the Base Sepolia Testnet blockchain.
This web application allows users to interact with a lottery smart contract deployed on the Base Sepolia Testnet. Users can:
- Connect their wallet
- Mint USDTFAKE tokens to participate in the lottery
- Purchase lottery tickets
- Check the current lottery round status
- View their transaction history
- Claim winnings (connected address is one of the winners by default)
- Next.js - React framework for creating web applications
- Tailwind CSS - for component styling
- wagmi - library for interacting with Ethereum
- RainbowKit - for wallet connection with beautiful UI
- viem - low-level library for interacting with Ethereum
- @coinbase/onchainkit - set of components for blockchain interaction
- LootGemLotteryMVP - main lottery contract (0xe104D4444D65DA9F87153F1455956B2b2BdB31E2)
- USDTFAKE - token for lottery participation (0xc2Bc86eE3C524A5CD4550393DE9E350F79ec596c)
-
Components:
Providers
- setup of providers for blockchain interactionConnectButton
- button for wallet connectionLotteryInfo
- information about the current lottery roundBuyTicket
- component for ticket purchaseMintTokens
- component for token mintingUserTickets
- user's ticket history
-
Contracts:
- Interfaces for interacting with lottery and token contracts
- Contract ABIs
-
Hooks:
- Custom hooks for reading contract data
- Hooks for sending transactions
-
Blockchain Connection:
- Using RainbowKit for convenient wallet connection
- Provider setup for Base Sepolia network
-
Contract Interaction:
- Using wagmi for reading data and sending transactions
- Data caching with TanStack Query
-
UI/UX:
- Responsive design using Tailwind CSS
- Modal windows for action confirmation
- Transaction status notifications
-
Event Handling:
- Contract event subscription for real-time UI updates
- Display of user transaction history
# Install dependencies
npm install
# Run in development mode
npm run dev
# Build for production
npm run build
# Run production version
npm run start
- Lottery contract: 0xe104D4444D65DA9F87153F1455956B2b2BdB31E2
- Game token: 0xc2Bc86eE3C524A5CD4550393DE9E350F79ec596c