proxima424

permissionless prediction markets

专业领域v1.0.0
作者:proxima424更新于 2026-05-18create-prediction-markets@clawhub_proxima424/create-prediction-markets
行业研究

据 AlphaMoat 统计,截至 2026-09,permissionless prediction markets 累计下载 3,612 次、获 1 个星标,在全部 5,078 个 AI 技能中排名第 3,010 位,在「专业领域」分类(465 个)中排名第 247 位。

累计安装
236
累计下载
3,612
星标
1
全站排名
#3,010
全站前 60% · 「专业领域」前 54%
平台累计安装累计下载星标评论
ClawHub ↗1173,4501-
SkillHub ↗2363,6121—

各平台的计数口径不同,统计时间不一致。

这个技能是做什么的

该技能在 Base 主网上用任意 ERC20 抵押品创建、交易、结算和赎回预测市场:通过 create-market.ts(问题、时长、流动性、抵押品)、trade.ts(买卖 YES/NO 或查看价格)、settle.ts(结束后结算)、redeem.ts(赎回 winnings)四个脚本操作,需导出 PRIVATE_KEY(RPC_URL 可选);也提供 PNPClient 的 TypeScript 编程接口,USDC/WETH/cbETH 等 Base 常用代币可直接做抵押品。 签名可能转移资金或改变链上状态;签名前应核对网络、资产、金额、滑点和接收地址,并取得用户明确确认。

资料发布于 2026-10-27

可以用来做什么

  • 创建预测市场:设置问题、持续时间、初始流动性与抵押代币
  • 用 trade.ts 买入/卖出 YES 或 NO 代币,或只查价格
  • 市场结束后用 settle.ts 按结果结算
  • 用 redeem.ts 赎回获胜仓位
  • 用 PNPClient 在 TypeScript 中编程化创建、交易、结算、赎回

什么时候用

  • 构建预测市场基础设施、举办竞猜或众包概率估计时
  • 为代币增加实用场景、让持有者参与自定义市场时
  • 需要基于市场的预测(信息金融)工作流时

示例提示词

以下是根据技能文档生成的示例,不代表实际运行结果。

为我查询符合条件的候选人,并总结匹配情况
用 trade.ts 以 10 USDC 买入这个市场的 YES,先看一眼当前价格
这个市场已到期且结果是 YES,帮我结算并赎回

月度数据趋势

累计下载3,612
2,4753,0863,6962026-03 · 累计下载 2,5592026-05 · 累计下载 2,9722026-07 · 累计下载 3,2962026-08 · 累计下载 3,3762026-09 · 累计下载 3,61226-0326-09
星标1
0122026-03 · 星标 12026-05 · 星标 12026-07 · 星标 12026-08 · 星标 12026-09 · 星标 126-0326-09

2026-09 起统计方法调整:同名技能按作者分别统计,并覆盖全部技能。图中虚线为调整前的月份,与之后的数据不直接比较,也不计算跨越调整的增长。

月份累计下载环比星标
2026-093,612—1
2026-083,376+2.4%1
2026-073,296—1
2026-052,972—1
2026-032,559—1

SKILL.md 原文

以下是作者发布的原始文件,按纯文本显示,本站未做修改或审核;其中的链接不可点击,命令请核实后再运行。抓取于 2026-10-23。

5.7 KB · ClawHub v1.0.0
---
name: pnp-markets
description: 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.
---

# PNP Markets

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

## Quick Decision
展开全部(共 180 行)

```
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

```bash
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

```bash
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

```bash
# 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

```bash
# 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

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

## Programmatic Usage

```typescript
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:
```bash
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](references/api-reference.md) for complete SDK documentation
- **Use Cases**: See [references/use-cases.md](references/use-cases.md) for detailed use case patterns
- **Examples**: See [references/examples.md](references/examples.md) for complete code examples

「专业领域」分类下的热门技能

数据月份:2026-09 · 下载/星标/安装数聚合自公开技能注册库(ClawHub、SkillHub),按月更新。口径说明见数据方法。