From ebb0d52a289e6f6d2d9f084dd359e309dd824acb Mon Sep 17 00:00:00 2001 From: chrisli30 Date: Wed, 2 Sep 2026 23:52:43 -0700 Subject: [PATCH 1/2] feat: add Polygon (137) and Hyperliquid EVM (999) wrapped natives Map wrapped.weth to WPOL (legacy WMATIC) and WHYPE so SDK Wave C symbol() E2E can pin the canonical native wrapper without magic addresses. No Uniswap/AAVE maps in this change. --- .changeset/wave-c-polygon-hyperliquid-wrapped.md | 5 +++++ README.md | 2 +- src/chains.ts | 2 ++ src/protocols/wrapped.ts | 9 ++++++++- tests/catalog.test.ts | 8 ++++++++ 5 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 .changeset/wave-c-polygon-hyperliquid-wrapped.md diff --git a/.changeset/wave-c-polygon-hyperliquid-wrapped.md b/.changeset/wave-c-polygon-hyperliquid-wrapped.md new file mode 100644 index 0000000..c846167 --- /dev/null +++ b/.changeset/wave-c-polygon-hyperliquid-wrapped.md @@ -0,0 +1,5 @@ +--- +"@avaprotocol/protocols": minor +--- + +Add Polygon PoS (137) and Hyperliquid EVM (999) to `Chains`, and map `wrapped.weth` to the canonical native wrappers: WPOL `0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270` (legacy WMATIC) and WHYPE `0x5555555555555555555555555555555555555555`. No Uniswap/AAVE on HyperEVM in this change; Polygon protocol maps are a follow-up. diff --git a/README.md b/README.md index 37459de..a303f10 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ const sig = Protocols.aaveV3.eventTopics.Borrow; | **Spark** | SparkLend Pool (AAVE V3 fork — reuse AAVE Pool ABI) | Mainnet | | **Superfluid** | CFAv1Forwarder + setFlowrate/createFlow ABI | Mainnet, Base, **BNB** | | **Uniswap V3** | SwapRouter02, QuoterV2, Permit2, Factory, NFT Position Manager, Universal Router + ABIs | Mainnet, Sepolia, **Optimism**, Base, Base Sepolia, **BNB**, **Arbitrum**, **Unichain**, **Robinhood** | -| **Wrapped Ether** | Canonical wrapper of native gas + WETH9 ABI (WBNB on BNB) | Mainnet, Sepolia, **Optimism**, Base, Base Sepolia, **BNB**, **Arbitrum**, **Unichain**, **Robinhood** | +| **Wrapped Ether** | Canonical wrapper of native gas + WETH9 ABI (WBNB on BNB, WPOL on Polygon, WHYPE on Hyperliquid EVM) | Mainnet, Sepolia, **Optimism**, Base, Base Sepolia, **BNB**, **Arbitrum**, **Unichain**, **Robinhood**, **Polygon**, **Hyperliquid** | | **ERC-20** | Standard `approve` ABI fragment | n/a | Shared ABIs (consumed by multiple protocol modules): diff --git a/src/chains.ts b/src/chains.ts index 476ffdd..71c4a22 100644 --- a/src/chains.ts +++ b/src/chains.ts @@ -17,6 +17,8 @@ export const Chains = Object.freeze({ BnbMainnet: 56 as const, ArbitrumOne: 42_161 as const, RobinhoodMainnet: 4_663 as const, + PolygonMainnet: 137 as const, + HyperliquidMainnet: 999 as const, }); export type ChainId = (typeof Chains)[keyof typeof Chains] | number; diff --git a/src/protocols/wrapped.ts b/src/protocols/wrapped.ts index 12dcb46..560c2d2 100644 --- a/src/protocols/wrapped.ts +++ b/src/protocols/wrapped.ts @@ -3,7 +3,8 @@ // Sepolia) this is the WETH9 (or OP-stack predeploy at 0x4200…0006) // contract. On chains with a different native gas token, the field // maps to the equivalent canonical wrapper — e.g. **WBNB** on BNB -// Chain. The field name stays `weth` so chain-agnostic consumers can +// Chain, **WPOL** on Polygon, **WHYPE** on Hyperliquid EVM. The field +// name stays `weth` so chain-agnostic consumers can // write `Protocols.wrapped.weth[chainId]` without branching by chain. // // The bridged-from-Ethereum WETH on BNB @@ -27,6 +28,12 @@ const weth: AddressByChain = { [Chains.UnichainMainnet]: "0x4200000000000000000000000000000000000006", // https://docs.robinhood.com/chain/contracts/ [Chains.RobinhoodMainnet]: "0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73", + // Polygon PoS native is POL. Canonical wrapper is the former WMATIC + // precompile, now WPOL: https://polygonscan.com/token/0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270 + [Chains.PolygonMainnet]: "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270", + // HyperEVM native is HYPE. Canonical WHYPE system contract: + // https://www.hyperscan.com/token/0x5555555555555555555555555555555555555555 + [Chains.HyperliquidMainnet]: "0x5555555555555555555555555555555555555555", }; /** diff --git a/tests/catalog.test.ts b/tests/catalog.test.ts index db18087..217d1bf 100644 --- a/tests/catalog.test.ts +++ b/tests/catalog.test.ts @@ -342,6 +342,14 @@ describe("Uniswap V3 catalog", () => { expect(Protocols.wrapped.weth[Chains.RobinhoodMainnet]).toBe( "0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73", ); + // Polygon WPOL (legacy WMATIC) / HyperEVM WHYPE — native wrappers, + // not bridged ETH. Field name stays `weth` for chain-agnostic callers. + expect(Protocols.wrapped.weth[Chains.PolygonMainnet]).toBe( + "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270", + ); + expect(Protocols.wrapped.weth[Chains.HyperliquidMainnet]).toBe( + "0x5555555555555555555555555555555555555555", + ); }); it("ships exactInputSingle in the SwapRouter02 ABI", () => { From c7570da45dfea607da14a0fd8ffe8662606796ac Mon Sep 17 00:00:00 2001 From: chrisli30 Date: Thu, 3 Sep 2026 00:03:48 -0700 Subject: [PATCH 2/2] docs: call WPOL the former WMATIC contract, not a precompile MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Copilot review on #34: 0x0d500… is a deployed wrapper, not a precompile. --- src/protocols/wrapped.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/protocols/wrapped.ts b/src/protocols/wrapped.ts index 560c2d2..4748c56 100644 --- a/src/protocols/wrapped.ts +++ b/src/protocols/wrapped.ts @@ -29,7 +29,7 @@ const weth: AddressByChain = { // https://docs.robinhood.com/chain/contracts/ [Chains.RobinhoodMainnet]: "0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73", // Polygon PoS native is POL. Canonical wrapper is the former WMATIC - // precompile, now WPOL: https://polygonscan.com/token/0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270 + // contract, now WPOL: https://polygonscan.com/token/0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270 [Chains.PolygonMainnet]: "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270", // HyperEVM native is HYPE. Canonical WHYPE system contract: // https://www.hyperscan.com/token/0x5555555555555555555555555555555555555555