Skip to content

Instantly share code, notes, and snippets.



Last active Mar 14, 2017
What would you like to do?
contract TheContractFactory is LiveFactory {
function uploadCode(string identifier, bytes o_code)
returns (bytes32) {
bytes32 h = identifierHash(identifier);
code[h] = o_code;
deployer[h] = msg.sender;
return h;
function deploy(string identifier) {
bytes c = code[identifierHash(identifier)];
if (c.length == 0) throw;
NewContract(deployCode(c), msg.sender, identifier);
function identifierHash(string identifier) returns (bytes32) {
return sha3(identifier);
modifier onlyOrNone(address x) {
if (x != 0x0 && x != msg.sender) throw;
mapping (bytes32 => address) public deployer;
mapping (bytes32 => bytes) public code;
event NewContract(address x, address indexed owner, string identifier);
event NewCode(string identifier);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.