From 1ff7acd0d5b399e3ca98a8b11225ba7c8c3dfb00 Mon Sep 17 00:00:00 2001 From: Hyunduk Shin Date: Tue, 11 Apr 2023 18:38:23 +0900 Subject: [PATCH 01/11] Add WEMIX3.0 Mainnet & Testnet (#500) * Add WEMIX3.0 Mainnet & Testnet * Fix a typo --- gnosis/safe/addresses.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/gnosis/safe/addresses.py b/gnosis/safe/addresses.py index e505d463e..186d15e4f 100644 --- a/gnosis/safe/addresses.py +++ b/gnosis/safe/addresses.py @@ -268,6 +268,14 @@ ("0xfb1bffC9d739B8D520DaF37dF666da4C687191EA", 22172521, "1.3.0+L2"), ("0x69f4D1788e39c87893C980c06EdF4b7f686e2938", 22172524, "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]]] = { @@ -464,4 +472,10 @@ EthereumNetwork.IOTEX_NETWORK_MAINNET: [ ("0xC22834581EbC8527d974F8a1c97E1bEA4EF910BC", 22172504), # v1.3.0 ], + EthereumNetwork.WEMIX3_0_MAINNET: [ + ("0xC22834581EbC8527d974F8a1c97E1bEA4EF910BC", 12651730), # v1.3.0 + ], + EthereumNetwork.WEMIX3_0_TESTNET: [ + ("0xC22834581EbC8527d974F8a1c97E1bEA4EF910BC", 20833988), # v1.3.0 + ], } From 9c906ead55dbc61459db5ca8a779b0a307bbfafa Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 17 Apr 2023 06:59:34 +0000 Subject: [PATCH 02/11] Bump psycopg2-binary from 2.9.5 to 2.9.6 Bumps [psycopg2-binary](https://github.com/psycopg/psycopg2) from 2.9.5 to 2.9.6. - [Release notes](https://github.com/psycopg/psycopg2/releases) - [Changelog](https://github.com/psycopg/psycopg2/blob/master/NEWS) - [Commits](https://github.com/psycopg/psycopg2/commits/2.9.6) --- updated-dependencies: - dependency-name: psycopg2-binary dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 1cf251cb2..c0894ebc7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -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 From be959363b56af8fe9634d54d03c6d9aec388de4f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 17 Apr 2023 06:59:32 +0000 Subject: [PATCH 03/11] Bump faker from 18.3.2 to 18.4.0 Bumps [faker](https://github.com/joke2k/faker) from 18.3.2 to 18.4.0. - [Release notes](https://github.com/joke2k/faker/releases) - [Changelog](https://github.com/joke2k/faker/blob/master/CHANGELOG.md) - [Commits](https://github.com/joke2k/faker/compare/v18.3.2...v18.4.0) --- updated-dependencies: - dependency-name: faker dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- requirements-test.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements-test.txt b/requirements-test.txt index 40f64d985..5b4bf7726 100644 --- a/requirements-test.txt +++ b/requirements-test.txt @@ -1,6 +1,6 @@ -r requirements.txt coverage==7.2.3 -faker==18.3.2 +faker==18.4.0 pytest==7.3.0 pytest-django==4.5.2 pytest-env==0.8.1 From 37a14a792b688956900de4999a8f6ed1ef4ca91c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 17 Apr 2023 09:37:25 +0000 Subject: [PATCH 04/11] Bump pytest from 7.3.0 to 7.3.1 Bumps [pytest](https://github.com/pytest-dev/pytest) from 7.3.0 to 7.3.1. - [Release notes](https://github.com/pytest-dev/pytest/releases) - [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst) - [Commits](https://github.com/pytest-dev/pytest/compare/7.3.0...7.3.1) --- updated-dependencies: - dependency-name: pytest dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- requirements-test.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements-test.txt b/requirements-test.txt index 5b4bf7726..cb68c6f9e 100644 --- a/requirements-test.txt +++ b/requirements-test.txt @@ -1,7 +1,7 @@ -r requirements.txt coverage==7.2.3 faker==18.4.0 -pytest==7.3.0 +pytest==7.3.1 pytest-django==4.5.2 pytest-env==0.8.1 pytest-rerunfailures==11.1.2 From 4aa1b9db83b3de0b59fd32d4f7704dd026c5049b Mon Sep 17 00:00:00 2001 From: Uxio Fuentefria Date: Mon, 17 Apr 2023 11:41:51 +0200 Subject: [PATCH 05/11] Fix error using block identifier as `pending` - Some providers have problems using the `block_identifier=pending` for ethereum RPC calls - Exception thrown can be a `ValueError`, not just a `BadFunctionCallOutput` --- gnosis/safe/safe_signature.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gnosis/safe/safe_signature.py b/gnosis/safe/safe_signature.py index 966ecce2b..c09e31500 100644 --- a/gnosis/safe/safe_signature.py +++ b/gnosis/safe/safe_signature.py @@ -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 From 7ca22b8726788cc506099042a38cb28b3614c2a6 Mon Sep 17 00:00:00 2001 From: Daniel Agustin Tradito Date: Mon, 17 Apr 2023 06:56:47 -0300 Subject: [PATCH 06/11] Add Velas Mainnet & Testnet (#503) --- gnosis/safe/addresses.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/gnosis/safe/addresses.py b/gnosis/safe/addresses.py index 186d15e4f..caa1080a2 100644 --- a/gnosis/safe/addresses.py +++ b/gnosis/safe/addresses.py @@ -268,6 +268,14 @@ ("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.VELAS_EVM_TESTNET: [ + ("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"), @@ -472,6 +480,12 @@ EthereumNetwork.IOTEX_NETWORK_MAINNET: [ ("0xC22834581EbC8527d974F8a1c97E1bEA4EF910BC", 22172504), # v1.3.0 ], + EthereumNetwork.VELAS_EVM_MAINNET: [ + ("0xC22834581EbC8527d974F8a1c97E1bEA4EF910BC", 27571962), # v1.3.0 + ], + EthereumNetwork.VELAS_EVM_TESTNET: [ + ("0xC22834581EbC8527d974F8a1c97E1bEA4EF910BC", 27571962), # v1.3.0 + ], EthereumNetwork.WEMIX3_0_MAINNET: [ ("0xC22834581EbC8527d974F8a1c97E1bEA4EF910BC", 12651730), # v1.3.0 ], From 72721850fdd532ec31af1e46b92321804a0a247a Mon Sep 17 00:00:00 2001 From: Nitin Mittal Date: Sun, 16 Apr 2023 22:58:23 +0400 Subject: [PATCH 07/11] add: polygon zkevm mainnet chain --- gnosis/eth/clients/etherscan_client.py | 2 ++ gnosis/eth/ethereum_network.py | 1 + gnosis/eth/multicall.py | 1 + gnosis/safe/addresses.py | 7 +++++++ 4 files changed, 11 insertions(+) diff --git a/gnosis/eth/clients/etherscan_client.py b/gnosis/eth/clients/etherscan_client.py index d7f2596da..a99eeb3a6 100644 --- a/gnosis/eth/clients/etherscan_client.py +++ b/gnosis/eth/clients/etherscan_client.py @@ -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", @@ -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", diff --git a/gnosis/eth/ethereum_network.py b/gnosis/eth/ethereum_network.py index ec49986da..a1de10398 100644 --- a/gnosis/eth/ethereum_network.py +++ b/gnosis/eth/ethereum_network.py @@ -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 diff --git a/gnosis/eth/multicall.py b/gnosis/eth/multicall.py index 60d0dd636..e3a7f84ac 100644 --- a/gnosis/eth/multicall.py +++ b/gnosis/eth/multicall.py @@ -52,6 +52,7 @@ class Multicall: EthereumNetwork.GNOSIS: "0x08612d3C4A5Dfe2FaaFaFe6a4ff712C2dC675bF7", EthereumNetwork.KCC_MAINNET: "0x7C1C85C39d3D6b6ecB811dfe949B9C23f6E818B0", EthereumNetwork.KCC_TESTNET: "0x665683D9bd41C09cF38c3956c926D9924F1ADa97", + EthereumNetwork.POLYGON_ZKEVM: "0xcA11bde05977b3631167028862bE2a173976CA11", } def __init__( diff --git a/gnosis/safe/addresses.py b/gnosis/safe/addresses.py index caa1080a2..e7c6c8a1e 100644 --- a/gnosis/safe/addresses.py +++ b/gnosis/safe/addresses.py @@ -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"), @@ -330,6 +334,9 @@ EthereumNetwork.MUMBAI: [ ("0xa6B71E26C5e0845f74c812102Ca7114b6a896AB2", 13736914), # v1.3.0 ], + EthereumNetwork.POLYGON_ZKEVM: [ + ("0xa6B71E26C5e0845f74c812102Ca7114b6a896AB2", 79000), # v1.3.0 + ], EthereumNetwork.ARBITRUM_ONE: [ ("0xa6B71E26C5e0845f74c812102Ca7114b6a896AB2", 1140), # v1.3.0 ], From 4ad3bda6d35bc7d5d56ef25fbbccf4d8e81ef7fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ux=C3=ADo?= Date: Mon, 17 Apr 2023 12:57:49 +0200 Subject: [PATCH 08/11] Fix WETH for CowSwap Oracle (Gnosis Chain) (#501) - CowSwap oracle in Gnosis Chain is supposed to use Wrapped XDAI for getting the price, not Wrapped Ether --- gnosis/protocol/gnosis_protocol_api.py | 18 ++++++++++-------- .../protocol/tests/test_gnosis_protocol_api.py | 2 ++ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/gnosis/protocol/gnosis_protocol_api.py b/gnosis/protocol/gnosis_protocol_api.py index 30a01738f..de2ce3d3b 100644 --- a/gnosis/protocol/gnosis_protocol_api.py +++ b/gnosis/protocol/gnosis_protocol_api.py @@ -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 @@ -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( diff --git a/gnosis/protocol/tests/test_gnosis_protocol_api.py b/gnosis/protocol/tests/test_gnosis_protocol_api.py index 78626938d..3c47916a9 100644 --- a/gnosis/protocol/tests/test_gnosis_protocol_api.py +++ b/gnosis/protocol/tests/test_gnosis_protocol_api.py @@ -153,6 +153,8 @@ def test_place_order(self): if type(order_id) is dict: if order_id["errorType"] == "NoLiquidity": pytest.xfail("NoLiquidity Error") + elif order_id["errorType"] == "InsufficientBalance": + pytest.xfail("InsufficientBalance") self.assertEqual(order_id[:2], "0x") self.assertEqual(len(order_id), 114) From 42251ddf4d38dd2c7e7b695ca02136685576386c Mon Sep 17 00:00:00 2001 From: Uxio Fuentefria Date: Fri, 14 Apr 2023 15:15:09 +0200 Subject: [PATCH 09/11] Set version 5.2.0 --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 323e26817..7a58d241a 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = safe-eth-py -version = 5.1.0 +version = 5.2.0 description = Safe Ecosystem Foundation utilities for Ethereum projects long_description = file: README.rst long_description_content_type = text/x-rst; charset=UTF-8 From 43958da0d411cc3ad729d79d0687b8f31df4f9a6 Mon Sep 17 00:00:00 2001 From: Uxio Fuentefria Date: Mon, 17 Apr 2023 13:20:51 +0200 Subject: [PATCH 10/11] Fix cowswap place_order test --- gnosis/eth/tests/utils.py | 2 +- gnosis/protocol/tests/test_gnosis_protocol_api.py | 11 ++++------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/gnosis/eth/tests/utils.py b/gnosis/eth/tests/utils.py index 6cb0547e3..d52c55344 100644 --- a/gnosis/eth/tests/utils.py +++ b/gnosis/eth/tests/utils.py @@ -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 diff --git a/gnosis/protocol/tests/test_gnosis_protocol_api.py b/gnosis/protocol/tests/test_gnosis_protocol_api.py index 3c47916a9..beb6e67b6 100644 --- a/gnosis/protocol/tests/test_gnosis_protocol_api.py +++ b/gnosis/protocol/tests/test_gnosis_protocol_api.py @@ -151,10 +151,7 @@ def test_place_order(self): ) if type(order_id) is dict: - if order_id["errorType"] == "NoLiquidity": - pytest.xfail("NoLiquidity Error") - elif order_id["errorType"] == "InsufficientBalance": - pytest.xfail("InsufficientBalance") - - 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) From 6784417dc6fb95e6cdb7301ff763061521d08610 Mon Sep 17 00:00:00 2001 From: Uxio Fuentefria Date: Mon, 17 Apr 2023 13:55:29 +0200 Subject: [PATCH 11/11] Remove velas testnet - It's not present on https://github.com/ethereum-lists/chains --- gnosis/safe/addresses.py | 7 ------- setup.cfg | 2 +- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/gnosis/safe/addresses.py b/gnosis/safe/addresses.py index e7c6c8a1e..0bc16b3a2 100644 --- a/gnosis/safe/addresses.py +++ b/gnosis/safe/addresses.py @@ -276,10 +276,6 @@ ("0xfb1bffC9d739B8D520DaF37dF666da4C687191EA", 27572492, "1.3.0+L2"), ("0x69f4D1788e39c87893C980c06EdF4b7f686e2938", 27572642, "1.3.0"), ], - EthereumNetwork.VELAS_EVM_TESTNET: [ - ("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"), @@ -490,9 +486,6 @@ EthereumNetwork.VELAS_EVM_MAINNET: [ ("0xC22834581EbC8527d974F8a1c97E1bEA4EF910BC", 27571962), # v1.3.0 ], - EthereumNetwork.VELAS_EVM_TESTNET: [ - ("0xC22834581EbC8527d974F8a1c97E1bEA4EF910BC", 27571962), # v1.3.0 - ], EthereumNetwork.WEMIX3_0_MAINNET: [ ("0xC22834581EbC8527d974F8a1c97E1bEA4EF910BC", 12651730), # v1.3.0 ], diff --git a/setup.cfg b/setup.cfg index 7a58d241a..c0e4b6ca5 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = safe-eth-py -version = 5.2.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