TradeX

Gasless cross-border remittances via Uniswap v4 pricing, Yellow Network & Merkle proofs

TradeX

Created At

HackMoney 2026

Project Description

TradeX PRISM solves the $42B/year remittance fee problem by separating price discovery from settlement—inspired by how TradFi FX markets handle $6.6T daily.

The protocol refracts each swap into two rays:

  • PRICE RAY: Captures live exchange rates from Uniswap V4 pools (INR/AED on Base Sepolia) as the "fixing rate"
  • SETTLEMENT RAY: Executes instant, gasless transfers via Yellow Network state channels (ERC-7824)

PRISMHook.sol then ties them together with on-chain Merkle attestations, creating permanent proof that settlements happened at the V4 fixing rate—auditable by anyone, forever.

For a Dubai worker sending AED 500 home to India:

  • Traditional banks: AED 40 fee, 3 days, opaque rates
  • PRISM: AED 2 fee, 2 seconds, provably fair V4 rate

The user gets ENS support, an address book, and automatic chain-switching between Sepolia (Yellow Network) and Base Sepolia (Uniswap V4). Every swap is verified on-chain while settlement happens off-chain—zero slippage, zero gas, maximum transparency.

Built for 280M migrant workers worldwide who deserve better than 3-7% fees and hidden FX markups.

How it's Made

PRISM is a multi-chain protocol spanning Sepolia and Base Sepolia, orchestrating three complex systems into one seamless UX.

CORE ARCHITECTURE:

  1. UNISWAP V4 INTEGRATION (Base Sepolia)

    • Deployed custom PRISMHook.sol that inherits from BaseHook
    • Hook reads sqrtPriceX96 from PoolManager.getSlot0() to capture live AMM rates
    • Converts sqrtPrice to human-readable rate: (sqrtPrice / 2^96)^2
    • Manages epoch-based "fixing rates" with 5-min TTL, mimicking TradFi FX benchmarks
    • INR/AED pool (fee: 3000, tickSpacing: 60) serves as the price oracle
  2. YELLOW NETWORK SETTLEMENT (Sepolia)

    • Integrated Nitrolite SDK (@erc7824/nitrolite) for ERC-7824 state channels
    • WebSocket client connects to Yellow Network clearnode for off-chain messaging
    • YellowAdapter.sol manages session opening/closing with EIP-712 meta-transactions
    • Transfers execute in ~2 seconds with zero gas via state channel updates
    • Collateral deposited to Nitrolite Custody (0x019B...262)
  3. MERKLE ATTESTATION LAYER

    • prismService.ts builds keccak256 Merkle trees from settlement batches
    • Each leaf = hash(sender, recipient, amountIn, amountOut)
    • PRISMHook.captureAndAttest() atomically: a) Reads V4 sqrtPriceX96 b) Stores fixing rate for current epoch c) Stores Merkle root + settlement metadata d) Emits PrismFixingRate + SettlementAttested events
    • Creates unique attestationId = keccak256(poolId, epoch, root, timestamp)
    • Anyone can verify settlements against on-chain Merkle proofs

FRONTEND (Next.js 16 + React 19):

  • wagmi v3 + viem v2 for blockchain interactions
  • RainbowKit for wallet connection
  • Auto chain-switching: Sepolia (Yellow) ↔ Base Sepolia (V4/Hook)
  • ENS resolution via useEnsName/useEnsAvatar with profile display
  • localStorage-based contacts system with ENS label support
  • Real-time V4 pool state updates via uniswapV4Service.ts

HACKY/NOTABLE BITS:

  • Cross-chain coordination without bridges: Sepolia holds Yellow Network state channels, Base Sepolia holds V4 pools + attestations. The frontend orchestrates both via automatic network switching.

  • sqrtPriceX96 math: Converting Uniswap's Q64.96 fixed-point format to decimal rates required careful precision handling. We use BigInt throughout to avoid floating-point errors.

  • Merkle tree optimization: Settlements are batched into epochs. Instead of posting every swap on-chain (expensive), we post one Merkle root per batch. This scales to 1000+ settlements/attestation.

  • Yellow Network integration was challenging—Nitrolite SDK is WebSocket-based, so we built a persistent connection manager in yellowNetwork.ts that handles reconnects, session persistence, and error recovery.

  • Hook address calculation: PRISMHook deploys to a deterministic address ending in specific flags (0x7992) to enable all hook callbacks. Used CREATE2 with salt mining.

  • ENS everywhere: Users can send to .eth names instead of addresses. The UI fetches ENS text records (avatar, description, Twitter) to show rich contact cards.

TECH STACK:

  • Solidity ^0.8.26 (Hardhat, Foundry)
  • Uniswap V4 Core (PoolManager, BaseHook)
  • Yellow Network (Nitrolite SDK, ERC-7824)
  • Next.js 16, TypeScript, TailwindCSS
  • wagmi v3, viem v2, RainbowKit
  • Merkle tree libraries (merkletreejs)

DEPLOYED & VERIFIED:

  • Base Sepolia: PRISMHook (0x875C...7992), V4 Pool, tokens
  • Sepolia: YellowAdapter (0xB023...796F), TradeX orchestrator

The result: A working cross-border remittance protocol that's 95% cheaper and 12,960x faster than SWIFT, with cryptographic proof of fair pricing.

background image mobile

Join the mailing list

Get the latest news and updates