Skip to content

Commit

Permalink
fix: improve version id
Browse files Browse the repository at this point in the history
  • Loading branch information
antazoey committed Feb 2, 2024
1 parent 05bfb6a commit b92eb42
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion ape_etherscan/dependency.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def handle_int(cls, value):

@property
def version_id(self) -> str:
return "etherscan" # Only 1 version
return f"{self.ecosystem}_{self.network}"

@property
def address(self) -> AddressType:
Expand Down
9 changes: 6 additions & 3 deletions tests/test_dependency.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,19 @@
],
)
def test_dependency(mock_backend, verification_type, expected_name, contract_address):
mock_backend.set_network("ethereum", "mainnet")
ecosystem = "ethereum"
network = "mainnet"
mock_backend.set_network(ecosystem, network)
mock_backend.setup_mock_get_contract_type_response(f"get_contract_response_{verification_type}")

dependency = EtherscanDependency(
name="Apes",
etherscan=contract_address,
ecosystem="ethereum",
network="mainnet",
ecosystem=ecosystem,
network=network,
)
actual = dependency.extract_manifest()
assert dependency.version_id == f"{ecosystem}_{network}"
assert f"{expected_name}.sol" in actual.sources
assert actual.compilers[0].name == "Solidity"
assert not actual.compilers[0].settings["optimizer"]["enabled"]
Expand Down

0 comments on commit b92eb42

Please sign in to comment.