Skip to content

Commit

Permalink
fix: omit commit from vyper version
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielSchiavini committed Nov 13, 2024
1 parent 715c6b9 commit a83112e
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions boa/explorer.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import re
import time
from dataclasses import dataclass
from datetime import timedelta
Expand Down Expand Up @@ -29,6 +30,7 @@ def filter_fn(response):
SESSION = Session()

DEFAULT_ETHERSCAN_URI = "https://api.etherscan.io/api"
VERSION_RE = re.compile(r"v(\d+\.\d+\.\d+)(\+commit.*)?")


@dataclass
Expand Down Expand Up @@ -62,6 +64,11 @@ def verify(
api_key = self.api_key or ""
output_selection = solc_json["settings"]["outputSelection"]
contract_file = next(k for k, v in output_selection.items() if "*" in v)
compiler_version = solc_json["compiler_version"]
version_match = re.match(VERSION_RE, compiler_version)
if not version_match:
raise ValueError(f"Failed to extract Vyper version from {compiler_version}")

data = {
"module": "contract",
"action": "verifysourcecode",
Expand All @@ -72,7 +79,7 @@ def verify(
"constructorArguments": constructor_calldata.hex(),
"contractaddress": address,
"contractname": f"{contract_file}:{contract_name}",
"compilerversion": f"vyper:{solc_json['compiler_version'][1:]}",
"compilerversion": f"vyper:{version_match.group(1)}",
"licenseType": license_type,
"optimizationUsed": "1",
}
Expand All @@ -95,7 +102,7 @@ def verification_created():
return None

identifier = _wait_until(
verification_created, timedelta(seconds=30), timedelta(seconds=5), 1.1
verification_created, timedelta(minutes=2), timedelta(seconds=5), 1.1
)
print(f"Verification started with identifier {identifier}")
if not wait:
Expand Down

0 comments on commit a83112e

Please sign in to comment.