Skip to content

Commit

Permalink
Merge pull request #141 from yohamta/etherscan-loader
Browse files Browse the repository at this point in the history
loaders: Avoid exception when Etherscan returns an empty response
  • Loading branch information
shazow authored Oct 15, 2024
2 parents 715601f + 070d074 commit be0c86f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/loaders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,11 @@ export class EtherscanABILoader implements ABILoader {
throw new Error(r.result); // This gets wrapped below
}

// Status 1 means success, but the result could still be empty
if (r.result.length > 0 && r.result[0].ABI === "Contract source code not verified") {
return emptyContractResult;
}

const result = r.result[0] as EtherscanContractResult;
return {
abi: JSON.parse(result.ABI),
Expand Down

0 comments on commit be0c86f

Please sign in to comment.