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
- espn
- gemini
- next.js
- pnpm
- react
- recharts
- shadcn
- solana
- tailwind
- three.js
- typescript
- vercel
- vitest
- yahoo-finance
- youtube-iframe
- zod