From 72377d2c473591c93fd3e015e08703c8e79fa045 Mon Sep 17 00:00:00 2001 From: Yashovardhan Agrawal <21066442+yashovardhan@users.noreply.github.com> Date: Fri, 29 May 2026 17:40:44 +0530 Subject: [PATCH] Update prediction market workflows --- skills/metamask-agent-wallet/SKILL.md | 1 + .../references/predict.md | 2 + .../workflows/predict-trading.md | 44 ++++++++++++++++++- .../workflows/predict-trading.md | 44 ++++++++++++++++++- 4 files changed, 89 insertions(+), 2 deletions(-) diff --git a/skills/metamask-agent-wallet/SKILL.md b/skills/metamask-agent-wallet/SKILL.md index ab5a700..4962fbc 100644 --- a/skills/metamask-agent-wallet/SKILL.md +++ b/skills/metamask-agent-wallet/SKILL.md @@ -77,6 +77,7 @@ Match the user's intent to a command and reference file, then read the reference | View open prediction orders | `mm-dev predict orders` | [predict.md](references/predict.md) | | Check Predict deposit wallet balance | `mm-dev predict balance` | [predict.md](references/predict.md) | | Fund Predict deposit wallet | `mm-dev predict deposit` | [predict.md](references/predict.md) | +| Bridge USDC to Polygon for predict | `mm-dev swap quote` + `mm-dev swap execute`, then `predict deposit` | [predict.md](references/predict.md), [predict-trading.md](workflows/predict-trading.md), [bridge.md](workflows/bridge.md) | | Withdraw pUSD from Predict deposit wallet | `mm-dev predict withdraw` | [predict.md](references/predict.md) | | Fetch prediction order book | `mm-dev predict book` | [predict.md](references/predict.md) | | Watch a Predict job | `mm-dev predict watch` | [predict.md](references/predict.md) | diff --git a/skills/metamask-agent-wallet/references/predict.md b/skills/metamask-agent-wallet/references/predict.md index 2598a81..02fec60 100644 --- a/skills/metamask-agent-wallet/references/predict.md +++ b/skills/metamask-agent-wallet/references/predict.md @@ -2,6 +2,8 @@ Use the `predict` commands to trade on prediction markets (Polymarket via the CLOB). +**Workflow:** [predict-trading.md](../workflows/predict-trading.md) — setup, cross-chain funding, quote, place, and close. + ## `predict mode` Command Choose or display the current Predict trading mode. diff --git a/skills/metamask-agent-wallet/workflows/predict-trading.md b/skills/metamask-agent-wallet/workflows/predict-trading.md index cc77610..a7c4703 100644 --- a/skills/metamask-agent-wallet/workflows/predict-trading.md +++ b/skills/metamask-agent-wallet/workflows/predict-trading.md @@ -2,7 +2,49 @@ Use this workflow when the user wants to set up prediction market trading, fund the deposit wallet, quote/place orders, or manage Predict orders and positions. -Reference command syntax in `../references/predict.md`. +Reference command syntax in `../references/predict.md`. Cross-chain funding: [bridge.md](bridge.md) (§ Fund prediction markets on Polygon). + +## End-to-end flow + +Typical order: + +1. One-time setup (if needed) — `predict setup`, credentials, approvals. +2. Fund — ensure pUSD or USDC.e on Polygon; bridge from other chains when needed. +3. Resolve market and outcome token ID. +4. Quote and place. +5. Manage orders/positions; close or cancel when the user asks to exit. + +Complete **funding before** heavy market search when the user already gave you an amount to trade. + +## Mandatory: Polygon USDC.e before `predict deposit` + +```bash +mm-dev wallet balance --chain 137 --token 0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174 --json +mm-dev wallet balance --chain 137 --token 0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359 --json +``` + +| Token | Polygon contract | Used by `predict deposit`? | +| --- | --- | --- | +| **USDC.e** (bridged) | `0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174` | **Yes** — wrap source for pUSD | +| Native USDC (Circle) | `0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359` | **No** — balance here does not fund deposit | + +Required: USDC.e ≥ `--amount` (pUSD) + ~$1 POL on Polygon for gas. + +If USDC.e is too low: do **not** retry `predict deposit` in a loop — `execution reverted` usually means native USDC only or insufficient USDC.e. + +## Fund from another chain + +Polymarket predict uses Polygon (`137`). If USDC.e on the owner EOA is insufficient but USDC exists elsewhere, bridge before `predict deposit` (see [swap.md](swap.md), [bridge.md](../workflows/bridge.md)): + +```bash +mm-dev wallet balance --chain 8453 --token USDC +mm-dev swap quote --from USDC --to USDC --amount --from-chain 8453 --to-chain 137 +mm-dev swap execute --quote-id +mm-dev wallet balance --chain 137 --token 0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174 +mm-dev predict deposit --amount --wait +``` + +Use the chain ID where the wallet actually holds USDC (`8453` Base, `42161` Arbitrum, `1` Ethereum). Include slippage buffer in the bridge amount. Re-check USDC.e (`0x2791…`), not native USDC (`0x3c499…`), before depositing. ## One-Time Setup diff --git a/skills/metamask-agent-workflows/workflows/predict-trading.md b/skills/metamask-agent-workflows/workflows/predict-trading.md index cc77610..a7c4703 100644 --- a/skills/metamask-agent-workflows/workflows/predict-trading.md +++ b/skills/metamask-agent-workflows/workflows/predict-trading.md @@ -2,7 +2,49 @@ Use this workflow when the user wants to set up prediction market trading, fund the deposit wallet, quote/place orders, or manage Predict orders and positions. -Reference command syntax in `../references/predict.md`. +Reference command syntax in `../references/predict.md`. Cross-chain funding: [bridge.md](bridge.md) (§ Fund prediction markets on Polygon). + +## End-to-end flow + +Typical order: + +1. One-time setup (if needed) — `predict setup`, credentials, approvals. +2. Fund — ensure pUSD or USDC.e on Polygon; bridge from other chains when needed. +3. Resolve market and outcome token ID. +4. Quote and place. +5. Manage orders/positions; close or cancel when the user asks to exit. + +Complete **funding before** heavy market search when the user already gave you an amount to trade. + +## Mandatory: Polygon USDC.e before `predict deposit` + +```bash +mm-dev wallet balance --chain 137 --token 0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174 --json +mm-dev wallet balance --chain 137 --token 0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359 --json +``` + +| Token | Polygon contract | Used by `predict deposit`? | +| --- | --- | --- | +| **USDC.e** (bridged) | `0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174` | **Yes** — wrap source for pUSD | +| Native USDC (Circle) | `0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359` | **No** — balance here does not fund deposit | + +Required: USDC.e ≥ `--amount` (pUSD) + ~$1 POL on Polygon for gas. + +If USDC.e is too low: do **not** retry `predict deposit` in a loop — `execution reverted` usually means native USDC only or insufficient USDC.e. + +## Fund from another chain + +Polymarket predict uses Polygon (`137`). If USDC.e on the owner EOA is insufficient but USDC exists elsewhere, bridge before `predict deposit` (see [swap.md](swap.md), [bridge.md](../workflows/bridge.md)): + +```bash +mm-dev wallet balance --chain 8453 --token USDC +mm-dev swap quote --from USDC --to USDC --amount --from-chain 8453 --to-chain 137 +mm-dev swap execute --quote-id +mm-dev wallet balance --chain 137 --token 0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174 +mm-dev predict deposit --amount --wait +``` + +Use the chain ID where the wallet actually holds USDC (`8453` Base, `42161` Arbitrum, `1` Ethereum). Include slippage buffer in the bridge amount. Re-check USDC.e (`0x2791…`), not native USDC (`0x3c499…`), before depositing. ## One-Time Setup