forked from cowdao-grants/cow-py
-
Notifications
You must be signed in to change notification settings - Fork 2
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
1 parent
6af0426
commit e3dd4e7
Showing
3 changed files
with
23 additions
and
16 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 |
---|---|---|
@@ -1,34 +1,41 @@ | ||
from enum import Enum | ||
from typing import Dict | ||
from .chains import Chain | ||
|
||
""" | ||
This module contains constants and functions related to the CoW Protocol. It provides mappings of | ||
the main CoW contract addresses to CoW's supported networks. | ||
""" | ||
|
||
BUY_ETH_ADDRESS = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE" | ||
|
||
VAULT_RELAYER = "0xC92E8bdf79f0507f65a392b0ab4667716BFE0110" | ||
COMPOSABLE_COW = "0xfdaFc9d1902f4e0b84f65F49f244b32b31013b74" | ||
SETTLEMENT_CONTRACT = "0x9008D19f58AAbD9eD0D60971565AA8510560ab41" | ||
EXTENSIBLE_FALLBACK_HANDLER = "0x2f55e8b20D0B9FEFA187AA7d00B6Cbe563605bF5" | ||
|
||
class CowContractAddress(Enum): | ||
VAULT_RELAYER = "0xC92E8bdf79f0507f65a392b0ab4667716BFE0110" | ||
COMPOSABLE_COW = "0xfdaFc9d1902f4e0b84f65F49f244b32b31013b74" | ||
SETTLEMENT_CONTRACT = "0x9008D19f58AAbD9eD0D60971565AA8510560ab41" | ||
EXTENSIBLE_FALLBACK_HANDLER = "0x2f55e8b20D0B9FEFA187AA7d00B6Cbe563605bF5" | ||
|
||
|
||
def map_address_to_supported_networks(address: str) -> Dict[Chain, str]: | ||
""" | ||
Maps a given address to all supported networks. | ||
:param address: The address to be mapped. | ||
:return: A dictionary mapping the address to each supported chain. | ||
""" | ||
return {chain_id: address for chain_id in Chain} | ||
|
||
|
||
""" An object containing the addresses of the CoW Protocol settlement contracts for each supported chain. """ | ||
COW_PROTOCOL_SETTLEMENT_CONTRACT_CHAIN_ADDRESS_MAP = map_address_to_supported_networks( | ||
SETTLEMENT_CONTRACT | ||
CowContractAddress.SETTLEMENT_CONTRACT | ||
) | ||
|
||
""" An object containing the addresses of the CoW Protocol Vault relayer contracts for each supported chain. """ | ||
COW_PROTOCOL_VAULT_RELAYER_CHAIN_ADDRESS_MAP = map_address_to_supported_networks( | ||
VAULT_RELAYER | ||
CowContractAddress.VAULT_RELAYER | ||
) | ||
|
||
""" An object containing the addresses of the `ExtensibleFallbackHandler` contracts for each supported chain. """ | ||
EXTENSIBLE_FALLBACK_HANDLER_CONTRACT_CHAIN_ADDRESS_MAP = ( | ||
map_address_to_supported_networks(EXTENSIBLE_FALLBACK_HANDLER) | ||
map_address_to_supported_networks(CowContractAddress.EXTENSIBLE_FALLBACK_HANDLER) | ||
) | ||
|
||
""" An object containing the addresses of the `ComposableCow` contracts for each supported chain. """ | ||
COMPOSABLE_COW_CONTRACT_CHAIN_ADDRESS_MAP = map_address_to_supported_networks( | ||
COMPOSABLE_COW | ||
CowContractAddress.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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ | |
|
||
import httpx | ||
|
||
|
||
class GraphQLError(Exception): | ||
pass | ||
|
||
|
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