hackquest logo

PROPHET

Prophet is a prediction market where one permission unlocks unlimited predictions. ERC-7715 + Envio power AI strategies and instant betting no popups, no friction, pure flow

视频

描述

PROPHET: The "Set-and-Forget" Prediction Market

Prophet is a prediction market where ERC-7715 enables Set-and-Forget AI strategies. Approve once, predict unlimited times no popups. Your AI agent executes trades instantly when markets match your criteria, all within your permission limits.

Live link: https://prophet-nine.vercel.app/

Github Repo: https://github.com/JamesVictor-O/PROPHET

X handle: https://x.com/codeX_james/status/2007564919001014602?s=20


🌟 Project Description

Prophet is reimagining how users interact with decentralized prediction markets. By moving away from the "One-Click, One-Confirm" model, we have built a platform where users can delegate their trading intent to a secure, permissioned AI agent.

Prophet started as a simple prediction market. During the MetaMask Cook-off, we discovered ERC-7715 and rebuilt everything. Now users grant one scoped permission, and our AI executes predictions automatically monitoring markets, placing bets, all within user-defined limits. No popups, just results.

The Problem

  1. High Friction UX: Traditional prediction markets require a wallet popup for every single bet, killing the excitement of real-time cultural events (like award shows or live sports).

  2. Opportunity Cost: Users miss out on lucrative markets because they aren't online the moment a "hot" prediction is created.

  3. Complex Onboarding: Standard Smart Accounts require users to manage new addresses and move funds, creating a barrier for average mobile users.

The Solution

We built a "Set-and-Forget" powerhouse using the latest account abstraction standards:

  1. Atomic Account Upgrades (EIP-7702): We instantly upgrade a user's existing EOA into a Smart Account for the session. No new wallet. No fund migration. The user's main account becomes "Smart" on demand.

  2. One-Tap Sessions (ERC-7715): Users grant a single "Session Permission" for specific parameters (e.g., "Spend up to 50 USDC on Music markets").

  3. AI Agent Delegation: Our AI, Prophet, monitors the chain 24/7. When a market matches the user's "Staking Intent" (e.g., "Bet on Burna Boy"), Prophet executes the trade automatically using the delegated permission.

  4. Sub-Second Data (Envio): Mobile needs speed. We use Envio HyperSync to index live market data and user leaderboards with sub-second latency, keeping the UI snappy and in-sync.

Core Features

  1. Set-and-Forget AI Prediction Strategies 🤖

The Innovation: Users create automated prediction strategies that execute without ANY wallet interaction after initial permission grant.

How It Works:

1. User grants ERC-7715 permission (ONE TIME)

2. User creates strategy with conditions: -

"Auto-bet on new sports markets"

"AI confidence > 60%" -

"Max 5 predictions/day, 0.025 USDC each"

3. Strategy list to envio for events, once prediction matches strategy, it runs automatically

4. NO wallet popups, NO manual intervention

Technical Implementation:

  • Uses ERC-7715 delegation to session account

  • StrategyExecutor monitors markets every 60 seconds

  • Automatically executes via redeemDelegations()

  • All within permission context and spending limits

2. One-Tap Betting (Zero Wallet Popups)

The Innovation: After one-time permission grant, users can place unlimited predictions with a single click - ZERO wallet confirmations.

Traditional Flow (Every Prediction):

User clicks "Predict"

MetaMask popup

→ Sign transaction

→ Wait for confirmation

Finally done (5-10 seconds)

Prophet Flow (After Permission)

User clicks "Predict"

→ Grant Permission onces

→ Transaction executes instantly

→ Done! (<1 second)

Technical Implementation:

  • Session Smart Account created on permission grant

  • redeemDelegations() executes transactions via ERC-7715 -

  • Gas sponsored by Pimlico Paymaster (ERC-4337)

  • USDC automatically transferred from user's EOA when needed

The Innovation:

Complete session-based permission system with MetaMask Smart Accounts.

User EOA (MetaMask)

Grant ERC-7715 Permission (once)

MetaMask Creates Smart Account (Gator)

Delegates to Session Account

Session Smart Account (ERC-4337)

Execute Transactions (many times)

Bundler + Paymaster (Pimlico)

Blockchain

Envio Indexer - Core Features

1. Real-Time Market Data

The Innovation: Sub-second GraphQL queries replace slow blockchain RPC calls.

Performance Comparison:

Traditional RPC: 2-5 seconds per queryEnvio GraphQL:   <100ms per querySpeed Boost:     10-50x faster

What's Indexed:

  • All MarketCreated events

  • All PredictionMade events

  • All MarketResolved events

  • All PayoutClaimed events

  • All ReputationUpdated events

Example Query:

graphql

query GetMarkets {
  Market(limit: 10, order_by: { createdAt: desc }) {
    id
    marketId
    question
    category
    totalPool
    yesPool
    noPool
    predictionCount
    status
    resolved
  }}

2. Live Activity Feeds with Envio

Real-time trending markets and user activity powered by Envio's instant queries.

Features:

  • ✅ Latest market updates

  • ✅ Recent predictions from all users

  • ✅ Market resolution notifications

  • ✅ User prediction history

  • ✅ Trending markets by volume

Benefits:

  • No manual polling needed

  • Data updates in real-time

  • Pre-aggregated for fast display

  • Scales to thousands of markets

3. Pre-Aggregated Entities

Envio automatically aggregates raw events into useful, queryable entities.

Market Entity:

graphql

type Market {id: String!marketId: BigInt!question: String!category: String!totalPool: BigInt!      # Pre-computed from all predictionsyesPool: BigInt!        # Pre-computednoPool: BigInt!         # Pre-computedpredictionCount: Int!   # Pre-computedstatus: String!resolved: Boolean!createdAt: BigInt!}

User Entity:

graphql

type User {id: String!address: String!totalPredictions: Int!      # AggregatedcorrectPredictions: Int!    # AggregatedtotalWinnings: BigInt!      # AggregatedcurrentStreak: Int!         # ComputedbestStreak: Int!            # ComputedreputationScore: BigInt!    # Live updatedusername: String}

GlobalStats Entity:

graphql

type GlobalStats {id: String!totalMarkets: Int!          # Platform-widetotalPredictions: Int!      # Platform-widetotalVolume: BigInt!        # Platform-widetotalUsers: Int!            # Platform-wideactiveMarkets: Int!         # Computed}

Why This Matters:

  • No need to manually calculate pools, counts, stats

  • Data is always up-to-date

  • Complex queries become simple

  • Massive performance improvement


4. Event-Driven Architecture 🔄

Every contract event is automatically indexed and transformed into queryable data.

Events Indexed:

MarketCreated → Creates Market entity

typescript

Market.load(marketId) || new Market(marketId)
market.question = event.params.question
market.category = event.params.category
market.save()

Prediction Made → Updates Market + creates Prediction

typescript

market.totalPool += amount
market.yesPool += isYes ? amount : 0
market.noPool += !isYes ? amount : 0
market.predictionCount += 1
market.save()

prediction = new Prediction(predictionId)
prediction.save()

MarketResolved → Updates Market status

typescript

market.resolved = true
market.status = "resolved"
market.winningOutcome = outcome
market.save()

PayoutClaimed → Updates User stats

typescript

user.totalWinnings += payout
user.correctPredictions += 1
user.save()

Technical Architecture (Updated)

  • Smart Contracts: Solidity (Base Sepolia). Optimized for EIP-7702 delegation.

  • Permissions: ERC-7715 via MetaMask Smart Accounts Kit.

  • Indexing: Envio HyperSync for sub-second data availability.

  • AI Engine: Google Gemini for market validation and automated strategy matching.

  • Frontend: Next.js 16 (Mobile-First) + Viem v2 + Wagmi.

本次黑客松进展

During this hackathon, we fundamentally re-architected PROPHET to transition from a high friction Web3 experience to a seamless, "Web2-like" prediction market. Our primary focus was leveraging the latest MetaMask Advance Permission to solve the "Pop-up Fatigue" that plagues decentralized betting. 1. Implementation of EIP-7702 & ERC-4337 Hybrid Architecture We successfully modified our core architecture to leverage EIP-7702 (Designated Code Delegation). This allowed us to: Upgrade EOAs on-the-fly: Transform a user's standard MetaMask account into a Smart Account in a single transaction. Remove "Double Signatures": By moving to a 7702-based delegation model, users no longer need to manage separate "Smart Account" balances; they can trade directly from their main wallet with smart contract capabilities. 2. Advanced "Set-and-Forget" Permissions (ERC-7715) We integrated the MetaMask Smart Accounts Kit to implement session-based permissions. One-Tap Trading: Users grant permission once at the start of their session. This eliminates wallet pop-ups for every single prediction creation or stake, allowing for high-frequency interaction. AI-Delegated Strategies: Leveraging MetaMask advanced permissions, we enabled "Set-and-Forget" strategies. Users can now define specific staking parameters and delegate execution to an AI agent. When a prediction market is created that matches the user’s strategy, the system automatically executes the stake on their behalf without requiring manual approval. 3. High-Performance Indexing with Envio To ensure a fluid user interface, we integrated the Envio Indexer to handle our off-chain data requirements. This significantly boosted app performance by: Real-time Leaderboards: Instantly calculating user rankings based on win rates and volume. Comprehensive Activity Feeds: Providing users with a low-latency view of their history, including markets created, total stakes, and historical win/loss ratios.

技术栈

React
Next
Ethers
Solidity
metamask
metamask advance permission
队长
JJames Victor
赛道
SocialFiGamingAI