A decentralized no-loss lottery protocol built on Hyperliquid, where players never lose their principal investment and compete to win yield generated from DeFi strategies.
HyperPool is an innovative lottery system where participants deposit wHYPE tokens to earn tickets for periodic draws. Unlike traditional lotteries, users can withdraw their deposits anytime while remaining eligible to win prizes generated from yield farming strategies. The protocol uses verifiable randomness (VRF) for fair winner selection and automatically compounds yield through HyperLend integration.
- π No Principal Loss: Withdraw your deposit anytime
- π° Yield Farming: Deposits automatically earn yield through HyperLend
- π² Fair Randomness: Uses Drand VRF for provably fair winner selection
- β‘ Auto-Compounding: Continuous yield harvesting into prize pools
- ποΈ Proportional Tickets: More deposits = better odds
- π Incentivized Actions: Earn rewards for calling harvest/close/finalize
βββββββββββββββββββββββββββ ββββββββββββββββββββββββ βββββββββββββββββββββββ
β Frontend β β Smart β β HyperLend β
β (Next.js + Privy) βββββΊβ Contracts βββββΊβ Protocol β
β β β β β β
β β’ Wallet Auth β β β’ LotteryVRF.sol β β β’ Yield Generation β
β β’ User Interface β β β’ DrandVRF_Split.sol β β β’ Liquidity Pool β
β β’ Transaction Mgmt β β β’ BLSVerifier.sol β β β’ Auto-compounding β
βββββββββββββββββββββββββββ ββββββββββββββββββββββββ βββββββββββββββββββββββ
β
βΌ
ββββββββββββββββββββββββ
β Drand VRF β
β (Randomness) β
β β
β β’ BLS Signatures β
β β’ External Beacon β
β β’ Provably Fair β
ββββββββββββββββββββββββ
LotteryVRF.sol: Main lottery logic with VRF integrationDrandVRF_Split.sol: Drand-based verifiable randomnessBLSVerifier.sol: BLS signature verification for Drand- Libraries: Helper contracts for views, errors, and calculations
- Framework: Next.js 14 with TypeScript
- Styling: Tailwind CSS with shadcn/ui components
- Web3: Wagmi + Viem for blockchain interactions
- Auth: Privy for wallet connection and authentication
- Node.js 18+
- Yarn or npm
- Git
# Clone the repository
git clone https://github.com/hyperpoolz/hyperloops.git
cd hyperloops
# Install dependencies
npm install
# Install frontend dependencies
cd frontend && npm install && cd ..
# Set up environment variables
cp .env.example .env
# Edit .env with your configuration# Compile contracts
npx hardhat compile
# Run tests
npx hardhat test
# Deploy locally
npx hardhat node
npx hardhat run scripts/deploy-simple.js --network localhost
# Start frontend development server
cd frontend
npm run devVisit http://localhost:3000 to see the application.
# Deploy to Hyperliquid mainnet
HYPERLEND_POOL="0x00A89d7a5A02160f20150EbEA7a2b5E4879A1A8b" \
HYPERLEND_DATA_PROVIDER="0x5481bf8d3946E6A3168640c1D7523eB59F055a29" \
WHYPE_TOKEN="0x5555555555555555555555555555555555555555" \
npx hardhat run scripts/deploy-final.js --network hyperevm_mainnet- Deposit: Add wHYPE tokens to enter the lottery
- Earn Tickets: Receive lottery tickets proportional to deposit (1 ticket per 0.1 wHYPE)
- Wait: Deposits automatically earn yield through HyperLend
- Win: Be selected in periodic draws to win accumulated yield
- Withdraw: Remove deposits anytime without penalty
- Yield Generation: User deposits supply liquidity to HyperLend
- Harvesting: Anyone can call
harvestYield()to collect yield into prize pool - Round Closure: When rounds end,
closeRound()requests randomness from Drand VRF - Winner Selection: VRF provides random number for proportional winner selection
- Prize Distribution: Winner receives yield minus small incentive fee
- Drand VRF: Uses BLS signatures from Drand beacon for verifiable randomness
- BN254 Curve: Optimized elliptic curve cryptography for efficient verification
- No Blockhash: Eliminates miner manipulation through external randomness source
- Transparent Process: All randomness requests and fulfillments are on-chain
# Blockchain Configuration
RPC_URL=https://api.hyperliquid-testnet.xyz/evm
PRIVATE_KEY=your_private_key_here
# Contract Addresses
HYPERLEND_POOL=0x00A89d7a5A02160f20150EbEA7a2b5E4879A1A8b
HYPERLEND_DATA_PROVIDER=0x5481bf8d3946E6A3168640c1D7523eB59F055a29
WHYPE_TOKEN=0x5555555555555555555555555555555555555555
# Frontend Configuration
NEXT_PUBLIC_CHAIN_ID=998
NEXT_PUBLIC_PROJECT_ID=your_walletconnect_project_iduint256 public constant TICKET_UNIT = 1e17; // 0.1 wHYPE per ticket
uint256 public constant LOTTERY_INTERVAL = 10 minutes; // Round duration
uint256 public constant HARVEST_INTERVAL = 10 minutes; // Min harvest delay
uint256 public constant INCENTIVE_BPS = 100; // 1% incentive feeDetailed documentation is available in the /docs folder:
- π Project Overview
- π Smart Contracts
- π₯οΈ Frontend Guide
- π API Integration
- π Deployment Guide
- βοΈ Technical Specifications
- π©βπ» Development Guide
- π§ͺ Testing Guide
# Run all tests
npx hardhat test
# Run specific test suites
npx hardhat test test/NoLossLotteryV2.test.js
npx hardhat test test/integration.test.js
# Generate coverage report
npx hardhat coverage
# Gas usage analysis
npx hardhat test --gas-reporter- β³ Pending: Professional security audit in progress
- β Completed: Comprehensive internal testing
- β Completed: Formal verification of critical functions
- β Completed: Extensive integration testing
- ReentrancyGuard: Prevents reentrancy attacks
- Access Controls: Owner-only functions for emergency operations
- Input Validation: Comprehensive parameter checking
- Safe Math: OpenZeppelin SafeERC20 for token operations
- External Randomness: Eliminates on-chain manipulation vectors
We welcome security researchers to review our code. Please report vulnerabilities responsibly to security@hyperpool.xyz.
We welcome contributions from the community! Please see our Contributing Guide for details.
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Make your changes with tests
- Run the test suite:
npm test - Commit with conventional commits:
git commit -m 'feat: add amazing feature' - Push to your branch:
git push origin feature/amazing-feature - Open a Pull Request
Lottery Contract: [Deployed Address]
VRF Contract: [Deployed Address]
BLS Verifier: [Deployed Address]
Lottery Contract: [Deployed Address]
VRF Contract: [Deployed Address]
BLS Verifier: [Deployed Address]
- Total Value Locked: $X.XX
- Active Participants: XXX users
- Rounds Completed: XX rounds
- Total Prizes Distributed: $X.XX
- Average APY: XX.X%
- Core protocol development
- VRF integration with Drand
- Frontend implementation
- Security audit completion
- Mainnet launch
- Multi-asset support
- Advanced yield strategies
- Mobile app release
- Governance token launch
- Cross-chain expansion
- Automated yield optimization
- NFT integration
- Advanced analytics dashboard
- Discord: Join our community
- Telegram: Official channel
- Twitter: @HyperPoolXYZ
- Email: support@hyperpool.xyz
This project is licensed under the MIT License - see the LICENSE file for details.
This protocol is experimental software. Users should understand the risks involved with DeFi protocols including but not limited to smart contract bugs, economic attacks, and regulatory changes. Never invest more than you can afford to lose.
Built with β€οΈ for the Hyperliquid ecosystem
For questions, suggestions, or support, please reach out to our community channels or create an issue in this repository.