awning

Saturday, Texas plays Arkansas. If Texas loses, the bar by the stadium empties early and is out $3,000. Ask an insurer to cover that day and the answer is no.

Awning says yes: $3,000 of cover for $287.20, priced live on the Gemini prediction market for the game, at the market's 9% odds.

Awning is cover for the bad days no insurance covers: a cold snap, a heat wave, fuel going up, the home team losing. Say the day in a sentence. An AI agent buys the cover inside spending limits that a contract on Arc enforces, and a pool contract locks your whole payout before you pay a cent. When the day comes there is nothing to file: the money lands in your vault by itself.

Say it → See the price → Get paid.

What makes it different: the agent's limits live in a contract, not a prompt. Hand a thief the agent's real key and the most they can take is the day's $2 data budget.

Try it: Open awning · Code: github.com/kushwahaamar-dev/awning

Tracks: Agentic Payments and AI · Best use of Arc · Gemini Prediction Markets · ElevenLabs · QuickNode Streams

Inspiration

A barbecue patio sits empty when a cold front comes through. A bakery's six delivery vans cost more the week diesel jumps. A coffee cart goes quiet on a cold morning. Each is a real loss, one day at a time, and none of it is something an insurer will write a policy for.

Prediction markets already price exactly these days. Gemini lists tomorrow's high temperature for 49 US cities, oil and other commodity strikes, and game outcomes, all as $1 contracts. Some owners have started using markets like these by hand. Doing it by hand means finding the right contract among a thousand, working out how many to buy, and understanding where the market's settlement differs from your actual loss. Almost nobody will do that. The price exists; the product doesn't.

So we wanted an agent to do it. That creates the second problem: an agent that spends money and reads text written by strangers will eventually be talked into something. A spending limit written in a prompt is a suggestion. We wanted limits the agent cannot argue with, so we put them in a contract.

What it does

The demo above follows that bar's bad day in 8 steps. Follow along at awning-eight.vercel.app: it is free and runs on test dollars.

  1. Open Awning. One question: what would a bad day cost you?
  2. Say your bad day. One sentence: what, where, when, and what it costs. Press Say it and talk, or type it. Google's Gemini model turns the sentence into a structured risk, and if something essential is missing it asks one question. If no market tracks the risk, it says so and records the gap.
  3. Read the ticket. What the cover pays, what it costs and the market's odds, read back to you by voice: pays $3,000 if the Longhorns don't win, costs $287.20. The price is live and moves when the market does.
  4. Check the proof. Gemini's market book with your contracts lit, how closely the market tracks your loss ("settles on the official result of the game"), a note on where a payout could differ from your loss, and a link to verify the live JSON on Gemini.
  5. Set the cover. Drag the slider to cover part or all of the loss. The price follows.
  6. Buy cover. Press Buy cover, or say "cover it". The pool posts an offer that locks your whole payout on Arc before you pay, and it only sells cover it can lock in full. Your agent pays the premium through the mandate contract.
  7. Open My agent. Your vault, the limits the contract enforces, and everything the agent did. The page shows what a hijacked agent could take right now ($1.98), and one press pauses the agent.
  8. If the day comes. Nothing to file. Gemini settles the market, AwningPool pays out, and the money lands in your vault by itself. If no result is reported within three days of the close, anyone can trigger the payout in full.

Everything else in the demo

  • Bad days priced right now. Ready-made examples on the first screen, each priced on Gemini that minute.
  • 49 cities, live. A map of every city Gemini lists tomorrow's high for, with what a bad day there costs to cover and how the market's odds moved through the day.
  • Big premium? You sign. Above your "ask me first" line the agent stops and needs your go-ahead, by button or by saying "approve".
  • A thief got $1.98. The hijack test hands the agent's real key to an attacker script on Arc testnet. Five transactions; the contracts refuse everything except what is left of today's $2 data budget.
  • The weather that costs you. Upload daily sales and Awning finds the temperature at which your takings drop, in dollars, then prices cover for it in one click.
  • Hedged on Gemini. The pool covers itself by buying the same position on Gemini's sandbox, and each cover records its hedge.
  • A standing order. Leave a risk with the agent; each day it prices the cover, buys a forecast over x402, and decides buy or skip inside your cap, writing down why.
  • Send money out. A payout moves from your vault on Arc to Base, Ethereum or Avalanche through Circle CCTP.
  • A proof page for judges. Each sponsor technology beside the latest real transaction, order or event behind it.
  • Light and dark.

How we built it

Three layers, each with one job: contracts on Arc hold the money and the rules, a pricing engine turns Gemini's markets into cover, and an agent acts only through the contracts.

Contracts (Solidity 0.8.28, Foundry, OpenZeppelin), deployed on Arc testnet (chain 5042002).

  • AwningMandate holds each owner's USDC and enforces what their agent may do: a daily data allowance (drawFloat), most for one cover, most per 30-day period, an allowlist of venues, an approval line above which a premium needs the owner's EIP-712 signature over the exact terms, a pause, and an expiry. The app's defaults are a $2,000 vault, $500 per cover, $1,500 a month, ask first above $100, and $2 a day for data. A refusal is not a revert: the transaction succeeds, moves nothing, and emits Blocked(owner, agent, action, reason, amount, counterparty, ref), so every denied attempt is on the permanent record.
  • AwningPool is an ERC-4626 USDC vault that writes every cover. offer locks the whole payout before any premium moves, and no more than half the pool may ride on one market. The pool never trusts a callback: taken(hedgeId) reads the mandate and checks the same owner paid exactly the offered terms before the deadline. A stray premium can be sent back by anyone, an offer nobody took can be lapsed by anyone, and if the resolver stays silent past resolveBy (three days after the market closes) anyone can trigger the payout to the owner.
  • USDC is the vault asset, the pool asset and the gas on Arc, so an owner holds one token and sees one balance.

Pricing. Every cover is a basket of binary contracts that pay $1 each, so a $300 cover is 300 contracts on each leg. The pool sells at what Gemini is asking plus Gemini's fee, so it can lay the risk off at once. For a cover of \( N \) dollars over legs with asking prices \( p_i \), the cost is

\( \text{cost} = N \sum_i p_i + r \, N \sum_i p_i (1 - p_i) \)

with taker rate \( r = 0.07 \) (and \( r = 0.0175 \) for a resting maker order when nobody is asking). With no offer on the book, the pool prices off the middle of the book, anchored on \( \min(\text{mid}, \text{fair}) \), where fair comes from the forecast. A forecast can lower a bid and never raise one. A quote lasts five minutes, and cover that would cost as much as it pays is not offered.

The engine (TypeScript, pure and unit tested against recorded Gemini data). It normalises Gemini's three market shapes (temperature partitions, nested price ladders, moneylines), matches an exposure to the market that settles on its subject and date, builds the legs, snaps thresholds and reports the snap, prices with the fee formula above, and scores basis risk.

The agent's loop. Interpret (the model), match, construct, check, price, explain, offer (underwriter key), ask the mandate (agent key), lay off on Gemini, settle (resolver key). The model makes exactly two kinds of call: sentence to exposure, and buy or skip for one day on a standing order. It never chooses an amount, a payee or a market. Those come from code, and the mandate bounds them whatever the model says.

Sponsor technology: what each one does for the owner, then how.

  • Gemini Prediction Markets: every price, and the pool's hedge. Market data from /v1/prediction-markets/events, live quotes over wss://ws.gemini.com bookTicker, and the pool's own hedge placed with POST /v1/prediction-markets/order (HMAC-SHA384) on Gemini's sandbox.
  • Arc: where the money and the rules live. Both contracts, USDC as gas, and x402 settled as EIP-3009 transferWithAuthorization on Arc's native USDC.
  • x402: the agent buys its own second opinion. For temperature markets the agent pays $0.02 over x402 (@x402/core, @x402/evm, v2 exact scheme) for a 31-member GFS ensemble forecast from Open-Meteo, and checks the market's price against it. The client refuses any request over $0.05 or to a seller not on its allowlist, before anything is signed.
  • Circle CCTP V2: a payout isn't stuck on one chain. "Send money out" burns through TokenMessengerV2 on Arc (domain 26) with the Forwarding Service hook, so Circle mints natively on the other chain and the receiver needs no gas there. On 20 November, $1 left a vault on Arc and $0.94 arrived at the same address on Base Sepolia.
  • QuickNode Streams: the owner's activity feed. One Stream on Arc testnet, dataset block_with_receipts, filtered by quicknode/filter.js to the two contracts' logs, delivered to /api/streams. The handler verifies X-QN-Signature (HMAC-SHA256), inflates gzip, and stores events idempotently by txHash:logIndex. When the Stream is quiet for 90 seconds, the app reads the same logs from the chain and writes the same rows.
  • ElevenLabs: buy cover by voice. Scribe (scribe_v2) for speech to text and Flash (eleven_flash_v2_5) for the replies. What counts as a spoken yes is pinned down by a test.
  • Google's Gemini model: a sentence becomes a structured risk. Structured output through @google/genai, validated with Zod.

App. Next.js 16 and React 19 on Vercel, Tailwind 4, Geist, viem, Postgres through Drizzle (PGlite locally), SWR. The owner's key is generated in the browser and never reaches the server; every account request carries a session signed by that key and checked against the chain.

Find my risk. Each day of sales is compared with days in the same month and on the same weekday, with both patterns taken out of sales and weather. Every whole-degree threshold between the 5th and 95th percentile is tried in both directions. Then the weather is shuffled within each month 800 times and the whole search rerun on each shuffle, and a finding is reported only if fewer than 1 in 100 shuffles do as well. Highs come from the station the city's market settles on, looked up from the National Weather Service.

Challenges we ran into

  • Gemini is not onchain. It is a centrally cleared exchange, so no contract can see its results. We made the trust explicit: a resolver key reports the result with a hash of the resolution it saw, each cover's marketRef commits to the exact contracts, and a resolver that goes silent loses, because the owner is paid in full after resolveBy.
  • An independent review found three holes in the first pool. An offer could be taken after its deadline, another account could spend an offered id, and stray premiums were counted as free assets. All three are fixed, each with a test, and invariant tests now check over random sequences that the pool holds everything on its books and that locked equals the sum of live offers.
  • Thin books. Many contracts have no offer. On a typical minute 21 of the 49 cities have cover priced; in the rest tomorrow is near certain or nobody is selling. The pool refuses cover it cannot fully lock.
  • No price history. Gemini's API has none, so Awning keeps its own: every city's temperature market and the commodity ladders, every five minutes, for two days. That is what draws the odds lines on the map and the cost chart on a quote.
  • Gemini's sandbox lists no weather or sports. It lists commodities and crypto under the live tickers. So the pool hedges commodity and crypto covers on Gemini's sandbox, and each cover records where its hedge sits.
  • The exchange went quiet. Gemini's API failed for half an hour on 17 November. Now prices are shown from the last listing with their age, and nothing is sold until live prices are back. The map and examples also stay priced after midnight Eastern, before tomorrow's markets are listed.
  • A serverless host has no timer. Settling covers and the agent's daily decisions need one. The same pass now runs after a page is served (at most once a minute), through /api/wake, and from a daily Vercel cron.
  • A free model key is sometimes busy. Any one model can refuse or sit silent for a minute. The app asks three models in turn, waits 9 seconds on each, and gives up after 40 seconds.
  • A public chain endpoint that blips. Arc's public RPC now and then answers "internal error" for a second or two. Calls are retried patiently, and a refusal by the contract is never retried.
  • Two things called Gemini. The markets are on the Gemini exchange; the model that reads a sentence is Google's Gemini. They are unrelated, so they got separate keys and separate names everywhere in the code.

Accomplishments that we're proud of

  • It works end to end on a public chain. A sentence becomes a priced cover from a live exchange, the payout is locked onchain, the premium moves through the mandate, the pool hedges on Gemini, and a resolved market pays the owner's vault. A cover settled and paid $100.00 on 19 November 2026. On 20 November the proof page counted 12 covers and 38 refusals by the mandate.
  • An agent that cannot be robbed. With the default limits, an attacker holding the agent's real key gets at most $2.00 out of a $2,000 vault: the day's data allowance and nothing else. In a real run on 20 November the attacker sent five transactions: three were refused by the mandate, one was sent back by the pool, and the attacker left with $1.98. The contract exposes that number as limits(owner).floatRemainingToday, and the app shows it before you press the button.
  • Your payout is locked before you pay. Every cover is an onchain offer with its payout set aside in the pool, and a silent resolver means you get paid.
  • Every price is live. Every number in the app, including the examples on the first screen, is read from Gemini that minute.
  • Buying by voice works end to end. On Arc testnet on 18 November, the day was said, the price read back, and "cover it" bought a $50 cover. On an account over its monthly limit the same words got the mandate's refusal, read aloud.
  • Tests. 126 contract tests with fuzzing and invariants on both contracts, plus engine, settlement, forecast and sales-analysis tests in Vitest, with CI on every push.
  • A quiet interface. One column, Geist, paper and ink, and one colour: the amber stripes of the awning, on the one thing to press.

What we learned

  • Limits belong outside the model. Once the mandate enforces caps onchain, the question of whether the model can be talked into something stops mattering for money. We tested the worst case, a fully stolen key, rather than prompt tricks.
  • A refusal is worth recording. Emitting Blocked instead of reverting turned every attack into an indexed event the owner can read.
  • Basis risk is the real risk. Temperature settles on one airport station, price markets on one index at one moment. Saying that plainly on the receipt is more useful than a confidence score.
  • Searching many thresholds finds luck. Trying every degree makes the best one look significant by chance. Rerunning the whole search on 800 shuffles of the weather is what makes a finding from sales worth pricing.
  • Use the model for as little as possible. Two kinds of call, each with a structured schema, and code for everything that moves money.

What's next

The goal: any small business names a bad day in a sentence and is covered a minute later, on whatever market prices it.

  • Trust: a challenge window on results, so a wrong report can be disputed before the pool pays or keeps, and the underwriter and resolver keys on separate machines from the agent.
  • The pool: open deposits from the app, a spread that pays depositors for the risk, and the pool's Gemini account funded from its USDC, so its hedge and its collateral are one balance sheet.
  • Owners: passkey smart accounts with gas paid for them. The mandate already verifies owners through SignatureChecker, so ERC-1271 accounts work without changing it.
  • Pricing: bias-corrected forecasts, and fair values for price markets from options-implied volatility.
  • New markets: sending Gemini the list of risks people asked for that no market tracks yet, as demand for new markets.

Built With

  • arc
  • circle-cctp
  • drizzle-orm
  • elevenlabs
  • foundry
  • gemini-prediction-markets
  • google-gemini
  • nextjs
  • open-meteo
  • openzeppelin
  • pglite
  • postgresql
  • quicknode-streams
  • react
  • solidity
  • swr
  • tailwindcss
  • typescript
  • usdc
  • vercel
  • viem
  • vitest
  • websockets
  • x402
  • zod
Share this project:

Updates

Submission history