0

This question already has an answer here:

I'm having difficulties verifying a contract on etherscan which has been deployed through the means of using another contract. The issue is in regards to match the input creation byte code with what I'm pasting into the code form on etherscan.

If contract C who inherits contract A and contract B, and then internally creates a contract D, how many of those contracts are than used for input bytecode creation of contract D?

marked as duplicate by ReyHaynes, Achala Dissanayake, mirg, CPereez19, Thomas Jay Rush May 31 '18 at 9:43

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • In that thread the contract generation is done through the constructor, but what if this is done through a function? – NowsyMe May 29 '18 at 15:11
0

The bytecode of contract D depends on D itself and anything it, itself, inherits. By deduction, it will be compiled with the same compiler version as contract C which is a factory doing the deployment.

Contract C populates any constructor arguments. For code verification purposes, it will be important to match the code inherited by contract D, the compiler version and optimization choice, and the constructor arguments which you have to ABI-encode.

Hope it helps.

  • what if the contract generation with constructor arguments of the new contract D is declared through a function call from contract C? does the ABI-encoding process remain the same? – NowsyMe May 29 '18 at 16:22
  • Yes. You have to reconstruct the arguments D received from C in order to verify D. Treat is if the EVM and the validation process is indifferent to the nature of the deployer. – Rob Hitchens - B9lab May 29 '18 at 17:12
  • been trying for hours now, it just seems not to work. Verifying everything else is working fine, but inner contract don't seem to work for me – NowsyMe May 29 '18 at 17:33

Not the answer you're looking for? Browse other questions tagged or ask your own question.