From 06420e85e7f23152525d6bbbd11f0350274eb49e Mon Sep 17 00:00:00 2001 From: shoom3301 Date: Tue, 26 Dec 2023 16:16:36 +0600 Subject: [PATCH] feat: sepolia network --- src/common/chains.ts | 1 + src/common/consts.ts | 40 ++++++++++++++++------------------------ 2 files changed, 17 insertions(+), 24 deletions(-) diff --git a/src/common/chains.ts b/src/common/chains.ts index 80e21698..69b7fd9f 100644 --- a/src/common/chains.ts +++ b/src/common/chains.ts @@ -6,4 +6,5 @@ export enum SupportedChainId { MAINNET = 1, GOERLI = 5, GNOSIS_CHAIN = 100, + SEPOLIA = 11155111, } diff --git a/src/common/consts.ts b/src/common/consts.ts index da014b94..cba962ab 100644 --- a/src/common/consts.ts +++ b/src/common/consts.ts @@ -1,12 +1,11 @@ import { SupportedChainId } from './chains' -import contractNetworks from '@cowprotocol/contracts/networks.json' - -const { GPv2Settlement } = JSON.parse(contractNetworks as unknown as string) as typeof contractNetworks export const BUY_ETH_ADDRESS = '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE' export const EXTENSIBLE_FALLBACK_HANDLER = '0x2f55e8b20D0B9FEFA187AA7d00B6Cbe563605bF5' export const COMPOSABLE_COW = '0xfdaFc9d1902f4e0b84f65F49f244b32b31013b74' +const SETTLEMENT_CONTRACT = '0x9008D19f58AAbD9eD0D60971565AA8510560ab41' + /** * The list of supported chains. */ @@ -14,37 +13,30 @@ export const ALL_SUPPORTED_CHAIN_IDS: SupportedChainId[] = [ SupportedChainId.MAINNET, SupportedChainId.GOERLI, SupportedChainId.GNOSIS_CHAIN, + SupportedChainId.SEPOLIA, ] +const mapAddressToNetworks: (address: string) => Record = (address: string) => { + return ALL_SUPPORTED_CHAIN_IDS.reduce>( + (acc, chainId) => ({ + ...acc, + [chainId]: address, + }), + {} + ) +} + /** * An object containing the addresses of the CoW Protocol settlement contracts for each supported chain. */ -export const COW_PROTOCOL_SETTLEMENT_CONTRACT_ADDRESS = ALL_SUPPORTED_CHAIN_IDS.reduce>( - (acc, chainId) => ({ - ...acc, - [chainId]: GPv2Settlement[chainId].address, - }), - {} -) +export const COW_PROTOCOL_SETTLEMENT_CONTRACT_ADDRESS = mapAddressToNetworks(SETTLEMENT_CONTRACT) /** * An object containing the addresses of the `ExtensibleFallbackHandler` contracts for each supported chain. */ -export const EXTENSIBLE_FALLBACK_HANDLER_CONTRACT_ADDRESS = ALL_SUPPORTED_CHAIN_IDS.reduce>( - (acc, chainId) => ({ - ...acc, - [chainId]: EXTENSIBLE_FALLBACK_HANDLER, - }), - {} -) +export const EXTENSIBLE_FALLBACK_HANDLER_CONTRACT_ADDRESS = mapAddressToNetworks(EXTENSIBLE_FALLBACK_HANDLER) /** * An object containing the addresses of the `ComposableCow` contracts for each supported chain. */ -export const COMPOSABLE_COW_CONTRACT_ADDRESS = ALL_SUPPORTED_CHAIN_IDS.reduce>( - (acc, chainId) => ({ - ...acc, - [chainId]: COMPOSABLE_COW, - }), - {} -) +export const COMPOSABLE_COW_CONTRACT_ADDRESS = mapAddressToNetworks(COMPOSABLE_COW)