Search projects, hackathons, sponsors and tech

    ← All projects

    Omni402

    Pay x402 from any chain, any token. Settle instantly in USDC on Base

    Demo

    About

    # omni402 - Description omni402 is a clearing layer between fragmented user liquidity and x402 USDC invoices. It solves a critical problem in web3 payments: users have tokens scattered across multiple chains, but merchants want to receive payments in a single, stable currency on one chain. ## The Problem Today, if a merchant wants to accept crypto payments, they need to: - Support multiple chains and tokens - Handle volatile assets - Wait for slow cross-chain bridges - Manage complex treasury operations Meanwhile, users are forced to bridge tokens, swap to the right asset, and pay high gas fees—often abandoning the purchase entirely. ## Our Solution omni402 makes this seamless: **For Users:** Pay with whatever you have—ARB, ETH, USDC on Arbitrum, or any supported token. No bridging required. One click and you're done. **For Merchants:** Sign up with email, get a CDP-managed wallet, and receive instant USDC settlements on Base. No crypto complexity, no seed phrases, just a dashboard showing your payment history. **For Developers:** Two lines of code to protect any API endpoint with x402 payments. Wrap your route handler with `requirePayment()` and you're monetizing. ## How It Works 1. User initiates payment on source chain (e.g., Arbitrum) 2. EdgePayment contract swaps their token to USDC via 1inch Aqua 3. LayerZero sends cross-chain message to Base 4. OmniTabHub triggers instant settlement from the pool 5. Merchant receives USDC immediately 6. Confirmation travels back to update invoice status The settlement pool provides instant liquidity so merchants don't wait for the cross-chain message—they get paid in seconds, not minutes. ## Use Cases - **API Monetization:** Charge per-request for premium data, AI inference, or content - **Digital Goods:** One-time payments for downloads, licenses, or access - **Microtransactions:** Sub-dollar payments without credit card minimums - **Global Access:** Accept payments from users worldwide without payment processor restrictions omni402 turns any HTTP endpoint into a cross-chain monetizable resource, powered by the x402 protocol standard.

    How it's made

    # omni402 - How It's Made ## Core Architecture omni402 is built on three main pillars: **LayerZero V2** for cross-chain messaging, **1inch Aqua** for token swaps, and **Coinbase Developer Platform** for merchant wallets. ## Smart Contracts ### EdgePayment (Arbitrum) Extends LayerZero's OApp for bidirectional messaging. When a user pays, it: 1. Accepts any token and swaps to USDC via 1inch SwapVM 2. Stores invoice as "Pending" 3. Sends LayerZero message to Hub with payment details 4. Receives settlement confirmation and marks invoice as "Settled" ### OmniTabHub (Base) The central coordinator that: 1. Receives payment messages via `_lzReceive` 2. Uses `lzCompose` for atomic settlement + confirmation 3. Calls SettlementPool to transfer USDC to merchant 4. Sends confirmation back to EdgePayment ### SettlementPool (Base) Share-based liquidity pool that enables instant settlements. LPs deposit USDC and earn fees from payments. The pool ensures merchants get paid immediately without waiting for cross-chain finality. ## LayerZero V2 Integration We use the full OApp pattern with both `OAppSender` and `OAppReceiver` for round-trip messaging. The executor options include both `lzReceive` gas (200k) and `lzCompose` gas (150k) to handle the settlement composition pattern. The hacky part: we use `sendCompose` to trigger a self-compose, which allows atomic execution of settlement + return message in a single transaction. This ensures the merchant gets paid and the confirmation gets sent in one atomic operation. ## 1inch Aqua (SwapVM) Instead of routing through AMMs with slippage, we use 1inch Aqua's resolver network. The EdgePayment contract stores a pre-configured swap order (strategy hash), and resolvers fill the other side of the trade. This gives users better execution than typical DEX aggregation. The taker traits `IS_EXACT_IN` and `USE_TRANSFER_FROM_AND_AQUA_PUSH` allow the router to pull tokens from our contract while resolvers push USDC output directly to us. ## Coinbase Developer Platform Merchants authenticate with email via CDP Auth and get an embedded wallet automatically. No seed phrases, no MetaMask—just email login. We use `@coinbase/cdp-hooks` for React integration: - `useCoinbaseAuth` for authentication state - `useFundWallet` for onramp - `useWalletBalance` to display USDC balance ## SDK Architecture The TypeScript SDK provides: - **Server:** `requirePayment()` wrapper for Next.js route handlers - **Client:** `Omni402Provider` context and `useOmni402` hook - **PaymentModal:** React component for the payment flow UI The client intercepts 402 responses, shows the payment modal, and retries with `X-PAYMENT` header containing the transaction hash. ## Facilitator Service Express.js service with Prisma/PostgreSQL that: - Verifies payment transactions by reading EdgePayment events - Stores payment records with status tracking - Listens to Hub's `PaymentSettled` events to update status - Provides payment history API for merchant dashboard ## Stack Summary - **Chains:** Arbitrum (edge), Base (hub) - **Messaging:** LayerZero V2 OApp - **Swaps:** 1inch Aqua/SwapVM - **Wallets:** Coinbase Developer Platform - **Frontend:** Next.js 15, TailwindCSS - **Backend:** Express.js, Prisma, PostgreSQL - **Contracts:** Solidity, Hardhat, OpenZeppelin Built for ETHGlobal Buenos Aires 2025.