An automated prediction market trading vault built on Base. Deposits USDC, trades on Polymarket, returns profits to shareholders.
┌─────────────────────────────────────────────────────────────────┐
│ SYSTEM OVERVIEW │
├─────────────────────────────────────────────────────────────────┤
│ │
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │
│ │ User │ │ Vault │ │ Polymarket │ │
│ │ (Base) │──────▶│ (Base) │──────▶│ (Polygon) │ │
│ │ │ │ │ │ │ │
│ │ Deposit │ │ pSNIPER │ │ Trading │ │
│ │ USDC │ │ Shares │ │ Execution │ │
│ └──────────────┘ └──────────────┘ └──────────────┘ │
│ │
│ Components: │
│ • Smart Contract - ERC4626 vault with NAV oracle │
│ • NAV Bot - Calculates real-time asset values │
│ • Withdrawal Servicer - Processes withdrawal requests │
│ • Trading Bot - Executes market sniping strategy │
│ • Order Monitor - Tracks fills and profit taking │
│ │
└─────────────────────────────────────────────────────────────────┘
| Contract | Network | Address |
|---|---|---|
| pSNIPER Vault | Base Mainnet | 0x960eC492C1c9245dAe05bA4027d6e15ce0AD9d3D |
- NAV-based pricing - Fair value calculated from real orderbook depth
- Locked withdrawals - Price fixed when you request, no slippage
- 3-state asset tracking - In-flight, pending, credited funds all counted
- Conservative valuation - Illiquid positions valued at $0
├── bot/ # NAV oracle
│ └── nav_oracle.py # Price calculation and signing
├── trading_bot/ # Polymarket trading workers
│ ├── withdrawal_servicer.py # Withdrawal processing
│ ├── auto_trader.py # Order placement
│ ├── order_monitor.py # Fill tracking
│ ├── market_monitor.py # Market discovery
│ └── polymarket_trader.py # Core trading logic
└── src/mastra/ # Workflow orchestration
├── workflows/ # Scheduled market monitoring
├── tools/ # Telegram, Twitter, market fetching
└── agents/ # AI agent for market analysis
- Node.js 20+
- Python 3.11+
- PostgreSQL database
- Polymarket API credentials
# Install Node dependencies
npm install
# Install Python dependencies
pip install -r trading_bot/requirements.txtCopy .env.example to .env and fill in your credentials:
cp .env.example .envRequired environment variables:
DATABASE_URL- PostgreSQL connection stringPOLYMARKET_PRIVATE_KEY- Trading wallet private keyPOLYMARKET_PROXY_ADDRESS- Polymarket proxy walletTELEGRAM_BOT_TOKEN- For notifications
cd bot
python nav_oracle.pyRuns on port 8080. Provides endpoints:
/health- Health check/price- Current share price/sign-nav- Signed NAV data for contract
cd trading_bot
python withdrawal_servicer.pyMonitors pending withdrawals and processes them automatically.
cd trading_bot
python auto_trader.pyPlaces orders on new markets based on configured strategy.
cd trading_bot
python order_monitor.pyTracks order fills and places profit-taking sells.
MIT