diff --git a/packages/source-fetcher/lib/etherscan.ts b/packages/source-fetcher/lib/etherscan.ts index f2491ca4792..e037c8f0641 100644 --- a/packages/source-fetcher/lib/etherscan.ts +++ b/packages/source-fetcher/lib/etherscan.ts @@ -255,7 +255,13 @@ const EtherscanFetcher: FetcherConstructor = class EtherscanFetcher private static processJsonResult( result: EtherscanResult, jsonInput: Types.SolcInput - ): Types.SourceInfo { + ): Types.SourceInfo | null { + if (jsonInput.language === "SolidityAST") { + //I don't know whether this is actually possible on Etherscan, + //but there's no way we can reasonably handle it, so let's + //just be defensive and refuse it + return null; + } return { contractName: result.ContractName, sources: this.processSources(jsonInput.sources), diff --git a/packages/source-fetcher/lib/types.ts b/packages/source-fetcher/lib/types.ts index bf12986ac16..ae7495106c9 100644 --- a/packages/source-fetcher/lib/types.ts +++ b/packages/source-fetcher/lib/types.ts @@ -101,7 +101,7 @@ export interface SolcSources { } export interface SolcInput { - language: "Solidity"; + language: "Solidity" | "Yul" | "SolidityAST"; sources: SolcSources; settings: SolcSettings; }