A modern, feature-rich DeFi staking platform built on CrossFi blockchain that allows users to stake both native XFI tokens and ERC20 tokens (USDT) to earn rewards.
- Native XFI Staking: Stake your XFI tokens to earn native rewards
- ERC20 USDT Staking: Stake USDT tokens to earn USDT rewards
- Flexible Staking Options: Choose between different staking periods and reward structures
- Live Statistics: View total staked amounts, reward rates, and epoch information
- User Portfolio: Track your staking positions, pending rewards, and performance
- Epoch Management: Monitor current epoch status and reward distribution cycles
- Reward Claiming: Claim earned rewards for both token types
- Position Management: View and manage your active staking positions
- Fee Tracking: Monitor accrued fees and platform statistics
- Emergency Withdraw: Access emergency withdrawal functionality when needed
- Modern UI: Beautiful, responsive interface with dark theme
- Real-time Updates: Live data updates using React Query
- Wallet Integration: Seamless wallet connection with thirdweb
- Toast Notifications: User-friendly feedback for all transactions
- Frontend: Next.js 15, React 19, TypeScript
- Styling: Tailwind CSS with custom design system
- Blockchain: CrossFi Network (Testnet/Mainnet)
- Web3: thirdweb SDK, ethers.js
- State Management: Zustand, React Query
- UI Components: Radix UI, Lucide React icons
- Notifications: Sonner toast system
- Node.js 18+
- pnpm (recommended) or npm
- MetaMask or compatible Web3 wallet
-
Clone the repository
git clone <repository-url> cd defi-staking-v2
-
Install dependencies
pnpm install
-
Environment Setup Create a
.env.localfile with the following variables:NEXT_PUBLIC_THIRDWEB_CLIENT_ID=your_thirdweb_client_id NEXT_PUBLIC_IS_TESTNET=true
-
Run the development server
pnpm dev
-
Open your browser Navigate to http://localhost:3000
The app supports both CrossFi Testnet and Mainnet:
- Testnet: Chain ID 4157 (default for development)
- Mainnet: Chain ID 4158 (for production)
NEXT_PUBLIC_THIRDWEB_CLIENT_ID: Your thirdweb client IDNEXT_PUBLIC_IS_TESTNET: Set to "true" for testnet, "false" for mainnet
- Connect Wallet: Click "Connect Wallet" to link your Web3 wallet
- Switch Network: Ensure you're connected to CrossFi network
- View Dashboard: Explore the main dashboard with platform statistics
- Choose Token Type: Select between XFI (native) or USDT (ERC20) staking
- Enter Amount: Specify the amount you want to stake
- Review Terms: Check staking period and reward rates
- Confirm Transaction: Approve the transaction in your wallet
- Monitor Position: Track your staking position in the user profile
- Check Pending Rewards: View available rewards in your profile
- Select Token Type: Choose which rewards to claim (XFI or USDT)
- Confirm Claim: Approve the claim transaction
- Receive Rewards: Rewards will be sent to your wallet
- View Active Stakes: See all your current staking positions
- Unstake Tokens: Withdraw your staked tokens (subject to lock periods)
- Track Performance: Monitor your staking performance over time
defi-staking-v2/
├── modules/
│ ├── app/ # App-level components and hooks
│ ├── blockchain/ # Smart contract ABIs and configurations
│ ├── components/ # Reusable UI components
│ ├── mutation/ # React Query mutations for transactions
│ ├── provider/ # Context providers
│ ├── query/ # React Query hooks for data fetching
│ └── utils/ # Utility functions and configurations
├── pages/ # Next.js pages
├── public/ # Static assets
└── styles/ # Global styles
- Smart Contract Integration: Secure interaction with audited smart contracts
- Transaction Validation: Comprehensive input validation and error handling
- Wallet Security: No private key storage, all transactions signed by user wallet
- Network Validation: Automatic network detection and switching
pnpm build
pnpm start- Set
NEXT_PUBLIC_IS_TESTNET=falsefor mainnet - Ensure all environment variables are properly configured
- Deploy to your preferred hosting platform (Vercel, Netlify, etc.)
- 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.
For support and questions:
- Check the documentation in the codebase
- Review the component structure for implementation details
- Ensure your wallet is connected to the correct CrossFi network
Note: This is a DeFi application. Always verify transaction details before confirming, and never share your private keys or seed phrases.