Skip to content

fix(x402): settle Arbitrum One deposits via CDP with checksummed v2 payload#294

Merged
gianalarcon merged 2 commits into
developfrom
feat/cdp/arbitrum-one
Jun 13, 2026
Merged

fix(x402): settle Arbitrum One deposits via CDP with checksummed v2 payload#294
gianalarcon merged 2 commits into
developfrom
feat/cdp/arbitrum-one

Conversation

@gianalarcon

Copy link
Copy Markdown
Contributor

What

Enable agentic gasless USDC (x402) deposits on Arbitrum One (42161) by routing them through the Coinbase CDP facilitator (x402 v2), and fix the CDP v2 payload that was being rejected.

Why

  • PayAI (our x402 v1 facilitator) advertises "arbitrum" in /supported but rejects it on verify with invalid_exact_evm_network_mismatch — confirmed on prod for both Arbitrum One and Arbitrum Sepolia. So PayAI cannot settle Arbitrum.
  • CDP is the only facilitator that settles Arbitrum One (per CDP network-support: Base, Base Sepolia, Polygon, Arbitrum One, World, Solana). CDP does not support Arbitrum Sepolia.

Changes

  • Chain-aware routing (resolveFacilitator): Arbitrum One (42161) → CDP; Base + everything else stay on PayAI v1 (untouched). CDP_SUPPORTED_NETWORKS + assertCdpNetworkSupported guard fails fast for chains CDP can't settle.
  • CDP v2 payload fix (the actual blocker): CDP's v2 validator requires EIP-55 checksummed EVM addresses. We were sending lowercase (multisig addresses are stored lowercase; the X-PAYMENT authorization carries lowercase), so the payload failed CDP's oneOf[x402V2PaymentPayload, x402V1PaymentPayload] and surfaced the misleading "x402V1PaymentPayload requires 'scheme'" error. Now checksum asset/payTo in the v2 requirements leaf and authorization.from/to in the payment payload via viem getAddress. Casing does not affect the EIP-3009 signature (EIP-712 encodes addresses to the 20-byte value).

Verified

  • ✅ Schema conformance against CDP's own SDK OpenAPI types + the canonical x402 exact-EVM spec.
  • ✅ Clean type-check (yarn workspace @polypay/shared build + @polypay/backend build).
  • 🚩 Needs a live Arbitrum One test deposit (real multisig + USDC) to confirm CDP /verify + /settle accept the checksummed body end-to-end — CDP can't be fully exercised in CI/locally.

Deploy notes

  • Staging is testnet; Arbitrum One can't be exercised there, so final confirmation must happen after this reaches prod.
  • Prod relayer needs Arbitrum One ETH funded before the live test (account-creation deploy).

🤖 Generated with Claude Code

gianalarcon and others added 2 commits June 13, 2026 15:54
…ayload

Arbitrum One (42161) only settles through Coinbase CDP (x402 v2); PayAI
advertises "arbitrum" in /supported but rejects it on verify with
invalid_exact_evm_network_mismatch (confirmed on prod). Route Arbitrum One
deposits to CDP (Base + everything else stay on PayAI v1) and fix the CDP v2
payload that was being rejected.

Root cause of the CDP 400: CDP's v2 validator requires EIP-55 checksummed EVM
addresses. We sent lowercase (multisig addresses are stored lowercase; the
X-PAYMENT authorization carries lowercase), so the payload failed CDP's
oneOf[x402V2PaymentPayload, x402V1PaymentPayload] and surfaced the misleading
"x402V1PaymentPayload requires 'scheme'" error. Checksum asset/payTo in the v2
requirements leaf and authorization.from/to in the payment payload via viem
getAddress. Casing does not affect the EIP-3009 signature (EIP-712 encodes
addresses to the 20-byte value). PayAI v1 path is untouched.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@gianalarcon gianalarcon merged commit 4018cdc into develop Jun 13, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant