CR8 Token Claim Portal - Testnet Deployment Guide
Complete guide to deploy and test the CR8 Token Claim Portal on Sepolia testnet.
Prerequisites
Sepolia ETH - Get from faucets:
Environment Setup:
bash# Create .env file in project root PRIVATE_KEY=your_private_key_without_0x SEPOLIA_RPC_URL=https://ethereum-sepolia-rpc.publicnode.com # Or use Alchemy/Infura for better reliability ETHERSCAN_API_KEY=your_key (optional, for verification)
Step 1: Deploy Contracts to Sepolia
bash
npm run deploy:sepoliaThis will deploy:
- ✅ CR8Token (upgradeable, 1.665B tokens)
- ✅ CR8Staking
- ✅ AgentDeposit
- ✅ TokenVesting (for claim portal)
Save the addresses - they'll be in deployments/sepolia.json
Step 2: Set Up Allocations
You have two options:
Option A: Use the Setup Script
Edit scripts/setupAllocations.js with your prelaunch holder addresses:
javascript
const allocations = [
{
address: "0x...", // Prelaunch holder wallet
amount: "1000000", // Amount in CR8 tokens
category: 0, // 0=Individual, 1=Contributor, 2=Community, 3=Angel
startTime: Math.floor(Date.now() / 1000) - 86400, // Started yesterday
vestingDuration: 0, // Immediate unlock (airdrop style)
cliffDuration: 0, // No cliff
},
// Add more allocations...
];Then run:
bash
npm run setup:allocations -- --network sepoliaOption B: Use the Complete Setup Script
bash
npx hardhat run scripts/testnetSetup.js --network sepoliaThis script will:
- Check deployment status
- Set up test allocations
- Transfer tokens to vesting contract
- Verify allocations
- Generate webapp configuration
Step 3: Transfer Tokens to Vesting Contract
The vesting contract needs to hold the tokens for allocations.
Option 1: Transfer from deployer
bash
# Using Hardhat console or a script
npx hardhat console --network sepolia
> const Token = await ethers.getContractAt("CR8Token", "TOKEN_ADDRESS");
> await Token.transfer("VESTING_ADDRESS", ethers.parseEther("1000000"));Option 2: Mint directly (if you're the owner)
bash
> await Token.mint("VESTING_ADDRESS", ethers.parseEther("1000000"));Step 4: Configure Web App
Get contract addresses:
bashcat deployments/sepolia.jsonUpdate webapp/.env.local:
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 # Sepolia NEXT_PUBLIC_RPC_URL=https://ethereum-sepolia-rpc.publicnode.com NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID=your_project_idInstall dependencies:
bashcd webapp npm installStart development server:
bashnpm run dev
Step 5: Test the Portal
Connect MetaMask:
- Switch to Sepolia network
- Connect your wallet
Test Claim Flow:
- View allocation details
- Check claimable amount
- Claim tokens
- Verify transaction on Etherscan
Test with Different Wallets:
- Use wallets that have allocations
- Test claiming unlocked tokens
- Verify vesting schedule display
Example Allocation Scenarios
Airdrop Style (Immediate Unlock)
javascript
{
startTime: Math.floor(Date.now() / 1000) - 86400, // Started in past
vestingDuration: 0, // No vesting
cliffDuration: 0, // No cliff
}Vesting Style (Gradual Unlock)
javascript
{
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
javascript
{
startTime: Math.floor(Date.now() / 1000) + 30 * 86400, // Starts in 30 days
vestingDuration: 365 * 24 * 60 * 60,
cliffDuration: 0,
}Verification (Optional)
Verify contracts on Etherscan:
bash
# Verify TokenVesting
npx hardhat verify --network sepolia \
TOKEN_VESTING_ADDRESS \
CR8_TOKEN_ADDRESS
# Verify CR8Token (if needed)
npx hardhat verify --network sepolia \
IMPLEMENTATION_ADDRESS \
--constructor-args arguments.jsTroubleshooting
"Insufficient funds"
- Get more Sepolia ETH from faucet
- Check gas prices
"No allocation found"
- Verify wallet address matches allocation
- Check allocations were set up correctly
- Ensure contract addresses in
.env.localare correct
"No tokens claimable"
- Check vesting schedule (start time, cliff)
- Verify tokens are unlocked
- Check allocation is active
Contract calls failing
- Verify network is Sepolia
- Check RPC URL is correct
- Ensure contracts are deployed
Security Checklist
- [ ] Deployed contracts verified on Etherscan
- [ ] Contract addresses saved securely
- [ ] Allocations set up correctly
- [ ] Webapp configured with correct addresses
- [ ] Tested with multiple wallets
- [ ] Verified claim functionality
- [ ] Checked vesting schedules
- [ ] Tested edge cases
Next Steps
After successful testnet deployment:
- ✅ Test all functionality
- ✅ Get community feedback
- ✅ Fix any issues
- ✅ Prepare for mainnet deployment
- ✅ Set up monitoring/analytics
Support
- Check
deployments/sepolia.jsonfor contract addresses - View contracts on Etherscan: https://sepolia.etherscan.io
- Review allocation setup in
scripts/setupAllocations.js - Check webapp logs for errors