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.
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
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
- Node.js 18+ & npm 9+
- Foundry (forge 0.2.0+)
- Ethereum wallet (MetaMask recommended)
- Solidity fundamentals
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
- Uniswap V4 hook handling swap interception
- Collects fees and manages lottery entries
- Permissionless lottery creation/management
- Chainlink VRF integration for winner selection
- 10% operator commission structure
- Swap router ensuring proper hook interaction
- Maintains swapper address tracking
- ERC20-based betting system
- Oracle-powered metric verification
- 0.5% platform fee on settlements
As a Swapper
- Connect wallet to PoolPlay dApp
- Select supported Uniswap V4 pool
- 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
- Deposit ERC20 tokens to PredictionMarket
- Place bet on desired pool metric
- Settle bet after validation period
We welcome contributions! Please see our Contribution Guidelines for details.
MIT License - See LICENSE for full text