Skip to content

Commit 9ee31cf

Browse files
authored
Merge branch 'safe-global:master' into master
2 parents 88ed189 + 6784417 commit 9ee31cf

11 files changed

+53
-19
lines changed

gnosis/eth/clients/etherscan_client.py

+2
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ class EtherscanClient:
3030
EthereumNetwork.KOVAN: "https://kovan.etherscan.io",
3131
EthereumNetwork.BINANCE_SMART_CHAIN_MAINNET: "https://bscscan.com",
3232
EthereumNetwork.POLYGON: "https://polygonscan.com",
33+
EthereumNetwork.POLYGON_ZKEVM: "https://zkevm.polygonscan.com",
3334
EthereumNetwork.OPTIMISM: "https://optimistic.etherscan.io",
3435
EthereumNetwork.ARBITRUM_ONE: "https://arbiscan.io",
3536
EthereumNetwork.ARBITRUM_NOVA: "https://nova.arbiscan.io",
@@ -53,6 +54,7 @@ class EtherscanClient:
5354
EthereumNetwork.KOVAN: "https://api-kovan.etherscan.io",
5455
EthereumNetwork.BINANCE_SMART_CHAIN_MAINNET: "https://api.bscscan.com",
5556
EthereumNetwork.POLYGON: "https://api.polygonscan.com",
57+
EthereumNetwork.POLYGON_ZKEVM: "https://api-zkevm.polygonscan.com",
5658
EthereumNetwork.OPTIMISM: "https://api-optimistic.etherscan.io",
5759
EthereumNetwork.ARBITRUM_ONE: "https://api.arbiscan.io",
5860
EthereumNetwork.ARBITRUM_NOVA: "https://api-nova.arbiscan.io",

gnosis/eth/ethereum_network.py

+1
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,7 @@ class EthereumNetwork(Enum):
268268
BRONOS_MAINNET = 1039
269269
METIS_ANDROMEDA_MAINNET = 1088
270270
MOAC_MAINNET = 1099
271+
POLYGON_ZKEVM = 1101
271272
WEMIX3_0_MAINNET = 1111
272273
WEMIX3_0_TESTNET = 1112
273274
CORE_BLOCKCHAIN_MAINNET = 1116

gnosis/eth/multicall.py

+1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ class Multicall:
5252
EthereumNetwork.GNOSIS: "0x08612d3C4A5Dfe2FaaFaFe6a4ff712C2dC675bF7",
5353
EthereumNetwork.KCC_MAINNET: "0x7C1C85C39d3D6b6ecB811dfe949B9C23f6E818B0",
5454
EthereumNetwork.KCC_TESTNET: "0x665683D9bd41C09cF38c3956c926D9924F1ADa97",
55+
EthereumNetwork.POLYGON_ZKEVM: "0xcA11bde05977b3631167028862bE2a173976CA11",
5556
}
5657

5758
def __init__(

gnosis/eth/tests/utils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def just_test_if_polygon_node() -> str:
6262
"id": 1,
6363
},
6464
).ok:
65-
pytest.skip("Cannot connect to poylgon node", allow_module_level=True)
65+
pytest.skip("Cannot connect to polygon node", allow_module_level=True)
6666
except IOError:
6767
pytest.skip(
6868
"Problem connecting to the polygon node", allow_module_level=True

gnosis/protocol/gnosis_protocol_api.py

+10-8
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,13 @@ def weth_address(self) -> ChecksumAddress:
7171
"""
7272
:return: Wrapped ether checksummed address
7373
"""
74-
if self.network == EthereumNetwork.MAINNET:
75-
return ChecksumAddress("0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2")
76-
elif self.network == EthereumNetwork.RINKEBY:
77-
return ChecksumAddress("0xc778417E063141139Fce010982780140Aa0cD5Ab")
78-
else: # XDAI
79-
return ChecksumAddress("0x6A023CCd1ff6F2045C3309768eAd9E68F978f6e1")
74+
if self.network == EthereumNetwork.GNOSIS: # WXDAI
75+
return ChecksumAddress("0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d")
76+
if self.network == EthereumNetwork.GOERLI: # Goerli WETH9
77+
return ChecksumAddress("0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6")
78+
79+
# Mainnet WETH9
80+
return ChecksumAddress("0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2")
8081

8182
def get_quote(
8283
self, order: Order, from_address: ChecksumAddress
@@ -129,9 +130,10 @@ def place_order(
129130
from_address = Account.from_key(private_key).address
130131
if not order.feeAmount:
131132
fee_amount = self.get_fee(order, from_address)
132-
if "errorType" in fee_amount: # ErrorResponse
133+
if isinstance(fee_amount, int):
134+
order.feeAmount = fee_amount
135+
elif "errorType" in fee_amount: # ErrorResponse
133136
return fee_amount
134-
order.feeAmount = fee_amount
135137

136138
signable_hash = eip712_encode_hash(
137139
order.get_eip712_structured_data(

gnosis/protocol/tests/test_gnosis_protocol_api.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,7 @@ def test_place_order(self):
151151
)
152152

153153
if type(order_id) is dict:
154-
if order_id["errorType"] == "NoLiquidity":
155-
pytest.xfail("NoLiquidity Error")
156-
157-
self.assertEqual(order_id[:2], "0x")
158-
self.assertEqual(len(order_id), 114)
154+
pytest.xfail(order_id["errorType"])
155+
else:
156+
self.assertEqual(order_id[:2], "0x")
157+
self.assertEqual(len(order_id), 114)

gnosis/safe/addresses.py

+28
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@
7070
("0x3E5c63644E683549055b9Be8653de26E0B4CD36E", 14306478, "1.3.0+L2"),
7171
("0xd9Db270c1B5E3Bd161E8c8503c55cEABeE709552", 14306478, "1.3.0"),
7272
],
73+
EthereumNetwork.POLYGON_ZKEVM: [
74+
("0x3E5c63644E683549055b9Be8653de26E0B4CD36E", 79000, "1.3.0+L2"),
75+
("0xd9Db270c1B5E3Bd161E8c8503c55cEABeE709552", 79000, "1.3.0"),
76+
],
7377
EthereumNetwork.MUMBAI: [
7478
("0x3E5c63644E683549055b9Be8653de26E0B4CD36E", 13736914, "1.3.0+L2"),
7579
("0xd9Db270c1B5E3Bd161E8c8503c55cEABeE709552", 13736914, "1.3.0"),
@@ -268,6 +272,18 @@
268272
("0xfb1bffC9d739B8D520DaF37dF666da4C687191EA", 22172521, "1.3.0+L2"),
269273
("0x69f4D1788e39c87893C980c06EdF4b7f686e2938", 22172524, "1.3.0"),
270274
],
275+
EthereumNetwork.VELAS_EVM_MAINNET: [
276+
("0xfb1bffC9d739B8D520DaF37dF666da4C687191EA", 27572492, "1.3.0+L2"),
277+
("0x69f4D1788e39c87893C980c06EdF4b7f686e2938", 27572642, "1.3.0"),
278+
],
279+
EthereumNetwork.WEMIX3_0_MAINNET: [
280+
("0xfb1bffC9d739B8D520DaF37dF666da4C687191EA", 12651754, "1.3.0+L2"),
281+
("0x69f4D1788e39c87893C980c06EdF4b7f686e2938", 12651757, "1.3.0"),
282+
],
283+
EthereumNetwork.WEMIX3_0_TESTNET: [
284+
("0xfb1bffC9d739B8D520DaF37dF666da4C687191EA", 20834033, "1.3.0+L2"),
285+
("0x69f4D1788e39c87893C980c06EdF4b7f686e2938", 20834039, "1.3.0"),
286+
],
271287
}
272288

273289
PROXY_FACTORIES: Dict[EthereumNetwork, List[Tuple[str, int]]] = {
@@ -314,6 +330,9 @@
314330
EthereumNetwork.MUMBAI: [
315331
("0xa6B71E26C5e0845f74c812102Ca7114b6a896AB2", 13736914), # v1.3.0
316332
],
333+
EthereumNetwork.POLYGON_ZKEVM: [
334+
("0xa6B71E26C5e0845f74c812102Ca7114b6a896AB2", 79000), # v1.3.0
335+
],
317336
EthereumNetwork.ARBITRUM_ONE: [
318337
("0xa6B71E26C5e0845f74c812102Ca7114b6a896AB2", 1140), # v1.3.0
319338
],
@@ -464,4 +483,13 @@
464483
EthereumNetwork.IOTEX_NETWORK_MAINNET: [
465484
("0xC22834581EbC8527d974F8a1c97E1bEA4EF910BC", 22172504), # v1.3.0
466485
],
486+
EthereumNetwork.VELAS_EVM_MAINNET: [
487+
("0xC22834581EbC8527d974F8a1c97E1bEA4EF910BC", 27571962), # v1.3.0
488+
],
489+
EthereumNetwork.WEMIX3_0_MAINNET: [
490+
("0xC22834581EbC8527d974F8a1c97E1bEA4EF910BC", 12651730), # v1.3.0
491+
],
492+
EthereumNetwork.WEMIX3_0_TESTNET: [
493+
("0xC22834581EbC8527d974F8a1c97E1bEA4EF910BC", 20833988), # v1.3.0
494+
],
467495
}

gnosis/safe/safe_signature.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,8 @@ def is_valid(self, ethereum_client: EthereumClient, safe_address: str) -> bool:
250250
).call(block_identifier=block_identifier)
251251
== 1
252252
)
253-
except BadFunctionCallOutput as e: # Error using `pending` block identifier
253+
except (ValueError, BadFunctionCallOutput, DecodingError) as e:
254+
# Error using `pending` block identifier
254255
exception = e
255256
raise exception # This should never happen
256257

requirements-test.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
-r requirements.txt
22
coverage==7.2.3
3-
faker==18.3.2
4-
pytest==7.3.0
3+
faker==18.4.0
4+
pytest==7.3.1
55
pytest-django==4.5.2
66
pytest-env==0.8.1
77
pytest-rerunfailures==11.1.2

requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ django-filter==23.1
33
djangorestframework==3.14.0
44
hexbytes==0.2.3
55
packaging
6-
psycopg2-binary==2.9.5
6+
psycopg2-binary==2.9.6
77
py-evm==0.5.0a3
88
pysha3>=1.0.2
99
requests==2.28.2

setup.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[metadata]
22
name = safe-eth-py
3-
version = 5.1.0
3+
version = 5.2.1
44
description = Safe Ecosystem Foundation utilities for Ethereum projects
55
long_description = file: README.rst
66
long_description_content_type = text/x-rst; charset=UTF-8

0 commit comments

Comments
 (0)