2

Mist 0.8.6, solidity 0.4.2+commit.af6afb04.mod.Emscripten.clang:

I am trying to create a contract within a contract, but the contract created with "new" is not created as contract but as EOA (Address).

Is this a problem of that compiler version or am I doing something wrong?

Simple code example:

pragma solidity ^0.4.2;

  contract ContractB {
    string private name;

    function set_name(string _name) {
      name = _name;
    }

    function get_name() returns(string) {
      return name;
    }
  }

  contract ContractC {
    string private name;

    function set_name(string _name) {
        name = _name;
    }

    function get_name() returns(string) {
        return name;
    }
  }

  contract ContractA {
    ContractB public contractBvar;
    ContractC public contractCvar;

    // Constructor
    function ContractA() {
        contractBvar = new ContractB();
        contractBvar.set_name("contractB");
    }


    function createContractC() {
        contractCvar = new ContractC();
        contractCvar.set_name("contractC");
    }
  }
1

seems morden ist just slow. the problem solved itself after a while. now its a contract account in etherscan: https://testnet.etherscan.io/address/0x0aA0bcdF51502c0f66950707e1D8Ac84Cf6dF3ea

| improve this answer | |

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.