From 39f6a0df5f7a714fce0c108bd6e348c62a175683 Mon Sep 17 00:00:00 2001 From: "Ryan R. Fox" Date: Tue, 9 Jun 2026 16:22:51 -0400 Subject: [PATCH] feat(evm): add Mezo mainnet (chain ID 31612) support with mUSD Mezo mainnet launched with the canonical x402 contracts (Permit2 + Exact/Upto proxies) deployed at the same CREATE2 addresses as Base and Mezo testnet, so the SDKs can now offer mUSD as the chain's default stablecoin. Adds the eip155:31612 entry to all three SDK registries (TS DEFAULT_STABLECOINS, Go NetworkConfigs + ChainIDMezo, Python NETWORK_CONFIGS), mirroring the existing eip155:31611 testnet entry with only the token address and chain id differing. Field values were confirmed on-chain via ERC-5267 eip712Domain(): name "Mezo USD", version "1", chainId 31612; decimals()=18; EIP-2612 nonces() present (mUSD lacks EIP-3009, so transfers go through Permit2 with gasless EIP-2612 approval). No faucetUrl: mainnet has no faucet and the paywall faucet UI is testnet-gated. The Go constant is named ChainIDMezo (not ChainIDMezoMainnet) to match the unsuffixed-mainnet convention (ChainIDBase, ChainIDStable, ChainIDRadius, ChainIDHPP). Mainnet entries precede their testnet siblings in every registry, matching the other chain families. gen/decimals.ts is the build:paywall output for the new 18-decimal entry (DEFAULT_ASSETS.md step 3). The nine paywall template bundles were deliberately NOT regenerated: a clean-HEAD rebuild already changes all nine (pre-existing drift on main, likely from a dependency bump after the last regen; check_paywall_template is now workflow_dispatch-only so PRs no longer enforce it), and the client bundles do not embed the decimals map, so they have no functional dependency on this change. Including them would mix ~MB of unrelated minifier churn into a 34-line chain addition. Validation: full TS suite (45 turbo tasks), pytest (1651 passed), go test -race, plus lint/format gates for all three languages, green on base and on this change. Tracked by x4-hyn9fv.4; Python display-amount 6-decimal hardcoding found during review filed as x4-4a6mr8. --- .../add-mezo-mainnet-default-stablecoin.yaml | 2 ++ go/mechanisms/evm/constants.go | 13 +++++++++++++ .../add-mezo-mainnet-default-stablecoin.feature.md | 1 + python/x402/mechanisms/evm/constants.py | 12 ++++++++++++ .../add-mezo-mainnet-default-stablecoin.md | 5 +++++ .../packages/http/paywall/src/evm/gen/decimals.ts | 1 + .../mechanisms/evm/src/shared/defaultAssets.ts | 8 ++++++++ 7 files changed, 42 insertions(+) create mode 100644 go/.changes/unreleased/add-mezo-mainnet-default-stablecoin.yaml create mode 100644 python/x402/changelog.d/add-mezo-mainnet-default-stablecoin.feature.md create mode 100644 typescript/.changeset/add-mezo-mainnet-default-stablecoin.md diff --git a/go/.changes/unreleased/add-mezo-mainnet-default-stablecoin.yaml b/go/.changes/unreleased/add-mezo-mainnet-default-stablecoin.yaml new file mode 100644 index 0000000000..b49d48a904 --- /dev/null +++ b/go/.changes/unreleased/add-mezo-mainnet-default-stablecoin.yaml @@ -0,0 +1,2 @@ +kind: added +body: Add Mezo mainnet (chain ID 31612) support with mUSD as the default stablecoin diff --git a/go/mechanisms/evm/constants.go b/go/mechanisms/evm/constants.go index 876f0fa74f..9f6806966f 100644 --- a/go/mechanisms/evm/constants.go +++ b/go/mechanisms/evm/constants.go @@ -74,6 +74,7 @@ var ( ChainIDBaseSepolia = big.NewInt(84532) ChainIDMegaETH = big.NewInt(4326) ChainIDMonad = big.NewInt(143) + ChainIDMezo = big.NewInt(31612) ChainIDMezoTestnet = big.NewInt(31611) ChainIDStable = big.NewInt(988) ChainIDStableTestnet = big.NewInt(2201) @@ -140,6 +141,18 @@ var ( Decimals: DefaultDecimals, }, }, + // Mezo Mainnet (uses Permit2 instead of EIP-3009, supports EIP-2612) + "eip155:31612": { + ChainID: ChainIDMezo, + DefaultAsset: AssetInfo{ + Address: "0xdD468A1DDc392dcdbEf6db6e34E89AA338F9F186", // mUSD on Mezo + Name: "Mezo USD", + Version: "1", + Decimals: 18, + AssetTransferMethod: AssetTransferMethodPermit2, + SupportsEip2612: true, + }, + }, // Mezo Testnet (uses Permit2 instead of EIP-3009, supports EIP-2612) "eip155:31611": { ChainID: ChainIDMezoTestnet, diff --git a/python/x402/changelog.d/add-mezo-mainnet-default-stablecoin.feature.md b/python/x402/changelog.d/add-mezo-mainnet-default-stablecoin.feature.md new file mode 100644 index 0000000000..35c4c48b10 --- /dev/null +++ b/python/x402/changelog.d/add-mezo-mainnet-default-stablecoin.feature.md @@ -0,0 +1 @@ +Add Mezo mainnet (chain ID 31612) support with mUSD as the default stablecoin diff --git a/python/x402/mechanisms/evm/constants.py b/python/x402/mechanisms/evm/constants.py index da96e45c27..b872acfa86 100644 --- a/python/x402/mechanisms/evm/constants.py +++ b/python/x402/mechanisms/evm/constants.py @@ -442,6 +442,18 @@ class NetworkConfig(_NetworkConfigRequired, total=False): "decimals": 6, }, }, + # Mezo Mainnet (uses Permit2 instead of EIP-3009, supports EIP-2612) + "eip155:31612": { + "chain_id": 31612, + "default_asset": { + "address": "0xdD468A1DDc392dcdbEf6db6e34E89AA338F9F186", + "name": "Mezo USD", + "version": "1", + "decimals": 18, + "asset_transfer_method": "permit2", + "supports_eip2612": True, + }, + }, # Mezo Testnet (uses Permit2 instead of EIP-3009, supports EIP-2612) "eip155:31611": { "chain_id": 31611, diff --git a/typescript/.changeset/add-mezo-mainnet-default-stablecoin.md b/typescript/.changeset/add-mezo-mainnet-default-stablecoin.md new file mode 100644 index 0000000000..57b088aa43 --- /dev/null +++ b/typescript/.changeset/add-mezo-mainnet-default-stablecoin.md @@ -0,0 +1,5 @@ +--- +"@x402/evm": minor +--- + +Add Mezo mainnet (chain ID 31612) support with mUSD as the default stablecoin diff --git a/typescript/packages/http/paywall/src/evm/gen/decimals.ts b/typescript/packages/http/paywall/src/evm/gen/decimals.ts index a69f55f0c1..cbbd6c4af6 100644 --- a/typescript/packages/http/paywall/src/evm/gen/decimals.ts +++ b/typescript/packages/http/paywall/src/evm/gen/decimals.ts @@ -10,5 +10,6 @@ */ export const NETWORK_DECIMALS: Record = { "eip155:31611": 18, + "eip155:31612": 18, "eip155:4326": 18, }; diff --git a/typescript/packages/mechanisms/evm/src/shared/defaultAssets.ts b/typescript/packages/mechanisms/evm/src/shared/defaultAssets.ts index 834a2d98f0..60be6d9dfc 100644 --- a/typescript/packages/mechanisms/evm/src/shared/defaultAssets.ts +++ b/typescript/packages/mechanisms/evm/src/shared/defaultAssets.ts @@ -97,6 +97,14 @@ export const DEFAULT_STABLECOINS: Record = { version: "2", decimals: 6, }, // Arbitrum Sepolia USDC + "eip155:31612": { + address: "0xdD468A1DDc392dcdbEf6db6e34E89AA338F9F186", + name: "Mezo USD", + version: "1", + decimals: 18, + assetTransferMethod: "permit2", + supportsEip2612: true, + }, // Mezo mainnet mUSD (no EIP-3009, supports EIP-2612) "eip155:31611": { address: "0x118917a40FAF1CD7a13dB0Ef56C86De7973Ac503", name: "Mezo USD",