Skip to content

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:

  1. TokenVesting Contract - Smart contract managing token allocations and unlock schedules
  2. 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

  1. Configure Hardhat:

    • Ensure your .env file has the necessary keys:
      PRIVATE_KEY=your_private_key
      SEPOLIA_RPC_URL=your_sepolia_rpc_url
      ETHERSCAN_API_KEY=your_etherscan_api_key (optional)
  2. Deploy contracts:

    bash
    npm run deploy:sepolia

    This will deploy:

    • CR8Token (upgradeable)
    • CR8Staking
    • AgentDeposit
    • TokenVesting
  3. Save the deployment addresses - They will be saved to deployments/sepolia.json

Step 2: Set Up Allocations

  1. 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
  2. Set up allocations:

    • Edit scripts/setupAllocations.js
    • Add your allocations in the allocations array:
      javascript
      const 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...
      ];
  3. Run the setup script:

    bash
    npx hardhat run scripts/setupAllocations.js --network sepolia

Step 3: Set Up Web App

  1. Navigate to webapp directory:

    bash
    cd webapp
  2. Install dependencies:

    bash
    npm install
  3. Configure environment variables:

    bash
    cp .env.local.example .env.local

    Edit .env.local with your contract addresses:

    env
    NEXT_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  # Optional
  4. Get WalletConnect Project ID (optional):

  5. Run the development server:

    bash
    npm run dev
  6. Open in browser:

    • Navigate to localhost:3000
    • Connect your wallet
    • View your allocation and claim tokens

Step 4: Testing

  1. 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)
  2. 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.local are 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:

  1. Build the app:

    bash
    npm run build
  2. Deploy to hosting service:

    • Vercel (recommended for Next.js)
    • Netlify
    • Your own server
  3. Update environment variables on your hosting platform with production contract addresses

  4. Update chain configuration in app/providers.tsx for mainnet

Security Notes

  • Never commit .env.local files
  • 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

CR8 Platform Documentation