address[] child;

function createChildContract() onlyOwner public{
    address newChild = new Child(msg.sender);
    emit ChildCreated(newChild);

contract Child {
   address public owner;

constructor(address _owner) public{
    owner = _owner;

function getOwner() external view returns(address){
    return owner;

I can make child contracts with this code in testnet but in mainnet it dosen't work.

Does mainnet just impossible to create child contract? or my code is wrong?

  • You didn't paste all the code. Feb 11 '19 at 10:01
  • What is the error you get in mainnet? Feb 11 '19 at 10:08
  • There is no errors etherscan.io/address/0x486f7112a03e622af4619732a20b07b12a003159 transaction is success but there is no event and child variable is empty @LauriPeltonen
    – Drin
    Feb 11 '19 at 10:11
  • @PeterPrographo Sorry im new here i don't know how to paste code
    – Drin
    Feb 11 '19 at 10:15
  • 1
    None of your mainnet transaction contain any data (except contract creation). You are calling the contract wrong. Feb 11 '19 at 10:20

Your transactions to the contract show that you aren't including any tx data, meaning you aren't calling createChildContract.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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