Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

10 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Polymarket Wrapped 🎁

Your personalized year in Polymarket trading - discover your stats, wins, and trading personality

A delightful, social, data-driven Wrapped experience for Polymarket traders, with an onchain footprint on Base.

Polymarket Wrapped License

Features

Core Features

  • πŸ”Œ Wallet Connect - Connect your wallet to instantly view your trading stats
  • πŸ“Š Trading Analytics - Comprehensive breakdown of your 2025 trading activity
    • Total trades, volume, and P&L
    • Win rate and best/worst trades
    • Favorite market categories
    • Trading persona (Whale, Day Trader, Strategic Investor, etc.)
    • Activity timeline and streaks
  • πŸ” Pin Code Sharing - Generate shareable pin codes for any trader's wrapped
  • πŸ–ΌοΈ Export & Share - Download beautiful images to share on social media
  • πŸŽ–οΈ NFT Badge Minting - Mint your Wrapped Badge as an NFT on Base (gasless!)

Technical Highlights

  • Next.js 16 with App Router and Server Components
  • RainbowKit + Wagmi for seamless wallet connection
  • Polymarket CLOB API integration for real-time trading data
  • Base Chain deployment with ERC-4337 account abstraction
  • Gasless Minting via Paymaster integration
  • Beautiful UI inspired by modern design patterns

Getting Started

Prerequisites

  • Node.js 18+ and npm/yarn/pnpm
  • A WalletConnect Project ID (get one here)
  • (Optional) Polymarket API key for rate limit increases

Installation

  1. Clone the repository

    cd /home/lyton/Documents/GitRepos/PolymarketWrapped
  2. Install dependencies

    npm install
    # or
    pnpm install
    # or
    yarn install
  3. Set up environment variables

    Copy .env.example to .env.local:

    cp .env.example .env.local

    Then fill in your values:

    NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID=your_walletconnect_project_id
    NEXT_PUBLIC_BADGE_CONTRACT_ADDRESS=your_deployed_contract_address
    NEXT_PUBLIC_PAYMASTER_URL=your_paymaster_url
    POLYMARKET_API_KEY=optional_polymarket_api_key
  4. Run the development server

    npm run dev
  5. Open http://localhost:3000 in your browser

Smart Contract Deployment

Deploy to Base

The PolymarketWrappedBadge contract is located in /contracts/PolymarketWrappedBadge.sol.

⚠️ Note: Due to dependency conflicts, we recommend deploying the contract separately.

See CONTRACT_DEPLOYMENT.md for detailed deployment instructions using:

  • ✨ Remix IDE (easiest, browser-based)
  • πŸ”¨ Foundry (recommended for production)
  • πŸ“¦ Separate Hardhat project

Contract Features:

  • ERC-721 compliant NFT
  • One badge per address per year
  • Custom metadata URI for each badge
  • Gas-efficient minting
  • Compatible with ERC-4337 account abstraction

Paymaster Setup

For gasless minting, integrate with a Paymaster service:

  1. Alchemy Account Kit (Recommended)

    • Sign up at Alchemy
    • Enable Paymaster for Base
    • Get your Paymaster URL
  2. Pimlico

    • Sign up at Pimlico
    • Configure Base sponsorship
    • Get your Paymaster endpoint
  3. Update .env.local with your Paymaster URL

Project Structure

polymarket-wrapped/
β”œβ”€β”€ app/
β”‚   β”œβ”€β”€ api/
β”‚   β”‚   β”œβ”€β”€ wrapped/[address]/    # Fetch wrapped data for an address
β”‚   β”‚   └── pincode/[code]/       # Resolve pin codes to addresses
β”‚   β”œβ”€β”€ layout.tsx                # Root layout with providers
β”‚   β”œβ”€β”€ page.tsx                  # Main page
β”‚   β”œβ”€β”€ providers.tsx             # Wagmi/RainbowKit setup
β”‚   └── globals.css               # Global styles
β”œβ”€β”€ components/
β”‚   β”œβ”€β”€ BackgroundEffects.tsx     # Animated background
β”‚   β”œβ”€β”€ HeroSection.tsx           # Landing section
β”‚   β”œβ”€β”€ StatsOverviewCard.tsx     # Trading stats display
β”‚   └── PersonaCard.tsx           # Trading persona card
β”œβ”€β”€ config/
β”‚   β”œβ”€β”€ app.ts                    # App configuration
β”‚   └── chains.ts                 # Chain configuration
β”œβ”€β”€ contracts/
β”‚   └── PolymarketWrappedBadge.sol # NFT badge contract
β”œβ”€β”€ lib/
β”‚   β”œβ”€β”€ polymarket-client.ts      # Polymarket API client
β”‚   β”œβ”€β”€ analytics-engine.ts       # Trading analytics
β”‚   β”œβ”€β”€ nft-client.ts             # NFT minting logic
β”‚   └── utils.ts                  # Utility functions
β”œβ”€β”€ types/
β”‚   └── trading.ts                # TypeScript types
└── package.json

API Routes

GET /api/wrapped/[address]

Fetch wrapped data for a specific address.

Response:

{
  "address": "0x...",
  "year": 2025,
  "stats": {
    "totalTrades": 150,
    "totalVolume": 50000,
    "totalPnL": 2500,
    "winRate": 0.65,
    "tradingPersona": {
      "type": "Strategic Investor",
      "description": "...",
      "traits": ["High Win Rate", "Calculated"],
      "emoji": "🎯"
    },
    ...
  },
  "trades": [...],
  "positions": [...]
}

GET /api/pincode/[code]

Resolve a pin code to wrapped data.

POST /api/pincode/[code]

Generate a new pin code for an address (admin use).

Request:

{
  "address": "0x..."
}

Response:

{
  "code": "ABC123",
  "address": "0x...",
  "expiresAt": 1234567890
}

Trading Personas

The app classifies traders into 8 unique personas based on their behavior:

Persona Criteria
πŸ‹ Whale High volume (>$100k) and large trades (>$2k avg)
⚑ Day Trader Very active (>200 trades)
🎯 Strategic Investor High win rate (>65%) and consistent trading
🎲 Degen Trader High risk, large individual bets
πŸ”₯ Risk Taker Negative P&L but persistent trading
πŸ’Ž HODL King Few trades but high volume, patient
🧠 Market Maven Diverse trading across many categories
🌱 Cautious Bettor New trader, just getting started

Roadmap

  • Core wrapped experience
  • Wallet connection
  • Pin code sharing
  • Smart contract development
  • Paymaster integration for gasless minting
  • Image export functionality
  • Social media sharing (Twitter cards)
  • Historical data (2024, 2023)
  • Leaderboards
  • Community challenges

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

MIT License - see LICENSE for details

Acknowledgments

  • Polymarket for the trading platform and API
  • Base for the L2 infrastructure
  • RainbowKit for the beautiful wallet connection UI
  • The Ethereum community for ERC-4337 standards

Support

For issues, questions, or suggestions, please open an issue.


Built with ❀️ for the Polymarket community

πŸš€ Deployment

1. Deploy Smart Contract (One-time, by dev)

The NFT badge contract needs to be deployed once by the app maintainer. All users will then mint from this contract.

Quick Deploy with Remix:

  1. Visit Remix IDE
  2. Copy contracts/PolymarketWrappedBadge.sol
  3. Compile and deploy to Base Mainnet
  4. Copy the deployed contract address

See CONTRACT_DEPLOYMENT.md for detailed instructions.

2. Deploy Frontend

Deploy to Vercel (Recommended):

# Install Vercel CLI
npm i -g vercel

# Deploy
vercel

Environment Variables (set in Vercel dashboard):

  • NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID - From cloud.walletconnect.com
  • NEXT_PUBLIC_BADGE_CONTRACT_ADDRESS - Your deployed contract address
  • POLYMARKET_API_KEY - Optional, for higher rate limits

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages