create-prediction-markets-1-0-0Create, trade, and settle prediction markets on Base with any ERC20 collateral. Use when building prediction market infrastructure, running contests, crowdsourcing probability estimates, adding utility to tokens, or tapping into true information finance via market-based forecasting.
Install via ClawdBot CLI:
clawdbot install tariqsumatri82/create-prediction-markets-1-0-0Create and manage prediction markets on Base Mainnet with any ERC20 collateral token.
Need prediction markets?
โโ Create market โ npx ts-node scripts/create-market.ts --help
โโ Trade (buy/sell) โ npx ts-node scripts/trade.ts --help
โโ Settle market โ npx ts-node scripts/settle.ts --help
โโ Redeem winnings โ npx ts-node scripts/redeem.ts --help
export PRIVATE_KEY=<wallet_private_key> # Required
export RPC_URL=<base_rpc_endpoint> # Optional (defaults to public RPC)
For production, use a dedicated RPC (Alchemy, QuickNode) to avoid rate limits.
Run any script with --help first to see all options.
npx ts-node scripts/create-market.ts \
--question "Will ETH reach $10k by Dec 2025?" \
--duration 168 \
--liquidity 100
Options: --collateral , --decimals
# Buy YES tokens
npx ts-node scripts/trade.ts --buy --condition 0x... --outcome YES --amount 10
# Sell NO tokens
npx ts-node scripts/trade.ts --sell --condition 0x... --outcome NO --amount 5 --decimals 18
# View prices only
npx ts-node scripts/trade.ts --info --condition 0x...
# Settle as YES winner
npx ts-node scripts/settle.ts --condition 0x... --outcome YES
# Check status
npx ts-node scripts/settle.ts --status --condition 0x...
npx ts-node scripts/redeem.ts --condition 0x...
import { PNPClient } from "pnp-evm";
import { ethers } from "ethers";
const client = new PNPClient({
rpcUrl: process.env.RPC_URL || "https://mainnet.base.org",
privateKey: process.env.PRIVATE_KEY!,
});
// Create market
const { conditionId } = await client.market.createMarket({
question: "Will X happen?",
endTime: Math.floor(Date.now() / 1000) + 86400 * 7,
initialLiquidity: ethers.parseUnits("100", 6).toString(),
});
// Trade
await client.trading.buy(conditionId, ethers.parseUnits("10", 6), "YES");
// Settle (after endTime)
const tokenId = await client.trading.getTokenId(conditionId, "YES");
await client.market.settleMarket(conditionId, tokenId);
// Redeem
await client.redemption.redeem(conditionId);
Use any ERC20. Common Base Mainnet tokens:
| Token | Address | Decimals |
|-------|---------|----------|
| USDC | 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 | 6 |
| WETH | 0x4200000000000000000000000000000000000006 | 18 |
| cbETH | 0x2Ae3F1Ec7F1F5012CFEab0185bfc7aa3cf0DEc22 | 18 |
Custom tokens add utilityโholders can participate in your markets.
Before interacting with PNP contracts, you must approve them to spend your collateral tokens. This is standard for all EVM dApps.
type(uint256).max approvals (standard EVM pattern) so you only approve once per tokenThe approval transaction must be confirmed on-chain before the main transaction executes. If you see:
ERC20: transfer amount exceeds allowance
This means the approval hasn't been mined yet. Simply wait a few seconds and retryโthe approval will be confirmed and subsequent attempts will succeed.
For maximum security-conscious users, you can manually set specific approval amounts, but this requires an approval transaction before each interaction.
| Contract | Address |
|----------|---------|
| PNP Factory | 0x5E5abF8a083a8E0c2fBf5193E711A61B1797e15A |
| Fee Manager | 0x6f1BffB36aC53671C9a409A0118cA6fee2b2b462 |
The pAMM virtual liquidity model ensures smooth trading even with minimal initial liquidity.
The approval transaction hasn't been confirmed yet. Wait 5-10 seconds and retry.
The market creation transaction may have failed or is still pending. Verify on BaseScan that your transaction was confirmed successfully.
The public Base RPC has rate limits. Use a dedicated RPC provider:
export RPC_URL=https://base-mainnet.g.alchemy.com/v2/YOUR_KEY
Base Mainnet can occasionally have congestion. Check gas prices and consider increasing if needed.
Generated Mar 1, 2026
Companies can create prediction markets to aggregate employee or public insights on future events like product launch success, sales targets, or market trends. This leverages collective wisdom to inform strategic planning and risk assessment, using internal tokens or stablecoins as collateral to incentivize accurate predictions.
Crypto projects can use their native ERC20 tokens as collateral in prediction markets, allowing token holders to participate in forecasting events related to project milestones or governance outcomes. This adds engagement and utility beyond simple staking, potentially increasing token demand and community involvement.
Organizations can run prediction-based contests where users stake tokens on outcomes like sports results, election results, or entertainment awards. This gamifies engagement, with winners redeeming prizes, and can be monetized through fees or sponsorship deals integrated into the market setup.
Financial firms can deploy prediction markets to crowdsource probability estimates on economic indicators, asset prices, or regulatory changes. This provides a decentralized forecasting tool that complements traditional models, using stablecoins like USDC for collateral to ensure reliability and ease of settlement.
Universities or research groups can create markets to test hypotheses or gather data on public opinion about scientific, social, or political topics. This facilitates experimental economics studies and educational simulations, with low-cost setup using any ERC20 token for collateral in a controlled environment.
Charge users a fee for creating prediction markets on the platform, either as a flat rate or percentage of liquidity. Revenue is generated from transaction fees embedded in the PNP contracts, with potential for scaling as market activity increases and users pay for premium features like custom collateral or advanced analytics.
Offer a software-as-a-service solution where businesses subscribe to use prediction markets for internal decision-making or public engagement. Revenue comes from subscription tiers based on features like API access, custom integrations, and dedicated support, leveraging the SDK for seamless deployment on Base.
Integrate a native token that serves as collateral or governance for prediction markets, with revenue generated from staking rewards, token appreciation, and fees from market activities. This model incentivizes ecosystem growth by rewarding accurate predictors and liquidity providers, driving network effects.
๐ฌ Integration Tip
Set up a dedicated RPC provider like Alchemy to avoid rate limits, and ensure ERC20 approvals are handled with infinite approvals for gas efficiency, retrying if transactions fail due to pending approvals.
Analyze stocks and cryptocurrencies using Yahoo Finance data. Supports portfolio management, watchlists with alerts, dividend analysis, 8-dimension stock scoring, viral trend detection (Hot Scanner), and rumor/early signal detection. Use for stock analysis, portfolio tracking, earnings reactions, crypto monitoring, trending stocks, or finding rumors before they hit mainstream.
Get stock prices, quotes, fundamentals, earnings, options, dividends, and analyst ratings using Yahoo Finance. Uses yfinance library - no API key required.
Yahoo Finance (yfinance) powered stock analysis skill: quotes, fundamentals, ASCII trends, high-resolution charts (RSI/MACD/BB/VWAP/ATR), plus optional web a...
Become an autonomous prediction market trader on Polymarket with AI-powered analysis and a performance-backed token on Base. Trade real markets, build a track record, and let the buyback flywheel run.
Get cryptocurrency token price and generate candlestick charts via CoinGecko API or Hyperliquid API. Use when user asks for token price, crypto price, price chart, or cryptocurrency market data.
Trade and monitor Hyperliquid perpetual futures. Check balances, view positions with P&L, place/cancel orders, execute market trades. Use when the user asks about Hyperliquid trading, portfolio status, crypto positions, or wants to execute trades on Hyperliquid.