Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot handle multiple source code files from Etherscan #947

Closed
4 tasks
kuzdogan opened this issue Mar 6, 2023 · 1 comment · Fixed by #965
Closed
4 tasks

Cannot handle multiple source code files from Etherscan #947

kuzdogan opened this issue Mar 6, 2023 · 1 comment · Fixed by #965
Assignees
Labels
🪲 bug Something isn't working

Comments

@kuzdogan
Copy link
Member

kuzdogan commented Mar 6, 2023

Import from Etherscan fails for the contract: https://etherscan.io/address/0xB753548F6E010e7e680BA186F9Ca1BdAB2E90cf2#code

The reason it seems, that it's neither a single source code file contract, nor a standard-json contract. We are not handling "Solidity Multiple files format" of Etherscan.

TODO:

  • Etherscan Handle Solidity Multiple files format

Add tests for parsing (if does not exist)

  • Single file Etherscan contracts
  • Solidity Multiple files format contracts
  • Standard-json contracts

View in Huly HI-370

@kuzdogan kuzdogan added the 🪲 bug Something isn't working label Mar 6, 2023
@marcocastignoli
Copy link
Member

we already have this:

https://github.com/ethereum/sourcify/blob/3c13af8e5c9af83c449df296b5563dcd54e6d339/src/server/controllers/VerificationController-util.ts#L582..L593

  let solcJsonInput;
  // SourceCode can be the Solidity code if there is only one contract file, or the json object if there are multiple files
  if (contractHasMultipleFiles(sourceCodeObject)) {
    solcJsonInput = parseMultipleFilesContract(sourceCodeObject);
    // Tell compiler to output metadata
    solcJsonInput.settings.outputSelection["*"]["*"] = ["metadata"];
  } else {
    const contractPath = contractResultJson.ContractName + ".sol";
    solcJsonInput = getSolcJsonInputFromEtherscanResult(
      contractResultJson,
      contractPath
    );
  }

@marcocastignoli marcocastignoli self-assigned this Mar 14, 2023
marcocastignoli added a commit that referenced this issue Mar 14, 2023
* add tests
* rename previous etherscan method to standard-json-input
kuzdogan pushed a commit that referenced this issue Mar 14, 2023
* add tests
* rename previous etherscan method to standard-json-input
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🪲 bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants