Skip to content

A full-stack DApp featuring an ERC-20 token, staking system, raffles, and cross-chain transfers powered by Chainlink.

License

Notifications You must be signed in to change notification settings

Panorama-Block/zico-token

Repository files navigation

ZicoAI Token

A full-stack DApp featuring an ERC-20 token, staking system, raffles, and cross-chain transfers powered by Chainlink.

Zico Token Architecture

πŸ—οΈ System Architecture

High-Level Overview

The Zico Token DApp is an end-to-end Web3 ecosystem that blends several advanced blockchain technologies to deliver a utility token with cross-chain capabilities, a staking system with random rewards, and decentralized raffles.

Main Components

  1. ZicoToken.sol – Core Contract

    contract ZicoToken is ERC20, Ownable, CCIPReceiver, VRFConsumerBaseV2

    Features:
    β€’ ERC-20 Standard – 1 M initial supply
    β€’ Staking System – Users lock tokens to earn rewards
    β€’ Cross-Chain Bridge – Chainlink CCIP integration
    β€’ Random Rewards – Lottery mechanism via Chainlink VRF
    β€’ Governance – Access control with OpenZeppelin Ownable

    Staking architecture:
    β€’ mapping(address => uint256) public stakes – user stakes
    β€’ address[] public stakerList – active stakers
    β€’ Pro-rata reward distribution
    β€’ VRF-based random bonuses to boost engagement

  2. ZicoRaffle.sol – Raffle Engine

    contract ZicoRaffle is VRFConsumerBaseV2, Ownable

    Features:
    β€’ Participant Management – Dynamic whitelist
    β€’ Fair Selection – Chainlink VRF for unbiased winners
    β€’ Custom Prizes – Admin-defined rewards
    β€’ Treasury Integration – Payouts executed automatically

  3. TreasuryVault.sol – Fund Management

    contract TreasuryVault is Ownable

    Features:
    β€’ Multi-Token Support – Handles ZICO & LINK
    β€’ Fee System – Automatic protocol fee collection
    β€’ Reward Distribution – Unified payout interface
    β€’ Admin Controls – Withdrawals restricted to owner

  4. ZICOStaking.sol – Alternate Staking Pool

    contract ZICOStaking is ERC20, Ownable

    Features:
    β€’ Independent Pool – Separate reward mechanics
    β€’ Auto Reward Calculation – Proportional distribution
    β€’ Claim Functionality – Manual reward harvesting

Chainlink Integration

β€’ CCIP (Cross-Chain Interoperability Protocol)
– Burn & Mint model for chain hops
– Automatic LINK fee handling
– Supports Ethereum, Arbitrum, Polygon, Avalanche
– Cryptographic validation & guaranteed finality

β€’ VRF (Verifiable Random Function)
– True randomness for raffles & bonuses
– On-chain proof of fairness
– Asynchronous callback workflow
– Gas-efficient configuration options

Front-End Architecture

React Application Stack

Frontend/
β”œβ”€β”€ Components/   # Reusable UI pieces
β”œβ”€β”€ Hooks/        # Web3 logic
β”œβ”€β”€ Utils/        # Helpers & constants
└── Services/     # Contract wrappers

Technologies:
β€’ Ethers.js – Core blockchain library
β€’ TailwindCSS – Modern styling framework
β€’ React Hooks – Reactive state management
β€’ Toast Notifications – Transaction feedback

Web3 Interaction Flow

  1. Wallet Connection – Auto-detect & connect MetaMask
  2. Contract Instances – Init contracts via providers
  3. Transaction Handling – Pending / success / error states
  4. Real-Time Updates – Polling & event listeners

Security & Governance

β€’ Access Control – Ownable & role-based patterns
β€’ Emergency Switches – Pause & emergency withdraw
β€’ On-Chain Validation – Input checks, balance checks, re-entrancy guards
β€’ Audit Trail – Extensive event logging for transparency

Protocol Use Cases

For Regular Users

  1. Passive Staking – Lock tokens for steady rewards
  2. Cross-Chain Trading – Move assets across chains
  3. Raffle Participation – Win special prizes
  4. Yield Farming – Maximize returns via staking

For Administrators

  1. Liquidity Management – Cross-chain liquidity ops
  2. Reward Distribution – Strategic incentive programs
  3. Protocol Governance – Adjust key parameters
  4. Event Management – Launch & manage special raffles

Scalability & Performance

β€’ Gas Optimization – Batch ops, storage packing, view functions
β€’ Multi-Chain Architecture – L2 support (Arbitrum, Polygon)
β€’ Cross-Chain Composability – Interop with external protocols
β€’ Unified UX – One interface across multiple chains

Project Structure

zico-token/
β”œβ”€β”€ contracts/            # Smart contracts (Foundry)
β”‚   β”œβ”€β”€ src/              # Solidity sources
β”‚   β”œβ”€β”€ script/           # Deployment scripts
β”‚   β”œβ”€β”€ test/             # Unit tests
β”‚   └── foundry.toml      # Foundry config
β”œβ”€β”€ frontend/             # React UI
β”‚   β”œβ”€β”€ src/              # React source
β”‚   β”œβ”€β”€ public/           # Static assets
β”‚   └── package.json      # NPM deps
β”œβ”€β”€ assets/               # Images & docs
β”œβ”€β”€ .github/              # GitHub Actions
β”œβ”€β”€ setup.sh              # Initial setup script
β”œβ”€β”€ run_all.sh            # One-click runner
└── start_frontend.sh     # Front-end launcher

Features

β€’ ERC-20 Token – Advanced ZICO token
β€’ Staking System – Stake & receive random rewards
β€’ Raffles – Chainlink VRF-powered lotteries
β€’ Cross-Chain – CCIP transfers between networks
β€’ Web Interface – Modern, responsive React app

Quick Start

  1. Initial Setup
./setup.sh
  1. Run Everything (Recommended)
./run_all.sh
  1. Manual Startup

Terminal 1 – Local Blockchain

anvil

Terminal 2 – Contract Deployment

cd contracts
forge script script/Deploy.s.sol \
  --rpc-url http://127.0.0.1:8545 \
  --private-key 0xac0974bec39a17xyzed5efcae7f4f2ff80 \
  --broadcast

Terminal 3 – Front-End

./start_frontend.sh

Development

Contracts

cd contracts
forge build     # Compile
forge test      # Unit tests
forge fmt       # Format

Front-End

cd frontend
npm install     # Install deps
npm start       # Dev server
npm run build   # Production build

MetaMask Configuration

β€’ Network: Anvil Local
β€’ RPC URL: http://127.0.0.1:8545
β€’ Chain ID: 31337
β€’ Currency: ETH
β€’ Private Key: 0xac0974bec39a17xyzefcae784d7bf4f2ff80

Tech Stack

β€’ Solidity – Smart contracts
β€’ Foundry – Development framework
β€’ React – User interface
β€’ Ethers.js – Blockchain interaction
β€’ Chainlink VRF – Randomness
β€’ Chainlink CCIP – Cross-chain transfers
β€’ TailwindCSS – Styling

About

A full-stack DApp featuring an ERC-20 token, staking system, raffles, and cross-chain transfers powered by Chainlink.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •