Skip to content

payments: BaseUsdcAdapter (Base + USDC + x402) #1029

@willgriffin

Description

@willgriffin

Parent

#1027

What to build

BaseUsdcAdapter implementation of the PaymentBackend interface. Targets USDC on Base (Coinbase's L2).

This is the agent-friendly path: fast L2 finality, native x402 support, sub-cent fees, USD-pegged stable settlement.

Shape

  • Stable id: base-usdc
  • Settlement currency: USDC (treated 1:1 with USD)
  • Chain identifier: base
  • x402Capable: true
  • Typical confirmation latency: ~2 seconds (1 L2 confirmation)
  • supportsRefunds: true (via reverse transfer)

Implementation details:

  • Reads Base via an RPC provider (Alchemy or Infura free tier covers MVP)
  • Subscribes to Transfer(address indexed from, address indexed to, uint256 value) events on the canonical Base USDC contract 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913, filtered to operator's receiving addresses
  • HD-derived child addresses per quote (BIP32 from a single operator-controlled master xpub; the master private key lives in cold-treasury Safe)
  • Sweep helper to consolidate child balances into the hot wallet
  • x402 verification: parses an X-Payment header (USDC transfer proof on Base) and confirms on-chain in the same request
  • Payout: programmatic send from the operator's hot wallet to the supplier's payout address

Acceptance criteria

  • BaseUsdcAdapter implements PaymentBackend and passes the conformance test suite from payments: new package skeleton + PaymentBackend interface #1028
  • Watch path detects an incoming Transfer to a known quote address and surfaces it
  • x402 proof verification works against a real Base USDC transfer (mainnet or testnet equivalent)
  • HD-derived addresses are deterministic given the master xpub and a quote id
  • Refund path can return a payment to the original sender
  • Tests do not require live RPC for the bulk of the suite (use mocked RPC); a small integration suite hits a public RPC

Blocked by

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions