← 返回 Skills 市场
proxima424

permissionless prediction markets

作者 proxima424 · GitHub ↗ · v1.0.0
cross-platform ⚠ suspicious
2523
总下载
1
收藏
1
当前安装
1
版本数
在 OpenClaw 中安装
/install create-prediction-markets
功能描述
Create, 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.
使用说明 (SKILL.md)

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=\x3Cwallet_private_key>    # Required
export RPC_URL=\x3Cbase_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 \x3CUSDC|WETH|address>, --decimals \x3Cn>

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:

Token Address Decimals
USDC 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 6
WETH 0x4200000000000000000000000000000000000006 18
cbETH 0x2Ae3F1Ec7F1F5012CFEab0185bfc7aa3cf0DEc22 18

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

  1. First interaction requires approval: When you create a market or trade for the first time with a token, an approval transaction is sent
  2. Infinite approvals: The SDK uses type(uint256).max approvals (standard EVM pattern) so you only approve once per token
  3. 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

Contract Address
PNP Factory 0x5E5abF8a083a8E0c2fBf5193E711A61B1797e15A
Fee Manager 0x6f1BffB36aC53671C9a409A0118cA6fee2b2b462

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.

Troubleshooting

"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

安全使用建议
Before installing or running this skill: (1) treat the PRIVATE_KEY requirement as sensitive — prefer a dedicated signing key with only the funds you are willing to risk, or use a remote signing provider/hardware wallet if possible; do not paste your primary hot wallet key into environments you don't control. (2) The SKILL.md and scripts recommend 'infinite' ERC20 approvals (type(uint256).max) — this is common but increases risk if the PNP contracts or token approvals are ever abused; consider using limited approvals if you want tighter control. (3) The published metadata omitted the PRIVATE_KEY requirement — assume the scripts will need it. (4) Verify the contract addresses (PNP Factory, Fee Manager, token addresses) on BaseScan and confirm they match upstream project sources before transacting. (5) Review the pnp-evm npm package source (and package-lock) yourself or run in a sandbox with minimal funds; running via npx/ts-node will fetch code from npm at runtime. (6) Prefer a small test transaction first to confirm behavior and outcomes are as expected.
功能分析
Type: OpenClaw Skill Name: create-prediction-markets Version: 1.0.0 The skill bundle provides CLI tools and SDK documentation for interacting with a prediction market dApp on the Base blockchain. It requires a `PRIVATE_KEY` environment variable for signing blockchain transactions, which is standard for dApps, but there is no evidence of this key being exfiltrated or misused. All operations described in the `SKILL.md` and implemented in the TypeScript scripts (`scripts/*.ts`) are legitimate blockchain interactions (create, trade, settle, redeem markets). The markdown instructions are purely functional and do not contain any prompt injection attempts or instructions for malicious behavior. Dependencies listed in `scripts/package.json` are standard for EVM development.
能力评估
Purpose & Capability
The name/description (create/trade/settle prediction markets on Base) aligns with the included scripts and the pnp-evm SDK. However the registry metadata declares no required environment variables/credentials while SKILL.md and every script clearly require a PRIVATE_KEY (and optionally an RPC_URL). That metadata omission is an inconsistency.
Instruction Scope
SKILL.md and the scripts confine actions to market lifecycle operations (create, trade, settle, redeem) and RPC interactions with Base; they construct a PNPClient using an environment PRIVATE_KEY and call SDK methods. There are no hidden network endpoints or data-exfiltration calls. The instructions do explicitly recommend using type(uint256).max (infinite approvals), which is a normal UX choice for EVM apps but a security trade-off that users should understand.
Install Mechanism
This is effectively instruction-only from installer perspective (no install spec). Code files and a package.json are included; dependencies are standard npm packages (pnp-evm, ethers). There are no downloads from arbitrary URLs or extract operations. Running the scripts will use npx/ts-node and fetch npm packages at runtime (network activity) — expected but worth noting.
Credentials
The scripts require a PRIVATE_KEY env var (and optional RPC_URL). That credential is necessary for signing transactions on behalf of a wallet, so it is proportionate to the skill's purpose; however the registry metadata claimed 'Required env vars: none' which is incorrect. Requiring a raw private key is high-impact: whoever runs these scripts must understand they are giving the code the ability to sign arbitrary transactions with that key. The SKILL.md's encouragement of infinite ERC20 approvals further increases funds-exposure risk.
Persistence & Privilege
The skill does not request permanent/system-wide privileges: always:false, it is user-invocable, and there is no code that modifies other skill configs or system settings. It will only run when invoked and does not install persistent agents.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install create-prediction-markets
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /create-prediction-markets 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
- Initial release of pnp-markets: create, trade, and settle prediction markets on Base Mainnet using any ERC20 token as collateral. - Includes CLI scripts for market creation, trading, settlement, and redemption with comprehensive help and usage examples. - Full programmatic usage documented via TypeScript SDK for integration into apps and bots. - Infinite ERC20 approval model adopted for seamless user experience and gas efficiency. - Supports any ERC20 token; popular Base tokens USDC, WETH, and cbETH provided as examples. - Extensive troubleshooting and references included for onboarding, integration, and best practices.
元数据
Slug create-prediction-markets
版本 1.0.0
许可证
累计安装 1
当前安装数 1
历史版本数 1
常见问题

permissionless prediction markets 是什么?

Create, 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. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 2523 次。

如何安装 permissionless prediction markets?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install create-prediction-markets」即可一键安装,无需额外配置。

permissionless prediction markets 是免费的吗?

是的,permissionless prediction markets 完全免费(开源免费),可自由下载、安装和使用。

permissionless prediction markets 支持哪些平台?

permissionless prediction markets 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 permissionless prediction markets?

由 proxima424(@proxima424)开发并维护,当前版本 v1.0.0。

💬 留言讨论