hackquest logo

Cookieverse Farcaster

Generate AI fortunes, mint COOKIE NFTs, bridge multi-chain with LayerZero, track quests, and battle on leaderboards across X & Farcaster in a sleek Cookieverse app and mini-app.

ビデオ

説明

🧩 Core Features

🍪 1. AI Fortune & COOKIE Minting

  • /api/fortune – calls OpenAI (Responses API) to generate a short fortune text

  • Main page (/) lets users:

    • Connect wallet (RainbowKit + Wagmi)

    • Generate fortune + image

    • Mint COOKIE NFTs via FortuneCookiesAI ABI (src/abi/FortuneCookiesAI.json)

  • Multi-chain aware:

    • Uses cookieAddressFor(chainId) to select correct COOKIE ERC-721 per chain

    • Supports Monad / Base / Mantle / Linea / Mitosis

🌉 2. ZK Bridge (LayerZero ONFT)

  • /bridge – ZK Bridge page implemented in src/app/bridge/page.tsx

  • Uses:

    • NEXT_PUBLIC_ADAPTER_* for ONFT Adapters per chain

    • NEXT_PUBLIC_ONFT_* / COOKIE canonical contracts

    • LayerZero v2 quoteSend + send on ONFT adapter ABI

  • UX:

    • Detects connected chain

    • Loads owned COOKIE token IDs (via /api/fc-token-ids)

    • Steps: Approve → Quote fee → Send (with flat fee params)

    • Updates MGID stats after successful bridge

🧮 3. Leaderboard

  • snapshot stored in Vercel Blob: fortune-cookie/snapshot.json via src/server/mgidStore.ts

  • Per-player record includes:

    • X username, Farcaster username

    • EOAWallet / SAWallet

    • per-chain scores, transactions, images

    • per-chain boost flags (BaseBoost, MonadBoost, LineaBoost, MantleBoost, MitosisBoost)

  • API routes:

    • /api/mgid-get – load player row

    • /api/mgid-upsert – recompute + persist MGID after actions (mint/bridge)

    • /api/mgid-leaderboard – sorted list for dashboard/leaderboard

    • /api/mgid-boosts – reads booster NFT ownership

  • UI:

    • /leaderboardLeaderboardClient

      • Shows top COOKIES minters (top-20), enriched with X / Farcaster from MGID

    • /dashboardDashboardClient

      • Shows multi-chain holdings, bridge counts, quests and ranks

📊 4. Multi-chain COOKIE Dashboard & Quests

  • Holdings:

    • /api/holdings aggregates NFT holdings per chain

    • Uses BlockVision + RPC fallbacks, plus a local “last-good” JSON to survive API hiccups

  • Leaderboard (on-chain view):

    • /api/leaderboard calculates top-20 mints per chain

    • Uses FortuneCookiesAI ABI with getPublicClientByKey for multi-chain scans

  • Quests & ranks (DashboardClient):

    • Daily & weekly COOKIE mint quests

    • Rank system (Bronze / Silver / Gold / Emerald) with custom colors

    • Per-chain counters (mints, bridges, images) and boosts

📱 5. Farcaster Mini-App (Cookieverse)

  • Mini-app entrypoint at /mini

  • Compact navigation in src/components/mini/MiniNav.tsx

  • Mini routes:

    • /mini – main minting view

    • /mini/bridge – mini bridge

    • /mini/dashboard – mini dashboard

    • /mini/leaderboard – mini leaderboard

    • /mini/smartaccount – smart account tools

  • Metadata published via public/.well-known/farcaster.json:

    • Name: Cookieverse

    • Home URL, icons, splash, description, webhook URL, category

  • Uses @farcaster/miniapp-sdk for:

    • Wallet connection with injected provider

    • Reading FID/session details (for Farcaster username mapping)

👤 6. Identity & Auth (X + Smart Accounts)

  • X / Twitter OAuth via NextAuth:

    • Config in src/lib/auth.ts

    • Provider: next-auth/providers/twitter (OAuth 2.0)

    • Session enriched with twitter_username & twitter_image

    • Used in MGID + UI (X avatar, username display)

  • Farcaster via Farcaster:

    • get username and wallet address

ハッカソンの進行状況

The app is built to be prod-ready: server-side APIs, on-chain scans, Etherscan v2 integration, Vercel Blob storage, OpenAI, Pinata, WalletConnect, LayerZero, Farcaster & more.

テックスタック

React
Web3
Ethers
Solidity
Next
Node
チームリーダー
Hhealth_coach
オープンソース
業界
SocialFiAINFT