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で、AIスキル全体5,078件中3,010位、専門分野では465件中247位です。

インストール数
236
ダウンロード数
3612
スター数
1
総合順位
#3,010
全体の上位 60% · 専門分野の上位 54%
プラットフォームインストール数ダウンロード数スター数コメント
ClawHub ↗11734501-
SkillHub ↗23636121—

プラットフォームごとに集計方法と集計時点が異なります。

このスキルでできること

このスキルは、Baseメインネット上で任意のERC20を担保に予測マーケットを作成・取引・決済・償還します。スクリプトはcreate-market.ts(質問・期間・流動性・担保)、trade.ts(YES/NOの売買、価格表示)、settle.ts(終了後の決済)、redeem.ts(償還)をカバーし、PRIVATE_KEYが必須でRPC_URLは任意。TypeScriptのPNPClient APIも提供され、USDC/WETH/cbETHなどBaseの主要トークンをそのまま担保に使えます。 署名により資金移動やオンチェーン状態の変更が発生する場合があります。署名前にネットワーク、資産、金額、スリッページ、送付先を確認し、ユーザーの明示的な承認を得てください。

資料公開日 2026-10-27

できること

  • 質問・期間・初期流動性・担保トークンを指定してマーケットを作成
  • trade.tsでYES/NOトークンを売買、または価格のみ表示
  • 終了後にsettle.tsでマーケットを決済
  • redeem.tsで勝ちポジションを償還
  • PNPClientでTypeScriptから作成・取引・決済・償還をプログラム的に実行

使う場面

  • 予測マーケット基盤の構築、コンテスト、確率推定のクラウドソーシングのとき
  • トークンにユーティリティを持たせ、ホルダーをマーケットに参加させたいとき
  • マーケットベースのフォーキャスト(情報金融)ワークフローが必要なとき

プロンプト例

スキルのドキュメントをもとに生成した例であり、実際の実行結果ではありません。

条件に合う候補者を探し、適合度を要約して
trade.tsでこのマーケットのYESを10 USDCで買って。まず現在価格を見せて
このマーケットはYESで終了した — 決済して償還して

月次の推移

ダウンロード数3612
2475308636962026-03 · ダウンロード数 25592026-05 · ダウンロード数 29722026-07 · ダウンロード数 32962026-08 · ダウンロード数 33762026-09 · ダウンロード数 361226-0326-09
スター数1
0122026-03 · スター数 12026-05 · スター数 12026-07 · スター数 12026-08 · スター数 12026-09 · スター数 126-0326-09

2026-09 から集計方法を変更し、同名スキルを作者ごとに分けて集計し、全スキルを対象にしました。破線は変更前の月で、変更後のデータとは直接比較せず、変更をまたぐ増減も計算していません。

月ダウンロード数前月比スター数
2026-093612—1
2026-083376+2.4%1
2026-073296—1
2026-052972—1
2026-032559—1

SKILL.md 原文

作者が公開した元のファイルをテキストのまま表示しています。AlphaMoat による編集や審査はしていません。リンクはクリックできません。コマンドは内容を確認してから実行してください。取得日 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)から月単位で集計しています。詳しくはデータの方法論をご覧ください。