Skip to content

A Gamified Liquidity Pools with Lottery and Prediction Markets

Notifications You must be signed in to change notification settings

Signor1/poolplay

Repository files navigation

PoolPlay

EigenLayer Uniswap Hook Foundry Next.js TailwindCSS shadcn/ui Reown Wagmi TanStack Query

PoolPlay is a Uniswap V4 hook that gamifies decentralized finance by integrating lottery pools and prediction markets into liquidity pool interactions. Users can enter lotteries simply by swapping tokens through supported pools, with fees collected contributing to prize pots, while prediction markets allow betting on pool metrics like TVL.

Table of Contents

Features

Swap-to-Enter Lottery Pools

  • Every swap through a PoolPlay-integrated Uniswap V4 pool collects a small fee (e.g., 1% of input amount)
  • Swappers are automatically entered into daily lotteries via Chainlink VRF
  • 90% of pot goes to winner, 10% operator commission

Prediction Markets

  • Bet on future pool metrics (TVL, volume) using ERC20 tokens
  • Outcomes settled via PoolManager data/oracles
  • 0.5% platform fee on settlements

Architecture

flowchart LR
    subgraph A[User Interaction]
      U1[User: Swaps Tokens]
      U2[User: Creates Lottery]
      U3[User: Places Prediction Bet]
    end

    subgraph B[Uniswap Ecosystem]
      UNI[Uniswap V4 Pool]
      H[PoolPlayHook]
      R[PoolPlayRouter]
    end

    subgraph C[PoolPlay Contracts]
      L[LotteryPool]
      P[PredictionMarket]
    end

    subgraph D[External Services]
      VRF[Chainlink VRF]
      ORACLE[Off-Chain Oracle]
    end

    U1 -->|Initiates Swap| R
    R -->|Executes Swap| UNI
    UNI -->|Triggers Hook| H
    H -->|Collects Fee, Enters Swapper| L
    U2 -->|Creates Lottery for Pool| L
    L -->|Requests Randomness| VRF
    VRF -->|Selects Winner| L
    U3 -->|Places Bet| P
    P -->|Queries Metrics| UNI
    P -->|Fetches Data| ORACLE
Loading

Getting Started

Prerequisites

  • Node.js 18+ & npm 9+
  • Foundry (forge 0.2.0+)
  • Ethereum wallet (MetaMask recommended)
  • Solidity fundamentals

Installation

Clone repository:

git clone https://github.com/yourusername/PoolPlay.git
cd PoolPlay

Install dependencies:

npm install
forge install

Configure environment:

cp .env.example .env
# Edit .env with your credentials

Compile contracts:

forge build

Deploy to testnet:

forge script script/Deploy.s.sol --rpc-url $RPC_URL --private-key $PRIVATE_KEY --broadcast

Contract Overview

PoolPlayHook

  • Uniswap V4 hook handling swap interception
  • Collects fees and manages lottery entries

LotteryPool

  • Permissionless lottery creation/management
  • Chainlink VRF integration for winner selection
  • 10% operator commission structure

PoolPlayRouter

  • Swap router ensuring proper hook interaction
  • Maintains swapper address tracking

PredictionMarket

  • ERC20-based betting system
  • Oracle-powered metric verification
  • 0.5% platform fee on settlements

Usage

As a Swapper

  1. Connect wallet to PoolPlay dApp
  2. Select supported Uniswap V4 pool
  3. Perform swap to automatically enter lottery

As a Lottery Creator

// Create lottery for pool with 1% fee
LotteryPool.createLottery(
  poolAddress,
  feeToken,
  1 days,
  100 // 1% fee in basis points
);

As a Bettor

  1. Deposit ERC20 tokens to PredictionMarket
  2. Place bet on desired pool metric
  3. Settle bet after validation period

Contributing

We welcome contributions! Please see our Contribution Guidelines for details.

License

MIT License - See LICENSE for full text

Team Members

About

A Gamified Liquidity Pools with Lottery and Prediction Markets

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •