# Send permissionless prediction markets to your agent
Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.
## Fast path
- 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.
## Suggested prompts
### New install

```text
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.
```
### Upgrade existing

```text
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.
```
## Machine-readable fields
```json
{
  "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": {
    "downloadUrl": "/downloads/create-prediction-markets",
    "sourceDownloadUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=create-prediction-markets",
    "sourcePlatform": "tencent",
    "targetPlatform": "OpenClaw",
    "packageFormat": "ZIP package",
    "primaryDoc": "SKILL.md",
    "includedAssets": [
      "references/examples.md",
      "references/api-reference.md",
      "references/use-cases.md",
      "scripts/create-market.ts",
      "scripts/package.json",
      "scripts/settle.ts"
    ],
    "downloadMode": "redirect",
    "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."
      ]
    }
  },
  "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"
  }
}
```
## Documentation

### PNP Markets

Create and manage prediction markets on Base Mainnet with any ERC20 collateral token.

### Quick Decision

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

### Environment

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.

### Scripts

Run any script with --help first to see all options.

### Create Market

npx ts-node scripts/create-market.ts \\
  --question "Will ETH reach $10k by Dec 2025?" \\
  --duration 168 \\
  --liquidity 100

Options: --collateral <USDC|WETH|address>, --decimals <n>

### Trade

# 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

# 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...

### Redeem

npx ts-node scripts/redeem.ts --condition 0x...

### Programmatic Usage

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);

### Collateral Tokens

Use any ERC20. Common Base Mainnet tokens:

TokenAddressDecimalsUSDC0x833589fCD6eDb6E08f4c7C32D4f71b54bdA029136WETH0x420000000000000000000000000000000000000618cbETH0x2Ae3F1Ec7F1F5012CFEab0185bfc7aa3cf0DEc2218

Custom tokens add utility—holders can participate in your markets.

### ERC20 Approvals

Before interacting with PNP contracts, you must approve them to spend your collateral tokens. This is standard for all EVM dApps.

### How It Works

First interaction requires approval: When you create a market or trade for the first time with a token, an approval transaction is sent
Infinite approvals: The SDK uses type(uint256).max approvals (standard EVM pattern) so you only approve once per token
Subsequent interactions: No approval needed—transactions execute directly

### Timing Considerations

The 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.

### Why Infinite Approvals?

Gas efficiency: Approve once, trade forever without extra transactions
Better UX: No repeated approval popups
Industry standard: Used by Uniswap, Aave, and most major DeFi protocols

For maximum security-conscious users, you can manually set specific approval amounts, but this requires an approval transaction before each interaction.

### Contracts

ContractAddressPNP Factory0x5E5abF8a083a8E0c2fBf5193E711A61B1797e15AFee Manager0x6f1BffB36aC53671C9a409A0118cA6fee2b2b462

### Why Prediction Markets?

Information Discovery: Market prices reveal collective probability estimates
Token Utility: Use your token as collateral to drive engagement
Contests: Run competitions where participants stake on outcomes
Forecasting: Aggregate crowd wisdom for decision-making

The pAMM virtual liquidity model ensures smooth trading even with minimal initial liquidity.

### "ERC20: transfer amount exceeds allowance"

The approval transaction hasn't been confirmed yet. Wait 5-10 seconds and retry.

### "Market doesn't exist"

The market creation transaction may have failed or is still pending. Verify on BaseScan that your transaction was confirmed successfully.

### "over rate limit" / RPC errors

The public Base RPC has rate limits. Use a dedicated RPC provider:

export RPC_URL=https://base-mainnet.g.alchemy.com/v2/YOUR_KEY

### Transaction stuck or slow

Base Mainnet can occasionally have congestion. Check gas prices and consider increasing if needed.

### Reference Files

API Reference: See references/api-reference.md for complete SDK documentation
Use Cases: See references/use-cases.md for detailed use case patterns
Examples: See references/examples.md for complete code examples
## Trust
- Source: tencent
- Verification: Indexed source record
- Publisher: proxima424
- Version: 1.0.0
## Source health
- Status: healthy
- Source download looks usable.
- Yavira can redirect you to the upstream package for this source.
- Health scope: source
- Reason: direct_download_ok
- Checked at: 2026-04-30T16:55:25.780Z
- Expires at: 2026-05-07T16:55:25.780Z
- Recommended action: Download for OpenClaw
## Links
- [Detail page](https://openagent3.xyz/skills/create-prediction-markets)
- [Send to Agent page](https://openagent3.xyz/skills/create-prediction-markets/agent)
- [JSON manifest](https://openagent3.xyz/skills/create-prediction-markets/agent.json)
- [Markdown brief](https://openagent3.xyz/skills/create-prediction-markets/agent.md)
- [Download page](https://openagent3.xyz/downloads/create-prediction-markets)