Skip to content

Instantly share code, notes, and snippets.

@izqui
Last active March 14, 2017 11:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save izqui/86ccef492398099ce9be6066309cc20f to your computer and use it in GitHub Desktop.
Save izqui/86ccef492398099ce9be6066309cc20f to your computer and use it in GitHub Desktop.
contract Counterfact is LiveFactory {
function addressForNonce(uint8 nonce) constant returns (address) {
if (nonce > 127) throw;
return address(sha3(0xd6, 0x94, address(this), nonce));
}
function Counterfact() payable {
firstDeployment = addressForNonce(uint8(1));
bool b = firstDeployment.send(msg.value);
}
address public firstDeployment;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment