Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/wave-c-polygon-hyperliquid-wrapped.md
Original file line number Diff line number Diff line change
@@ -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.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 2 additions & 0 deletions src/chains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
9 changes: 8 additions & 1 deletion src/protocols/wrapped.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
// 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
[Chains.HyperliquidMainnet]: "0x5555555555555555555555555555555555555555",
};

/**
Expand Down
8 changes: 8 additions & 0 deletions tests/catalog.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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", () => {
Expand Down
Loading