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 UserTokenFactory { | |
mapping(address=>UserToken) public userTokens; | |
function getUserToken(address owner) returns(UserToken) { | |
if(userTokens[owner] == 0) { | |
UserToken token = new UserToken(owner); | |
userTokens[owner] = token; | |
} | |
return userTokens[owner]; | |
} |
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
object "Create2Proxy" { | |
code { | |
let size := datasize("runtime") | |
datacopy(0, dataoffset("runtime"), size) | |
return(0, size) | |
} | |
object "runtime" { | |
code { | |
let salt := calldataload(0) | |
let size := sub(calldatasize(), 32) |
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 asyncio | |
import logging | |
from flask import Blueprint, Flask, request, render_template, g | |
from flask_graphql import GraphQLView | |
from google.cloud import logging as glogging | |
#from graphql.execution.executors.asyncio import AsyncioExecutor | |
from web3 import Web3, HTTPProvider | |
from werkzeug.serving import run_simple | |
from graphql import ( | |
graphql, |
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
type Address { | |
address: String | |
} | |
type Node { | |
name: String | |
nameHash: String | |
label: String | |
node: String | |
subNodes: [Node] |
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
// WHATEVER YOU DO, DON'T USE THIS. | |
// This is a bit of demo code posted to illustrate a principle. It is unaudited, | |
// probably full of bugs, and definintely not production ready. | |
// https://twitter.com/nicksdjohnson/status/1041642345467404291 | |
import "./DumbWallet.sol"; | |
contract DumbMultisig { | |
struct MultisigConfig { | |
mapping(address=>bool) signatories; |
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
// WHATEVER YOU DO, DON'T USE THIS. | |
// This is a bit of demo code posted to illustrate a principle. It is unaudited, | |
// probably full of bugs, and definintely not production ready. | |
// https://twitter.com/nicksdjohnson/status/1041642345467404291 | |
import "./DumbWallet.sol"; | |
contract WalletDelegator { | |
mapping(address=>uint) public nonces; |
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
// WHATEVER YOU DO, DON'T USE THIS. | |
// This is a bit of demo code posted to illustrate a principle. It is unaudited, | |
// probably full of bugs, and definintely not production ready. | |
// https://twitter.com/nicksdjohnson/status/1041642345467404291 | |
contract DumbWallet { | |
mapping(address=>bool) public authorised; | |
event Authorised(address indexed target, bool value); | |
event Call(address indexed target, uint 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
import logging | |
import json | |
import sys | |
import mapreduce | |
def mapper(key, value): | |
if value['event'] == 'AuctionStarted': | |
yield (value['args']['hash'], {'registered': value['args']['registrationDate']}) |
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
/** | |
* @dev OpcodeChecker processes contract code to generate a bitmap of used opcodes. | |
* | |
* DO NOT USE: See the vulnerability identified by Recmo below. A patch will be provided soon. | |
* | |
* The generated bitmap can be used to enforce whitelisting and blacklisting on contract code. | |
* Bit n of the bitmap is set iff opcode n is used. For instance, the presence of the STOP opcode | |
* will result in bit 0 of the bitmap being set. | |
* | |
* A best-effort attempt is made to skip over unreachable data, but there may be false positives. |
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 argparse | |
import requests | |
import xml.etree.ElementTree as ET | |
from cStringIO import StringIO | |
from PyPDF2 import PdfFileReader, PdfFileWriter | |
parser = argparse.ArgumentParser(description='Build a PDF from a set of matching RFCs') | |
parser.add_argument('rfc', metavar='RFC', nargs='*') |