Skip to content

enliven17/push-predict

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

20 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

PushPredict 🌐

The world's first Universal Cross-Chain Prediction Market platform powered by Push Network's revolutionary technology and Push UI Kit. Trade on real-world events with seamless universal wallet integration and cross-chain interactions.

🌟 Universal Features

  • 🌐 Push Universal Wallet - Seamless multi-chain wallet integration with Push UI Kit
  • πŸ”„ Universal Authentication - Email, Google, and Web3 wallet login options
  • ⚑ Push Chain Client - Direct integration with Push Network's universal blockchain
  • 🎯 Binary Prediction Markets - Trade on Yes/No outcomes with PC tokens
  • πŸ“Š Live Price Feeds - Real-time crypto prices powered by Pyth Network
  • πŸ“ˆ Real-time Activity - Live betting tracking and market updates
  • πŸ‘€ Universal Dashboard - Complete betting history and portfolio management
  • πŸ’¬ Comments System - Market discussions and community engagement
  • πŸ”§ Admin Controls - Market creation and resolution tools
  • πŸ“± Responsive Design - Mobile-first UI with Push Network theme

πŸš€ Universal Tech Stack

  • Frontend: Next.js 15, TypeScript, Tailwind CSS
  • Universal Blockchain: Push Network Donut Testnet
  • Wallet Integration: Push UI Kit (@pushchain/ui-kit)
  • Universal SDK: @pushchain/core for blockchain interactions
  • Price Feeds: Pyth Network (Real-time crypto prices)
  • Smart Contracts: Solidity with Push Network integration
  • Database: Supabase (PostgreSQL) with universal schema
  • State Management: Zustand with Push Wallet Context
  • UI Components: Radix UI, Lucide Icons with Push Network theme
  • Authentication: Push Universal Wallet (Email, Google, Web3)

πŸ”— Network Information

🍩 Push Network (Primary)

πŸ“Š Pyth Network (Price Feeds)

  • Service: Real-time price data provider
  • API: Hermes API (https://hermes.pyth.network)
  • Update Frequency: Every 5 seconds
  • Supported Assets: BTC, ETH, SOL, USDC, USDT
  • Integration: Automatic price detection for crypto markets

πŸš€ Quick Start

Prerequisites

  • Node.js 18+ and npm
  • Push Universal Wallet (Email, Google, or Web3 wallet)
  • PC tokens (Push Network) - Primary currency
  • Push UI Kit integration for seamless wallet experience

Installation

  1. Clone the repository
git clone <repository-url>
cd push-predict
  1. Install dependencies
npm install
  1. Environment setup
cp .env.example .env
# Configure your environment variables
  1. Run development server
npm run dev
  1. Open application
http://localhost:3000

Environment Variables

# Push Network Configuration
NEXT_PUBLIC_PUSH_RPC_URL=https://evm.rpc-testnet-donut-node1.push.org/
NEXT_PUBLIC_CONTRACT_ADDRESS=0x0fA9052a598799d8ef7061bd74915E92532E5DE9
NEXT_PUBLIC_ADMIN_ADDRESS=<admin_wallet_address>
NEXT_PUBLIC_PUSH_CHAIN_ID=42101

# Push UI Kit Configuration
# No additional configuration needed - Push UI Kit handles wallet connections

# Private Keys (Server-side)
PRIVATE_KEY=<main_account_private_key>

# Supabase Database
NEXT_PUBLIC_SUPABASE_URL=<your_supabase_url>
NEXT_PUBLIC_SUPABASE_ANON_KEY=<your_supabase_anon_key>
SUPABASE_SERVICE_ROLE_KEY=<service_role_key>

# App Configuration
NEXT_PUBLIC_APP_URL=http://localhost:3000

# Pyth Network (Price Feeds)
# No API key required - uses public Hermes API
# Automatic integration for crypto price feeds

🌐 Deployment

Live Demo

πŸš€ Production URL: https://push-predict.vercel.app

Deploy to Vercel

  1. Install Vercel CLI
npm i -g vercel
  1. Login to Vercel
vercel login
  1. Deploy the project
vercel --prod
  1. Set environment variables in Vercel Dashboard
  • Go to your project settings in Vercel
  • Add all environment variables from .env.example
  • Make sure to set production values
  1. Redeploy after setting environment variables
vercel --prod

Environment Variables for Production

Required environment variables for Vercel deployment:

# Public variables (safe to expose)
NEXT_PUBLIC_CONTRACT_ADDRESS=0x0fA9052a598799d8ef7061bd74915E92532E5DE9
NEXT_PUBLIC_PUSH_RPC_URL=https://evm.rpc-testnet-donut-node1.push.org/
NEXT_PUBLIC_PUSH_CHAIN_ID=42101
NEXT_PUBLIC_SUPABASE_URL=your_supabase_url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key
NEXT_PUBLIC_ADMIN_ADDRESS=your_admin_address

# Private variables (server-side only)
PRIVATE_KEY=your_private_key
SUPABASE_SERVICE_ROLE_KEY=your_supabase_service_role_key

πŸ“± Usage Guide

🌐 For Users

  1. Connect with Push Universal Wallet - Email, Google, or Web3 wallet options
  2. Automatic Push Network Setup - Seamless connection to Push Chain
  3. Browse Prediction Markets - Explore available betting opportunities
  4. Place Bets with PC Tokens - Direct betting on Push Network
  5. Track Performance - View complete betting history and portfolio
  6. Claim Winnings - Collect rewards from successful predictions
  7. Join Discussions - Comment and engage with the community

πŸ”§ For Admins

  1. Create Markets - Set up new prediction markets
  2. Monitor Activity - Track platform usage and statistics
  3. Resolve Markets - Determine outcomes and distribute winnings
  4. Manage Platform - Oversee all market operations

πŸ—οΈ Universal Smart Contract

PushPredict Contract Details

  • Address: 0x0fA9052a598799d8ef7061bd74915E92532E5DE9
  • Network: Push Network Donut Testnet
  • Platform Fee: 2.5%
  • Min Bet: 0.01 PC
  • Max Bet: 10 PC

Push Network Integration Features

  • βœ… Push UI Kit Integration - Seamless wallet connection
  • βœ… Universal Authentication - Multiple login methods
  • βœ… Push Chain Client - Direct blockchain interaction
  • βœ… PC Token Betting - Native Push Network currency
  • βœ… Real-time Updates - Live market data and activity

Available Scripts

# Contract Deployment
npx hardhat run scripts/deploy.js --network push_testnet

# Market Management
node scripts/create-eth-market.js    # Create ETH prediction market
node scripts/create-btc-market.js    # Create BTC prediction market
node scripts/resolve-market.js       # Resolve market outcomes

# Push Network Testing
node scripts/test-push-universal.js     # Test Push Network features
node scripts/test-real-universal-bet.js # Test betting functionality

# Database Management
node scripts/sync-markets-to-supabase.js # Sync blockchain to database
node scripts/check-bet-activities.js     # Check bet activity records
node scripts/check-markets.js            # Verify market data

πŸ—„οΈ Universal Database Schema

The application uses Supabase for cross-chain data storage:

  • 🌐 Universal Markets - Cross-chain market information
  • πŸ”„ Cross-Chain Bet Activities - Multi-blockchain betting history
  • πŸ‘₯ Universal Users - Cross-chain user profiles and mapping
  • πŸ’¬ Universal Comments - Multi-chain market discussions
  • πŸ“Š Cross-Chain Analytics - Universal platform statistics

Setup Universal Database:

-- Execute supabase-schema.sql in your Supabase SQL Editor
-- Includes cross-chain tables with foreign key relationships
-- Supports multi-blockchain user activities and positions

Key Universal Tables:

  • markets - Universal market data with supported_chains
  • bet_activities - Cross-chain betting records with chain_namespace
  • user_positions - Multi-chain user positions with original_address
  • users - Universal user profiles with chain mapping

🎨 Architecture

See diagrams.md for detailed system architecture and flow diagrams.

πŸ› οΈ Development

Project Structure

β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ app/                 # Next.js app router pages
β”‚   β”œβ”€β”€ components/          # React components
β”‚   β”œβ”€β”€ hooks/              # Custom React hooks
β”‚   β”œβ”€β”€ lib/                # Utility libraries
β”‚   β”œβ”€β”€ providers/          # Context providers
β”‚   └── types/              # TypeScript definitions
β”œβ”€β”€ contracts/              # Solidity smart contracts
β”œβ”€β”€ scripts/               # Deployment and utility scripts
└── public/               # Static assets

Key Components

  • Market Cards - Display market information
  • Bet Dialog - Handle bet placement with validation
  • Activity Feed - Show real-time betting activity
  • Comments System - Enable market discussions
  • Admin Dashboard - Market management tools

πŸ” Security

  • Smart Contract Audited - Comprehensive security review
  • Input Validation - Client and server-side validation
  • Rate Limiting - API protection against abuse
  • Wallet Security - Non-custodial, user-controlled funds
  • Region Restrictions - Compliance with local regulations

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

🌐 Universal Cross-Chain Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Ethereum       β”‚    β”‚  Push Network   β”‚    β”‚  Solana         β”‚
β”‚  Sepolia        β”‚    β”‚  (Primary)      β”‚    β”‚  Devnet         β”‚
β”‚                 β”‚    β”‚                 β”‚    β”‚                 β”‚
β”‚  ETH Payment    │───▢│  PC Betting     │◀───│  SOL Payment    β”‚
β”‚  User Signs     β”‚    β”‚  Contract Exec  β”‚    β”‚  User Signs     β”‚
β”‚  Bridge Auto    β”‚    β”‚  Universal SDK  β”‚    β”‚  Bridge Auto    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚                       β”‚                       β”‚
         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                 β”‚
                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                    β”‚  Universal      β”‚
                    β”‚  Database       β”‚
                    β”‚  (Supabase)     β”‚
                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ™ Universal Acknowledgments

  • 🍩 Push Network Team - For revolutionary universal blockchain technology
  • ⟠ Ethereum Foundation - For robust cross-chain infrastructure
  • β—Ž Solana Labs - For high-performance blockchain integration
  • 🌈 RainbowKit - For excellent multi-chain wallet UX
  • πŸ—„οΈ Supabase - For reliable universal database and real-time features
  • ⚑ Vercel - For seamless deployment and hosting

πŸ“ž Universal Support


🌐 Built with ❀️ for the Universal Cross-Chain Future
Powered by Push Network's Revolutionary Technology enliven 2025

About

The world's first Universal Cross-Chain Prediction Market platform powered by Push Network's revolutionary technology. Trade on real-world events from any supported blockchain with cross-chain interactions.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors