Inspiration

Most people meet prediction markets as a place to bet, so most people never touch them. But every contract has two sides, and one of them is insurance. A contract that pays when Bitcoin falls is cover for someone holding Bitcoin. A contract that pays when the Texans lose is a consolation for a Texans fan. A contract that pays on a cold day is cover for an ice cream shop. We wanted to build the app that only ever offers that side: you never bet on anything, you just cushion what you already have at stake.

What it does

Cushion is a web app. You tell it what you have riding on something, in plain words, and it finds the Gemini prediction markets that move against you and prices a cushion: one price, one payout, and the market's chance you'll need it.

  • Today: the news market that moved most in a day, what's coming up, and a card for each thing you have at stake.
  • Portfolio: enter your coins and stocks. Cushion works out what each one really moves with, charts it with every level Gemini lists a market at, and lets you drag a line to where your cushion should start paying. You see your loss with and without it.
  • Live games: a second screen for a game, with the broadcast, score, a live field, win chance and a cushion that pays if your team loses. You watch what it's worth after every score and can cash out. A recorded Colts at Texans game runs as if live, in step with its broadcast, so it works any time.
  • Bills: pick your car and how far you drive, or your home and your thermostat. Cushion works out your gas or heating bill and covers a price spike, bought once or re-bought daily on autopilot.
  • Fantasy: your lineup as a roster. Every player with a market starts cushioned on the stat he's drafted for, and you get paid back when he has a quiet game.
  • Small business: pick what you run and where. A food truck gets a cold-day cushion and a fuel cushion; a sports bar gets a home-team-loss cushion.

Prices, order books, odds and settlements are live from Gemini. Fills are simulated with play money, and every cushion is written to Solana devnet as a public receipt, with no wallet needed.

How we built it

  • Next.js 16 and TypeScript for the whole app, with server routes that fetch, validate and cache upstream data, and a React front end on Tailwind and shadcn/ui.
  • Gemini's prediction market API for everything market-related: events and contracts, live order books, price history and settlement results. Every response is parsed with zod at the boundary.
  • A pure pricing engine. A cushion is a list of contract legs. A falling price is covered by a strip of NO contracts down a price ladder, each sized to the gap below it, so the payout steps up as the loss grows. Legs are priced by walking the real order book level by level.
  • Exposure models: a regression of each stock's daily returns on Gemini's markets (Yahoo Finance history), and rough pass-through models for gas and heating bills, all labelled as estimates.
  • Live sports from ESPN's public scoreboard and play-by-play, matched to Gemini's game markets. The replayed game syncs ESPN's timestamped plays and Gemini's real trades to a YouTube broadcast through the IFrame Player API.
  • Solana: each purchase is written to devnet through the Memo program, signed and paid for by an app-held key using @solana/kit.
  • Design: a light theme for daily use and "The Drop" as dark mode. The landing page is a three.js scene where a line through your day falls onto a 3D copula surface that dents and ripples as it catches the fall.
  • Vitest for 390 tests, many run against saved real Gemini and ESPN responses.

Challenges we ran into

  • Thin order books. Many Gemini markets have little depth, so a cushion often can't fill completely. We price against real depth and say so plainly ("Only $40 of the $134 you asked for is on offer") instead of pretending.
  • Turning binary contracts into insurance. A single yes/no contract pays all or nothing. Sizing a strip of contracts down a price ladder so the payout grows with the loss took a lot of careful arithmetic and testing.
  • Mapping real life onto markets. Most stocks have no market of their own, so we regress them on the markets that exist and only use a match that explains enough of the moves. Otherwise the app says the holding can't be cushioned.
  • Slow upstream data. Listing every player prop takes Gemini about 25 seconds, so the app caches those answers at the CDN while keeping buy prices uncached.
  • Making a recorded game feel live: lining up a YouTube broadcast, ESPN's play timestamps and Gemini's trade history so the video's position is the clock.
  • Getting the physics to feel right: the copula's drops have to sink into the surface and be pushed back out by it, without gaining energy on the rebound.

Accomplishments that we're proud of

  • The reframe works: every screen speaks insurance (what it costs, what it pays, the chance you'll need it), and the contracts are a footnote.
  • Everything that is live is real. Quotes, books, odds and settlements come straight from Gemini, and anything estimated or simulated is labelled where it appears.
  • Six very different life situations (portfolio, sports, bills, fantasy, business, news) all run through one engine and one buy flow.
  • On-chain receipts with zero friction: no wallet, no seed phrase and no gas for the user.
  • A landing page people want to watch, and a light and dark mode that are each a deliberate design.
  • 390 passing tests over the engine, the market parsing and the receipts.

What we learned

  • Prediction markets carry far more useful information than "who wins". Reading a strike ladder as a probability curve, or a temperature market as a weather forecast, opens up a lot of consumer products.
  • Honesty is a feature. Showing partial fills, estimates and thin markets made the app more trustworthy, not less.
  • The hard part of a consumer finance app is the language. Most of our iteration went into saying things in plain words.
  • On Solana, the simplest primitive (a memo) was enough to give every purchase a public, verifiable record without asking users to touch crypto.

What's next for Cushion

  • Real orders through Gemini's trading API, behind the same buy flow.
  • A custom Solana program that holds each cushion as an on-chain record and settles it from Gemini's result, instead of a memo receipt.
  • Longer cover, by rolling daily contracts automatically and using month-end ladders.
  • More life events as Gemini lists more markets: rain, flight delays, mortgage rates.
  • Accounts, so a profile and its cushions follow you across devices.

Built With

Share this project:

Updates

posted an update —

Apologies, the second form kept reloading the page for an unknown reason, here is the contents that went there in case it did not actually go through.

Second form

Title and team members

Cushion. Justin Li, Gabriel Ginsberg, Michael Sun.

Main track

Consumer Apps

On-chain award

Best Use of Solana

Bounty submissions

Gemini bounty: Prediction Markets

Project description

Cushion turns prediction markets into everyday protection: tell it what you have riding on tomorrow, and it prices a cushion that pays if things go wrong.

What did you build? A web app with six sections (Today, Portfolio, Live games, Bills, Fantasy, Small business). In each one you say what you have at stake, and Cushion finds the Gemini prediction markets that move against you and prices cover on the live order book: one price, one payout and the market's chance you'll need it. Every purchase is recorded on Solana devnet as a public receipt.

What problem does it solve? People only meet prediction markets as betting, so most never use them. But the same contracts work as insurance for things people already care about: a portfolio, a team, a heating bill, a fantasy lineup, a small business's bad days. Cushion only offers that protective side, in plain language, with no trading jargon.

How does it work? Server routes read Gemini's public prediction market API (events, order books, price history, settlements) and validate it with zod. A pure engine turns each risk into contract legs; for a falling price, a strip of NO contracts down a price ladder, sized so the payout grows with the loss. Legs are priced by walking the real order book, and partial fills are shown as partial. Stocks are mapped to markets by regression on daily returns. When Gemini resolves a contract, the app settles the play-money account. Each purchase is written to Solana devnet through the Memo program, signed and paid for by the app, so users never need a wallet.

What makes it unique? It uses the same markets for the opposite purpose: protection, not speculation. It reads a strike ladder as a payoff curve, so binary contracts behave like an option. It's honest about thin markets and labels every estimate. And the crypto is invisible: on-chain receipts with no wallet, seed phrase or gas for the user.

What would you build next? Real orders through Gemini's trading API, a custom Solana program that holds and settles each cushion on-chain, rolling cover for longer periods, more life events (rain, flight delays, mortgage rates), and accounts that follow you across devices.

Technologies and sponsor tools: Gemini Prediction Markets API, Solana (devnet, Memo program, @solana/kit), Next.js 16, React 19, TypeScript, Tailwind CSS, shadcn/ui, Recharts, three.js, zod, Vitest, Vercel. Also ESPN's public sports API, Yahoo Finance and the YouTube IFrame Player API.

Demo video

https://youtu.be/s-oF_ua1ob0

GitHub repo link

https://github.com/justinli500/cushion

Technical summary

  • Architecture: one Next.js 16 app (App Router, TypeScript) deployed on Vercel. Server routes fetch upstream data, validate it with zod and cache it (in memory, and at the CDN for slow, non-price data). The browser holds each person's profile and play-money account.
  • Market data: Gemini's public prediction market endpoints, with no API key: GET /v1/prediction-markets/events (markets, contracts, quotes), GET /v1/book/{symbol} (live order book), GET /v2/candles/{symbol}/{timeframe} (price history) and GET /v1/prediction-markets/events/{ticker} (settlement via resolutionSide). It reads price ladders, temperature buckets, game winners, player props and news events.
  • Pricing engine (pure functions, tested): a cushion is a list of legs (contract, side, quantity), each paying $1 per contract on its side. Legs are filled by walking the book level by level (buying NO at p is selling YES at 1 − p into the bids), and the market's chance comes from the bid/ask midpoint, with ladder probabilities forced monotonic.
  • Exposure: stock returns are regressed on each listed market and used only above a fit threshold; bill and heating pass-through are rough models labelled as estimates.
  • Account: an append-only event log in localStorage; balance and positions are derived by replaying it, so a settlement recorded twice pays once.
  • On-chain receipts: POST /api/receipts validates the purchase, builds a JSON memo of at most 500 bytes (contract symbols, sides, quantities, cost, maximum payout, plus a SHA-256 of the full receipt when it has to be trimmed; no personal data), signs one transaction with the app's key, sends it to Solana devnet's Memo program and waits for confirmation. Requests are rate-limited and de-duplicated by receipt ID. Receipts are linked from the Account page to Solana Explorer.
  • Live game replay: ESPN's timestamped play-by-play and Gemini's real trades for one game, synced to a YouTube broadcast.
  • Front end: Tailwind and shadcn/ui, Recharts for charts, three.js (React Three Fiber) for the landing page's copula, with a light and dark theme applied before first paint.
  • Testing: 390 Vitest tests over the engine, parsing, exposure models and receipts, many using saved real Gemini and ESPN responses.

Smart contract / program addresses

Cushion does not deploy its own program. It uses one existing Solana program on devnet:

What Address
SPL Memo program (used; not deployed by us) MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr
Cushion receipt wallet (signer and fee payer for every receipt) 442CDMzrvfKqKkyqSHsLnQgPdzUeuJuYYMWPFQhd4jQm

Receipt history: https://explorer.solana.com/address/442CDMzrvfKqKkyqSHsLnQgPdzUeuJuYYMWPFQhd4jQm?cluster=devnet