Inspiration
Most people don't have just one worry. If you're paid in crypto, you're worried about a crash, and maybe also about rates, fuel, or a bad month, all at once. Prediction markets already price these events, but every multi-leg product on them is a parlay: miss one leg and you get nothing. That's the opposite of what a hedge should do. We wanted one product that takes all your worries and pays you for each one that actually happens.
What it does
Weave weaves your worries into one hedge. You type what you're worried about, and an AI builder picks live Gemini prediction markets and weights them by your exposure. You get one basket token instead of a stack of separate positions.
The payout is per leg, not all-or-nothing. In our live Crash Cover basket, 70% of the payout is on "BTC falls below $X by the top of the hour" and 30% on "ETH falls below $Y". If only BTC falls, each token pays $0.70; if both fall, it pays $1.00.
You choose how much you want covered, like "cover $500", and buy with USDC on Arc. When Gemini resolves each market, the result is posted onchain with Gemini's resolution as evidence, and you redeem whatever hit. Every token is backed by $1.00 of USDC in the contract, and the app shows the vault's solvency live.
When nothing fits, the builder says so: "my dog gets sick" returns no good match instead of a weak hedge.
How we value a basket (the math)
A basket has n legs. Leg i is a Gemini market event Eᵢ, held on the side that protects you, with a weight wᵢ. The weights are positive and sum to 1:
$$\sum_{i=1}^{n} w_i = 1, \qquad w_i > 0$$
One token pays the weights of the legs that happen, so its payout is between $0 and $1:
$$X = \sum_{i=1}^{n} w_i \,\mathbf{1}{E_i}, \qquad 0 \le X \le 1$$
Fair value. By linearity of expectation, the token's value is the weighted sum of the leg probabilities pᵢ, whatever the correlation between the legs:
$$\mathbb{E}[X] = \sum_{i=1}^{n} w_i \,\Pr(E_i) = \sum_{i=1}^{n} w_i \, p_i$$
So no joint-probability model is needed. Every pᵢ comes straight from Gemini's live order book.
Mint price. We charge the weighted ask aᵢ plus a 2% fee. A NO leg's ask comes from the YES bid:
$$P = 1.02 \sum_{i=1}^{n} w_i \, a_i, \qquad a_i^{\text{NO}} = 1 - b_i^{\text{YES}}$$
Example: with a BTC-NO ask of 0.30 and an ETH-NO ask of 0.06:
$$P = 1.02\,(0.7 \times 0.30 + 0.3 \times 0.06) \approx 0.233$$
That is about $0.233 per token, so covering $500 means 500 tokens for about $116.
Why not a parlay? A parlay pays only if every leg hits, so its fair price is the joint probability of all the legs, which depends on how they are correlated. Market prices alone only pin it between the Fréchet bounds:
$$\max\left(0,\ \sum_{i} p_i - (n-1)\right) \;\le\; \Pr\left(\bigcap_{i} E_i\right) \;\le\; \min_i p_i$$
A per-leg basket has no such gap: its price is exact.
Exact hedge. Because the payout is linear in the legs, N tokens are replicated exactly by buying wᵢ·N contracts of each leg. The two payoffs match in every outcome:
$$N \cdot X = \sum_{i=1}^{n} (w_i N)\,\mathbf{1}{E_i}$$
We place these hedge orders on the Gemini sandbox.
Solvency. A mint of m tokens is refused unless the vault can still pay the maximum payout on every token. Here R is the reserve, S the token supply and c the mint cost:
$$R + c \;\ge\; (S + m) \times 1\ \text{USDC}$$
The app shows the live coverage ratio, reserve ÷ supply.
How we built it
- Contract: WeaveBasket, an ERC-1155 USDC vault in Solidity (Hardhat 3), deployed and source-verified on Arc testnet at
0xdab8e6446ea0819af35ed9ddf7fbc9a74d79e781. It has full collateral, a 4-minute price staleness check, a buyer max-cost slippage guard, and one-shot resolution per leg. It has 12 tests, including a fuzz test that the vault is always solvent. - Operator: a Node service. It opens a new Crash Cover basket every hour from Gemini's hourly BTC/ETH strike ladders (strikes just below the current price) and posts prices every 15 seconds. It posts each leg's result with Gemini's
resolutionSideandresolvedAtas evidence, sweeps spare collateral from settled baskets, and mirrors each mint on the Gemini sandbox. - AI builder: an LLM (gpt-oss-120b on Groq) picks legs and weights from the live Gemini market list. Its output is validated: only real market IDs, weights that sum to 1, and an honest "none" when nothing fits. It gets one retry with the errors listed, and deterministic rules are the fallback.
- Frontend: Next.js 16, React 19, Tailwind 4 and viem. It shows live Gemini books, charts sampled from live data (never simulated history), and runs buy, redeem and send directly on the contract through MetaMask.
Gemini Prediction Markets integration
Gemini is the source of truth for every price and every result in Weave, and the place the operator hedges. Production data drives the product; the sandbox is used only for orders, so no real money moves.
Endpoints we use
GET /v1/prediction-markets/events?status=active&category=crypto(production): finds the nearest hourly BTC and ETH "price today at" ladder events with more than 5 minutes left, to open each hour's Crash Cover basket.GET /v1/prediction-markets/events/{ticker}(production): livebestBid/bestAskfor every leg, cached 15 s on our server and polled by the app.contracts[].resolutionSideandresolvedAt(production): settlement. The operator posts each leg's result onchain with these fields as the evidence string.GET /v1/prediction-markets/events/{ticker}(sandbox): finds the same contract on the sandbox ladder, or the nearest strike when the ladders differ.POST /v1/prediction-markets/order(sandbox, HMAC-SHA384 signed): mirrors each mint by buying wᵢ·N NO contracts per leg as limit, immediate-or-cancel orders, and logs every fill and order id.
How it maps to the product
- Strike choice: for each asset we pick the "$X or above" contract whose YES mid is closest to 0.75 among contracts with both a bid and an ask, so NO costs about a quarter and pays only on a real drop.
- Pricing: the mint price comes straight from Gemini's book. A leg with no ask is never priced at mid; it can't be bought. Gemini has no price-history endpoint, so every chart is built from live data, never simulated.
- AI builder: works over a catalog of real Gemini markets across crypto, economy, rates and energy, each shown with its exact Gemini title, contract, side and live ask. It can only pick ids from that list.
- Resolution: a leg settles only after Gemini sets
resolutionSide. Each result is accepted onchain exactly once with Gemini's evidence stored, so anyone can check a payout against Gemini. - Hedging: a failed sandbox fill is recorded as unhedged and never blocks a mint; the onchain reserve still covers every payout.
- Why it's good for Gemini: every leg is a Gemini instrument symbol, so each basket sold is order flow into Gemini's books, in a product Gemini doesn't offer today: a per-leg basket instead of an all-or-nothing combo.
Full endpoint table with code links: see the "Gemini Prediction Markets integration" section of our GitHub README.
Challenges we ran into
- Gemini's markets live offchain, so we designed the bridge: an operator posts prices and results, the contract refuses mints when the posted price is stale, and each result is posted once, with evidence.
- Gemini lists only the current hour's crypto markets, so Crash Cover rolls into a new token every hour, with strikes picked live.
- Arc's RPC only serves logs within a 10,000-block window, so we scan history in bounded windows.
- Arc uses USDC as gas. Native balances have 18 decimals while the ERC-20 view has 6, which is easy to get wrong.
- Pricing a combo needs joint probabilities. We avoided that on purpose: the per-leg payout makes the price a plain weighted sum.
Accomplishments that we're proud of
- A working end-to-end loop on Arc testnet against real Gemini markets: live prices in, a USDC buy, onchain resolution from Gemini's own result, and a redeem. It has already settled real hourly baskets.
- A payout shape no prediction market sells today: per leg, not all-or-nothing.
- An AI builder that tells you when your worry has no good hedge.
- Full collateral that anyone can verify, with a live solvency gauge.
What we learned
- Expectation is linear, which is why a per-leg basket is easy to price and to hedge exactly, and a parlay is neither.
- Bridging an offchain market to a chain is mostly about failing safely: stale prices, late results, and operator downtime.
- Arc fits this well: USDC as both gas and collateral keeps the money flow simple.
What's next for Weave
- Selling back to the vault before expiry
- Signed price quotes in place of posted prices
- Lending against basket tokens, since they're standard ERC-1155s
- Live hedging through a registered Gemini partner
Built With
- arc
- gemini-api
- groq
- hardhat
- metamask
- next.js
- react
- solidity
- tailwindcss
- typescript
- viem

