Testing Guide - CR8 Token Claim Portal
Quick Test Setup
The webapp works perfectly as a template for airdrop-style token claims! Here's how to test it:
Step 1: Deploy Contracts Locally
npm run deploy:localThis creates test contracts on Hardhat local network.
Step 2: Set Up Test Allocations
Create a simple test script or use the existing setup:
# Edit scripts/setupAllocations.js with test data
npm run setup:allocations -- --network hardhatExample test allocation:
const allocations = [
{
address: "0x70997970C51812dc3A010C7d01b50e0d17dc79C8", // Hardhat account #1
amount: "10000",
category: 0,
startTime: Math.floor(Date.now() / 1000) - 86400, // Started yesterday
vestingDuration: 0, // Immediate unlock (airdrop style)
cliffDuration: 0,
}
];Step 3: Configure Web App
Get contract addresses from deployment:
bashcat deployments/hardhat.jsonUpdate webapp/.env.local:
envNEXT_PUBLIC_TOKEN_VESTING_ADDRESS=0x5FC8d32690cc91D4c39d9d3abcBD16989F875707 NEXT_PUBLIC_CR8_TOKEN_ADDRESS=0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512 NEXT_PUBLIC_CHAIN_ID=1337 NEXT_PUBLIC_RPC_URL=http://127.0.0.1:8545Start webapp:
bashcd webapp npm install npm run dev
Step 4: Test with MetaMask
Add Hardhat network to MetaMask:
- Network Name: Hardhat Local
- RPC URL: http://127.0.0.1:8545
- Chain ID: 1337
- Currency Symbol: ETH
Import test account:
- Private key:
0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 - This is Hardhat's first test account (has 10,000 ETH)
- Private key:
Connect and test:
- Open
localhost:3000 - Connect MetaMask
- View allocation
- Claim tokens
- Open
Testing Different Scenarios
Airdrop Style (Immediate Unlock)
{
startTime: Math.floor(Date.now() / 1000) - 86400, // Started in past
vestingDuration: 0, // No vesting
cliffDuration: 0, // No cliff
}Vesting Style (Gradual Unlock)
{
startTime: Math.floor(Date.now() / 1000) - 180 * 86400, // Started 180 days ago
vestingDuration: 365 * 24 * 60 * 60, // 1 year vesting
cliffDuration: 90 * 24 * 60 * 60, // 90 day cliff (already passed)
}Future Unlock (Not Yet Claimable)
{
startTime: Math.floor(Date.now() / 1000) + 30 * 86400, // Starts in 30 days
vestingDuration: 365 * 24 * 60 * 60,
cliffDuration: 0,
}Using as Template
The webapp is perfectly suited as a template for:
✅ Airdrop Claims - Set vestingDuration: 0 and cliffDuration: 0
✅ Vesting Portals - Use linear vesting with cliff periods
✅ Reward Claims - Same mechanics, different branding
✅ Retroactive Distributions - Past contributor rewards
Key Template Features:
Flexible Allocation System
- Multiple categories
- Custom unlock schedules
- Batch operations
User-Friendly UI
- Wallet connection
- Clear allocation display
- One-click claiming
- Transaction tracking
Production Ready
- Error handling
- Loading states
- Responsive design
- Dark mode support
Customization Checklist
- [ ] Update token name/symbol
- [ ] Change branding colors
- [ ] Modify allocation categories
- [ ] Update network configuration
- [ ] Customize UI components
- [ ] Add custom features
See TEMPLATE_GUIDE.md for detailed customization instructions.
Troubleshooting
"No Allocation Found"
- Verify wallet address matches allocation
- Check allocations were set up correctly
- Ensure contract addresses are correct
Transaction Fails
- Ensure wallet has ETH for gas
- Verify tokens are unlocked
- Check network is correct
Contract Not Found
- Verify contract addresses in
.env.local - Check contracts were deployed
- Restart dev server after changes