The Original Augur REP TokenTraderFactory Contract (Work In Progress. Note that there is a bug in this contract)

NOTE Dec 14 2016: I’ve found a bug in the original REP TokenTraderFactory that could potentially lead to a loss in $$$. I’m working with the original author to fix this. Do not use this contract anymore. A new contract with the bug fixed will be deployed.

The GNT SellOnly TokenTraderFactory does not contain the same bug.


The Trustless Golem Network Token (GNT) Selling Contract allows GNT sellers to list their sale contracts on https://cryptoderivatives.market/. As of Tue Nov 22 2016 22:37:16 UTC, 15,782.71674413 ethers (ETH) has been paid to purchase 10,035,267.26729285 GNTs through these sale contracts with an average rate of 0.00157273 ETH for 1 GNT. This is equivalent to ~ BTC 208, USD 156,468 or AUD 211,976. Source https://cryptoderivatives.market/gnt_trades.html.

There has been some interest in creating a buy/sell market using the original Augur REP TokenTraderFactory contract to trade The Golem Network Token Wrapped (GNTW) Contract (Work In Progress). Let’s look at this REP TokenTraderFactory contract in this post.


Table of contents


1. How The Buy/Sell Contract Works

2. How To List A Buy/Sell Contract

3. How To Deactivate/Activate Your Listing

4. How To Execute A Buy On A Buy/Sell Contract

5. How To Execute A Sell On A Buy/Sell Contract

6. Watch The TokenTraderFactory In Ethereum Wallet / Mist

7. Watch The TokenTrader Contract In Ethereum Wallet / Mist

8. The Original Trustless REP Token Trading Contract Source Code

Following is the verified contact source for the original Augur REP TokenTraderFactory contract at 0x3398080b81a1cff1429af347ce2b17fc28de3937 by /u/JonnyLatte. This factory contract then creates the TokenTrader contract as deployed to 0x399156ee3339f4b29a53e307b98cce09fda3bac7:


9. Application Binary Interface (ABI)

9.1 TokenTraderFactory ABI

[{"constant":false,"inputs":[{"name":"_asset","type":"address"},{"name":"_buyPrice","type":"uint256"},{"name":"_sellPrice","type":"uint256"},{"name":"_units","type":"uint256"},{"name":"_sellsTokens","type":"bool"},{"name":"_buysTokens","type":"bool"}],"name":"createTradeContract","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"tradeContract","type":"address"}],"name":"verify","outputs":[{"name":"valid","type":"bool"},{"name":"asset","type":"address"},{"name":"buyPrice","type":"uint256"},{"name":"sellPrice","type":"uint256"},{"name":"units","type":"uint256"},{"name":"sellsTokens","type":"bool"},{"name":"buysTokens","type":"bool"}],"payable":false,"type":"function"},{"payable":false,"type":"fallback"},{"anonymous":false,"inputs":[{"indexed":false,"name":"bookid","type":"bytes32"},{"indexed":false,"name":"owner","type":"address"},{"indexed":false,"name":"addr","type":"address"}],"name":"TradeListing","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"bookid","type":"bytes32"},{"indexed":false,"name":"asset","type":"address"},{"indexed":false,"name":"units","type":"uint256"}],"name":"NewBook","type":"event"}]

Here is the corresponding event and method listing:

9.2 TokenTrader ABI

[{"constant":false,"inputs":[{"name":"_value","type":"uint256"}],"name":"withdraw","outputs":[{"name":"ok","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"asset","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"sellPrice","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"sellsTokens","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"buyPrice","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_value","type":"uint256"}],"name":"withdrawAsset","outputs":[{"name":"ok","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"units","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_token","type":"address"},{"name":"_value","type":"uint256"}],"name":"withdrawToken","outputs":[{"name":"ok","type":"bool"}],"payable":false,"type":"function"},{"constant":false,"inputs":[],"name":"buy","outputs":[],"payable":true,"type":"function"},{"constant":false,"inputs":[{"name":"_sellsTokens","type":"bool"},{"name":"_buysTokens","type":"bool"}],"name":"activate","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"buysTokens","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":false,"inputs":[],"name":"deposit","outputs":[],"payable":true,"type":"function"},{"constant":false,"inputs":[{"name":"amount","type":"uint256"}],"name":"sell","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"type":"function"},{"inputs":[{"name":"_asset","type":"address"},{"name":"_buyPrice","type":"uint256"},{"name":"_sellPrice","type":"uint256"},{"name":"_units","type":"uint256"},{"name":"_sellsTokens","type":"bool"},{"name":"_buysTokens","type":"bool"}],"type":"constructor"},{"payable":true,"type":"fallback"},{"anonymous":false,"inputs":[{"indexed":false,"name":"sells","type":"bool"},{"indexed":false,"name":"buys","type":"bool"}],"name":"ActivatedEvent","type":"event"},{"anonymous":false,"inputs":[],"name":"UpdateEvent","type":"event"}]

Here is the corresponding property, event and method listing:

This entry was posted in Blog and tagged , , , , . Bookmark the permalink.