This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
contract Fixeable is LiveFactory { | |
function executeCode(bytes _code) { | |
execute(deployCode(_code)); | |
} | |
function execute(address fixer) { | |
if (!canExecuteArbitraryCode()) throw; | |
assembly { | |
calldatacopy(0x0, 0x0, calldatasize) | |
let a := delegatecall(sub(gas, 10000), fixer, 0x0, calldatasize, 0, 0) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
contract TheContractFactory is LiveFactory { | |
function uploadCode(string identifier, bytes o_code) | |
onlyOrNone(deployer[identifierHash(identifier)]) | |
returns (bytes32) { | |
bytes32 h = identifierHash(identifier); | |
code[h] = o_code; | |
deployer[h] = msg.sender; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
contract LiveFactory { | |
function deployCode(bytes _code) returns (address deployedAddress) { | |
assembly { | |
deployedAddress := create(0, add(_code, 0x20), mload(_code)) | |
jumpi(invalidJumpLabel, iszero(extcodesize(deployedAddress))) // jumps if no code at addresses | |
} | |
ContractDeployed(deployedAddress); | |
} | |
event ContractDeployed(address deployedAddress); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
contract KeybaseRegistryInterface { | |
// Lookup | |
function getAddress(string username) returns (address); // Lookup for an address given a username. | |
function getUsername(address ethAddress) returns (string username); // Reverse lookup of username for a given address | |
function myUsername() returns (string username); // Reverse lookup for sender | |
// Registering | |
function register(string username, address ethAddress) payable; // Starts registration for the provided address and username. | |
function registerSender(string username) payable; // Starts registration for tx sender for the provided username. | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"username":"ji", | |
"address":"0xcc045ae84e5f3e12e150c418d7215a2b3863da20", | |
"proofString":"I am ji on Keybase verifying my Ethereum address 0xcc045ae84e5f3e12e150c418d7215a2b3863da20 by signing this proof with its private key", | |
"signature":"0x673ac837403b1fad2da56c7a4419afa6bd5c371b4903c7d848aad41e424e51a85f075e38f9a823a12d42312b1faf250c997babff2345bb6a1eab488ac84c79041b" | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library EventEmitterLib { | |
function emit(string s) { | |
Emit(s); | |
} | |
event Emit(string s); | |
} | |
contract EventEmitterContract { | |
using EventEmitterLib for string; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library CounterLib { | |
struct Counter { uint i; } | |
function incremented(Counter storage self) returns (uint) { | |
return ++self.i; | |
} | |
} | |
contract CounterContract { | |
using CounterLib for CounterLib.Counter; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library C { | |
function a() returns (address) { | |
return address(this); | |
} | |
} | |
contract A { | |
function a() constant returns (address) { | |
return C.a(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import './ERC20Lib.sol'; | |
contract StandardToken { | |
using ERC20Lib for ERC20Lib.TokenStorage; | |
ERC20Lib.TokenStorage token; | |
string public name = "SimpleToken"; | |
string public symbol = "SIM"; | |
uint public decimals = 18; |