-
Checkout: one Arc transaction pays the seller and Sway's 3% fee. If any part fails, nothing goes through.
-
Sell a card: Sway checks the balance, then swaps it to a new number only Sway knows.
-
The seller's old card number now reads $0. The swap is recorded on Arc, so it can't be spent twice.
-
Receipt after payment confirms on chain. The buyer signs a free message to reveal the new card number and PIN.
-
12 fictional stores, each with a live discount read from Arc. A $1 card costs $0.83–$0.94.
Inspiration
Gift card resale has one obvious scam: the seller keeps the number and PIN, sells the card, then spends it before the buyer does. Checking the balance doesn't fix that, because after the sale both people know the PIN. We wanted resale where that's impossible.
What it does
- Sell: enter a gift card number and PIN. Sway checks the balance with the store, then swaps the balance onto a brand-new card number that only Sway knows. The seller's old number drops to $0, so there's nothing left to drain.
- Buy: shoppers see each card at a discount (6–17% off depending on the store) and pay in USDC on Arc. One transaction pays the seller, pays Sway's 3% fee and settles the order. If any part fails, none of it happens.
- Reveal: after the payment confirms on chain, the buyer signs a free message proving they paid, and only then sees the new card number and PIN.
- Sign-in is email through Privy. There are no seed phrases and no "connect wallet" step.
How we built it
- Contracts (Solidity, Foundry, OpenZeppelin):
MerchantCreditis an ERC-1155 where each store's credit is a token and 1 unit = $0.01. Only the store's issuer can mint it, and only the marketplace can burn it at checkout.SwayMarketplaceholds listings in escrow and runs the atomic checkout. Each store has its own rate, locked into a listing when it's created. Checkout has a max-price guard, can only settle an order once, and rounding never creates value. - App: Next.js 16 on Vercel, viem/wagmi, Privy embedded wallets, official Arc USDC.
- Backend: Next.js route handlers with no database. Orders are HMAC-signed tokens. The receipt API reports "paid" only from a confirmed
CheckoutCompletedevent in a successful transaction. Card reveal requires a wallet signature that matches the on-chain buyer. - Swap: a simulated store gift card system for our fictional stores handles balance checks, the swap and issuing the buyer's new card. Every dollar of on-chain credit is issued only after the old card is zeroed.
- 52 Foundry tests (unit, fuzz and invariant: buyer payment always equals seller payout plus fee) and 15 backend tests.
Challenges we ran into
- Proving a card wasn't drained. A balance check can't tell who spent it, which is why we designed the swap.
- Arc's public RPC rate-limits bursts and caps log queries at about 2,000 blocks. We moved listing reads into one Multicall3 call and look up receipts by transaction hash instead of scanning history.
- On Arc, native gas and the ERC-20 USDC are the same balance with different decimals (18 vs 6). All money math is integer-only through the ERC-20.
- New sellers have no gas, so Sway tops them up with a small amount of testnet USDC.
Accomplishments that we're proud of
- Real end-to-end on Arc testnet: sell → swap → list → buy → reveal, with the seller, buyer and Sway's fee all paid in one transaction.
- Works as a phone web app; add it to your Home Screen.
- Nothing is faked. Every "paid" screen is backed by a confirmed transaction.
What we learned
- How to design around trust when you can't verify off-chain state.
- How Arc's USDC-as-gas model works.
- How to keep crypto invisible in a consumer flow.
What's next for Sway
- Real retailer and gift card exchange APIs for the balance check and swap.
- Compliance work for holding gift card value (money transmission and anti-money-laundering rules).
- Partial redemption, and more card values.
Built With
- arc
- circle
- erc-1155
- ethereum
- foundry
- next.js
- node.js
- openzeppelin
- privy
- react
- solidity
- tailwind
- typescript
- usdc
- vercel
- viem
- wagmi