Skip to content

Commit

Permalink
Merge branch 'safe-global:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
ElvisKrop authored Apr 20, 2023
2 parents 88ed189 + 6784417 commit 9ee31cf
Show file tree
Hide file tree
Showing 11 changed files with 53 additions and 19 deletions.
2 changes: 2 additions & 0 deletions gnosis/eth/clients/etherscan_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class EtherscanClient:
EthereumNetwork.KOVAN: "https://kovan.etherscan.io",
EthereumNetwork.BINANCE_SMART_CHAIN_MAINNET: "https://bscscan.com",
EthereumNetwork.POLYGON: "https://polygonscan.com",
EthereumNetwork.POLYGON_ZKEVM: "https://zkevm.polygonscan.com",
EthereumNetwork.OPTIMISM: "https://optimistic.etherscan.io",
EthereumNetwork.ARBITRUM_ONE: "https://arbiscan.io",
EthereumNetwork.ARBITRUM_NOVA: "https://nova.arbiscan.io",
Expand All @@ -53,6 +54,7 @@ class EtherscanClient:
EthereumNetwork.KOVAN: "https://api-kovan.etherscan.io",
EthereumNetwork.BINANCE_SMART_CHAIN_MAINNET: "https://api.bscscan.com",
EthereumNetwork.POLYGON: "https://api.polygonscan.com",
EthereumNetwork.POLYGON_ZKEVM: "https://api-zkevm.polygonscan.com",
EthereumNetwork.OPTIMISM: "https://api-optimistic.etherscan.io",
EthereumNetwork.ARBITRUM_ONE: "https://api.arbiscan.io",
EthereumNetwork.ARBITRUM_NOVA: "https://api-nova.arbiscan.io",
Expand Down
1 change: 1 addition & 0 deletions gnosis/eth/ethereum_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ class EthereumNetwork(Enum):
BRONOS_MAINNET = 1039
METIS_ANDROMEDA_MAINNET = 1088
MOAC_MAINNET = 1099
POLYGON_ZKEVM = 1101
WEMIX3_0_MAINNET = 1111
WEMIX3_0_TESTNET = 1112
CORE_BLOCKCHAIN_MAINNET = 1116
Expand Down
1 change: 1 addition & 0 deletions gnosis/eth/multicall.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class Multicall:
EthereumNetwork.GNOSIS: "0x08612d3C4A5Dfe2FaaFaFe6a4ff712C2dC675bF7",
EthereumNetwork.KCC_MAINNET: "0x7C1C85C39d3D6b6ecB811dfe949B9C23f6E818B0",
EthereumNetwork.KCC_TESTNET: "0x665683D9bd41C09cF38c3956c926D9924F1ADa97",
EthereumNetwork.POLYGON_ZKEVM: "0xcA11bde05977b3631167028862bE2a173976CA11",
}

def __init__(
Expand Down
2 changes: 1 addition & 1 deletion gnosis/eth/tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def just_test_if_polygon_node() -> str:
"id": 1,
},
).ok:
pytest.skip("Cannot connect to poylgon node", allow_module_level=True)
pytest.skip("Cannot connect to polygon node", allow_module_level=True)
except IOError:
pytest.skip(
"Problem connecting to the polygon node", allow_module_level=True
Expand Down
18 changes: 10 additions & 8 deletions gnosis/protocol/gnosis_protocol_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,13 @@ def weth_address(self) -> ChecksumAddress:
"""
:return: Wrapped ether checksummed address
"""
if self.network == EthereumNetwork.MAINNET:
return ChecksumAddress("0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2")
elif self.network == EthereumNetwork.RINKEBY:
return ChecksumAddress("0xc778417E063141139Fce010982780140Aa0cD5Ab")
else: # XDAI
return ChecksumAddress("0x6A023CCd1ff6F2045C3309768eAd9E68F978f6e1")
if self.network == EthereumNetwork.GNOSIS: # WXDAI
return ChecksumAddress("0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d")
if self.network == EthereumNetwork.GOERLI: # Goerli WETH9
return ChecksumAddress("0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6")

# Mainnet WETH9
return ChecksumAddress("0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2")

def get_quote(
self, order: Order, from_address: ChecksumAddress
Expand Down Expand Up @@ -129,9 +130,10 @@ def place_order(
from_address = Account.from_key(private_key).address
if not order.feeAmount:
fee_amount = self.get_fee(order, from_address)
if "errorType" in fee_amount: # ErrorResponse
if isinstance(fee_amount, int):
order.feeAmount = fee_amount
elif "errorType" in fee_amount: # ErrorResponse
return fee_amount
order.feeAmount = fee_amount

signable_hash = eip712_encode_hash(
order.get_eip712_structured_data(
Expand Down
9 changes: 4 additions & 5 deletions gnosis/protocol/tests/test_gnosis_protocol_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,7 @@ def test_place_order(self):
)

if type(order_id) is dict:
if order_id["errorType"] == "NoLiquidity":
pytest.xfail("NoLiquidity Error")

self.assertEqual(order_id[:2], "0x")
self.assertEqual(len(order_id), 114)
pytest.xfail(order_id["errorType"])
else:
self.assertEqual(order_id[:2], "0x")
self.assertEqual(len(order_id), 114)
28 changes: 28 additions & 0 deletions gnosis/safe/addresses.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@
("0x3E5c63644E683549055b9Be8653de26E0B4CD36E", 14306478, "1.3.0+L2"),
("0xd9Db270c1B5E3Bd161E8c8503c55cEABeE709552", 14306478, "1.3.0"),
],
EthereumNetwork.POLYGON_ZKEVM: [
("0x3E5c63644E683549055b9Be8653de26E0B4CD36E", 79000, "1.3.0+L2"),
("0xd9Db270c1B5E3Bd161E8c8503c55cEABeE709552", 79000, "1.3.0"),
],
EthereumNetwork.MUMBAI: [
("0x3E5c63644E683549055b9Be8653de26E0B4CD36E", 13736914, "1.3.0+L2"),
("0xd9Db270c1B5E3Bd161E8c8503c55cEABeE709552", 13736914, "1.3.0"),
Expand Down Expand Up @@ -268,6 +272,18 @@
("0xfb1bffC9d739B8D520DaF37dF666da4C687191EA", 22172521, "1.3.0+L2"),
("0x69f4D1788e39c87893C980c06EdF4b7f686e2938", 22172524, "1.3.0"),
],
EthereumNetwork.VELAS_EVM_MAINNET: [
("0xfb1bffC9d739B8D520DaF37dF666da4C687191EA", 27572492, "1.3.0+L2"),
("0x69f4D1788e39c87893C980c06EdF4b7f686e2938", 27572642, "1.3.0"),
],
EthereumNetwork.WEMIX3_0_MAINNET: [
("0xfb1bffC9d739B8D520DaF37dF666da4C687191EA", 12651754, "1.3.0+L2"),
("0x69f4D1788e39c87893C980c06EdF4b7f686e2938", 12651757, "1.3.0"),
],
EthereumNetwork.WEMIX3_0_TESTNET: [
("0xfb1bffC9d739B8D520DaF37dF666da4C687191EA", 20834033, "1.3.0+L2"),
("0x69f4D1788e39c87893C980c06EdF4b7f686e2938", 20834039, "1.3.0"),
],
}

PROXY_FACTORIES: Dict[EthereumNetwork, List[Tuple[str, int]]] = {
Expand Down Expand Up @@ -314,6 +330,9 @@
EthereumNetwork.MUMBAI: [
("0xa6B71E26C5e0845f74c812102Ca7114b6a896AB2", 13736914), # v1.3.0
],
EthereumNetwork.POLYGON_ZKEVM: [
("0xa6B71E26C5e0845f74c812102Ca7114b6a896AB2", 79000), # v1.3.0
],
EthereumNetwork.ARBITRUM_ONE: [
("0xa6B71E26C5e0845f74c812102Ca7114b6a896AB2", 1140), # v1.3.0
],
Expand Down Expand Up @@ -464,4 +483,13 @@
EthereumNetwork.IOTEX_NETWORK_MAINNET: [
("0xC22834581EbC8527d974F8a1c97E1bEA4EF910BC", 22172504), # v1.3.0
],
EthereumNetwork.VELAS_EVM_MAINNET: [
("0xC22834581EbC8527d974F8a1c97E1bEA4EF910BC", 27571962), # v1.3.0
],
EthereumNetwork.WEMIX3_0_MAINNET: [
("0xC22834581EbC8527d974F8a1c97E1bEA4EF910BC", 12651730), # v1.3.0
],
EthereumNetwork.WEMIX3_0_TESTNET: [
("0xC22834581EbC8527d974F8a1c97E1bEA4EF910BC", 20833988), # v1.3.0
],
}
3 changes: 2 additions & 1 deletion gnosis/safe/safe_signature.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,8 @@ def is_valid(self, ethereum_client: EthereumClient, safe_address: str) -> bool:
).call(block_identifier=block_identifier)
== 1
)
except BadFunctionCallOutput as e: # Error using `pending` block identifier
except (ValueError, BadFunctionCallOutput, DecodingError) as e:
# Error using `pending` block identifier
exception = e
raise exception # This should never happen

Expand Down
4 changes: 2 additions & 2 deletions requirements-test.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
-r requirements.txt
coverage==7.2.3
faker==18.3.2
pytest==7.3.0
faker==18.4.0
pytest==7.3.1
pytest-django==4.5.2
pytest-env==0.8.1
pytest-rerunfailures==11.1.2
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ django-filter==23.1
djangorestframework==3.14.0
hexbytes==0.2.3
packaging
psycopg2-binary==2.9.5
psycopg2-binary==2.9.6
py-evm==0.5.0a3
pysha3>=1.0.2
requests==2.28.2
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = safe-eth-py
version = 5.1.0
version = 5.2.1
description = Safe Ecosystem Foundation utilities for Ethereum projects
long_description = file: README.rst
long_description_content_type = text/x-rst; charset=UTF-8
Expand Down

0 comments on commit 9ee31cf

Please sign in to comment.