Skip to content

Commit

Permalink
feat: sepolia network
Browse files Browse the repository at this point in the history
  • Loading branch information
shoom3301 committed Dec 26, 2023
1 parent 1dfac8d commit 06420e8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 24 deletions.
1 change: 1 addition & 0 deletions src/common/chains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ export enum SupportedChainId {
MAINNET = 1,
GOERLI = 5,
GNOSIS_CHAIN = 100,
SEPOLIA = 11155111,
}
40 changes: 16 additions & 24 deletions src/common/consts.ts
Original file line number Diff line number Diff line change
@@ -1,50 +1,42 @@
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.
*/
export const ALL_SUPPORTED_CHAIN_IDS: SupportedChainId[] = [
SupportedChainId.MAINNET,
SupportedChainId.GOERLI,
SupportedChainId.GNOSIS_CHAIN,
SupportedChainId.SEPOLIA,
]

const mapAddressToNetworks: (address: string) => Record<SupportedChainId, string> = (address: string) => {
return ALL_SUPPORTED_CHAIN_IDS.reduce<Record<number, string>>(
(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<Record<number, string>>(
(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<Record<number, string>>(
(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<Record<number, string>>(
(acc, chainId) => ({
...acc,
[chainId]: COMPOSABLE_COW,
}),
{}
)
export const COMPOSABLE_COW_CONTRACT_ADDRESS = mapAddressToNetworks(COMPOSABLE_COW)

0 comments on commit 06420e8

Please sign in to comment.