A modern, decentralized application for staking ERC20 tokens with automatic rewards and real-time balance updates. Built with React, TypeScript, and Web3 technologies.
- RainbowKit wallet connection
- Support for multiple wallets (MetaMask, WalletConnect, Coinbase Wallet, etc.)
- Network switching and account management
- Mobile-responsive wallet interface
- ERC20 Token Staking: Stake any ERC20 tokens securely
- Automatic Approval: Smart approval flow for token spending
- Time-based Staking: Set custom staking durations
- Real-time Balance Updates: Automatic refresh when transactions confirm
- Unstaking: Withdraw staked tokens after duration expires
- shadcn/ui Components: Beautiful, accessible UI components
- Dark/Light Theme: Toggle between themes with system preference support
- Responsive Design: Optimized for mobile, tablet, and desktop
- Loading States: Visual feedback for all operations
- Error Handling: Comprehensive error messages and recovery
- Auto-Refresh: Balances update automatically after transactions
- Transaction Tracking: Monitor transaction confirmations
- Contract Information: View staking contract details
- Token Minting: Get free test tokens for staking
- Real-time Data: Live balance and staking information
- React 19 - Latest React with concurrent features
- TypeScript - Type-safe development
- Vite - Fast build tool and dev server
- Tailwind CSS 4 - Utility-first CSS framework
- Wagmi - React hooks for Ethereum
- Viem - TypeScript interface for Ethereum
- RainbowKit - Wallet connection UI
- TanStack Query - Data fetching and caching
- shadcn/ui - Modern component library
- Radix UI - Accessible UI primitives
- Lucide React - Beautiful icons
- Tailwind Merge - Dynamic class merging
- ESLint - Code linting
- TypeScript ESLint - TypeScript-specific linting
- PostCSS - CSS processing
- Node.js 18+ (preferably 20+)
- npm or yarn package manager
- A Web3 wallet (MetaMask, etc.)
-
Clone the repository
git clone https://github.com/your-username/erc20-token-staking.git cd erc20-token-staking -
Install dependencies
npm install
-
Start development server
npm run dev
-
Open your browser Navigate to
http://localhost:5173
# Build the application
npm run build
# Preview production build
npm run previewsrc/
βββ components/
β βββ ui/ # shadcn/ui components
β βββ site-header.tsx # Main header with wallet & theme
β βββ theme-provider.tsx # Theme context provider
β βββ mode-toggle.tsx # Theme switcher component
βββ hooks/
β βββ use-mobile.ts # Mobile detection hook
βββ lib/
β βββ utils.ts # Utility functions
βββ abi.json # Smart contract ABI
βββ ercabi.json # ERC20 contract ABI
βββ config.tsx # Wagmi configuration
βββ ContextProvider.tsx # Web3 context provider
βββ homepage.tsx # Main staking interface
βββ App.tsx # Root component
βββ main.tsx # Application entry point
The application uses default configurations but can be customized:
- Contract Addresses: Update in
ContextProvider.tsx - Supported Networks: Modify in
config.tsx - Theme Settings: Adjust in
theme-provider.tsx
The app integrates with custom staking contracts:
// Contract addresses (update these for your deployment)
const STAKING_CONTRACT = '0x78f68a870B2454AFb4fa8A944B7c18dAdcA39dDC';
const ERC20_CONTRACT = 'YOUR_ERC20_CONTRACT_ADDRESS';The app supports three theme modes:
- Light: Clean, bright interface
- Dark: Easy on the eyes for low-light environments
- System: Automatically matches your OS preference
All UI components are built with shadcn/ui and can be customized by:
- Modifying component variants in
src/components/ui/ - Updating Tailwind CSS classes
- Changing color schemes in
tailwind.config.js
- Type Safety: Full TypeScript coverage
- Input Validation: Client-side validation for all forms
- Error Boundaries: Graceful error handling
- Secure Transactions: Wallet-based transaction signing
- Contract Verification: Transparent smart contract interactions
The application is fully responsive and optimized for:
- Mobile phones (320px+)
- Tablets (640px+)
- Desktop (1024px+)
Key mobile features:
- Touch-friendly interface
- Optimized wallet connection
- Responsive card layouts
- Mobile-first design approach
- Connect your GitHub repository to Vercel
- Vercel will automatically detect Vite configuration
- Deploy with zero configuration
- Connect your repository to Netlify
- Set build command:
npm run build - Set publish directory:
dist - Deploy
# Build the project
npm run build
# Deploy the dist/ folder to your hosting service- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Commit your changes:
git commit -m 'Add 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.
- shadcn/ui for the beautiful component library
- RainbowKit for seamless wallet integration
- Wagmi for React hooks for Ethereum
- Vite for the lightning-fast build tool
- Tailwind CSS for the utility-first CSS framework
If you encounter any issues or have questions:
- Check the Issues page
- Create a new issue with detailed information
- Contact the maintainers
Stay tuned for updates:
- Additional token support
- Enhanced UI/UX improvements
- New staking features
- Mobile app development
Built with β€οΈ for the Web3 community