From eac0738b915bf8490f70b3afa6e9e4b58266b14b Mon Sep 17 00:00:00 2001 From: xrsv Date: Tue, 19 Nov 2024 14:03:30 -0800 Subject: [PATCH] feat(breaking): support Unichain Mainnet on v2 and v3 (#197) --- sdks/sdk-core/src/addresses.ts | 21 +++++++++++++++++---- sdks/sdk-core/src/chains.ts | 6 ++++-- sdks/sdk-core/src/entities/weth9.ts | 1 + 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/sdks/sdk-core/src/addresses.ts b/sdks/sdk-core/src/addresses.ts index b0badf04a..dbcd084fb 100644 --- a/sdks/sdk-core/src/addresses.ts +++ b/sdks/sdk-core/src/addresses.ts @@ -56,7 +56,8 @@ export const V2_FACTORY_ADDRESSES: AddressMap = { [ChainId.CELO]: '0x79a530c8e2fA8748B7B40dd3629C0520c2cCf03f', [ChainId.BLAST]: '0x5C346464d33F90bABaf70dB6388507CC889C1070', [ChainId.WORLDCHAIN]: '0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f', - [ChainId.ASTROCHAIN_SEPOLIA]: '0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f', + [ChainId.UNICHAIN_SEPOLIA]: '0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f', + [ChainId.UNICHAIN]: '0x1f98400000000000000000000000000000000002', } /** * @deprecated use V2_ROUTER_ADDRESSES instead @@ -74,7 +75,8 @@ export const V2_ROUTER_ADDRESSES: AddressMap = { [ChainId.POLYGON]: '0xedf6066a2b290c185783862c7f4776a2c8077ad1', [ChainId.BLAST]: '0xBB66Eb1c5e875933D44DAe661dbD80e5D9B03035', [ChainId.WORLDCHAIN]: '0x541aB7c31A119441eF3575F6973277DE0eF460bd', - [ChainId.ASTROCHAIN_SEPOLIA]: '0x920b806E40A00E02E7D2b94fFc89860fDaEd3640', + [ChainId.UNICHAIN_SEPOLIA]: '0x920b806E40A00E02E7D2b94fFc89860fDaEd3640', + [ChainId.UNICHAIN]: '0x284f11109359a7e1306c3e447ef14d38400063ff', } // Networks that share most of the same addresses i.e. Mainnet, Goerli, Optimism, Arbitrum, Polygon @@ -277,7 +279,7 @@ const WORLDCHAIN_ADDRESSES: ChainAddresses = { swapRouter02Address: '0x091AD9e2e6e5eD44c1c66dB50e49A601F9f36cF6', } -const ASTROCHAIN_SEPOLIA_ADDRESSES: ChainAddresses = { +const UNICHAIN_SEPOLIA_ADDRESSES: ChainAddresses = { v3CoreFactoryAddress: '0x1F98431c8aD98523631AE4a59f267346ea31F984', multicallAddress: '0x9D0F15f2cf58655fDDcD1EE6129C547fDaeD01b1', quoterAddress: '0x6Dd37329A1A225a6Fca658265D460423DCafBF89', @@ -292,6 +294,16 @@ const ASTROCHAIN_SEPOLIA_ADDRESSES: ChainAddresses = { v4QuoterAddress: '0x2cfa87651D3AB05Bc59E325E5eaC8495CF34cE55', } +const UNICHAIN_ADDRESSES: ChainAddresses = { + v3CoreFactoryAddress: '0x1f98400000000000000000000000000000000003', + multicallAddress: '0xb7610f9b733e7d45184be3a1bc966960ccc54f0b', + quoterAddress: '0x565ac8c7863d9bb16d07e809ff49fe5cd467634c', + v3MigratorAddress: '0xb9d0c246f306b1aaf02ae6ba112d5ef25e5b60dc', + nonfungiblePositionManagerAddress: '0x943e6e07a7e8e791dafc44083e54041d743c46e9', + tickLensAddress: '0xd5d76fa166ab8d8ad4c9f61aaa81457b66cbe443', + swapRouter02Address: '0x73855d06de49d0fe4a9c42636ba96c62da12ff9c', +} + export const CHAIN_TO_ADDRESSES_MAP: Record = { [ChainId.MAINNET]: MAINNET_ADDRESSES, [ChainId.OPTIMISM]: OPTIMISM_ADDRESSES, @@ -316,7 +328,8 @@ export const CHAIN_TO_ADDRESSES_MAP: Record [ChainId.BLAST]: BLAST_ADDRESSES, [ChainId.ZKSYNC]: ZKSYNC_ADDRESSES, [ChainId.WORLDCHAIN]: WORLDCHAIN_ADDRESSES, - [ChainId.ASTROCHAIN_SEPOLIA]: ASTROCHAIN_SEPOLIA_ADDRESSES, + [ChainId.UNICHAIN_SEPOLIA]: UNICHAIN_SEPOLIA_ADDRESSES, + [ChainId.UNICHAIN]: UNICHAIN_ADDRESSES, } /* V3 Contract Addresses */ diff --git a/sdks/sdk-core/src/chains.ts b/sdks/sdk-core/src/chains.ts index f4f4f5f77..2703704c0 100644 --- a/sdks/sdk-core/src/chains.ts +++ b/sdks/sdk-core/src/chains.ts @@ -24,7 +24,8 @@ export enum ChainId { BLAST = 81457, ZKSYNC = 324, WORLDCHAIN = 480, - ASTROCHAIN_SEPOLIA = 1301, + UNICHAIN_SEPOLIA = 1301, + UNICHAIN = 130, } export const SUPPORTED_CHAINS = [ @@ -51,7 +52,8 @@ export const SUPPORTED_CHAINS = [ ChainId.BLAST, ChainId.ZKSYNC, ChainId.WORLDCHAIN, - ChainId.ASTROCHAIN_SEPOLIA, + ChainId.UNICHAIN_SEPOLIA, + ChainId.UNICHAIN, ] as const export type SupportedChainsType = (typeof SUPPORTED_CHAINS)[number] diff --git a/sdks/sdk-core/src/entities/weth9.ts b/sdks/sdk-core/src/entities/weth9.ts index 6a6d01e39..38ecfa11b 100644 --- a/sdks/sdk-core/src/entities/weth9.ts +++ b/sdks/sdk-core/src/entities/weth9.ts @@ -29,4 +29,5 @@ export const WETH9: { [chainId: number]: Token } = { 324: new Token(324, '0x5AEa5775959fBC2557Cc8789bC1bf90A239D9a91', 18, 'WETH', 'Wrapped Ether'), 480: new Token(480, '0x4200000000000000000000000000000000000006', 18, 'WETH', 'Wrapped Ether'), 1301: new Token(1301, '0x4200000000000000000000000000000000000006', 18, 'WETH', 'Wrapped Ether'), + 130: new Token(130, '0x4200000000000000000000000000000000000006', 18, 'WETH', 'Wrapped Ether'), }