A full-stack DApp featuring an ERC-20 token, staking system, raffles, and cross-chain transfers powered by Chainlink.
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.
-
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 OwnableStaking architecture:
β’mapping(address => uint256) public stakes
β user stakes
β’address[] public stakerList
β active stakers
β’ Pro-rata reward distribution
β’ VRF-based random bonuses to boost engagement -
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 -
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 -
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
β’ 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
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
- Wallet Connection β Auto-detect & connect MetaMask
- Contract Instances β Init contracts via providers
- Transaction Handling β Pending / success / error states
- Real-Time Updates β Polling & event listeners
β’ 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
For Regular Users
- Passive Staking β Lock tokens for steady rewards
- Cross-Chain Trading β Move assets across chains
- Raffle Participation β Win special prizes
- Yield Farming β Maximize returns via staking
For Administrators
- Liquidity Management β Cross-chain liquidity ops
- Reward Distribution β Strategic incentive programs
- Protocol Governance β Adjust key parameters
- Event Management β Launch & manage special raffles
β’ 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
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
β’ 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
- Initial Setup
./setup.sh
- Run Everything (Recommended)
./run_all.sh
- 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
cd contracts
forge build # Compile
forge test # Unit tests
forge fmt # Format
cd frontend
npm install # Install deps
npm start # Dev server
npm run build # Production build
β’ Network: Anvil Local
β’ RPC URL: http://127.0.0.1:8545
β’ Chain ID: 31337
β’ Currency: ETH
β’ Private Key: 0xac0974bec39a17xyzefcae784d7bf4f2ff80
β’ Solidity β Smart contracts
β’ Foundry β Development framework
β’ React β User interface
β’ Ethers.js β Blockchain interaction
β’ Chainlink VRF β Randomness
β’ Chainlink CCIP β Cross-chain transfers
β’ TailwindCSS β Styling