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://dev.augur.net – 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 its 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 invite.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://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 trade, if there is an Order on the book that will fulfill your trade request then it will be Filled immediately. If there is no matching Order, or your trade request can only be partially Filled, the remainder of what wasn’t filled of your trade will be placed on the Order Book as an Order. If you are the Maker of the Order you can cancel it to remove it from the Order 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 price than the limit price set by the trader, 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 trade request to buy 100 Shares of Outcome A with a limit price of 0.5 ETH, which will cost 50.0 ETH plus GAS used to send the transaction.

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 GAS cost.

If no Order is available on the Order Book that would partially or completely fill our trade request then a Bid Order would be 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. 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, the only currency lost would be the GAS used to pay to place the trade and cancel the trade. When a Taker decides to fill our Order on 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.

Settlement Fees Explained

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 Creator Fee for their Market. The Creator Fee must be between 0 and 50 percent. Once a Market is created the Creator Fee cannot be raised, only lowered.

Augur also extracts Fees to help support the Reporting System known as the Reporting Fee. Settlement Fees refer to both the Creator Fee and the Reporting Fee combined. The Reporting Fee isn’t set by the Market Creator, like the Creator Fee, but is instead set by an automated Augur Market.

Augur will automatically create a Market once every Thirty (30) days to use as a data feed for the REP price. This Market will act just like a regular Market and it will go through Reporting Rounds process in order to be Resolved. Once the REP price is known, Augur can calculate the REP Market cap and the appropriate Reporting Fee to ensure the security of the Reporting System.

The Augur 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 determine wether the Reporting Fee 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 Reporting Fee will be updated once every 30 days, or once every Reporting Window. 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 accounted for by the fee system.

Settlement 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 a set of Shares for each Outcome. Complete Sets are priced differently for each Market, and are determined by the Number of Ticks, which represents all possible price points, or Ticks, for a Market as well as the amount of attoeth it costs to purchase a Complete Set for the Market. If you own a set of Shares in each Outcome, you can Settle those Shares and receive ETH back for their value minus Settlement Fees.

Calculating Trades

In this section we break down all potential trade situations and their expected result. There are two types of Orders, Bid Orders (requesting to buy) and Ask Orders (requesting to sell). In our examples below we will go over all the potential trade possibilities around Bid Orders and Ask Orders. Orders are placed on the Order Book by Makers and contain four important details: The Maker of the Order, the price of the Order, The amount of Shares or ETH escrowed, and the Outcome we plan to trade on. The price can be any value between 0 and the Number of Ticks. The calculations below use num_shares as the number of Shares the Order is requesting, price as the price per Share for the Order, outcome for the Outcome our Order is trading on, num_ticks as the Number of Ticks, and fee_rate as the Settlement Fees extracted during the Settlement of Shares.

The Formulas for determining how much opening a Long or Short position costs are as follows:

Cost of Opening a Long Position(open_long_position_cost):

num_shares * price

Cost of Opening a Short Position(open_short_position_cost):

num_shares * (num_ticks - price)

The formulas for determining the payout and the fees required to be paid by each side of an Order are as follows:

Total payout for closing a Long Position(total_payout_closing_long):

num_shares * price / num_ticks

Total payout for closing a Short Position(total_payout_closing_short):

num_shares * (num_ticks - price) / num_ticks

Fees paid for closing a Long Position(long_position_fees):

total_payout_closing_long * fee_rate

Fees paid for closing a Short Position(short_position_fees):

total_payout_closing_short * fee_rate

Below are some more examples of specific order situations and their results:

Bid Order Trading

Maker of Bid Order Taker of Bid Order
Escrows: num_shares of all outcomes except outcome
Order Details: price, maker, outcome, escrow
Intent: close a short position for outcome.
Sends: open_short_position_cost ETH.
Intent: open a short position for outcome.
Gains: total_payout_closing_short ETH.
Loses: num_shares in all outcomes except outcome.
Gains: num_shares in all outcomes except outcome.
Loses: total_payout_closing_short ETH.
Maker of Bid Order Taker of Bid Order
Escrows: open_long_position_cost ETH
Order Details: price, maker, outcome, escrow
Intent: open a long position for outcome.
Sends:: open_short_position_cost ETH.
Intent: open a short position for outcome.
Gains: num_shares of outcome.
Loses: open_long_position_cost ETH
Gains: num_shares of all outcomes except for outcome.
Loses: open_short_position_cost ETH.
Maker of Bid Order Taker of Bid Order
Escrows: num_shares of all outcomes except outcome
Order Details: price, maker, outcome, escrow
Intent: close a short position for outcome.
Sends: num_shares of outcome.
Intent: close a long position for outcome.
Gains: total_payout_closing_short - short_position_fees ETH.
Loses: num_shares in all outcomes except outcome.
Gains: total_payout_closing_long - long_position_fees ETH.
Loses: num_shares in outcome.
Maker of Bid Order Taker of Bid Order
Escrows: open_long_position_cost ETH
Order Details: price, maker, outcome, escrow
Intent: open a long position for outcome.
Sends: num_shares of outcome.
Intent: close a long position for outcome.
Gains: num_shares in outcome.
Loses: open_long_position_cost ETH
Gains: total_payout_closing_short ETH.
Loses: num_shares of outcome.

Ask Order Trading

Maker of Ask Order Taker of Ask Order
Escrows: num_shares of outcome.
Order Details: price, maker, outcome, escrow
Intent: close a long position for outcome.
Sends: open_long_position_cost ETH.
Intent: open a long position for outcome.
Gains: total_payout_closing_long ETH.
Loses: num_shares in outcome
Gains: num_shares of outcome.
Loses: open_long_position_cost ETH
Maker of Ask Order Taker of Ask Order
Escrows: open_short_position_cost ETH.
Order Details: price, maker, outcome, escrow
Intent: open a short position for outcome.
Sends: open_long_position_cost ETH.
Intent: open a long position for outcome.
Gains: num_shares in all outcomes except outcome.
Loses: open_short_position_cost ETH
Gains: num_shares of outcome.
Loses: open_long_position_cost ETH.
Maker of Ask Order Taker of Ask Order
Escrows: num_shares of outcome.
Order Details: price, maker, outcome, escrow
Intent: close a long position for outcome.
Sends: Shares in all outcomes except outcome.
Intent: close a short position for outcome.
Gains: total_payout_closing_long - long_position_fees ETH.
Loses: num_shares of outcome
Gains: total_payout_closing_short - short_position_fees ETH.
Loses: num_shares in all outcomes except outcome.
Maker of Ask Order Taker of Ask Order
Escrows: open_short_position_cost ETH.
Order Details: price, maker, outcome, escrow
Intent: open a short position for outcome.
Sends: Shares in all outcomes except outcome.
Intent: close a short position for outcome.
Gains: num_shares in all outcomes except outcome.
Loses: open_short_position_cost ETH.
Gains: total_payout_closing_short ETH.
Loses: num_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: Designated Reporting, First Round Reporting, Last Round 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. Designated Reporting
  3. Designated Dispute
  4. Awaiting Migration
  5. First Round Reporting
  6. First Round Dispute
  7. Last Round Reporting
  8. Last Round Dispute
  9. Fork
  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, the Market will immediately enter it’s Designated Reporting state.

The Designated Reporting (2) state is up to three days long, also known as the Designated Report Phase. During the Designated Reporting Phase the Market is expected to be Reported on by the Designated Reporter. As soon as the Designated Reporter submits their Report the Market will be moved into the Designated Dispute (3) state, also known as the Designated Dispute Phase, and First Report REP Bond and First Report GAS Bond are both refunded immediately to the Market Creator.

The Designated Dispute Phase lasts for three days, during which any REP holder can post a Dispute Bond to Challenge the Proposed Outcome Reported by the Designated Reporter. A Market in the Designated Dispute state is considered a Market Awaiting Finalization because if no Dispute Bond is posted the Proposed Outcome will become the Final Outcome and the Market will be considered Finalized (10).

If a Dispute Bond is posted during the Designated Dispute Phase, or if the Designated Reporter fails to Report during the Designated Report Phase then the Market will be moved into the Awaiting Migration (4) state. If the reason the market moves into the Awaiting Migration state is because the Designated Reporter failed to Report, then the First Report REP Bond and First Report GAS Bond are sent to the nearest Reporting Window.

The Awaiting Migration (4) state can last up to 30 days and theoretically could be as short as one second long. During this time the Market is waiting for the next Reporting Window to begin so that the Market can be moved into a First Round 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 First Round Reporting (5) state, and the Reporting Phase will begin. During the Reporting Phase markets in both a First Round Reporting (5) and Last Round Reporting (7) state will be reported on by Reporters.

In the event that a Market is moved into First Round Reporting due to a Designated Reporter failing to Report, then the first person to submit a Report will receive the First Report GAS Bond and the First Report REP Bond. The First Report REP Bond is applied to whatever stake of REP is submit with the First Report. The First Report GAS Bond is used on behalf of the First Reporter to pay for their transaction GAS cost and if there is any ETH left over it will be given to the First Reporter.

Once 27 days have passed the Reporting Window’s Reporting Phase ends and the Dispute Phase begins. All Markets previously in the First Round Reporting (5) or Last Round Reporting (7) states will move into the First Round Dispute (6) and Last Round 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 First Round Dispute or Last Round Dispute state can be Challenged by any REP holder willing to post a Dispute Bond.

If a Market in the First Round Dispute (6) state is challenged then it will be moved into the Last Round 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 Last Round 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, known as the Fork Period, and creates multiple Universes of Augur. Users can migrate their REP from the original Universe, known as the Parent Universe, into one of the new Universes, known as a Child Universe. Migration is one-way and final and any REP that isn’t involved with the Forked Market is able to be migrated to the REP holder’s chosen Child Universe. The Forked Market’s staked REP is automatically moved to the Child Universe corresponding to that Outcome the REP is staked on.

The Universe with the most REP migrated to it by the end of the Fork Period will be chosen as the Winning Universe. Forked Markets are considered Finalized (10) in each Universe but only the Winning Universe will be able to Settle shares and reward Reporters. Forking is discussed in greater detail in the below section: Forking Details.

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 the Forked Market is always considered Finalized in each Child Universe. Once a Market is Finalized, traders can Settle their positions with the Market.

Designated 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 Designated Reporter to accurately Report on the Outcome of the Market. The result of Designated Reporting is still Challengeable with a Dispute Bond so if the Designated Reporter does incorrectly Report the Outcome of the Market it can be adjudicated by First Round 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 Challenged.

Designated Reporting Details

Designated Reporting is a way to attempt quick Market Resolution. A Market Creator must assign a Designated Reporter during Market Creation. Designated Reporting provides the advantage of faster Market Resolution than any other type of Reporting. This is pleasing to Traders who want to Settle their Shares and collect their earnings as soon as possible after a Market’s End Time has passed. Designated Reporting begins immediately following the End Time of a Market, unlike other forms of Reporting which must wait for the next available Reporting Window before any attempt at Market Resolution can be made.

Designated Reporting consists of two phases which are completely independent of the continuous cycle of Reporting Windows. The first phase is known as the Designated Report Phase which, unlike a Reporting Window’s Report Phase which lasts 27 days, only lasts a maximum of three (3) days. The Designated Report Phase is ended immediately when the Designated Reporter submits their Report and the Proposed Outcome is set for the Market.

If the Designated Reporter fails to Report within the Designated Report Phase the First Report REP Bond, the First Report GAS Bond and the Market is moved into the next available Reporting Window for First Round Reporting. These Bonds will be used to help pay for the gas costs and add to the REP staked by the First Reporter to Report on this Market when First Round Reporting begins.

If the Designated Reporter does successful Report within the Designated Report Phase the First Report REP Bond and the First Report GAS Bond is refunded to the Market Creator immediately and the Market enters the Designated Dispute Phase which lasts for three (3) days. During this 3 day period any REP holder can post a Dispute Bond to Challenge the Proposed Outcome Reported by the Designated Reporter. If a Dispute Bond is posted the Market is moved into the next available Reporting Window for First Round Reporting. If the Market is left unchallenged for the duration of the Designated Dispute Phase then the Market’s Proposed Outcome becomes the Final Outcome and the Market is considered Finalized allowing the Settlement of Shares.

Reporting Windows in Detail

Reporting Windows continually occur and last for thirty (30) days. Reporting Windows have two phases, the Reporting Phase and the Dispute Phase. The Reporting Phase lasts for twenty seven (27) days in which Reporters will be Reporting on Markets in the First Round Reporting and Last Round 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. In order to earn Reporting Fees as a REP holder you need to Report on Markets during the Reporting Phase.

Markets are placed into the next available Reporting Window following the End Time of a Market. For example, if a Market’s End Time is 12:00 AM EST on January 3rd 2053 and a Reporting Window was just started on January 1st 2053, the Market would move into the next Reporting Window that would be starting on January 31st, 2053, or 30 days since the start of the January 1st Window. Designated Reporting Markets are only placed into the next available Reporting Window if they are Challenged or the Designated Reporter fails to Report.

Any REP holder can participate in a Reporting Window. In fact, in special cases, someone without any REP is able to successfully Report on Markets in First Round Reporting. This case only occurs when the Market’s Designated Reporter fails to Report during the Designated Report Phase. In this situation, the first person to submit a report can do so and stake 0 REP on the report. This is only the case because the First Report REP Bond is added to the First Report’s Stake so in this case the stake can be 0 as it will get the bond added to it. This creates a race to be the First Reporter so as to attempt to get free REP from reporting correctly and earning the First Report REP Bond.

Reporting Round Details

If the Proposed Outcome of a Market’s Designated Report Phase is Challenged during the Designated Dispute Phase or if the Designated Reporter fails to Report then the Market will move into Reporting Rounds. Augur currently allows for two Reporting Rounds on a Market before a Fork is required to Finalize the Market, they are known as First Round Reporting and Last Round Reporting respectively.

Rounds of Reporting only occur during the Reporting Phase, which is the first 27 days, of a Reporting Window. Any REP holder is can stake at least 1 attoREP on an Outcome for a Market being Reported on in a Reporting Round. The Outcome with the most REP staked on it at the end of the Reporting Phase will become the Proposed Outcome during the Dispute Phase as the Market Awaits Finalization. If the Market’s Proposed Outcome isn’t Challenged during the Dispute Phase then the Market will Finalize and the Proposed Outcome will become the Final Outcome.

REP holders who staked REP on the eventual Final Outcome will receive their REP back, a portion of Reporting Fees, and a portion of the REP staked on Outcomes that weren’t the Final Outcome. A larger stake of REP placed on the Final Outcome will result in a larger portion of the Reporting Fees and REP that is to be redistributed following the Reporting Window ending.

If the Market’s Proposed Outcome is Challenged during a Dispute Phase then the Market will be elevated to the next level of Reporting Rounds in the following Reporting Window. However a Challenge to a Last Round Report will cause a Fork, which is discussed in greater detail in the following section.

All Rounds of Reporting have virtually no difference between them, they operate exactly the same aside for two specific cases. One, as mentioned in the previous paragraph, is if the Last Round of Reporting is Challenged which causes a Fork. The second comes in the form of a Designated Reporter not Reporting on the Market so the Market moves to First Round Reporting. In this case the First Report REP Bond and the First Report GAS Bond are sent to the Reporting Window along with the Market.

The first person to Report on this Market is known as the First Reporter, and their Report is known as the First Report. The First Report is incentivized by Augur in two ways. The first way is the First Report GAS Bond which is used to cover the transaction cost of the First Report. If there is leftover ETH in the First Report GAS Bond after the First Report is submit then it will be sent to the First Reporter. The second way Augur incentivizes a First Report is the First Report REP Bond which is added to the Staked REP of the First Report.

The First Reporter doesn’t need to be a REP holder in order to Report. This is the only case where someone without REP is able to Report. A First Reporter without any REP could stake 0 attoREP on their Report and because the First Report REP Bond is added to their stake they will have more than 1 attoREP staked, making the Report valid. If the First Reporter ends up Reporting the accurate Final Outcome they will get the First Report REP Bond back as if they had owned that REP all along. This is an interesting way to accumulate REP without needing to trade currency for it while simultaneously causing a race to Report, which helps Augur run smoothly by incentivizing at least one Report for Markets.

Forking Details

The final state of Reporting, if needed, is the very disruptive Fork. Forks are disruptive because Augur needs to assume the Decentralized Oracle System is under attack if a Fork occurs. Since Augur assumes it’s under attack, any non-Finalized Market is put into a pending state, in which they will not be Reported on until the Fork is resolved.

As discussed above, if an Last Round Reporting Market’s Proposed Outcome is Challenged during the Dispute Phase then the Market causes a Fork. Forks cause the creation of Universes equal to the number of Outcomes for the Forked Market. A Binary Market that causes a Fork would create three Universes, one where the Final Outcome is “Yes”, one where the Final Outcome is “No”, and one where the Final Outcome is “Invalid”. The Universes will start with no Markets, no liquidity, and no REP until someone migrates some REP to the new Universe. The only thing on a new Universe is the Finalized Forked Market.

All Markets created in Augur belong to a Universe. The Original Universe that contained the Market that caused the Fork to occur will become locked once the Fork happens, this Universe is considered the Parent Universe. Markets are always tradable, no matter what state they are in or what Universe. While trading can still take place in the Parent Universe, new Markets cannot be created in a Locked Universe, however they can be created in any of the new Universes spawned by the Fork, known as Child Universes.

Forking causes the REP remaining in the Locked Universe to no longer have the ability to earn fees from Reporting as there will never be new Markets to Report on. REP holders are given the option to Migrate their REP to one of the Child Universes created by the Fork. Migration should be considered very carefully as it only happens in one direction and is irreversible, however if you ever want to use your REP to earn Reporting Fees again you will need to choose a Child Universe to Migrate too. There is no time limit on when a REP holder is allowed to migrate, they can choose to do it immediately after a Fork or wait for the Fork to resolve. REP staked on the Forked Market is automatically migrated to the Child Universe that belongs to the Outcome the REP is staked on, you cannot choose the Child Universe like you can with any of your other REP.

It should be noted that each Child Universe of a Fork will have their own version of REP. In other words, a new REP contract is created for each Child Universe that has REP from the Parent Universe’s REP contract migrated to it. Only REP belonging to the Universe is valid REP to use within that Universe. Migrating REP from the Parent Universe to a Child Universe can be thought of as a permanent conversion of Parent Universe REP into Child Universe REP.

After a Fork occurs, a Fork Period begins and lasts for sixty (60) days, during which Reporting is put on hold. Once the Fork Period ends, a Winning Universe will be decided based on which Universe had the most REP migrated to it during the Fork Period. The Winning Universe is the Universe where pending Markets will be migrated to in order to allow them to be resolved by Reporting. Formally pending Markets will immediately reenter the Designated Dispute Phase. The Winning Universe is the only Universe in which Settlement will take place for the Forked Market. Although a Winning Universe is going to emerge from a Fork, the “Losing” Universes created by the Fork aren’t any less valid than the Winning Universe, they are just less likely to see Markets created on them if the far majority of users are using the Winning Universe.

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.
var Augur = require('augur.js');
var augur = new Augur();

var options = {
  httpAddresses: [
    '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.
 */
var password = "thisismysupersecurepassword";

augur.accounts.register(password, function (account) {
  console.log("Account:", account);
});

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

var keystore = account.keystore;

augur.accounts.login(keystore, password, function (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.

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

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

augur.trading.orderBook.getOrderBook({
  _type: _type,
  _market: _market,
  _outcome: _outcome,
  minPrice: minPrice,
  maxPrice: maxPrice,
  _startingOrderId: _startingOrderId,
  _numOrdersToLoad: _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: _type,
  _market: _market,
  _outcome: _outcome,
  minPrice: minPrice,
  maxPrice: maxPrice,
  _startingOrderId: _startingOrderId,
  _numOrdersToLoad: _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: _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'
}

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

augur.markets.batchGetMarketInfo({ marketIDs: 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
/**
* Get the Number of Outcomes for the Market:
* 0x9368ff3e9ce1c0459b309fac6dd4e69229b91a42
*/

var market = "0x9368ff3e9ce1c0459b309fac6dd4e69229b91a42";
var params = { market: market };

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

// asynchronously -- STRONGLY RECOMMENDED --
augur.api.Market.getNumberOfOutcomes(params, function (numOutcomes) {
  console.log(numOutcomes);
});
// console prints 2

// synchronous -- possible but not recommended.
var outcomes = augur.api.Market.getNumberOfOutcomes(params);
// outcomes = 2

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” than 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.

Dispute Bond Token Call API

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

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

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

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

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

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

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

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

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

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

Dispute Bond Token Contract Code

The Dispute Bond Token is used by REP holders to Challenge the Outcome of Markets Awaiting Finalization. The Dispute Bond is only purchasable with REP. Only one Dispute Bond needs to be purchased for a Market per round of Reporting in order for the Market to move to the next state of Reporting in the next upcoming Reporting Window. If a Challenge is successful, which means the Final Outcome of the Market is something other than the Proposed Outcome that was disputed, then the Bond Holder is entitled to up to 2x the Dispute Bond cost in REP. After 2x the cost of the Dispute Bond is paid to the Bond Holder any remaining REP is redistributed as normal to other Reporters who correctly staked on the Final Outcome.

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

This method will returns the balance for a specified disputeBondToken owned by the provided _address. Returns 1 or 0 as you cannot own more than 1 Dispute Bond Token, and only one is required for a Market’s Proposed Outcome to be considered Challenged.

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

This transaction will return the account address of the bond holder for a specified disputeBondToken. This is the person who owns/purchased the bond and would be the person to refund if they correctly Challenged the Proposed Outcome of a Market Awaiting Finalization.

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

This transaction will return the amount of REP, denoted in attotokens, of bond remaining to be paid out for a specified disputeBondToken. Bonds are paid back to the Bond Holder if they correctly Challenged a Proposed Outcome and the Final Outcome for the Market is something different than the Challenged Proposed Outcome. Otherwise, the Bond is paid out to Reporters who confirmed the Proposed Outcome to be the Final Outcome of the Market.

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

This transaction will return the Universe that contained the Market that a specified disputeBondToken belongs to.

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

This transaction will return the Payout Distribution Hash for the dispute payout given a specified disputeBondToken. The Payout Distribution Hash in this case refers the Hash that was the Proposed Outcome but was Challenged by the Dispute Bond.

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

This transaction will return the Market that a specified disputeBondToken belongs to. All Dispute Bond Tokens belong to a Market, and there can only be one Dispute Bond Token per Dispute Phase for that Market.

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

This transaction will return the Reputation Token address used by the Universe that contains Market of the specified disputeBondToken.

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

This transaction will return the total supply of a specified disputeBondToken. This should always return 1 as only 1 Dispute Bond Token can be purchased per Dispute Phase and therefore every Dispute Bond Token is unique.

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

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

Market Call API

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

augur.api.Market.getBestGuessSecondPlaceTentativeWinningPayoutDistributionHash({ market: market }, function (secondPlaceTentativeWinningPayoutDistributionHash) { /* ... */ })
// example output:
secondPlaceTentativeWinningPayoutDistributionHash = "0x20acbb1199c43cb2ca244eb862df2d350300904a96039eb53cbaff012c92d10c"

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

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

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

augur.api.Market.getDesignatedReporter({ market: market }, function (designatedReporter) { /* ... */ })
// example output:
designatedReporter = "0xca3edca4ed326bbcb77e914b379913b12d49654d"

augur.api.Market.getDesignatedReporterDisputeBondToken({ market: market }, function (designatedReporterDisputeBondToken) { /* ... */ })
// example output:
designatedReporterDisputeBondToken = "0xe783e32cfeea2d2be8df1ae6e978e6d4de63fe26"

augur.api.Market.getDesignatedReportPayoutHash({ market: market }, function (designatedReportPayoutHash) { /* ... */ })
// example output:
designatedReportPayoutHash = "0x58aff2018af3cb2ca3a3a1862df2d350300904a96039eb50cb0fd1ac3710aad"

augur.api.Market.getDesignatedReportReceivedTime({ market: market }, function (designatedReportReceivedTime) { /* ... */ })
// example output:
designatedReportReceivedTime = "1500388800";

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

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

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

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

augur.api.Market.getForkingMarket({ market: market }, function (forkedMarket) { /* ... */ })
// example output:
forkedMarket = "0x0"

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

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

augur.api.Market.getNumTicks({ market: market }, function (numTicks) { /* ... */ })
// example output:
numTicks = "1000"

augur.api.Market.getReportingState({ market: market }, function (reportingState) { /* ... */ })
// example output:
reportingState = "0";

augur.api.Market.getStakeToken({ market: market }, function (stakeToken) { /* ... */ })
// example output:
stakeToken = "0x5caa66408617f77601d0dc19c163621e7f4b8b38"

var _payoutDistributionHash = "0x4480ed40f94e2cb2ca244eb862df2d350300904a96039eb53cba0e34b8ace90a";
augur.api.Market.getStakeTokenOrZeroByPayoutDistributionHash({ market: market, _payoutDistributionHash: _payoutDistributionHash }, function (stakeTokenOrZero) { /* ... */ })
// example output:
stakeTokenOrZero = "0x5caa66408617f77601d0dc19c163621e7f4b8b38"

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

augur.api.Market.getRound1ReportersDisputeBondToken({ market: market }, function (round1ReportersDisputeBondToken) { /* ... */ })
// example output:
round1ReportersDisputeBondToken = "0x0151f9153f236359ea3605cef0fffff90aba0327";

augur.api.Market.getRound2ReportersDisputeBondToken({ market: market }, function (round2ReportersDisputeBondToken) { /* ... */ })
// example output:
round2ReportersDisputeBondToken = "0xe5d6eaefcfaf7ea1e17c4768a554d57800699ea4";

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

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

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

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

augur.api.Market.getWinningPayoutDistributionHashFromFork({ market: market }, function (winningPayoutDistributionHashFromFork) { /* ... */ })
// example output:
winningPayoutDistributionHashFromFork = "0xab912273ffce2cb2ca24ce2162df2d342322904a96039eb53cba0e34b8b9fc12"

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

var stakeToken = "0xbb87186146569514b8cd8b72e57eec3849e3981f";
augur.api.Market.isContainerForStakeToken({
  market: market,
  _shadyTarget: stakeToken
}, function (isContainerForStakeToken) { /* ... */ })
// example output:
isContainerForStakeToken = "1"

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

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

Market Contract Code

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

Returns the second best, or second place, tentatively winning Payout Distribution Hash. The Payout Set Reported by a REP holder is converted into a sha3 hash known as the Payout Distribution Hash. This method returns the Payout Set Hash with the 2nd most REP staked on it while the Market is still Awaiting Finalization.

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

Returns the address of the token used to denominate the specified market. A Denomination Token is the ERC20 Token used as the currency to trade on the Outcome of a Market.

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

Returns the timestamp for when a specific market’s Designated Report Phase and Designated Dispute Phase should end. Can be up to 6 days after the Market’s End Time, or as little as 3 days after the End Time, depends on how quickly the Designated Reporter Reports.

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

Returns the timestamp for when a specific market’s Designated Report Phase should be completed but doesn’t count the Designated Dispute Phase. If the Designated Reporter has already submit their Report for the Designated Report Phase, then this will return the timestamp for when that Report was submit to the Market.

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

Returns the address for the Designated Reporter set for the specified market. Every Market is required to have an assigned Designated Reporter, which is set by the Market Creator during Market Creation.

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

Returns the Dispute Bond Token address for the Designated Reporting round for a specified market. When a Designated Report is Challenged a Dispute Bond is created and this function is designed to return that bond address. This returns 0 if the Market doesn’t have a Designated Report or if the Designated Report hasn’t been Challenged.

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

Returns the Payout Distribution Hash of the Payout Set submit by the Designated Reporter for their Report. The Payout Set is used to determine how the Market should Settle for particular Shares after being Finalized.

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

Returns the timestamp of when the Designated Reporter’s Report was submit for the specified market. Each Market is required to have a Designated Reporter who is expected to Report during the Designated Report Phase. This timestamp is used to determine if they actually submit their Report on time, which would be anytime within 3 days of the Market’s End Time.

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

Returns the timestamp for when the specified market’s event has come to pass. When the Market’s End Time passes the Market either enters the Designated Report Phase if a Designated Reporter is assigned or the Market will await the next Reporting Window to begin Reporting Rounds.

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

Returns the timestamp for when the specified market was Finalized. A Finalized Market has a Final Outcome set from successful Market Resolution which cannot be Challenged and the Market is considered Settled.

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

Returns the final Payout Distribution Hash for a specified market. The Final Payout Distribution Hash determines how a Finalized Market payouts out for a specific Share of an Outcome.

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

Returns the Stake Token address for the Final Outcome of a specific market. If the Market isn’t Settled then this will return a null address, 0x0.

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

Returns the Market address of the Forked Market for the Universe that contains the specified market address. If the market address specified belongs in a Universe that hasn’t had a Fork take place, this will return 0x0.

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

Returns the Creator Fee set by the Market Creator, denominated in attotokens per settlement of a Complete Set, for the market.

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

Returns the number of Outcomes for a specified market. The number of outcomes is the number of potential results of the Market.

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

Returns the Number of Ticks set for a specific market. The Number of Ticks represents the number of valid price points between the Market’s Minimum Price and Maximum Price.

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

Returns the staked amount of REP, in attorep, for a specified _payoutDistributionHash of a market. Reporters who stake REP on the same Outcome during the Reporting Phase will have identical Payout Distribution Hashs. This method returns the total amount of staked REP for a specific Payout Distribution Hash. The Hash with the most REP staked on it is considered the Proposed Outcome while the Market is Awaiting Finalization. If the Dispute Phase passes without a Challenge to the Proposed Outcome then the Market is Finalized and the Proposed Outcome becomes the Final Outcome.

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

Returns the current Reporting State that the market is in. This method returns a number between 0 and 12, which corresponds to the various Reporting States outlined in the Reporting Section of the documentation.

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

Returns the Stake Token address for _payoutNumerators on the market specified. When a Reporter submits a Report, they submit a Payout Set (_payoutNumerators) array indicating how the Market should payout. Each Payout Set has a Stake Token associated with it, so if two different Reporters submit the same Payout Set as their Report then they will receive the same Stake Token currency. This method will return the Stake Token associated with a specific Payout Set.

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

Returns a Stake Token address, or 0 if there is no Stake Token for a specific _payoutDistributionHash for a market. Payout Sets that are valid, that is that they sum of the values in the array equal the Number of Ticks for the Market and no individual value in the array is greater than the Number of Ticks, become Payout Distribution Hashes. This method returns the Stake Token given a Payout Distribution Hash, much like getStakeToken returns the Stake Token given a Payout Set.

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

Returns the Reporting Window address for the specified market. This returns the Reporting Window when this Market is scheduled to be Reported on for Reporting Rounds if a Designated Reporter fails to Report or their Report is Challenged.

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

Returns the Dispute Bond Token address for the First Report Round for a specified market. When a First Report Round Report is Challenged a Dispute Bond is created and this function is designed to return that bond address. This returns 0 if the Market doesn’t have a First Round Report or if the First Round Report hasn’t been Challenged.

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

Returns the Last Report Round’s Dispute Bond Token address for the market. If this Market hasn’t gone through a Last Report Round or there was no Challenge to the Proposed Outcome of the Last Report Round then this will return an empty address 0x0.

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

Returns the Share Token’s address for the specified market and _outcome. Every Outcome of a Market has a separate Share Token used to handle trading around that Outcome and this method returns the contract address of the Share Tokens for the specified Outcome.

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

Returns the tentatively winning Payout Distribution Hash given a specified market. The tentatively winning Payout Distribution Hash is the hash with the most REP staked on it prior to Market Finalization. Once the Market Finalized the tentatively winning Payout Distribution Hash becomes the Winning Payout Distribution Hash.

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

Returns the type name for the specified market contract address, will always return “Market” if the market is a Market contract. This is helpful if you need to verify that a contract address is a Market.

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

Returns the Universe address of the Universe that the specified market is contained within. All Markets are created on a specific Universe and new Universes can be created in the event of a Fork.

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

Returns the winning Payout Distribution Hash, which is used to identify the Winning Universe, after a Fork for a given market. The Winning Payout Distribution Hash is also used to determine how the Finalized Market should payout for a specific Outcome when Shares are Settled for that Outcome.

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

Returns wether the specific market is a container for the _shadyTarget address provided. A _shadyTarget address will return true if it is a Designated Report Dispute Bond token, or a Reporting Round Dispute Bond token for this Market. Returns 1 if true, 0 if false.

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

Returns wether the specific market is a container for the _shadyTarget address provided. The _shadyTarget address will return true if the address is a Stake Token that belongs to the Market, otherwise false will be returned. 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. The _shadyTarget address will return true if it’s a Share Token belonging to the Market, otherwise it will return false if the address is not a Share Token belonging to this Market. Returns 1 if true, 0 if false.

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

Returns True or False depending on if the Market passed as market has been Finalized as Invalid. This means the Market is unable to be finalized to a single Final Outcome due to an unclear Market or an indeterminate Outcome. Returns 1 for True in the event that the Market is valid, 0 is False, the Market is invalid.

Stake Token Call API

// Stake Token Contract Call API Examples:
var stakeToken = "0xbb87186146569514b8cd8b72e57eec3849e3981f";
var _owner = "0x438f2aeb8a16745b1cd711e168581ebce744ffaa";
var _spender = "0xfe9d0408be14d1d1ec28671b03bda1b80748977e";

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

augur.api.StakeToken.balanceOf({
  stakeToken: stakeToken,
  _owner: _owner
}, function (balance) { /* ... */ })
// example output:
balance = "200000"

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

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

augur.api.StakeToken.getPayoutNumerator({
  stakeToken: stakeToken,
  index: 0
}, function (payoutSetValue) { /* ... */ })
// example output:
payoutSetValue = "1000"

augur.api.StakeToken.getStakeWindow({ stakeToken: stakeToken }, function (reportingWindow) { /* ... */ })
// example output:
reportingWindow = "0x06cbcd92af2571f1419b622a794d65db524f682a"

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

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

augur.api.StakeToken.getUniverse({ stakeToken: stakeToken }, function (universe) { /* ... */ })
// example output:
universe = "0x0920d1513057572be46580b7ef75d1d01a99a3e5"

augur.api.StakeToken.isValid({ stakeToken: stakeToken }, function (isValid) { /* ... */ })
// example output:
isValid = "1"

augur.api.StakeToken.totalSupply({ stakeToken: stakeToken }, function (totalSupply) { /* ... */ })
// example output:
totalSupply = "210000000000000"

Stake Token Contract Code

The Stake Token is used to represent Staked REP by a Reporter for a specific Report and Market. When a Reporter submits a Report during a Reporting Round for this Market they need to stake REP based on how confident they are in the Report. The REP staked is converted into Stake Tokens. A new type of Stake Token is created for each Payout Set submit by Reporters. Stake Tokens are then redeemed after Finalizing the Market. If your Stake Tokens are the tokens that represent the Winning Payout Set then your Stake Tokens can be redeemed for the amount of REP that was staked as well as a portion of Reporting Fee and REP staked on any other Outcome but the Final Outcome. If your tokens are Staked on any other Outcome they are worthless and the Staked REP is redistributed to people with winning Stake Tokens.

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

Returns the allowance that a specified _spender can spend of the _owner’s stakeTokens. Stake Tokens allow a token owner to designate an spender address to be able to spend the Stake Tokens for the owner. This method returns the amount of Stake Tokens the spender is allowed to spend for the owner.

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

Returns the amount of Stake Tokens owned for the specified stakeToken address and _owner address provided. This is useful in finding out how much REP was Staked for a particular Report by a specific Reporter.

augur.api.StakeToken.getMarket({ stakeToken }[, callback])

This method will return the Market address that the Stake Token belongs too. Every Stake Token belongs to a specific Market in which the Token acts as a 1 to 1 representation of Staked REP for a particular Payout Set representing a Report for the Market.

augur.api.StakeToken.getPayoutDistributionHash({ stakeToken }[, callback])

Returns the Payout Distribution Hash for a specific stakeToken. A Payout Distribution Hash is a sha3 hash of the Payout Set the Stake Token represents. The Payout Distribution Hash is used in other contract methods to identify a particular Payout Set.

augur.api.StakeToken.getPayoutNumerator({ stakeToken, index }[, callback])

Returns the value at the index of the Payout Set represented by this stakeToken. The index is a value between 0 and number of Outcomes for the Market and corresponds to a particular Outcome of the Market. In a Binary Market for example, there are only two Outcomes, so the allowable index values are 0 and 1.

augur.api.StakeToken.getReportingWindow({ stakeToken }[, callback])

Returns the Reporting Window address for the specified stakeToken. All Stake Tokens belong to a specific Market and all Market’s belong to a specific Reporting Window. This method will return the Reporting Window that contains the Market that these Stake Tokens were purchased for.

augur.api.StakeToken.getReputationToken({ stakeToken }[, callback])

As mentioned above, a Stake Token belongs to a Market which in turn belongs to a Reporting Window. Reporting Windows only interact with a single REP contract, and this method will return the contract address of valid REP for this Reporting Window and by extension these Stake Tokens. Stake Tokens can only be purchased with REP that belongs to the Reporting Window the tokens are ultimately contained within.

augur.api.StakeToken.getTypeName({ stakeToken }[, callback])

Returns the type name for the specified stakeToken, should will return “StakeToken” if the stakeToken address provided belongs to a Stake Token contract.

augur.api.StakeToken.getUniverse({ stakeToken }[, callback])

Returns the Universe address for the specified stakeToken’s Reporting Window. Everything in Augur belongs to a Universe, and Stake Tokens are no different. New Universes are created in the event of a Fork, so this method provides an API user the ability to find out which Universe the Stake Token is currently in.

augur.api.StakeToken.isValid({ stakeToken }[, callback])

This method is used as a way to check if the stakeToken represents a Payout Set that indicates the Market is Invalid. This isn’t to say that the Stake Token, the Report, or the Payout Set is invalid, but rather the Outcome of the Market is unclear based on how the Market is worded or the result of Market doesn’t correspond to any of the Outcomes set for the Market.

augur.api.StakeToken.totalSupply({ stakeToken }[, callback])

Returns the current total supply of the specified stakeToken. This is used to see how many Stake Tokens have been purchased for a specific Payout Set. This is used to see how much REP is staked on a particular Payout Set since Stake Tokens are a 1:1 ratio to REP staked.

Reporting Window Call API

// Reporting Window Contract Call API Examples:
var reportingWindow = "0x06cbcd92af2571f1419b622a794d65db524f682a";
var _market = "0x9368ff3e9ce1c0459b309fac6dd4e69229b91a42";
var _reporter = "0x2cd999e2f90dfc237ccbc52e2a469e1e11221f75";

augur.api.ReportingWindow.getAvgReportingGasPrice({ reportingWindow: reportingWindow }, function (avgReportingGasPrice) { /* ... */ })
// example output:
avgReportingGasPrice = "340000"

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

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

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

augur.api.ReportingWindow.getMarketsCount({ reportingWindow: reportingWindow }, function (marketsCount) { /* ... */ })
// example output:
marketsCount = "65"

augur.api.ReportingWindow.getNextReportingWindow({ reportingWindow: reportingWindow }, function (nextReportingWindow) { /* ... */ })
// example output:
nextReportingWindow = "0x0d6b5a54f940bf3d52e438cab785981aaefdf40c"

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

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

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

augur.api.ReportingWindow.getNumMarkets({ reportingWindow: reportingWindow }, function (numMarkets) { /* ... */ })
// example output:
numMarkets = "65"

augur.api.ReportingWindow.getPreviousReportingWindow({ reportingWindow: reportingWindow }, function () { /* ... */ })
// example output:
= "0x3d1db1cac3153879b1c190aeb9bb7292f09ad83e"

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

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

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

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

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

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

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

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

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

augur.api.ReportingWindow.isForkingMarketFinalized({ reportingWindow: reportingWindow }, function (isForkingMarketFinalized) { /* ... */ })
// example output:
isForkingMarketFinalized = "0";

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

Reporting Window Contract Code

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

Returns the average amount of Gas spent per Report submit during the Reporting Window.

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

Every Reporting Window consists of two phases, the Reporting Phase and the Dispute Phase. This method is used to return the timestamp for the end of the Reporting Window’s Dispute Phase.

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

As stated above, Reporting Windows have two phases, the Reporting Phase and Dispute Phase and this method returns the timestamp of the start of the Dispute Phase.

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

Returns a timestamp for when this Reporting Window will end. A Reporting Window is considered active for a total of 30 days, then ends, and is no longer considered to be active.

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

Returns the total number of Markets that belong to the Reporting Window. This includes Reporting Round Markets.

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

Returns the next Reporting Window’s Contract Address. Reporting Windows last 30 days and continually occur, one after the other. Only one Reporting Window can be active at a time in a Universe, and every Reporting Window belongs to a Universe.

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

Returns the number of Markets belonging to this Reporting Window in which Designated Reporter’s Proposed Outcome was Challenged during the Designated Dispute Phase. This is only the count of Markets where Designated Reporters did Report during the Designated Report Phase but the Market didn’t get Finalized. This doesn’t include Markets where the Designated Reporter failed to submit a Report.

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

Returns the number of Markets belonging to this Reporting Window in which the Designated Reporter failed to Report during the Designated Report Phase. These Markets will have First Report Bonds up for grabs for the First Reporter because these Markets have yet to receive a Report. This only includes Markets where Designated Reporters failed to Report, and does not include Markets where the Designated Reporter’s Proposed Outcome was Challenged.

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

Returns the number of Markets that were Reported to be Invalid during a Reporting Window. Invalid Markets are Markets that aren’t clearly defined or doesn’t fit one of the Outcomes set for this Market. Reporters are encouraged to Report the Market as Invalid if they can’t confidently stake their REP into a single Outcome for the Market.

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

Returns the total number of Markets that belong to the Reporting Window. This includes Reporting Round Markets.

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

Returns the previous Reporting Window’s Contract Address. Reporting Windows last 30 days and continually occur, one after the other. Only one Reporting Window can be active at a time in a Universe, and every Reporting Window belongs to a Universe.

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

Returns a timestamp of when the Reporting Phase of a specific Reporting Window will be ending. Reporting Windows are 30 days long and split into two Phases, the Reporting Phase and the Dispute Phase. The Reporting Phase lasts 27 days, the Dispute Phase lasts 3 days.

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

Returns a timestamp of when the Reporting Phase of a specific Reporting Window will be starting. Reporting Windows are 30 days long and split into two Phases, the Reporting Phase and the Dispute Phase. The Reporting Phase lasts 27 days, the Dispute Phase lasts 3 days.

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

Returns the Reputation Token (REP) address for the specified Reporting Window. Every Reporting Window has a Reporting Phase where Reporters submit Reports on the Outcomes of Markets. In order to Report, Reporters need to stake REP. A Reporting Window only accepts one REP contract as the source of staked REP and this method returns that contract’s address.

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

Returns a timestamp of when a Reporting Window becomes active and starts. A Reporting Window is considered active for a total of 30 days, then ends, and is no longer considered to be active. Only active Reporting Windows allow Reporters to Report on the Outcomes of the Markets contained in the Reporting Window.

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

Returns the type name for the reportingWindow address provided. If the address is a Reporting Window contract, this will return “ReportingWindow”.

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

Returns the Universe address that the Reporting Window belongs to. Every Reporting Window belongs to a specific Universe in which they were created and operate within.

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

This method returns wether the Reporting Window is currently active or not. Reporting Windows are considered active during the Window’s Reporting Phase and Dispute Phase, which last a total of 30 days. Returns 1 if the reportingWindow is active, 0 if not.

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

Returns wether the _shadyMarket address provided is a Market that is set to be Reported on during the Reporting Window. Markets are assigned a Reporting Window that is the first Reporting Window following the Market’s End Time. Returns 1 if the Market belongs to the reportingWindow, 0 if not.

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

Returns wether the Reporting Window is currently in it’s Dispute Phase or not. The Dispute Phase is a 3 day long period that follows the Reporting Window’s Reporting Phase, which lasts 27 days. Returns 1 if the Reporting Window’s Dispute Phase is active, 0 if not.

augur.api.ReportingWindow.isForkingMarketFinalized({ reportingwindow }[, callback])

Returns wether the Forked Market that caused this Reporting Window’s Universe to be created has been Finalized or not. Every Reporting Window belongs to a Universe and all Universes, except for the first Universe, are created because of a Fork. Returns 1 if the Forked Market is Finalized, 0 it not.

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

Returns wether the Reporting Window is currently in it’s Reporting Phase or not. The Reporting Phase lasts 27 days at the start of a Reporting Window and is followed by a 3 day Dispute Phase. Returns 1 if the Reporting Window’s Reporting Phase is active, 0 if not.

Reputation Token Call API

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

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

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

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

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

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

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

Reputation Token Contract Code

The Reputation Token, known as REP, is the key that allows Augur’s Decentralized Oracle System to function, and by extension the entirety of Augur. REP has three major functions, it’s used to Report on the Outcome of a Market, Challenge the Proposed Outcome of a Market, and as a bond when creating a Market. Reporters stake REP on the Outcome of a Market as a show of confidence in their Report. If the Reporter correctly staked on the Final Outcome of the Market they can claim their REP back, earn Reporting Fees proportional to their staked REP, and a portion of the REP incorrectly staked on other Outcomes.

REP is also used to Challenge the Proposed Outcome of Reports during the Designated Dispute Phase or the Dispute Phase. If the Challenge successfully changes the Proposed Outcome of a Market and that outcome becomes the Final Outcome, the Dispute Bond holder can redeem the bond for up to double the REP it cost to place. When creating a Market, the Market Creator is required to specify a Designated Reporter and pay a First Report REP Bond to ensure the Designated Reporter shows up. If the Reporter doesn’t show up, the Market Creators First Report REP Bond will go to the First Reporter to Report on the Market. Their GAS cost for the Report transaction will be covered by the Market Creator’s First Report GAS Bond and the First Report REP Bond is added to whatever the First Reporter staked, there by improving her stake and potential rewards if correctly staked.

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

Returns the allowance that a specified _spender can spend of the _owner’s REP. REP holders can designate a spender address to be able to take actions with REP on behalf of the owner. This method returns the amount of REP the spender is allowed to use. In order to designate a spender address and the amount of REP they are allowed to act with, see the approve method in the REP Transaction API section.

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

Returns the REP balance of the specified reputationToken address owned by the _owner address provided. This is the method to use to check how much REP a particular address controls.

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

Returns the Universe address for the REP address provided. All of Augur’s information belongs to a Universe and each Universe has it’s own REP contract. New Universes are created in the event of a Fork.

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

As mentioned in the previous method description, all of Augur’s Universes have their own REP contract, specific to that Universe. In the event of a Fork occurring, REP holders are expected to migrate their REP to one of the newly created Child Universes. The Child Universe with the most REP migrated to it at the end of the 60 day Fork Period will be the only Universe that allows for Settlement on the Forked Market and will be the Universe that all pending Markets will migrate to for Reporting. What this method does is returns the Universe address of the currently “winning” migration destination. In other words, this returns the Universe with the most REP migrated to it so far.

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

Returns the total supply of REP for a particular REP contract address. This number is going to return 11 million on the original Augur Universe. If a Fork ever occurs, each Child Universe could potentially have some portion of REP migrated to it. This method is how to find the total amount of REP contained within a specific Universe, given that Universe’s REP address.

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

Returns the type name for a specified reputationToken. If the reputationToken address provided is actually a legitimate REP contract, this will return “ReputationToken”. This is used to confirm that the address is a Reputation Token Contract.

Orders Call API

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

augur.api.Orders.isWorsePrice({
  _type: _type,
  _fxpPrice: _fxpPrice,
  _orderId: _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:
var _orderId = "0x7ca90ca9118db456d87e3d743b97782a857200b55039f7ffe8de94e5d920f870";
var _type = "1";
var _market = "0x9368ff3e9ce1c0459b309fac6dd4e69229b91a42";
var _outcome = "1";
var _fxpPrice = "450000000000000000"; // 0.45

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

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

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

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

augur.api.OrdersFetcher.getOrderIds({
  _type: _type,
  _market: _market,
  _outcome: _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:
var shareToken = "0x18b17188ce3c491f6ab4427258d92452be5c8054";
var _owner = "0x438f2aeb8a16745b1cd711e168581ebce744ffaa";
var _spender = "0xfe9d0408be14d1d1ec28671b03bda1b80748977e";

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

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

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

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

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

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

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

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

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

augur.api.ShareToken.getTypeName({ shareToken: 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”.

Universe Call API

// Universe Contract Call API Examples:
var universe = "0x0920d1513057572be46580b7ef75d1d01a99a3e5";
var _parentPayoutDistributionHash = "0x4480ed40f94e2cb2ca244eb862df2d350300904a96039eb53cba0e34b8ace90a";

augur.api.Universe.getChildUniverse({
  universe: universe,
  _parentPayoutDistributionHash: _parentPayoutDistributionHash
}, function (childUniverse) { /* ... */ })
// example output:
childUniverse = "0xb4e8c1f85c4382d64954aca187f9f386c8bb1a6c"

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

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

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

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

augur.api.Universe.getParentUniverse({ universe: universe }, function (parentUniverse) { /* ... */ })
// example output:
parentUniverse = "0x63c59544b89cce1dd53b1b566862189b25adec41"

augur.api.Universe.getParentPayoutDistributionHash({ universe: universe }, function (universeParentPayoutDistributionHash) { /* ... */ })
// example output:
universeParentPayoutDistributionHash = "0xa310ca2018af3cb2ca244eb862df2d350300904a96039eb53cbaff012c92d10c"

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

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

augur.api.Universe.getReportingWindow({ universe: universe, _reportingWindowId: 579 }, function (reportingWindow) { /* ... */ })
// example output:
reportingWindow = "0x1f90cc6b4e89303e451c9b852827b5791667f570";

var _endTime = 2524608000;
augur.api.Universe.getReportingWindowByMarketEndTime({
  universe: universe,
  _endTime: _endTime,
  _hasDesignatedReporter: 0
}, function (reportingWindowByEndTime) { /* ... */ })
// example output:
reportingWindowByEndTime = "0x06cbcd92af2571f1419b622a794d65db524f682a";

augur.api.Universe.getReportingWindowByTimestamp({
  universe: universe,
  _timestamp: _endTime
}, function (reportingWindowByTimestamp) { /* ... */ })
// example output:
reportingWindowByTimestamp = "0x06cbcd92af2571f1419b622a794d65db524f682a";

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

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

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

var market = "0x9368ff3e9ce1c0459b309fac6dd4e69229b91a42";
augur.api.Universe.isContainerForMarket({
  universe: universe,
  _shadyTarget: market
}, function (isContainerForMarket) { /* ... */ })
// example output:
isContainerForMarket = "1";

var stakeToken = "0x2a73cec0b62fcb8c3120bc80bdb2b1351c8c2d1e";
augur.api.Universe.isContainerForStakeToken({
  universe: universe,
  _shadyTarget: stakeToken
}, function (isContainerForStakeToken) { /* ... */ })
// example output:
isContainerForStakeToken = "1";

var reportingWindow = "578";
augur.api.Universe.isContainerForReportingWindow({
  universe: universe,
  _shadyTarget: reportingWindow
}, function (isContainerForReportingWindow) { /* ... */ })
// example output:
isContainerForReportingWindow = "1";

var childUniverse = "0xb4e8c1f85c4382d64954aca187f9f386c8bb1a6c";
augur.api.Universe.isParentOf({
  universe: universe,
  _shadyChild: childUniverse
}, function (isParentOf) { /* ... */ })
// example output:
isParentOf = "1";

Universe Contract Code

The Universe Contract is the contract that defines an Augur Universe and the methods used to interact with them. All of Augur’s Markets, Order Books, Reporting Windows, and REP belong to a specific Universe. In the rare event that an Last Report Round Market’s Proposed Outcome is Challenged during the Dispute Phase of a Reporting Window then a Fork will occur and new Universes will be created. The Universe that originally contained the Forked Market will become a Locked Universe, thereby not allowing any Market creation to take place in the Locked Universe. The newly created Universes are known as Child Universes, where as the original and now Locked Universe is considered those Child Universes’ Parent Universe.

augur.api.Universe.getChildUniverse({ universe, _parentPayoutDistributionHash }[, callback])

Returns the Child Universe address for this universe address who’s Forked Market’s Final Outcome is the _parentPayoutDistributionHash Payout Distribution Hash provided.

augur.api.Universe.getCurrentReportingWindow({ universe }[, callback])

Returns the current running Reporting Window’s Id belonging to the universe specified. Every Universe has Reporting Windows that are continually run for a duration of 30 days before immediately starting the next Window.

augur.api.Universe.getForkEndTime({ universe }[, callback])

Returns the timestamp for when the Fork Period ends that was started on the universe specified.

augur.api.Universe.getForkingMarket({ universe }[, callback])

Returns the contract address of the Market that the specified universe is Forking over. This returns 0 if the Universe has never forked and there is no Forked Market.

augur.api.Universe.getNextReportingWindow({ universe }[, callback])

Returns the next Reporting Window Id coming up after the current Reporting Window ends in a specific universe.

augur.api.Universe.getParentUniverse({ universe }[, callback])

Returns the Parent Universe address of the specified universe. When a Fork occurs, Child Universes are created and the original Universe that contained the Forking Market would become a Parent Universe to the newly created Universes. If this is called on the very first Augur Universe then it will return 0, as the first Universe had no Parent Universe.

augur.api.Universe.getParentPayoutDistributionHash({ universe }[, callback])

Returns the Parent Universes’s Payout Distribution Hash given the universe address of a Child Universe. The Payout Distrubution Hash is a hash of the Disputed Outcome of the Forked Market.

augur.api.Universe.getPreviousReportingWindow({ universe }[, callback])

Returns the previous Reporting Window Id to the current Reporting Window for the specified universe.

augur.api.Universe.getReportingPeriodDurationInSeconds({ universe }[, callback])

Returns the specified universe’s Reporting Window full duration in seconds, also known as the Reporting Period. This includes both the Reporting Phase and Dispute Phase of the Reporting Window. The Reporting Phase should last 27 days followed by a 3 day Dispute Phase which makes the Reporting Period Duration a total of 30 days, or 2,592,000 seconds.

augur.api.Universe.getReportingWindow({ universe, _reportingWindowId }[, callback])

Returns the Reporting Window Contract Address belonging to this universe that matches the _reportingWindowId passed to the function.

augur.api.Universe.getReportingWindowByMarketEndTime({ universe, _endTime, _hasDesignatedReporter }[, callback])

Returns the Reporting Window address on the specific universe given an _endTime and if the Market we are checking for has an Designated Reporter or not (_hasDesignatedReporter). _hasDesignatedReporter should be 0 for Markets without an Designated Reporter, 1 for Markets with an Designated Reporter.

augur.api.Universe.getReportingWindowByTimestamp({ universe, _timestamp }[, callback])

Returns the Reporting Window Contract Address for a specific universe and provided _timestamp.

augur.api.Universe.getReportingWindowId({ universe, _timestamp }[, callback])

Returns the Reporting Window Id for a specific universe and provided _timestamp. This is calculated by dividing the timestamp by the Universes’ Reporting Window duration in seconds.

augur.api.Universe.getReputationToken({ universe }[, callback])

Returns the Reputation Token Address for a specific universe. This is the REP usable within this Universe.

augur.api.Universe.getTypeName({ universe }[, callback])

Returns the specified universe’s type name, which should always return “Universe”.

augur.api.Universe.isContainerForMarket({ universe, _shadyTarget }[, callback])

Returns wether the specific universe is a container for the Market _shadyTarget address provided. Returns 1 if true, 0 if false. All Markets are created within a Universe, and this function is used to help confirm if a Market is actually attached to the Universe in question.

augur.api.Universe.isContainerForStakeToken({ universe, _shadyTarget }[, callback])

Returns wether the specific universe is a container for the Reporting Token _shadyTarget address provided. Returns 1 if true, 0 if false. Stake Tokens are 1:1 exchangeable for REP by Reporters to represent their staked REP for a Report. This method is designed determine wether the Universe contains the Stake Token specified.

augur.api.Universe.isContainerForReportingWindow({ universe, _shadyTarget }[, callback])

Returns wether the specific universe is a container for the Reporting Window _shadyTarget Contract Address provided. Returns 1 if true, 0 if false. Every Reporting Window belongs to a Universe and this method is used to see if a specific Reporting Window Address belongs to the Universe in question.

augur.api.Universe.isParentOf({ universe, _shadyChild }[, callback])

Returns wether the specific universe is a container for the _shadyChild Child Universe Address provided. Returns 1 if true, 0 if false. If you want to see if a specific Universe is the Parent Universe to a Child Universe you would use this function to determine that.

Transaction API

// Transaction API (Tx API for short) example:
var privateKey = <Buffer ...>;
var reputationTokenAddress = "0x2a73cec0b62fcb8c3120bc80bdb2b1351c8c2d1e";
var transferTarget = "0xea674fdde714fd979de3edf0f56aa9716b898ec8";
var 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: function (result) { console.log(result) },
  onSuccess: function (result) { console.log(result) },
  onFailed: function (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 ReputationToken Contract)
var payload = {
  to: "0x2a73cec0b62fcb8c3120bc80bdb2b1351c8c2d1e",
  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
var onSent = function (sentResponse) { console.log("transaction sent:", sentResponse); };

// onSuccess callback fires
var onSuccess = function (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
var onFailed = function (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.
var 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: '0x2a73cec0b62fcb8c3120bc80bdb2b1351c8c2d1e',
  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 its 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
var privateKey = <Buffer ...>;
var disputeBondToken = "0xe5d6eaefcfaf7ea1e17c4768a554d57800699ea4";
var _destinationAddress = "0xaa895acf2091752393384b902f813da761ca421f";

augur.api.DisputeBondToken.transfer({
  _signer: privateKey,
  disputeBondToken: disputeBondToken,
  _destinationAddress: _destinationAddress,
  _attotokens: 1,
  onSent: function (result) { console.log(result) },
  onSuccess: function (result) { console.log(result) },
  onFailed: function (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: disputeBondToken,
  onSent: function (result) { console.log(result) },
  onSuccess: function (result) { console.log(result) },
  onFailed: function (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"
}

var _shadyUniverse = "0x580f633f475614636ee132a0a355dcdc826d16c8";
augur.api.DisputeBondToken.withdrawToUniverse({
  _signer: privateKey,
  disputeBondToken: disputeBondToken,
  _shadyUniverse: _shadyUniverse,
  onSent: function (result) { console.log(result) },
  onSuccess: function (result) { console.log(result) },
  onFailed: function (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

The Dispute Bond Token is used by REP holders to Challenge the Outcome of Markets Awaiting Finalization. The Dispute Bond is only purchasable with REP. Only one Dispute Bond needs to be purchased for a Market per round of Reporting in order for the Market to move to the next state of Reporting in the next upcoming Reporting Window. If a Challenge is successful, which means the Final Outcome of the Market is something other than the Proposed Outcome that was disputed, then the Bond Holder is entitled to up to 2x the Dispute Bond cost in REP. After 2x the cost of the Dispute Bond is paid to the Bond Holder any remaining REP is redistributed as normal to other Reporters who correctly staked on the Final Outcome.

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 is used to transfer ownership of a Dispute Bond Token from one address to another. 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), the to address (_destinationAddress), and the _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 Challenging the Proposed Outcome of the disputeBondToken’s Market. This transaction will fail 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 the disputeBondToken’s Market isn’t Finalized.

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

This transaction is used by the bond holder of the specified disputeBondToken to withdraw Reputation Tokens earned by correctly Challenging the Proposed Outcome of the disputeBondToken’s Market. This transaction will fail to payout if the msg.sender isn’t the bond holder for the specified disputeBondToken, if the _shadyUniverse isn’t the Child Universe of the Universe containing this disputeBondToken, if the Payout Distribution Hash for the Parent Universe of shadyUniverse is the same Distribution Hash Challenged by the disputeBondToken.

Market Tx API

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

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

augur.api.Market.derivePayoutDistributionHash({
  _signer: privateKey,
  market: market,
  _payoutNumerators: _payoutNumerators,
  onSent: function (result) { console.log(result) },
  onSuccess: function (result) { console.log(result) },
  onFailed: function (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: "0x4c92c4b38832d970d090b6403905de4ec2d1ae0adf4ca4972343c27fa86f7c61ea62e250",
  nonce: "0x4",
  timestamp: 1501003134,
  to: "0x9368ff3e9ce1c0459b309fac6dd4e69229b91a42",
  value: "0x0"
}

augur.api.Market.designatedReport({
  _signer: privateKey,
  market: market,
  _payoutNumerators: _payoutNumerators,
  onSent: function (result) { console.log(result) },
  onSuccess: function (result) { console.log(result) },
  onFailed: function (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.disavowTokens({
  _signer: privateKey,
  market: market,
  onSent: function (result) { console.log(result) },
  onSuccess: function (result) { console.log(result) },
  onFailed: function (result) { console.log(result) }
})
// example output:
successResponse = {
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320490,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0x0193add7b8dc3868944cb8b7748ab53cec5a2d9f5041f882b04b0bf0a31e1ff2",
  input: "0xf12afe02",
  nonce: "0x5",
  timestamp: 1501003135,
  to: "0x9368ff3e9ce1c0459b309fac6dd4e69229b91a42",
  value: "0x0"
}

augur.api.Market.disputeDesignatedReport({
  _signer: privateKey,
  market: market,
  onSent: function (result) { console.log(result) },
  onSuccess: function (result) { console.log(result) },
  onFailed: function (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.disputeRound1Reporters({
  _signer: privateKey,
  market: market,
  onSent: function (result) { console.log(result) },
  onSuccess: function (result) { console.log(result) },
  onFailed: function (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.disputeRound2Reporters({
  _signer: privateKey,
  market: market,
  onSent: function (result) { console.log(result) },
  onSuccess: function (result) { console.log(result) },
  onFailed: function (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.migrateDueToNoReports({
  _signer: privateKey,
  market: market,
  onSent: function (result) { console.log(result) },
  onSuccess: function (result) { console.log(result) },
  onFailed: function (result) { console.log(result) }
})
// example output:
successResponse = {
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320491,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0x76acc0f6322ec26e9623158f0b377777b8c7c3e4b4e700de08b39cf8accc39e5",
  input: "0x2c10270f",
  nonce: "0x7",
  timestamp: 1501003137,
  to: "0x9368ff3e9ce1c0459b309fac6dd4e69229b91a42",
  value: "0x0"
}

augur.api.Market.migrateThroughAllForks({
  _signer: privateKey,
  market: market,
  onSent: function (result) { console.log(result) },
  onSuccess: function (result) { console.log(result) },
  onFailed: function (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: market,
  onSent: function (result) { console.log(result) },
  onSuccess: function (result) { console.log(result) },
  onFailed: function (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: market,
  onSent: function (result) { console.log(result) },
  onSuccess: function (result) { console.log(result) },
  onFailed: function (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"
}

var _payoutDistributionHash = "0x4480ed40f94e2cb2ca244eb862df2d350300904a96039eb53cba0e34b8ace90a";
augur.api.Market.updateTentativeWinningPayoutDistributionHash({
  _signer: privateKey,
  market: market,
  _payoutDistributionHash: _payoutDistributionHash,
  onSent: function (result) { console.log(result) },
  onSuccess: function (result) { console.log(result) },
  onFailed: function (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.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.derivePayoutDistributionHash({ _signer, market, _payoutNumerators, onSent, onSuccess, onFailed })

Returns the Payout Distribution Hash for the _payoutNumerators passed in. If the Payout Sets, referred to as Payout Numerator in the function, is valid, then a Payout Distribution Hash is created by hashing the Payout Sets using sha3.

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

This transaction is used by the Designated Reporter for a specified market to Report, by submitting _payoutNumerators (Payout Sets) that indicate how the Market should Payout. This transaction will fail if the msg.sender isn’t the Designated Reporter Address set for this Market, or if this Market isn’t in the Designated Report Phase.

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

This transaction is used to disavow Stake Tokens for this Market. When a Stake Token is disavowed it is able to be redeemed from the Market for the full REP price of purchase. This is used in the event of a Fork, which causes all Markets that aren’t Finalized to enter an Awaiting Fork Migration state for the duration of the Fork Period. During this time, the Market is unable to proceed through the Market Resolution process until the Fork Period is completed and a winning Child Universe is known. To withdraw REP from the Staked Tokens on Markets Awaiting Fork Migration the Stake Tokens must be disavowed by calling disavowTokens on the Market. The Stake Tokens are then disavowed for the entire Market and can be sold back to the Market for full REP price. This then allows the REP holder to migrate their REP to their chosen Child Universe.

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

This transaction is used to Challenge the Proposed Outcome of a Market that was Reported on by a Designated Reporter and is currently in the Designated Dispute Phase. The msg.sender of this transaction must have REP to pay for the Dispute Bond. This transaction will cause the Market to go to the first available Reporting Window and enter the First Report Round.

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

This transaction will Challenge the Proposed Outcome of a First Report Round Market if the Market is currently in the Dispute Phase and is Awaiting Finalization. The msg.sender needs to have enough REP to purchase the Dispute Bond in order for this transaction to be successful. Successfully triggering this transaction will move the Market into the next available Reporting Window for the next Reporting Round.

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

disputeRound2Reporters is used to Challenge the Proposed Outcome of a Market that has gone through the Last Report Round and is Awaiting Finalization in a Dispute Phase. This method purchases a Dispute Bond for the msg.sender, who must pay for the Bond using REP. Sending this transaction will cause a Fork, since this is used to dispute the Last Report Round Proposed Outcome for the Market, which will cause the creation of new Universes and cause the current Universe to be Locked.

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

This function is called to move a Market to the next Reporting Window if no Reports were submitted for the Market during a Reporting Phase. If a Market is in the First Report Round and doesn’t receive any Reports, it’s moved to the next coming Reporting Window to be Reported on again, however it remains in the First Report Round, however this will be rare as the First Report is incentivized.

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

This transaction will call migrateThroughOneFork repeatedly until the Market has migrated through all of the Forks or has reached an active Fork which will throw. See the migrateThroughOneFork function for a better explanation of what is going on here (the next method).

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

This transaction attempts to migrate the Market into a winning Child Universe from a Forked Parent Universe. When a Fork occurs, there is a 60 day long Fork Period that occurs where in REP holders migrate their REP to the Universe they want to continue in. Once the Fork Period ends, the Child Universe with the most REP migrated to it will be declared the Winning Universe. Calling migrateThroughOneFork attempts to move the Market from a Parent Universe to the Winning Universe after it’s been decided. This method will throw if the Fork Period isn’t over, so there is no Winning Universe to migrate to yet. This will return 1 if the market was successfully migrated and return 0 if no migration was required.

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

This transaction will attempt to finalize a Market that is Awaiting Finalization. If the Market isn’t Awaiting Finalization then this will fail and return 0. If the Market is Awaiting Finalization and can be finalized then this function will return 1 to indicate that the Market is now finalized and the Proposed Outcome is now the Final Outcome. Further the Tentatively Winning Payout Distribution Hash will become the Winning Payout Distribution Hash.

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

This method is used to potentially update the Tentatively Winning Payout Distribution Hash. The Tentatively Winning Payout Distribution Hash is the Payout Distribution Hash with the most REP staked on it so far by Reporters. If the Market is successfully Finalized the Tentatively Winning Payout Distribution Hash becomes the Winning Payout Distribution Hash and determines how various Shares of Outcomes will payout during Settlement. This transaction will not change the Tentative Winning Payout Distribution Hash if the _payoutDistributionHash submitted to it doesn’t have enough REP stakes to overtake the current Tentatively Winning Payout Distribution Hash. Returns 1 regardless of if the Tentatively Winning Distribution Hash was changed or not.

Stake Token Tx API

// Stake Token Contract Transaction API Examples:
var privateKey = <Buffer ...>;
var stakeToken = "0xbb87186146569514b8cd8b72e57eec3849e3981f";
var _spender = "0xfe9d0408be14d1d1ec28671b03bda1b80748977e";
var _attotokens = "100000000000000000000";

augur.api.StakeToken.approve({
  _signer: privateKey,
  stakeToken: stakeToken,
  _spender: _spender,
  _value: _attotokens,
  onSent: function (result) { console.log(result) },
  onSuccess: function (result) { console.log(result) },
  onFailed: function (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.StakeToken.buy({
  _signer: privateKey,
  stakeToken: stakeToken,
  _attotokens: _attotokens,
  onSent: function (result) { console.log(result) },
  onSuccess: function (result) { console.log(result) },
  onFailed: function (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.StakeToken.migrateLosingTokens({
  _signer: privateKey,
  stakeToken: stakeToken,
  onSent: function (result) { console.log(result) },
  onSuccess: function (result) { console.log(result) },
  onFailed: function (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.StakeToken.redeemDisavowedTokens({
  _signer: privateKey,
  stakeToken: stakeToken,
  _reporter: _spender,
  onSent: function (result) { console.log(result) },
  onSuccess: function (result) { console.log(result) },
  onFailed: function (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.StakeToken.redeemForkedTokens({
  _signer: privateKey,
  stakeToken: stakeToken,
  onSent: function (result) { console.log(result) },
  onSuccess: function (result) { console.log(result) },
  onFailed: function (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.StakeToken.redeemWinningTokens({
  _signer: privateKey,
  stakeToken: stakeToken,
  onSent: function (result) { console.log(result) },
  onSuccess: function (result) { console.log(result) },
  onFailed: function (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.StakeToken.transfer({
  _signer: privateKey,
  stakeToken: stakeToken,
  _to: _spender,
  _value: _attotokens,
  onSent: function (result) { console.log(result) },
  onSuccess: function (result) { console.log(result) },
  onFailed: function (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"
}

var _from = "0x34c85afe56c392e240c64dc09d2a7962afe2920a";
augur.api.StakeToken.transferFrom({
  _signer: privateKey,
  stakeToken: stakeToken,
  _from: _from,
  _to: _spender,
  _value: _attotokens,
  onSent: function (result) { console.log(result) },
  onSuccess: function (result) { console.log(result) },
  onFailed: function (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"
}

Stake Token Contract Code

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

Allows the _spender the ability to spend up to _value worth of the specified stakeToken for the msg.sender. This transaction is used to allow another person to perform actions with your Stake Tokens on your behalf. This transaction will spawn an Approval event which will record a log of the owner’s address (msg.sender), _spender address, and _value amount approved.

augur.api.StakeToken.buy({ _signer, stakeToken, _attotokens, onSent, onSuccess, onFailed })

This transaction is used to purchase Stake Tokens using REP. The Stake Token’s Market must be in an Reporting Round and Stake Tokens can only be purchased during the Reporting Phase of a Reporting Window. Stake Tokens have a 1:1 ratio to REP, which means 100 attoREP is equal to 100 attoStakeTokens, so the msg.sender also needs to have at least _attotokens worth of REP to complete this transaction. This transaction will spawn a Transfer event which will record a log of the from address (msg.sender), to address (stakeToken), and the amount of _attotokens purchased.

augur.api.StakeToken.migrateLosingTokens({ _signer, stakeToken, onSent, onSuccess, onFailed })

This transaction should be called, though it’s not required, once on each Stake Token that isn’t the Winning Stake Token once a Market has Finalized. This method will migrate the REP used to purchase the non-winning Stake Token to the Winning Stake Token so the REP can be redistributed to the Reporters who correctly staked REP on the Winning Payout Set. If this isn’t called, then whatever REP is staked into this Stake Token will remain staked into the Stake Token indefinitely. This function will fail to migrate REP to the winning Stake Token if the Market isn’t finalized, the Market caused a Fork, or if This Stake Token represents the Winning Payout Set and is therefor not a losing token.

augur.api.StakeToken.redeemDisavowedTokens({ _signer, stakeToken, _reporter, onSent, onSuccess, onFailed })

In the event of a Fork, all Markets, except for the Forked Market, that haven’t been Finalized are placed into a pending state until the Fork Period concludes and the Fork is Resolved. During this time, any Stake Tokens purchased for these pending Markets are considered to be “Disavowed” and are able to be refunded for REP back into the Parent Universe using this transaction. This is an important tool because REP holders are expected to Migrate their REP to a Child Universe and they need to be able to reclaim their REP to do so. Once the Fork is resolved, all pending markets immediately start Designated Dispute Phase. This will fail if the Stake Token hasn’t been Disavowed, or if this is used on a Stake Token belonging to the Forked Market. This transaction will spawn a Transfer event which will record the from address (stakeToken), to address (_reporter), and the amount of REP transferred.

augur.api.StakeToken.redeemForkedTokens({ _signer, stakeToken, onSent, onSuccess, onFailed })

This transaction is used to migrate REP that is in a Forked Market. Unlike redeemDisavowedTokens, which only works on Disavowed Markets and withdraws the REP to the Parent Universe, this transaction only works on the Forked Market and the REP is withdrawn to the Child Universe corresponding to the Stake Token’s Payout Set. This transaction will spawn a Transfer event which will record a log of the from address (the Child Universe’s REP contract), to address (msg.sender), and the amount of REP transferred.

augur.api.StakeToken.redeemWinningTokens({ _signer, stakeToken, onSent, onSuccess, onFailed })

This transaction is used to redeem REP from a winning Stake Token on a Finalized Market. Calling this method will withdraw REP based on the amount of REP staked into the Stake Token by the msg.sender as well as a portion of the REP redistributed from losing Stake Tokens. It’s recommended that Reporters make sure migrateLosingTokens was called one time on each of the losing Stake Tokens for this Market if they wish to claim the a portion of the REP staked in those losing Tokens. This transaction will only succeed if the Market is Finalized, the stakeToken is the winning Stake Token, and this isn’t a Forked Market. This transaction will spawn a Transfer event which will record a log of the from address (stakeToken), to address (msg.sender), and the amount of REP transferred.

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

The transfer transaction is used to transfer a Stake Token’s ownership from the msg.sender to the _to address provided. This transaction will fail if the msg.sender doesn’t own any Stake Tokens at the stakeToken address provided, or if the _value provided is greater than the number of Stake Tokens owned by the msg.sender. This transaction will spawn a Transfer event which will record a log of the msg.sender address, _to address, and _value amount transferred.

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

Unlike transfer, in transferFrom you specify a _from value as the owner of the Stake Token who will be giving up their ownership to the _to address provided. This allows Stake Tokens to be completely transferrable and therefor the Staked REP contained is also still transferable even while staked on a Report. This transaction will fail if the msg.sender doesn’t have approval of the _from, if the _from address doesn’t own any Stake Tokens, or if the _value provided is more than the Stake Tokens owned by the _from address. This transaction will also spawn a Transfer event which will record a log of the _from address, _to address, and _value amount transferred.

Reporting Window Tx API

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

augur.api.ReportingWindow.createNewMarket({
  _signer: privateKey,
  reportingWindow: reportingWindow,
  _endTime: _endTime,
  _numOutcomes: _numOutcomes,
  _payoutDenominator: _payoutDenominator,
  _feePerEthInWei: _feePerEthInWei,
  _denominationToken: currencyContract,
  _creator: _creator,
  _minDisplayPrice: _minDisplayPrice,
  _maxDisplayPrice: _maxDisplayPrice,
  _designatedReporterAddress: _designatedReporterAddress,
  _topic: _topic,
  onSent: function (result) { console.log(result) },
  onSuccess: function (result) { console.log(result) },
  onFailed: function (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, _designatedReporterAddress, _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:
var privateKey = <Buffer ...>;
var reputationToken = "0x2a73cec0b62fcb8c3120bc80bdb2b1351c8c2d1e";
var _spender = "0xea674fdde714fd979de3edf0f56aa9716b898ec8";
var _from = "0x1a05071893b764109f0bbc5b75d78e3e38b69ab3";
var _value = "100000000000000000000";

augur.api.ReputationToken.approve({
  _signer: privateKey,
  reputationToken: reputationToken,
  _spender: _spender,
  _value: _value,
  onSent: function (result) { console.log(result) },
  onSuccess: function (result) { console.log(result) },
  onFailed: function (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: reputationToken,
  onSent: function (result) { console.log(result) },
  onSuccess: function (result) { console.log(result) },
  onFailed: function (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"
}

var _destination = "0x73295d3c0ca46113ca226222c81c79adabf9f391";
augur.api.ReputationToken.migrateOut({
  _signer: privateKey,
  reputationToken: reputationToken,
  _destination: _destination,
  _reporter: _source,
  _attotokens: _value,
  onSent: function (result) { console.log(result) },
  onSuccess: function (result) { console.log(result) },
  onFailed: function (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: reputationToken,
  _to: _spender,
  _value,
  onSent: function (result) { console.log(result) },
  onSuccess: function (result) { console.log(result) },
  onFailed: function (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: reputationToken,
  _from: _from,
  _to: _spender,
  _value: _value,
  onSent: function (result) { console.log(result) },
  onSuccess: function (result) { console.log(result) },
  onFailed: function (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:
var privateKey = <Buffer ...>;
var _orderId = "0x7ca90ca9118db456d87e3d743b97782a857200b55039f7ffe8de94e5d920f870";
var _type = "1";
var _market = "0x9368ff3e9ce1c0459b309fac6dd4e69229b91a42";
var _outcome = "1";

augur.api.CancelOrder.cancelOrder({
  _signer: privateKey,
  _orderId: _orderId,
  _type: _type,
  _market: _market,
  _outcome: _outcome,
  onSent: function (result) { console.log(result) },
  onSuccess: function (result) { console.log(result) },
  onFailed: function (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 its _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).

Claim Proceeds Tx API

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

augur.api.ClaimProceeds.claimProceeds({
  _signer: privateKey,
  _market: _market,
  onSent: function (result) { console.log(result) },
  onSuccess: function (result) { console.log(result) },
  onFailed: function (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
var privateKey = <Buffer ...>;
var _market = "0x9368ff3e9ce1c0459b309fac6dd4e69229b91a42";
var _amount = "50000000000000000000" // 50.0

augur.api.CompleteSets.publicBuyCompleteSets({
  _signer: privateKey,
  _market: _market,
  _amount: _amount,
  onSent: function (result) { console.log(result) },
  onSuccess: function (result) { console.log(result) },
  onFailed: function (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: _market,
  _amount: _amount,
  onSent: function (result) { console.log(result) },
  onSuccess: function (result) { console.log(result) },
  onFailed: function (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:
var privateKey = <Buffer ...>;
var _type = "1";
var _attoshares = "10000000000000000000"; // 10 shares
var _displayPrice = "0.5";
var _market = "0xd3273eba07248020bf98a8b560ec1576a612102f";
var _outcome = "1";
var _betterOrderId = "0xea2c7476e61f5e2625e57df17fcce74741d3c2004ac657675f686a23d06e6091";
var _worseOrderId = "0xed42c0fab97ee6fbde7c47dc62dc3ad09e8d3af53517245c77c659f7cd561426";
var _tradeGroupId = "1";

augur.api.MakeOrder.publicMakeOrder({
  _signer: privateKey,
  _type: _type,
  _attoshares: _attoshares,
  _displayPrice: _displayPrice,
  _market: _market,
  _outcome: _outcome,
  _betterOrderId: _betterOrderId,
  _worseOrderId: _worseOrderId,
  _tradeGroupId: _tradeGroupId,
  onSent: function (result) { console.log(result) },
  onSuccess: function (result) { console.log(result) },
  onFailed: function (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:
var privateKey = <Buffer ...>;
var shareToken = "0xa22c79a48f51df6d0863821bd1dd2c5d6f511bc5";
var _spender = "0x01f50356c280cd886dd058210937160c73700a4b";
var _attotokens = "100000000000000000000";

augur.api.ShareToken.approve({
  _signer: privateKey,
  shareToken: shareToken,
  _spender: _spender,
  _value: _attotokens,
  onSent: function (result) { console.log(result) },
  onSuccess: function (result) { console.log(result) },
  onFailed: function (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: shareToken,
  _to: _spender,
  _value: _attotokens,
  onSent: function (result) { console.log(result) },
  onSuccess: function (result) { console.log(result) },
  onFailed: function (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"
}

var _from = "0x4b01721f0244e7c5b5f63c20942850e447f5a5ee";
augur.api.ShareToken.transferFrom({
  _signer: privateKey,
  shareToken: shareToken,
  _from: _from,
  _to: _spender,
  _value: _attotokens,
  onSent: function (result) { console.log(result) },
  onSuccess: function (result) { console.log(result) },
  onFailed: function (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:
var privateKey = <Buffer ...>;
var _orderId = "0xea2c7476e61f5e2625e57df17fcce74741d3c2004ac657675f686a23d06e6091";
var _amountTakerWants = "10000000000000000000"; // 10.0
var _tradeGroupId = "1";

augur.api.TakeOrder.publicTakeOrder({
  _signer: privateKey,
  _orderId: _orderId,
  _amountTakerWants: _amountTakerWants,
  _tradeGroupId: _tradeGroupId,
  onSent: function (result) { console.log(result) },
  onSuccess: function (result) { console.log(result) },
  onFailed: function (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:
var privateKey = <Buffer ...>;
var _market = "0x7e8e07364ccde43ba5159537404924e86ca53c92";
var _outcome = "1";
var _fxpAmount = "10000000000000000000"; // 10.0
var _fxpPrice = "500000000000000000"; // 0.5
var _tradeGroupId = "1";

augur.api.Trade.publicBuy({
  _signer: privateKey,
  _market: _market,
  _outcome: _outcome,
  _fxpAmount: _fxpAmount,
  _fxpPrice: _fxpPrice,
  _tradeGroupId: _tradeGroupId,
  onSent: function (result) { console.log(result) },
  onSuccess: function (result) { console.log(result) },
  onFailed: function (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: _market,
  _outcome: _outcome,
  _fxpAmount: _fxpAmount,
  _fxpPrice: _fxpPrice,
  _tradeGroupId: _tradeGroupId,
  onSent: function (result) { console.log(result) },
  onSuccess: function (result) { console.log(result) },
  onFailed: function (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: _market,
  _outcome: _outcome,
  _fxpAmount: _fxpAmount,
  _fxpPrice: _fxpPrice,
  _tradeGroupId: _tradeGroupId,
  onSent: function (result) { console.log(result) },
  onSuccess: function (result) { console.log(result) },
  onFailed: function (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: _market,
  _outcome: _outcome,
  _fxpAmount: _fxpAmount,
  _fxpPrice: _fxpPrice,
  _tradeGroupId: _tradeGroupId,
  onSent: function (result) { console.log(result) },
  onSuccess: function (result) { console.log(result) },
  onFailed: function (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.
var contractAddresses = {
  ReputationToken: "0x2a73cec0b62fcb8c3120bc80bdb2b1351c8c2d1e",
 /* ... */
};
// Events API is a JSON object containing the event labels, and information about each event
var 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: function (event) { /* ... */ },
    block: function (blockhash) { /* ... */ },
    burn: function (event) { /* ... */ },
    cancelOrder: function (event) { /* ... */ },
    completeSets: function (event) { /* ... */ },
    depositEther: function (event) { /* ... */ },
    initiateWithdrawEther: function (event) { /* ... */ },
    makeOrder: function (event) { /* ... */ },
    mint: function (event) { /* ... */ },
    takeOrder: function (event) { /* ... */ },
    transfer: function (event) { /* ... */ },
    withdrawEther: function (event) { /* ... */ },
  },
  function (filters) { console.log('Listening to filters:', filters); }
);

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

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

// Look up Transfers from my account to my friends account.
var 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"
// its 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/filters/add-filter.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 fee 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.

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.

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.

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.

Child Universe

A Child Universe is a Universe created after a Fork. Child Universes have a Parent Universe which is the Universe that had the Fork happen on it. Locked Universes always have Child Universes because a Fork causes the Universe to be locked which then causes the creation of new Universes which are considered Children of the original, and now Locked, Universe.

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 a trade then a Complete Set will be formed and settled (destroyed). The cost in attoeth of a Complete Set for a particular Market is determined by the Number of Ticks for that Market. When Complete Sets are Settled, Settlement Fees are extracted from the value of the Complete Set and are paid proportionally by both parties, so if you are going to get a larger payout from Settlement you will also pay the lions share of the fees. The Settlement Fees extracted will go toward paying for the reporting system, in the form of a Reporting fee, and paying the Market Creator their set Creator Fee from Share Settlement.

Creator Fee

A Creator Fee is set by the Market Creator when he or she creates a new Market. Once the Creator Fee is set, it can never be increased, only decreased. The Creator Fee must be between 0% and 50%. The Creator 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 Creator 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 Settlement Fees are discussed in more details in the Trading section of the documentation.

Designated Dispute Phase

The Designated Dispute Phase is a three (3) day period immediately following a Reported Proposed Outcome by an Designated Reporter during the Designated Report Phase. During this time, any REP holder can post a Dispute Bond to Challenge the Proposed Outcome of the Market, which moves the Market into the next available Reporting Window for a Reporting Round, specifically the First Report Round. If a Dispute Bond is not posted during the Designated Dispute Phase then the Market is Finalized and the Proposed Outcome becomes the Final Outcome. The Designated Dispute Phase has identical rules to a Reporting Window’s Dispute Phase with the one exception being that an Designated Dispute Phase is not part of a Reporting Window.

Designated Report Phase

The Designated Report Phase is up to three (3) days in length and begins immediately following the End Time of a Market. During this time the Designated Reporter is expected to Report a Proposed Outcome for the Market. When the Designated Reporter submits his/her/its response the Market will immediately enter an Designated Dispute Phase. If the Designated Reporter fails to Report on the Market within the Designated Report Phase then the First Report REP Bond is lost and applied to the First Reporter’s stake and the Market is moved into the next available Reporting Window for a Reporting Round. The Designated Report Phase should not be confused with a Reporting Window’s Reporting Phase which is longer and only concerns Reporting Rounds.

Designated Reporter

An Designated Reporter is a single address designated to submit the Proposed Outcome for a Market during Designated Reporting. The Designated Reporter is set by the Market Creator during Market Creation. All Markets must have a Designated Reporter.

Designated Reporting

Designated 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, known as the Designated Report Phase. After the Report has been submit by the Designated Reporter then a 3 day Designated Dispute Phase begins where in any REP Holder can Challenge 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 Reporting Rounds. Designated Reporting is independent of Reporting Windows.

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 becomes the Final Outcome. During this 3 day period, a REP Holder can post a Dispute Bond if they would like to force another round of Reporting for the Market. The Market will be moved into the next Reporting Window. Markets in the Dispute Phase are 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.

Final Outcome

A Final Outcome is a Proposed Outcome that is not Challenged through a Dispute Phase and the Market becomes Finalized. A Market’s Final Outcome cannot be challenged or changed.

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.

First Report

The First Report is simply the first Report placed on a Market. The First Report generally will come from the Designated Reporter for the Market, which would immediately refund the First Report Bonds to the Market Creator. In the event a Designated Reporter fails to Report then the Market is moved into the next available Reporting Window, along with the First Report Bonds, for it’s First Report Round. The first person to submit a Report and Stake at least 0 REP on their Report will have the First Report REP Bond added to their Stake and their Report transaction’s GAS cost covered by the First Report GAS Bond. This provides an incentive to submit the First Report as the First Reporter stands to gain the First Report REP Bond in REP if they Stake on the eventual Final Outcome.

First Report Bonds

The First Report Bonds is a term used to indicate the combination of both the First Report GAS Bond and the First Report REP Bond. Both are returned to the Market Creator in the event that the Designated Reporter Reports during the Designated Report Phase and both are forfeited to the First Reporter if the Designated Reporter fails to Report during the Designated Report Phase.

First Report GAS Bond

The First Report GAS Bond is paid for using ETH by the Market Creator during Market Creation. This Bond is completely refunded to the Market Creator as soon as the Designated Reporter submits a Report during the Designated Report Phase. This Bond is used in the event of a Designated Reporter failing to submit a Report during the Designated Report Phase. The Market, as well as the First Report REP Bond and this Bond, are moved into the next Reporting Window for Reporting Rounds, starting with the First Report Round. During the First Report Round the First Reporter’s transaction to submit the First Report on this Market is paid for using the First Report GAS Bond. If the transaction costs less than the amount of the First Report GAS Bond then the remaining ETH is sent to the First Reporter.

First Report REP Bond

The First Report REP Bond is paid for using REP by the Market Creator during Market Creation. The Bond is refunded to the Market Creator if the Designated Reporter submits a Report during the Designated Report Phase. If the Designated Reporter fails to Report during the Designated Report Phase then the First Report REP Bond is applied to the stake of the First Reporter for this Market in the Reporting Rounds during the next available Reporting Window. This actually allows for someone to stake 0 REP for the First Report because the Bond is added to whatever you stake. This means someone without any REP has the potential to Report and if the Market is eventually Finalized the way that person Reported then they can earn REP without having to buy it.

First Report Round

The First Report Round is the first Reporting Round a Market will go through if it requires Reporting Rounds to be Resolved.

First Reporter

The First Reporter is the person who submits the First Report on a Market. Generally the First Reporter will be the Designated Reporter, however if the Designated Reporter fails to Report then the First Reporter will become whoever submits the First Report during the First Report Round for this Market.

Fork

A Fork occurs if a Market Awaiting Finalization from an Last Report Round of Reporting Rounds is Disputed. A Fork causes Augur to create multiple Universes of itself. Each Universe is empty except for the Forked Market. There will be a Universe created for each possible Outcome of the Market, including invalid, and the Markets will be Finalized on each Universe. REP holders will need to choose which Universe they want to migrate their REP tokens too. Migration is one way and final. After sixty (60) days the Fork Period ends and the Universe with the most REP migrated too it will allow traders to Settle Shares for the Forked Market and Reporting Fees will be paid out to Reporters for that Universe only. The original Universe that contained the Forked Market is known as the Parent Universe and is considered Locked. All of the new Universes created are known as Child Universes. Forking will result in a new REP Token contract belonging to each Child Universe spawned by the Fork.

Fork Period

The Fork Period is a sixty (60) day period of time after a Fork has occurred.

Forked Market

A Forked Market is a Market who’s Proposed Outcome after a Last Report Round is Disputed and causes a Fork to occur. A Fork will cause the creation of multiple Universes of Augur with the Forked Market having a different Final Outcome in each Universe. The Universe that contained the Forked Market originally will become a Locked Universe.

Last Report Round

The Last Report Round is the final Reporting Round in which a Challenge to the Proposed Outcome during the Dispute Phase will result in a Fork instead of another Reporting Round. Unlike previous Reporting Rounds, when a Market in the Last Report Round enters the Dispute Phase and it’s Proposed Outcome is Challenged then the Market becomes a Forked Market and the Universe becomes a Locked Universe.

Locked Universe

A Locked Universe is a Universe that had a Fork occur within it and no longer allows the creation of new Markets. All Markets within a Locked Universe remain tradable, as Markets never stop being tradable, even after Finalizing. REP holders within a Locked Universe are given a one time and final option to migrate their REP to one of the new universes created after a Fork locks a Market. There is no time constraint to how long a REP holder is allowed to wait to choose a Universe to migrate their REP to.

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 Creator Fee for the Market, which once set cannot be raised, which will determine their cut of all shares Settled on the Market. The Market Creator also needs to specify a Max Price and a Min Price as well as the Number of Ticks for the Market. There are three different Market types supported by Augur, they are: Binary, Categorical, and Scalar.

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 and can no longer be Challenged.

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 Creator 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 Resolution

Market Resolution is the process of Finalizing a Market. Designated Reporting, Reporting Rounds and Forks are all examples of attempts at Market Resolution.

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.

Number of Ticks

The Number of Ticks can be thought of as the number of possible prices, or Ticks, between Minimum Price and Maximum Price for a Market. It’s also the amount of attoeth required to purchase a single Complete Set of indivisible Shares for a Market. When Shares are Settled then each Complete Set will yield Number of Ticks attoeth. The yield from the Complete Sets Settlement is what Settlement Fees are extracted from prior to paying out traders for their closed Positions. Settlement Fees are paid proportionally so that the trader set to receive more payout will have to pay more Fees. The price of an Order can be set to anywhere between 0 and the Number of Ticks set for the Market.

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.

Parent Universe

A Parent Universe is a Universe that has spawned Child Universes because a Fork had occurred on the Parent Universe and caused it to make new Universes. In other words, Locked Universes are Parent Universes to the Universes created due to the Fork.

Payout Distribution Hash

The Payout Distribution Hash is a sha3 hash of the Payout Set. When a Market is Awaiting Finalization it is said to have a tentative Winning Payout Distribution Hash. Once the Market is Finalized then the tentative hash becomes the Winning Payout Distribution Hash. Payout Distribution Hash’s of Forked Markets are used as identifiers for Child Universes and Parent Universes.

Payout Set

A Payout Set, sometimes referred to as the “Payout Numerator” in contract methods, is an array with a length equal to the number of Outcomes for a Market. Each value in the Array is required to be 0 or a positive number that does not exceed the Number of Ticks for the Market. Further, the total sum of all the values contained within the Payout Set array should be equaled to the Number of Ticks for the Market. A quick example, on a Binary Market with 1000 Ticks, if we wanted to submit a Report that stakes REP on Outcome 0, we would submit a Payout Set that looks like this [1000, 0]. Payout Sets are a breakdown of how Markets should payout, or the Payout Distribution, when Finalized, so in the above example, only shares of Outcome 0 will payout on the Finalized Market. Valid Payout Sets are hashed using sha3, and becomes a Payout Distribution Hash.

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.

Proposed Outcome

The Proposed Outcome is the currently reported 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 become a Final Outcome.

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 stake on a Report on the Outcome of a Market, Pay the First Report REP Bond in order to create a Market, and to purchase a Dispute Bond to Challenge the Proposed Outcome of a Market Awaiting Finalization. During the Reporting Phase of a Reporting Window is where most REP holders will be using their REP to Report. You will be asked to stake REP on an Outcome based on how confident you are in that Outcome being the result of the Market. The Markets you will see during a Reporting Window are all past their End Time and the Outcome should be determinable. If the outcome is not determinable you can Report it as Invalid. The more REP you stake, the larger the share of the Reporting Fees you will receive if you Report with the consensus. The two bonds purchased by REP, Dispute Bonds and the First Report REP Bond, are both fully refunded to the bond placer if things go smoothly. So the Market Creator immediately gets their REP bond back if the Designated Reporter does Report during the Designated Report Phase. Dispute Bonds are refunded to the Dispute Bond Owner if the Market’s Proposed Outcome is changed from the one Challenged.

Report

A Report, or Reporting, is the staking of REP on the Outcome of a Market that’s passed its 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 is a REP holder who Stakes REP on the Outcome of a Market who’s End Time has come to pass and is Awaiting Finalization. A Designated Reporter is assigned by the Market Creator during Market Creation for Designated Reporting. REP holders will need to wait for a Market to enter a Reporting Round of a Reporting Window in order to Report on the Outcome of the Market. Reporters are expected to Report accurately as the Market’s event should have come to pass and the result should be known. To incentivize this, reporters who stake on the non Final Outcome will lose their stake to the Reporters who did correctly Stake their REP on the Final Outcome.

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 Settlement Fees, which includes the Creator Fee and the Reporting Fee. The Reporting Fee is 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 Period

The Reporting Period is combined time of the Reporting Phase and Dispute Phase of a Reporting Window. In other words, it’s a term used to describe the total duration of a Reporting Window.

Reporting Phase

The Reporting Phase occurs in the first twenty seven (27) days of a [Reporting Window]. During this phase, Markets in Reporting Rounds are Reported on by Reporters. Following a Reporting Phase the Market should receive a Report to set a Proposed Outcome and be moved into a Dispute Phase during which the Market is considered to be Awaiting Finalization.

Reporting Round

Reporting Rounds take place in a Reporting Window during which REP holders Stake REP on the Outcome of Markets currently in a Reporting Round. Markets enter Reporting Rounds if the Designated Reporter fails to Report during the Designated Report Phase or if the Designated Reporter’s Proposed Outcome is Challenged during the Designated Dispute Phase. Markets start in the First Report Round which incentivizes a First Report if the Market hasn’t received a Report from the Designated Reporter but otherwise acts like any other Reporting Round. Reporting Rounds last the entirety of a Reporting Window and if the Market’s Proposed Outcome is Challenged during the Dispute Phase of the Reporting Window, it is moved up to the next level of Reporting Rounds until eventually reaching the Last Report Round. A Challenge of the Proposed Outcome following a Last Report Round will cause a Fork to occur.

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 combined duration of the Reporting Phase and the Dispute Phase is known as the Reporting Period. The Reporting Phase lasts twenty seven (27) days in which Markets in a Reporting Round 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 Settlement Fees, which includes both the Creator Fee and the Reporting Fee, are only extracted during settlement.

Settlement Fees

Settlement Fees are fees extracted when a Complete Set is Settled. It’s the combination of the Creator Fee and the Reporting Fee.

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.

Stake Token

A Stake Token is used to represent the amount of Staked REP a Reporter has on an Outcome for their Report. Stake Tokens have a 1:1 cost ratio to REP, so 100 attoREP would buy you 100 attoStakeTokens.

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.

Tick

A Tick is the smallest recognized amount by which a price of a security or future may fluctuate. Ticks are each individually a potential price point for a Share of an Outcome for a Market between its Minimum Price and Maximum Price. When a Market Creator creates a new Market they are asked to enter the Number of Ticks for the Market. This number represents how much attoeth a Complete Set of Shares will cost to buy for this Market. A Scalar Market with a Minimum Price of -10 and a Maximum Price of 30 could have a number of ticks set to 4000. This would mean that to purchase a Complete Set for this Market, you would need to spend 4000 attoeth. The Settlement of a Complete Set of Shares will yield 4000 attoeth, which Settlement Fees are then extracted from prior to payout. It also indicates that there are 4000 valid price points between -10 and 30 in this Market, which means an Order with a price of 1.24 or 20.5 is valid for this Market, but a price of 5.725 would be invalid.

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.

Universe

A Universe is a version of Augur. All Markets created on Augur belong to a Universe. Augur will launch with only one Universe, but more can be created in the rare event of a Fork. The Universe in which a Fork occurs will become a Locked Universe and new Universes will be created, one for each Outcome of the Forked Market. After a Fork, REP holders can choose to migrate their REP to one of the new Universes created. They don’t have to migrate, but Locked Universes do not allow the creation of new Markets, and therefor there will be no Markets to Report on in the future and no fees to earn from Reporting. All Universes of Augur are equally valid, even after a Fork has been resolved, and can continue to operate after the Fork Period ends. Universes contain only the Forked Market with a Final Outcome set to one of the possible outcomes, with a Universe created for each possibility, and no other Markets to begin with.

Validity Bond

The Validity Bond is paid by the Market Creator during Market Creation. The bond is paid in ETH and is refunded to the Market Creator if the Final Outcome of the Market is not invalid.

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 invite.augur.net and sign up. We love to hear feedback from people who are as excited as we are about Augur!