NAV
Code

Overview

Augur is a decentralized prediction market platform that runs on Ethereum.

The stable Augur application is built and hosted at https://app.augur.net. If you want to use or help test Augur, you do not need to download or install anything! Just go to https://app.augur.net and start using it. (If you want to use our cutting-edge development client, this is maintained at https://augur-dev.firebaseapp.com – warning, we push changes to augur-dev.firebaseapp.com pretty rapidly, so it can be a bit buggy! We suggest simply using https://app.augur.net for a more stable experience.)

Augur has it’s own dedicated stack exchange which can be found at augur.stackexchange.com. The stack exchange allows people to ask questions about Augur and get answers to those questions. It’s a great resource to find the answers for questions you might have that aren’t answered directly in these documents. You can also try our Slack, which is open to the pubic. If you’d like to join the conversation, just go to slack.augur.net and sign up. Generally, questions are based asked in the #dev or #general channels.

Getting Started

If you want to help develop Augur, you will need to build the client from source. To do this, first install Node.js, and git.

First we need to clone the Augur repository from Github, open up your terminal and enter the following command to clone the repository:

$ git clone https://www.github.com/AugurProject/augur.git

Now navigate into the newly created augur folder by running the following command:

$ cd augur

Now we need to install Augur’s dependencies. This can be done with npm or yarn. Both methods are detailed in the next sections.

Using NPM

Node.js comes with a built in package manager called npm. npm is used to install dependencies for Augur, build the Augur project from source code, run tests, and start a web server to host Augur among other things. To install Augur’s dependencies using npm we will run the following command:

$ npm install

To build Augur from the source code, we can run the following command:

$ npm run build

After we build Augur from the source files, we are ready to fire up a local web sever. To do this, we run the following command:

$ npm start

If you would like to enable hot-reloading, which automatically updates your changes on the localhost, then instead of running npm start, we would instead enter:

$ npm run dev

This is a useful way to do some hacking on the Augur source code and see your changes reflected in real time.

Now go to http://localhost:8080 in your web browser. You should be greeted by Augur’s most popular topics page. Congratulations, you’re ready to start hacking!

Using Yarn

Some people prefer to use yarn instead of npm. If you prefer to use yarn then you would run the following command to install the Augur dependencies:

$ yarn

To build Augur from the source code:

$ yarn build

After building, you can run the following command to start the web server:

$ yarn start

If you would like hot-reloading for development purposes then, instead of yarn start, the yarn command is:

$ yarn dev

Finally, go to http://localhost:8080 in your web browser. You should be greeted by Augur’s most popular topics page. Congratulations, you’re ready to start hacking!

If you plan to submit a Pull Request to the Augur Project, make sure to read through the contributing section of these documents before you submit the request.

Architecture

Augur is designed to work with a locally running Ethereum Node. If a local Ethereum Node isn’t available then Augur will default to using one of the hosted Augur Nodes. A hosted Augur Node is simply an Ethereum Node being run by the Augur Team and hosted on a public server. The sections below explain a bit about each setup (local or hosted) and provide a diagram of what is going on under the hood.

Local node

If you are running a local Ethereum node, sending RPC requests to your local node is the best (fastest) way to use Augur. To do this, you can either download and run the Augur app locally, or simply visit https://app.augur.net, which is configured to automatically talk to your local node, if present.

Note to geth users: Geth’s RPC server uses regular (unencrypted) HTTP and because of this, in order for the Augur app to communicate with your local geth node, it must be served over HTTP.

Hosted node

Understandably, many users will not want to go to the trouble of running a full Ethereum node solely for the purpose of using Augur. Augur maintains a public (testnet during the beta) Ethereum node at https://eth9000.augur.net, which is used automatically by https://app.augur.net (and by local.augur.net if a local Ethereum node is not detected).

Trading

Augur allows anyone to create an openly tradable market about any upcoming event. Augur will maintain an order book for each of the markets created. Any trader can place or take an order on the market’s order book. When placing an order, if there is an order on the book that will fulfill your order then it will be filled immediately. If there is no matching order, or your order was only partially filled, on the book then your order, or the remainder of what wasn’t filled of your order, will be placed on the book until another trader tries to fill the order or we cancel the order and remove it from the book. Orders are executed on a “first come, first served” basis.

The Augur UI will offer users the best prices first when displaying the order book on each market page. Orders are never executed at a worse prices than the limit price set by the user, however they can settle for better than the limit price. Orders can also be partially filled. The UI will automatically include multiple backup/fallback orders to attempt to fill our order in the event that the best order was filled before we sent the transaction. These backup/fallback orders will always fit within the limit price set by the trader.

Trading Example

Let’s use an example binary market trading on the “super big event” coming up. For this example, we want to go long on Outcome A. We would submit a bid order to buy 100 shares of Outcome A with a limit price of 0.5 ETH, which will cost 50.0 ETH plus trading fees and gas used to place the bid order. Fees will be discussed in more details in the next section.

If there are orders on the order book that match our request for 100 shares of Outcome A at a price of 0.5 ETH or cheaper then Augur will fill those orders. We will now own 100 Shares of Outcome A and we will have lost 50.0 ETH plus trading fees and gas cost.

If no order is available on the order book that would partially or completely fill our order request then a bid order would be created and placed on the order book. Whenever an order is placed on the order book something of value is escrowed by the market. In our example, the value we are giving to the market to place our bid would be our 50.0 ETH plus fees. If we were attempting to sell shares that we currently owned then we would escrow the shares instead of ETH. If we cancel our order we can get our 50.0 ETH back, but we do lose our fees and gas costs. When someone decides to take our order off the order book, we will get our 100 shares of Outcome A transferred to us.

For more information on how to trade using the Augur API, check the trade section of the Transaction API.

Trading Fees

Creating a market costs a small amount of ETH. Without some incentive people won’t create markets as they get nothing in return for the ETH they spent to create it. Augur solves this problem by allowing market creators to set a Trading Fee for their market. The Trading Fee must be between 0 and 50 percent. Once a market is created the Trading Fee cannot be raised, only lowered.

Augur extracts Trading Fees in order to be able to reward users who create markets, but it also extracts Fees to help support the reporting system. The Reporter Fee isn’t set by the market creator like the Trading Fee but is instead set by Augur.

Augur will automatically create a market once a month to use as a data feed for the REP price. This market will be a normal market and it will go through the normal reporting process. Once the REP price is known, Augur can calculate the REP market cap by multiply by the total supply of REP.

The contracts will track the open interest of all markets passively as people interact with Augur, which allows Augur to always have access to the open interest numbers. Once the open interest and REP market caps are known Augur can then wether the REP market cap is too high or too low. Augur then calculates the new Reporter Fee using the following formula:

current_reporting_fee * (augur_open_interest * 5 / rep_market_cap)

The current plan is to update this value once a month. If updates where to occur too frequently, the market will not have time to adjust to the new fees. If we update too infrequently, then we are at risk of the security model becoming invalid due to a sudden growth in Augur that isn’t yet account for by the fee system.

For simplicity, going forward Trading Fees will refer to both the Trading Fee and the Reporting Fee combined. Trading Fees are extracted anytime settlement occurs and shares are destroyed. This can happen for two reasons:

Selling a Complete Set can be thought of as exiting your market position. Complete Sets are simply a set of shares for each outcome. If you own a set of shares in each outcome, you can settle those shares and receive ETH back for their value minus Trading Fees.

Calculating Trades

In this section we breakdown all potential trade situations and their expected outcome. There are two types of orders, bid orders (requesting to buy) and ask orders (requesting to sell). In our examples below we will first go over all the potential trade possibilities around Bid Orders and Ask Orders. The calculations below use N as the number of Shares the order is requesting, X as the price per Share for the order, and Outcome for the outcome our order is concerning.

Bid Order Trading

Maker of Bid Order Taker of Bid Order
Escrows: N Shares of all outcomes except Outcome at X Price.
Intent: close a short position for Outcome.
Sends: ETH.
Intent: open a short position for Outcome.
Gains: (marketMaxPrice - X) * N ETH.
Loses: N Shares in all outcomes except Outcome.
Gains: N Shares in all outcomes except Outcome.
Loses: (marketMaxPrice - X) * N ETH.
Maker of Bid Order Taker of Bid Order
Escrows: (X - marketMinPrice) * N ETH for N Shares of
Outcome at X Price.
Intent: open a long position for Outcome.
Sends:: ETH.
Intent: open a short position for Outcome.
Gains: N Shares of Outcome.
Loses: (X - marketMinPrice) * N ETH
Gains: N Shares of all outcomes except for Outcome.
Loses: (marketMaxPrice - X) * N ETH.
Maker of Bid Order Taker of Bid Order
Escrows: N Shares of all outcomes except Outcome at X Price.
Intent: close a short position for Outcome.
Sends: N Shares of Outcome.
Intent: close a long position for Outcome.
Gains:
((marketMaxPrice - X) * N) - (tradingFees / 2) ETH.
Loses: N Shares in all outcomes except Outcome.
Gains:
((X - marketMinPrice) * N) - (tradingFees / 2) ETH.
Loses: N Shares in Outcome.
Maker of Bid Order Taker of Bid Order
Escrows: (X - marketMinPrice) * N ETH for N Shares
of Outcome at X Price.
Intent: open a long position for Outcome.
Sends: N Shares of Outcome.
Intent: close a long position for Outcome.
Gains: N Shares in Outcome.
Loses: (X - marketMinPrice) * N ETH
Gains: (X - marketMinPrice) * N ETH.
Loses: N Shares of Outcome.

Ask Order Trading

Maker of Ask Order Taker of Ask Order
Escrows: N Shares of Outcome at X Price.
Intent: close a long position for Outcome.
Sends: ETH.
Intent: open a long position for Outcome.
Gains: (X - marketMinPrice) * N ETH.
Loses: N Shares in Outcome
Gains: N Shares of Outcome.
Loses: (X - marketMinPrice) * N ETH
Maker of Ask Order Taker of Ask Order
Escrows: (marketMaxPrice - X) * N ETH for N Shares
of Outcome at X Price.
Intent: open a short position for Outcome.
Sends: ETH.
Intent: open a long position for Outcome.
Gains: N Shares in all outcomes except Outcome.
Loses: (marketMaxPrice - X) * N ETH
Gains: N Shares of Outcome.
Loses: (X - marketMinPrice) * N ETH.
Maker of Ask Order Taker of Ask Order
Escrows: N Shares of Outcome at X Price.
Intent: close a long position for Outcome.
Sends: Shares in all outcomes except Outcome.
Intent: close a short position for Outcome.
Gains:
((X - marketMinPrice) * N) - (tradingFees / 2) ETH.
Loses: N Shares of Outcome
Gains:
((marketMaxPrice - X) * N) - (tradingFees / 2) ETH.
Loses: N Shares in all outcomes except Outcome.
Maker of Ask Order Taker of Ask Order
Escrows: (marketMaxPrice - X) * N ETH for N Shares
of Outcome at X Price.
Intent: open a short position for Outcome.
Sends: Shares in all outcomes except Outcome.
Intent: close a short position for Outcome.
Gains: N Shares in all outcomes except Outcome.
Loses: (marketMaxPrice - X) * N ETH.
Gains: (marketMaxPrice - X) * N ETH.
Loses: N Shares in all outcomes except Outcome.

Reporting

The Reporting Diagram above is a high level overview of Reporting implemented by Augur. There are four ways for a Market to attempt to Finalize: Automated Reporting, Limited Reporting, All Reporting, and rarely a Fork. Markets in Augur have 10 potential states after Market Creation. The potential states of a Market are as follows:

  1. Pre-Reporting
  2. Automated Reporting
  3. Automated Dispute
  4. Awaiting Migration
  5. Limited Reporting
  6. Limited Dispute
  7. All Reporting
  8. All Dispute
  9. Forking
  10. Finalized

The Pre-Reporting (1) state is the time period where the market’s End Time has not come to pass, generally this is the most active trading period. Once the End Time has come to pass, a Market with an Automated Reporter set will immediately enter it’s Automated Reporting state.

The Automated Reporting (2) state is up to three days long. During this state, the market is expected to Reported on by the Automated Reporter at some point during this three day period. As soon as the Automated Reporter submits their Report the Market will be moved into the Automated Dispute (3) state. The Automated Dispute state lasts for three days, during which any REP holder can post a Dispute Bond to challenge the Proposed Outcome submitted by the Automated Reporter. A Market in the Automated Dispute state is considered a Market Awaiting Finalization because if no Dispute Bond is posted the Proposed Outcome will become final and the Market will be considered Finalized (10). If a Dispute Bond is posted during the Automated Dispute state, or if the Automated Reporter fails to report during the Automated Reporting state then the market will be moved into the Awaiting Migration (4) state.

The Awaiting Migration (4) state can last up to 30 days and theoretically could be as short as a second long. During this time the Market is waiting for the next Reporting Window to begin so that the Market can be moved into the Limited Reporting (5) state. Reporting Windows last a total of 30 days, the first 27 days are for the Reporting Phase, the following 3 days are for the Dispute Phase. When a Reporting Window ends another Reporting Window immediately starts.

Once a new Reporting Window has begun, any markets in the Awaiting Migration (4) state will be moved into the Limited Reporting (5) state, and the Reporting Phase will begin. During the Reporting Phase markets in both a Limited Reporting (5) and All Reporting (7) state will be reported on by Registered Reporters.

Once 27 days have passed the Reporting Window’s Reporting Phase ends and the Dispute Phase begins. All Markets previously in the Limited Reporting (5) or All Reporting (7) states will move into the Limited Dispute (6) and All Dispute (8) states respectively. The Proposed Outcome for these markets becomes whichever outcome had the most REP staked on it during the Reporting Phase by Reporters. During the Dispute Phase any Market in the Limited Dispute or All Dispute state can be challenged by any REP holder willing to post a Dispute Bond.

If a Market in the Limited Dispute (6) state is challenged then it will be moved into the All Reporting (7) state at the start of the next Reporting Window, which should be a maximum of three days away from the posting of the dispute bond. If a Market in the All Dispute (8) state is challenged then that market will cause a Fork and be moved into the Fork (9) state.

The Fork (9) state is a special and rarely entered state. A fork lasts sixty (60) days, and creates multiple Branches of Augur. A Branch can be thought of as a different universe of Augur where everything is the same as all the other Branches, when they are first created anyway, except for the Finalized Outcome of the Market that has entered the Fork state.

Users can migrate their REP from the original branch or universe into one of the new branches (whichever they choose). Migration is one-way and final. The universe with the most REP migrated to it by the end of the Fork period (60 days) will be chosen as the winning branch. Forked markets are considered Finalized (10) in each universe but only the winning universe will be able to Settle shares and reward reporters for their work.

A Market can move into the Finalized (10) state anytime they have a Reported Proposed Outcome and move through a Dispute Phase without being challenged. Forks cannot be challenged and their markets are always considered Finalized. Once a market is finalized, traders can Settle their positions with the market.

The majority of Markets will most likely use Automated Reporting as it removes the need to wait for a Reporting Window to get to Market Settlement. Automated Reporting is designed to be fast and because of this doesn’t leverage the decentralized oracle system built into Augur. Instead we are trusting the market creator’s chosen Automated Reporter to accurately report on the outcome of the market. The result of Automated Reporting is still challengeable with a dispute bond so if the Automated Reporter does incorrectly report the outcome of the market it can be adjudicated by Limited Reporting in the next available Reporting Window. With the dispute system in place, we don’t actually lose any security or truth as an incorrect Proposed Outcome for a market can be disputed.

Reporting Windows and Registration

Reporting Windows continually occur and last for thirty days. Reporting Windows have two phases, the Reporting Phase and the Dispute Phase. The Reporting Phase lasts for twenty seven (27) days in which Registered Reporters will be Reporting on Markets in the Limited Reporting and All Reporting states. The Dispute Phase lasts three (3) days immediately following the Reporting Phase. During a Dispute Phase any REP holder is able to post a Dispute Bond to challenge the Proposed Outcome of the Market. You do not need to have registered for the Reporting Window to post a Dispute Bond. In order to earn Reporting Fees as a REP holder you need to Report on Markets during the Reporting Phase.

REP holders who intend to Report on the outcome of markets in a Limited Reporting or All Reporting state will need to register to report prior to the Reporting Window’s start time. To do this, REP holders will purchase a Registration Token, which are tied to a specific upcoming Reporting Window. The purpose of a Registration Token is to allow the system to get an approximation as to how many Reporters will be participating in the Reporting Window. This is used to calculate how many Markets each Reporter needs to Report on in order for the system to get its target number of Reports per Market. Registration Tokens can be purchased as far in advanced as you would like for any future Reporting Window, but cannot be purchased for a Reporting Window in progress or a past Reporting Window.

General API

The Augur API is split up into three sections, the Simplified API, the Call API, and the Transaction API. The Simplified API is provided to get information about Markets on the Augur network. The Call and Transaction API’s are direct contract and method mapping to the augur.api object. The Call API uses eth_call to make “get” requests for information stored on the blockchain. The Transaction API uses eth_sendTransaction to make “set” requests to the blockchain in order to modify the blockchain’s information in some way, like creating a new Order on the Order Book. The Call and Transaction APIs will be covered in greater detail in their respective sections of these docs.

In this section we will go over how to import augur.js into your project and connect it to an Ethereum Node. This section will also cover market creation, initial market loading, and review the Simplified API methods.

Connect to an Ethereum Node

// After installing, just require augur.js to use it.
import Augur from 'augur.js';
const augur = new Augur();

const options = {
  httpAddresss: [
    'http://127.0.0.1:8545', // local http address for Geth Node
    'https://eth9000.augur.net' // hosted http address for Augur Node
  ],
  wsAddresses: [
    'ws://127.0.0.1:8545', // local websocket address for Geth Node
    'wss://ws9000.augur.net', // hosted websocket address for Augur Node
  ],
};

// Attempt to connect to a local Ethereum node
// if that fails, fall back to our hosted node
augur.connect(options, function (vitals) { /* ... */ });
// example vitals object:
vitals = {
  networkID: '9000',
  blockNumber: '0xf69b5',
  coinbase: '0x05ae1d0ca6206c6168b42efcd1fbe0ed144e821b',
  gasPrice: 18000000000,
  api: {
    events: { /*...*/},
    functions: { /* ... */ },
  },
  contracts: { /* ... */ },
  rpc: { /* ... */ },
};

The Augur API is a set of JavaScript bindings for the methods encoded in Augur’s smart contracts. The API method name, as well as its parameters as keys in the params object, are generally identical to those of the underlying smart contract method.

Augur’s core contracts exist on Ethereum’s decentralized network. The various serialization, networking, and formatting tasks required to communicate with the Augur contracts from a web application are carried out by Augur’s middleware.

augur.js is the Augur JavaScript SDK, and is the user-facing component of the middleware. If you want to interact with the Augur contracts from a custom application, augur.js is the recommended way to do so. The easiest way to install augur.js is using npm:

$ npm install augur.js

or if you prefer yarn:

$ yarn add augur.js

To use the Augur API, augur.js must connect to an Ethereum node, which can be either remote (hosted) or local. To specify the connection endpoint, pass your RPC connection info to augur.connect. Augur will go through the list of potential connections provided by the options argument and attempt to connect to each in turn until one of the connections is successful or all attempts fail.

In the example we have set our first connection to try as http://127.0.0.1:8545 which is our local geth node. If Augur is unable to connect to the local geth node, then Augur will go to the next provided address. In this case we have provided a single hosted node (https://eth9000.augur.net) as the only other attempt to make outside of the local geth node. If a connection is successfully established then a vitals object will be returned, otherwise an error message will be returned.

Accounts

/**
 * Create an account using the augur.accounts.register method.
 */
 const password = "thisismysupersecurepassword";

 augur.accounts.register(password, account => console.log("Account:", account));

// output
account = {
  address: "0x0ab5f1a15f2462eba143ecc8e1733f44dfe019bf",
  derivedKey: <Buffer ...>,
  keystore: { /* ... */ },
  privateKey: <Buffer ...>
};

const keystore = account.keystore;

augur.accounts.login(keystore, password, account => console.log("Account:", account));

// output
account = {
  address: "0x0ab5f1a15f2462eba143ecc8e1733f44dfe019bf",
  derivedKey: <Buffer ...>,
  keystore: { /* ... */ },
  privateKey: <Buffer ...>
};

// Augur.js does not store any account data. Augur.js simply returns the important information. You can use the privateKey Buffer returned to sign your transactions.

Augur.js includes a trustless account management system. The purpose of the accounts system is to allow people to use Augur without needing to run an Ethereum node themselves, as running a full Ethereum node can be resource-intensive.

To use the account system, the user specifies a password. Everything else is done automatically for the user. The only requirement for the password is that it be at least 6 characters long.

A private key (+ derived public key and address) is automatically generated for the user. A secret key derived from the password using PBKDF2, along with a random 128-bit initialization vector, is used to encrypt the private key (using AES-256). Nothing is stored by Augur.js, the account object will be returned to the callback provided or simply returned if no callback is provided.

The Augur UI will handle your account information for you, but if you are using Augur.js on it’s own you will need to manage the account yourself. Augur.js doesn’t sign any transactions for you if you aren’t using the Augur UI.

If you want to use the Augur.js API directly, you will need to sign any transaction that will modify information on the blockchain (non-call transactions). All transactions take a _signer parameter which should be set to the sending account’s privateKey Buffer or a function that will sign a transaction (hardware wallet).

Numbers

Before we move on, lets quickly talk about Numbers. There are three acceptable ways to pass numerical inputs to the Augur API:

Floating-point (decimal) values should be passed to augur.js as strings (e.g., instead of 0.07, use "0.07"), for reasons described in enormous detail elsewhere.

Market creation

var marketID = "0x34e104a15ab3eb2a0c26f1138c278416424ef7f8425799a76127e9b427fac74d";
var params = {
  market: marketID,
  liquidity: 9012,
  startingQuantity: 501,
  bestStartingQuantity: 500,
  priceWidth: "0.08697536855694898",
  initialFairPrices: [ "0.661837082683109", "0.5132635487227519" ]
};
augur.create.generateOrderBook(params, {
  onBuyCompleteSets: function (res) { /* ... */ },
  onSetupOutcome: function (outcome) { /* ... */ },
  onSetupOrder: function (order) { /* ... */ },
  onSuccess: function (orderBook) { /* ... */ },
  onFailed: function (err) { /* ... */ }
});

params.isSimulationOnly = true;
augur.create.generateOrderBook(params, {
  onSimulate: function (simulation) { /* ... */ }
})
// example:
simulation = {
  shares: "4007",
  numBuyOrders: [ 10, 7 ],
  numSellOrders: [ 4, 7 ],
  buyPrices:
   [ [ "0.61834939840463451",
       "0.55853753243153362626",
       "0.49872566645843274252",
       "0.43891380048533185878",
       "0.37910193451223097504",
       "0.3192900685391300913",
       "0.25947820256602920756",
       "0.19966633659292832382",
       "0.13985447061982744008",
       "0.08004260464672655634" ],
     [ "0.46977586444427741",
       "0.40996399847117652626",
       "0.35015213249807564252",
       "0.29034026652497475878",
       "0.23052840055187387504",
       "0.1707165345787729913",
       "0.11090466860567210756" ] ],
  sellPrices:
   [ [ "0.70532476696158349",
       "0.76513663293468437374",
       "0.82494849890778525748",
       "0.88476036488088614122" ],
     [ "0.55675123300122639",
       "0.61656309897432727374",
       "0.67637496494742815748",
       "0.73618683092052904122",
       "0.79599869689362992496",
       "0.8558105628667308087",
       "0.91562242883983169244" ] ],
  numTransactions: 34,
  priceDepth: "0.05981186597310088374"
}

augur.create.generateOrderBook is a convenience method for generating an initial Order Book for a newly created Market. generateOrderBook calculates the number of Orders to create, as well as the spacing between orders, using the calculatePriceDepth method.

generateOrderBook(params, callbacks)

params is an object containing the input parameters (see example code). liquidity is the total amount of liquidity to add to the market. initialFairPrice is the center of the bid-ask spread. startingQuantity is the number of shares available at each price point. bestStartingQuantity can optionally be specified separately, and is the number of shares available at the best price point (those closest to the spread). priceWidth is the price difference between the best bid and best ask orders.

calculatePriceDepth accepts arguments liquidity, startingQuantity, bestStartingQuantity, halfPriceWidth, minValue, and maxValue. All arguments to calculatePriceDepth are expected to be in BigNumber format. The order book generated by augur.create.generateOrderBook is “flat”, in the sense that there is the same size order created at each price point (except for the best bid/offer). A typical generated order book (for a single outcome) might look like:

price width
[Not supported by viewer]
maximum
price
[Not supported by viewer]
price
[Not supported by viewer]
order size
(# shares)
[Not supported by viewer]
best
starting
quantity
[Not supported by viewer]
starting
quantity
[Not supported by viewer]
initial fair
price
[Not supported by viewer]
minimum
price
[Not supported by viewer]
price depth
[Not supported by viewer]
asks (sell orders)
[Not supported by viewer]
bids (buy orders)
[Not supported by viewer]

This calculation is done as follows. Let \(p_\mathrm{max}\) and \(p_\mathrm{min}\) be the maximum and minimum allowed prices, \(I\) be the initial fair price for the outcome under consideration, \(q\) be the starting quantity (size of each order), \(q_0\) be the size of the best order, and \(w\) be the price width (the size of the bid-ask spread). The liquidity available on the buy and sell order books is given by:

$$ L_{\mathrm{buy}} = q_0 + \frac{q}{\delta} \left( p_\mathrm{min} + I - \frac{w}{2} \right) $$

$$ L_{\mathrm{sell}} = q_0 + \frac{q}{\delta} \left( p_\mathrm{max} - I - \frac{w}{2} \right) $$

where \(\delta\) is the “price depth”, the distance between orders on the same side of the book. The total liquidity \(L = L_{\mathrm{buy}} + L_{\mathrm{sell}}\) is an input parameter, so the only unknown is the price depth \(\delta\), which can now be calculated:

$$ \delta = \frac{\left( p_\mathrm{min} + p_\mathrm{max} - w \right) q}{L - 2q_0} $$

The initial order book is now fully specified.

augur.create.generateOrderBook also accepts an optional parameter, isSimulationOnly, which if set to true, returns information about what the method will do (see code example). shares is the number of complete sets of shares to purchased, numBuyOrders is the number of buy orders that will be created, numSellOrders is the number of sell orders that will be created, and numTransactions is the total number of Ethereum transactions needed to set up the order book.

Initial market loading

To load the basic Market info for all markets, first call augur.markets.getMarketsInfo({ marketIDs }, callback). You will likely need to chunk the results so that the request does not time out. More detailed market info (including prices) for each market in each chunk (page) is then loaded using augur.markets.getMarketInfo({ _market }, callback). getMarketInfo does not return the full Order Book; to get the order book for a market, call augur.trading.orderBook.getOrderBook({ _type, _market, _outcome, minPrice, maxPrice[, _startingOrderId, _numOrdersToLoad ]}, callback).

Simplified API

const _type = 1; // 1 is "buy", 2 is "sell"
const _market = '0x9368ff3e9ce1c0459b309fac6dd4e69229b91a42';
const _outcome = 1;
const minPrice = "0.0";
const maxPrice = "1.0";
const _startingOrderId = "0x3c3958b3cad3fb693a6fdd013a615485ef42d824aaa3bd57734f5ec21567ebdc";
const _numOrdersToLoad = 3;

augur.trading.orderBook.getOrderBook({
  _type,
  _market,
  _outcome,
  minPrice,
  maxPrice,
  _startingOrderId,
  _numOrdersToLoad
}, function (orderBook) { /* ... */ })
// example output:
{
  buy: {
    '0x3c3958b3cad3fb693a6fdd013a615485ef42d824aaa3bd57734f5ec21567ebdc': {
      amount: '15',
      block: 220,
      fullPrecisionAmount: '15',
      fullPercisionPrice: '0.1770833333333333',
      id: '0x3c3958b3cad3fb693a6fdd013a615485ef42d824aaa3bd57734f5ec21567ebdc',
      market: '0x9368ff3e9ce1c0459b309fac6dd4e69229b91a42',
      outcome: '1',
      owner: '0x05ae1d0ca6206c6168b42efcd1fbe0ed144e821b',
      price: '0.177',
      type: 'buy',
    },
    '0x1f4f112a9aa99282e306cb58abc95b5b46199f802bd36d68f1619ba98866963a': {
      amount: '10',
      block: 217,
      fullPrecisionAmount: '10',
      fullPercisionPrice: '0.1208333333333333',
      id: '0x1f4f112a9aa99282e306cb58abc95b5b46199f802bd36d68f1619ba98866963a',
      market: '0x9368ff3e9ce1c0459b309fac6dd4e69229b91a42',
      outcome: '1',
      owner: '0x05ae1d0ca6206c6168b42efcd1fbe0ed144e821b',
      price: '0.1208',
      type: 'buy',
    },
    '0x2b054b0c9ca2fcf22ee73ba14ae41da70c7039c1a5b8125a40b9f2b68a20080b': {
      amount: '10',
      block: 219,
      fullPrecisionAmount: '10',
      fullPercisionPrice: '0.0083333333333333',
      id: '0x2b054b0c9ca2fcf22ee73ba14ae41da70c7039c1a5b8125a40b9f2b68a20080b',
      market: '0x9368ff3e9ce1c0459b309fac6dd4e69229b91a42',
      outcome: '1',
      owner: '0x05ae1d0ca6206c6168b42efcd1fbe0ed144e821b',
      price: '0.0083',
      type: 'buy',
    }
  }
}

augur.trading.orderBook.getOrderBook({
  _type,
  _market,
  _outcome,
  minPrice,
  maxPrice,
  _startingOrderId,
  _numOrdersToLoad
}, function (orderBookChunk) { /* ... */ }, function (completeSingleOutcomeOrderBookSide) { /* ... */ });
// example chunk output:
{
  buy: {
    '0x3c3958b3cad3fb693a6fdd013a615485ef42d824aaa3bd57734f5ec21567ebdc': {
      amount: '15',
      block: 220,
      fullPrecisionAmount: '15',
      fullPercisionPrice: '0.1770833333333333',
      id: '0x3c3958b3cad3fb693a6fdd013a615485ef42d824aaa3bd57734f5ec21567ebdc',
      market: '0x9368ff3e9ce1c0459b309fac6dd4e69229b91a42',
      outcome: '1',
      owner: '0x05ae1d0ca6206c6168b42efcd1fbe0ed144e821b',
      price: '0.177',
      type: 'buy',
    },
    '0x1f4f112a9aa99282e306cb58abc95b5b46199f802bd36d68f1619ba98866963a': {
      amount: '10',
      block: 217,
      fullPrecisionAmount: '10',
      fullPercisionPrice: '0.1208333333333333',
      id: '0x1f4f112a9aa99282e306cb58abc95b5b46199f802bd36d68f1619ba98866963a',
      market: '0x9368ff3e9ce1c0459b309fac6dd4e69229b91a42',
      outcome: '1',
      owner: '0x05ae1d0ca6206c6168b42efcd1fbe0ed144e821b',
      price: '0.1208',
      type: 'buy',
    },
    '0x2b054b0c9ca2fcf22ee73ba14ae41da70c7039c1a5b8125a40b9f2b68a20080b': {
      amount: '10',
      block: 219,
      fullPrecisionAmount: '10',
      fullPercisionPrice: '0.0083333333333333',
      id: '0x2b054b0c9ca2fcf22ee73ba14ae41da70c7039c1a5b8125a40b9f2b68a20080b',
      market: '0x9368ff3e9ce1c0459b309fac6dd4e69229b91a42',
      outcome: '1',
      owner: '0x05ae1d0ca6206c6168b42efcd1fbe0ed144e821b',
      price: '0.0083',
      type: 'buy',
    }
  }
}

augur.markets.getMarketInfo({ _market }, function (market) { /* ... */ });
// example output:
{
  author: '0x05ae1d0ca6206c6168b42efcd1fbe0ed144e821b',
  branchID: '0xf69b5',
  consensus: null,
  creationBlock: 213,
  creationFee: '9',
  creationTime: 1502248462,
  cumulativeScale: '1',
  description: 'What will be the status of the U.S. electoral college on January 1, 2020?~|>Unchanged from 2016|Undermined but still in existence (e.g., National Popular Vote bill)|Formally abolished',
  endDate: 1577952000,
  eventBond: '4.5',
  extraInfo: 'http://www.nationalpopularvote.com',
  id: '0x9368ff3e9ce1c0459b309fac6dd4e69229b91a42',
  makerFee: '0.01',
  maxValue: '3',
  minValue: '1',
  network: '9000',
  numOutcomes: 3,
  outcomes: [{
    id: 1,
    outstandingShares: '310',
    price: '0.6020833333333333',
    sharesPurchased: '0',
  }, {
    id: 2,
    outstandingShares: '310',
    price: '0.4333333333333333',
    sharesPurchased: '0',
  }, {
    id: 3,
    outstandingShares: '310',
    price: '0.4333333333333333',
    sharesPurchased: '0',
  }],
  tags: ['politics', 'elections', 'US politics'],
  takerFee: '0.02',
  topic: 'politics',
  tradingFee: '0.02',
  tradingPeriod: 9131,
  type: 'categorical',
  volume: '1710.399999999999999985'
}

const marketIDs = [ market, '0xe095e00863aecd814003a739da97b54c2b6737bd'];
// const account = '0xb3f636cae9e8ad9795d14d3bdda3e382dba47c73';

augur.markets.batchGetMarketInfo({ marketIDs }, function (marketsInfo) { /* ... */ })
// example output:
{
  '0x9368ff3e9ce1c0459b309fac6dd4e69229b91a42': {
    author: '0x05ae1d0ca6206c6168b42efcd1fbe0ed144e821b',
    branchID: '0xf69b5',
    consensus: null,
    creationBlock: 213,
    creationFee: '9',
    creationTime: 1502248462,
    cumulativeScale: '1',
    description: 'What will be the status of the U.S. electoral college on January 1, 2020?~|>Unchanged from 2016|Undermined but still in existence (e.g., National Popular Vote bill)|Formally abolished',
    endDate: 1577952000,
    eventBond: '4.5',
    extraInfo: 'http://www.nationalpopularvote.com',
    id: '0x9368ff3e9ce1c0459b309fac6dd4e69229b91a42',
    makerFee: '0.01',
    maxValue: '3',
    minValue: '1',
    network: '9000',
    numOutcomes: 3,
    outcomes: [{
      id: 1,
      outstandingShares: '310',
      price: '0.6020833333333333',
      sharesPurchased: '0',
    }, {
      id: 2,
      outstandingShares: '310',
      price: '0.4333333333333333',
      sharesPurchased: '0',
    }, {
      id: 3,
      outstandingShares: '310',
      price: '0.4333333333333333',
      sharesPurchased: '0',
    }],
    tags: ['politics', 'elections', 'US politics'],
    takerFee: '0.02',
    topic: 'politics',
    tradingFee: '0.02',
    tradingPeriod: 9131,
    type: 'categorical',
    volume: '1710.399999999999999985'
  },
  '0xe095e00863aecd814003a739da97b54c2b6737bd': {
    author: '0x9e12c5b6067c61c811add8fb55f5d6fcb88a9e5f',
    branchID: '0xf69b5',
    consensus: null,
    creationBlock: 5156,
    creationFee: '9',
    creationTime: 1502291695,
    cumulativeScale: '1',
    description: 'Will the Bitcoin (BTC) price be equal to or higher than USD 3,400 on 31 August 2017 as shown on www.coinmarketcap.com?',
    endDate: 1504130400,
    eventBond: '4.5',
    extraInfo: 'http://www.nationalpopularvote.com',
    id: '0xe095e00863aecd814003a739da97b54c2b6737bd',
    makerFee: '0.01',
    maxValue: '2',
    minValue: '1',
    network: '9000',
    numOutcomes: 2,
    outcomes: [{
      id: 1,
      outstandingShares: '2101.2',
      price: '0',
      sharesPurchased: '0',
    }, {
      id: 2,
      outstandingShares: '2101.2',
      price: '0.99',
      sharesPurchased: '0',
    }],
    resolutionSource: 'www.coinmarketcap.com',
    tags: ['Bitcoin', 'Cryptocurrency', null],
    takerFee: '0.02',
    topic: 'Bitcoin',
    tradingFee: '0.02',
    tradingPeriod: 8704,
    type: 'binary',
    volume: '8346'
  }
}

augur.markets.getMarketsInfo({
  marketIDs: [
    '0xfb9165a0f492a910082c02bc174d3b3b7f7f979e', '0x563b377a956c80d77a7c613a9343699ad6123911'
  ]
}, function (marketsInfo) { /* ... */ })
// example output:
{
  '0xfb9165a0f492a910082c02bc174d3b3b7f7f979e': {
    author: '0x9e12c5b6067c61c811add8fb55f5d6fcb88a9e5f',
    branchID: '0xf69b5',
    consensus: null,
    creationTime: 1502248542,
    description: 'Who will win the University of Georgia vs. University of Florida football game in 2017?~|>Georgia|Florida|Vanderbilt',
    endDate: 1509346800,
    id: '0xfb9165a0f492a910082c02bc174d3b3b7f7f979e',
    makerFee: '0.01',
    maxValue: '3',
    minValue: '1',
    numOutcomes: 3,
    tags: ['sports', 'college football', 'football'],
    takerFee: '0.02',
    topic: 'sports',
    tradingFee: '0.02',
    tradingPeriod: 8734,
    type: 'categorical',
    volume: '1195.999999999999999997'
  },
  '0x563b377a956c80d77a7c613a9343699ad6123911': {
    author: '0x9e12c5b6067c61c811add8fb55f5d6fcb88a9e5f',
    branchID: '0xf69b5',
    consensus: null,
    creationTime: 1502248522,
    description: "Will Augur's live release happen by the end of August, 2017?",
    endDate: 1504249200,
    id: '0x563b377a956c80d77a7c613a9343699ad6123911',
    makerFee: '0.010000000000000000125',
    maxValue: '2',
    minValue: '1',
    numOutcomes: 2,
    tags: ['Augur', 'release date', 'Ethereum'],
    takerFee: '0.030000000000000000375',
    topic: 'Augur',
    tradingFee: '0.026666666666666667',
    tradingPeriod: 8705,
    type: 'binary',
    volume: '29623.019599999999999969'
  }
}

All of the methods in the Simplified API are getter methods that use an eth_call RPC request; for transactional requests (eth_sendTransaction), see the Transaction API section below. This API is simplified in the sense that single requests to this API can be used to fetch a large amount of data, without the need for complicated RPC batch queries.

augur.trading.orderBook.getOrderBook({ _type, _market, _outcome, minPrice, maxPrice[, _startingOrderId, _numOrdersToLoad ]}[, callback])

Retrieves a section of the Order Book for a specified Market. The required params are _market which is the address of the Market we intend to get the order book for. The _type which is either set to 1 for getting the Buy side of the order book and 2 for the sell side. The _outcome which is an integer value between 1 and 8 for the Outcome we want to get Orders for. The minPrice and maxPrice are also required and should be set to the minimum and maximum possible prices for a Share. The two optional parameters are _startingOrderId which defaults to 0x0, which indicates “start from the best order”, and _numOrdersToLoad which defaults to 0, or “load all orders”. The _startingOrderId field should be the order ID from which to start walking towards the order book’s tail, as a hexadecimal string. The _numOrdersToLoad is expected to be a whole number. The getOrderBook function generally should be used only to fetch a small chunk of orders. To fetch entire order book, typically getOrderBookChunked should be used instead.

augur.trading.orderBook.getOrderBookChunked({ _type, _market, _outcome, minPrice, maxPrice[, _startingOrderId, _numOrdersToLoad ]}[, onChunkCallback, onCompleteCallback ])

Very similar to the above getOrderBook function, however this function is designed for getting the entire side of an Outcome’s Order Book for a specific Market in chunks. The getOrderBookChunked function has a params object with the same keys as getOrderBook but they work slightly differently. The _numOrdersToLoad key is now the chunk size, which instead of defaulting to 0 or “load all orders”, it defaults to the default chunk size: 100. The chunk size is simply the number of orders each request will attempt to bring back at a time. This function also has two callbacks, the onChunkCallback and the onCompleteCallback. The onChunkCallback will be triggered for each chunk of orders received where as the onCompleteCallback will only be called when the entire order book’s single outcome side has been returned. In our example, we are looking to find all the buy orders for outcome 1 in our market, starting from the order ID 0x3c3958b3cad3fb693a6fdd013a615485ef42d824aaa3bd57734f5ec21567ebdc in chunks of three orders per return to onChunkCallback.

augur.markets.getMarketInfo({ _market }[, callback])

Returns information about a Market (_market) that is stored on-contract. Information returned will include all kinds of basic information about the market as well as information about each market Outcome. This information doesn’t include the Order Book however and you should use getOrderBook or getOrderBookChunked to get information about Open Orders for the specified Market.

augur.markets.batchGetMarketInfo({ marketIDs }[, callback])

Retrieve a marketsInfo object for the Market IDs in the array marketIDs. The marketsInfo object will contain marketInfo objects (see above for example) which are indexed by their respective market IDs. Much like the above getMarketsInfo the Order Book will not be included in the market information returned and needs to be retrieved separately.

augur.markets.getMarketsInfo({ marketIDs }[, callback])

This function returns a marketsInfo object containing marketInfo objects indexed by their respective market IDs similar to batchGetMarketInfo. This function does not return as much information about the markets as batchGetMarketInfo.

Call API

// Call API Example
/**
* Check account 0x05ae1d0ca6206c6168b42efcd1fbe0ed144e821b's Cash balance.
*/
const address = "0x05ae1d0ca6206c6168b42efcd1fbe0ed144e821b";
const params = { _owner: address };

// augur.api.<Contract Name>.<Contract Method>(<Params Object>, <Callback Function>);

// asynchronously -- STRONGLY RECOMMENDED --
augur.api.Cash.balanceOf(params, balance => console.log(balance));
// console prints 9999.495000000000000001

// synchronous -- possible but not recommended.
const money = augur.api.Cash.balanceOf(params);
// money = 9999.495000000000000001

Augur’s Call API is made up of “getter” methods that retrieve information from the blockchain (using Ethereum’s eth_call RPC) but does not write information to the blockchain. The Call API is for more granular “gets” then the Simplified API allows for. The Call API is directly mapped to the Augur Contracts and their publicly exposed methods. All Call API functions will accept two arguments, a params object with key/value pairs that match inputs for the contract method and a callback function. The Augur API functions are attached to the augur.api object and follow a pattern of augur.api.<Contract Name>.<Contract Method>(<Params Object>, <Callback Function>). Although technically optional, the Augur Team strongly recommends using a callback. Without the callback the calls will be synchronous which can lock up your browser until they complete.

Branch Call API

// Branch Contract Call API Examples:
const branch = "0x0920d1513057572be46580b7ef75d1d01a99a3e5";
const _parentPayoutDistributionHash = "0x4480ed40f94e2cb2ca244eb862df2d350300904a96039eb53cba0e34b8ace90a";

augur.api.Branch.getChildBranch({ branch, _parentPayoutDistributionHash }, function (childBranch) { /* ... */ })
// example output:
childBranch = "0xb4e8c1f85c4382d64954aca187f9f386c8bb1a6c"

augur.api.Branch.getCurrentReportingWindow({ branch }, function (currReportingWindow) { /* ... */ })
// example output:
currReportingWindow = "578"

augur.api.Branch.getForkEndTime({ branch }, function (forkEndTime) { /* ... */ })
// example output:
forkEndTime = "1489855429";

augur.api.Branch.getForkingMarket({ branch }, function (forkingMarket) { /* ... */ })
// example output:
forkingMarket = "0x78f7b43150d27c464359e735781c16ac585f52a8";

augur.api.Branch.getNextReportingWindow({ branch }, function (nextReportingWindow) { /* ... */ })
// example output:
nextReportingWindow = "579"

augur.api.Branch.getParentBranch({ branch }, function (parentBranch) { /* ... */ })
// example output:
parentBranch = "0x63c59544b89cce1dd53b1b566862189b25adec41"

augur.api.Branch.getParentPayoutDistributionHash({ branch }, function (branchParentPayoutDistributionHash) { /* ... */ })
// example output:
branchParentPayoutDistributionHash = "0xa310ca2018af3cb2ca244eb862df2d350300904a96039eb53cbaff012c92d10c"

augur.api.Branch.getPreviousReportingWindow({ branch }, function (previousReportingWindow) { /* ... */ })
// example output:
previousReportingWindow = "577"

augur.api.Branch.getReportingPeriodDurationInSeconds({ branch }, function (reportingPeriodDuration) { /* ... */ })
// example output:
reportingPeriodDuration = "2592000";

const _endTime = 2524608000;
augur.api.Branch.getReportingWindowByMarketEndTime({ branch, _endTime, _hasAutomatedReporter: 0 }, function (reportingWindowByEndTime) { /* ... */ })
// example output:
reportingWindowByEndTime = "0x06cbcd92af2571f1419b622a794d65db524f682a";

augur.api.Branch.getReportingWindowByTimestamp({ branch, _timestamp: endTime }, function (reportingWindowByTimestamp) { /* ... */ })
// example output:
reportingWindowByTimestamp = "0x06cbcd92af2571f1419b622a794d65db524f682a";

augur.api.Branch.getReportingWindowId({ branch, _timestamp: new Date().getTime() }, function (reportingWindowId) { /* ... */ })
// example output:
reportingWindowId = "578";

augur.api.Branch.getReputationToken({ branch }, function (reputationTokenAddress) { /* ... */ })
// example output:
reputationTokenAddress = "0x2fb561b2bdbcd1ae1995bdd6aff6776d6f4292f2";

augur.api.Branch.getTopics({ branch }, function (topicsAddress) { /* ... */ })
// example output:
topicsAddress = "0x14f094c79a676c681e7cc490e775f73072e535ae";

augur.api.Branch.getTypeName({ branch }, function (typeName) { /* ... */ })
// example output:
typeName = "Branch";

const market = "0x9368ff3e9ce1c0459b309fac6dd4e69229b91a42";
augur.api.Branch.isContainerForMarket({ branch, _shadyTarget: market }, function (isContainerForMarket) { /* ... */ })
// example output:
isContainerForMarket = "1";

const registrationToken = "0x8385755a52e85df2f571ce5e1550e5472c639352";
augur.api.Branch.isContainerForRegistrationToken({ branch, _shadyTarget: registrationToken }, function (isContainerForRegistrationToken) { /* ... */ })
// example output:
isContainerForRegistrationToken = "1";

const reportingToken = "0x2a73cec0b62fcb8c3120bc80bdb2b1351c8c2d1e";
augur.api.Branch.isContainerForReportingToken({ branch, _shadyTarget: reportingToken }, function (isContainerForReportingToken) { /* ... */ })
// example output:
isContainerForReportingToken = "1";

const reportingWindow = "578";
augur.api.Branch.isContainerForReportingWindow({ branch, _shadyTarget: reportingWindow }, function (isContainerForReportingWindow) { /* ... */ })
// example output:
isContainerForReportingWindow = "1";

const childBranch = "0xb4e8c1f85c4382d64954aca187f9f386c8bb1a6c";
augur.api.Branch.isParentOf({ branch, _shadyChild: childBranch }, function (isParentOf) { /* ... */ })
// example output:
isParentOf = "1";

Branch Contract Code

augur.api.Branch.getChildBranch({ branch, _parentPayoutDistributionHash }[, callback])

Returns the child branch address of the specified branch address related to the _parentPayoutDistributionHash provided.

augur.api.Branch.getCurrentReportingWindow({ branch }[, callback])

Returns the current reporting window ID for the specified branch.

augur.api.Branch.getForkEndTime({ branch }[, callback])

Returns the timestamp for when the fork ends given a specified branch.

augur.api.Branch.getForkingMarket({ branch }[, callback])

Returns the address of the market that the specified branch is forking over.

augur.api.Branch.getNextReportingWindow({ branch }[, callback])

Returns the next reporting window ID for a specific branch.

augur.api.Branch.getParentBranch({ branch }[, callback])

Returns the parent branch address of the specified branch.

augur.api.Branch.getParentPayoutDistributionHash({ branch }[, callback])

Returns the parent branch’s payout distribution hash given a branch address.

augur.api.Branch.getPreviousReportingWindow({ branch }[, callback])

Returns the previous reporting window ID for the specified branch.

augur.api.Branch.getReportingPeriodDurationInSeconds({ branch }[, callback])

Returns the specified branch’s reporting period duration in seconds.

augur.api.Branch.getReportingWindowByMarketEndTime({ branch, _endTime, _hasAutomatedReporter }[, callback])

Returns the reporting window address on the specific branch given an _endTime and if the market we are checking for has an automated reporter or not (_hasAutomatedReporter). _hasAutomatedReporter should be 0 for markets without an automated reporter, 1 for markets with an automated reporter.

augur.api.Branch.getReportingWindowByTimestamp({ branch, _timestamp }[, callback])

Returns the reporting window address for a specific branch and provided _timestamp.

augur.api.Branch.getReportingWindowId({ branch, _timestamp }[, callback])

Returns the reporting window ID for a specific branch and provided _timestamp. This is calculated by dividing the timestamp by the branch’s reporting period duration in seconds.

augur.api.Branch.getReputationToken({ branch }[, callback])

Returns the reputation token address for a specific branch.

augur.api.Branch.getTopics({ branch }[, callback])

Returns the topics address for the specific branch.

augur.api.Branch.getTypeName({ branch }[, callback])

Returns the specified branch’s type name, which should always return “Branch”.

augur.api.Branch.isContainerForMarket({ branch, _shadyTarget }[, callback])

Returns wether the specific branch is a container for the _shadyTarget address provided. Returns 1 if true, 0 if false.

augur.api.Branch.isContainerForRegistrationToken({ branch, _shadyTarget }[, callback])

Returns wether the specific branch is a container for the _shadyTarget address provided. Returns 1 if true, 0 if false.

augur.api.Branch.isContainerForReportingToken({ branch, _shadyTarget }[, callback])

Returns wether the specific branch is a container for the _shadyTarget address provided. Returns 1 if true, 0 if false.

augur.api.Branch.isContainerForReportingWindow({ branch, _shadyTarget }[, callback])

Returns wether the specific branch is a container for the _shadyTarget provided. Returns 1 if true, 0 if false.

augur.api.Branch.isParentOf({ branch, _shadyChild }[, callback])

Returns wether the specific branch is a container for the _shadyChild branch address provided. Returns 1 if true, 0 if false.

Dispute Bond Token Call API

// Dispute Bond Token Contract Call API Examples:
const disputeBondToken = "0xe5d6eaefcfaf7ea1e17c4768a554d57800699ea4";
const _address = "0x3d62bafc1791752393384b902f813da861ddedd9";

augur.api.DisputeBondToken.balanceOf({ disputeBondToken, _address }, function (balance) { /* ... */ })
// example output:
balance = "1"

augur.api.DisputeBondToken.getBondHolder({ disputeBondToken }, function (bondHolder) { /* ... */ })
// example output:
bondHolder = "0x3d62bafc1791752393384b902f813da861ddedd9"

augur.api.DisputeBondToken.getBondRemainingToBePaidOut({ disputeBondToken }, function (bondRemainingToBePaidOut) { /* ... */ })
// example output:
bondRemainingToBePaidOut = "1100000000000000000000"

augur.api.DisputeBondToken.getBranch({ disputeBondToken }, function (branch) { /* ... */ })
// example output:
branch = "0x0920d1513057572be46580b7ef75d1d01a99a3e5"

augur.api.DisputeBondToken.getDisputedPayoutDistributionHash({ disputeBondToken }, function (disputedPayoutDistributionHash) { /* ... */ })
// example output:
disputedPayoutDistributionHash = "0xff89be2020af3cb2ca244eb862df2d350300904a96039eb53cbacf380f13f21b"

augur.api.DisputeBondToken.getMarket({ disputeBondToken }, function (market) { /* ... */ })
// example output:
market = "0x9368ff3e9ce1c0459b309fac6dd4e69229b91a42"

augur.api.DisputeBondToken.getReputationToken({ disputeBondToken }, function (reputationToken) { /* ... */ })
// example output:
reputationToken = "0x2a73cec0b62fcb8c3120bc80bdb2b1351c8c2d1e"

augur.api.DisputeBondToken.getTotalSupply({ disputeBondToken }, function (totalSupply) { /* ... */ })
// example output:
totalSupply = "1"

augur.api.DisputeBondToken.getTypeName({ disputeBondToken }, function (typeName) { /* ... */ })
// example output:
typeName = "DisputeBondToken";

Dispute Bond Token Contract Code

augur.api.DisputeBondToken.balanceOf({ disputeBondToken, _address }[, callback])

This transaction will return the balance for a specified disputeBondToken owned by the provided _address. Will always result in 1 or 0.

augur.api.DisputeBondToken.getBondHolder({ disputeBondToken }[, callback])

This transaction will return the address of the bond holder for a specified disputeBondToken.

augur.api.DisputeBondToken.getBondRemainingToBePaidOut({ disputeBondToken }[, callback])

This transaction will return the amount, denoted in attotokens, of bond remaining to be paid out for a specified disputeBondToken.

augur.api.DisputeBondToken.getBranch({ disputeBondToken }[, callback])

This transaction will return the branch that a specified disputeBondToken’s market lives on.

augur.api.DisputeBondToken.getDisputedPayoutDistributionHash({ disputeBondToken }[, callback])

This transaction will return the distribution hash for the dispute payout given a specified disputeBondToken.

augur.api.DisputeBondToken.getMarket({ disputeBondToken }[, callback])

This transaction will return the market that a specified disputeBondToken is disputing the results of.

augur.api.DisputeBondToken.getReputationToken({ disputeBondToken }[, callback])

This transaction will return the reputation token address that a specified disputeBondToken’s market uses.

augur.api.DisputeBondToken.getTotalSupply({ disputeBondToken }[, callback])

This transaction will return the total supply of a specified disputeBondToken, which will always return 1.

augur.api.DisputeBondToken.getTypeName({ disputeBondToken }[, callback])

Returns the type name of the specified disputeBondToken, this should always return “DisputeBondToken”.

Market Call API

// Market Contract Call API Examples:
const market = "0x9368ff3e9ce1c0459b309fac6dd4e69229b91a42";

augur.api.Market.canBeReportedOn({ market }, function (canBeReportedOn) { /* ... */ })
// example output:
canBeReportedOn = "1"

augur.api.Market.getAutomatedReportDisputeDueTimestamp({ market }, function (automatedReporterDisputeDueTimestamp) { /* ... */ })
// example output:
automatedReporterDisputeDueTimestamp = "1500907130"

augur.api.Market.getAutomatedReportDueTimestamp({ market }, function (automatedReporterDueTimestamp) { /* ... */ })
// example output:
automatedReporterDueTimestamp = "1500647930"

augur.api.Market.getBranch({ market }, function (branch) { /* ... */ })
// example output:
branch = "0x0920d1513057572be46580b7ef75d1d01a99a3e5"

augur.api.Market.getCompleteSetCostInAttotokens({ market }, function (completeSetCostInAttotokens) { /* ... */ })
// example output:
completeSetCostInAttotokens = "1000000000000000000"

augur.api.Market.getCreator({ market }, function (marketCreator) { /* ... */ })
// example output:
marketCreator = "0x438f2aeb8a16745b1cd711e168581ebce744ffaa"

augur.api.Market.getDenominationToken({ market }, function (denominationToken) { /* ... */ })
// example output:
denominationToken = "0x30e3852448f4ab5d62bbf7544ca3c92daca5c957"

augur.api.Market.getEndTime({ market }, function (endTime) { /* ... */ })
// example output:
endTime = "1500388730";

augur.api.Market.getFinalizationTime({ market }, function (finalizationTime) { /* ... */ })
// example output:
finalizationTime = "1500647930";

augur.api.Market.getFinalPayoutDistributionHash({ market }, function (finalPayoutDistributionHash) { /* ... */ })
// example output:
finalPayoutDistributionHash = "0xa310ca2018af3cb2ca244eb862df2d350300904a96039eb53cbaff012c92d10c"

augur.api.Market.getFinalWinningReportingToken({ market }, function (winningReportingToken) { /* ... */ })
// example output:
winningReportingToken = "0x2a73cec0b62fcb8c3120bc80bdb2b1351c8c2d1e"

augur.api.Market.getMarketCreatorSettlementFeeInAttoethPerEth({ market }, function (marketCreatorSettlementFee) { /* ... */ })
// example output:
marketCreatorSettlementFee = "20000000000000000"

augur.api.Market.getMaxDisplayPrice({ market }, function (maxDisplayPrice) { /* ... */ })
// example output:
maxDisplayPrice = "1"

augur.api.Market.getMinDisplayPrice({ market }, function (minDisplayPrice) { /* ... */ })
// example output:
minDisplayPrice = "0"

augur.api.Market.getNumberOfOutcomes({ market }, function (numOutcomes) { /* ... */ })
// example output:
numOutcomes = "2"

augur.api.Market.getPayoutDenominator({ market }, function (payoutDenominator) { /* ... */ })
// example output:
payoutDenominator = "1"

augur.api.Market.getRegistrationToken({ market }, function (registrationToken) { /* ... */ })
// example output:
registrationToken = "0x8385755a52e85df2f571ce5e1550e5472c639352"

augur.api.Market.getReportingWindow({ market }, function (reportingWindow) { /* ... */ })
// example output:
reportingWindow = "0x06cbcd92af2571f1419b622a794d65db524f682a"

augur.api.Market.getReputationToken({ market }, function (reputationToken) { /* ... */ })
// example output:
reputationToken = "0x2a73cec0b62fcb8c3120bc80bdb2b1351c8c2d1e"

augur.api.Market.getShareToken({ market, _outcome: 1 }, function (shareToken) { /* ... */ })
// example output:
shareToken = "0x18b17188ce3c491f6ab4427258d92452be5c8054"

augur.api.Market.getTentativeWinningPayoutDistributionHash({ market }, function (tentativeWinningPayoutDistributionHash) { /* ... */ })
// example output:
tentativeWinningPayoutDistributionHash = "0x4480ed40f94e2cb2ca244eb862df2d350300904a96039eb53cba0e34b8ace90a"

augur.api.Market.getTopic({ market }, function (topic) { /* ... */ })
// example output:
topic = "Augur"

augur.api.Market.getTypeName({ market }, function (typeName) { /* ... */ })
// example output:
typeName = "Market";

const reportingToken = "0xbb87186146569514b8cd8b72e57eec3849e3981f";
augur.api.Market.isContainerForReportingToken({ market, _shadyTarget: reportingToken }, function (isContainerForReportingToken) { /* ... */ })
// example output:
isContainerForReportingToken = "1"

const shareToken = "0x18b17188ce3c491f6ab4427258d92452be5c8054";
augur.api.Market.isContainerForShareToken({ market, _shadyTarget: shareToken }, function (isContainerForShareToken) { /* ... */ })
// example output:
isContainerForShareToken = "1"

const disputeBondToken = "0xe5d6eaefcfaf7ea1e17c4768a554d57800699ea4";
augur.api.Market.isContainerForDisputeBondToken({ market, _shadyTarget: disputeBondToken }, function (isContainerForShareToken) { /* ... */ })
// example output:
isContainerForDisputeBondToken = "1"

augur.api.Market.isDoneWithAllReporters({ market }, function (isDoneWithAllReporters) { /* ... */ })
// example output:
isDoneWithAllReporters = "1"

augur.api.Market.isDoneWithAutomatedReporters({ market }, function (isDoneWithAutomatedReporters) { /* ... */ })
// example output:
isDoneWithAutomatedReporters = "1"

augur.api.Market.isDoneWithLimitedReporters({ market }, function (isDoneWithLimitedReporters) { /* ... */ })
// example output:
isDoneWithLimitedReporters = "1"

augur.api.Market.isFinalized({ market }, function (isFinalized) { /* ... */ })
// example output:
isFinalized = "1"

augur.api.Market.isInAllDisputePhase({ market }, function (isInAllDisputePhase) { /* ... */ })
// example output:
isInAllDisputePhase = "1";

augur.api.Market.isInAllReportingPhase({ market }, function (isInAllReportingPhase) { /* ... */ })
// example output:
isInAllReportingPhase = "1";

augur.api.Market.isInAutomatedDisputePhase({ market }, function (isInAutomatedDisputePhase) { /* ... */ })
// example output:
isInAutomatedDisputePhase = "1";

augur.api.Market.isInAutomatedReportingPhase({ market }, function (isInAutomatedReportingPhase) { /* ... */ })
// example output:
isInAutomatedReportingPhase = "1";

augur.api.Market.isInLimitedDisputePhase({ market }, function (isInLimitedDisputePhase) { /* ... */ })
// example output:
isInLimitedDisputePhase = "1";

augur.api.Market.isInLimitedReportingPhase({ market }, function (isInLimitedReportingPhase) { /* ... */ })
// example output:
isInLimitedReportingPhase = "1";

augur.api.Market.needsMigration({ market }, function (needsMigration) { /* ... */ })
// example output:
needsMigration = "1";

augur.api.Market.shouldCollectReportingFees({ market }, function (shouldCollectReportingFees) { /* ... */ })
// example output:
shouldCollectReportingFees = "1";

Market Contract Code

augur.api.Market.canBeReportedOn({ market }[, callback])

Returns wether the specific market can be reported on. Returns 1 if true, 0 if false.

augur.api.Market.getAutomatedReportDisputeDueTimestamp({ market }[, callback])

Returns the timestamp for when a specific market’s automated report process and dispute period should be completed.

augur.api.Market.getAutomatedReportDueTimestamp({ market }[, callback])

Returns the timestamp for when a specific market’s automated report process should be completed but doesn’t count the dispute period.

augur.api.Market.getBranch({ market }[, callback])

Returns the branch ID of the branch that the specified market is contained within.

augur.api.Market.getCompleteSetCostInAttotokens({ market }[, callback])

Returns the cost of a complete set for a specific market denominated in attotokens.

augur.api.Market.getCreator({ market }[, callback])

Returns the address of the creator of the specified market.

augur.api.Market.getDenominationToken({ market }[, callback])

Returns the address of the token used to denominate the specified market.

augur.api.Market.getEndTime({ market }[, callback])

Returns the timestamp for when the specified market’s event has come to pass and the market is ready to be reported on.

augur.api.Market.getFinalizationTime({ market }[, callback])

Returns the timestamp for when the specified market was finalized.

augur.api.Market.getFinalPayoutDistributionHash({ market }[, callback])

Returns the final payout distribution hash for a specified market.

augur.api.Market.getFinalWinningReportingToken({ market }[, callback])

Returns the winning reporting token address for a specified market.

augur.api.Market.getMarketCreatorSettlementFeeInAttoethPerEth({ market }[, callback])

Returns the fee paid to the market creator denominated in attotokens for 1 token settled on the market.

augur.api.Market.getMaxDisplayPrice({ market }[, callback])

Returns the maximum displayed price for the specified market.

augur.api.Market.getMinDisplayPrice({ market }[, callback])

Returns the minimum displayed price for the specified market.

augur.api.Market.getNumberOfOutcomes({ market }[, callback])

Returns the number of outcomes for a specified market.

augur.api.Market.getPayoutDenominator({ market }[, callback])

Returns the payout denominator for a specified market.

augur.api.Market.getRegistrationToken({ market }[, callback])

Returns the registration token’s address for the specified market.

augur.api.Market.getReportingWindow({ market }[, callback])

Returns the reporting window address for the specified market.

augur.api.Market.getReputationToken({ market }[, callback])

Returns the reputation token’s address for the specified market.

augur.api.Market.getShareToken({ market, _outcome }[, callback])

Returns the share token’s address for the specified market and _outcome.

augur.api.Market.getTentativeWinningPayoutDistributionHash({ market }[, callback])

Returns the tentatively winning Payout Distribution Hash given a specified market.

augur.api.Market.getTopic({ market }[, callback])

Returns the topic of the specified market.

augur.api.Market.getTypeName({ market }[, callback])

Returns the type name for the specified market, should always return “Market”.

augur.api.Market.isContainerForReportingToken({ market, _shadyTarget }[, callback])

Returns wether the specific market is a container for the _shadyTarget address provided, which is the reporting token address we intend to check. Returns 1 if true, 0 if false.

augur.api.Market.isContainerForShareToken({ market, _shadyTarget }[, callback])

Returns wether the specific market is a container for the _shadyTarget address provided, which is the share token address we intend to check. Returns 1 if true, 0 if false.

augur.api.Market.isContainerForDisputeBondToken({ market, _shadyTarget }[, callback])

Returns wether the specific market is a container for the _shadyTarget address provided. A _shadyTarget will return true if it is a automated report dispute bond token, a limited reporter dispute bond token, or an all reporters dispute bond token for this market. Returns 1 if true, 0 if false.

augur.api.Market.isDoneWithAllReporters({ market }[, callback])

Returns wether the specific market is done with the all reporting phase or not. Returns 1 if true, 0 if false.

augur.api.Market.isDoneWithAutomatedReporters({ market }[, callback])

Returns wether the specific market is done with the automated reporting phase or not. Returns 1 if true, 0 if false.

augur.api.Market.isDoneWithLimitedReporters({ market }[, callback])

Returns wether the specific market is done with the limited reporting phase or not. Returns 1 if true, 0 if false.

augur.api.Market.isFinalized({ market }[, callback])

Returns wether the specific market has been finalized or not. Returns 1 if true, 0 if false.

augur.api.Market.isInAllDisputePhase({ market }[, callback])

Returns wether the specific market is current in the All Dispute Phase or not. Returns 1 if true, 0 if false.

augur.api.Market.isInAllReportingPhase({ market }[, callback])

Returns wether the specific market is current in the All Reporting Phase or not. Returns 1 if true, 0 if false.

augur.api.Market.isInAutomatedDisputePhase({ market }[, callback])

Returns wether the specific market is current in the Automated Dispute Phase or not. Returns 1 if true, 0 if false.

augur.api.Market.isInAutomatedReportingPhase({ market }[, callback])

Returns wether the specific market is current in the Automated Reporting Phase or not. Returns 1 if true, 0 if false.

augur.api.Market.isInLimitedDisputePhase({ market }[, callback])

Returns wether the specific market is current in the Limited Dispute Phase or not. Returns 1 if true, 0 if false.

augur.api.Market.isInLimitedReportingPhase({ market }[, callback])

Returns wether the specific market is current in the the Limited Reporting Phase or not. Returns 1 if true, 0 if false.

augur.api.Market.needsMigration({ market }[, callback])

Returns wether the specific market needs to be migrated to a new branch or not. Returns 1 if true, 0 if false.

augur.api.Market.shouldCollectReportingFees({ market }[, callback])

Returns wether the specific market should collect reporting fees or not. Returns 1 if true, 0 if false.

Registration Token Call API

// Registration Token Contract Call API Examples:
const registrationToken = "0x8385755a52e85df2f571ce5e1550e5472c639352";
const _owner = "0x438f2aeb8a16745b1cd711e168581ebce744ffaa";
const _spender = "0xfe9d0408be14d1d1ec28671b03bda1b80748977e";

augur.api.RegistrationToken.allowance({ registrationToken, _owner, _spender }, function (allowance) { /* ... */ })
// example output:
allowance = "1";

augur.api.RegistrationToken.balanceOf({ registrationToken, _owner }, function (balance) { /* ... */ })
// example output:
balance = "1";

augur.api.RegistrationToken.getBranch({ registrationToken }, function (branch) { /* ... */ })
// example output:
branch = "0x0920d1513057572be46580b7ef75d1d01a99a3e5"

augur.api.RegistrationToken.getPeakSupply({ registrationToken }, function (peakSuppy) { /* ... */ })
// example output:
peakSuppy = "234"

augur.api.RegistrationToken.getReportingWindow({ registrationToken }, function (reportingWindow) { /* ... */ })
// example output:
reportingWindow = "0x06cbcd92af2571f1419b622a794d65db524f682a"

augur.api.RegistrationToken.getReputationToken({ registrationToken }, function (reputationToken) { /* ... */ })
// example output:
reputationToken = "0x2a73cec0b62fcb8c3120bc80bdb2b1351c8c2d1e"

augur.api.RegistrationToken.getTotalSupply({ registrationToken }, function (totalSupply) { /* ... */ })
// example output:
totalSupply = "215";

augur.api.RegistrationToken.getTypeName({ registrationToken }, function (typeName) { /* ... */ })
// example output:
typeName = "RegistrationToken";

Registration Token Contract Code

augur.api.RegistrationToken.allowance({ registrationToken, _owner, _spender }[, callback])

Returns the allowance that a specified _spender can spend of the _owner’s registrationTokens.

augur.api.RegistrationToken.balanceOf({ registrationToken, _owner }[, callback])

Returns the token balance for the specified registrationToken owned by the _owner provided.

augur.api.RegistrationToken.getBranch({ registrationToken }[, callback])

Returns the Branch address for the specified registrationToken’s Reporting Window.

augur.api.RegistrationToken.getPeakSupply({ registrationToken }[, callback])

Returns the peak supply of tokens for the specified registrationToken.

augur.api.RegistrationToken.getReportingWindow({ registrationToken }[, callback])

Returns the Reporting Window address for the specified registrationToken.

augur.api.RegistrationToken.getReputationToken({ registrationToken }[, callback])

Returns the Reputation Tokens address for the specific registrationToken’s Reporting Window.

augur.api.RegistrationToken.getTotalSupply({ registrationToken }[, callback])

Returns the current total supply of the specified registrationToken.

augur.api.RegistrationToken.getTypeName({ registrationToken }[, callback])

Returns the type name for the specified registrationToken, should always return “RegistrationToken”.

Reporting Token Call API

// Reporting Token Contract Call API Examples:
const reportingToken = "0xbb87186146569514b8cd8b72e57eec3849e3981f";
const _owner = "0x438f2aeb8a16745b1cd711e168581ebce744ffaa";
const _spender = "0xfe9d0408be14d1d1ec28671b03bda1b80748977e";

augur.api.ReportingToken.allowance({ reportingToken, _owner, _spender }, function (allowance) { /* ... */ })
// example output:
allowance = "1"

augur.api.ReportingToken.balanceOf({ reportingToken, _owner }, function (balance) { /* ... */ })
// example output:
balance = "1"

augur.api.ReportingToken.getBranch({ reportingToken }, function (branch) { /* ... */ })
// example output:
branch = "0x0920d1513057572be46580b7ef75d1d01a99a3e5"

augur.api.ReportingToken.getMarket({ reportingToken }, function (market) { /* ... */ })
// example output:
market = "0x9368ff3e9ce1c0459b309fac6dd4e69229b91a42"

augur.api.ReportingToken.getPayoutDistributionHash({ reportingToken }, function (payoutDistributionHash) { /* ... */ })
// example output:
payoutDistributionHash = "0x4480ed40f94e2cb2ca244eb862df2d350300904a96039eb53cba0e34b8ace90a"

augur.api.ReportingToken.getPayoutNumerator({ reportingToken, index: 0 }, function (payoutNumerator) { /* ... */ })
// example output:
payoutNumerator = "1"

augur.api.ReportingToken.getRegistrationToken({ reportingToken }, function (registrationToken) { /* ... */ })
// example output:
registrationToken = "0x8385755a52e85df2f571ce5e1550e5472c639352"

augur.api.ReportingToken.getReportingWindow({ reportingToken }, function (reportingWindow) { /* ... */ })
// example output:
reportingWindow = "0x06cbcd92af2571f1419b622a794d65db524f682a"

augur.api.ReportingToken.getReputationToken({ reportingToken }, function (reputationToken) { /* ... */ })
// example output:
reputationToken = "0x2a73cec0b62fcb8c3120bc80bdb2b1351c8c2d1e"

augur.api.ReportingToken.getTotalSupply({ reportingToken }, function (totalSupply) { /* ... */ })
// example output:
totalSupply = "210"

augur.api.ReportingToken.getTypeName({ reportingToken }, function (typeName) { /* ... */ })
// example output:
typeName = "ReportingToken";

Reporting Token Contract Code

augur.api.ReportingToken.allowance({ reportingToken, _owner, _spender }[, callback])

Returns the allowance that a specified _spender can spend of the _owner’s reportingTokens.

augur.api.ReportingToken.balanceOf({ reportingToken, _owner }[, callback])

Returns the token balance for the specified reportingToken owned by the provided _owner.

augur.api.ReportingToken.getBranch({ reportingToken }[, callback])

Returns the Branch address for the specified reportingToken’s Reporting Window.

augur.api.ReportingToken.getMarket({ reportingToken }[, callback])

Returns the market address for the specified reportingToken.

augur.api.ReportingToken.getPayoutDistributionHash({ reportingToken }[, callback])

Returns the payoutDistributionHash for a specific reportingToken.

augur.api.ReportingToken.getPayoutNumerator({ reportingToken, index }[, callback])

Returns the payout Numerator for a specific reportingToken given an outcome index.

augur.api.ReportingToken.getRegistrationToken({ reportingToken }[, callback])

Returns the Registration Token address for this specific reportingToken.

augur.api.ReportingToken.getReportingWindow({ reportingToken }[, callback])

Returns the Reporting Window address for the specified reportingToken.

augur.api.ReportingToken.getReputationToken({ reportingToken }[, callback])

Returns the Reputation Tokens address for the specific reportingToken’s Reporting Window.

augur.api.ReportingToken.getTotalSupply({ reportingToken }[, callback])

Returns the current total supply of the specified reportingToken.

augur.api.ReportingToken.getTypeName({ reportingToken }[, callback])

Returns the type name for the specified reportingToken, should always return “ReportingToken”.

Reporting Window Call API

// Reporting Window Contract Call API Examples:
const reportingWindow = "0x06cbcd92af2571f1419b622a794d65db524f682a";

augur.api.ReportingWindow.getBranch({ reportingWindow }, function (branch) { /* ... */ })
// example output:
branch = "0x0920d1513057572be46580b7ef75d1d01a99a3e5"

augur.api.ReportingWindow.getDisputeEndTime({ reportingWindow }, function (disputeEndTime) { /* ... */ })
// example output:
disputeEndTime = "1500907130"

augur.api.ReportingWindow.getDisputeStartTime({ reportingWindow }, function (disputeStartTime) { /* ... */ })
// example output:
disputeStartTime = "1500647930"

augur.api.ReportingWindow.getEndTime({ reportingWindow }, function (endTime) { /* ... */ })
// example output:
endTime = "1500388730"

augur.api.ReportingWindow.getMaxReportsPerLimitedReporterMarket({ reportingWindow }, function (maxReportsPerLimitedReporterMarket) { /* ... */ })
// example output:
maxReportsPerLimitedReporterMarket = "9"

const _market = "0x9368ff3e9ce1c0459b309fac6dd4e69229b91a42";
augur.api.ReportingWindow.getNumberOfReportsByMarket({ reportingWindow, _market }, function (numOfReportsByMarket) { /* ... */ })
// example output:
numOfReportsByMarket = "10";

augur.api.ReportingWindow.getRegistrationToken({ reportingWindow }, function (registrationToken) { /* ... */ })
// example output:
registrationToken = "0x8385755a52e85df2f571ce5e1550e5472c639352"

augur.api.ReportingWindow.getReportingEndTime({ reportingWindow }, function (reportingEndTime) { /* ... */ })
// example output:
reportingEndTime = "1500647900"

augur.api.ReportingWindow.getReportingStartTime({ reportingWindow }, function (reportingStartTime) { /* ... */ })
// example output:
reportingStartTime = "14998315100"

const _reporter = "0x2cd999e2f90dfc237ccbc52e2a469e1e11221f75";
augur.api.ReportingWindow.getReportsByReporter({ reportingWindow, _reporter }, function (reportsByReporter) { /* ... */ })
// example output:
reportsByReporter = "0x03198001d1c223b2fdb1866703a7c2e4d5313f80"

augur.api.ReportingWindow.getReputationToken({ reportingWindow }, function (reputationToken) { /* ... */ })
// example output:
reputationToken = "0x2a73cec0b62fcb8c3120bc80bdb2b1351c8c2d1e"

augur.api.ReportingWindow.getRequiredReportsPerReporterForlimitedReporterMarkets({ reportingWindow }, function (requiredReportsPerReporterForLimitedReporterMarkets) { /* ... */ })
// example output:
requiredReportsPerReporterForLimitedReporterMarkets = "2"

augur.api.ReportingWindow.getStartTime({ reportingWindow }, function (startTime) { /* ... */ })
// example output:
startTime = "14995895900"

augur.api.ReportingWindow.getTargetReportsPerLimitedReporterMarket({ reportingWindow }, function (targetReportsPerLimitedReporterMarket) { /* ... */ })
// example output:
targetReportsPerLimitedReporterMarket = "3"

augur.api.ReportingWindow.getTargetReportsPerReporter({ reportingWindow }, function (targetReportsPerReporter) { /* ... */ })
// example output:
targetReportsPerReporter = "5"

augur.api.ReportingWindow.isActive({ reportingWindow }, function (isActive) { /* ... */ })
// example output:
isActive = "1"

augur.api.ReportingWindow.isContainerForMarket({ reportingWindow, _shadyMarket: _market }, function (isContainerForMarket) { /* ... */ })
// example output:
isContainerForMarket = "1"

const _registrationToken = "0x8385755a52e85df2f571ce5e1550e5472c639352";
augur.api.ReportingWindow.isContainerForRegistrationToken({ reportingWindow, _shadyRegistrationToken: _registrationToken }, function (isContainerForRegistrationToken) { /* ... */ })
// example output:
isContainerForRegistrationToken = "1"

augur.api.ReportingWindow.isDisputeActive({ reportingWindow }, function (isDisputeActive) { /* ... */ })
// example output:
isDisputeActive = "1"

augur.api.ReportingWindow.isDoneReporting({ reportingWindow, _reporter }, function (isDoneReporting) { /* ... */ })
// example output:
isDoneReporting = "1"

augur.api.ReportingWindow.isReportingActive({ reportingWindow }, function (isReportingActive) { /* ... */ })
// example output:
isReportingActive = "1"

Reporting Window Contract Code

augur.api.ReportingWindow.getBranch({ reportingWindow }[, callback])

Returns the branch address that contains the specified reportingWindow.

augur.api.ReportingWindow.getDisputeEndTime({ reportingWindow }[, callback])

Returns the Dispute End Time for a specified reportingWindow.

augur.api.ReportingWindow.getDisputeStartTime({ reportingWindow }[, callback])

Returns the Dispute Start Time for the specified reportingWindow.

augur.api.ReportingWindow.getEndTime({ reportingWindow }[, callback])

Returns the End Time for the specified reportingWindow.

augur.api.ReportingWindow.getMaxReportsPerLimitedReporterMarket({ reportingWindow }[, callback])

Returns the maximum number of reports a limited reporter market can have in the specified reportingWindow.

augur.api.ReportingWindow.getNumberOfReportsByMarket({ reportingWindow, _market }[, callback])

Returns the number of reports submitted so far to a specified _market in a given reportingWindow.

augur.api.ReportingWindow.getRegistrationToken({ reportingWindow }[, callback])

Returns the Registration Token address for the specified reportingWindow.

augur.api.ReportingWindow.getReportingEndTime({ reportingWindow }[, callback])

Returns the reporting phase end time for the specified reportingWindow.

augur.api.ReportingWindow.getReportingStartTime({ reportingWindow }[, callback])

Returns the reporting phase start time for the specified reportingWindow.

augur.api.ReportingWindow.getReportsByReporter({ reportingWindow, reporter }[, callback])

Returns the reports set address for the specified reportingWindow and reporter.

augur.api.ReportingWindow.getReputationToken({ reportingWindow }[, callback])

Returns the Reputation Token address for the specified reportingWindow.

augur.api.ReportingWindow.getRequiredReportsPerReporterForlimitedReporterMarkets({ reportingWindow }[, callback])

Returns the required number of reports per reporter for the limited reporter markets contained within the specified reportingWindow.

augur.api.ReportingWindow.getStartTime({ reportingWindow }[, callback])

Returns the specified reportingWindow’s start time.

augur.api.ReportingWindow.getTargetReportsPerLimitedReporterMarket({ reportingWindow }[, callback])

Returns the target number of reports per reporter for the limited reporter markets contained within the specified reportingWindow.

augur.api.ReportingWindow.getTargetReportsPerReporter({ reportingWindow }[, callback])

Returns the target number of reports per reporter for all markets contained within the specified reportingWindow.

augur.api.ReportingWindow.isActive({ reportingWindow }[, callback])

Returns wether the specified reportingWindow is currently active or not. Returns 1 if true, 0 if false.

augur.api.ReportingWindow.isContainerForMarket({ reportingWindow, shadyMarket }[, callback])

Returns wether the specified reportingWindow contains the shadyMarket or not. Returns 1 if true, 0 if false.

augur.api.ReportingWindow.isContainerForRegistrationToken({ reportingWindow, shadyRegistrationToken }[, callback])

Returns wether the specified reportingWindow contains the shadyRegistrationToken or not. Returns 1 if true, 0 if false.

augur.api.ReportingWindow.isDisputeActive({ reportingWindow }[, callback])

Returns wether the specified reportingWindow’s dispute phase is active or not. Returns 1 if true, 0 if false.

augur.api.ReportingWindow.isDoneReporting({ reportingWindow, reporter }[, callback])

Returns wether the specified reporter is finished reporting for the reportingWindow or not. Returns 1 if true, 0 if false.

augur.api.ReportingWindow.isReportingActive({ reportingWindow }[, callback])

Returns wether the specified reportingWindow’s reporting phase is active or not. Returns 1 if true, 0 if false.

Reputation Token Call API

// Reputation Token Contract Call API Examples:
const reputationToken = "0x2a73cec0b62fcb8c3120bc80bdb2b1351c8c2d1e";
const _owner = "0x438f2aeb8a16745b1cd711e168581ebce744ffaa";
const _spender = "0xfe9d0408be14d1d1ec28671b03bda1b80748977e";

augur.api.ReputationToken.allowance({ reputationToken, _owner, _spender }, function (allowance) { /* ... */ })
// example output:
allowance = "200"

augur.api.ReputationToken.assertReputationTokenIsLegit({ _shadyReputationToken: reputationToken }, function (isLegitREPToken) { /* ... */ })
// example output:
isLegitREPToken = true;

augur.api.ReputationToken.balanceOf({ reputationToken, _owner }, function (balance) { /* ... */ })
// example output:
balance = "1000"

augur.api.ReputationToken.getBranch({ reputationToken }, function (branch) { /* ... */ })
// example output:
branch = "0x0920d1513057572be46580b7ef75d1d01a99a3e5"

augur.api.ReputationToken.getTopMigrationDestination({ reputationToken }, function (topMigrationDestination) { /* ... */ })
// example output:
topMigrationDestination = "0x1aa30942000ac72dee6580e1ac32d1d01ac1af00"

augur.api.ReputationToken.getTotalSupply({ reputationToken }, function (totalSupply) { /* ... */ })
// example output:
totalSupply = "11000000"

augur.api.ReputationToken.getTypeName({ reputationToken }, function (typeName) { /* ... */ })
// example output:
reputationToken = "ReputationToken";

Reputation Token Contract Code

augur.api.ReputationToken.allowance({ reputationToken, _owner, _spender }[, callback])

Returns the allowance that a specified _spender can spend of the _owner’s reputationTokens.

augur.api.ReputationToken.assertReputationTokenIsLegit({ reputationToken, _shadyReputationToken }[, callback])

Returns true or false depending on if the _shadyReputationToken provided is actually a legitimate token belonging to the correct branch for a specified reputationToken.

augur.api.ReputationToken.balanceOf({ reputationToken, _owner }[, callback])

Returns the token balance of the specified reputationToken owned by the _owner provided.

augur.api.ReputationToken.getBranch({ reputationToken }[, callback])

Returns the Branch address for the specified reputationToken.

augur.api.ReputationToken.getTopMigrationDestination({ reputationToken }[, callback])

Returns the top migration destination address for the specified reputationToken.

augur.api.ReputationToken.getTotalSupply({ reputationToken }[, callback])

Returns the current total supply of the specified reputationToken.

augur.api.ReputationToken.getTypeName({ reputationToken }[, callback])

Returns the type name for a specified reputationToken, this should always return “ReputationToken”.

Cash Call API

// Cash Contract Call API Examples:
const _owner = "0x438f2aeb8a16745b1cd711e168581ebce744ffaa";
const _spender = "0xfe9d0408be14d1d1ec28671b03bda1b80748977e";

augur.api.Cash.allowance({ _owner, _spender }, function (allowance) { /* ... */ })
// example output:
allowance = "100"

augur.api.Cash.balanceOf({ _owner }, function (balance) { /* ... */ })
// example output:
balance = "10000"

augur.api.Cash.getDecimals({}, function (decimals) { /* ... */ })
// example output:
decimals = "18"

augur.api.Cash.getInitiated({}, function (initiated) { /* ... */ })
// example output:
initiated = "1"

augur.api.Cash.getName({}, function (name) { /* ... */ })
// example output:
name = "Cash"

augur.api.Cash.getSymbol({}, function (symbol) { /* ... */ })
// example output:
symbol = "CASH"

augur.api.Cash.getTotalSupply({}, function (totalSupply) { /* ... */ })
// example output:
totalSupply = "11000000"

Cash Contract Code

augur.api.Cash.allowance({ _owner, _spender }[, callback])

Returns the allowance that a specified _spender address can spend of the _owner address’ Cash tokens.

augur.api.Cash.balanceOf({ _owner }[, callback])

Returns the balance of Cash tokens owned by the specified _owner.

augur.api.Cash.getDecimals({}[, callback])

Returns the amount of decimal places that the Cash contract is accurate to: 18, like Ether.

augur.api.Cash.getInitiated({}[, callback])

Returns wether the sender of this call has initiated a withdraw of Ether from the Cash contract or not. Returns 1 if true, 0 if false.

augur.api.Cash.getName({}[, callback])

Returns the name string for Cash: Cash.

augur.api.Cash.getSymbol({}[, callback])

Returns the symbol string for Cash: CASH.

augur.api.Cash.getTotalSupply({}[, callback])

Returns the current total supply of Cash.

Orders Call API

// Orders Contract Call API Examples:
const _orderId = "0x7ca90ca9118db456d87e3d743b97782a857200b55039f7ffe8de94e5d920f870";
const _type = "1";
const _market = "0x9368ff3e9ce1c0459b309fac6dd4e69229b91a42";
const _outcome = "1";
const _fxpPrice = "450000000000000000"; // 0.45

augur.api.Orders.assertIsNotBetterPrice({ _type, _fxpPrice, _betterOrderId: _orderId }, function (isNotBetterPrice) { /* ... */ })
// example output:
isNotBetterPrice = "1"

augur.api.Orders.assertIsNotWorsePrice({ _type, _fxpPrice, _worstOrderId: _orderId }, function (isNotWorstPrice) { /* ... */ })
// example output:
isNotWorstPrice = "0"

augur.api.Orders.getAmount({ _orderId }, function (amount) { /* ... */ })
// example output:
amount = "15"

augur.api.Orders.getBestOrderId({ _type, _market, _outcome }, function (bestOrderID) { /* ... */ })
// example output:
bestOrderID = "0x7ca90ca9118db456d87e3d743b97782a857200b55039f7ffe8de94e5d920f870"

augur.api.Orders.getBestOrderWorstOrderHash({ _market, _outcome, _type }, function (bestOrderWorstOrderHash) { /* ... */ })
// example output:
bestOrderWorstOrderHash = "0x502caca9a38d2456d8ac2d743b49982a857222b53039f7eee8de94e5d91aec99"

const secondBestOrderID = "0x49cb49f610b5f6e31ee163a8ad65f964af1088e38c8a1b07f1218177b5e006b5";
augur.api.Orders.getBetterOrderId({ _orderId: secondBestOrderID }, function (betterOrderID) { /* ... */ })
// example output:
betterOrderID = "0x7ca90ca9118db456d87e3d743b97782a857200b55039f7ffe8de94e5d920f870"

augur.api.Orders.getLastOutcomePrice({ _market, _outcome }, function (lastOutcomePrice) { /* ... */ })
// example output:
lastOutcomePrice = "490000000000000000"

augur.api.Orders.getMarket({ _orderId }, function (orderMarket) { /* ... */ })
// example output:
orderMarket = "0x9368ff3e9ce1c0459b309fac6dd4e69229b91a42";

augur.api.Orders.getOrderMoneyEscrowed({ _orderId }, function (orderMoneyEscrowed) { /* ... */ })
// example output:
orderMoneyEscrowed = "5000000000000000000"

augur.api.Orders.getOrderMaker({ _orderId }, function (owner) { /* ... */ })
// example output:
owner = "0x438f2aeb8a16745b1cd711e168581ebce744ffaa";

augur.api.Orders.getOrderSharesEscrowed({ _orderId }, function (orderSharesEscrowed) { /* ... */ })
// example output:
orderSharesEscrowed = "0";

augur.api.Orders.getOutcome({ _orderId }, function (orderOutcome) { /* ... */ })
// example output:
orderOutcome = "1";

augur.api.Orders.getPrice({ _orderId }, function (price) { /* ... */ })
// example output:
price = "500000000000000000";

augur.api.Orders.getTradeType({ _orderId }, function (type) { /* ... */ })
// example output:
type = "1";

augur.api.Orders.getVolume({ _market }, function (volume) { /* ... */ })
// example output:
volume = "100000000000000000000000";

const secondWorstOrderID = "0x4b538f4de2517f7d7bbb227161981c51c40bf725da9941b3dc02e6c14cafd1f1";
augur.api.Orders.getWorseOrderId({ _orderId: secondWorstOrderID }, function (worseOrderID) { /* ... */ })
// example output:
worseOrderID = "0x9a8d5523ed521813533d1f8469f5040fa1404fcf470b9da43bccfe38c80ad035"

augur.api.Orders.getWorstOrderId({ _type, _market, _outcome }, function (worstOrderID) { /* ... */ })
// example output:
worstOrderID = "0x9a8d5523ed521813533d1f8469f5040fa1404fcf470b9da43bccfe38c80ad035"

augur.api.Orders.isBetterPrice({ _type, _fxpPrice, _orderId }, function (isBetterPrice) { /* ... */ })
// example output:
isBetterPrice = "0"

augur.api.Orders.isWorsePrice({ _type, _fxpPrice, _orderId }, function (isWorsePrice) { /* ... */ })
// example output:
isWorsePrice = "1"

Orders Contract Code

augur.api.Orders.assertIsNotBetterPrice({ _type, _fxpPrice, _betterOrderId }[, callback])

Returns wether the specified _fxpPrice is not a better price than the _betterOrderId for a given order _type. Returns 1 if true, 0 if false.

augur.api.Orders.assertIsNotWorsePrice({ _type, _fxpPrice, _worstOrderId }[, callback])

Returns wether the specified _fxpPrice is not a worst price than the _worstOrderId for a given order _type. Returns 1 if true, 0 if false.

augur.api.Orders.getAmount({ _orderId }[, callback])

Returns the amount of Shares requested on a specified _orderId.

augur.api.Orders.getBestOrderId({ _type, _market, _outcome }[, callback])

Returns the order ID of the best order on the _market of _type trading on the provided _outcome.

augur.api.Orders.getBestOrderWorstOrderHash({ _market, _outcome, _type }[, callback])

Returns a sha256 order hash containing the inputted params _market, _outcome, and _type.

augur.api.Orders.getBetterOrderId({ _orderId }[, callback])

Returns a better order ID than the _orderId.

augur.api.Orders.getLastOutcomePrice({ _market, _outcome }[, callback])

Returns the fixed point value of the last price traded for a specified _market and _outcome.

augur.api.Orders.getMarket({ _orderId }[, callback])

Returns the Market address for the specified _orderId.

augur.api.Orders.getOrderMoneyEscrowed({ _orderId }[, callback])

Returns the fixed point value of the amount of money escrowed by the Maker for a specified _orderId.

augur.api.Orders.getOrderMaker({ _orderId }[, callback])

Returns the Maker address of the specified _orderId.

augur.api.Orders.getOrderSharesEscrowed({ _orderId }[, callback])

Returns the fixed point value of the amount of shares escrowed by the Maker for a specified _orderId.

augur.api.Orders.getOutcome({ _orderId }[, callback])

Returns the Outcome being traded on for the specified _orderId.

augur.api.Orders.getPrice({ _orderId }[, callback])

Returns the fixed point value of the price of a specified _orderId.

augur.api.Orders.getTradeType({ _orderId }[, callback])

Returns the trade type, 1 for buy and 2 for sell, for a specified _orderId.

augur.api.Orders.getVolume({ _market }[, callback])

Returns the fixed point value of the volume of a specified _market.

augur.api.Orders.getWorseOrderId({ _orderId }[, callback])

Returns a worse order ID than the _orderId.

augur.api.Orders.getWorstOrderId({ _type, _market, _outcome }[, callback])

Returns the order ID of the worst order on the _market of _type trading on the provided _outcome.

augur.api.Orders.isBetterPrice({ _type, _fxpPrice, _orderId }[, callback])

Returns wether the specified _fxpPrice is a better price than the _orderId for a given order _type. Returns 1 if true, 0 if false.

augur.api.Orders.isWorsePrice({ _type, _fxpPrice, _orderId }[, callback])

Returns wether the specified _fxpPrice is a worst price than the _orderId for a given order _type. Returns 1 if true, 0 if false.

Orders Fetcher Call API

// Orders Fetcher Contract Call API Examples:
const _orderId = "0x7ca90ca9118db456d87e3d743b97782a857200b55039f7ffe8de94e5d920f870";
const _type = "1";
const _market = "0x9368ff3e9ce1c0459b309fac6dd4e69229b91a42";
const _outcome = "1";
const _fxpPrice = "450000000000000000"; // 0.45

augur.api.OrdersFetcher.ascendOrderList({ _type, _fxpPrice, _lowestOrderId: _orderId }, function (ascendingOrderList) { /* ... */ })
// example output:
ascendingOrderList = [
  "0x7ca90ca9118db456d87e3d743b97782a857200b55039f7ffe8de94e5d920f870",
  "0x4a8d07c2c9cd996484c04b7077d1fc4aeaeb8aa4750d7f26f2a896c4393fb6b0"]

augur.api.OrdersFetcher.descendOrderList({ _type, _fxpPrice, _highestOrderId: _orderId }, function (decendingOrderList) { /* ... */ })
// example output:
decendingOrderList = [
  "0x09502d4c2765d61a8e47fd4ada696966f3bc3bce6b780ecedded035e616c272e",
  "0x7ca90ca9118db456d87e3d743b97782a857200b55039f7ffe8de94e5d920f870"]

augur.api.OrdersFetcher.findBoundingOrders({ _type, _fxpPrice, _bestOrderId: _orderId, _worstOrderId: 0, _betterOrderId: 0, _worseOrderId: 0 }, function (boundingOrders) { /* ... */ })
// example output:
boundingOrders = [
  "0x4a8d07c2c9cd996484c04b7077d1fc4aeaeb8aa4750d7f26f2a896c4393fb6b0",
  "0x09502d4c2765d61a8e47fd4ada696966f3bc3bce6b780ecedded035e616c272e"]

augur.api.OrdersFetcher.getOrder({ _orderId }, function (order) { /* ... */ })
// example output:
order = [ "10000000000000000000",
          "500000000000000000",
          "0x438f2aeb8a16745b1cd711e168581ebce744ffaa",
          "5000000000000000000",
          "0",
          "0x4a8d07c2c9cd996484c04b7077d1fc4aeaeb8aa4750d7f26f2a896c4393fb6b0",
          "0x09502d4c2765d61a8e47fd4ada696966f3bc3bce6b780ecedded035e616c272e",
          "42000000000000"  ]

augur.api.OrdersFetcher.getOrderIds({ _type, _market, _outcome, _startingOrderId: _orderId, _numOrdersToLoad: 2 }, function (orderIDs) { /* ... */ })
// example output:
orderIDs = [
  "0x7ca90ca9118db456d87e3d743b97782a857200b55039f7ffe8de94e5d920f870",
  "0x4a8d07c2c9cd996484c04b7077d1fc4aeaeb8aa4750d7f26f2a896c4393fb6b0"]

Orders Fetcher Contract Code

augur.api.OrdersFetcher.ascendOrderList({ _type, _fxpPrice, _lowestOrderId }[, callback])

Returns an array containing the order IDs that should be the better Order ID and worse Order ID respectively for an order inserted at _fxpPrice. _lowestOrderId is an order ID expected to be a worse price than the _fxpPrice specified for an order of _type.

augur.api.OrdersFetcher.descendOrderList({ _type, _fxpPrice, _highestOrderId }[, callback])

Returns an array containing the order IDs that should be set to better Order ID and worse Order ID respectively for an order inserted at _fxpPrice. _highestOrderId is an order ID expected to be a better price than the _fxpPrice specified for an order of _type.

augur.api.OrdersFetcher.findBoundingOrders({ _type, _fxpPrice, _bestOrderId, _worstOrderId, _betterOrderId, _worseOrderId }[, callback])

Returns an array containing the order IDs that should be set to better Order ID and worse Order ID respectively for an order inserted at _fxpPrice. _betterOrderId and _worseOrderId should be orders that are better or worse than the _fxpPrice for an order of _type. _bestOrderId and _worstOrderId should be the best and worst order IDs on the order book for the specified _type.

augur.api.OrdersFetcher.getOrder({ _orderId }[, callback])

Returns a length 8 array containing information about a specified _orderId. Information returned includes: amount of attoshares, fixed point display price, owner address, tokens escrowed, shares escrowed, better order id, worse order id, and gas price.

augur.api.OrdersFetcher.getOrderIDs({ _type, _startingOrderId, _numOrdersToLoad }[, callback])

Returns an array of order IDs of _type starting from the _startingOrderId order ID specified. The array will be of length _numOrdersToLoad.

Share Token Call API

// Share Token Contract Call API Examples:
const shareToken = "0x18b17188ce3c491f6ab4427258d92452be5c8054";
const _owner = "0x438f2aeb8a16745b1cd711e168581ebce744ffaa";
const _spender = "0xfe9d0408be14d1d1ec28671b03bda1b80748977e";

augur.api.ShareToken.allowance({ shareToken, _owner, _spender }, function (allowance) { /* ... */ })
// example output:
allowance = "100"

augur.api.ShareToken.balanceOf({ shareToken, _owner }, function (balance) { /* ... */ })
// example output:
balance = "1000"

augur.api.ShareToken.getDecimals({ shareToken }, function (decimals) { /* ... */ })
// example output:
decimals = "18"

augur.api.ShareToken.getMarket({ shareToken }, function (market) { /* ... */ })
// example output:
market = "0x9368ff3e9ce1c0459b309fac6dd4e69229b91a42"

augur.api.ShareToken.getName({ shareToken }, function (name) { /* ... */ })
// example output:
name = "Shares"

augur.api.ShareToken.getOutcome({ shareToken }, function (outcome) { /* ... */ })
// example output:
outcome = "1"

augur.api.ShareToken.getSymbol({ shareToken }, function (symbol) { /* ... */ })
// example output:
symbol = "SHARES"

augur.api.ShareToken.isShareToken({ shareToken }, function (isShareToken) { /* ... */ })
// example output:
isShareToken = "1"

augur.api.ShareToken.getTotalSupply({ shareToken }, function (totalSupply) { /* ... */ })
// example output:
totalSupply = "50000"

augur.api.ShareToken.getTypeName({ shareToken }, function (typeName) { /* ... */ })
// example output:
typeName = "ShareToken";

Share Token Contract Code

augur.api.ShareToken.allowance({ shareToken, _owner, _spender }[, callback])

Returns the token allowance a _spender can use of an _owner’s specified shareTokens.

augur.api.ShareToken.balanceOf({ shareToken, _owner }[, callback])

Returns the token balance of a specified shareToken owned by the _owner.

augur.api.ShareToken.getDecimals({ shareToken }[, callback])

Returns the amount of decimal places the shareToken is accurate to: 18.

augur.api.ShareToken.getMarket({ shareToken }[, callback])

Returns the market address for the specified shareToken.

augur.api.ShareToken.getName({ shareToken }[, callback])

Returns the name string of the shareToken: Shares.

augur.api.ShareToken.getOutcome({ shareToken }[, callback])

Returns the Outcome of the market that the specified shareToken is for.

augur.api.ShareToken.getSymbol({ shareToken }[, callback])

Returns the symbol string of the shareToken: SHARES.

augur.api.ShareToken.isShareToken({ shareToken }[, callback])

Returns wether the shareToken is a share token or not. Returns 1 if true, 0 if false. (should always be true.)

augur.api.ShareToken.getTotalSupply({ shareToken }[, callback])

Returns the total supply of shareTokens specified.

augur.api.ShareToken.getTypeName({ shareToken }[, callback])

Returns the type name for a specific shareToken, which should always return “ShareToken”.

Topics Call API

// Topics Contract Call API Examples:
const topics = "0x14f094c79a676c681e7cc490e775f73072e535ae";
const _topic = "Augur";

augur.api.Topics.count({ topics }, function (count) { /* ... */ })
// example output:
count = "152"

augur.api.Topics.getPopularity({ topics, _topic }, function (popularity) { /* ... */ })
// example output:
popularity = "1000"

augur.api.Topics.getPopularityByOffset({ topics, _offset: 0 }, function () { /* ... */ })
// example output:
popularity = "1000"

augur.api.Topics.getTopicByOffset({ topics, _offset: 0 }, function () { /* ... */ })
// example output:
topic = "Augur"

Topics Contract Code

augur.api.Topics.count({ topics }[, callback])

Returns a count of all the Topics at the specified topics address.

augur.api.Topics.getPopularity({ topics, _topic }[, callback])

Returns the popularity value of a specified _topic at the topics address provided.

augur.api.Topics.getPopularityByOffset({ topics, _offset }[, callback])

Returns the popularity of the Topic at the index _offset at the topics address provided.

augur.api.Topics.getTopicByOffset({ topics, _offset }[, callback])

Returns the Topic at the index _offset at the topics address provided.

Transaction API

// Transaction API (Tx API for short) example:
const privateKey = <Buffer ...>;
const reputationTokenAddress = "0x2a73cec0b62fcb8c3120bc80bdb2b1351c8c2d1e";
const transferTarget = "0xea674fdde714fd979de3edf0f56aa9716b898ec8";
const attotokens = "100000000000000000000"; // 1000.00 REP

// the Augur API is organized by Contract and then Method like so:
// augur.api.<Contract>.<Method>(<argument object>);
augur.api.ReputationToken.transfer({
  _signer: privateKey,
  reputationToken: reputationTokenAddress,
  _to: transferTarget,
  _value: attotokens,
  onSent: (result) => console.log(result),
  onSuccess: (result) => console.log(result),
  onFailed: (result) => console.log(result)
});
// example sent output:
sentResponse = {
  txHash: '0x915f8f0b13244b0dd9b7377b252d9245ef0fc109c82931a87410d1bdad671fe6',
  callReturn: '1'
}
// example successful output:
successResponse = {
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320512,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0x915f8f0b13244b0dd9b7377b252d9245ef0fc109c82931a87410d1bdad671fe6",
  input: "0x83b58638000000000000000000000000ea674fdde714fd979de3edf0f56aa9716b898ec80000000000000000000000000000000000000000000000056bc75e2d63100000",
  nonce: "0xf2",
  timestamp: 1501003152,
  to: "0x2a73cec0b62fcb8c3120bc80bdb2b1351c8c2d1e",
  value: "0x0"
}
// example failed output:
failedResponse = {
  error: '0x',
  message: 'no response or bad input'
}

Augur’s Transaction API (“Tx API” for short) is made up of “setter” methods that can both read from and write to the blockchain using Ethereum’s eth_sendTransaction RPC. Under the hood, the API uses augur.js’s convenience wrapper for eth_sendTransaction which can be accessed using augur.rpc.transact. Although it is possible to call augur.rpc.transact directly, which is discussed in greater detail below, it is generally better and easier to use the built in API functions. The API functions are attached to the augur.api object and follow a pattern of augur.api.<Contract>.<Method>(<Argument Object>).

Arguments

All Transaction API methods accept a single object argument. This single object must contain the onSent, onSuccess, and onFailed callback fields. This single object should contain all required params for the transactions as key/value pairs. This is different to the Call API methods which accept a params object and a second optional argument for the callback. It is strongly recommended that you use a callback, even if it’s optional in the Call API, as that will ensure your requests are made asynchronously.

Callbacks

All Transaction API methods accept three callback functions within the argument object. The following keys are used for each callback:

onSent(sentResponse)

Fires when the initial eth_sendTransaction response is received. If the transaction was broadcast to the network without problems, sentResponse will have two fields: txHash (the transaction hash as a hex string) and callReturn (the value returned by the invoked contract method). The optional returns field in the payload object sent to augur.rpc.transact can be used to specify the format of the callReturn value.

onSuccess(successResponse)

Fires when the transaction is successfully incorporated into a block and added to the blockchain, as indicated by a nonzero blockHash value. successResponse is structured the same way as eth_getTransactionByHash responses (see code example for details), with the addition of a callReturn field which contains the contract method’s return value.

onFailed(failedResponse)

Fires if the transaction is unsuccessful. failedResponse has error (error code) and message (error description) fields, describing the way in which the transaction failed.

Signer

In addition to the arguments and callbacks, all Transaction API functions require a _signer param. The _signer param should be set to the private key buffer or a signing function, provided by a hardware wallet, of the account who wishes to initiate the transaction. The Transaction API functions all attempt to modify information on the blockchain which requires a signed transaction. Anytime you plan to modify or “set” information on the blockchain you will need to include a _signer param. This concept is discussed in a bit more detail in the next section.

Using Transact Directly

// using augur.rpc.transact() directly example:
// payload object (generated by transfer method of the Cash Contract)
const payload = {
  to: "0x039546e174d6a2f4c9239e08094b114fa82efc23",
  events: ["Transfer"],
  label: "Transfer",
  method: "transfer",
  signature: ['int256', 'int256'],
  fixed: [1],
  from: "0x05ae1d0ca6206c6168b42efcd1fbe0ed144e821b",
  params: [
    "0x6329a1eb5c9c6c5cd3739fd35a1fd028e50c1456",
    "1000",
  ],
  returns: "unfix",
  send: true
};

// onSent callback fires when the initial eth_sendTransaction response
// is received
const onSent = sentResponse => console.log("transaction sent:", sentResponse);  

// onSuccess callback fires
const onSuccess = successResponse => console.log("transaction successful:", successResponse);

// onFailed callback fires when the transaction is malformed, fails to confirm,
// or an object with an error field is received
const onFailed = failedResponse => console.error("transaction failed:", failedResponse);

// privateKeyorSigner is either the privateKey buffer of the account trying to send the transaction or a function to sign a transaction (generally from a hardware wallet). Below we are going to use the Buffer returned from augur.accounts.login.
const privateKeyOrSigner = <Buffer ...>;

augur.rpc.transact(payload, privateKeyOrSigner, onSent, onSuccess, onFailed);
// example outputs:
sentResponse = {
  txHash: '0xdf096e249638df143118f562868e90285579819e59b09f0784b95fa5fd920413',
  callReturn: '1000'
}
successResponse = {
  nonce: '0x4e1',
  blockHash: '0xb8e4e78c9cf949729bbb7b94e942d8d63e67e9f48b394f3208cf0d2928e44bad',
  blockNumber: '0x6a5f',
  transactionIndex: '0x0',
  from: '0x05ae1d0ca6206c6168b42efcd1fbe0ed144e821b',
  to: '0x039546e174d6a2f4c9239e08094b114fa82efc23',
  value: '0x0',
  gas: '0x2fd618',
  gasPrice: '0xba43b7400',
  input: '0x867445580000000000000000000000006329a1eb5c9c6c5cd3739fd35a1fd028e50c145600000000000000000000000000000000000000000000000000000000000003e8',
  callReturn: '1000',
  txHash: '0xdf096e249638df143118f562868e90285579819e59b09f0784b95fa5fd920413'
}
failedResponse = {
  error: 501,
  message: 'polled network but could not confirm transaction'
}

augur.rpc.transact(payload, privateKeyOrSigner, onSent, onSuccess, onFailed)

You can broadcast transactions to the Ethereum Network by calling augur.rpc.transact directly. If called directly, the payload object needs to be constructed by hand and must be structured correctly.

The payload object, also known as the “transaction object”, is structured as follows:

Required:

Optional:

The params and signature fields are required if your function accepts parameters; otherwise, these fields can be excluded. The returns field is used only to format the output, and does not affect the actual RPC request.

The privateKeyOrSigner is required if we are attempting to execute a transaction that will modify the blockchain (eth_sendTransaction). If we are simply getting information (eth_call) we don’t need to pass anything for privateKeyOrSigner. privateKeyOrSigner should be the Private Key Buffer for the logged in account or a function to sign transactions provided by a hardware wallet.

Under the hood augur.rpc.transact carries out the following sequence:

  1. augur.rpc.transact will first attempt to use eth_call on the transaction submitted in order to determine if there is enough GAS to perform the transaction and that the transaction is properly formed. If you have a malformed transaction, didn’t provide enough GAS, or the transaction will fail then an error is passed to the onFailed handler and the augur.rpc.transact sequence terminates.

  2. After confirming that the Transaction is valid, augur.rpc.transact will send a eth_sendTransaction RPC request (or eth_sendRawTransaction for transactions which are already signed), which broadcasts the transaction to the Ethereum Network. If no transaction hash is received or there is an error, then the error will be passed to the onFailed handler and the augur.rpc.transact sequence will terminate. Otherwise, the onSent handler will be called and return an object containing the txHash and callReturn.

  3. After calling the onSent handler, Augur will add the transaction to the transactions object (which is indexed by transaction hash, e.g. transactions[txHash]) and assign the transaction a status of "pending". Use augur.rpc.getTransactions() to access the transactions object.

  4. Augur then uses eth_getTransactionByHash to determine if the transaction has been mined or not, indicated by a null response. A null response indicates that the transaction has been (silently) removed from geth’s transaction pool. This can happen if the transaction is a duplicate of another transaction that has not yet cleared the transaction pool (and therefore geth does not fire a duplicate transaction error), or if the transaction’s nonce (but not its other fields) is a duplicate. If a null response is received from eth_getTransactionByHash then Augur will attempt to re-submit the transaction to augur.rpc.transact as long the amount of attempts hasn’t exceeded augur.constants.TX_RETRY_MAX. If the attempts to submit the transaction exceed augur.constants.TX_RETRY_MAX then a TRANSACTION_RETRY_MAX_EXCEEDED error will be sent to the onFailed handler and the augur.rpc.transact sequence will terminate.

  5. Once the transaction has been successfully mined (eth_getTransactionByHash successfully returns the transaction object) the transaction is updated to include the blockNumber and blockHash and it’s status is changed to "sealed".

  6. When the amount of confirmations of our transaction exceeds augur.constants.REQUIRED_CONFIRMATIONS then the transaction is updated to a status of "confirmed". A callReturn field is added to the transaction object, which is then passed to the onSuccess handler, completing the sequence.

Dispute Bond Token Tx API

// Dispute Bond Token Contract Transaction API Examples:
// privateKey for the msg.sender of these transactions
const privateKey = <Buffer ...>;
const disputeBondToken = "0xe5d6eaefcfaf7ea1e17c4768a554d57800699ea4";
const _destinationAddress = "0xaa895acf2091752393384b902f813da761ca421f";

augur.api.DisputeBondToken.transfer({
  _signer: privateKey,
  disputeBondToken,
  _destinationAddress,
  _attotokens: 1,
  onSent: (result) => console.log(result),
  onSuccess: (result) => console.log(result),
  onFailed: (result) => console.log(result),
});
// example output:
successResponse = {
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320480,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0x6b0f32ca16855ab6a680ebff87f63837c78e1fcdd94f909cac9acf7768e73384",
  input: "0x86744558000000000000000000000000aa895acf2091752393384b902f813da761ca421f0000000000000000000000000000000000000000000000000000000000000001",
  nonce: "0x1",
  timestamp: 1501003125,
  to: "0xe5d6eaefcfaf7ea1e17c4768a554d57800699ea4",
  value: "0x0"
}

augur.api.DisputeBondToken.withdraw({
  _signer: privateKey,
  disputeBondToken,
  onSent: (result) => console.log(result),
  onSuccess: (result) => console.log(result),
  onFailed: (result) => console.log(result),
});
// example output:
successResponse = {
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320481,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0xf5681056bab571e0ec73411896a3e8f7a7b610e43f148ea96cd06f66a2e8472a",
  input: "0x3ccfd60b",
  nonce: "0x3",
  timestamp: 1501003126,
  to: "0xe5d6eaefcfaf7ea1e17c4768a554d57800699ea4",
  value: "0x0"
}

const _shadyBranch = "0x580f633f475614636ee132a0a355dcdc826d16c8";
augur.api.DisputeBondToken.withdrawToBranch({
  _signer: privateKey,
  disputeBondToken,
  _shadyBranch,
  onSent: (result) => console.log(result),
  onSuccess: (result) => console.log(result),
  onFailed: (result) => console.log(result),
});
// example output:
successResponse = {
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320483,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0xd3a9a88dd49f9eb485498190013fe8004df40a2549e5c2f3aafb452aab0a7a98",
  input: "0x8ac17bbb000000000000000000000000580f633f475614636ee132a0a355dcdc826d16c8",
  nonce: "0x4",
  timestamp: 1501003128,
  to: "0xe5d6eaefcfaf7ea1e17c4768a554d57800699ea4",
  value: "0x0"
}

Dispute Bond Token Contract Code

augur.api.DisputeBondToken.transfer({ _signer, disputeBondToken, _destinationAddress, _attotokens, onSent, onSuccess, onFailed })

The transfer transaction will change the current bond holder to the specified _destinationAddress. This transaction will fail if the msg.sender isn’t the bond holder of the specified disputeBondToken or if the value of _attotokens isn’t equal to 1. This transaction will spawn a Transfer event which will record the from address (msg.sender), to address (_destinationAddress), and _attotokens amount transferred (1).

augur.api.DisputeBondToken.withdraw({ _signer, disputeBondToken, onSent, onSuccess, onFailed })

This transaction is used by the bond holder of the specified disputeBondToken to withdraw reputation tokens earned by correctly disputing the outcome of the disputeBondToken’s market that hasn’t caused a fork. This transaction will fail to pay out reputation tokens if the msg.sender isn’t the bond holder for the specified disputeBondToken, if the market for the disputeBondToken isn’t finalized, if the market is finalized but the final payout distribution hash is the same distribution hash challenged by the disputeBondToken, or if this disputeBondToken’s market has caused a fork.

augur.api.DisputeBondToken.withdrawToBranch({ _signer, disputeBondToken, _shadyBranch, onSent, onSuccess, onFailed })

This transaction is used by the bond holder of the specified disputeBondToken to withdraw reputation tokens earned by correctly disputing the outcome of the disputeBondToken’s market that has caused a fork. This transaction will fail to pay out reputation tokens if the msg.sender isn’t the bond holder for the specified disputeBondToken, if the _shadyBranch isn’t the child branch of the branch containing this disputeBondToken, if this disputeBondToken’s market has not caused a fork, if the payout distribution hash for the parent branch of shadyBranch is the same distribution hash challenged by the disputeBondToken.

Market Tx API

// Market Contract Transaction API Examples:
const privateKey = <Buffer ...>;
const market = "0x9368ff3e9ce1c0459b309fac6dd4e69229b91a42";
const _payoutNumerators = [ 0, 2 ];

augur.api.Market.approveSpenders({
  _signer: privateKey,
  market,
  onSent: (result) => console.log(result),
  onSuccess: (result) => console.log(result),
  onFailed: (result) => console.log(result)
})
// example output:
successResponse = {
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320485,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0xe0dd7114a82fda1daba5adee379eb2fc4fce72e2b2d0005833ffd5ee1f54064c",
  input: "0x8d7e8a57",
  nonce: "0x1",
  timestamp: 1501003130,
  to: "0x9368ff3e9ce1c0459b309fac6dd4e69229b91a42",
  value: "0x0"
}

augur.api.Market.automatedReport({
  _signer: privateKey,
  market,
  _payoutNumerators,
  onSent: (result) => console.log(result),
  onSuccess: (result) => console.log(result),
  onFailed: (result) => console.log(result)
})
// example output:
successResponse = {
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320486,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0x4c291db662925c48ed38d3c33e3f7e6599f956f3254d4a8464b71bdadb758316",
  input: "0x17c18af20000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002",
  nonce: "0x2",
  timestamp: 1501003132,
  to: "0x9368ff3e9ce1c0459b309fac6dd4e69229b91a42",
  value: "0x0"
}

augur.api.Market.decreaseMarketCreatorSettlementFeeInAttoethPerEth({
  _signer: privateKey,
  market,
  _newFeePerEthInWei: '1000000000',
  onSent: (result) => console.log(result),
  onSuccess: (result) => console.log(result),
  onFailed: (result) => console.log(result)
})
// example output:
successResponse = {
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320488,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0x6544da2190a54542e95473a6c9b18b7259480b8b48953eaa750d3e1379d8ccd6",
  input: "0x4c92c4b3000000000000000000000000000000000000000000000000000000003b9aca00",
  nonce: "0x4",
  timestamp: 1501003134,
  to: "0x9368ff3e9ce1c0459b309fac6dd4e69229b91a42",
  value: "0x0"
}

augur.api.Market.disputeAllReporters({
  _signer: privateKey,
  market,
  onSent: (result) => console.log(result),
  onSuccess: (result) => console.log(result),
  onFailed: (result) => console.log(result)
})
// example output:
successResponse = {
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320489,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0x80dbc117b8dc3868944cb8b7748ab53cec5a2d9f5041f882b04b0bf8a88e6172",
  input: "0x99ea0fd5",
  nonce: "0x5",
  timestamp: 1501003135,
  to: "0x9368ff3e9ce1c0459b309fac6dd4e69229b91a42",
  value: "0x0"
}

augur.api.Market.disputeAutomatedReport({
  _signer: privateKey,
  market,
  onSent: (result) => console.log(result),
  onSuccess: (result) => console.log(result),
  onFailed: (result) => console.log(result)
})
// example output:
successResponse = {
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320490,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0xd0d81785960bb128c35748e018ad52e599a80921c39ac02adabdaeb4a23d926c",
  input: "0x7a13d14c",
  nonce: "0x6",
  timestamp: 1501003136,
  to: "0x9368ff3e9ce1c0459b309fac6dd4e69229b91a42",
  value: "0x0"
}

augur.api.Market.disputeLimitedReporters({
  _signer: privateKey,
  market,
  onSent: (result) => console.log(result),
  onSuccess: (result) => console.log(result),
  onFailed: (result) => console.log(result)
})
// example output:
successResponse = {
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320491,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0xd3f644e8904966909a9d974c7ed63ae8ddbb0f23d824f576764afddd7023ef88",
  input: "0x3f4628c1",
  nonce: "0x7",
  timestamp: 1501003137,
  to: "0x9368ff3e9ce1c0459b309fac6dd4e69229b91a42",
  value: "0x0"
}

augur.api.Market.migrateThroughAllForks({
  _signer: privateKey,
  market,
  onSent: (result) => console.log(result),
  onSuccess: (result) => console.log(result),
  onFailed: (result) => console.log(result)
})
// example output:
successResponse = {
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320492,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0x32bf0849d589b6dd639791c7ea49579ea654a648c41b3a614878d77608ef1b07",
  input: "0x00987265",
  nonce: "0x8",
  timestamp: 1501003138,
  to: "0x9368ff3e9ce1c0459b309fac6dd4e69229b91a42",
  value: "0x0"
}

augur.api.Market.migrateThroughOneFork({
  _signer: privateKey,
  market,
  onSent: (result) => console.log(result),
  onSuccess: (result) => console.log(result),
  onFailed: (result) => console.log(result)
})
// example output:
successResponse = {
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320493,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0x32bf0849d589b6dd639791c7ea49579ea654a648c41b3a614878d77608ef1b07",
  input: "0x069b559c",
  nonce: "0x9",
  timestamp: 1501003139,
  to: "0x9368ff3e9ce1c0459b309fac6dd4e69229b91a42",
  value: "0x0"
}

augur.api.Market.tryFinalize({
  _signer: privateKey,
  market,
  onSent: (result) => console.log(result),
  onSuccess: (result) => console.log(result),
  onFailed: (result) => console.log(result)
})
// example output:
successResponse = {
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320494,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0x6b506f0f96381638635948aa0969f4fbb0e918b7a752643cbe7619f0c1f9fc67",
  input: "0x338e579e",
  nonce: "0xa",
  timestamp: 1501003140,
  to: "0x9368ff3e9ce1c0459b309fac6dd4e69229b91a42",
  value: "0x0"
}

const _payoutDistributionHash = "0x4480ed40f94e2cb2ca244eb862df2d350300904a96039eb53cba0e34b8ace90a";
augur.api.Market.updateTentativeWinningPayoutDistributionHash({
  _signer: privateKey,
  market,
  _payoutDistributionHash,
  onSent: (result) => console.log(result),
  onSuccess: (result) => console.log(result),
  onFailed: (result) => console.log(result)
})
// example output:
successResponse = {
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320499,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0x7c5aff31c3c88edfb03d10ced2c561a7464326a6941db1eee868c0a46e7fc77d",
  input: "0xe36cd6e04480ed40f94e2cb2ca244eb862df2d350300904a96039eb53cba0e34b8ace90a",
  nonce: "0xf",
  timestamp: 1501003145,
  to: "0x9368ff3e9ce1c0459b309fac6dd4e69229b91a42",
  value: "0x0"
}

Market Contract Code

augur.api.Market.approveSpenders({ _signer, market, onSent, onSuccess, onFailed })

This transaction calls a number of approve transactions for the market’s denominationToken and shareTokens to allow other contracts the ability to transfer around the market’s tokens so the market can function.

augur.api.Market.automatedReport({ _signer, market, _payoutNumerators, onSent, onSuccess, onFailed })

This transaction is used by the automatedReporter for a specified market to report the winning outcome, by submitting _payoutNumerators, of the market. This transaction will fail if the msg.sender isn’t the automatedReporterAddress set for this market, or if this market isn’t in the Automated Reporting Phase.

augur.api.Market.decreaseMarketCreatorSettlementFeeInAttoethPerEth({ _signer, market, _newFeePerEthInWei, onSent, onSuccess, onFailed })

Lowers the market creator’s settlement fee in attoeth per Eth settled to the _newFeePerEthInWei value. This transaction will fail if the msg.sender is not the creator of the market, if _newFeePerEthInWei is 0 or less, or if _newFeePerEthInWei isn’t a lower number than the current fee per Eth.

augur.api.Market.disputeAllReporters({ _signer, market, onSent, onSuccess, onFailed })

This transaction will trigger a dispute of the all reporters phase of reporting for the specified market. This transaction will take the bond amount from the msg.sender and then move the market into the upcoming reporting window. This transaction will fail if the market isn’t in the all reporters dispute phase of reporting.

augur.api.Market.disputeAutomatedReport({ _signer, market, onSent, onSuccess, onFailed })

This transaction will trigger a dispute of the automated report phase of reporting for the specified market. This transaction will take the bond amount from the msg.sender and then update the market reporting phase to limited reporting. This transaction will fail if the market isn’t in the automated dispute phase of reporting or if the market has been finalized.

augur.api.Market.disputeLimitedReporters({ _signer, market, onSent, onSuccess, onFailed })

This transaction will trigger a dispute of the limited report phase of reporting for the specified market. This transaction will take the bond amount from the msg.sender and then move the market into the next reporting window for all reporting. This transaction will fail if the market isn’t in the limited dispute phase of reporting.

augur.api.Market.migrateThroughAllForks({ _signer, market, onSent, onSuccess, onFailed })

This transaction will call migrateThroughOneFork repeatedly until the market has moved through all forks or has reached an active fork which will throw.

augur.api.Market.migrateThroughOneForks({ _signer, market, onSent, onSuccess, onFailed })

This transaction will move the market onto the active branch following a fork and refund bond holders for limited or all reporting disputes. This transaction will fail if no move is required or if the forked market isn’t finalized. Returns 1 if a move occurred, 0 if no move occurred, and throws if the forking market isn’t finalized.

augur.api.Market.tryFinalize({ _signer, market, onSent, onSuccess, onFailed })

This transaction will attempt to finalize the market. If the market becomes finalized, this transaction will return 1. If the market could not be finalized then 0 is returned instead.

augur.api.Market.updateTentativeWinningPayoutDistributionHash({ _signer, market, _payoutDistributionHash, onSent, onSuccess, onFailed })

This transaction will attempt to update the tentativeWinningPayoutDistributionHash for this market to the _payoutDistributionHash provided. This transaction will not update the tentativeWinningPayoutDistributionHash if it already has a value and it’s supply of reporting tokens is higher than the _payoutDistributionHash’s supply of reporting tokens. This transaction will fail if the _payoutDistributionHash provided isn’t a hash contained within this market’s reporting tokens. Returns 1.

Registration Token Tx API

// Registration Token Contract Transaction API Examples:
const privateKey = <Buffer ...>;
const registrationToken = "0x8385755a52e85df2f571ce5e1550e5472c639352";
const _spender = "0xfe9d0408be14d1d1ec28671b03bda1b80748977e";
const _value = "100000000000000000000";

augur.api.RegistrationToken.approve({
  _signer: privateKey,
  registrationToken,
  _spender,
  _value,
  onSent: (result) => console.log(result),
  onSuccess: (result) => console.log(result),
  onFailed: (result) => console.log(result)
});
// example output:
successResponse = {
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320494,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0x2b51b527645d4844b5f604c39c7b5bca1e7de02b028f9e70d3b2c0aaf4471163",
  input: "0x83b58638000000000000000000000000fe9d0408be14d1d1ec28671b03bda1b80748977e0000000000000000000000000000000000000000000000056bc75e2d63100000",
  nonce: "0x7",
  timestamp: 1501003138,
  to: "0x8385755a52e85df2f571ce5e1550e5472c639352",
  value: "0x0"
}

augur.api.RegistrationToken.redeem({
  _signer: privateKey,
  registrationToken,
  onSent: (result) => console.log(result),
  onSuccess: (result) => console.log(result),
  onFailed: (result) => console.log(result)
});
// example output:
successResponse = {
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320495,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0x35fceac9ab27d1e6922d10c90db97cb863876dbfb74503ef93e5df5161e04fe2",
  input: "0xbe040fb0",
  nonce: "0x8",
  timestamp: 1501003139,
  to: "0x8385755a52e85df2f571ce5e1550e5472c639352",
  value: "0x0"
}

augur.api.RegistrationToken.register({
  _signer: privateKey,
  registrationToken,
  onSent: (result) => console.log(result),
  onSuccess: (result) => console.log(result),
  onFailed: (result) => console.log(result)
});
// example output:
successResponse = {
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320496,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0x2324f99375a30a212d9b47c2478516a79c98804379599fcf9030ddbd46fd87e4",
  input: "0x1aa3a008",
  nonce: "0x9",
  timestamp: 1501003140,
  to: "0x8385755a52e85df2f571ce5e1550e5472c639352",
  value: "0x0"
}

augur.api.RegistrationToken.transfer({
  _signer: privateKey,
  registrationToken,
  _to: _spender,
  _value,
  onSent: (result) => console.log(result),
  onSuccess: (result) => console.log(result),
  onFailed: (result) => console.log(result)
});

// example output:
successResponse = {
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320497,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0x6d3e368b97bb342b2f901efb94a5b306a33f9d623ababd1a258ab3c287762682",
  input: "0x86744558000000000000000000000000fe9d0408be14d1d1ec28671b03bda1b80748977e0000000000000000000000000000000000000000000000056bc75e2d63100000",
  nonce: "0xa",
  timestamp: 1501003141,
  to: "0x8385755a52e85df2f571ce5e1550e5472c639352",
  value: "0x0"
}

const _from = "0x39d3b15006e580077a2e8b51b93be90ccf1ec0e0";
augur.api.RegistrationToken.transferFrom({
  _signer: privateKey,
  registrationToken,
  _from,
  _to: _spender,
  _value,
  onSent: (result) => console.log(result),
  onSuccess: (result) => console.log(result),
  onFailed: (result) => console.log(result)
});
// example output:
successResponse = {
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320498,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0xd9417b50a49b50a50e133173dc3fb994477af9e30cecd2c3c845f7bc79ce8f78",
  input: "0x27f08b0000000000000000000000000039d3b15006e580077a2e8b51b93be90ccf1ec0e0000000000000000000000000fe9d0408be14d1d1ec28671b03bda1b80748977e0000000000000000000000000000000000000000000000056bc75e2d63100000",
  nonce: "0xb",
  timestamp: 1501003142,
  to: "0x8385755a52e85df2f571ce5e1550e5472c639352",
  value: "0x0"
}

Registration Token Contract Code

augur.api.RegistrationToken.approve({ _signer, registrationToken, _spender, _value, onSent, onSuccess, onFailed })

Allows the _spender the ability to spend up to _value worth of the specified registrationToken for the sender of this approve transaction (msg.sender). This transaction will spawn an Approval event which will record the owner address (msg.sender), _spender, and _value approved.

augur.api.RegistrationToken.redeem({ _signer, registrationToken, onSent, onSuccess, onFailed })

If the msg.sender of this transaction has a registrationToken, has completed reporting, and the reporting window for the specified registrationToken has completed then transfer the bond amount of reputation tokens to the msg.sender. Currently the bond amount is set to 1018 attotokens, or 1 REP.

augur.api.RegistrationToken.register({ _signer, registrationToken, onSent, onSuccess, onFailed })

If the msg.sender of this transaction has the bond amount of REP, the reporting window for this registrationToken hasn’t started yet, and the msg.sender doesn’t already have a registrationToken then this transaction will transfer the bond amount of reputationTokens out of the msg.sender’s wallet and transfer 1 registrationToken to msg.sender in return. Currently the bond amount is set to 1018 attotokens, or 1 REP.

augur.api.RegistrationToken.transfer({ _signer, registrationToken, _to, _value, onSent, onSuccess, onFailed })

If the msg.sender of the transfer transaction has enough of registrationToken to be able to transfer _value worth to the _to and _value is a valid value between 1 and 2254 then this transaction will send _value worth of registrationToken to the specified _to from the msg.sender. This transaction will spawn a Transfer event which will record the from address, to address, and _value amount transferred.

augur.api.RegistrationToken.transferFrom({ _signer, registrationToken, _from, _to, _value, onSent, onSuccess, onFailed })

If the _from of the transferFrom transaction has enough of registrationToken to be able to transfer _value worth to the _to, _value is a valid value between 1 and 2254, and the msg.sender has the approval to spend at least _value worth of registrationToken for _from then this transaction will send _value worth of registrationToken to the specified _to from the _from. This transaction will spawn a Transfer event which will record the from address, to address, and _value amount transferred.

Reporting Token Tx API

// Reporting Token Contract Transaction API Examples:
const privateKey = <Buffer ...>;
const reportingToken = "0xbb87186146569514b8cd8b72e57eec3849e3981f";
const _spender = "0xfe9d0408be14d1d1ec28671b03bda1b80748977e";
const _attotokens = "100000000000000000000";

augur.api.ReportingToken.approve({
  _signer: privateKey,
  reportingToken,
  _spender,
  _value: _attotokens,
  onSent: (result) => console.log(result),
  onSuccess: (result) => console.log(result),
  onFailed: (result) => console.log(result)
});
// example output:
successResponse = {
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320499,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0xb3f94e1ad1890d0a14b21e3fd46530eb8c18887edc810e01fc789ccbfb39f067",
  input: "0x83b58638000000000000000000000000fe9d0408be14d1d1ec28671b03bda1b80748977e0000000000000000000000000000000000000000000000056bc75e2d63100000",
  nonce: "0xc",
  timestamp: 1501003143,
  to: "0x8385755a52e85df2f571ce5e1550e5472c639352",
  value: "0x0"
}

augur.api.ReportingToken.buy({
  _signer: privateKey,
  reportingToken,
  _attotokens,
  onSent: (result) => console.log(result),
  onSuccess: (result) => console.log(result),
  onFailed: (result) => console.log(result)
});
// example output:
successResponse = {
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320500,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0x99620dd1428671eb095de26ad02137916237844456e243cdaa9d9821affa5120",
  input: "0xe94030130000000000000000000000000000000000000000000000056bc75e2d63100000",
  nonce: "0xd",
  timestamp: 1501003143,
  to: "0x8385755a52e85df2f571ce5e1550e5472c639352",
  value: "0x0"
}

augur.api.ReportingToken.migrateLosingTokens({
  _signer: privateKey,
  reportingToken,
  onSent: (result) => console.log(result),
  onSuccess: (result) => console.log(result),
  onFailed: (result) => console.log(result)
});
// example output:
successResponse = {
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320502,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0x75cb653f1ab81c95d0aad86c03e092a3fa9de7252603edfabee534b8e5183141",
  input: "0xe9aa05a1",
  nonce: "0xd2",
  timestamp: 1501003151,
  to: "0x8385755a52e85df2f571ce5e1550e5472c639352",
  value: "0x0"
}

augur.api.ReportingToken.redeemDisavowedTokens({
  _signer: privateKey,
  reportingToken,
  _reporter: _spender,
  onSent: (result) => console.log(result),
  onSuccess: (result) => console.log(result),
  onFailed: (result) => console.log(result)
});
// example output:
successResponse = {
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320503,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0x3c7827f3cc51e4062c73bf9fdbd6ad51edec7d31842900cd88811e67d83eb514",
  input: "0x60b54d2e000000000000000000000000fe9d0408be14d1d1ec28671b03bda1b80748977e",
  nonce: "0xd3",
  timestamp: 1501003152,
  to: "0x8385755a52e85df2f571ce5e1550e5472c639352",
  value: "0x0"
}

augur.api.ReportingToken.redeemForkedTokens({
  _signer: privateKey,
  reportingToken,
  onSent: (result) => console.log(result),
  onSuccess: (result) => console.log(result),
  onFailed: (result) => console.log(result)
});
// example output:
successResponse = {
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320504,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0x8cfc973a802f44e5c0a93a8a0d294e680fe4735ca4f49310038908d73bb4536c",
  input: "0x00633a30000000000000000000000000fe9d0408be14d1d1ec28671b03bda1b80748977e",
  nonce: "0xd4",
  timestamp: 1501003153,
  to: "0x8385755a52e85df2f571ce5e1550e5472c639352",
  value: "0x0"
}

augur.api.ReportingToken.redeemWinningTokens({
  _signer: privateKey,
  reportingToken,
  onSent: (result) => console.log(result),
  onSuccess: (result) => console.log(result),
  onFailed: (result) => console.log(result)
});
// example output:
successResponse = {
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320505,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0xa94d27cf876602ff5cbbce344e5d03ff30c60d61c2e2adf4bf9c54c303d51b81",
  input: "0xc165c7cc000000000000000000000000fe9d0408be14d1d1ec28671b03bda1b80748977e",
  nonce: "0xd5",
  timestamp: 1501003155,
  to: "0x8385755a52e85df2f571ce5e1550e5472c639352",
  value: "0x0"
}

augur.api.ReportingToken.transfer({
  _signer: privateKey,
  reportingToken,
  _to: _spender,
  _value: _attotokens,
  onSent: (result) => console.log(result),
  onSuccess: (result) => console.log(result),
  onFailed: (result) => console.log(result)
});
// example output:
successResponse = {
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320500,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0x8f92137eff5e7824423ff6e79e15188b61d9dd9244fd2c436b020de6d8e721fe",
  input: "0x86744558000000000000000000000000fe9d0408be14d1d1ec28671b03bda1b80748977e0000000000000000000000000000000000000000000000056bc75e2d63100000",
  nonce: "0xe",
  timestamp: 1501003144,
  to: "0x8385755a52e85df2f571ce5e1550e5472c639352",
  value: "0x0"
}

const _from = "0x34c85afe56c392e240c64dc09d2a7962afe2920a";
augur.api.ReportingToken.transferFrom({
  _signer: privateKey,
  reportingToken,
  _from,
  _to: _spender,
  _value: _attotokens,
  onSent: (result) => console.log(result),
  onSuccess: (result) => console.log(result),
  onFailed: (result) => console.log(result)
});
// example output:
successResponse = {
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320501,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0x2c678df877e01d343a4e7701b92dddcecafc095fd1e4d90423838cd73eadb7d7",
  input: "0xc19cca5200000000000000000000000034c85afe56c392e240c64dc09d2a7962afe2920a000000000000000000000000fe9d0408be14d1d1ec28671b03bda1b80748977e0000000000000000000000000000000000000000000000056bc75e2d63100000",
  nonce: "0xf",
  timestamp: 1501003145,
  to: "0x8385755a52e85df2f571ce5e1550e5472c639352",
  value: "0x0"
}

Reporting Token Contract Code

augur.api.ReportingToken.approve({ _signer, reportingToken, _spender, _attotokens, onSent, onSuccess, onFailed })

Allows the _spender the ability to spend up to _attotokens worth of the specified reportingToken for the msg.sender of this approve transaction. This transaction will spawn an Approval event which will record the owner address (msg.sender), _spender, and _attotokens value approved.

augur.api.ReportingToken.buy({ _signer, reportingToken, _attotokens, onSent, onSuccess, onFailed })

Purchases _attotokens worth of reportingToken for msg.sender using the msg.sender’s reputationTokens. If the msg.sender doesn’t have _attotokens worth of reputationToken, if _attotokens value isn’t between 1 and 2254, the market for this reportingToken can’t be reported on, or the msg.sender doesn’t have a registrationToken for the reportingWindow containing the reportingToken’s market then this transaction will fail. This transaction will spawn a Transfer event which will record the from address, to address, and the amount of _attotokens purchased.

augur.api.ReportingToken.migrateLosingTokens({ _signer, reportingToken, onSent, onSuccess, onFailed })

Sets the supply of this reportingToken to 0 and transfers all REP on this reportingToken to this reportingToken’s market’s winning reporting token contract. This will fail if the market isn’t finalized, the market isn’t a container for this reportingToken, the market for this reportingToken is the cause of a fork, and the market’s winning reporting token isn’t this reportingToken.

augur.api.ReportingToken.redeemDisavowedTokens({ _signer, reportingToken, _reporter, onSent, onSuccess, onFailed })

Transfers REP to the _reporter from the reportingToken for the value of reportingToken owned by _reporter. This transaction will fail if the reportingToken is still contained within the reportingToken’s market. This transaction will spawn a Transfer event which will record the from address, to address, and the amount of attotokens of REP transferred to the _reporter.

augur.api.ReportingToken.redeemForkedTokens({ _signer, reportingToken, onSent, onSuccess, onFailed })

Transfers REP to the msg.sender on the new branch for the amount of reportingTokens owned by msg.sender from the old branch. This transaction will fail if the market isn’t a container for the reportingToken, or if the market isn’t the cause of a fork. This transaction will spawn a Transfer event which will record the from address, to address, and the amount of attotokens of REP transferred to the msg.sender on the new branch.

augur.api.ReportingToken.redeemWinningTokens({ _signer, reportingToken, onSent, onSuccess, onFailed })

Transfers REP to the msg.sender based on how many reportingTokens the msg.sender owned on the old branch. This transaction will fail if the market isn’t finalized, if the market isn’t a container for reportingToken, if the market is the cause of a fork, or if the reportingToken isn’t the winning reportingToken. This transaction will spawn a Transfer event which will record the from address, to address, and the amount of attotokens of REP transferred to the msg.sender on the new branch.

augur.api.ReportingToken.transfer({ _signer, reportingToken, _to, _value, onSent, onSuccess, onFailed })

If the msg.sender of the transfer transaction has enough of reportingToken to be able to transfer _value worth to the _to and _value is a valid value between 1 and 2254 then this transaction will send _value worth of reportingToken to the specified _to from the msg.sender. This transaction will spawn a Transfer event which will record the from address, to address, and _value amount transferred.

augur.api.ReportingToken.transferFrom({ _signer, reportingToken, _from, _to, _value, onSent, onSuccess, onFailed })

If the sourceAddress of the transferFrom transaction has enough of reportingToken to be able to transfer _value worth to the _to, _value is a valid value between 1 and 2254, and the msg.sender has the approval to spend at least _value worth of reportingToken for _from then this transaction will send _value worth of registrationToken to the specified _to from the _from. This transaction will spawn a Transfer event which will record the from address, to address, and _value amount transferred.

Reporting Window Tx API

// Reporting Window Contract Transaction API Examples:
const privateKey = <Buffer ...>;
const reportingWindow = "0x06cbcd92af2571f1419b622a794d65db524f682a";
const _endTime = 1501015000;
const _numOutcomes = '2';
const _payoutDenominator = '2';
const _feePerEthInWei = '10000000000000000';
const cashContract = "0xb85a75a008e15d134c8ba01679ce2ab82dd7f777";
const _creator = "0xab11204cfeaccffa63c2d23aef2ea9accdb0a0d5";
const _minDisplayPrice = "0";
const _maxDisplayPrice = "1";
const _automatedReporterAddress = "0x01dcd72e4bed9ecba84f1749b139ae4338b30ce0";
const _topic = "examples";

augur.api.ReportingWindow.createNewMarket({
  _signer: privateKey,
  reportingWindow,
  _endTime,
  _numOutcomes,
  _payoutDenominator,
  _feePerEthInWei,
  _denominationToken: cashContract,
  _creator,
  _minDisplayPrice,
  _maxDisplayPrice,
  _automatedReporterAddress,
  _topic,
  onSent: (result) => console.log(result),
  onSuccess: (result) => console.log(result),
  onFailed: (result) => console.log(result),
});
// example output:
successResponse = {
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320502,
  callReturn: "0x5e3b08cd8a3b909e4396eda0818d5b1e4f43d4da",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0x8de51be2ae9140e6db01a97b8578419e8deb542c7de2a615ced10f282bce3cc8",
  input: "0x55d619ab000000000000000000000000000000000000000000000000000000005977abd800000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000002386f26fc10000000000000000000000000000b85a75a008e15d134c8ba01679ce2ab82dd7f777000000000000000000000000ab11204cfeaccffa63c2d23aef2ea9accdb0a0d50000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000001dcd72e4bed9ecba84f1749b139ae4338b30ce0000000000000000000000000000000000000000000000000000000000a62cd64",
  nonce: "0xf1",
  timestamp: 1501003145,
  to: "0x06cbcd92af2571f1419b622a794d65db524f682a",
  value: "0x0"
}

Reporting Window Contract Code

augur.api.ReportingWindow.createNewMarket({ _signer, reportingWindow, _endTime, _numOutcomes, _payoutDenominator, _feePerEthInWei, _denominationToken, _creator, _minDisplayPrice, _maxDisplayPrice, _automatedReporterAddress, _topic, onSent, onSuccess, onFailed })

This function will create a new market for the given reportingWindow that will be constructed using the arguments passed and return the new market’s address if successful. This transaction will fail if the _numOutcomes value isn’t within the range of 2 and 8, if the _payoutDenominator isn’t between 2 and 2254, if the current time is not before the start time of the _reportingWindow, if the _payoutDenominator isn’t a multiple of _numOutcomes, if _feesPerEthInWei is lower than or equal to 0 or greater than or equal to 0.5 ETH (5 * 1018), if the _maxDisplayPrice and _minDisplayPrice isn’t between -2254 to 2254, if _maxDisplayPrice - _minDisplayPrice must be between 1 and 2254, or if the msg.value amount sent isn’t enough to cover the market’s validity bond and the estimated gas cost for the target amount of reporters to report.

Reputation Token Tx API

// Reputation Token Contract Transaction API Examples:
const privateKey = <Buffer ...>;
const reputationToken = "0x2a73cec0b62fcb8c3120bc80bdb2b1351c8c2d1e";
const _spender = "0xea674fdde714fd979de3edf0f56aa9716b898ec8";
const _from = "0x1a05071893b764109f0bbc5b75d78e3e38b69ab3";
const _value = "100000000000000000000";

augur.api.ReputationToken.approve({
  _signer: privateKey,
  reputationToken,
  _spender,
  _value,
  onSent: (result) => console.log(result),
  onSuccess: (result) => console.log(result),
  onFailed: (result) => console.log(result)
});
// example output:
successResponse = {
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320512,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0x915f8f0b13244b0dd9b7377b252d9245ef0fc109c82931a87410d1bdad671fe6",
  input: "0x83b58638000000000000000000000000ea674fdde714fd979de3edf0f56aa9716b898ec80000000000000000000000000000000000000000000000056bc75e2d63100000",
  nonce: "0xf2",
  timestamp: 1501003152,
  to: "0x2a73cec0b62fcb8c3120bc80bdb2b1351c8c2d1e",
  value: "0x0"
}

augur.api.ReputationToken.migrateFromLegacyRepContract({
  _signer: privateKey,
  reputationToken,
  onSent: (result) => console.log(result),
  onSuccess: (result) => console.log(result),
  onFailed: (result) => console.log(result)
});
// example output:
successResponse = {
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320513,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0xf1eb499764e9422d51a37b3567bb2513c022d63524518d520a9d4eabad0f0238",
  input: "0x3a15e7ca",
  nonce: "0xf3",
  timestamp: 1501003153,
  to: "0x2a73cec0b62fcb8c3120bc80bdb2b1351c8c2d1e",
  value: "0x0"
}

const _destination = "0x73295d3c0ca46113ca226222c81c79adabf9f391";
augur.api.ReputationToken.migrateOut({
  _signer: privateKey,
  reputationToken,
  _destination,
  _reporter: _source,
  _attotokens: _value,
  onSent: (result) => console.log(result),
  onSuccess: (result) => console.log(result),
  onFailed: (result) => console.log(result)
});
// example output:
successResponse = {
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320514,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0xeddcfa199671312d7dd90eba2895da3104801ab05220758c62bbc6ef059f6057",
  input: "0x5ca7a72700000000000000000000000073295d3c0ca46113ca226222c81c79adabf9f3910000000000000000000000001a05071893b764109f0bbc5b75d78e3e38b69ab30000000000000000000000000000000000000000000000056bc75e2d63100000",
  nonce: "0xf4",
  timestamp: 1501003154,
  to: "0x2a73cec0b62fcb8c3120bc80bdb2b1351c8c2d1e",
  value: "0x0"
}

augur.api.ReputationToken.transfer({
  _signer: privateKey,
  reputationToken,
  _to: _spender,
  _value,
  onSent: (result) => console.log(result),
  onSuccess: (result) => console.log(result),
  onFailed: (result) => console.log(result)
});
// example output:
successResponse = {
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320515,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0x8f92137eff5e7824423ff6e79e15188b61d9dd9244fd2c436b020de6d8e721fe",
  input: "0x86744558000000000000000000000000ea674fdde714fd979de3edf0f56aa9716b898ec80000000000000000000000000000000000000000000000056bc75e2d63100000",
  nonce: "0xf5",
  timestamp: 1501003155,
  to: "0x2a73cec0b62fcb8c3120bc80bdb2b1351c8c2d1e",
  value: "0x0"
}

augur.api.ReputationToken.transferFrom({
  _signer: privateKey,
  reputationToken,
  _from,
  _to: _spender,
  _value,
  onSent: (result) => console.log(result),
  onSuccess: (result) => console.log(result),
  onFailed: (result) => console.log(result)
});
// example output:
successResponse = {
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320516,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0x2c678df877e01d343a4e7701b92dddcecafc095fd1e4d90423838cd73eadb7d7",
  input: "0x27f08b000000000000000000000000001a05071893b764109f0bbc5b75d78e3e38b69ab3000000000000000000000000ea674fdde714fd979de3edf0f56aa9716b898ec80000000000000000000000000000000000000000000000056bc75e2d63100000",
  nonce: "0xf6",
  timestamp: 1501003156,
  to: "0x2a73cec0b62fcb8c3120bc80bdb2b1351c8c2d1e",
  value: "0x0"
}

Reputation Token Contract Code

augur.api.ReputationToken.approve({ _signer, reputationToken, _spender, _value, onSent, onSuccess, onFailed })

Allows the _spender the ability to spend up to _value (denoted in attotokens) worth of the specified reputationToken for the msg.sender of this approve transaction. This transaction will spawn an Approval event which will record the owner address (msg.sender), _spender, and _value in attotokens approved.

augur.api.ReputationToken.migrateFromLegacyRepContract({ _signer, reputationToken, onSent, onSuccess, onFailed })

This function will migrate REP tokens from the legacy rep contract owned by msg.sender to the reputationToken provided. msg.sender will add whatever msg.sender’s balance was for the legacy rep contract to the reputationToken contract.

augur.api.ReputationToken.migrateOut({ _signer, reputationToken, _destination, _reporter, _attotokens, onSent, onSuccess, onFailed })

This function migrates a _reporter’s REP (amount of REP denoted in _attotokens) from one reputationToken address to another (_destination). The msg.sender of this transaction must be the _reporter provided or the msg.sender must be approved to spend _attotokens amount of REP for the _reporter provided.

augur.api.ReputationToken.transfer({ _signer, reputationToken, _to, _value, onSent, onSuccess, onFailed })

If the msg.sender of the transfer transaction has enough of reputationToken to be able to transfer _value (denoted in attotokens) worth to the _to address and _value is a number between 1 and 2254 then this transaction will send _value (in attotokens) worth of reputationToken to the specified _to address from the msg.sender. This transaction will spawn a Transfer event which will record the from address (msg.sender), _to address, and _value amount transferred.

augur.api.ReputationToken.transferFrom({ _signer, reputationToken, _from, _to, _value, onSent, onSuccess, onFailed })

If the _from address of the transferFrom transaction has enough of reputationToken to be able to transfer _value (denoted in attotokens) worth to the _to address, _value is a number between 1 and 2254, and the msg.sender has the approval to spend at least _value worth of reputationTokens for the _from address then this transaction will send _value worth of reputationToken to the specified _to address from the _from address. This transaction will spawn a Transfer event which will record the _from address, _to address, and _value (in attotokens) amount transferred.

Cancel Order Tx API

// Cancel Order Contract Transaction API Examples:
const privateKey = <Buffer ...>;
const _orderId = "0x7ca90ca9118db456d87e3d743b97782a857200b55039f7ffe8de94e5d920f870";
const _type = "1";
const _market = "0x9368ff3e9ce1c0459b309fac6dd4e69229b91a42";
const _outcome = "1";

augur.api.CancelOrder.cancelOrder({
  _signer: privateKey,
  _orderId,
  _type,
  _market,
  _outcome,
  onSent: (result) => console.log(result),
  onSuccess: (result) => console.log(result),
  onFailed: (result) => console.log(result),
});
// example output:
successResponse = {
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320516,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0xa031604c8ef75ab5b1d07f7358d594e1cb57c927a86be92459d78ae3415bb3b0",
  input: "0x309d23e17ca90ca9118db456d87e3d743b97782a857200b55039f7ffe8de94e5d920f87000000000000000000000000000000000000000000000000000000000000000010000000000000000000000009368ff3e9ce1c0459b309fac6dd4e69229b91a420000000000000000000000000000000000000000000000000000000000000001",
  nonce: "0xf61",
  timestamp: 1501003156,
  to: "0xb2930b35844a230f00e51431acae96fe543a0347",
  value: "0x0"
}

Cancel Order Contract Code

augur.api.CancelOrder.cancelOrder({ _signer, _orderId, _type, _market, _outcome, onSent, onSuccess, onFailed })

The cancelOrder transaction is used to cancel and refund an existing order on the specified _market of _type for the _outcome given it’s _orderId. This will fail if msg.sender isn’t the owner of the order, if the _market or _orderId is not defined, or if _type is not an expected value (1 for a BID, 2 for an ASK).

Cash Tx API

// Cash Token Contract
const privateKey = <Buffer ...>;
const _from = "0x438f2aeb8a16745b1cd711e168581ebce744ffaa";
const _to = "0xfe9d0408be14d1d1ec28671b03bda1b80748977e";
const _value = "100000000000000000000";

augur.api.Cash.approve({
  _signer: privateKey,
  _spender: _to,
  _value,
  onSent: (result) => console.log(result),
  onSuccess: (result) => console.log(result),
  onFailed: (result) => console.log(result),
});
// example output:
successResponse = {
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320517,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0x13c698a48dcee8a3680e8ff1b767cf3327b2dec516355de7112b23a1031dcd70",
  input: "0x83b58638000000000000000000000000fe9d0408be14d1d1ec28671b03bda1b80748977e0000000000000000000000000000000000000000000000056bc75e2d63100000",
  nonce: "0xf7",
  timestamp: 1501003157,
  to: "0xa8f769b88d6d74fb2bd3912f6793f75625228baf",
  value: "0x0"
}

augur.api.Cash.depositEther({
  _signer: privateKey,
  _value,
  onSent: (result) => console.log(result),
  onSuccess: (result) => console.log(result),
  onFailed: (result) => console.log(result),
});
// example output:
successResponse = {
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320518,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0xe5e6737ec3fd36c7147cc9af910d96a6e41977e1c2a491205b7a006dbf33c4ff",
  input: "0xf81de66a",
  nonce: "0xf8",
  timestamp: 1501003158,
  to: "0xa8f769b88d6d74fb2bd3912f6793f75625228baf",
  value: "0x0"
}

augur.api.Cash.withdrawEther({
  _signer: privateKey,
  _amount: _value,
  onSent: (result) => console.log(result),
  onSuccess: (result) => console.log(result),
  onFailed: (result) => console.log(result),
});
// example output:
successResponse = {
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320519,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0xe340a2b59c774d3e297e4728be09d96e1cd5579551cdde6966c0bd23ce764fb2",
  input: "0x25d48493000000000000000000000000438f2aeb8a16745b1cd711e168581ebce744ffaa0000000000000000000000000000000000000000000000056bc75e2d63100000",
  nonce: "0xf9",
  timestamp: 1501003159,
  to: "0xa8f769b88d6d74fb2bd3912f6793f75625228baf",
  value: "0x0"
}

augur.api.Cash.transfer({
  _signer: privateKey,
  _to,
  _value,
  onSent: (result) => console.log(result),
  onSuccess: (result) => console.log(result),
  onFailed: (result) => console.log(result),
});
// example output:
successResponse = {
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320520,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0xa29b95168d8ee80bc940fdd9ddc68b9c3f2f94cb688d613719da58819c65673a",
  input: "0x86744558000000000000000000000000fe9d0408be14d1d1ec28671b03bda1b80748977e0000000000000000000000000000000000000000000000056bc75e2d63100000",
  nonce: "0xfa",
  timestamp: 1501003120,
  to: "0xa8f769b88d6d74fb2bd3912f6793f75625228baf",
  value: "0x0"
}

augur.api.Cash.transferFrom({
  _signer: privateKey,
  _from,
  _to,
  _value,
  onSent: (result) => console.log(result),
  onSuccess: (result) => console.log(result),
  onFailed: (result) => console.log(result),
});
// example output:
successResponse = {
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320521,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0xb6973356d29c63f559093ec2d732a70fbfe4085736d04c0496e2b1abd45f53d5",
  input: "0x27f08b00000000000000000000000000438f2aeb8a16745b1cd711e168581ebce744ffaa000000000000000000000000fe9d0408be14d1d1ec28671b03bda1b80748977e0000000000000000000000000000000000000000000000056bc75e2d63100000",
  nonce: "0xfb",
  timestamp: 1501003121,
  to: "0xa8f769b88d6d74fb2bd3912f6793f75625228baf",
  value: "0x0"
}

Cash Token Contract Code

augur.api.Cash.approve({ _signer, _spender, _value, onSent, onSuccess, onFailed })

Allows the _spender the ability to spend up to _value (denoted in attotokens) worth of Cash Tokens for the msg.sender of this approve transaction. This transaction will spawn an Approval event which will record the owner address (msg.sender), _spender, and _value in attotokens approved.

augur.api.Cash.depositEther({ _signer, _value, onSent, onSuccess, onFailed })

This transaction is used to convert Ether (ETH) into a Cash token that is used on the augur markets. _value is the amount of Ether (ETH) denoted in attotokens to deposit into the Cash Token Contract for the msg.sender. This will spawn a DepositEther event which will record the owner address (msg.sender), _value deposited, and the total balance for this msg.sender.

augur.api.Cash.withdrawEther({ _signer, _to, _amount, onSent, onSuccess, onFailed })

This transaction is used to convert Cash Tokens back into Ether (ETH) by sending the _amount of msg.sender’s CASH Tokens _to the address specified denoted in attotokens. This transaction requires a 3-day wait period from the initial call to withdraw. Once three days have passed, calling withdrawEther again will withdraw the _amount specified. This transaction will fail if we have initiated a withdraw but it hasn’t been 3 days since the initiated withdraw, if the msg.sender doesn’t have at least _amount of Cash Tokens denoted in attotokens, or if the _amount specified is less than 1. This transaction can spawn two different events depending on when it was called. If a withdraw hasn’t been initiated then calling withdrawEther will spawn a InitiateWithdrawEther event which records the msg.sender, the _amount specified for withdraw, and the current balance of Cash Tokens for the msg.sender. If it has been at least 3 days since we have initiated a withdraw then when the withdraw takes place, this transaction will spawn a WithdrawEther event. The WithdrawEther event records msg.sender, the _amount withdrawn, and the balance of Cash Tokens after withdrawal has been completed.

augur.api.Cash.transfer({ _signer, _to, _value, onSent, onSuccess, onFailed })

If the msg.sender of the transfer transaction has enough of Cash Tokens to be able to transfer _value (denoted in attotokens) worth to the _to address and _value is a number between 1 and 2254 then this transaction will send _value (in attotokens) worth of Cash Tokens to the specified _to address from the msg.sender. This transaction will spawn a Transfer event which will record the from address (msg.sender), _to address, and _value amount transferred.

augur.api.Cash.transferFrom({ _signer, _from, _to, _value, onSent, onSuccess, onFailed })

If the _from address of the transferFrom transaction has enough Cash Tokens to be able to transfer _value (denoted in attotokens) worth to the _to address, _value is a number between 1 and 2254, and the msg.sender has the approval to spend at least _value worth of Cash Tokens for the _from address then this transaction will send _value worth of Cash Tokens to the specified _to address from the _from address. This transaction will spawn a Transfer event which will record the _from address, _to address, and _value (in attotokens) amount transferred.

Claim Proceeds Tx API

// Claim Proceeds Contract Transaction API Examples:
const privateKey = <Buffer ...>;
const _market = "0x9368ff3e9ce1c0459b309fac6dd4e69229b91a42";

augur.api.ClaimProceeds.claimProceeds({
  _signer: privateKey,
  _market,
  onSent: (result) => console.log(result),
  onSuccess: (result) => console.log(result),
  onFailed: (result) => console.log(result),
});
// example output:
successResponse = {
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320522,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0x0f6152b9a39055b34bc092d9e96e852e3137e3d42f4e78b1dc5848f8b2abf12f",
  input: "0x5fd65fba0000000000000000000000009368ff3e9ce1c0459b309fac6dd4e69229b91a42",
  nonce: "0xfc",
  timestamp: 1501003122,
  to: "0x96c7ed5f9465a8661df4df3bbbf16cc13ad7e115",
  value: "0x0"
}

Claim Proceeds Contract Code

augur.api.ClaimProceeds.claimProceeds({ _signer, _market, onSent, onSuccess, onFailed })

The claimProceeds transaction attempts to collect trading profits from outstanding shares in a finalized _market owned by the msg.sender. This transaction will fail if the _market specified is not finalized or if it hasn’t been at least 3 days since the _market was finalized.

Complete Sets Tx API

// Complete Sets Contract
const privateKey = <Buffer ...>;
const _market = "0x9368ff3e9ce1c0459b309fac6dd4e69229b91a42";
const _amount = "50000000000000000000" // 50.0

augur.api.CompleteSets.publicBuyCompleteSets({
  _signer: privateKey,
  _market,
  _amount,
  onSent: (result) => console.log(result),
  onSuccess: (result) => console.log(result),
  onFailed: (result) => console.log(result),
});
// example output:
successResponse = {
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320523,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0xc77149d6a3fef8755a20aa2100fc79c02ca7dd198d6f3c65aabe638883d8d017",
  input: "0xfadc758a0000000000000000000000009368ff3e9ce1c0459b309fac6dd4e69229b91a42000000000000000000000000000000000000000000000002b5e3af16b1880000",
  nonce: "0xfd",
  timestamp: 1501003123,
  to: "0xfbb1b73c4f0bda4f67dca266ce6ef42f520fbb98",
  value: "0x0"
}

augur.api.CompleteSets.publicSellCompleteSets({
  _signer: privateKey,
  _market,
  _amount,
  onSent: (result) => console.log(result),
  onSuccess: (result) => console.log(result),
  onFailed: (result) => console.log(result),
});
// example output:
successResponse = {
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320524,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0x21121bf9a8d32969b5ce4d53b6021ad6b7b5e7c658e9d98d582c720c8abce220",
  input: "0x04b586670000000000000000000000009368ff3e9ce1c0459b309fac6dd4e69229b91a42000000000000000000000000000000000000000000000002b5e3af16b1880000",
  nonce: "0xfe",
  timestamp: 1501003124,
  to: "0xfbb1b73c4f0bda4f67dca266ce6ef42f520fbb98",
  value: "0x0"
}

Complete Sets Contract Code

augur.api.CompleteSets.publicBuyCompleteSets({ _signer, _market, _amount, onSent, onSuccess, onFailed })

This transaction will attempt to purchase _amount worth of shares in all outcomes for a specified _market. This transaction will fail if the msg.sender doesn’t have enough of the _market’s denomination token to be able to afford _amount shares in all outcomes, or if the _amount is not a number between 1 and 2254. When successful this transaction will spawn a CompleteSets event which will record the msg.sender, _market, type (buy), _amount purchased, number of outcomes in the _market, marketCreatorFee, and the reportingFee. During a buy, the marketCreatorFee and reportingFee will be 0 because no fees are paid for purchasing shares, only selling/settling shares.

augur.api.CompleteSets.publicSellCompleteSets({ _signer, _market, _amount, onSent, onSuccess, onFailed })

This transaction will attempt to sell _amount worth of shares in all outcomes for a specified _market. This transaction will fail if the msg.sender doesn’t own _amount of shares in all outcomes for the _market, or if the _amount is not a number between 1 and 2254. When successful this transaction will spawn a CompleteSets event which will record the msg.sender, _market, type (sell), _amount sold, number of outcomes in the _market, marketCreatorFee paid for selling the shares, and the reportingFee paid for selling the shares.

Make Order Tx API

// Make Order Contract Transaction API Examples:
const privateKey = <Buffer ...>;
const _type = "1";
const _attoshares = "10000000000000000000"; // 10 shares
const _displayPrice = "0.5";
const _market = "0xd3273eba07248020bf98a8b560ec1576a612102f";
const _outcome = "1";
const _betterOrderId = "0xea2c7476e61f5e2625e57df17fcce74741d3c2004ac657675f686a23d06e6091";
const _worseOrderId = "0xed42c0fab97ee6fbde7c47dc62dc3ad09e8d3af53517245c77c659f7cd561426";
const _tradeGroupId = "1";

augur.api.MakeOrder.publicMakeOrder({
  _signer: privateKey,
  _type,
  _attoshares,
  _displayPrice,
  _market,
  _outcome,
  _betterOrderId,
  _worseOrderId,
  _tradeGroupId,
  onSent: (result) => console.log(result),
  onSuccess: (result) => console.log(result),
  onFailed: (result) => console.log(result),
});
// example output:
successResponse = {
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320525,
  callReturn: "0x5f80029d47ca806002b6b6bbbb0077124f8da9b69a885f7714907bd773bcf8a7",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0xcf6729b0e27fffc81c4f5c824992a780daf1f41bf590c7f62f16777edbc2c08e",
  input: "0x138dcef200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000008ac7230489e8000000000000000000000000000000000000000000000000000000000000fffffff1000000000000000000000000d3273eba07248020bf98a8b560ec1576a612102f0000000000000000000000000000000000000000000000000000000000000001ea2c7476e61f5e2625e57df17fcce74741d3c2004ac657675f686a23d06e6091ed42c0fab97ee6fbde7c47dc62dc3ad09e8d3af53517245c77c659f7cd5614260000000000000000000000000000000000000000000000000000000000000001",
  nonce: "0xff",
  timestamp: 1501003125,
  to: "0x82378b6ee7b6e8c69874b491e4488c72a390c367",
  value: "0x0"
}

Make Order Contract Code

augur.api.MakeOrder.publicMakeOrder({ _signer, _type, _attoshares, _displayPrice, _market, _outcome, _betterOrderId, _worseOrderId, _tradeGroupId, onSent, onSuccess, onFailed })

This transaction will create a new order on the order book for the specified _market trading on the _outcome provided. The required fields besides market and outcome are the _type of order (1 for a bid, 2 for an ask), amount of shares denoted in _attoshares, and the _displayPrice for the order. Optional params include _betterOrderId, _worseOrderId, _tradeGroupId, and the callbacks. The _betterOrderId and _worseOrderId are orderIDs of orders already on the order book which should be better and worse than the order we are intending to create with this transaction. The _tradeGroupId is a field used by the Augur UI to group transactions and can be left blank.

This transaction will fail if _type is not a valid value of 1 or 2, If the _attoshares value is less than 0, if the _market isn’t defined, if the _outcome is less than 0 or greater than the total number of outcomes for the _market, or if the _displayPrice is below the _market’s minimum _displayPrice or if the _displayPrice is above the market’s maximum _displayPrice.

Share Token Tx API

// Share Token Contract Transaction API Examples:
const privateKey = <Buffer ...>;
const shareToken = "0xa22c79a48f51df6d0863821bd1dd2c5d6f511bc5";
const _spender = "0x01f50356c280cd886dd058210937160c73700a4b";
const _attotokens = "100000000000000000000";

augur.api.ShareToken.approve({
  _signer: privateKey,
  shareToken,
  _spender,
  _value: _attotokens,
  onSent: (result) => console.log(result),
  onSuccess: (result) => console.log(result),
  onFailed: (result) => console.log(result)
});
// example output:
successResponse = {
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320526,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0x02730239e82d37ec032ecde79f27ae75d7cc59c277ab44c6eb5b67520ee487e9",
  input: "0x83b5863800000000000000000000000001f50356c280cd886dd058210937160c73700a4b0000000000000000000000000000000000000000000000056bc75e2d63100000",
  nonce: "0xff1",
  timestamp: 1501003126,
  to: "0xa22c79a48f51df6d0863821bd1dd2c5d6f511bc5",
  value: "0x0"
}
augur.api.ShareToken.transfer({
  _signer: privateKey,
  shareToken,
  _to: _spender,
  _value: _attotokens,
  onSent: (result) => console.log(result),
  onSuccess: (result) => console.log(result),
  onFailed: (result) => console.log(result)
});
// example output:
successResponse = {
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320527,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0x7dfbd9d87964814e0da2d874d8d7c2d886df6b852a46d69562018620d62fd773",
  input: "0x8674455800000000000000000000000001f50356c280cd886dd058210937160c73700a4b0000000000000000000000000000000000000000000000056bc75e2d63100000",
  nonce: "0xff2",
  timestamp: 1501003127,
  to: "0xa22c79a48f51df6d0863821bd1dd2c5d6f511bc5",
  value: "0x0"
}

const _from = "0x4b01721f0244e7c5b5f63c20942850e447f5a5ee";
augur.api.ShareToken.transferFrom({
  _signer: privateKey,
  shareToken,
  _from,
  _to: _spender,
  _value: _attotokens,
  onSent: (result) => console.log(result),
  onSuccess: (result) => console.log(result),
  onFailed: (result) => console.log(result)
});
// example output:
successResponse = {
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320528,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0x619a9d4a75f43cf5d5b8e81365f9859e60aa96554915e912cdf7ffd96f0d4d96",
  input: "0x27f08b000000000000000000000000004b01721f0244e7c5b5f63c20942850e447f5a5ee00000000000000000000000001f50356c280cd886dd058210937160c73700a4b0000000000000000000000000000000000000000000000056bc75e2d63100000",
  nonce: "0xff3",
  timestamp: 1501003128,
  to: "0xa22c79a48f51df6d0863821bd1dd2c5d6f511bc5",
  value: "0x0"
}

Share Token Contract Code

augur.api.ShareToken.approve({ _signer, shareToken, _spender, _value, onSent, onSuccess, onFailed })

Allows the _spender the ability to spend up to _value worth of the specified shareToken for the msg.sender of this approve transaction. This transaction will spawn an Approval event which will record the owner address (msg.sender), _spender, and _value denoted in attotokens approved.

augur.api.ShareToken.transfer({ _signer, shareToken, _to, _value, onSent, onSuccess, onFailed })

If the msg.sender of the transfer transaction has enough of shareTokens to be able to transfer _value worth to the _to address and _value is a valid number between 1 and 2254 then this transaction will send _value worth of shareToken to the specified _to address from the msg.sender. This transaction will spawn a Transfer event which will record the from address (msg.sender), _to address, and _value amount transferred denoted in attotokens.

augur.api.ShareToken.transferFrom({ _signer, shareToken, _from, _to, _value, onSent, onSuccess, onFailed })

If the _from address of the transferFrom transaction has enough of shareToken to be able to transfer _value worth to the _to address, _value is a valid number between 1 and 2254, and the msg.sender has the approval to spend at least _value worth of shareToken for _from address then this transaction will send _value worth of shareToken to the specified _to address from the _from address. This transaction will spawn a Transfer event which will record the _from address, _to address, and _value amount transferred denoted in attotokens.

Take Order Tx API

// Take Order Contract Transaction API Examples:
const privateKey = <Buffer ...>;
const _orderId = "0xea2c7476e61f5e2625e57df17fcce74741d3c2004ac657675f686a23d06e6091";
const _amountTakerWants = "10000000000000000000"; // 10.0
const _tradeGroupId = "1";

augur.api.TakeOrder.publicTakeOrder({
  _signer: privateKey,
  _orderId,
  _amountTakerWants,
  _tradeGroupId,
  onSent: (result) => console.log(result),
  onSuccess: (result) => console.log(result),
  onFailed: (result) => console.log(result),
});
// example output:
successResponse = {
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320529,
  callReturn: "0",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0x3efb4102dc3b9e1bb145ca21310233646a4eba24894b04f12ee4d390281301ac",
  input: "0x49a2cba0ea2c7476e61f5e2625e57df17fcce74741d3c2004ac657675f686a23d06e60910000000000000000000000000000000000000000000000008ac7230489e800000000000000000000000000000000000000000000000000000000000000000001",
  nonce: "0xff4",
  timestamp: 1501003129,
  to: "0x077f28f038dd94ed9c444b806137302b1c4cbd5a",
  value: "0x0"
}

Take Order Contract Code

augur.api.TakeOrder.publicTakeOrder({ _signer, _orderID, _amountTakerWants, _tradeGroupID, onSent, onSuccess, onFailed })

Given an _orderId and the amount a taker wants as _amountTakerWants denoted in attoshares this transaction will attempt to fill the order specified. If the _amountTakerWants is enough to fill the order completely then the order will be removed from the order book, otherwise it will be adjusted to only include the remaining amount after filling the _amountTakerWants value that the taker requests. This transaction requires _orderId and _amountTakerWants are defined. The maker of the order specified by _orderId cannot be the msg.sender of this transaction. This transaction will return the fixed point amount remaining of the order specified by _orderId after being filled, if it’s completely filled this will return 0. The _tradeGroupId is an optional value that is used by the Augur UI and can be left undefined.

Trade Tx API

// Trade Contract Transaction API Examples:
const privateKey = <Buffer ...>;
const _market = "0x7e8e07364ccde43ba5159537404924e86ca53c92";
const _outcome = "1";
const _fxpAmount = "10000000000000000000"; // 10.0
const _fxpPrice = "500000000000000000"; // 0.5
const _tradeGroupId = "1";

augur.api.Trade.publicBuy({
  _signer: privateKey,
  _market,
  _outcome,
  _fxpAmount,
  _fxpPrice,
  _tradeGroupId,
  onSent: (result) => console.log(result),
  onSuccess: (result) => console.log(result),
  onFailed: (result) => console.log(result),
});
// example output:
successResponse = {
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320530,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0x027e3b312f5949388830a0f5c945cbfcbf4ec06edc3b342ef8d6e85f631a50c3",
  input: "0x888b82010000000000000000000000007e8e07364ccde43ba5159537404924e86ca53c9200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000008ac7230489e8000000000000000000000000000000000000000000000000000006f05b59d3b200000000000000000000000000000000000000000000000000000000000000000001",
  nonce: "0xff5",
  timestamp: 1501003130,
  to: "0xa7f3659c53820346176f7e0e350780df304db179",
  value: "0x0"
}

augur.api.Trade.publicSell({
  _signer: privateKey,
  _market,
  _outcome,
  _fxpAmount,
  _fxpPrice,
  _tradeGroupId,
  onSent: (result) => console.log(result),
  onSuccess: (result) => console.log(result),
  onFailed: (result) => console.log(result),
});
// example output:
successResponse = {
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320531,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0x1072dd3501dd0796f3b986bb45704798d198265ca5b75303488a8eb69c76bae5",
  input: "0xf049066b0000000000000000000000007e8e07364ccde43ba5159537404924e86ca53c9200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000008ac7230489e8000000000000000000000000000000000000000000000000000006f05b59d3b200000000000000000000000000000000000000000000000000000000000000000001",
  nonce: "0xff6",
  timestamp: 1501003131,
  to: "0xa7f3659c53820346176f7e0e350780df304db179",
  value: "0x0"
}

augur.api.Trade.publicTrade({
  _signer: privateKey,
  _direction: '1',
  _market,
  _outcome,
  _fxpAmount,
  _fxpPrice,
  _tradeGroupId,
  onSent: (result) => console.log(result),
  onSuccess: (result) => console.log(result),
  onFailed: (result) => console.log(result),
});
// example output:
successResponse = {
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320532,
  callReturn: "0xa754c0437ff499df19d163199dcb43a539cbd0a9670b976f0ac66f33a88b3ac6",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0x2dc8b6f31e83e0e558863528130af2c66309f582ed02d96c7d7cfbe6a2c7179f",
  input: "0x1ee6ba1000000000000000000000000000000000000000000000000000000000000000010000000000000000000000007e8e07364ccde43ba5159537404924e86ca53c9200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000008ac7230489e8000000000000000000000000000000000000000000000000000006f05b59d3b200000000000000000000000000000000000000000000000000000000000000000001",
  nonce: "0xff7",
  timestamp: 1501003132,
  to: "0xa7f3659c53820346176f7e0e350780df304db179",
  value: "0x0"
}

augur.api.Trade.publicTakeBestOrder({
  _signer: privateKey,
  _direction: '2',
  _market,
  _outcome,
  _fxpAmount,
  _fxpPrice,
  _tradeGroupId,
  onSent: (result) => console.log(result),
  onSuccess: (result) => console.log(result),
  onFailed: (result) => console.log(result),
});
// example output:
successResponse = {
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320533,
  callReturn: "0",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0x7ab9bde926dfb9d1bbee93c07cbcf7d11ea4b995fa8f72d88d8322336d1aefd1",
  input: "0x048db15000000000000000000000000000000000000000000000000000000000000000020000000000000000000000007e8e07364ccde43ba5159537404924e86ca53c9200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000008ac7230489e8000000000000000000000000000000000000000000000000000006f05b59d3b200000000000000000000000000000000000000000000000000000000000000000001",
  nonce: "0xff8",
  timestamp: 1501003133,
  to: "0xa7f3659c53820346176f7e0e350780df304db179",
  value: "0x0"
}

Trade Contract Code

augur.api.Trade.publicBuy({ _signer, _market, _outcome, _fxpAmount, _fxpPrice, _tradeGroupId, onSent, onSuccess, onFailed })

The publicBuy transaction is used to purchase shares for a specified _market and _outcome. The amount of shares you wish to purchase is _fxpAmount denoted in attoshares and the price point you would like to buy at is _fxpPrice denoted in attotokens of the _market’s denomination token. This transaction will take orders off the order book that can be filled with this request, otherwise this transaction will create a new order to buy _fxpAmount of shares at _fxpPrice. The _tradeGroupId is an optional argument used by the Augur UI and can be left undefined. This transaction returns 1 if this order was filled completely, or if this order can’t be filled immediately an order will be created and the _orderId of that new order will be returned.

augur.api.Trade.publicSell({ _signer, _market, _outcome, _fxpAmount, _fxpPrice, _tradeGroupId, onSent, onSuccess, onFailed })

The publicSell transaction is used to purchase shares for a specified _market and _outcome. The amount of shares you wish to purchase is _fxpAmount denoted in attoshares and the price point you would like to sell at is _fxpPrice denoted in attotokens of the _market’s denomination token. This transaction will take orders off the order book that can be filled with this request, otherwise this transaction will create a new order to sell _fxpAmount of shares at _fxpPrice. The _tradeGroupId is an optional argument used by the Augur UI and can be left undefined. This transaction returns 1 if this order was filled completely, or if this order can’t be filled immediately an order will be created and the _orderId of that new order will be returned.

augur.api.Trade.publicTrade({ _signer, _direction, _market, _outcome, _fxpAmount, _fxpPrice, _tradeGroupId, onSent, onSuccess, onFailed })

The publicTrade transaction is works exactly like publicBuy or publicSell however a direction must be specified this time. The _direction must be either 1 for buying or 2 for selling. This transaction returns 1 if this order was filled completely, or if this order can’t be filled immediately an order will be created and the _orderId of that new order will be returned.

augur.api.Trade.publicTakeBestOrder({ _signer, _direction, _market, _outcome, _fxpAmount, _fxpPrice, _tradeGroupId, onSent, onSuccess, onFailed })

The publicTakeBestOrder transaction will work very similarly to publicTrade except it will not create an order if the request can’t be filled. The _direction must be either 1 for buying or 2 for selling. This transaction returns the fixed point amount not filled by the order, so 0 for a completely filled order, some other number if this request could only be partially filled.

Events API

// Listen for Events emitted by the augur contracts
// contractAddresses is a JSON object containing the name and address of the augur contracts.
const contractAddresses = {
  Cash: "0xbd19195b9e8a2d8ed14fc3a2823856b5c16f7f55",
 /* ... */
};
// Events API is a JSON object containing the event labels, and information about each event
const eventsAPI = {
  Approval: {
    address: "0x9308cf21b5a11f182f9707ca284bbb71bb84f893",
    /* ... */
  },
  /* ... */
}
// Both contractAddress and eventsAPI can be found in successful connection object received from calling the augur.connect() function. The contractAddresses can be found in connectionObject.contracts and the events API can be found at connectionObject.api.events.

// Start listening for Events
augur.filters.listen(contractAddresses, eventsAPI, {
    approval: (event) => { /* ... */ },
    block: (blockhash) => { /* ... */ },
    burn: (event) => { /* ... */ },
    cancelOrder: (event) => { /* ... */ },
    completeSets: (event) => { /* ... */ },
    depositEther: (event) => { /* ... */ },
    initiateWithdrawEther: (event) => { /* ... */ },
    makeOrder: (event) => { /* ... */ },
    mint: (event) => { /* ... */ },
    takeOrder: (event) => { /* ... */ },
    transfer: (event) => { /* ... */ },
    withdrawEther: (event) => { /* ... */ },
  },
  filters => console.log('Listening to filters:', filters)
);

// Stop listening for events and delete (uninstall) filters
augur.filters.ignore();

/**
 * Search for historical events.
 */
const myAccountAddress = "0x05ae1d0ca6206c6168b42efcd1fbe0ed144e821b";
const myFriendsAddress = "0x6c15291028d082e1b9358e19f15c83b9c54f2ba1";

// Look up Transfers from my account to my friends account.
let params = {
  label: "Transfer",
  filter: { from: myAccountAddress, to: myFriendsAddress }
};

augur.logs.getLogs(params, function (err, logs) { /* ... */ });

// Logs will look something like this:
logs = [{
  blockNumber: 6200,
  removed: false,
  from: "0x05ae1d0ca6206c6168b42efcd1fbe0ed144e821b",
  to: "0x6c15291028d082e1b9358e19f15c83b9c54f2ba1",
  value: "1000000000000",
  timestamp: 1502305142,  
  transactionHash: "0xba9c4044153059f584ddc8ea61d89c4cfb5421fe81c014baf90b8918a1622028"
}];

// now only look for Transfers between block 2000 and 6000.
params = {
  label: "Transfer",
  filter: { from: myAccountAddress, to: myFriendsAddress, toBlock: 6000, fromBlock: 2000 }
};

augur.logs.getLogs(params, function (err, logs) { /* ... */ });

// in this case we have no logs in those blocks for the filters specified
// so an empty array is returned.
logs = [];

// lets add the aux object to our params.
// In this case we are going to look for all Transfer transactions from myAccountAddress
// to myFriendsAddress, starting from block 2000 all the way to the latest block.
// We would also like to have the logs object organized by from field, in this case just myAccountAddress as we specified that as the only from address to look for.
// We also would like to add an extra field to each log called "anotherField"
// it's value should always be "testing"
params = {
  label: "Transfer",
  filter: { from: myAccountAddress, to: myFriendsAddress, toBlock: "latest", fromBlock: 2000 },
  aux: { index: "from", extraField: { name: "anotherField", value: "testing" } }
};

augur.logs.getLogs(params, function (err, logs) { /* ... */ });

// The transactions are organized by from address and this time they have an added extra field
logs = {
  "0x05ae1d0ca6206c6168b42efcd1fbe0ed144e821b": [{
    blockNumber: 6200,
    removed: false,
    from: "0x05ae1d0ca6206c6168b42efcd1fbe0ed144e821b",
    to: "0x6c15291028d082e1b9358e19f15c83b9c54f2ba1",
    value: "1000000000000",
    timestamp: 1502305142,  
    transactionHash: "0xba9c4044153059f584ddc8ea61d89c4cfb5421fe81c014baf90b8918a1622028",
    anotherField: "testing"
  },
  {
    blockNumber: 6400,
    removed: false,
    from: "0x05ae1d0ca6206c6168b42efcd1fbe0ed144e821b",
    to: "0x6c15291028d082e1b9358e19f15c83b9c54f2ba1",
    value: "100000000000000",
    timestamp: 1502306213,  
    transactionHash: "0x13c40b9ed0fd124e9bfcae2bd41e6dc8163d4ac0012c69c0efe57f502ecf81ea",
    anotherField: "testing"
  }]
};

// finally, we can merge more than one search by adding the mergedLogs object to the aux object.
params = {
  label: "Transfer",
  filter: { from: myAccountAddress, to: myFriendsAddress, toBlock: 6300, fromBlock: 5000 },
  aux: { index: "from", extraField: { name: "firstSearch", value: true }, mergedLogs: {} }
};

augur.logs.getLogs(params, function (err, logs) {
  // the first set of logs have been returned, change the params and
  // call again to merge these calls together
  params.filter.toBlock = 'latest';
  params.filter.fromBlock = 6300;
  params.aux.extraField = null;

  augur.logs.getLogs(params, function (err, logs) {
    // logs will look something like this, only the first searches logs have the extra field.
    logs = {
      "0x05ae1d0ca6206c6168b42efcd1fbe0ed144e821b": [{
        blockNumber: 6200,
        removed: false,
        from: "0x05ae1d0ca6206c6168b42efcd1fbe0ed144e821b",
        to: "0x6c15291028d082e1b9358e19f15c83b9c54f2ba1",
        value: "1000000000000",
        timestamp: 1502305142,  
        transactionHash: "0xba9c4044153059f584ddc8ea61d89c4cfb5421fe81c014baf90b8918a1622028",
        firstSearch: true
      },
      {
        blockNumber: 6400,
        removed: false,
        from: "0x05ae1d0ca6206c6168b42efcd1fbe0ed144e821b",
        to: "0x6c15291028d082e1b9358e19f15c83b9c54f2ba1",
        value: "100000000000000",
        timestamp: 1502306213,  
        transactionHash: "0x13c40b9ed0fd124e9bfcae2bd41e6dc8163d4ac0012c69c0efe57f502ecf81ea",
      }]
    };
  });
});
// (Note: for efficiency, the mergedLogs field in aux is mutated by getLogs.  If this
// bothers you, feel free to use lodash's merge, ES6/7 spread, etc. to accomplish the same thing.
// Also, the tears of functional programmers are delicious. ;)

There are a variety of “events” emitted by the augur contracts. Each event is triggered by a user doing something on augur: submitting a report, closing a Market, filling an Open Order, etc.

The augur.js events API includes event listeners, which notify you of events happening now, and a search function for historical events (“logs”):

The following table shows the events that can be passed to augur.filters.listen. All of these events are optional; if you don’t need some of these events for your application, don’t include the event in your call to augur.filters.listen. In this table, “Contract” refers to the Ethereum contract on which the event is defined (source code / contract addresses), “Data (indexed)” refers to fields included in the event log that are searchable using the augur.logs.getLogs function.

Label Contract Event description Data (indexed) Data (non-indexed)
Approval ERC20 Approved for the spender to spend a ERC20 token for an owner account owner, spender value
Burn VariableSupplyToken Burned the target’s tokens to completely destroy them target value
CancelOrder Orders Canceled an order and removed the order from the order book market, sender fxpPrice, fxpAmount, orderID, outcome, type, cashRefund, sharesRefund
BuyCompleteSets Orders Bought a Complete Set of shares for a market sender, market fxpAmount, numOutcomes
DepositEther Cash Deposited Ether into cash tokens which are a 1:1 conversion to ETH sender value, balance
InitiateWithdrawEther Cash Started the withdraw process to convert cash tokens into ETH, 3 day wait sender value, balance
MakeOrder Orders Placed an order onto the order book market, sender type, fxpPrice, fxpAmount, outcome, orderID, fxpMoneyEscrowed, fxpSharesEscrowed, tradeGroupID
Mint VariableSupplyToken Created brand new tokens for target target value
Registration Register Records the registration of new accounts sender timestamp
SellCompleteSets Orders Sold a Complete Set of shares for a market sender, market fxpAmount, numOutcomes, marketCreatorFee, reportingFee
TakeOrder Orders Took an order off the order book and filled it market, outcome, type orderID, price, maker, taker, makerShares, makerTokens, takerShares, takerTokens, tradeGroupID
Transfer ERC20Basic Transferred tokens from one owner to another from, to value
WithdrawEther Cash Withdrew Ether from the cash token contract after waiting 3 days sender value, balance

In addition to these on-contract events, augur.filters.listen also accepts a callback for the block listener, which fires whenever a new block arrives. The argument passed to its callback is the hash (as a hex string) of the new block.

Tests

The Augur repository, and the middleware augur.js repository both contain tests. Tests are run using Mocha. Mocha does not need to be installed globally to run the test suites, but if you would like to run specific tests explicitly then it is helpful to globally install Mocha.

To globally install Mocha using npm you would run the following command:

$ npm install -g mocha

To globally install Mocha using yarn, you would run the following command:

$ yarn global add mocha

Once you have Mocha installed, you can run a specific test case like so:

$ mocha ./test/unit/core/cash.js

Augur and Augur.js both contain their own sets of unit tests and Augur.js has a an integration test suite as well. The following sections will provide more details about the differences between the two.

Running Tests In Augur

Augur has a suite of unit tests that can be run using npm or yarn. In order to run tests, makes sure you have installed the dependencies for Augur first by using the following command:

$ npm install

or if you are using yarn:

$ yarn

Once you have installed the dependencies for Augur, you can run the following command using npm to run the unit tests:

$ npm test

of if you prefer to use yarn, the command becomes:

$ yarn test

The Augur repository is also following a set of standard coding rules. In order to check if your code is following the standards, you can run a linting command. To lint the Augur repository using npm, you would run the following command:

$ npm run lint

and to issue the same command with yarn, you would enter this:

$ yarn lint

Running Tests In Augur.js

augur.js includes both Unit tests and integration tests that can be run with npm or yarn. In order to run tests, makes sure you have installed the dependencies for Augur.js first by using the following command:

$ npm install

or if you are using yarn:

$ yarn

Once you have installed the dependencies for Augur.js, you can run the following command using npm to run the unit tests:

$ npm run test

To run integration tests with npm, use the following command:

$ npm run integration-test

If you would prefer to use yarn the command to run unit tests becomes:

$ yarn test

to run integration tests, the command is:

$ yarn integration-test

Augur.js also follows a standard for it’s code and also has a linting command. The command using npm is:

$ npm run lint

And if you prefer yarn then the command is:

$ yarn lint

Errors

{
    "error": 412,
    "message": "transaction validation failed"
}

In addition to the error codes generated by the Augur API, there is a separate set of error codes used by Augur’s smart contracts. To avoid confusion, API error codes are positive integers, while contract error codes are integers less than or equal to zero.

API and contract errors are returned as objects that contain an error field (the integer error code) and a message field (a description of the error).

API Errors

Error Code Meaning
40 Gas Limit Exceeded: trade exceeds the current block gas limit
41 Wrong Number of Outcomes: the number of initial fair prices does not match this market’s number of outcomes
42 Insufficient Liquidity: insufficient liquidity to generate order book
43 Initial Price Out-of-Bounds: one or more initial fair prices are out-of-bounds
44 Price Width Out-of-Bounds: price width is too large for one or more initial fair prices
97 Database Delete Failed
98 Database Write Failed
99 Database Read Failed
400 Invalid Contract Parameter: cannot send parameter to contract
401 Not Logged In
402 Incorrect number of parameters
403 Bad Credentials: incorrect handle or password
404 Transaction Not Found
405 Password Too Short: password must be at least 6 characters long
406 Null Call Return: expected contract call to return value, received null
407 Null Response: expected transaction hash from Ethereum node, received null
408 No Response
409 Invalid Response: could not parse response from Ethereum node
410 Local Node Failure: RPC request to local Ethereum node failed
411 Hosted Node Failure: RPC request to hosted nodes failed
412 Transaction Invalid: transaction validation failed
422 Handle Taken: handle already taken
450 Filter could not be created
500 Transaction Failed
501 Transaction Not Confirmed: polled network but could not confirm transaction
502 Duplicate Transaction
503 Raw Transaction Error: error sending client-side transaction
504 RLP Encoding Error (geth error -32603)
505 Transaction receipt not found
599 RPC Timeout: timed out while waiting for Ethereum network response
650 Loopback Not Found: loopback interface required for synchronous local commands
651 Ethereum Not Found: no active Ethereum node(s) found
710 Check Order Book Failed: could not check order book using current prices
711 Trade Failed: instead of success value (1), received [actual value received]
712 Trade Not Found

Contract Errors

Contract Method Error Meaning
buy 0 Market doesn’t exist
buy -1 Amount/price bad
buy -2 Oracle-only branch
buy -4 Not enough money or shares
buy 21 Trade already exists
buyCompleteSets 0 market not found
buyCompleteSets -1 oracle-only branch
buyCompleteSets -3 not enough cash
cashFaucet -1 Hey, you’re not broke!
claimProceeds 0 reporting not done
claimProceeds -1 trader doesn’t exist
claimProceeds -8 invalid branch
closeMarket 0 fail/trading not over yet/event not expired or closed already
closeMarket -1 Market has no cash anyway / already closed
closeMarket -2 0 outcome / not reported on yet
closeMarket -3 not final round 2 event
closeMarket -5 Event forked and not final yet
closeMarket -6 bonded pushed forward market not ready to be resolved
closeMarket -7 event not reportable >.99
closeMarket -8 market isn’t in branch
collectFees -2 needs to be second half of reporting period to claim rep (1st half is when redistribution is done)
createEvent -1 we’re either already past that date, branch doesn’t exist, or description is bad
createEvent 0 not enough money to pay fees or event already exists
createEvent -2 max value < min value
createEvent -9 would expire during non-reporting fork period
createMarket -1 bad input or parent doesn’t exist
createMarket -2 too many events
createMarket -3 too many outcomes
createMarket -4 not enough money
createMarket -5 fee too low
createMarket -6 duplicate events
createMarket -7 event already expired
createMarket -8 market already exists
createMarket -9 would expire during non-reporting fork period
penalizationCatchup -1 not in first half of reporting period
penalizationCatchup -2 doesn’t need to be penalized/caught up
penalizationCatchup -3 user isn’t behind or reported in the last period (and should thus use the penalization functions in consensus.se)
penalizeOnForkedEvent -2 already past first half of new period and needed to penalize before then
penalizeOnForkedEvent -4 fork event isn’t resolved yet
penalizeOnForkedEvent -5 already done for all events in this period
penalizeRoundTwoWrong 0 event is a fork event
penalizeRoundTwoWrong -1 need to penalize in round 2 penalize function
penalizeRoundTwoWrong -2 already past first half of new period and needed to penalize before then
penalizeRoundTwoWrong -4 in fork period only thing that rbcr is done on is the round 2 event in the original branch via round 2 penalize
penalizeRoundTwoWrong -5 already done for all events in this period
penalizeRoundTwoWrong -6 forked events should be penalized using the fork penalization function
penalizeWrong 0 event is a fork event
penalizeWrong -1 need to penalize in round 2 penalize function
penalizeWrong -2 already past first half of new period and needed to penalize before then
penalizeWrong -4 in fork period only thing that rbcr is done on is the round 2 event in the original branch via round 2 penalize
penalizeWrong -5 already done for all events in this period
penalizeWrong -6 forked events should be penalized using the fork penalization function
penalizeWrong -7 no outcome
proveReporterDidntReportEnough -1 already done
proveReporterDidntReportEnough -2 not in right part of period
pushMarketForward -1 fork period cannot be the current or previous period
pushMarketForward -2 market is already closed or pushed forward
pushMarketForward -3 not enough cash to post early resolution bond
pushMarketForward -4 early resolution already attempted or outcome already exists
sell 0 Market doesn’t exist
sell -1 Amount/price bad
sell -2 Oracle-only branch
sell -3 Bad outcome to trade
sell -4 Not enough money or shares
sell 21 Trade already exists
sellCompleteSets -1 oracle-only branch
sellCompleteSets -2 not a participant in this market
sellCompleteSets -3 not enough shares
sendReputation 0 Not enough Reputation
sendReputation -1 Your Reputation account was just created! Earn some Reputation before you can send to others.
sendReputation -2 Receiving address doesn’t exist
short_sell -1 trade doesn’t exist
short_sell -2 invalid trade hash/commitment
short_sell -3 must be a bid, not an ask
short_sell -4 market is already resolved
short_sell -5 can’t pickup your own trade
short_sell -6 can’t trade on oracle only branch
short_sell -7 not a large enough trade
short_sell 10 insufficient balance
short_sell 22 trade in same block prohibited
slashRep 0 Not a valid claim
slashRep -2 Reporter doesn’t exist
submitReportHash -1 invalid event
submitReportHash -2 not in first half of period (commit phase)
submitReport 0 reporter doesn’t exist or has <1 rep
submitReport -1 has already reported
submitReport -2 not in second half of period [reveal part]
submitReport -3 hash doesn’t match
submitReport -4 bad report
submitReport -5 invalid event
submitReport -6 already resolved
submitReport -7 <48 hr left in period, too late to report, able to put up readj. bonds though",
submitReport -8 fees couldn’t be collected
submitReport -9 need to pay not reporting bond
trade -1 oracle only branch
trade -2 bad trade hash
trade -3 trader doesn’t exist / own shares in this market
trade -4 must trade at least 0.00000001 in value
trade -5 can’t pick up your own trade
trade 10 insufficient balance
trade 22 trade in same block prohibited
updateTradingFee -1 invalid trading fee: either fee is below the minimum trading fee or you are trying to raise the trading fee (trading fees can be lowered, but not raised)
updateTradingFee -4 sender’s address does not match the market creator’s address

UI Conventions

Modules

  // Modules Conventions
  // Import Conventions
  // Order: 3rd party modules > services > components/selectors/reducers/actions
  // > constants > utils
  import React, { Component } from 'react';
  import { augur } from 'services/augurjs';
  import Input from 'modules/common/components/input';
  import { BUY, SELL } from 'modules/trade/constants/types';
  import trimString from 'utils/trim-string';

  // Export conventions
  // single constant export
  export default const BUY = 'buy';
  // or for a single function
  export default (args) => {
    // do something...
  };

Modules import paths for assets, modules, utils, and services are aliased, so avoid relative paths. Always traverse from the aliases. Import requirements in the following order:

  1. 3rd party modules
  2. services
  3. components/selectors/reducers/actions
  4. constants
  5. utils

Modules with a single export should have that denoted as default. If the export is a function, it should be anonymous.

Components

All components should be semantically tagged, highly reusable, and DRY. Components should have comments for functionality that may be non-obvious, depend on other methods, requires a complex mutation/filer, etc.

To help ensure this, the following conventions have been employed:

Layout Conventions:

<!-- JSX Layout Conventions -->
<!-- Example Component tree (after rendering)-->
<!-- only one main tag in the whole app, currently in app.jsx -->
<main id="app">
<!-- each view has it's own section component -->
  <section id="create-market-view" >
  <!-- each view has reusable components which should be articles
  unless they are specifically a button, list, link, etc.-->
    <article>
      <!-- more reusable components may be inside -->
    </article>
    <!-- ....more reusable components -->
  </section>
</main>

There is only one main tag, which is currently employed in the app.jsx component, to contain all view content. All top-level components (i.e. - views) should be contained within a section tag. Though valid, section should only be used for view level components. All section tags should have an accompanying id attribute (excluding unique semantic tags (main, header, footer, etc.)). All reusable components should be contained within an article tag unless this use would be semantically incorrect; in which case, use whatever tag is appropriate. All components should be standard HTML5 elements with their default behaviors intact. (Note: Due to some implementation constraints, there may be a reason to deviate from this, but it should be dialoged over prior to implementation.)

// React Conventions:
// required propTypes should come first.
static propTypes = {
  importantProp: PropTypes.object.isRequired,
  optionalProp: PropTypes.string,
}

// top level component (ie Views) example:
const marketsView = p => (
  <section id="markets-view">
    <MarketsList
      loginAccount={p.loginAccount}
      markets={p.markets}
      pagination={p.pagination}
      scalarShareDenomination={p.scalarShareDenomination}
    />
  </section>
);

marketsView.propTypes = {
  loginAccount: PropTypes.object,
  scalarShareDenomination: PropTypes.object,
  markets: PropTypes.array,
  pagination: PropTypes.object,
};

export default marketsView;

// re-usable component example:
const MarketsList = (p) => {
  const nullMessage = 'No Markets Available';

  return (
    <article className="markets-list">
      {p.markets.length ? p.markets.map((market) => {
        const selectedShareDenomination = getValue(p, `scalarShareDenomination.markets.${market.id}`);
        const shareDenominations = getValue(p, 'scalarShareDenomination.denominations');

        return (
          <MarketPreview
            key={market.id}
            loginAccount={p.loginAccount}
            {...market}
            selectedShareDenomination={selectedShareDenomination}
            shareDenominations={shareDenominations}
          />
        );
      }) : <NullStateMessage message={nullMessage} /> }
      {!!p.pagination && !!p.pagination.numUnpaginated &&
        <Paginator {...p.pagination} />
      }
    </article>
  );
};

MarketsList.propTypes = {
  loginAccount: PropTypes.object,
  scalarShareDenomination: PropTypes.object,
  markets: PropTypes.array,
  pagination: PropTypes.object
};

export default MarketsList;

React Conventions

Props that are being passed to a component should be explicit from both ends and Prop validations should have required props first, optional props after.

Null component states (ex: ‘no markets’, 'no tags’, etc.) should always be shown as the false value for a conditional display. Conditional display should occur as far down the component tree as possible.

Detailed Component Conventions

Not all conventions are detailed above, but rather just the main points. For a full review of the breadth of the conventions employed, reference:

Styles

// Less Variable exposed for JS example:
@animation-speed-very-fast: 200ms;

// For accessibility w/in JS
body {
  --animation-speed-very-fast: unit(@animation-speed-very-fast);
}
// access less variable using JS
updateAnimationSpeedValue() {
    this.setState({
      animationSpeed: parseInt(window.getComputedStyle(document.body).getPropertyValue('--animation-speed-very-fast'), 10)
    });
  }

All styles should be contextual such that styling rules are only directly applied to the immediately relevant component(s), with the ultimate goal always being consistency and maintainability. This is seen reflected in the overall structure of the stylesheets – generally a 1-to-1 between a component and a stylesheet.

The full breadth of Less’s functionality is permissible. If you need a Less variable to be accessible during runtime, create a rule set for body and with identically named custom properties which have their values as the respective less variables. You can then get these values by calling getComputedStyle and getPropertyValue on document.body.

Following are some of the conventions that have been employed:

Mixin Conventions

  /* Mixin Conventions */
  // BORDER Constants
  // Defaults
  @border-all: 'all sides';
  @border-default-chroma: @border-normal;
  @border-default-width: 1px;
  // Sides
  @border-top: border-top;
  @border-right: border-right;
  @border-bottom: border-bottom;
  @border-left: border-left;
  // Chroma
  @border-normal: @color-border;
  @border-muted: @color-border-muted;
  @border-light: @color-border-light;
  @border-faded: fadeout(@color-border, @amount-extra-light);
  // Style
  @border-solid: solid;
  @border-dotted: dotted;
  @border-dashed: dashed;
  @border-double: double;
  // Width
  @border-width-2: 2px;
  @border-width-3: 3px;
  // define mixin
  .border(@side: false; @property: @border-all; @chroma: @border-default-chroma; @width: @border-default-width; @style: @border-solid;) {
    & when (@side) {
      & when (@property = @border-all) {
        border: @width @style @chroma;
      }

      @{property}: @width @style @chroma;
    }

    & when not (@side) {
      border: none;
    }
  }

  /* Component Style Conventions: */

  .example-widget-viewer {
    // mixins come first and in alphabetical order
    .border(true);

    align-items: center;
    background-color: @color-white;
    display: flex;
    flex: 1;
    min-width: 22em;
  }

Use mixins where provided. If an identical style is to be applied to multiple elements, that declaration block should probably be abstracted to a mixin. Comments should be employed for mixins to help inform the utilization. This can be seen in the way (not exhaustive) typography and borders are employed. Some notable mixins include: - animations, - borders, - colors, and - typography.

Component Style Conventions

Every component should have the minimum amount of styling required (helps maintain contextualization). This allows for stylesheets of parent components that employ a component to apply any additional 'chrome’ required.

Things to remember about Component Less styling include:

Detailed Style Conventions

Above are the main points, but additional structural and styling conventions of the stylesheets themselves are enforced through linting. For a full review of all conventions, reference:

Glossary

This section of the documentation is dedicated to terms found and used throughout the rest of documentation. Below you will find sections about terms used in Augur. The goal is to explain everything that might be confusing in an easy to understand way.

All Reporting

All Reporting is the third level of the Reporting system, second if the Market never had a set Automated Reporter. If a Market has gone through Limited Reporting and while Awaiting Finalization is challenged then the Market will be moved into the upcoming All Reporting level of the next Reporting Window. Every Reporter is expected to report on All Reporting Markets during a Reporting Window’s Reporting Phase in which they are Reporting. All Reporting lasts for 27 days and is followed by a 3 day Dispute Phase where a Dispute Bond can be posted to force the final reporting system level, a Fork. All Reporting takes place within a Reporting Window.

Ask Order

An Ask Order is an Order indicating the desire of the Maker to sell Shares of one or more Outcomes. This is the opposite of a Bid Order.

Automated Reporter

An Automated Reporter is a single address designated to submit the Proposed Outcome for a Market during Automated Reporting. The Automated Reporter is set by the Market Creator during Market Creation. If no Automated Reporter is set then the market will use Limited Reporting as it’s first attempt to be Finalized, instead of Automated Reporting.

Automated Reporting

Automated Reporting is the first and fastest way that a Market can be Reported on. One address will be responsible for submitting a Proposed Outcome for the Market and will have 3 days to do so after a Market’s End Time. After the Automated Report has been submitted by the automated Reporter then a 3 day Dispute Phase begins where in anyone can post a bond to dispute the Market Awaiting Finalization. If the Dispute Bond is posted then the market is moved into the next Reporting Window and will be subject to Limited Reporting. Automated Reporting is independent of Reporting Windows.

Bid Order

A Bid Order is an Order indicating the desire of the Maker to buy Shares of one or more Outcomes. This is the opposite of an Ask Order.

Binary Market

A Binary Market is a market with only two outcomes, as well as Indeterminate which is always a possible outcome. Binary markets are for yes or no questions, if you need more than a yes or no then a Categorical or Scalar market might fit your needs better.

Branch

A Branch can be thought of as a separate universe of Augur where the Proposed Outcome submitted for a All Reporting Market is Disputed and multiple versions of Augur are needed to resolve the dispute. Each version of Augur is a different Branch, where each version will feature a copy of Augur’s state with the one difference being the Proposed Outcome of the Market that caused the Fork. Once the Fork occurs, REP holders will have to choose which branch to migrate their REP to. Migration is a one way action and is final. The Market that caused the Fork will be considered Finalized in all branches, however only the branch that has the most REP migrated to it after 60 days will allow traders to Settle Shares and payout Reporters their Reporting Fees.

Categorical Market

A Categorical Market is a market with more than 2 potential outcomes, but no more than 8. As with all markets, Indeterminate is also an outcome not included in the 8 outcome maximum. Categorical Markets are best for multiple choice type questions, which team wins a tournament or what color tie the President of the United States wears at his next press conference. If you just need a yes or no question, you will probably want to make a Binary Market. If you wanted to guess the temperature in degrees on a certain day, you would probably want to use a Scalar Market for that, as it would be very difficult to pin down 8 possibilities and it’s not a yes or no question.

Challenge

Challenge is used to describe the act of a REP holder posting a Dispute Bond to dispute or “challenge” the Proposed Outcome of a Market Awaiting Finalization before it is Finalized.

Complete Set

A Complete Set is a collection of Shares in every Outcome. Complete Sets are created when the Maker and Taker of an Order both use currency to pay for the trade, as opposed to one or both parties using Shares to complete the trade. When both parties use shares to complete the trade then a Complete Set will be formed and settled (destroyed). The range of the market, (maxDisplayPrice - minDisplayPrice) - Trading Fees ETH will then be paid out proportionally to both the Maker and Taker based on their respective Shares value at the time of settlement. The Trading Fees extracted will go toward paying for the reporting system and paying the Market Creator their set Trading Fee from share settlement.

Dispute Bond

A Dispute Bond is a bond posted to force another round of Reporting if a Reporter feels the Proposed Outcome of a Market Awaiting Finalization isn’t accurate. If the Market’s Proposed Outcome is changed in the forced round of reporting then the poster of the dispute bond will get their money back for successfully challenging the false Outcome of the Market.

Dispute Phase

A Dispute Phase is a three (3) day window after a Market has been Reported on before which the Proposed Outcome of the market Finalized. During this 3 day period, a Reporter can post a Dispute Bond for a particular market if they would like to force another round of reporting on that market. The market will be moved into the next coming Reporting Window. Markets in the Dispute Phase are sometimes referred to as Markets Awaiting Finalization.

End Time

End Time is the date and time that a Market’s event will have come to pass and should be known. After this date and time has passed the Market will get Reported on and Finalized.

Fill Order

Filling an Order is when a Taker provides what the Maker of the order is seeking in their order. If a taker only provides some of what the Maker wants then it’s known as a partial fill. If the Taker provides exactly what the Maker requests then it’s known as completely filling the order.

Finalized Market

A Finalized Market is a Market that has Awaited Finalization and has not been disputed, the Proposed Outcome is now considered final. This market will now allow Share holders to settle their shares with the market.

Fork

A Fork occurs if a Market Awaiting Finalization from an All Reporting round of Reporting is Disputed. A Fork causes Augur to create multiple Branches of itself, where each branch is a copy of the current state of Augur with the only difference being the Finalized outcome of the Market that caused the Fork to occur. There will be a branch created for each possible outcome of the market, including invalid. REP holders will need to choose which branch they want to migrate their REP tokens too. Migration is one way and final. After sixty (60) days the Fork Period ends and the branch with the most REP migrated too it will allow traders to settle shares for that market and Reporting Fees will be paid out to Reporters for that branch.

Fork Period

The Fork Period is a sixty (60) day window of time after a Fork has occurred.

Limited Reporting

Limited Reporting is the second level of Reporting and is the first attempt at Market Finalization if an Automated Reporter hasn’t been set by the Market Creator. Limited Reporting means the Market needs to be reported on by a certain amount of Reporters who will stake their REP on the Proposed Outcome of their choosing. Limited Reporting has a Reporting Phase that lasts for twenty seven (27) days and has a three (3) day Dispute Phase following it. If a Limited Report’s Proposed Outcome is challenged the Market is moved into the All Reporting state and attached to the next Reporting Window. Limited Reporting takes place within a Reporting Window.

Maker

A Maker is the creator of an Order that is placed on the Order Book. They escrow currency or Shares into their Order in order to buy or sell Shares of an Outcome of a Market.

Market

A market is created by users of Augur for a small fee. They are used to describe an upcoming event that people would presumably be interested in wagering on. They should also provide information on how to verify the outcome of the event, the more specific the better. Each market created on the Augur network will have an automatically managed Order Book, which will allow users to buy and sell Shares of different outcomes of the market. The Market Creator can set the Trading Fee for the market, which once set cannot be raised, which will determine their cut of all shares Settled on the Market. There are three different Market types supported by Augur, they are: Binary, Categorical, and Scalar.

Market Creator

A Market Creator is a user who created a market. They are charged a small fee to make a new market but can determine the Trading Fee for Settlement of Shares on that market. Market Creators are incentivized to create popular markets so as to generate the most amount of Settlement fees for themselves. Other information a market requires is the actual question being purposed, the type of market, the number of Outcomes, End Time, and a Topic.

Market Awaiting Finalization

Market Awaiting Finalization occurs when a Market has been Reported on and has a Proposed Outcome. Market’s await finalization for a period of 3 days, which is the length of the Dispute Phase, in which REP Holders are allowed to post a Dispute Bond to force another round of reporting for the Market Awaiting Finalization. If a Market’s Proposed Outcome is not Challenged for 3 days it becomes a Finalized Market.

Maximum Display Price

The Maximum Display Price (often seen as maxDisplayPrice) is the maximum price allowed for a share on a market. For Binary or Categorical Markets this value is always 1, as in 1 ETH. Scalar markets’ Maximum Display Price would be the top end of the range set by the Market Creator.

Minimum Display Price

The Minimum Display Price (often seen as minDisplayPrice) is the minimum price allowed for a share on a market. For Binary or Categorical Markets this value is always 0, as in 0 ETH. Scalar markets’ Minimum Display Price would be the bottom end of the range set by the Market Creator.

Open Order

An Open Order is an Order that is currently on the Order Book and has not been completely Filled.

Order

An Order can be thought of as the recorded interest of a user to execute a trade of some amount of Shares at a defined price point. Orders come in two types, Bid Orders and Ask Orders, which indicate an attempt to buy or sell respectively. The Maker of the order will also need to escrow currency or shares in order to provide their half of the trade. The information stored in an Order is as follows: the type of order, the Market the order is trading on, the Outcome the order is concerned with buying or selling, the Maker’s address, the price per share, the amount of shares to trade, what block number the order was created during, the amount of currency or Shares escrowed in the order by the Maker for their half of the trade.

Order Book

The Order Book is the collection of all Open Orders currently available for a Market. Orders are placed on the order book by Makers and are Filled by Takers. Orders are divided up by which type, or side, of order they are Bid or Ask. Orders are further divided up by Outcome.

Outcome

An outcome is a potential result of a Market’s future event. For example, a market with a question of “Will it rain anywhere in New York City on November 1st, 2032 as reported by www.weather.com?” would have three potential Outcomes: Yes, No, and Invalid. Invalid would be an option if the world blew up before November 1st, 2032 and there was no New York City or www.weather.com to verify the Market’s Outcome. More realistically this can happen for markets that have too vague of a question. A good example of a vague market that would most likely be voted invalid would be “Does God exist?” as no one has a definitive answer.

Position

A Position is the amount of Shares that is owned (a long position) or borrowed and then sold (a short position) by an individual. A position can be profitable or unprofitable, depending on Market movements. Positions can be Open or Closed. An Open Position simply means you currently own the shares, where as a closed position means you have now redeemed your shares and have cashed out for currency. Closing a short positions means you are buying the Shares of the Outcome you are short on, where as closing a long position means selling the Shares you own.

Registration Token

A Registration Token is purchasable by REP holders for REP and is used as a sort of ticket to participate in the upcoming Reporting Window that the Registration Token belongs to. Once the Reporting Window has started, you will need the Registration Token to be able to report. When the Reporter finishes Reporting they are able to redeem their Registration Token for the REP spent to purchase it. The Registration Token cannot be redeemed once the reporting window it belongs to has passed if the Reporter did not Report and the deposit is lost. The Registration Token is designed as a sort of deposit to ensure that Reporters who sign up to Report in the upcoming Reporting Window actually show up and participate in the reporting process, or lose their deposit.

REP

REP, also known as Reputation, Reputation Tokens, or REP Tokens, is the currency used by the Augur Decentralized Oracle System. REP is used to purchase a Registration Token for an upcoming Reporting Window and to Report on the outcome of Markets. Once you have registered for a Reporting Window, when the time comes to report you will be shown markets that need to be finalized. You will be asked to wager REP on an outcome based on how confident you are in that outcome being the result of the question asked in the market. The markets you will see for reporting are all past their End Time and the outcome should be determinable. If the outcome is not determinable you can wager your rep into the Indeterminate outcome. The more REP you wager, the larger the share of the Reporting Fees you will receive if you report with the consensus.

Report

A Report, or Reporting, is the staking of REP on the Outcome of a Market that’s passed it’s End Time by a Reporter. The staking of REP is the act of Reporting. Reporting as a term can be used to describe the act of submitting a report for a single market or a number of markets. Reporting takes place during a Reporting Window. For a detailed breakdown of the Reporting System in Augur, see the Reporting Section.

Reporter

A Reporter, or Registered Reporter, is a REP holder who Stakes REP on the Outcome of a Market who’s End Time has come to pass and is not Awaiting Finalization. A Reporter can be assigned by the Market Creator during Market Creation for Automated Reporting, otherwise REP holders will need to purchase a Registration Token for an upcoming Reporting Window in order to Report on the Outcome of Markets. Reporters are expected to Report accurately as the Market’s event should have come to pass and the result should be known.

Reporting Fee

The Reporting Fee is used to help pay for Augur’s Decentralized Oracle System. When Shares are Settled (aka destroyed), before paying out to the share holders Augur will extract the Trading Fees, which includes the Trading Fee and the Reporting Fee. The Reporting Fees are sent to the Reporting Window that contains the market being traded on, and are later used to pay REP holders for Reporting on the Outcome of Markets.

Reporting Phase

The Reporting Phase occurs in the first twenty seven (27) days of a [Reporting Window]. During this phase, Limited Reporting and All Reporting Markets are Reported on by Reporters.

Reporting Window

The Reporting Window is a period of 30 days in which Markets that have passed their End Time are expected to be Reported on by Reporters. Reporting Windows last for thirty (30) days and consist of two (2) phases, the Reporting Phase and the Dispute Phase. The Reporting Phase lasts twenty seven (27) days in which Limited Reporting and All Reporting Markets are Reported on. The Dispute Phase lasts three (3) days and during this time any REP holder is allowed to post a Dispute Bond to Challenge the Proposed Outcome of the Market Awaiting Finalization. Reporting Windows are occasionally referred to as “Reporting Cycles” or “Reporting Periods” as those were legacy terms for a Reporting Window during development of Augur.

Scalar Market

A Scalar Market is a Market with a range for potential outcomes. A scalar market example might be “According to www.weather.com, what will the temperature in Fahrenheit be at SFO on January 3rd, 2062 at 1:00pm?”. In this example market, we might set the minDisplayPrice of the market to -50 and the maxDisplayPrice to 150. This would allow for the market to Settle on any number between the two. Sometimes you don’t need a range of potential outcomes, only a simple yes/no or a small number of choices, in these cases you would want to use a Binary or Categorical Market respectively.

Settlement

Settlement is something that happens one of two ways. The first is when a trader who holds Shares would like to cash out of their Position on a Finalized Market. The other is the collection of a Complete Set which can happen before a Market Finalizes. The Trading Fees, which includes both the Trading Fee and the Reporting Fee, are only extracted during settlement.

Shares

A Share is the ownership of a portion of a Market’s Outcome’s value. A Complete Set of Shares are created when both the Maker and Taker of an Order send currency to the market to complete an Order. Shares are settled (destroyed) when a Complete Set is sold back to the market.

Taker

A Taker is someone who partially or fully Fills an Open Order on the Order Book. Takers send currency or Shares to fill the Open Order and complete their half of the trade described in the Order.

Topic

A Topic is a keyword used to categorize markets. All markets must have a topic, and are optionally allowed up to two sub-topics to further categorize the Market. An example Market for “Will the New York Giants win Super Bowl 100?” might have a Topic of “Sports” and sub-topics of “American Football” and “NFL”. The Topics are set by the Market Creator when a new market is made and cannot be changed.

Trading Fee

A Trading Fee is set by the Market Creator when he or she creates a new Market. Once the trading fee is set, it can never be increased, only decreased. The Trading Fee must be between 0% and 50%. The Trading Fee and the Reporting Fee are both extracted at the same time whenever Shares are Settled. Shares can be settled when a user amasses a Complete Set or when the market has been Finalized and you want to close your open Position. The Trading Fee is designed to incentivize users to make popular markets as they stand to earn money if enough people trade on the market. They can then recoup their market creation cost and ideally turn a profit on posting interesting markets. The Trading Fees are discussed in more details in the Trading section of the documentation.

Proposed Outcome

The Proposed Outcome is the currently proposed Outcome for a Market that is Awaiting Finalization. In other words, it’s the outcome Reporters have staked their REP on to indicate that it is the correct outcome of the Market. If a market isn’t Challenged while Awaiting Finalization by a REP holder posting a Dispute Bond then the Market will become Finalized and the Prosed Outcome will be final.

Contributing

We think Augur and Ethereum are pretty awesome, and believe that they’re going to change the world. We’d love it if you want to be a part of this – as a user, tester, or developer!

Before you submit a pull request to the Augur Project, you should make sure you have linted your code so that it fits the Augur Project standards and you have updated/added unit tests for your changes. You can find more details about testing and linting in the tests section of these documents.

Most of our day-to-day conversation happens in our Slack. (We also have an IRC gateway in #augur on Freenode that is connected to our Slack chat!) Our Slack is open. If you’d like to join the conversation, just go to slack.augur.net and sign up. We love to hear feedback from people who are as excited as we are about Augur!