Hedger is a Base-native application that enables businesses to hedge real-world operational risks by matching natural-language descriptions of their risk to relevant prediction markets on Polymarket, and executing hedges using USDC on Base.
root/
├── frontend/ # Next.js web UI
├── backend/ # Python FastAPI backend
└── contracts/ # Solidity contracts for Base
cd contracts
npm install
# Create .env file with PRIVATE_KEY and BASE_RPC_URL
npm run compile
npm run deploy:baseSepolia # or deploy:base for mainnetcd backend
pip install -r requirements.txt
# Create .env file with OPENAI_API_KEY
python main.pyThe backend will run on http://localhost:8000
cd frontend
npm install
# Create .env.local file with:
# - NEXT_PUBLIC_API_URL=http://localhost:8000
# - NEXT_PUBLIC_HEDGE_REGISTRY_ADDRESS=<deployed contract address>
# - NEXT_PUBLIC_HEDGE_RECEIPT_NFT_ADDRESS=<deployed contract address>
# - NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID=<your project id>
npm run devThe frontend will run on http://localhost:3000
- Risk Intake: Natural language risk description
- Market Matching: AI-powered matching using embeddings + LLM ranking
- Trade Execution: EIP-712 order signing and Polymarket CLOB integration
- Onchain Recording: Base smart contract records hedges and mints NFT receipts
- Portfolio View: View all your hedges and NFT receipts
- Base: EVM L2 for smart contracts
- Frontend: Next.js, React, RainbowKit, Wagmi, Ethers.js
- Backend: Python, FastAPI, OpenAI (embeddings + GPT-4o-mini)
- Contracts: Solidity, Hardhat, OpenZeppelin
- Trading: Polymarket CLOB API
contracts/: Solidity smart contracts (HedgeRegistry, HedgeReceiptNFT)backend/: FastAPI server with matching engine and Polymarket integrationfrontend/: Next.js web application with wallet integration
See .env.example files in each directory for required configuration.
MIT