Welcome to the Bleu challenge! This monorepo contains a full-stack dapp implementation for NFT staking with event indexing.
├── apps/
│ ├── contracts/ # Solidity smart contracts
│ ├── web/ # Next.js frontend
│ └── indexer/ # Ponder indexer
- Smart Contract: ERC721 NFT with staking capabilities
- Frontend: Next.js app with wallet integration
- Indexer: Ponder-based event indexing with GraphQL API
- Node.js 20.9+ (with corepack enabled)
# Enable corepack (if not already enabled)
corepack enable
# Enable pnpm (one-time setup)
corepack prepare [email protected] --activate
# Install dependencies
pnpm install
# Set up environment variables
pnpm setup:env
# Start all services in development mode
pnpm dev
# Start individual services
pnpm dev:web # Start frontend
pnpm dev:indexer # Start indexer
pnpm dev:anvil # Start local blockchain
# Build
pnpm build # Build all packages
pnpm build:web # Build frontend only
pnpm build:indexer # Build indexer only
pnpm build:contracts # Build contracts only
# Test
pnpm test # Run all tests
pnpm test:web # Run frontend tests
pnpm test:indexer # Run indexer tests
pnpm test:contracts # Run contract tests
# Linting & Formatting
pnpm check # Check code style and format
pnpm typecheck # Run type checking
# Clean
pnpm clean # Clean all build artifacts
# Build contracts
pnpm contracts:build
# Run contract tests
pnpm contracts:test
# Deploy to local network
pnpm contracts:deploy
# Deploy to testnet (Sepolia)
pnpm contracts:deploy:testnet
See apps/contracts/README.md for contract-specific documentation.
The Next.js frontend features:
- Wallet connection (via ConnectKit)
- NFT minting interface
- Staking management
- Real-time updates via GraphQL
See apps/web/README.md for frontend-specific documentation.
The Ponder indexer:
- Indexes NFT transfers and staking events
- Provides GraphQL API for querying NFT states
- Supports filtering and pagination
See apps/indexer/README.md for indexer-specific documentation.
Query examples:
# Get all staked NFTs
query GetStakedNFTs {
nfts(where: { staked: true }) {
id
owner
stakedAt
}
}
# Get recent staking events
query GetStakingEvents {
stakingEvents(orderBy: timestamp, orderDirection: desc, first: 10) {
id
tokenId
eventType
timestamp
}
}
# Run all tests
pnpm test
# Run linting
pnpm lint
# Fix linting issues
pnpm lint:fix
# Type checking
pnpm typecheck
# Build all packages
pnpm build
# Build specific package
pnpm build:web
pnpm build:indexer
pnpm build:contracts
The project can be deployed to:
- Smart Contracts: Sepolia testnet
- Frontend: Vercel
- Indexer: Your preferred hosting
# Deploy frontend to Vercel
pnpm deploy:web
# Deploy contracts to testnet
pnpm deploy:contracts
# Deploy indexer
pnpm deploy:indexer
See individual package READMEs for specific deployment instructions.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.