Skip to content

Self-serve Create Market wizard: planner → real transactor (hub-e19)#93

Draft
krandder wants to merge 1 commit into
mainfrom
selfserve-wizard
Draft

Self-serve Create Market wizard: planner → real transactor (hub-e19)#93
krandder wants to merge 1 commit into
mainfrom
selfserve-wizard

Conversation

@krandder

Copy link
Copy Markdown
Contributor

Self-serve Create Market wizard: planner → real transactor (hub-e19)

Turns /markets/new from a read-only plan preview into a wallet-connected market
creation wizard, with the ratified self-serve gates baked in. Part of the
futarchy.fi self-serve program (hub-ilc), Tier 1.

What's new

  • Real proposal creationCreateMarketFlow now connects a wallet
    (RainbowKit) and creates the proposal via the existing, proven
    useCreateProposal hook. Simulate-first: a static call against Gnosis shows
    "would succeed — new proposal 0x…" with no broadcast, so the flow is demoable
    end-to-end without minting a market; "Sign & broadcast" sends the real tx.
  • R1 liquidity floor gate (ratified 2026-07-10) — a market goes live only if a
    $100 trade moves price < 3%; below the floor it reads DRAFT. Computed from
    pool math (src/features/marketCreation/liquidityFloor.js). With a pinhead seed
    the gate correctly says DRAFT — "a wizard that mints dead markets would be worse
    than no wizard."
  • Metadata validator (validateMetadata.js) — catches the exact bugs that
    shipped to production: TWAP invert flags disagreeing with on-chain token0
    (the ~22,000× price-display incident), missing coingecko_ticker (hidden spot
    price), and JSON that won't round-trip (the escape-stripping incident). Plus a
    read-modify-write helper so updateExtendedMetadata never drops keys.
  • R3 zero-trade honesty — the UI states that a window ending with no trades
    resolves by the default rule, not as a market verdict.
  • 0xAlex TWAP defaults — TWAP live from proposal start, 5-day (120h) window,
    48h msig buffer before vote close.
  • Static-export fix (was PR [codex] Fix create market static export #81)/markets/new was an empty shell in
    production because the dynamic(ssr:false) chunk 404'd under output:'export'.
    Now a static import + a mounted-guard on the wallet panel, so the page renders
    in SSG and the wallet-connected parts hydrate client-side.

Tests

node --test test/marketCreation.test.mjs — 9/9: wrong invert flag caught + auto
corrected, missing ticker caught, invert deferred pre-pools, read-modify-write
preserves keys / refuses unparseable input, deep pool LIVE vs thin pool DRAFT,
zero liquidity → DRAFT.

Not in this PR (staged, shown as the plan below the wizard)

FLM bundle deploy + bootstrap, Snapshot link, and arb activation remain the
described plan steps. The FLM factory is deployed on Gnosis (0x1814aDfE…) but is
pre-audit (one medium open, hub-rslu), so wiring its bootstrap into a one-click
flow waits on that fix. Arb activation = writing arbitrageContractAddress
(shared GNO/sDAI 0xaC59…) into metadata, picked up automatically by the arb
autopilot.

…dator (hub-e19)

- Wallet-connected createProposal (simulate-first) via existing useCreateProposal
- R1 liquidity floor gate ($100 trade <3% else DRAFT); R3 zero-trade honesty
- validateMetadata: invert-flag vs token0, ticker, JSON round-trip, read-modify-write
- 0xAlex TWAP defaults (live-from-start, 120h window, 48h msig buffer)
- Static-export fix (was PR #81): /markets/new rendered empty shell in prod
- 9/9 node:test units
@netlify

netlify Bot commented Jul 16, 2026

Copy link
Copy Markdown

Deploy Preview for futarchy ready!

Name Link
🔨 Latest commit 909cdd4
🔍 Latest deploy log https://app.netlify.com/projects/futarchy/deploys/6a590a8cbd9e9d000814e984
😎 Deploy Preview https://deploy-preview-93--futarchy.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant