From 526822e66123a752251c1e148c90e7d73ab633a0 Mon Sep 17 00:00:00 2001 From: Miro Kuratczyk Date: Tue, 27 Jan 2026 15:06:37 -0500 Subject: [PATCH 1/2] Fix: nil err returned as err --- engine/cld/legacy/cli/commands/evm_helper.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/cld/legacy/cli/commands/evm_helper.go b/engine/cld/legacy/cli/commands/evm_helper.go index caae1d07..4321dc52 100644 --- a/engine/cld/legacy/cli/commands/evm_helper.go +++ b/engine/cld/legacy/cli/commands/evm_helper.go @@ -97,7 +97,7 @@ func GetContractCreationTx(ctx context.Context, endpoint string, addressStr stri } // If API call failed due to reasons other than action unsupported, there is no fallback. if !strings.Contains(errMsg, "invalid Action name") { - return "", err + return "", fmt.Errorf("failed to get contract creation tx: %s", errMsg) } return GetContractCreationTxFallback(ctx, endpoint, addressStr, apiKey) From 17a2e165137c99c961f3056d61984668ee31f303 Mon Sep 17 00:00:00 2001 From: Miro Kuratczyk Date: Tue, 27 Jan 2026 15:57:07 -0500 Subject: [PATCH 2/2] Fix: etherscan V1 API deprecated; add V2 support --- engine/cld/legacy/cli/commands/evm_helper.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/engine/cld/legacy/cli/commands/evm_helper.go b/engine/cld/legacy/cli/commands/evm_helper.go index 4321dc52..28030fd7 100644 --- a/engine/cld/legacy/cli/commands/evm_helper.go +++ b/engine/cld/legacy/cli/commands/evm_helper.go @@ -54,8 +54,8 @@ type ContractCreationResult struct { // GetContractCreationTx finds contract creation tx by querying getcontractcreation action. // It is a short-cut provided by most Etherscan instances. -func GetContractCreationTx(ctx context.Context, endpoint string, addressStr string, apiKey string) (string, error) { - url := fmt.Sprintf("%s?module=contract&action=getcontractcreation&contractaddresses=%s&apikey=%s", endpoint, addressStr, apiKey) +func GetContractCreationTx(ctx context.Context, endpoint string, chainIDStr, addressStr string, apiKey string) (string, error) { + url := fmt.Sprintf("%s?chainid=%s&module=contract&action=getcontractcreation&contractaddresses=%s&apikey=%s", endpoint, chainIDStr, addressStr, apiKey) ctx, cancel := context.WithTimeout(ctx, etherscanTimeout) defer cancel() @@ -187,7 +187,7 @@ func buildContractVerifyCmd( } cmd := []string{ - "forge", "contract verify", "--watch", + "forge", "verify-contract", "--watch", "--compiler-version", compilerVersion, "--optimizer-runs", strconv.FormatUint(optimizerRuns, 10), "--chain-id", chainID, @@ -273,7 +273,7 @@ func verifyContract( lggr.Infof("contract %s is already verified", contractAddress) return nil } - contractCreationTx, err := GetContractCreationTx(ctx, explorer.URL, contractAddress, explorer.APIKey) + contractCreationTx, err := GetContractCreationTx(ctx, explorer.URL, chainID, contractAddress, explorer.APIKey) if err != nil { return fmt.Errorf("failed to get contract creation tx: %w", err) }