All projects

Token Premier League

Fantasy crypto gaming on the blockchain — Create teams of cryptocurrencies, compete in lobbies, and win prizes based on real-time price movements.

Prediction Markets CRE & AI

What it is

Token Premier League is a Web3 fantasy gaming platform where users build a team of 6 cryptocurrencies and compete in time-bound lobbies based on real market performance, instead of sports players. It solves the problem of passive crypto engagement by turning market knowledge and prediction skill into a competitive, transparent game with on-chain trust.
How it works:

  1. A user connects a wallet and joins a lobby with an entry fee.
  2. The user selects 6 tokens and assigns Captain (2x) and Vice-Captain (1.5x) multipliers.
  3. During the contest window, token prices are tracked using oracle data.
  4. Points are calculated from percentage price movement (for example, +1% = +100 points, -1% = -100 points), with multipliers applied.
  5. A live leaderboard ranks participants, and winners receive rewards based on final standings.
    What problem it solves:

Use Case

  • Centralize multiple feed mappings inside one contract (DataConsumerMulti)
  • Read latest prices on a fixed schedule without manual calls
  • Standardize output format for backend services, bots, or analytics pipelines
  • Keep chain/network and feed-pair configs environment-driven (staging / production)
    Stack
  • Solidity (0.8.20): DataConsumerMulti contract
  • Chainlink Data Feeds: underlying oracle data source
  • Chainlink CRE (Chainlink Runtime Environment): workflow runtime
  • TypeScript + Bun: workflow implementation and tests
  • Viem: ABI encoding/decoding and unit formatting
  • Zod: config schema validation
  • YAML/JSON config: target/rpc/workflow settings
    Architecture
  1. Smart Contract Layer
    • DataConsumerMulti stores pair → feed address mapping
    • Exposes getLatestPrice(pair) and getDecimals(pair)
  2. CRE Workflow Layer
    • main.ts boots Runner
    • workflow.ts defines handler logic
    • On trigger, workflow calls contract methods via EVMClient
    • Scales raw prices using decimals and logs results
  3. Configuration Layer
    • project.yaml: RPC + network target definitions
    • workflow.yaml: workflow artifact + config file mapping
    • config.staging.json / config.production.json: schedule, chain, contract, pairs
      CRE Modal Used
      The project uses a CRE cron-trigger modal (scheduled execution model):
  • CronCapability triggers the workflow at the configured interval (schedule)
  • Handler executes read-only EVM contract calls
  • Output is emitted as JSON each run

How it Works

  1. Frontend in Next.js 14 + TypeScript + TailwindCSS for lobby creation, team selection, leaderboard, wallet actions, and real-time UI updates.
  2. Wallet and chain integration using wagmi, viem, and RainbowKit.
  3. Backend/data layer with MongoDB for app state, snapshots, transactions, and participant/lobby metadata.
  4. Smart contracts (Solidity + Foundry + OpenZeppelin) to handle contest participation, deposits, reward distribution, and trustless settlement.
  5. Price oracle integration using Chainlink Data Feeds for market price inputs used in fantasy point calculations.

Links

Created by

  • Neeraj Choubisa