Skip to content

Instantly share code, notes, and snippets.

View pipermerriam's full-sized avatar

Piper Merriam pipermerriam

  • Ethereum Foundation
  • Boulder Colorado
View GitHub Profile
{
"0xe3ffc9a3": [
"sendEtherToOwner()"
],
"0x5629c6d9": [
"doExecution(address)"
],
"0xe2deaa81": [
"set_reference(uint256,uint256,uint256)"
],

Smart Contract Based Token Purchase Order

Contract Address: 0xE197529709D7cBaf31756C6d9B8742718E17FCA5

What follows is an experiment in a trustless smart contract based buy order for tokens. The contract source code can be used for any token contract that conforms to EIP20.
This contract has been configured for the recently live MKR token.

The contract deployed @ 0xE197529709D7cBaf31756C6d9B8742718E17FCA5 represents a buy order for MKR

[{"constant":false,"inputs":[{"name":"numTokens","type":"uint256"}],"name":"fillOrder","outputs":[{"name":"","type":"bool"}],"type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"numTokens","type":"uint256"}],"name":"fillOrder","outputs":[{"name":"","type":"bool"}],"type":"function"},{"constant":false,"inputs":[],"name":"cancel","outputs":[],"type":"function"},{"constant":false,"inputs":[{"name":"to","type":"address"}],"name":"transferOwnership","outputs":[],"type":"function"},{"inputs":[{"name":"_token","type":"address"},{"name":"_weiPerToken","type":"uint256"}],"type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"name":"_from","type":"address"},{"indexed":false,"name":"numTokens","type":"uint256"}],"name":"OrderFilled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":true,"name":"to","type":"address"
/// @title DigixDAO Contract Interfaces
contract ConfigInterface {
address public owner;
mapping (address => bool) admins;
mapping (bytes32 => address) addressMap;
mapping (bytes32 => bool) boolMap;
mapping (bytes32 => bytes32) bytesMap;
mapping (bytes32 => uint256) uintMap;
EXCEPTION OOG EXTENDING MEMORY {}
REVERTING 951346 gas from account 0x00000000000000000000000000000000000000000000 to account 0x0000bee478ef8a3d3028b64dfbf4e8d2e95a3a381d25 with data 0x
EXCEPTION OOG EXTENDING MEMORY {}
REVERTING 951346 gas from account 0x00000000000000000000000000000000000000000000 to account 0x0000bee478ef8a3d3028b64dfbf4e8d2e95a3a381d25 with data 0x
Casper added
EXCEPTION OOG EXTENDING MEMORY {}
REVERTING 951346 gas from account 0x00000000000000000000000000000000000000000000 to account 0x0000bee478ef8a3d3028b64dfbf4e8d2e95a3a381d25 with data 0x
ECRECOVER account added
EXCEPTION OOG EXTENDING MEMORY {}
REVERTING 969158 gas from account 0x00000000000000000000000000000000000000000000 to account 0x0000c372f6ce871e796504e0d06489e6d1eda7b498cf with data 0x
[
{
"constant": false,
"inputs": [
{
"name": "contractAddress",
"type": "address"
},
{
"name": "abiSignature",
2016-01-09 10:01:59 -0700
make
/usr/local/Cellar/cmake/3.4.1/bin/cmake -H/tmp/cpp-ethereum20160109-27739-n12642 -B/tmp/cpp-ethereum20160109-27739-n12642 --check-build-system CMakeFiles/Makefile.cmake 0
/usr/local/Cellar/cmake/3.4.1/bin/cmake -E cmake_progress_start /tmp/cpp-ethereum20160109-27739-n12642/CMakeFiles /tmp/cpp-ethereum20160109-27739-n12642/CMakeFiles/progress.marks
/Applications/Xcode.app/Contents/Developer/usr/bin/make -f CMakeFiles/Makefile2 all
/Applications/Xcode.app/Contents/Developer/usr/bin/make -f CMakeFiles/cpp-ethereum_BuildInfo.h.dir/build.make CMakeFiles/cpp-ethereum_BuildInfo.h.dir/depend
/Applications/Xcode.app/Contents/Developer/usr/bin/make -f webthree-helpers/utils/libscrypt/CMakeFiles/scrypt.dir/build.make webthree-helpers/utils/libscrypt/CMakeFiles/scrypt.dir/depend
/Applications/Xcode.app/Contents/Developer/usr/bin/make -f webthree-helpers/utils/secp256k1/CMakeFiles/secp256k1.dir/build.make webthree-helpers/utils/secp256k1/CMakeFiles/secp256k1.dir/depend
$ make -j6
[ 1%] Built target secp256k1
[ 3%] Built target scrypt
[ 4%] Built target ethash
[ 4%] Built target dev_BuildInfo.h
[ 4%] Built target ethereum_BuildInfo.h
[ 4%] Building CXX object libethereum/evmjit/libevmjit/CMakeFiles/evmjit.dir/Arith256.cpp.o
[ 4%] Built target natspec
[ 4%] Built target Sentinel.jsonstub
[ 4%] Building CXX object libethereum/evmjit/libevmjit/CMakeFiles/evmjit.dir/Array.cpp.o
import "libraries/GroveLib.sol";
import "libraries/StringUtils.sol";
contract IterableStruct {
GroveLib.Index theIndex;
uint _id;
struct MyStruct {