-
Notifications
You must be signed in to change notification settings - Fork 12
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
5 changed files
with
32 additions
and
31 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,49 @@ | ||
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' | ||
|
||
// TODO: use addresses from the contracts repo | ||
const VAULT_RELAYER = '0xC92E8bdf79f0507f65a392b0ab4667716BFE0110' | ||
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, | ||
] | ||
|
||
export function mapAddressToSupportedNetworks(address: string): Record<SupportedChainId, 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 = mapAddressToSupportedNetworks(SETTLEMENT_CONTRACT) | ||
|
||
/** | ||
* An object containing the addresses of the CoW Protocol Vault realyer contracts for each supported chain. | ||
*/ | ||
export const COW_PROTOCOL_VAULT_RELAYER_ADDRESS = mapAddressToSupportedNetworks(VAULT_RELAYER) | ||
|
||
/** | ||
* 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 = mapAddressToSupportedNetworks(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 = mapAddressToSupportedNetworks(COMPOSABLE_COW) |
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
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
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