UPDATE: This works fine on the testnet/mainnet. For some reason the JavascriptVM in remix doesn't like it. If anyone from remix sees this and could lend a hand though!

I wrote some a contract factory code and I'm trying to test it out in the remix browser. I keep getting an invalid opcode error when I run the createContract bit.

contract test{

    function test(address OAddress, bytes32 _name,address _cpty1, address _creator) {



contract Factory {
    address[] public newContracts;
    address public creator;
    address public ID;
    bytes32 public Name;
    modifier onlyOwner{require(msg.sender == creator); _;}
    event Print(address _name, address _value);

    function Factory (bytes32 _Name, address _ID){
        creator = msg.sender;  
        Name = _Name;
        ID = _ID;

    function createContract () payable returns (address){
        address newContract = new test(ID,Name,msg.sender,creator);
        return newContract;
    function withdrawFee() onlyOwner {

It was working last week, but for some reason I get this error now. Any help would be much appreciated.


Looks like there is a problem on the test net again. I have trouble creating new contracts as well. Although they publish on Ropsten (I can see via EtherScan), browser solidity doesn't recognizes them and Metamask gives an contract pubished failed error.

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.