Skip to content

feat: expand chains (+6 testnets) and tokens (+EURC, WETH, USDT)#4

Merged
AlejandroFabianCampos merged 3 commits into
mainfrom
feat/expand-chains-and-tokens
Apr 28, 2026
Merged

feat: expand chains (+6 testnets) and tokens (+EURC, WETH, USDT)#4
AlejandroFabianCampos merged 3 commits into
mainfrom
feat/expand-chains-and-tokens

Conversation

@AlejandroFabianCampos
Copy link
Copy Markdown
Collaborator

@AlejandroFabianCampos AlejandroFabianCampos commented Apr 28, 2026

Summary

Chain expansion (testnet): adds 6 testnets to SupportedChain: ethereum-sepolia, arbitrum-sepolia, optimism-sepolia, polygon-amoy, scroll-sepolia, linea-sepolia (chain IDs, USDC addresses, viem chain map, default confirmations = 0, QuickNode slugs).

Token expansion: introduces a SupportedToken union (USDC | EURC | WETH | USDT) with TOKEN_CONTRACTS, TOKEN_DECIMALS, and TOKEN_CREDENTIAL_TYPES. Coverage spans testnet and mainnet. USDC_CONTRACTS is preserved as-is so existing consumers don't break.

evm.charge resolver: now resolves the token contract from (token, chain), validates that the requested credentialTypes are supported by the token (e.g. WETH and USDT lack EIP-3009 transferWithAuthorization), and uses per-token decimals instead of the hardcoded 6.

Public surface (mpp/index.ts): exports the new types and lookup maps so downstream consumers (admin layers, balance views) can validate (chain, token, credentialType) tuples without re-hardcoding the matrix.

Token availability (testnet)

USDC EURC WETH USDT
ethereum-sepolia
arbitrum-sepolia
optimism-sepolia
polygon-amoy
scroll-sepolia
linea-sepolia
base-sepolia

Token availability (mainnet)

USDC EURC WETH USDT
ethereum
base
arbitrum
optimism
polygon
avalanche
linea
unichain

Provenance rules

Tokens added to TOKEN_CONTRACTS must be either issuer-deployed (Circle for USDC/EURC, Tether for mainnet USDT, chain team for canonical native ETH wrappers) or verified on-chain. Community deployments and bridged variants are not first-class. Concrete consequences:

  • USDT testnet is omitted — Tether doesn't run an official testnet program; candidate testnet contracts are community deployments without provenance. USDT support is therefore mainnet-only.
  • WETH on Polygon and Avalanche is omitted — both chains have native non-ETH gas (MATIC, AVAX) and carry "WETH" only as a bridged ERC-20, which is a different trust model.
  • EURC mainnet is shipped only on chains where Circle issues the canonical contract (ethereum, base, avalanche).

Per-token credential-type compatibility

permit2 authorization (EIP-3009) hash
USDC
EURC
WETH
USDT

evm.charge rejects authorization when paired with WETH or USDT at construction time (USDT mainnet uses its own non-standard approve/transferFrom semantics and lacks EIP-3009).

Test plan

  • npm run build — clean
  • npm run lint — clean
  • npm run typecheck — clean
  • npm run test — 82/82 pass (existing chain-expansion tests validate the 6 new testnet entries: chain IDs, USDC addresses, default confirmations, viem mapping, slug coverage, RPC URL shape)
  • Downstream agent-proxy typecheck — clean

Note

Medium Risk
Modifies server-side evm.charge construction to resolve token addresses/decimals and validate credential types, which can change runtime behavior or raise new configuration-time errors for existing integrations. Also expands chain matrices (IDs, slugs, viem mappings, confirmations), increasing the surface area for misconfigured constants.

Overview
Adds 6 new testnet chains (ethereum-sepolia, arbitrum-sepolia, optimism-sepolia, polygon-amoy, scroll-sepolia, linea-sepolia) across the chain matrices (chain IDs, USDC addresses, viem chain mapping, QuickNode slugs, and default confirmations).

Introduces multi-token support via SupportedToken plus new exported lookup tables TOKEN_CONTRACTS, TOKEN_DECIMALS, and TOKEN_CREDENTIAL_TYPES (adding EURC, WETH, and mainnet-only USDT).

Updates server charge() to select the ERC-20 contract/decimals from (token, chain), default credentialTypes per token, and reject unsupported (chain, token) pairs or invalid credential types (e.g., disallowing authorization for tokens without EIP-3009).

Reviewed by Cursor Bugbot for commit 70f6c54. Bugbot is set up for automated code reviews on this repo. Configure here.

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 8bf5696. Configure here.

Comment thread src/server/Charge.ts
@AlejandroFabianCampos AlejandroFabianCampos changed the title feat: add 6 testnets and multi-token support (EURC, WETH) feat: expand chains (+6 testnets) and tokens (+EURC, WETH, USDT) Apr 28, 2026
@AlejandroFabianCampos AlejandroFabianCampos merged commit dd2e0e5 into main Apr 28, 2026
2 checks passed
@AlejandroFabianCampos AlejandroFabianCampos mentioned this pull request Apr 30, 2026
2 tasks
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.

2 participants