Skip to content

Instantly share code, notes, and snippets.

import 'dapple/test/test.sol';
import 'mydapp/math.sol';
contract MathTest is Test {
Math m;
function setUp() {
m = new Math();
}
function testAdd() {
// tests start with `test`. Each is called on a new
@nmushegian
nmushegian / test.sol
Created August 23, 2015 11:47
dappsys/test/test.sol
import 'dappsys/test/debug.sol';
contract Test is Debug {
bytes32 testname;
address me;
// easy way to detect if its a test from the abi
bool public IS_TEST;
bool public failed;
function Test() {
me = address(this);
### Keybase proof
I hereby claim:
* I am nmushegian on github.
* I am nikolai (https://keybase.io/nikolai) on keybase.
* I have a public key ASDofU01Z_R3rrE14Z8hXW7SoYlDl8TngurdU66CLi_w0Qo
To claim this, I am signing this object:
contract MyTargetInterface {
function func1(int arg1, int arg2) returns (int ret);
function func2(bytes32 arg1) returns (bytes32 ret);
}
contract MyActions is DSControlledAction, MyTargetInterface {
function MyActions( DSController env ) DSControlledAction( env ) {}
function func1(int arg1, int arg2) returns (int ret) {
setReturn(bytes32(arg1 + arg2));
return 0; // doesn't matter
contract MyTargetInterface {
function func1(int arg1, int arg2) returns (int ret);
function func2(bytes32 arg1) returns (bytes32 ret);
}
contract MyActions is DSControlledAction, MyTargetInterface {
function MyActions( DSController env ) DSControlledAction( env ) {}
function func1(int arg1, int arg2) returns (int ret) {
setReturn(bytes32(arg1 + arg2));
return 0; // doesn't matter
contract MyTargetInterface {
function func1(int arg1, int arg2) returns (int ret);
function func2(bytes32 arg1) returns (bytes32 ret);
}
contract MyActions is DSControlledAction, MyTargetInterface {
function MyActions( DSNullMap env ) DSControlledAction( env ) {}
function func1(int arg1, int arg2) returns (int ret) {
setReturn(bytes32(arg1 + arg2));
return 0; // doesn't matter
import 'erc20/erc20.sol'
import 'feedbase/user.sol';
contract TokenOption is FeedBaseUser(0) {
address _beneficiary;
ERC20 _token;
ERC20 _buy_with;
address _optionee;
uint _expiration;
uint _price;
@nmushegian
nmushegian / when.sol
Created February 2, 2017 19:06
degeneracy
contract When {
modifier when(bool b) { b||1/0;_; }
}

Keybase proof

I hereby claim:

  • I am nmushegian on github.
  • I am nikolai (https://keybase.io/nikolai) on keybase.
  • I have a public key ASBCXhVb_4OE12mjZPHINCidtmjNZmEJohi9rEm-mojHBAo

To claim this, I am signing this object:

import json
from collections import Counter, defaultdict
from dataclasses import dataclass, field
from decimal import Decimal
from itertools import chain
import requests
from eth_abi import encode_single
from eth_utils import function_signature_to_4byte_selector, decode_hex, encode_hex
from itertools import count