I've been using this technique to create new contracts.
contract Factory {
bytes32[] Names;
address[] newContracts;
function createContract (bytes32 name) {
address newContract = new Contract(name);
newContracts.push(newContract);
}
function getName (uint i) {
Contract con = Contract(newContracts[i]);
Names[i] = con.Name();
}
}
contract Contract {
bytes32 public Name;
function Contract (bytes32 name) {
Name = name;
}
}
But This doesn't work for my current contract. It exceeds the gaslimit on ropsten if deployed together. How can I create contracts by using their contract address or abi? It must be possible to create larger contracts somehow right?
Edit: It's also so strange that the created contract is much bigger than the "Factory" contract. And the created contract can be deployed fine on its own, whereas the factory is not possible. Why? Does a factory take much more code?
Here is the code (I have very little comments): https://gist.github.com/anonymous/91dbd8614331b57c1d1bf371195dc9d3