Inspiration
My family loved going to Rangers games growing up, and at every game, there was a contest to glide a puck to the center of the ice. It was my favorite part of the games because somebody had the chance to walk out with a ton of money. There isn't a market for that, unfortunately, but I found that using prediction markets, a business could run sports promotions and cover its risk on the exact event the promotion is based on. This June, a New York bar did it by hand, putting $5,000 on Kalshi to cover free tabs if the Knicks won. I wanted to minimize any friction by turning that into a button small businesses could press.
What it does
FreeIf lets a shop run a "free if our team wins" promotion for one fixed price, letting everyone share the joy of a home team winning while making sure the business benefits regardless of the outcome.
- The shop picks a game, what is free and how many customers, and pays one fixed price
- Each customer gets a card with their order
- If the team wins, the vault handles payouts to customers automatically. The customer scans the card and claims their funds
- If the team loses, nobody is owed anything. Regardless, the shop never pays more than the price it saw
How we built it
- The vault is one Solidity contract on the Arc testnet, built and tested with Foundry, and reviewed multiple times, with the help of AI. It locks each promo's full payout the moment the promotion is funded.
- The keeper (Node and TypeScript service) prices a promo using Gemini's orderbook, signs a quote the vault will accept, registers the cards each customer can claim their potential rebate through, and settles with Gemini's result.
- A QuickNode Stream watches the vault's logs on Arc and posts each event to the keeper, which pushes it to every open page.
- The web app lets shops and customers log in by email through Circle user-controlled wallets, so nobody sees a wallet or a seed phrase.
Challenges we ran into
- A deposit could take locked money: a review found that before the first deploy a new deposit could take money locked for a promo. Deposits are now priced so that can't happen.
- Who counts as a customer: my first version used open links, so anyone who saw the sign could claim. I replaced it with cards, one per customer the shop paid for.
- Gemini's sandbox lists only crypto and commodity markets, so the hedge order is simulated for games and weather.
Accomplishments that we're proud of
- It uses blockchain technology without the parts that could be confusing for people who aren't native.
- It's my first hackathon, and I built a project I'm proud to show my friends.
- Low latency: each step of a promo shows on the page about one second after it happens on Arc.
What we learned
- Prediction market order books can be thin, so pricing is derived from what the whole payout would cost and not the best offer alone.
- Arc is a great chain to use for payouts in USDC since fees are paid with USDC, so no second token is needed to move, minimizing friction.
What's next for FreeIf
- A real run with a handful of bars and/or pizza shops
- Finding liquidity providers for the vault
- Moving to the mainnet and buying matching contracts on Gemini so the vault is actually hedged
- More decentralization: a second source for results, a multisig owner, and the vault's limits enforced in a contract
- Implementing a hedge-as-you-go feature where merchants can actively hedge as orders come in
- Letting shops turn unused cards back in before kickoff for a refund at the current price
Built With
- arc
- circle
- foundry
- gemini
- next.js
- node.js
- quicknode
- solidity
- typescript
- usdc