-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
17 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,4 +6,5 @@ export enum SupportedChainId { | |
MAINNET = 1, | ||
GOERLI = 5, | ||
GNOSIS_CHAIN = 100, | ||
SEPOLIA = 11155111, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |