$ show winsznx/theeleven
The Eleven is a full-stack prediction market platform for live football events, deployed on X Layer (chain 196) using Uniswap v4 hooks. The system is powered by 11 autonomous AI agent personas (e.g., IlRegista, IlBomber) that monitor live match data from API-Football or Football-Data.org, evaluate binary propositions (e.g., clean sheet, corners over, next goal), and create markets via a commit-reveal mechanism. Markets are implemented as PropMarketHook contracts deployed through a factory using CREATE2. Users can stake on outcomes gaslessly via EIP-3009 signatures relayed by the x402-facilitator service, and markets are resolved deterministically after match events. The monorepo (pnpm workspaces) contains five packages: `contracts` (Foundry-based Solidity), `agent` (TypeScript runtime with Prisma persistence), `web` (Next.js 15 dApp with RainbowKit, Three.js 3D pitch, and Farcaster Frame v2 integration), `x402-facilitator` (standalone npm package for gasless USDT0 transfers), and `mcp-server` (MCP bridge exposing market tools to AI agents). The architecture is event-driven: the agent's TickLoop polls matches, emits deltas, and triggers market creation/reveal/resolution skills. The web app provides a full dApp experience including a markets list, agent detail views, a status page, and documentation. Key reusable patterns include a generic proposition template system with ABI encoding/decoding, a CREATE2 salt miner for hook deployment, a commit-reveal skill with cryptographic safety, and a gasless staking flow that can be extracted for any EIP-3009-compatible token. The codebase is well-tested (172 web tests, 229 agent tests, 85 contract tests with 100% coverage on the hook) and actively maintained with CI/CD via GitHub Actions and Railway deployment.
The LLM identified 5 files worth highlighting for reuse:
Implements a deterministic salt miner for Uniswap v4 hook deployment via CREATE2. Iterates over nonces to find a salt that produces a hook address with a specific permission bitmap prefix. Isolated utility with no internal dependencies, reusable for any CREATE2-based deployment where address constraints are needed.
One of seven proposition templates implementing a generic Template<T> interface with encodeParams, decodeParams, and resolve methods. Demonstrates a clean, type-safe pattern for defining binary market logic with ABI-encoded parameters. Each template is self-contained and can be extracted to support new proposition types in other prediction market systems.
A standalone client for relaying gasless USDT0 transfers via EIP-3009 transferWithAuthorization. Handles typed data construction, signature splitting, and transaction submission. Published as an npm package (@regista11/x402-facilitator), it is fully reusable for any application needing gasless ERC-20 transfers on X Layer or compatible chains.
A reusable Three.js component that renders a dynamic liquid glass surface with custom shaders. Used as a decorative background element. Isolated from business logic, it can be extracted into any React Three Fiber project for immersive visual effects.
Abstract base class for all 11 agent personas. Defines the evaluate() method that returns a list of propositions based on match state, and buildRevealedParams() for commit-reveal. Each persona extends this with deterministic logic. The pattern is cleanly separated from the runtime loop and can be reused for other autonomous agent systems with similar evaluation and reveal workflows.