diff --git a/gnosis/eth/clients/etherscan_client.py b/gnosis/eth/clients/etherscan_client.py index cb0c0fe1c..ab36a3915 100644 --- a/gnosis/eth/clients/etherscan_client.py +++ b/gnosis/eth/clients/etherscan_client.py @@ -47,6 +47,7 @@ class EtherscanClient: EthereumNetwork.NEON_EVM_DEVNET: "https://devnet.neonscan.org", EthereumNetwork.NEON_EVM_MAINNET: "https://neonscan.org", EthereumNetwork.SEPOLIA: "https://sepolia.etherscan.io", + EthereumNetwork.ZKSYNC_V2: "https://explorer.zksync.io/", } NETWORK_WITH_API_URL = { @@ -74,6 +75,7 @@ class EtherscanClient: EthereumNetwork.NEON_EVM_DEVNET: "https://devnet-api.neonscan.org", EthereumNetwork.NEON_EVM_MAINNET: "https://api.neonscan.org", EthereumNetwork.SEPOLIA: "https://api-sepolia.etherscan.io", + EthereumNetwork.ZKSYNC_V2: "https://block-explorer-api.mainnet.zksync.io/", } HTTP_HEADERS = { "User-Agent": "curl/7.77.0", diff --git a/gnosis/eth/tests/clients/mocks.py b/gnosis/eth/tests/clients/mocks.py index f80eb2f00..8ad1e6eac 100644 --- a/gnosis/eth/tests/clients/mocks.py +++ b/gnosis/eth/tests/clients/mocks.py @@ -981,6 +981,17 @@ "version": 1, } +etherscan_multisend_abi = [ + {"inputs": [], "stateMutability": "nonpayable", "type": "constructor"}, + { + "inputs": [{"internalType": "bytes", "name": "transactions", "type": "bytes"}], + "name": "multiSend", + "outputs": [], + "stateMutability": "payable", + "type": "function", + }, +] + etherscan_source_code_mock = [ { diff --git a/gnosis/eth/tests/clients/test_etherscan_client.py b/gnosis/eth/tests/clients/test_etherscan_client.py index b96933ef4..227093931 100644 --- a/gnosis/eth/tests/clients/test_etherscan_client.py +++ b/gnosis/eth/tests/clients/test_etherscan_client.py @@ -1,8 +1,10 @@ from django.test import TestCase +import pytest + from ... import EthereumNetwork from ...clients import EtherscanClient, EtherscanRateLimitError -from .mocks import sourcify_safe_metadata +from .mocks import etherscan_multisend_abi, sourcify_safe_metadata class TestEtherscanClient(TestCase): @@ -27,3 +29,12 @@ def test_etherscan_get_abi(self): self.assertIsNone(etherscan_api.get_contract_metadata(random_address)) except EtherscanRateLimitError: self.skipTest("Etherscan rate limit reached") + + @pytest.mark.xfail(reason="Test might fail due to third-party service issues") + def test_etherscan_get_abi_zksync(self): + multisend_address = "0x0dFcccB95225ffB03c6FBB2559B530C2B7C8A912" + etherscan_api = EtherscanClient(EthereumNetwork(324)) + self.assertEqual( + etherscan_api.get_contract_abi(multisend_address), + etherscan_multisend_abi, + )