Why we built it
In February, bitcoin dipped to $60,000 for a few hours. We replayed that week: a loan that had borrowed 60% against one bitcoin got liquidated near the bottom and kept a tenth of it. The price was back at $70,000 that same evening.
What it does
Airbag watches a bitcoin loan on Arc. It reads Gemini's prediction market to get one number: the chance you lose your bitcoin. If that goes over 5%, it pays the loan down with your own savings, and gives them back once things calm down. You don't press anything.
We tried it on a real loan on Arc Testnet. We pushed the loan to a 42% chance of being lost and the bot made it safe 4 seconds later. The fee was about one cent.
How we built it
The loan and the savings are Circle's Borrow Kit and Earn Kit on Arc. We wrote a small contract, AirbagGuard, so the bot can only move your savings into your own loan and back. It never has your wallet's key. Gemini's live feed and a QuickNode Stream wake the bot when something changes, and on Gemini's test site it buys a hedge after each save.
What was hard
Borrow Kit sometimes showed the old debt right after a repayment, so the bot could have paid twice. We ended up reading the loan straight from the contract. Our laptop's clock was also 157 seconds fast, which made every transaction fail until we worked out why.
What we learned
We checked 47 of Gemini's markets that had already ended. What it called 80% happened 87% of the time, so the odds are worth trusting.
Built With
- arc
- circle
- express.js
- foundry
- gemini
- morpho
- node.js
- quicknode
- react
- render
- solidity
- tailwindcss
- typescript
- usdc
- viem
- vite
- websockets