From 9cac126caa279e63b2f2ead76f1055f7de40a2b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20L=C3=B3pez?= Date: Sat, 26 Oct 2024 16:57:39 +0200 Subject: [PATCH] platform: etherscan: support ETHERSCAN_API_KEY environment variable Fixes #567 --- crytic_compile/platform/etherscan.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/crytic_compile/platform/etherscan.py b/crytic_compile/platform/etherscan.py index 5904c4c..21c0b44 100644 --- a/crytic_compile/platform/etherscan.py +++ b/crytic_compile/platform/etherscan.py @@ -312,6 +312,8 @@ def compile(self, crytic_compile: "CryticCompile", **kwargs: str) -> None: only_bytecode = kwargs.get("etherscan_only_bytecode", False) etherscan_api_key = kwargs.get("etherscan_api_key", None) + if etherscan_api_key is None: + etherscan_api_key = os.getenv("ETHERSCAN_API_KEY") export_dir = kwargs.get("export_dir", "crytic-export") export_dir = os.path.join(