{
  "schemaVersion": "1.0",
  "item": {
    "slug": "create-prediction-markets",
    "name": "permissionless prediction markets",
    "source": "tencent",
    "type": "skill",
    "category": "AI 智能",
    "sourceUrl": "https://clawhub.ai/proxima424/create-prediction-markets",
    "canonicalUrl": "https://clawhub.ai/proxima424/create-prediction-markets",
    "targetPlatform": "OpenClaw"
  },
  "install": {
    "downloadMode": "redirect",
    "downloadUrl": "/downloads/create-prediction-markets",
    "sourceDownloadUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=create-prediction-markets",
    "sourcePlatform": "tencent",
    "targetPlatform": "OpenClaw",
    "installMethod": "Manual import",
    "extraction": "Extract archive",
    "prerequisites": [
      "OpenClaw"
    ],
    "packageFormat": "ZIP package",
    "includedAssets": [
      "references/examples.md",
      "references/api-reference.md",
      "references/use-cases.md",
      "scripts/create-market.ts",
      "scripts/package.json",
      "scripts/settle.ts"
    ],
    "primaryDoc": "SKILL.md",
    "quickSetup": [
      "Download the package from Yavira.",
      "Extract the archive and review SKILL.md first.",
      "Import or place the package into your OpenClaw setup."
    ],
    "agentAssist": {
      "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
      "steps": [
        "Download the package from Yavira.",
        "Extract it into a folder your agent can access.",
        "Paste one of the prompts below and point your agent at the extracted folder."
      ],
      "prompts": [
        {
          "label": "New install",
          "body": "I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete."
        },
        {
          "label": "Upgrade existing",
          "body": "I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run."
        }
      ]
    },
    "sourceHealth": {
      "source": "tencent",
      "status": "healthy",
      "reason": "direct_download_ok",
      "recommendedAction": "download",
      "checkedAt": "2026-04-30T16:55:25.780Z",
      "expiresAt": "2026-05-07T16:55:25.780Z",
      "httpStatus": 200,
      "finalUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=network",
      "contentType": "application/zip",
      "probeMethod": "head",
      "details": {
        "probeUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=network",
        "contentDisposition": "attachment; filename=\"network-1.0.0.zip\"",
        "redirectLocation": null,
        "bodySnippet": null
      },
      "scope": "source",
      "summary": "Source download looks usable.",
      "detail": "Yavira can redirect you to the upstream package for this source.",
      "primaryActionLabel": "Download for OpenClaw",
      "primaryActionHref": "/downloads/create-prediction-markets"
    },
    "validation": {
      "installChecklist": [
        "Use the Yavira download entry.",
        "Review SKILL.md after the package is downloaded.",
        "Confirm the extracted package contains the expected setup assets."
      ],
      "postInstallChecks": [
        "Confirm the extracted package includes the expected docs or setup files.",
        "Validate the skill or prompts are available in your target agent workspace.",
        "Capture any manual follow-up steps the agent could not complete."
      ]
    },
    "downloadPageUrl": "https://openagent3.xyz/downloads/create-prediction-markets",
    "agentPageUrl": "https://openagent3.xyz/skills/create-prediction-markets/agent",
    "manifestUrl": "https://openagent3.xyz/skills/create-prediction-markets/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/create-prediction-markets/agent.md"
  },
  "agentAssist": {
    "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
    "steps": [
      "Download the package from Yavira.",
      "Extract it into a folder your agent can access.",
      "Paste one of the prompts below and point your agent at the extracted folder."
    ],
    "prompts": [
      {
        "label": "New install",
        "body": "I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete."
      },
      {
        "label": "Upgrade existing",
        "body": "I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run."
      }
    ]
  },
  "documentation": {
    "source": "clawhub",
    "primaryDoc": "SKILL.md",
    "sections": [
      {
        "title": "PNP Markets",
        "body": "Create and manage prediction markets on Base Mainnet with any ERC20 collateral token."
      },
      {
        "title": "Quick Decision",
        "body": "Need prediction markets?\n├─ Create market     → npx ts-node scripts/create-market.ts --help\n├─ Trade (buy/sell)  → npx ts-node scripts/trade.ts --help\n├─ Settle market     → npx ts-node scripts/settle.ts --help\n└─ Redeem winnings   → npx ts-node scripts/redeem.ts --help"
      },
      {
        "title": "Environment",
        "body": "export PRIVATE_KEY=<wallet_private_key>    # Required\nexport RPC_URL=<base_rpc_endpoint>         # Optional (defaults to public RPC)\n\nFor production, use a dedicated RPC (Alchemy, QuickNode) to avoid rate limits."
      },
      {
        "title": "Scripts",
        "body": "Run any script with --help first to see all options."
      },
      {
        "title": "Create Market",
        "body": "npx ts-node scripts/create-market.ts \\\n  --question \"Will ETH reach $10k by Dec 2025?\" \\\n  --duration 168 \\\n  --liquidity 100\n\nOptions: --collateral <USDC|WETH|address>, --decimals <n>"
      },
      {
        "title": "Trade",
        "body": "# Buy YES tokens\nnpx ts-node scripts/trade.ts --buy --condition 0x... --outcome YES --amount 10\n\n# Sell NO tokens  \nnpx ts-node scripts/trade.ts --sell --condition 0x... --outcome NO --amount 5 --decimals 18\n\n# View prices only\nnpx ts-node scripts/trade.ts --info --condition 0x..."
      },
      {
        "title": "Settle",
        "body": "# Settle as YES winner\nnpx ts-node scripts/settle.ts --condition 0x... --outcome YES\n\n# Check status\nnpx ts-node scripts/settle.ts --status --condition 0x..."
      },
      {
        "title": "Redeem",
        "body": "npx ts-node scripts/redeem.ts --condition 0x..."
      },
      {
        "title": "Programmatic Usage",
        "body": "import { PNPClient } from \"pnp-evm\";\nimport { ethers } from \"ethers\";\n\nconst client = new PNPClient({\n  rpcUrl: process.env.RPC_URL || \"https://mainnet.base.org\",\n  privateKey: process.env.PRIVATE_KEY!,\n});\n\n// Create market\nconst { conditionId } = await client.market.createMarket({\n  question: \"Will X happen?\",\n  endTime: Math.floor(Date.now() / 1000) + 86400 * 7,\n  initialLiquidity: ethers.parseUnits(\"100\", 6).toString(),\n});\n\n// Trade\nawait client.trading.buy(conditionId, ethers.parseUnits(\"10\", 6), \"YES\");\n\n// Settle (after endTime)\nconst tokenId = await client.trading.getTokenId(conditionId, \"YES\");\nawait client.market.settleMarket(conditionId, tokenId);\n\n// Redeem\nawait client.redemption.redeem(conditionId);"
      },
      {
        "title": "Collateral Tokens",
        "body": "Use any ERC20. Common Base Mainnet tokens:\n\nTokenAddressDecimalsUSDC0x833589fCD6eDb6E08f4c7C32D4f71b54bdA029136WETH0x420000000000000000000000000000000000000618cbETH0x2Ae3F1Ec7F1F5012CFEab0185bfc7aa3cf0DEc2218\n\nCustom tokens add utility—holders can participate in your markets."
      },
      {
        "title": "ERC20 Approvals",
        "body": "Before interacting with PNP contracts, you must approve them to spend your collateral tokens. This is standard for all EVM dApps."
      },
      {
        "title": "How It Works",
        "body": "First interaction requires approval: When you create a market or trade for the first time with a token, an approval transaction is sent\nInfinite approvals: The SDK uses type(uint256).max approvals (standard EVM pattern) so you only approve once per token\nSubsequent interactions: No approval needed—transactions execute directly"
      },
      {
        "title": "Timing Considerations",
        "body": "The approval transaction must be confirmed on-chain before the main transaction executes. If you see:\n\nERC20: transfer amount exceeds allowance\n\nThis 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."
      },
      {
        "title": "Why Infinite Approvals?",
        "body": "Gas efficiency: Approve once, trade forever without extra transactions\nBetter UX: No repeated approval popups\nIndustry standard: Used by Uniswap, Aave, and most major DeFi protocols\n\nFor maximum security-conscious users, you can manually set specific approval amounts, but this requires an approval transaction before each interaction."
      },
      {
        "title": "Contracts",
        "body": "ContractAddressPNP Factory0x5E5abF8a083a8E0c2fBf5193E711A61B1797e15AFee Manager0x6f1BffB36aC53671C9a409A0118cA6fee2b2b462"
      },
      {
        "title": "Why Prediction Markets?",
        "body": "Information Discovery: Market prices reveal collective probability estimates\nToken Utility: Use your token as collateral to drive engagement\nContests: Run competitions where participants stake on outcomes\nForecasting: Aggregate crowd wisdom for decision-making\n\nThe pAMM virtual liquidity model ensures smooth trading even with minimal initial liquidity."
      },
      {
        "title": "\"ERC20: transfer amount exceeds allowance\"",
        "body": "The approval transaction hasn't been confirmed yet. Wait 5-10 seconds and retry."
      },
      {
        "title": "\"Market doesn't exist\"",
        "body": "The market creation transaction may have failed or is still pending. Verify on BaseScan that your transaction was confirmed successfully."
      },
      {
        "title": "\"over rate limit\" / RPC errors",
        "body": "The public Base RPC has rate limits. Use a dedicated RPC provider:\n\nexport RPC_URL=https://base-mainnet.g.alchemy.com/v2/YOUR_KEY"
      },
      {
        "title": "Transaction stuck or slow",
        "body": "Base Mainnet can occasionally have congestion. Check gas prices and consider increasing if needed."
      },
      {
        "title": "Reference Files",
        "body": "API Reference: See references/api-reference.md for complete SDK documentation\nUse Cases: See references/use-cases.md for detailed use case patterns\nExamples: See references/examples.md for complete code examples"
      }
    ],
    "body": "PNP Markets\n\nCreate and manage prediction markets on Base Mainnet with any ERC20 collateral token.\n\nQuick Decision\nNeed prediction markets?\n├─ Create market     → npx ts-node scripts/create-market.ts --help\n├─ Trade (buy/sell)  → npx ts-node scripts/trade.ts --help\n├─ Settle market     → npx ts-node scripts/settle.ts --help\n└─ Redeem winnings   → npx ts-node scripts/redeem.ts --help\n\nEnvironment\nexport PRIVATE_KEY=<wallet_private_key>    # Required\nexport RPC_URL=<base_rpc_endpoint>         # Optional (defaults to public RPC)\n\n\nFor production, use a dedicated RPC (Alchemy, QuickNode) to avoid rate limits.\n\nScripts\n\nRun any script with --help first to see all options.\n\nCreate Market\nnpx ts-node scripts/create-market.ts \\\n  --question \"Will ETH reach $10k by Dec 2025?\" \\\n  --duration 168 \\\n  --liquidity 100\n\n\nOptions: --collateral <USDC|WETH|address>, --decimals <n>\n\nTrade\n# Buy YES tokens\nnpx ts-node scripts/trade.ts --buy --condition 0x... --outcome YES --amount 10\n\n# Sell NO tokens  \nnpx ts-node scripts/trade.ts --sell --condition 0x... --outcome NO --amount 5 --decimals 18\n\n# View prices only\nnpx ts-node scripts/trade.ts --info --condition 0x...\n\nSettle\n# Settle as YES winner\nnpx ts-node scripts/settle.ts --condition 0x... --outcome YES\n\n# Check status\nnpx ts-node scripts/settle.ts --status --condition 0x...\n\nRedeem\nnpx ts-node scripts/redeem.ts --condition 0x...\n\nProgrammatic Usage\nimport { PNPClient } from \"pnp-evm\";\nimport { ethers } from \"ethers\";\n\nconst client = new PNPClient({\n  rpcUrl: process.env.RPC_URL || \"https://mainnet.base.org\",\n  privateKey: process.env.PRIVATE_KEY!,\n});\n\n// Create market\nconst { conditionId } = await client.market.createMarket({\n  question: \"Will X happen?\",\n  endTime: Math.floor(Date.now() / 1000) + 86400 * 7,\n  initialLiquidity: ethers.parseUnits(\"100\", 6).toString(),\n});\n\n// Trade\nawait client.trading.buy(conditionId, ethers.parseUnits(\"10\", 6), \"YES\");\n\n// Settle (after endTime)\nconst tokenId = await client.trading.getTokenId(conditionId, \"YES\");\nawait client.market.settleMarket(conditionId, tokenId);\n\n// Redeem\nawait client.redemption.redeem(conditionId);\n\nCollateral Tokens\n\nUse any ERC20. Common Base Mainnet tokens:\n\nToken\tAddress\tDecimals\nUSDC\t0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913\t6\nWETH\t0x4200000000000000000000000000000000000006\t18\ncbETH\t0x2Ae3F1Ec7F1F5012CFEab0185bfc7aa3cf0DEc22\t18\n\nCustom tokens add utility—holders can participate in your markets.\n\nERC20 Approvals\n\nBefore interacting with PNP contracts, you must approve them to spend your collateral tokens. This is standard for all EVM dApps.\n\nHow It Works\nFirst interaction requires approval: When you create a market or trade for the first time with a token, an approval transaction is sent\nInfinite approvals: The SDK uses type(uint256).max approvals (standard EVM pattern) so you only approve once per token\nSubsequent interactions: No approval needed—transactions execute directly\nTiming Considerations\n\nThe approval transaction must be confirmed on-chain before the main transaction executes. If you see:\n\nERC20: transfer amount exceeds allowance\n\n\nThis 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.\n\nWhy Infinite Approvals?\nGas efficiency: Approve once, trade forever without extra transactions\nBetter UX: No repeated approval popups\nIndustry standard: Used by Uniswap, Aave, and most major DeFi protocols\n\nFor maximum security-conscious users, you can manually set specific approval amounts, but this requires an approval transaction before each interaction.\n\nContracts\nContract\tAddress\nPNP Factory\t0x5E5abF8a083a8E0c2fBf5193E711A61B1797e15A\nFee Manager\t0x6f1BffB36aC53671C9a409A0118cA6fee2b2b462\nWhy Prediction Markets?\nInformation Discovery: Market prices reveal collective probability estimates\nToken Utility: Use your token as collateral to drive engagement\nContests: Run competitions where participants stake on outcomes\nForecasting: Aggregate crowd wisdom for decision-making\n\nThe pAMM virtual liquidity model ensures smooth trading even with minimal initial liquidity.\n\nTroubleshooting\n\"ERC20: transfer amount exceeds allowance\"\n\nThe approval transaction hasn't been confirmed yet. Wait 5-10 seconds and retry.\n\n\"Market doesn't exist\"\n\nThe market creation transaction may have failed or is still pending. Verify on BaseScan that your transaction was confirmed successfully.\n\n\"over rate limit\" / RPC errors\n\nThe public Base RPC has rate limits. Use a dedicated RPC provider:\n\nexport RPC_URL=https://base-mainnet.g.alchemy.com/v2/YOUR_KEY\n\nTransaction stuck or slow\n\nBase Mainnet can occasionally have congestion. Check gas prices and consider increasing if needed.\n\nReference Files\nAPI Reference: See references/api-reference.md for complete SDK documentation\nUse Cases: See references/use-cases.md for detailed use case patterns\nExamples: See references/examples.md for complete code examples"
  },
  "trust": {
    "sourceLabel": "tencent",
    "provenanceUrl": "https://clawhub.ai/proxima424/create-prediction-markets",
    "publisherUrl": "https://clawhub.ai/proxima424/create-prediction-markets",
    "owner": "proxima424",
    "version": "1.0.0",
    "license": null,
    "verificationStatus": "Indexed source record"
  },
  "links": {
    "detailUrl": "https://openagent3.xyz/skills/create-prediction-markets",
    "downloadUrl": "https://openagent3.xyz/downloads/create-prediction-markets",
    "agentUrl": "https://openagent3.xyz/skills/create-prediction-markets/agent",
    "manifestUrl": "https://openagent3.xyz/skills/create-prediction-markets/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/create-prediction-markets/agent.md"
  }
}