An experimental playground for fully on-chain prediction market resolutions.
PM Kit is a playground project exploring how GenLayer's Intelligent Contracts can enable trustless, fully on-chain prediction market resolutions. Instead of relying on centralized oracles, markets are resolved by GenLayer validators that:
- Fetch real-world data (crypto prices, stock prices, news)
- Process non-deterministic data
- Reach consensus across multiple AI-powered validators
- Bridge results back to Base via LayerZero
This demonstrates a new paradigm for prediction markets where resolution is transparent, verifiable, and requires no trust assumptions.
The system consists of three main components working in harmony:
- Frontend: User interface for placing bets and viewing markets.
- Base Contracts: Manages funds, betting logic, and payouts on the Base blockchain.
- GenLayer Oracle: Intelligent contracts that fetch external data and push results back to Base.
graph TD
User([User]) -->|Place Bet| Frontend
Frontend -->|Tx| Base[Base Sepolia Contracts]
subgraph "Resolution Flow"
Base -->|Request| LZ[LayerZero Bridge]
LZ -->|Relay| GL[GenLayer Oracle]
GL -->|Fetch Data| Web(Real World Data)
GL -->|Consensus Result| LZ
LZ -->|Callback| Base
end
Base -->|Payout| User
Follow these steps to set up the project locally.
- Node.js (v18+)
- npm or pnpm
- A customized
contracts/.envfile with yourPRIVATE_KEY.
-
Install Contracts Dependencies
cd contracts npm install cp .env.example .env -
Install Frontend Dependencies
cd ../frontend npm install cp .env.example .env -
Install Bridge Service Dependencies
cd ../bridge/service npm install cp .env.example .env
Note: Uses MockUSDL as the betting token. For production, deploy with any ERC-20 by passing its address to the factory constructor.
cd contracts
# 1. Deploy MockUSDL token
npx hardhat run scripts/deploy-usdl.ts --network baseSepolia
# Note the deployed address
# 2. Deploy BetFactory (pass token address)
MOCK_USDL_ADDRESS=0x... npx hardhat run scripts/deploy-factory.ts --network baseSepolia
# Note the deployed factory address
# 3. Configure factory with bridge receiver (after bridge setup)
FACTORY_ADDRESS=0x... BRIDGE_RECEIVER_ADDRESS=0x... npx hardhat run scripts/configure-factory.ts --network baseSepoliaFollow the GenLayer Studio Bridge Boilerplate guide to set up the relay service. You will need to deploy:
- BridgeSender on GenLayer
- BridgeReceiver on Base (linked to your BetFactory)
cd frontend
npm run devOpen http://localhost:3000 to view the application.
We provide comprehensive test scripts for different parts of the stack.
| Component | Command | Description |
|---|---|---|
| E2E Flow | npm run test:e2e |
Full flow: Create -> Bet -> Resolve -> Bridge |
| Oracle | npm run test:oracle |
Deploy and test GenLayer oracle logic |
| Contracts | npx hardhat test |
Unit tests for Solidity contracts |
Distributed under the MIT License. See LICENSE for more information.