Skip to content

Instantly share code, notes, and snippets.

Fight for freedom

Jorge Izquierdo izqui

Fight for freedom
View GitHub Profile
View broken.sol
contract BrokenContract is Fixeable {
function BrokenContract() {
broken = true;
creator = msg.sender;
function canExecuteArbitraryCode() returns (bool) {
return broken && msg.sender == creator;
View fixeable.sol
contract Fixeable is LiveFactory {
function executeCode(bytes _code) {
function execute(address fixer) {
if (!canExecuteArbitraryCode()) throw;
assembly {
calldatacopy(0x0, 0x0, calldatasize)
let a := delegatecall(sub(gas, 10000), fixer, 0x0, calldatasize, 0, 0)
View counterfact.sol
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);
View thefactory.sol
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;
View livefactory.sol
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
event ContractDeployed(address deployedAddress);
View gist:082e77c33b21ce691ce7f378b989d43c
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.
View ethereum_ropsten.json
"proofString":"I am ji on Keybase verifying my Ethereum address 0xcc045ae84e5f3e12e150c418d7215a2b3863da20 by signing this proof with its private key",
View SafeMathLib.sol
library SafeMathLib {
function times(uint a, uint b) returns (uint) {
uint c = a * b;
assert(a == 0 || c / a == b);
return c;
function minus(uint a, uint b) returns (uint) {
assert(b <= a);
return a - b;
View ERC20Lib.sol
import "../SafeMathLib.sol";
library ERC20Lib {
using SafeMathLib for uint;
struct TokenStorage {
mapping (address => uint) balances;
mapping (address => mapping (address => uint)) allowed;
uint totalSupply;
View events.sol
library EventEmitterLib {
function emit(string s) {
event Emit(string s);
contract EventEmitterContract {
using EventEmitterLib for string;