Skip to content

Commit 8ee622e

Browse files
authored
Merge pull request #277 from GronwD/optimistic
optimistic support
2 parents 69b5650 + 9dcbea3 commit 8ee622e

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

crytic_compile/cryticparser/cryticparser.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,14 @@ def _init_etherscan(parser: ArgumentParser) -> None:
352352
default=DEFAULTS_FLAG_IN_CONFIG["etherscan_api_key"],
353353
)
354354

355+
group_etherscan.add_argument(
356+
"--optim-apikey",
357+
help="Optimistic API key.",
358+
action="store",
359+
dest="optim_api_key",
360+
default=DEFAULTS_FLAG_IN_CONFIG["etherscan_api_key"],
361+
)
362+
355363
group_etherscan.add_argument(
356364
"--etherscan-export-directory",
357365
help="Directory in which to save the analyzed contracts.",

crytic_compile/platform/etherscan.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
SUPPORTED_NETWORK = {
3535
# Key, (prefix_base, perfix_bytecode)
3636
"mainet:": (".etherscan.io", "etherscan.io"),
37+
"optim:": ("-optimistic.etherscan.io", "optimistic.etherscan.io"),
3738
"ropsten:": ("-ropsten.etherscan.io", "ropsten.etherscan.io"),
3839
"kovan:": ("-kovan.etherscan.io", "kovan.etherscan.io"),
3940
"rinkeby:": ("-rinkeby.etherscan.io", "rinkeby.etherscan.io"),
@@ -217,6 +218,7 @@ def compile(self, crytic_compile: "CryticCompile", **kwargs: str) -> None:
217218
avax_api_key = kwargs.get("avax_api_key", None)
218219
ftmscan_api_key = kwargs.get("ftmscan_api_key", None)
219220
bscan_api_key = kwargs.get("bscan_api_key", None)
221+
optim_api_key = kwargs.get("optim_api_key", None)
220222

221223
export_dir = kwargs.get("export_dir", "crytic-export")
222224
export_dir = os.path.join(
@@ -241,6 +243,9 @@ def compile(self, crytic_compile: "CryticCompile", **kwargs: str) -> None:
241243
if bscan_api_key and "bscscan" in etherscan_url:
242244
etherscan_url += f"&apikey={bscan_api_key}"
243245
etherscan_bytecode_url += f"&apikey={bscan_api_key}"
246+
if optim_api_key and "optim" in etherscan_url:
247+
etherscan_url += f"&apikey={optim_api_key}"
248+
etherscan_bytecode_url += f"&apikey={optim_api_key}"
244249

245250
source_code: str = ""
246251
result: Dict[str, Union[bool, str, int]] = {}

0 commit comments

Comments
 (0)