CR8 Token Claim Portal - Setup Guide
This guide will help you set up and deploy the CR8 Token Claim Portal for prelaunch token holders.
Overview
The claim portal consists of:
- TokenVesting Contract - Smart contract managing token allocations and unlock schedules
- Next.js Web App - User interface for viewing allocations and claiming tokens
Prerequisites
- Node.js 18+ and npm
- Hardhat installed globally or locally
- A wallet with testnet ETH (for Sepolia deployment)
- WalletConnect Project ID (optional but recommended)
Step 1: Deploy Contracts
Configure Hardhat:
- Ensure your
.envfile has the necessary keys:PRIVATE_KEY=your_private_key SEPOLIA_RPC_URL=your_sepolia_rpc_url ETHERSCAN_API_KEY=your_etherscan_api_key (optional)
- Ensure your
Deploy contracts:
bashnpm run deploy:sepoliaThis will deploy:
- CR8Token (upgradeable)
- CR8Staking
- AgentDeposit
- TokenVesting
Save the deployment addresses - They will be saved to
deployments/sepolia.json
Step 2: Set Up Allocations
Transfer tokens to vesting contract:
- The TokenVesting contract needs to hold the tokens for allocations
- Transfer the required amount of CR8 tokens to the vesting contract address
Set up allocations:
- Edit
scripts/setupAllocations.js - Add your allocations in the
allocationsarray:javascriptconst allocations = [ { address: "0x...", // Beneficiary wallet address amount: "1000000", // Amount in CR8 tokens (will be converted to wei) category: 0, // 0=Individual, 1=Contributor, 2=Community, 3=Angel startTime: Math.floor(Date.now() / 1000), // Vesting start (unix timestamp) vestingDuration: 365 * 24 * 60 * 60, // 1 year in seconds cliffDuration: 90 * 24 * 60 * 60, // 90 days cliff in seconds }, // Add more allocations... ];
- Edit
Run the setup script:
bashnpx hardhat run scripts/setupAllocations.js --network sepolia
Step 3: Set Up Web App
Navigate to webapp directory:
bashcd webappInstall dependencies:
bashnpm installConfigure environment variables:
bashcp .env.local.example .env.localEdit
.env.localwith your contract addresses:envNEXT_PUBLIC_TOKEN_VESTING_ADDRESS=0x... # From deployments/sepolia.json NEXT_PUBLIC_CR8_TOKEN_ADDRESS=0x... # From deployments/sepolia.json NEXT_PUBLIC_CHAIN_ID=11155111 NEXT_PUBLIC_RPC_URL=https://ethereum-sepolia-rpc.publicnode.com NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID=your_project_id # OptionalGet WalletConnect Project ID (optional):
- Go to https://cloud.walletconnect.com/
- Create a new project
- Copy the Project ID to
.env.local
Run the development server:
bashnpm run devOpen in browser:
- Navigate to
localhost:3000 - Connect your wallet
- View your allocation and claim tokens
- Navigate to
Step 4: Testing
Test with a test wallet:
- Use a wallet that has an allocation
- Connect to the web app
- Verify allocation details are displayed correctly
- Test claiming tokens (if any are unlocked)
Verify on Etherscan:
- Check that allocations were set up correctly
- Verify token transfers when claiming
Allocation Categories
- 0 - Individual: Early supporters and community members
- 1 - Contributor: Project contributors and builders
- 2 - Community: Community treasury and rewards
- 3 - Angel: Angel investors and advisors
Vesting Schedule Details
- Start Time: When vesting begins (unix timestamp)
- Cliff Duration: Period before any tokens can be claimed
- Vesting Duration: Total time for linear unlock after cliff
After the cliff period ends, tokens unlock linearly over the remaining vesting duration.
Troubleshooting
"No Allocation Found"
- Verify the wallet address matches the allocation
- Check that allocations were set up correctly
- Ensure contract addresses in
.env.localare correct
Transaction Fails
- Ensure wallet has enough ETH for gas
- Verify tokens are actually unlocked (check vesting schedule)
- Check network is set to Sepolia
Contract Not Found
- Verify contract addresses in
.env.local - Check that contracts were deployed successfully
- Restart dev server after changing environment variables
Production Deployment
For production deployment:
Build the app:
bashnpm run buildDeploy to hosting service:
- Vercel (recommended for Next.js)
- Netlify
- Your own server
Update environment variables on your hosting platform with production contract addresses
Update chain configuration in
app/providers.tsxfor mainnet
Security Notes
- Never commit
.env.localfiles - Keep private keys secure
- Verify contract addresses before sharing
- Consider using environment-specific configurations
Support
For issues or questions:
- Check contract deployment logs
- Verify allocation setup
- Review web app console for errors
- Check Etherscan for transaction status