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. Additionally, you can chat with us on Discord. If you’d like to join the conversation, just go to invite.augur.net and sign up. Most questions are best asked in the #dev or #general channels.

Getting Started

If you would like to help develop Augur, you’ll need to build the client from source. To do this, first install Node.js, and Git.

Next, clone the Augur repository from Github by opening a terminal window and typing:

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

Navigate to the newly created augur folder by running:

$ cd augur

Once this has been done, Augur’s dependencies will need to be installed. This can be done using either npm or yarn. Both methods are detailed in the next sections.

If you plan on submitting a pull request to the Augur Project, please be sure to read through the Contributing section of these documents before submitting the request.

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, run the following command:

$ npm install

To build Augur from the source code, run:

$ npm run build

After building Augur from the source files, a local web server will need to be started. This can be done using the following command:

$ npm start

To enable hot-reloading (which automatically loads changes made locally), run the following instead of npm start:

$ npm run dev

Doing this is an easy way to do some hacking on the Augur source code and see the changes reflected in real time.

Now open a web browser and go to http://localhost:8080. This should load Augur’s most popular categories page.

Congratulations, you’re ready to start hacking!

Using Yarn

Some people prefer to use yarn instead of npm. To use yarn, execute the following command to install the Augur dependencies:

$ yarn

To build Augur from the source code, run:

$ yarn build

After building, the following command will start a local web server:

$ yarn start

To enable hot-reloading for development purposes, run the following instead of yarn start:

$ yarn dev

Finally, open a web browser and go to http://localhost:8080. This should load Augur’s most popular categories page.

Congratulations, you’re ready to start hacking!

Architecture

Augur is designed to work with a locally-running Ethereum node; however, if one is not available, Augur can be configured to use a hosted Ethereum node instead. A hosted Ethereum node is one that is hosted on a public server by the Augur team. The sections below explain a bit about each setup and provide a diagram of what’s going on under the hood.

Local Ethereum Node

Running a local Ethereum node, such as Geth, while using Augur provides the best performance and overall experience. This is because Augur sends RPC requests to a hosted Ethereum node takes more time than sending them to a local node. To use a local Ethereum node with Augur, either download and run the Augur app locally, or simply visit https://app.augur.net, which is configured to automatically talk to a 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 Ethereum Node

Since many users do not wish 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 Creator 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 Filler 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 Order Creators and contain four important details: The Creator 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

Creator of Bid Order Filler of Bid Order
Escrows: num_shares of all outcomes except outcome
Order Details: price, creator, 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.
Creator of Bid Order Filler of Bid Order
Escrows: open_long_position_cost ETH
Order Details: price, creator, 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.
Creator of Bid Order Filler of Bid Order
Escrows: num_shares of all outcomes except outcome
Order Details: price, creator, 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.
Creator of Bid Order Filler of Bid Order
Escrows: open_long_position_cost ETH
Order Details: price, creator, 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

Creator of Ask Order Filler of Ask Order
Escrows: num_shares of outcome.
Order Details: price, creator, 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
Creator of Ask Order Filler of Ask Order
Escrows: open_short_position_cost ETH.
Order Details: price, creator, 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.
Creator of Ask Order Filler of Ask Order
Escrows: num_shares of outcome.
Order Details: price, creator, 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.
Creator of Ask Order Filler of Ask Order
Escrows: open_short_position_cost ETH.
Order Details: price, creator, 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.

The figure below shows the timeline and actions that users perform from the time a Market is created to the time a Fork ends and the Market is Finalized.

API Overview

augur.js is a collection of JavaScript APIs that can be used to query for information about Augur’s Markets and interact with Augur’s smart contracts. The documentation for augur.js is divided into four sections: the Simplified API, the Call API, the Transaction API, and the Events API. The Simplified API provides general information about Markets within Augur, and many of its functions require a connection to an Augur Node (covered in the next section). The Call and Transaction APIs provide direct mappings to Augur’s smart contract methods via 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 Events API enables listening for certain logged events and searching for them. The Call, Transaction, and Events APIs do not require a connection to an Augur Node. Each of these four components of augur.js is covered in greater detail in their respective sections below.

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, and initial market loading.

Connect to an Ethereum Node

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

var ethereumNode = { 
  httpAddresses: [
    "http://127.0.0.1:8545", // local http address for Geth node
    "https://eth9000.augur.net" // hosted http address for Geth node
  ],
  wsAddresses: [
    "ws://127.0.0.1:8546", // local websocket address for Geth node
    "wss://ws9000.augur.net" // hosted websocket address for Geth node
  ]
  // ipc addresses can also be specified as:
  // ipcAddresses: [ ... ]
};
var augurNode = "ws://127.0.0.1:9001"; // local websocket address for Augur Node

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

Augur’s JavaScript API is a set of JavaScript bindings for the methods encoded in Augur’s Solidity 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 smart contracts run 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. It is the recommended way to interact with Augur’s smart contracts from a custom application.

The easiest way to install augur.js is using npm:

$ npm install augur.js

Alternatively, this can be done using yarn, as follows:

$ yarn add augur.js

To use the Augur API, augur.js must connect to an Ethereum node, which can be either local or remote (hosted). 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. The Ethereum node may have multiple http, websocket, or ipc addresses specified as arrays. The Augur Node, however, can only have one websocket address specified.

In the example, the first connection that will be tried is http://127.0.0.1:8545, which is our local Ethereum node being run using the Geth client. If a connection to the local Geth node cannot be established, the next provided address will be tried. In this case, we have provided a single hosted node (https://eth9000.augur.net) as another attempt to make after the local Geth node. If a connection is successfully established, then a vitals object will be returned, otherwise an error message will be returned.

Connect to an Augur Node

// Connect to an Augur Node as follows:
var Augur = require("augur.js");
var augur = new Augur();

var ethereumNode = { http: "http://127.0.0.1:8545", ws: "ws://127.0.0.1:8546" };
// To connect to a hosted Augur Node instead of a local Augur Node, substitute its websocket address below.
var augurNode = "ws://127.0.0.1:9001"; // Websocket address of a locally-running Augur Node

augur.connect({ ethereumNode, augurNode }, (err) => {
  // do stuff
});

Anyone wishing to query for information about Augur’s markets will need to use the augur.js Simplified API, which requires a connection to an Augur Node. Augur Node is a standalone application that scans the Ethereum blockchain for all Augur event logs and stores them to a SQLite or PostgresSQL database.

Instead of looking up information about Augur-related events directly on the Ethereum blockchain, the Simplified API sends query requests to an Augur Node’s database. This is because looking up information directly on the blockchain can be a slow and difficult process, especially when sorting is required. For example, to run a query for all Markets created by a specific user, sorted by volume and limited to 100 results, would require scanning the blockchain for all Market creation events by that user, saving the results locally, querying each Market to obtain its volume, saving those results locally, and then sorting the Markets created by the user and discarding everything after the first 100 results. This would require a large number of RPC requests and would take a long time to complete.

To alleviate this problem, the Simplified API executes queries by submitting an RPC request to an Augur Node that is either running locally or remotely (hosted). The Augur Node then runs the request against its database and returns the result. This allows queries to be run on Augur much more quickly than would otherwise be possible.

To set up a local Augur Node, follow the instructions described in the Augur Node GitHub repository. Once a local Augur Node is running (or if the websocket address of a hosted node is known), a connection to it can be established by specifying the websocket address as shown by the JavaScript sample code on the right.

Accounts

/**
 * Create an account using the augur.accounts.register method.
 */
var newAccount;
var registerParameters = { password: "thisismysupersecurepassword" };

augur.accounts.register(registerParameters, function (error, account) {
  console.log("Error:", error);
  console.log("Account:", account);
  newAccount = account;
});

// output
Error: null
Account: {
  address: "0xb1baa74babc22bad068e3055846fb76becad7da2",
  derivedKey: <Buffer ...>,
  keystore: { ... },
  privateKey: <Buffer ...>
};

/**
 * Log into an account using the augur.accounts.login method.
 */
var loginParameters = { keystore: newAccount.keystore, password: registerParameters.password };

augur.accounts.login(loginParameters, function (error, account) {
  console.log("Error:", error);
  console.log("Account:", account);
});

// output
Error: null
Account: {
  address: undefined,
  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, let’s 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 get a list of all Markets, first call augur.markets.getMarkets({ universe[, sortBy, isSortDescending, limit, offset] }[, callback]). More detailed market info (including prices) for each market can then be loaded using augur.markets.getMarketsInfo({ marketIDs }[, callback]). getMarketsInfo does not return the Open Orders for the Market; to get the Open Orders, call augur.trading.getOrders({ [universe, marketID, outcome, orderType, creator, orderState, earliestCreationTime, latestCreationTime, sortBy, isSortDescending, limit, offset] }[, callback]).

Debugging Options

augur.rpc.setDebugOptions({ broadcast: true });
augur.api.Universe.getCurrentReportingWindow();
// example output:
packaged: {
  from: "0x56ddb80fe4e5aa05182d794526ab1eff78c90688", 
  to: "0xa1d76546015cfe50183497ca65fcbd5c656f7813", 
  data: "0x6235eef3", 
  gas: "0x2fd618", 
  returns: "address"
}
Blockchain RPC to http://127.0.0.1:8545 via SyncTransport with payload: 
{
  "id":429,
  "jsonrpc":"2.0",
  "method":"eth_call",
  "params":[{"from":"0x56ddb80fe4e5aa05182d794526ab1eff78c90688",
             "to":"0xa1d76546015cfe50183497ca65fcbd5c656f7813",
             "data":"0x6235eef3",
             "gas":"0x2fd618"},
             "latest"]
}
"0x54d134699764375417e4b5dda1e2ac62f62e9725"

augur.rpc.setDebugOptions({ connect: true });
augur.connect({ 'ethereumNode': { http: "http://rinkeby.augur.net:8545", ws: "ws://rinkeby.augur.net:8546" }, 'augurNode': "ws://127.0.0.1:9001"}, function (err, vitals) { console.log(err); console.log(vitals); });
// example output:
connecting to augur node... 
{ 
  augurNode: "ws://127.0.0.1:9001",
  ethereumNode: { http: "http://rinkeby.augur.net:8545", ws: "ws://rinkeby.augur.net:8546" }
}
connecting to ethereum node... 
{ 
  augurNode: "ws://127.0.0.1:9001",
  ethereumNode: { http: "http://rinkeby.augur.net:8545", ws: "ws://rinkeby.augur.net:8546" }
}
connected to augur
Web3: not connected
Sync: http://rinkeby.augur.net:8545
HTTP: http://rinkeby.augur.net:8545
WS: ws://rinkeby.augur.net:8546
IPC: not connected
connected to ethereum
{
  augurNode: "ws://127.0.0.1:9001",
  ethereumNode: {
    abi: {events: {...}, functions: {...}},
    blockNumber: "0x133773",
    coinbase: null,
    contracts: {...},
    gasPrice: 20000000000,
    networkID: "4",
    rpc: {...}
  }
}

augur.rpc.setDebugOptions({ tx: true });
augur.api.Universe.getOrCacheMarketCreationCost({
  onSent: function (result) {...},
  onSuccess: function (result) {...},
  onFailed: function (result) {...}
});
// example output:
payload transact: 
{
  constant: false,  
  from: "0x40485264986740c8fb3d11e814bd94cf86012d29"
  name: "getOrCacheMarketCreationCost"
  params: [],
  returns: "uint256",
  send: true,
  to: "0xa282b625053e80da550098fdb325a8ece6dfe8ac"
}
callReturn: 10000000006000000
txHash: 0x26f731c948568d9c0a4983fa134431f3fba0c68248f95d35536c9157cafa785a

The function augur.rpc.setDebugOptions allows several debugging options to be enabled:

Simplified API

Accounts Functions

augur.accounts.getAccountTransferHistory({
  account: "0x0000000000000000000000000000000000000b0b",
  token: null,
  isSortDescending: false
}, function (error, result) { 
  console.log(result);
});
// example output:
[
  {
    transactionHash: "0x00000000000000000000000000000000000000000000000000000000deadbeef",
    logIndex: 0,
    creationBlockNumber: 1400000,
    blockHash: "0x1400000",
    creationTime: 1506473474,
    sender: " 0x0000000000000000000000000000000000000b0b",
    recipient: " 0x000000000000000000000000000000000000d00d",
    token: " 0x1000000000000000000000000000000000000000",
    value: 10,
    symbol: "shares",
    marketID: " 0x0000000000000000000000000000000000000001",
    outcome: 0,
  },
  {
    transactionHash: "0x00000000000000000000000000000000000000000000000000000000d3adb33f",
    logIndex: 0,
    creationBlockNumber: 1400001,
    blockHash: "0x1400001",
    creationTime: 1506473500,
    sender: " 0x000000000000000000000000000000000000d00d",
    recipient: " 0x0000000000000000000000000000000000000b0b",
    token: " 0x1000000000000000000000000000000000000000",
    value: 2,
    symbol: "shares",
    marketID: " 0x0000000000000000000000000000000000000001",
    outcome: 0,
  },
  {
    transactionHash: "0x00000000000000000000000000000000000000000000000000000000deadb33f",
    logIndex: 1,
    creationBlockNumber: 1400001,
    blockHash: "0x1400001",
    creationTime: 1506473500,
    sender: " 0x0000000000000000000000000000000000000b0b",
    recipient: " 0x000000000000000000000000000000000000d00d",
    token: " 0x7a305d9b681fb164dc5ad628b5992177dc66aec8",
    value: 47,
    symbol: "REP",
    marketID: null,
    outcome: null,
  }
]

augur.accounts.getAccountTransferHistory(p, callback) → {Array.<AccountTransfer>}

Returns the token transfers made to or from a specific Ethereum address.

Note: This function requires an Augur Node connection.

Parameters:

Returns:

Create-Market Functions

// augur.createMarket.createBinaryMarket: Example JS code coming soon

// augur.createMarket.createCategoricalMarket: Example JS code coming soon

// augur.createMarket.createScalarMarket: Example JS code coming soon

// augur.createMarket.getMarketCreationCost: Example JS code coming soon

// augur.createMarket.getMarketCreationCostBreakdown: Example JS code coming soon

augur.createMarket.createBinaryMarket(p)

Creates a Binary Market in a specified Universe.

Parameters:

Returns:

Description pending.

augur.createMarket.createCategoricalMarket(p)

Creates a Categorical Market in a specified Universe.

Parameters:

Returns:

Description pending.

augur.createMarket.createScalarMarket(p)

Creates a Scalar Market in a specified Universe.

Parameters:

Returns:

Description pending.

augur.createMarket.getMarketCreationCost(p, callback) → {MarketCreationCost}

Retrieves the Designated Report No-Show REP Bond amount and total ether required to create a new Market.

Note: This function will send a transaction if needed to create the current Reporting Window.

Parameters:

Returns:

augur.createMarket.getMarketCreationCostBreakdown(p, callback) → {MarketCreationCostBreakdown}

Similar to augur.createMarket.getMarketCreationCost, but provides more detail about the ether costs required to create a new Market. These ether costs are broken down by the gas cost paid to the First Reporter and the cost of the Validity Bond.

Note: This function will send a transaction if needed to create the current Reporting Window.

Parameters:

Returns:

Markets Functions

augur.markets.getCategories({
  universe: "0x000000000000000000000000000000000000000b",
  sortBy: "popularity",
  isSortDescending: true
}, function (error, result) { 
  console.log(result);
});
// example output:
[
  { category: "finance", popularity: 12345 },
  { category: "politics", popularity: 5000 },
  { category: "ethereum", popularity: 1000 },
  { category: "augur", popularity: 500 },
]

// NOTE: This function has not be implemented yet, so the format of the returned data is still pending.
augur.markets.getDisputableMarkets({ 
  reportingWindow: "0x1000000000000000000000000000000000000000"
}, function (error, result) { 
  console.log(result);
});
// example output: coming soon

augur.markets.getMarketPriceHistory({
  marketID: "0x0000000000000000000000000000000000000001",
  sortBy: null,
  isSortDescending: null,
  limit: null,
  offset: null,
}, function (error, result) { 
  console.log(result);
});
// example output:
{
  0: [{
    price: 5.5,
    timestamp: 1506474500,
  }],
}

augur.markets.getMarkets({
  universe: "0x000000000000000000000000000000000000000b"
}, function (error, result) { 
  console.log(result);
});
// example output:
[
  "0x0000000000000000000000000000000000000001",
  "0x0000000000000000000000000000000000000002",
  "0x0000000000000000000000000000000000000003",
  "0x0000000000000000000000000000000000000011",
]

augur.markets.getMarketsAwaitingDesignatedReporting({
  universe: "0x000000000000000000000000000000000000000b",
  sortBy: "volume",
  isSortDescending: false,
}, function (error, result) { 
  console.log(result);
});
// example output:
[
  "0x0000000000000000000000000000000000000001",
  "0x0000000000000000000000000000000000000002",
  "0x0000000000000000000000000000000000000003",
  "0x0000000000000000000000000000000000000012",
  "0x0000000000000000000000000000000000000014",
  "0x0000000000000000000000000000000000000015",
  "0x0000000000000000000000000000000000000016",
  "0x0000000000000000000000000000000000000017",
]

augur.markets.getMarketsAwaitingReporting({
  universe: "0x000000000000000000000000000000000000000b"
}, function (error, result) { 
  console.log(result);
});
// example output: 
[
  "0x0000000000000000000000000000000000000012",
  "0x0000000000000000000000000000000000000013",
  "0x0000000000000000000000000000000000000014",
  "0x0000000000000000000000000000000000000015",
  "0x0000000000000000000000000000000000000016",
  "0x0000000000000000000000000000000000000017",
  "0x0000000000000000000000000000000000000018",
  "0x0000000000000000000000000000000000000019",
  "0x0000000000000000000000000000000000000001",
  "0x0000000000000000000000000000000000000002",
  "0x0000000000000000000000000000000000000003",
  "0x0000000000000000000000000000000000000011"
]

augur.markets.getMarketsClosingInDateRange({
  universe: "0x000000000000000000000000000000000000000b",
  earliestClosingTime: 1506573450,
  latestClosingTime: 1506573470,
  limit: 10,
}, function (error, result) { 
  console.log(result);
});
// example output:
[
  "0x0000000000000000000000000000000000000001",
]

augur.markets.getMarketsCreatedByUser({
  universe: "0x000000000000000000000000000000000000000b",
  creator: "0x0000000000000000000000000000000000000b0b",
}, function (error, result) { 
  console.log(result);
});
// example output:
[
  "0x0000000000000000000000000000000000000001",
  "0x0000000000000000000000000000000000000002",
  "0x0000000000000000000000000000000000000011",
]

augur.markets.getMarketsInCategory({
  universe: "0x000000000000000000000000000000000000000b",
  category: "augur",
}, function (error, result) { 
  console.log(result);
});
// example output:
[
  "0x0000000000000000000000000000000000000001",
  "0x0000000000000000000000000000000000000002",
  "0x0000000000000000000000000000000000000003",
  "0x0000000000000000000000000000000000000011",
]

augur.markets.getMarketsInfo({
  marketIDs: [
    "0x0000000000000000000000000000000000000001",
    "0x0000000000000000000000000000000000000002",
  ],
}, function (error, result) { 
  console.log(result);
});
// example output:
[
  {
    id: "0x0000000000000000000000000000000000000001",
    universe: "0x000000000000000000000000000000000000000b",
    type: "categorical",
    numOutcomes: 8,
    minPrice: 0,
    maxPrice: 1,
    cumulativeScale: "1",
    author: "0x0000000000000000000000000000000000000b0b",
    creationTime: 1506473474,
    creationBlock: 1400000,
    creationFee: 10,
    reportingFeeRate: 0.02,
    marketCreatorFeeRate: 0.01,
    marketCreatorFeesCollected: 0,
    category: "test category",
    tags: ["test tag 1", "test tag 2"],
    volume: 0,
    outstandingShares: 0,
    reportingState: "DESIGNATED_REPORTING",
    reportingWindow: "0x1000000000000000000000000000000000000000",
    endDate: 1506573470,
    finalizationTime: null,
    description: "This is a categorical test market created by b0b.",
    extraInfo: null,
    designatedReporter: "0x0000000000000000000000000000000000000b0b",
    designatedReportStake: 10,
    resolutionSource: "http://www.trusted-third-party.com",
    numTicks: 10000,
    tickSize: "0.0001",
    consensus: null,
    outcomes: [{
      id: 0,
      volume: 100,
      price: 0.125,
      name: "outcome 0",
    }, {
      id: 1,
      volume: 100,
      price: 0.125,
      name: "outcome 1",
    }, {
      id: 2,
      volume: 100,
      price: 0.125,
      name: "outcome 2",
    }, {
      id: 3,
      volume: 100,
      price: 0.125,
      name: "outcome 3",
    }, {
      id: 4,
      volume: 100,
      price: 0.125,
      name: "outcome 4",
    }, {
      id: 5,
      volume: 100,
      price: 0.125,
      name: "outcome 5",
    }, {
      id: 6,
      volume: 100,
      price: 0.125,
      name: "outcome 6",
    }, {
      id: 7,
      volume: 100,
      price: 0.125,
      name: "outcome 7",
    }],
  },
  {
    id: "0x0000000000000000000000000000000000000002",
    universe: "0x000000000000000000000000000000000000000b",
    type: "binary",
    numOutcomes: 2,
    minPrice: 0,
    maxPrice: 1,
    cumulativeScale: "1",
    author: "0x0000000000000000000000000000000000000b0b",
    creationTime: 1506480000,
    creationBlock: 1400100,
    creationFee: 10,
    reportingFeeRate: 0.02,
    marketCreatorFeeRate: 0.01,
    marketCreatorFeesCollected: 0,
    category: "test category",
    tags: ["test tag 1", "test tag 2"],
    volume: 0,
    outstandingShares: 0,
    reportingState: "DESIGNATED_REPORTING",
    reportingWindow: "0x1000000000000000000000000000000000000000",
    endDate: 1506573480,
    finalizationTime: null,
    description: "This is a binary test market created by b0b.",
    extraInfo: null,
    designatedReporter: "0x0000000000000000000000000000000000000b0b",
    designatedReportStake: 10,
    resolutionSource: "http://www.trusted-third-party.com",
    numTicks: 10000,
    consensus: null,
    outcomes: [{
      id: 0,
      volume: 1000,
      price: 0.5,
      name: "outcome 0",
    }, {
      id: 1,
      volume: 1000,
      price: 0.5,
      name: "outcome 1",
    }]
  }
]

augur.markets.getCategories(p, callback) → {Array.<Category>}

Returns the Market Categories in a specific Universe.

Note: This function requires an Augur Node connection.

Parameters:

Returns:

augur.markets.getDisputableMarkets(p, callback)

This function has not been implemented yet. Returns the Markets in a specific Reporting Window that are able to be disputed, along with the value of the Dispute Bond needed to dispute each Market’s result.

Note: This function requires an Augur Node connection.

Parameters:

Returns:

augur.markets.getMarketPriceHistory(p, callback) → {MarketPriceTimeSeries}

Returns the prices and timestamps of a specific Market’s Outcomes over time.

Note: This function requires an Augur Node connection.

Parameters:

Returns:

augur.markets.getMarkets(p, callback) → {Array.<string>}

Returns an array of Markets in a specific Universe.

Note: This function requires an Augur Node connection.

Parameters:

Returns:

augur.markets.getMarketsAwaitingDesignatedReporting(p, callback) → {Array.<string>}

Returns the Markets in a specific Universe that are waiting for a Designated Report to be submitted.

Note: This function requires an Augur Node connection.

Parameters:

Returns:

augur.markets.getMarketsAwaitingReporting(p, callback) → {Array.<string>}

Returns the Markets in a particular Universe or Reporting Window that are waiting for a Designated Report to be submitted or waiting for the Reporting Phase to end. Either the Universe or Reporting Window must be specified.

Note: This function requires an Augur Node connection.

Parameters:

Returns:

augur.markets.getMarketsClosingInDateRange(p, callback) → {Array.<string>}

Returns the Markets closing between a given time range in a specific Universe.

Note: This function requires an Augur Node connection.

Parameters:

Returns:

augur.markets.getMarketsCreatedByAccount(p, callback) → {Array.<string>}

Returns the Markets created by a specific user, as well as the total amount of fees earned so far by that user.

Note: This function requires an Augur Node connection.

Parameters:

Returns:

augur.markets.getMarketsInCategory(p, callback) → {Array.<string>}

Returns the Markets within a specific category.

Note: This function requires an Augur Node connection.

Parameters:

Returns:

augur.markets.getMarketsInfo(p) → {Array.<MarketInfo>}

Returns information about Markets that are stored on-contract. The returned result includes basic information about the Markets as well as information about each Market Outcome. It does not include Order Book information; however the function augur.trading.getOrders can be used to get information about Orders for the specified Market.

Note: This function requires an Augur Node connection.

Parameters:

Returns:

(Array.<MarketInfo>)

Reporting Functions

augur.reporting.getReportingHistory({
  reporter: "0x0000000000000000000000000000000000000021",
  universe: "0x000000000000000000000000000000000000000b",
}, function (error, result) { 
  console.log(result);
});
// example output:
{
  "0x000000000000000000000000000000000000000b": {
    "0x0000000000000000000000000000000000000011": [{
      transactionHash: "0x0000000000000000000000000000000000000000000000000000000000000D00",
      logIndex: 0,
      creationBlockNumber: 1400051,
      blockHash: "0x1400051",
      creationTime: 1506474500,
      marketID: "0x0000000000000000000000000000000000000011",
      marketReportingState: "DESIGNATED_REPORTING",
      reportingWindow: "0x1000000000000000000000000000000000000000",
      payoutNumerators: [0, 2],
      amountStaked: 17,
      stakeToken: "0x0000000000000000001000000000000000000001",
      isCategorical: false,
      isScalar: false,
      isIndeterminate: false,
      isSubmitted: true,
    }],
    "0x0000000000000000000000000000000000000019": [{
      transactionHash: "0x0000000000000000000000000000000000000000000000000000000000000D03",
      logIndex: 0,
      creationBlockNumber: 1400052,
      blockHash: "0x1400052",
      creationTime: 1506474515,
      marketID: "0x0000000000000000000000000000000000000019",
      marketReportingState: "FIRST_REPORTING",
      reportingWindow: "0x1000000000000000000000000000000000000000",
      payoutNumerators: [1, 1],
      amountStaked: 229,
      stakeToken: "0x0000000000000000001000000000000000000003",
      isCategorical: false,
      isScalar: false,
      isIndeterminate: false,
      isSubmitted: true,
    }],
  }
}

augur.reporting.getReportingSummary({ 
  reportingWindow: "0x1000000000000000000000000000000000000000"
}, function (error, result) { 
  console.log(result);
});
// example output: 
{
  "AWAITING_FINALIZATION": 1,
  "DESIGNATED_REPORTING": 8,
  "FIRST_REPORTING": 2,
  "FINALIZED": 1,
}

// NOTE: This function has not be implemented yet, so the format of the returned data is still pending.
augur.reporting.getReportingWindowsWithUnclaimedFees({ 
  universe: "0x000000000000000000000000000000000000000b",
  account: "0x0000000000000000000000000000000000000021"
}, function (error, result) { 
  console.log(result);
});
// example output: coming soon

augur.reporting.getStakeTokens({ 
  universe: "0x000000000000000000000000000000000000000b",
  account: "0x0000000000000000000000000000000000000021",
  stakeTokenState: "UNFINALIZED",
}, function (error, result) { 
  console.log(result);
});
// example output: 
{
  "0x0000000000000000001000000000000000000001": {
    stakeToken: "0x0000000000000000001000000000000000000001",
    marketID: "0x0000000000000000000000000000000000000011",
    payout0: 0,
    payout1: 2,
    payout2: null,
    payout3: null,
    payout4: null,
    payout5: null,
    payout6: null,
    payout7: null,
    isInvalid: false,
    amountStaked: 17,
    winningToken: null,
    claimed: false,
    reportingState: "FIRST_REPORTING",
  },
}

augur.reporting.getReportingHistory(p, callback) → {Object}

Returns information about the reports submitted by a particular user. For Reporting Windows that have ended, this includes the final Outcome of the Market, whether the user’s report matched that final Outcome, how much REP the user gained or lost from redistribution, and how much the user earned in reporting fees.

Note: This function requires an Augur Node connection.

Parameters:

Returns:

augur.reporting.getReportingSummary(p, callback) → {Object}

Returns the number of Markets in various reporting phases, including “DESIGNATED_REPORTING”, “FIRST_REPORTING”, “LAST_REPORTING”, “AWAITING_FINALIZATION” (when a Market has been reported on and is in a dispute phase), “FORKING” (for the Market that has forked), “AWAITING_FORK_MIGRATION” (for Markets that are waiting for a forked Market to resolve), and “FINALIZED”.

Note: This function requires an Augur Node connection.

Parameters:

Returns:

augur.reporting.getReportingWindowsWithUnclaimedFees(p, callback)

This function has not been implemented yet. Returns the Reporting Windows where a specific user has unclaimed reporting fees.

Note: This function requires an Augur Node connection.

Parameters:

Returns:

augur.reporting.getStakeTokens(p, callback) → {Array.<StakeToken>}

Returns the stake tokens owned by a specific user that are either unclaimed or are in Markets that have not been finalized.

Note: This function requires an Augur Node connection.

Parameters:

Returns:

Trading Functions

augur.trading.getBetterWorseOrders({
  marketID: "0x0000000000000000000000000000000000000001",
  outcome: 0,
  orderType: "buy",
  price: 0.65,
}, function (error, result) { 
  console.log(result);
});
// example output: 
{
  betterOrderID: "0x1000000000000000000000000000000000000000000000000000000000000000",
  worseOrderID: "0x2000000000000000000000000000000000000000000000000000000000000000",
}

augur.trading.getOrders({
  marketID: "0x0000000000000000000000000000000000000001",
  universe: "0x000000000000000000000000000000000000000b",
  outcome: null,
  orderType: "buy",
  creator: null,
  orderState: "OPEN",
}, function (error, result) { 
  console.log(result);
});
// example output:
{
  "0x0000000000000000000000000000000000000001": {
    0: {
      buy: {
        "0x1000000000000000000000000000000000000000000000000000000000000000": {
          orderID: "0x1000000000000000000000000000000000000000000000000000000000000000",
          shareToken: "0x1000000000000000000000000000000000000000",
          transactionHash: "0x0000000000000000000000000000000000000000000000000000000000000A00",
          logIndex: 0,
          owner: "0x0000000000000000000000000000000000000b0b",
          creationTime: 1506473500,
          creationBlockNumber: 1400001,
          orderState: "OPEN",
          price: 0.7,
          amount: 1,
          fullPrecisionPrice: 0.7,
          fullPrecisionAmount: 1,
          tokensEscrowed: 0.7,
          sharesEscrowed: 0,
        },
        "0x2000000000000000000000000000000000000000000000000000000000000000": {
          orderID: "0x2000000000000000000000000000000000000000000000000000000000000000",
          shareToken: "0x1000000000000000000000000000000000000000",
          transactionHash: "0x0000000000000000000000000000000000000000000000000000000000000A01",
          logIndex: 0,
          owner: "0x000000000000000000000000000000000000d00d",
          creationTime: 1506473515,
          creationBlockNumber: 1400002,
          orderState: "OPEN",
          price: 0.6,
          amount: 2,
          fullPrecisionPrice: 0.600001,
          fullPrecisionAmount: 2,
          tokensEscrowed: 1.200002,
          sharesEscrowed: 0,
        },
        "0x5000000000000000000000000000000000000000000000000000000000000000": {
          orderID: "0x5000000000000000000000000000000000000000000000000000000000000000",
          amount: 1,
          creationBlockNumber: 1400001,
          creationTime: 1506473500,
          transactionHash: "0x0000000000000000000000000000000000000000000000000000000000000A06",
          logIndex: 0,
          fullPrecisionAmount: 1,
          fullPrecisionPrice: 0.7,
          orderState: "OPEN",
          owner: "0x0000000000000000000000000000000000000b0b",
          price: 0.7,
          shareToken: "0x1000000000000000000000000000000000000000",
          sharesEscrowed: 0,
          tokensEscrowed: 0.7,
        },
      },
    },
    1: {
      buy: {
        "0x3000000000000000000000000000000000000000000000000000000000000000": {
          orderID: "0x3000000000000000000000000000000000000000000000000000000000000000",
          shareToken: "0x2000000000000000000000000000000000000000",
          transactionHash: "0x0000000000000000000000000000000000000000000000000000000000000A02",
          logIndex: 0,
          owner: "0x000000000000000000000000000000000000d00d",
          creationTime: 1506473515,
          creationBlockNumber: 1400002,
          orderState: "OPEN",
          price: 0.6,
          amount: 2,
          fullPrecisionPrice: 0.6,
          fullPrecisionAmount: 2.0000001,
          tokensEscrowed: 1.20000006,
          sharesEscrowed: 0,
        },
      },
    },
  },
}

// augur.trading.getPositionInMarket: Example JS code coming soon

augur.trading.getUserTradingHistory({
      account: "0x000000000000000000000000000000000000d00d",
      universe: null,
      marketID: "0x0000000000000000000000000000000000000001",
      outcome: 0,
      orderType: null,
      sortBy: null,
      isSortDescending: null,
      limit: null,
      offset: null,
}, function (error, result) { 
  console.log(result);
});
// example output:
[
  {
    transactionHash: "0x0000000000000000000000000000000000000000000000000000000000000C00",
    logIndex: 0,
    type: "sell",
    price: 5.5,
    amount: 0.2,
    maker: false,
    marketCreatorFees: 0,
    reporterFees: 0,
    settlementFees: "0",
    marketID: "0x0000000000000000000000000000000000000001",
    outcome: 0,
    shareToken: "0x1000000000000000000000000000000000000000",
    timestamp: 1506474500,
    tradeGroupID: null,
  }
]

augur.trading.getUserTradingPositions({
  account: "0x000000000000000000000000000000000000d00d",
  universe: "0x000000000000000000000000000000000000000b",
  marketID: null,
  outcome: null,
  sortBy: null,
  isSortDescending: null,
  limit: null,
  offset: null,
}, function (error, result) { 
  console.log(result);
});
// example output:
[
  {
    "marketID": "0x0000000000000000000000000000000000000001",
    "outcome": 0,
    "numShares": 0.2,
    "numSharesAdjustedForUserIntention": 0.2,
    "realizedProfitLoss": 0,
    "unrealizedProfitLoss": 11,
  }, {
    "marketID": "0x0000000000000000000000000000000000000001",
    "outcome": 1,
    "numShares": 0,
    "numSharesAdjustedForUserIntention": 0,
    "realizedProfitLoss": 0,
    "unrealizedProfitLoss": 0,
  }, {
    "marketID": "0x0000000000000000000000000000000000000001",
    "outcome": 2,
    "numShares": 0,
    "numSharesAdjustedForUserIntention": 0,
    "realizedProfitLoss": 0,
    "unrealizedProfitLoss": 0,
  }, {
    "marketID": "0x0000000000000000000000000000000000000001",
    "outcome": 3,
    "numShares": 0,
    "numSharesAdjustedForUserIntention": 0,
    "realizedProfitLoss": 0,
    "unrealizedProfitLoss": 0,
  }, {
    "marketID": "0x0000000000000000000000000000000000000001",
    "outcome": 4,
    "numShares": 0,
    "numSharesAdjustedForUserIntention": 0,
    "realizedProfitLoss": 0,
    "unrealizedProfitLoss": 0,
  }, {
    "marketID": "0x0000000000000000000000000000000000000001",
    "outcome": 5,
    "numShares": 0,
    "numSharesAdjustedForUserIntention": 0,
    "realizedProfitLoss": 0,
    "unrealizedProfitLoss": 0,
  }, {
    "marketID": "0x0000000000000000000000000000000000000001",
    "outcome": 6,
    "numShares": 0,
    "numSharesAdjustedForUserIntention": 0,
    "realizedProfitLoss": 0,
    "unrealizedProfitLoss": 0,
  }, {
    "marketID": "0x0000000000000000000000000000000000000001",
    "outcome": 7,
    "numShares": 0,
    "numSharesAdjustedForUserIntention": 0,
    "realizedProfitLoss": 0,
    "unrealizedProfitLoss": 0,
  }
]

augur.trading.getBetterWorseOrders(p, callback) → {BetterWorseOrders}

Returns the IDs of the orders for a given Outcome that have a better and worse price than the specified price. If no better/worse orders exist, null will be returned. This function should be called prior to calling augur.api.CreateOrder.publicCreateOrder in order to get the _betterOrderId and _worseOrderId parameters that it accepts. (_betterOrderId and _worseOrderId are used to optimize the sorting of Orders on the Order Book.)

Note: This function requires an Augur Node connection.

Parameters:

Returns:

augur.trading.getOrders(p, callback) → {SingleOutcomeOrderBookSide}

Returns a list of orders in a given Universe or Market.

Note: This function requires an Augur Node connection.

Parameters:

Returns:

augur.trading.getPositionInMarket(p) → {Array.<string>}

Gets the number of Shares held by a specific Ethereum address for each Outcome of a Market.

Parameters:

Returns:

augur.trading.getUserTradingHistory(p, callback) → {Array.<UserTrade>}

Returns information about the trades a specific user has made.

Note: This function requires an Augur Node connection.

Parameters:

Returns:

augur.trading.getUserTradingPositions(p, callback) → {Array.<UserTradePosition>}

Returns the trading positions held by a specific user.

Note: This function requires an Augur Node connection.

Parameters:

Returns:

Type Definitions

Account (Object)

Properties:

AccountTransfer (Object)

Properties:

AuthenticationMetadata (Object)

Authentication metadata for raw transactions.

Properties:

BetterWorseOrders (Object)

Properties:

Category (Object)

Properties:

CipherParams (Object)

Properties:

ExtraInfo (Object)

Properties:

Keystore (Object)

Properties:

KeystoreCrypto (Object)

Properties:

MarketCreationCost (Object)

Properties:

MarketCreationCostBreakdown (Object)

Properties:

MarketInfo (Object)

Properties:

MarketPriceTimeSeries (Object)

Properties:

NoKeystoreAccount (Object)

Properties:

Order (Object)

Properties:

ORDER_STATE (Object)

Serves as an enum for the state of an order.

Properties:

OutcomeInfo (Object)

Properties:

Pbkdf2Params (Object)

Properties:

Report (Object)

Properties:

REPORTING_STATE (Object)

Serves as an enum for the state of a stake token.

Properties:

ScryptParams (Object)

Properties:

SingleOutcomeOrderBookSide (Object)

Properties:

SingleOutcomePriceTimeSeries (Object)

Properties:

STAKE_TOKEN_STATE (Object)

Serves as an enum for the state of a stake token.

Properties:

StakeToken (Object)

Properties:

TimestampedPrice (Object)

Properties:

UserTrade (Object)

Properties:

UserTradePosition (Object)

Properties:

Call API

// Call API Example
/**
* Get the Number of Outcomes for the Market:
* 0x9368ff3e9ce1c0459b309fac6dd4e69229b91a42
*/

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

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

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

// synchronous -- possible but not recommended.
var outcomes = augur.api.Market.getNumberOfOutcomes(error, 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 Call API

// Dispute Bond Contract Call API Examples:
var disputeBond = "0xe5d6eaefcfaf7ea1e17c4768a554d57800699ea4";

augur.api.DisputeBond.getBondRemainingToBePaidOut({ tx: { to: disputeBond } }, function (error, bondRemainingToBePaidOut) { /* ... */ })
// example output:
bondRemainingToBePaidOut = "1100000000000000000000"

augur.api.DisputeBond.getDisputedPayoutDistributionHash({ tx: { to: disputeBond } }, function (error, disputedPayoutDistributionHash) { /* ... */ })
// example output:
disputedPayoutDistributionHash = "0xff89be2020af3cb2ca244eb862df2d350300904a96039eb53cbacf380f13f21b"

augur.api.DisputeBond.getMarket({ tx: { to: disputeBond } }, function (error, market) { /* ... */ })
// example output:
market = "0x9368ff3e9ce1c0459b309fac6dd4e69229b91a42"

augur.api.DisputeBond.getOwner({ tx: { to: disputeBond } }, function (error, owner) { /* ... */ })
// example output:
owner = "0x3d62bafc1791752393384b902f813da861ddedd9"

augur.api.DisputeBond.getUniverse({ tx: { to: disputeBond } }, function (error, universe) { /* ... */ })
// example output:
universe = "0x0920d1513057572be46580b7ef75d1d01a99a3e5"

Dispute Bond 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.DisputeBond.getBondRemainingToBePaidOut({ tx }[, callback])

This transaction will return the amount of REP, denoted in attotokens, of bond remaining to be paid out for a specified disputeBond. 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.DisputeBond.getDisputedPayoutDistributionHash({ tx }[, callback])

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

augur.api.DisputeBond.getMarket({ tx }[, callback])

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

augur.api.DisputeBond.getOwner({ tx }[, callback])

This transaction will return the account address of the bond holder for a specified disputeBond. 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.DisputeBond.getUniverse({ tx }[, callback])

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

Market Call API

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

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

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

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

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

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

augur.api.Market.getDesignatedReporterDisputeBond({ tx: { to: market } }, function (error, designatedReporterDisputeBond) { /* ... */ })
// example output:
designatedReporterDisputeBond = "0xe783e32cfeea2d2be8df1ae6e978e6d4de63fe26"

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

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

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

augur.api.Market.getExtraDisputeBondRemainingToBePaidOut({ tx: { to: market } }, function (error, extraDisputeBondRemainingToBePaidOut) { /* ... */ })
// example output:
extraDisputeBondRemainingToBePaidOut = "1000";

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

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

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

augur.api.Market.getFirstReportersDisputeBond({ tx: { to: market } }, function (error, round1ReportersDisputeBond) { /* ... */ })
// example output:
round1ReportersDisputeBond = "0x0151f9153f236359ea3605cef0fffff90aba0327";

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

augur.api.Market.getLastReportersDisputeBond({ tx: { to: market } }, function (error, round2ReportersDisputeBond) { /* ... */ })
// example output:
round2ReportersDisputeBond = "0xe5d6eaefcfaf7ea1e17c4768a554d57800699ea4";

augur.api.Market.getMarketCreatorMailbox({ tx: { to: market } }, function (error, marketCreatorMailbox) { /* ... */ })
// example output:
marketCreatorMailbox = "0xeabdeaefcfaf7ea1e17c4768a554d5780069eabd"

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

augur.api.Market.getOwner({ tx: { to: market } }, function (error, owner) { /* ... */ })
// example output:
owner = "0x06cbcd92af2571f1419b622a794d65db524f682b"

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

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

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

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

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

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

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

augur.api.Market.getTotalStake({ tx: { to: market } }, function (error, totalStake) { /* ... */ })
// example output:
totalStake = "1000"

augur.api.Market.getTotalWinningDisputeBondStake({ tx: { to: market } }, function (error, _totalDisputeBondStake) { /* ... */ })
// example output:
_totalDisputeBondStake = "1000"

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

var disputeBond = "0xe5d6eaefcfaf7ea1e17c4768a554d57800699ea4";
augur.api.Market.isContainerForDisputeBond({
  tx: { to: market },
  _shadyDisputeBond: disputeBond
}, function (error, isContainerForShareToken) { /* ... */ })
// example output:
isContainerForDisputeBond = "1"

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

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

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

Market Contract Code

augur.api.Market.getBestGuessSecondPlaceTentativeWinningPayoutDistributionHash({ tx }[, 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({ tx }[, 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. Currently, this will always return “Cash”; however, Augur will eventually support other types of Denomination Tokens.

augur.api.Market.getDesignatedReportDisputeDueTimestamp({ tx }[, 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({ tx }[, 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({ tx }[, 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.getDesignatedReporterDisputeBond({ tx }[, 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({ tx }[, 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({ tx }[, 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({ tx }[, 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.getExtraDisputeBondRemainingToBePaidOut({ tx }[, callback])

Returns the amount of REP that is available in a Market to be migrated to other Universes to reward Dispute Bond holders.

augur.api.Market.getFinalizationTime({ tx }[, 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({ tx }[, 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({ tx }[, 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.getFirstReportersDisputeBond({ tx }[, 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.getForkingMarket({ tx }[, 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.getLastReportersDisputeBond({ tx }[, callback])

Returns the Last Report Round’s Dispute Bond 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.getMarketCreatorMailbox({ tx }[, callback])

Returns the address of the Market Creator Mailbox for market.

augur.api.Market.getMarketCreatorSettlementFeeDivisor({ tx }[, 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({ tx }[, 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({ tx }[, 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.getOwner({ tx }[, callback])

Returns the address of the specified Market’s owner.

augur.api.Market.getPayoutDistributionHashStake({ tx, _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({ tx }[, 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.getReportingWindow({ tx }[, 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.getShareToken({ tx, _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.getStakeTokenOrZeroByPayoutDistributionHash({ tx, _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 getOrCreateStakeToken returns the Stake Token given a Payout Set.

augur.api.Market.getTentativeWinningPayoutDistributionHash({ tx }[, 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.getTotalStake({ tx }[, callback])

Returns the total amount staked on the specified Market.

augur.api.Market.getTotalWinningDisputeBondStake({ tx }[, callback])

Returns the sum of all Dispute Bonds staked on challenging a Payout Distribution Hash other than the final Payout Distribution Hash for the specfied Market.

augur.api.Market.getUniverse({ tx }[, 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.isContainerForDisputeBond({ tx, _shadyDisputeBond }[, callback])

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

augur.api.Market.isContainerForStakeToken({ tx, _shadyStakeToken }[, callback])

Returns whether the specific market is a container for the _shadyStakeToken address provided. The _shadyStakeToken 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({ tx, _shadyShareToken }[, callback])

Returns whether the specific market is a container for the _shadyShareToken address provided. The _shadyShareToken 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({ tx }[, 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.

Orders Call API

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

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

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

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

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

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

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

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

augur.api.Orders.getOrderCreator({ 
  tx: { to: orders },
  _orderId: _orderId 
}, function (error, owner) { /* ... */ })
// example output:
owner = "0x438f2aeb8a16745b1cd711e168581ebce744ffaa";

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

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

augur.api.Orders.getOrderType({ 
  tx: { to: orders },
  _orderId: _orderId 
}, function (error, type) { /* ... */ })
// example output:
type = "1";

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

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

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

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

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

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

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

Orders Contract Code

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

Returns whether 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({ tx, _type, _fxpPrice, _worstOrderId }[, callback])

Returns whether 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({ tx, _orderId }[, callback])

Returns the amount of Shares requested on a specified _orderId.

augur.api.Orders.getBestOrderId({ tx, _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({ tx, _market, _outcome, _type }[, callback])

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

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

Returns a better order ID than the _orderId.

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

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

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

Returns the Market address for the specified _orderId.

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

Returns the Creator address of the specified _orderId.

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

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

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

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

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

Returns the trade type, 1 for bid and 2 for ask, for a specified _orderId.

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

Returns the Outcome being traded on for the specified _orderId.

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

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

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

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

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

Returns a worse order ID than the _orderId.

augur.api.Orders.getWorstOrderId({ tx, _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({ tx, _type, _fxpPrice, _orderId }[, callback])

Returns whether 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({ tx, _type, _fxpPrice, _orderId }[, callback])

Returns whether 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 ordersFetcher = "0x7768ff3e9ce1c0459b309fac6dd4e69229b91a77";
var _orderId = "0x7ca90ca9118db456d87e3d743b97782a857200b55039f7ffe8de94e5d920f870";
var _type = "1";
var _market = "0x9368ff3e9ce1c0459b309fac6dd4e69229b91a42";
var _outcome = "1";
var _fxpPrice = "450000000000000000"; // 0.45

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

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

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

Orders Fetcher Contract Code

augur.api.OrdersFetcher.ascendOrderList({ tx, _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({ tx, _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({ tx, _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.

Participation Token Call API

// Participation Token Contract Call API Examples:
var participationToken = "0x18b17188ce3c491f6ab4427258d92452be5c8054";

augur.api.ParticipationToken.getReportingWindow({ tx: { to: participationToken } }, function (error, reportingWindow) { /* ... */ })
// example output:
reportingWindow =  "0x1f90cc6b4e89303e451c9b852827b5791667f570";

Participation Token Contract Code

The Participation Token is an ERC-20 token that implements all of the required functions listed in the ERC-20 Token Standard. It does not, however, implement the optional functions.

augur.api.ParticipationToken.getReportingWindow({ tx }[, callback])

Returns the Reporting Window address for the specified participationToken. 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 Participation Tokens were purchased for.

Reporting Window Call API

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

augur.api.ReportingWindow.allMarketsFinalized({ tx: { to: reportingWindow } }, function (error, allMarketsFinalized) { /* ... */ })
// example output:
allMarketsFinalized = "1"

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

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

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

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

augur.api.ReportingWindow.getFirstReporterMarketsCount({ tx: { to: reportingWindow } }, function (error, firstReporterMarketsCount) { /* ... */ })
// example output:
firstReporterMarketsCount = "54321"

augur.api.ReportingWindow.getLastReporterMarketsCount({ tx: { to: reportingWindow } }, function (error, lastReporterMarketsCount) { /* ... */ })
// example output:
lastReporterMarketsCount = "12345"

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

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

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

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

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

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

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

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

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

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

augur.api.ReportingWindow.getTotalStake({ tx: { to: reportingWindow } }, function (error, totalStake) { /* ... */ })
// example output:
totalStake = "18900512367"

augur.api.ReportingWindow.getTotalWinningStake({ tx: { to: reportingWindow } }, function (error, totalStake) { /* ... */ })
// example output:
totalStake = "29105"

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

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

var _market = "0x9368ff3e9ce1c0459b309fac6dd4e69229b91a42";
augur.api.ReportingWindow.isContainerForMarket({
  tx: { to: reportingWindow },
  _shadyMarket: _market
}, function (error, isContainerForMarket) { /* ... */ })
// example output:
isContainerForMarket = "1"

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

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

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

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

Reporting Window Contract Code

augur.api.ReportingWindow.allMarketsFinalized({ tx }[, callback])

Returns true if all Markets in the specified Reporting Window are Finalized Markets. Otherwise, returns false.

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

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

augur.api.ReportingWindow.getDisputeEndTime({ tx }[, 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({ tx }[, 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({ tx }[, 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.getFirstReporterMarketsCount({ tx }[, callback])

Returns the number of Markets in the specified Reporting Window that are in the First Report Round. NOTE: If the Reporting Window has not begun yet, this number will include Markets that may end up being Finalized in the Designated Report Round. Since it is unknown whether Designated Reporters ultimately will submit a report, Augur assumes by default that all new Markets will go to the First Report Round. Once the Reporting Window has begun, this function will return the number of Markets that are actually in the First Report Round.

augur.api.ReportingWindow.getLastReporterMarketsCount({ tx }[, callback])

Returns the number of Markets in the specified Reporting Window that are in the Last Report Round.

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

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

augur.api.ReportingWindow.getNumDesignatedReportNoShows({ tx }[, 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 a Designated Report No-Show Gas Bond and Designated Report No-Show REP Bond 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.getNumIncorrectDesignatedReportMarkets({ tx }[, 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.getNumInvalidMarkets({ tx }[, 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({ tx }[, callback])

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

augur.api.ReportingWindow.getParticipationToken({ tx }[, callback])

Returns the Contract Address of the Participation Token associated with the specified Reporting Window.

augur.api.ReportingWindow.getReportingEndTime({ tx }[, 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({ tx }[, 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({ tx }[, 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({ tx }[, 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.getTotalStake({ tx }[, callback])

Returns the total amount staked across all Markets in the specified Reporting Window.

augur.api.ReportingWindow.getTotalWinningStake({ tx }[, callback])

Returns the total amount Participation Tokens purchased in the specified Reporting Window. NOTE: Participation Tokens are only purchasable in the event that no Market in a Reporting Window can be reported on.

augur.api.ReportingWindow.getUniverse({ tx }[, 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({ tx }[, callback])

This method returns whether 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({ tx, _shadyMarket }[, callback])

Returns whether 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({ tx }[, callback])

Returns whether 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({ tx }[, callback])

Returns whether 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.isOver({ tx }[, callback])

Returns whether the 30-day reporting period for the specified Reporting Window has ended.

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

Returns whether 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";

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

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

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 Designated Report No-Show REP Bond to ensure the Designated Reporter shows up. If the Reporter doesn’t show up, the Market Creator’s Designated Report No-Show 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 Designated Report No-Show Gas Bond and the Designated Report No-Show REP Bond is added to whatever the First Reporter staked, there by improving her stake and potential rewards if correctly staked.

The Reputation Token is an ERC-20 token that implements all of the required functions listed in the ERC-20 Token Standard. It does not, however, implement the optional functions.

augur.api.ReputationToken.getUniverse({ tx }[, 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({ tx }[, 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.

Share Token Call API

// Share Token Contract Call API Examples:
var shareToken = "0x18b17188ce3c491f6ab4427258d92452be5c8054";

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

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

Share Token Contract Code

The Share Token is an ERC-20 token that implements all of the required functions listed in the ERC-20 Token Standard. It does not, however, implement the optional functions.

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

Returns the market address for the specified shareToken.

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

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

Stake Token Call API

// Stake Token Contract Call API Examples:
var stakeToken = "0xbb87186146569514b8cd8b72e57eec3849e3981f";

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

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

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

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

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

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

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

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.

The Stake Token is an ERC-20 token that implements all of the required functions listed in the ERC-20 Token Standard. It does not, however, implement the optional functions.

augur.api.StakeToken.getMarket({ tx }[, 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({ tx }[, 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({ tx, 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({ tx }[, 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({ tx }[, 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.getUniverse({ tx }[, 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({ tx }[, 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.

Universe Call API

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

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

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

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

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

augur.api.Universe.getForkReputationGoal({ universe }, function (error, forkReputationGoal) { /* ... */ })
// example output:
forkReputationGoal = "150657";

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

augur.api.Universe.getOpenInterestInAttoEth({ tx: { to: universe } }, function (error, openInterestInAttoEth) { /* ... */ })
// example output:
openInterestInAttoEth = "7123876876123"

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

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

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

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

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

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

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

augur.api.Universe.getReportingWindowForForkEndTime({
  tx: { to: universe }
}, function (error, reportingWindowForForkEndTime) { /* ... */ })
// example output:
reportingWindowForForkEndTime = "0x06cbcd92af2571f1419b622a794d65db524f682a";

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

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

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

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

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

var childUniverse = "0xb4e8c1f85c4382d64954aca187f9f386c8bb1a6c";
augur.api.Universe.isParentOf({
  tx: { to: universe },
  _shadyChild: childUniverse
}, function (error, 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({ tx, _parentPayoutDistributionHash }[, callback])

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

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

Returns the address of the current running Reporting Window of the Universe specified in tx. 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({ tx }[, callback])

Returns the timestamp for when the Fork Period ends that was started on the Universe specified in tx. If there is no Forked Market in the Universe, this function will return 0.

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

Returns the contract address of the Market that the Universe specified in tx is Forking over. This returns the null address (0x0000000000000000000000000000000000000000) if the Universe has never Forked and there is no Forked Market.

augur.api.Universe.getForkReputationGoal({ tx }[, callback])

Returns the estimated amount of REP that must be migrated to one Child Universe in order to allow a Fork in the Universe specified in tx to be finalized before the end of the Fork Period.

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

Returns the address of the Reporting Window coming up after the current Reporting Window ends in the Universe specified in tx.

augur.api.Universe.getOpenInterestInAttoEth({ tx }[, callback])

Returns the total value of all Complete Sets that exist across all Markets the Universe specified in tx, priced in attoETH.

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

Returns the Parent Universe address of the Universe specified in tx. When a Fork occurs, Child Universes are created and the original Universe that contained the Forked 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({ tx }[, callback])

Returns the Parent Universes’s Payout Distribution Hash for Child Universe specified in tx. The Payout Distrubution Hash is a hash of the Disputed Outcome of the Forked Market.

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

Returns the address of the previous Reporting Window to the current Reporting Window for the Universe specified in tx.

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

Returns the Reporting Window full duration in seconds (also known as the Reporting Period) for the Universe](#universe) specified in tx. 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({ tx, _reportingWindowId }[, callback])

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

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

Returns the Reporting Window address on the specific universe given an _endTime.

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

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

augur.api.Universe.getReportingWindowForForkEndTime({ tx }[, callback])

Returns the Reporting Window that the current Fork Period ends in the Universe specified in tx. If no Fork has occurred, the null address (0x0000000000000000000000000000000000000000) is returned.

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

Returns the Reporting Window Id for the Universe specified in tx and provided _timestamp. This is calculated by dividing the timestamp by the Universe’s Reporting Window duration in seconds.

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

Returns the address of the Reputation Token for the Universe specified in tx. This is the REP usable within this Universe.

augur.api.Universe.isContainerForMarket({ tx, _shadyMarket }[, callback])

Returns whether the specific universe is a container for the Market _shadyMarket 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({ tx, _shadyStakeToken }[, callback])

Returns whether the specific universe is a container for the Reporting Token _shadyStakeToken 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 whether the Universe contains the Stake Token specified.

augur.api.Universe.isContainerForReportingWindow({ tx, _shadyReportingWindow }[, callback])

Returns whether the specific universe is a container for the Reporting Window _shadyReportingWindow 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({ tx, _shadyChild }[, callback])

Returns whether 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 onSent output:
{
  callReturn: '100000000000000000000',
  hash: '0x915f8f0b13244b0dd9b7377b252d9245ef0fc109c82931a87410d1bdad671fe6'

}
// example onSuccess output:
{
  blockHash: "0xdc5e31404be698a6866fbe7d7cf435a2c6fab7deb3acf41d6c9bb981a2630fed",
  blockNumber: 1330897,
  callReturn: "100000000000000000000",
  from: "0x40485264986740c8fb3d11e814bd94cf86012d29",
  gas: "0x2fd618",
  gasFees: "0.00081266",
  gasPrice: "0x4a817c800",
  hash: "0x915f8f0b13244b0dd9b7377b252d9245ef0fc109c82931a87410d1bdad671fe6",
  input: "0x39d26051",
  nonce: "0x0",
  r: "0x706eb8aee04faf21fd6da949f946df5fa118da35a619560af9b81fc05054715c",
  s: "0x60d3125aa3b1daabd37618fb80232037cdaef9c87a8d262826880f0e57fdb0d3",
  timestamp: 1512018567,
  to: "0xfc6bba7d664e8cc242857f069e9fb1e7c25ecb44",
  transactionIndex: "0x1",
  v: "0x2c",
  value: "0x0"
}
// example onFailed output:
{
  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 = {
  constant: false,  
  from: "0x40485264986740c8fb3d11e814bd94cf86012d29", 
  name: "getOrCacheMarketCreationCost",
  params: [],
  returns: "uint256",
  send: true,
  to: "0x6eabb9367012c0a84473e1e6d7a7ce39a54d77bb"
};

// 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 ...>;

// accountType is a string set to "privateKey", "uPort", or "ledger".
var accountType = "privateKey";

// 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); };

augur.rpc.transact(payload, privateKeyOrSigner, accountType, onSent, onSuccess, onFailed);
// example onSent output:
Transaction sent: {
  callReturn: "10000000006000000",
  hash: "0x269011fe4ed9c7370f8e8237c525062988e8fcce485d93a1a6a419bb3a8e70d3"
}
// example onSuccess output:
Transaction successful: {
  blockHash: "0x5090c1a25a2accf4cb47a1d99f4fa4215146ac29402688ad3e554169af332e4c",
  blockNumber: 1348278,
  callReturn: "10000000006000000",
  from: "0x40485264986740c8fb3d11e814bd94cf86012d29",
  gas: "0x2fd618",
  gasFees: "0.001882121837379",
  gasPrice: "0x5b793ccec",
  hash: "0x0f8e4cdf3de1aa3c01bea8b12cbde32b2bc7701d2bc1b6403634cdd5999ad729",
  input: "0xec86fdbd",
  nonce: "0x12",
  r: "0x3bedf73900da86c9afb6721e472a268108c66694a589b3083935a3c3cc0cc764",
  s: "0x2c9c24f3bbdd63ba2218de2eddb120f52e966d36fa82989ef6b1e3df0b205ce2",
  timestamp: 1512278406,
  to: "0x6eabb9367012c0a84473e1e6d7a7ce39a54d77bb",
  transactionIndex: "0x1",
  v: "0x2c",
  value: "0x0"
}
//example onFailed output: 
Transaction failed: {
  error: 501,
  message: 'polled network but could not confirm transaction'
}

augur.rpc.transact(payload, privateKeyOrSigner, accountType, 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.

The accountType is a string that can be “privateKey”, “uPort”, or “ledger”, depending on the type of account that is sending the transaction.

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.

Cancel Order Tx API

// Cancel Order Contract Transaction API Examples:
var _orderId = "0x7ca90ca9118db456d87e3d743b97782a857200b55039f7ffe8de94e5d920f870";
var _type = "1";
var _market = "0x9368ff3e9ce1c0459b309fac6dd4e69229b91a42";
var _outcome = "1";

augur.api.CancelOrder.cancelOrder({
  _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 onSuccess output:
{
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320516,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0xa031604c8ef75ab5b1d07f7358d594e1cb57c927a86be92459d78ae3415bb3b0",
  input: "0x309d23e17ca90ca9118db456d87e3d743b97782a857200b55039f7ffe8de94e5d920f87000000000000000000000000000000000000000000000000000000000000000010000000000000000000000009368ff3e9ce1c0459b309fac6dd4e69229b91a420000000000000000000000000000000000000000000000000000000000000001",
  nonce: "0xf61",
  r: "0x706eb8aee04faf21fd6da949f946df5fa118da35a619560af9b81fc05054715c",
  s: "0x60d3125aa3b1daabd37618fb80232037cdaef9c87a8d262826880f0e57fdb0d3",
  timestamp: 1501003133,
  to: "0xa7f3659c53820346176f7e0e350780df304db179",
  v: "0x2c",
  value: "0x0"
}

Cancel Order Contract Code

augur.api.CancelOrder.cancelOrder({ _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). It returns true if the order was successfully canceled. (NOTE: The return value cannot be obtained reliably when calling externally.)

Claim Trading Proceeds Tx API

// Claim Trading Proceeds Contract Transaction API Examples:
var _market = "0x9368ff3e9ce1c0459b309fac6dd4e69229b91a42";

augur.api.ClaimTradingProceeds.claimTradingProceeds({
  _market: _market,
  onSent: function (result) { console.log(result) },
  onSuccess: function (result) { console.log(result) },
  onFailed: function (result) { console.log(result) }
});
// example onSuccess output:
{
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320522,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0x0f6152b9a39055b34bc092d9e96e852e3137e3d42f4e78b1dc5848f8b2abf12f",
  input: "0x5fd65fba0000000000000000000000009368ff3e9ce1c0459b309fac6dd4e69229b91a42",
  nonce: "0xfc",
  r: "0x706eb8aee04faf21fd6da949f946df5fa118da35a619560af9b81fc05054715c",
  s: "0x60d3125aa3b1daabd37618fb80232037cdaef9c87a8d262826880f0e57fdb0d3",
  timestamp: 1501003133,
  to: "0xa7f3659c53820346176f7e0e350780df304db179",
  v: "0x2c",
  value: "0x0"
}

Claim Trading Proceeds Contract Code

augur.api.ClaimTradingProceeds.claimTradingProceeds({ _market, onSent, onSuccess, onFailed })

The claimTradingProceeds 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 _market = "0x9368ff3e9ce1c0459b309fac6dd4e69229b91a42";
var _amount = "50000000000000000000" // 50.0

augur.api.CompleteSets.publicBuyCompleteSets({
  _market: _market,
  _amount: _amount,
  onSent: function (result) { console.log(result) },
  onSuccess: function (result) { console.log(result) },
  onFailed: function (result) { console.log(result) }
});
// example onSuccess output:
{
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320523,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0xc77149d6a3fef8755a20aa2100fc79c02ca7dd198d6f3c65aabe638883d8d017",
  input: "0xfadc758a0000000000000000000000009368ff3e9ce1c0459b309fac6dd4e69229b91a42000000000000000000000000000000000000000000000002b5e3af16b1880000",
  nonce: "0xfd",
  r: "0x706eb8aee04faf21fd6da949f946df5fa118da35a619560af9b81fc05054715c",
  s: "0x60d3125aa3b1daabd37618fb80232037cdaef9c87a8d262826880f0e57fdb0d3",
  timestamp: 1501003133,
  to: "0xa7f3659c53820346176f7e0e350780df304db179",
  v: "0x2c",
  value: "0x0"
}

augur.api.CompleteSets.publicSellCompleteSets({
  _market: _market,
  _amount: _amount,
  onSent: function (result) { console.log(result) },
  onSuccess: function (result) { console.log(result) },
  onFailed: function (result) { console.log(result) }
});
// example onSuccess output:
{
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320524,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0x21121bf9a8d32969b5ce4d53b6021ad6b7b5e7c658e9d98d582c720c8abce220",
  input: "0x04b586670000000000000000000000009368ff3e9ce1c0459b309fac6dd4e69229b91a42000000000000000000000000000000000000000000000002b5e3af16b1880000",
  nonce: "0xfe",
  r: "0x706eb8aee04faf21fd6da949f946df5fa118da35a619560af9b81fc05054715c",
  s: "0x60d3125aa3b1daabd37618fb80232037cdaef9c87a8d262826880f0e57fdb0d3",
  timestamp: 1501003133,
  to: "0xa7f3659c53820346176f7e0e350780df304db179",
  v: "0x2c",
  value: "0x0"
}

Complete Sets Contract Code

augur.api.CompleteSets.publicBuyCompleteSets({ _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({ _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.

Create Order Tx API

// Make Order Contract Transaction API Examples:
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 = "0x0000000000000000000000000000000000000000000000000000000000000001";

augur.api.CreateOrder.publicCreateOrder({
  _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 onSuccess output:
{
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320525,
  callReturn: "0x5f80029d47ca806002b6b6bbbb0077124f8da9b69a885f7714907bd773bcf8a7",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0xcf6729b0e27fffc81c4f5c824992a780daf1f41bf590c7f62f16777edbc2c08e",
  input: "0x138dcef200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000008ac7230489e8000000000000000000000000000000000000000000000000000000000000fffffff1000000000000000000000000d3273eba07248020bf98a8b560ec1576a612102f0000000000000000000000000000000000000000000000000000000000000001ea2c7476e61f5e2625e57df17fcce74741d3c2004ac657675f686a23d06e6091ed42c0fab97ee6fbde7c47dc62dc3ad09e8d3af53517245c77c659f7cd5614260000000000000000000000000000000000000000000000000000000000000001",
  nonce: "0xff",
  r: "0x706eb8aee04faf21fd6da949f946df5fa118da35a619560af9b81fc05054715c",
  s: "0x60d3125aa3b1daabd37618fb80232037cdaef9c87a8d262826880f0e57fdb0d3",
  timestamp: 1501003133,
  to: "0xa7f3659c53820346176f7e0e350780df304db179",
  v: "0x2c",
  value: "0x0"
}

Create Order Contract Code

augur.api.CreateOrder.publicCreateOrder({ _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.

Dispute Bond Tx API

// Dispute Bond Contract Transaction API Examples:
var disputeBond = "0xe5d6eaefcfaf7ea1e17c4768a554d57800699ea4";
var _newOwner = "0xaa895acf2091752393384b902f813da761ca421f";

augur.api.DisputeBond.transferOwnership({
  disputeBond: disputeBond,
  _newOwner: _newOwner,
  onSent: function (result) { console.log(result) },
  onSuccess: function (result) { console.log(result) },
  onFailed: function (result) { console.log(result) }
});
// example onSuccess output:
{
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320480,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0x6b0f32ca16855ab6a680ebff87f63837c78e1fcdd94f909cac9acf7768e73384",
  input: "0x86744558000000000000000000000000aa895acf2091752393384b902f813da761ca421f0000000000000000000000000000000000000000000000000000000000000001",
  nonce: "0x1",
  r: "0x706eb8aee04faf21fd6da949f946df5fa118da35a619560af9b81fc05054715c",
  s: "0x60d3125aa3b1daabd37618fb80232037cdaef9c87a8d262826880f0e57fdb0d3",
  timestamp: 1501003133,
  to: "0xa7f3659c53820346176f7e0e350780df304db179",
  v: "0x2c",
  value: "0x0"
}

augur.api.DisputeBond.withdraw({
  disputeBond: disputeBond,
  onSent: function (result) { console.log(result) },
  onSuccess: function (result) { console.log(result) },
  onFailed: function (result) { console.log(result) }
});
// example onSuccess output:
{
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320481,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0xf5681056bab571e0ec73411896a3e8f7a7b610e43f148ea96cd06f66a2e8472a",
  input: "0x3ccfd60b",
  nonce: "0x3",
  r: "0x706eb8aee04faf21fd6da949f946df5fa118da35a619560af9b81fc05054715c",
  s: "0x60d3125aa3b1daabd37618fb80232037cdaef9c87a8d262826880f0e57fdb0d3",
  timestamp: 1501003133,
  to: "0xa7f3659c53820346176f7e0e350780df304db179",
  v: "0x2c",
  value: "0x0"
}

augur.api.DisputeBond.withdrawDisavowedTokens({
  disputeBond: disputeBond,
  onSent: function (result) { console.log(result) },
  onSuccess: function (result) { console.log(result) },
  onFailed: function (result) { console.log(result) }
});
// example onSuccess output:
{
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320482,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0xf5681056bab571e0ec73411896a3e8f7a7b610e43f148ea96cd06f66a2e8472a",
  input: "0x3ccfd60b",
  nonce: "0x3",
  r: "0x706eb8aee04faf21fd6da949f946df5fa118da35a619560af9b81fc05054715c",
  s: "0x60d3125aa3b1daabd37618fb80232037cdaef9c87a8d262826880f0e57fdb0d3",
  timestamp: 1501003133,
  to: "0xa7f3659c53820346176f7e0e350780df304db179",
  v: "0x2c",
  value: "0x0"
}

augur.api.DisputeBond.withdrawInEmergency({
  disputeBond: disputeBond,
  onSent: function (result) { console.log(result) },
  onSuccess: function (result) { console.log(result) },
  onFailed: function (result) { console.log(result) }
});
// example onSuccess output:
{
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320483,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0xf5681056bab571e0ec73411896a3e8f7a7b610e43f148ea96cd06f66a2e8472a",
  input: "0x00000001",
  nonce: "0x3",
  r: "0x706eb8aee04faf21fd6da949f946df5fa118da35a619560af9b81fc05054715c",
  s: "0x60d3125aa3b1daabd37618fb80232037cdaef9c87a8d262826880f0e57fdb0d3",
  timestamp: 1501003133,
  to: "0xa7f3659c53820346176f7e0e350780df304db179",
  v: "0x2c",
  value: "0x0"
}

var _shadyUniverse = "0x580f633f475614636ee132a0a355dcdc826d16c8";
augur.api.DisputeBond.withdrawToUniverse({
  disputeBond: disputeBond,
  _shadyUniverse: _shadyUniverse,
  onSent: function (result) { console.log(result) },
  onSuccess: function (result) { console.log(result) },
  onFailed: function (result) { console.log(result) }
});
// example onSuccess output:
{
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320484,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0xd3a9a88dd49f9eb485498190013fe8004df40a2549e5c2f3aafb452aab0a7a98",
  input: "0x8ac17bbb000000000000000000000000580f633f475614636ee132a0a355dcdc826d16c8",
  nonce: "0x4",
  r: "0x706eb8aee04faf21fd6da949f946df5fa118da35a619560af9b81fc05054715c",
  s: "0x60d3125aa3b1daabd37618fb80232037cdaef9c87a8d262826880f0e57fdb0d3",
  timestamp: 1501003133,
  to: "0xa7f3659c53820346176f7e0e350780df304db179",
  v: "0x2c",
  value: "0x0"
}

Dispute Bond 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.DisputeBond.transferOwnership({ disputeBond, _newOwner, onSent, onSuccess, onFailed })

The transferOwnership transaction will change the current bond holder to the specified _newOwner. This is used to transfer ownership of a Dispute Bond from one address to another. This transaction will fail if the msg.sender isn’t the bond holder of the specified disputeBond.

augur.api.DisputeBond.withdraw({ disputeBond, onSent, onSuccess, onFailed })

This transaction is used by the bond holder of the specified disputeBond to withdraw Reputation Tokens earned by correctly Challenging the Proposed Outcome of the disputeBond’s Market. This transaction will fail if the msg.sender isn’t the bond holder for the specified disputeBond, if the Market for the disputeBond isn’t Finalized, if the Market is Finalized but the final Payout Distribution Hash is the same Distribution Hash Challenged by the disputeBond, or if the disputeBond’s Market isn’t Finalized.

augur.api.DisputeBond.withdrawDisavowedTokens({ disputeBond, onSent, onSuccess, onFailed })

This transaction is used by the bond holder of the specified disputeBond to withdraw Reputation Tokens in the event that another Market forks. This transaction will fail if the msg.sender isn’t the bond holder for the specified disputeBond or if the Market for the disputeBond is the Forked Market.

augur.api.DisputeBond.withdrawInEmergency({ disputeBond, onSent, onSuccess, onFailed })

If a critical bug or vulnerability is found in Augur, the development team can put it the system into a haulted state until the issue is resolved. In such instances, most regularly-used functions in Augur’s backend will become unuseable until the system is returned to its normal state. When this happens, users can call the withdrawInEmergency function to withdraw their Dispute Bond and convert it into a Reputation Token.

This transaction will fail if Augur is not currently in a haulted state.

It returns true if the Dispute Bond was successfully withdrawn and converted to a Reputation Token. (NOTE: The return value cannot be obtained reliably when calling externally.)

augur.api.DisputeBond.withdrawToUniverse({ disputeBond, _shadyUniverse, onSent, onSuccess, onFailed })

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

Fill Order Tx API

// Fill Order Contract Transaction API Examples:
var _orderId = "0xea2c7476e61f5e2625e57df17fcce74741d3c2004ac657675f686a23d06e6091";
var _amountFillerWants = "10000000000000000000"; // 10.0
var _tradeGroupId = "0x0000000000000000000000000000000000000000000000000000000000000002";

augur.api.FillOrder.publicFillOrder({
  _orderId: _orderId,
  _amountFillerWants: _amountFillerWants,
  _tradeGroupId: _tradeGroupId,
  onSent: function (result) { console.log(result) },
  onSuccess: function (result) { console.log(result) },
  onFailed: function (result) { console.log(result) }
});
// example onSuccess output:
{
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320529,
  callReturn: "0",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0x3efb4102dc3b9e1bb145ca21310233646a4eba24894b04f12ee4d390281301ac",
  input: "0x49a2cba0ea2c7476e61f5e2625e57df17fcce74741d3c2004ac657675f686a23d06e60910000000000000000000000000000000000000000000000008ac7230489e800000000000000000000000000000000000000000000000000000000000000000001",
  nonce: "0xff4",
  r: "0x706eb8aee04faf21fd6da949f946df5fa118da35a619560af9b81fc05054715c",
  s: "0x60d3125aa3b1daabd37618fb80232037cdaef9c87a8d262826880f0e57fdb0d3",
  timestamp: 1501003133,
  to: "0xa7f3659c53820346176f7e0e350780df304db179",
  v: "0x2c",
  value: "0x0"
}

Fill Order Contract Code

augur.api.FillOrder.publicFillOrder({ _orderID, _amountFillerWants, _tradeGroupID, onSent, onSuccess, onFailed })

Given an _orderId and the amount a Filler wants as _amountFillerWants denoted in attoshares this transaction will attempt to fill the order specified. If the _amountFillerWants 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 _amountFillerWants value that the filler requests. This transaction requires _orderId and _amountFillerWants are defined. The Creator 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.

Mailbox Tx API

// Mailbox Contract Transaction API Examples:
var mailbox = "0x9368ff3e9ce1c0459b309fac6dd4e69229b91a42";
augur.api.Mailbox.transferOwnership({
  mailbox: mailbox,
  onSent: function (result) { console.log(result) },
  onSuccess: function (result) { console.log(result) },
  onFailed: function (result) { console.log(result) }
})
// example onSuccess output:
{
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320488,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0x6544da2190a54542e95473a6c9b18b7259480b8b48953eaa750d3e1379d8ccd6",
  input: "0x4c92c4b38832d970d090b6403905de4ec2d1ae0adf4ca4972343c27fa86f7c61ea62e250",
  nonce: "0x4",
  r: "0x706eb8aee04faf21fd6da949f946df5fa118da35a619560af9b81fc05054715c",
  s: "0x60d3125aa3b1daabd37618fb80232037cdaef9c87a8d262826880f0e57fdb0d3",
  timestamp: 1501003133,
  to: "0xa7f3659c53820346176f7e0e350780df304db179",
  v: "0x2c",
  value: "0x0"
}

augur.api.Mailbox.withdrawEther({
  mailbox: mailbox,
  onSent: function (result) { console.log(result) },
  onSuccess: function (result) { console.log(result) },
  onFailed: function (result) { console.log(result) }
})
// example onSuccess output:
{
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320489,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0x6544da2190a54542e95473a6c9b18b7259480b8b48953eaa750d3e1379d8ccd6",
  input: "0x4c92c4b38832d970d090b6403905de4ec2d1ae0adf4ca4972343c27fa86f7c61ea62e250",
  nonce: "0x4",
  r: "0x706eb8aee04faf21fd6da949f946df5fa118da35a619560af9b81fc05054715c",
  s: "0x60d3125aa3b1daabd37618fb80232037cdaef9c87a8d262826880f0e57fdb0d3",
  timestamp: 1501003133,
  to: "0xa7f3659c53820346176f7e0e350780df304db179",
  v: "0x2c",
  value: "0x0"
}

var _repToken = "0x9368ff3e9ce1c0459b309fac6dd4e69229b91a42";
augur.api.Mailbox.withdrawTokens({
  mailbox: mailbox,
  token: _repToken,
  onSent: function (result) { console.log(result) },
  onSuccess: function (result) { console.log(result) },
  onFailed: function (result) { console.log(result) }
})
// example onSuccess output:
{
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320489,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0x6544da2190a54542e95473a6c9b18b7259480b8b48953eaa750d3e1379d8ccd6",
  input: "0x4c92c4b38832d970d090b6403905de4ec2d1ae0adf4ca4972343c27fa86f7c61ea62e250",
  nonce: "0x4",
  r: "0x706eb8aee04faf21fd6da949f946df5fa118da35a619560af9b81fc05054715c",
  s: "0x60d3125aa3b1daabd37618fb80232037cdaef9c87a8d262826880f0e57fdb0d3",
  timestamp: 1501003133,
  to: "0xa7f3659c53820346176f7e0e350780df304db179",
  v: "0x2c",
  value: "0x0"
}

Mailbox Contract Code

augur.api.Mailbox.transferOwnership({ mailbox, _newOwner, onSent, onSuccess, onFailed })

The transferOwnership transaction will change the current Market Creator Mailbox owner to the specified _newOwner. This transaction will fail if the msg.sender isn’t the owner of the specified mailbox.

augur.api.Mailbox.withdrawEther({ mailbox, onSent, onSuccess, onFailed })

Transfers all ETH in the Market Creator Mailbox to the Market Creator’s address. This transaction will fail if the msg.sender isn’t the owner of the specified mailbox.

augur.api.Mailbox.withdrawTokens({ mailbox, _token, onSent, onSuccess, onFailed })

Transfers all tokens of type _token in the Market Creator Mailbox to the Market Creator’s address. This transaction will fail if the msg.sender isn’t the owner of the specified mailbox.

Market Tx API

// Market Contract Transaction API Examples:
var market = "0x9368ff3e9ce1c0459b309fac6dd4e69229b91a42";
var _payoutNumerators = [ 0, 1000 ];

var _invalid = false;
augur.api.Market.derivePayoutDistributionHash({
  market: market,
  _payoutNumerators: _payoutNumerators,
  _invalid: _invalid,
  onSent: function (result) { console.log(result) },
  onSuccess: function (result) { console.log(result) },
  onFailed: function (result) { console.log(result) }
})
// example onSuccess output:
{
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320488,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0x6544da2190a54542e95473a6c9b18b7259480b8b48953eaa750d3e1379d8ccd6",
  input: "0x4c92c4b38832d970d090b6403905de4ec2d1ae0adf4ca4972343c27fa86f7c61ea62e250",
  nonce: "0x4",
  r: "0x706eb8aee04faf21fd6da949f946df5fa118da35a619560af9b81fc05054715c",
  s: "0x60d3125aa3b1daabd37618fb80232037cdaef9c87a8d262826880f0e57fdb0d3",
  timestamp: 1501003133,
  to: "0xa7f3659c53820346176f7e0e350780df304db179",
  v: "0x2c",
  value: "0x0"
}

augur.api.Market.disavowTokens({
  market: market,
  onSent: function (result) { console.log(result) },
  onSuccess: function (result) { console.log(result) },
  onFailed: function (result) { console.log(result) }
})
// example onSuccess output:
{
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320490,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0x0193add7b8dc3868944cb8b7748ab53cec5a2d9f5041f882b04b0bf0a31e1ff2",
  input: "0xf12afe02",
  nonce: "0x5",
  r: "0x706eb8aee04faf21fd6da949f946df5fa118da35a619560af9b81fc05054715c",
  s: "0x60d3125aa3b1daabd37618fb80232037cdaef9c87a8d262826880f0e57fdb0d3",
  timestamp: 1501003133,
  to: "0xa7f3659c53820346176f7e0e350780df304db179",
  v: "0x2c",
  value: "0x0"
}

var _payoutNumerators = [5,10,25,60];
var _attotokens = 100;
var _invalid = false;
augur.api.Market.disputeDesignatedReport({
  market: market,
  _payoutNumerators: _payoutNumerators, 
  _attotokens: _attotokens,
  _invalid: _invalid
  onSent: function (result) { console.log(result) },
  onSuccess: function (result) { console.log(result) },
  onFailed: function (result) { console.log(result) }
})
// example onSuccess output:
{
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320490,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0xd0d81785960bb128c35748e018ad52e599a80921c39ac02adabdaeb4a23d926c",
  input: "0x83b58638000000000000000000000000ea674fdde714fd979de3edf0f56aa9716b898ec80000000000000000000000000000000000000000000000056bc75e2d63100000",
  nonce: "0x6",
  r: "0x706eb8aee04faf21fd6da949f946df5fa118da35a619560af9b81fc05054715c",
  s: "0x60d3125aa3b1daabd37618fb80232037cdaef9c87a8d262826880f0e57fdb0d3",
  timestamp: 1501003133,
  to: "0xa7f3659c53820346176f7e0e350780df304db179",
  v: "0x2c",
  value: "0x0"
}

augur.api.Market.disputeFirstReporters({
  market: market,
  _payoutNumerators: _payoutNumerators,
  _attotokens: _attotokens,
  _invalid: _invalid,
  onSent: function (result) { console.log(result) },
  onSuccess: function (result) { console.log(result) },
  onFailed: function (result) { console.log(result) }
})
// example onSuccess output:
{
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320491,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0xd3f644e8904966909a9d974c7ed63ae8ddbb0f23d824f576764afddd7023ef88",
  input: "0x83b58638000000000000000000000000ea674fdde714fd979de3edf0f56aa9716b898ec80000000000000000000000000000000000000000000000056bc75e2d63100000",
  nonce: "0x7",
  r: "0x706eb8aee04faf21fd6da949f946df5fa118da35a619560af9b81fc05054715c",
  s: "0x60d3125aa3b1daabd37618fb80232037cdaef9c87a8d262826880f0e57fdb0d3",
  timestamp: 1501003133,
  to: "0xa7f3659c53820346176f7e0e350780df304db179",
  v: "0x2c",
  value: "0x0"
}

augur.api.Market.disputeLastReporters({
  market: market,
  onSent: function (result) { console.log(result) },
  onSuccess: function (result) { console.log(result) },
  onFailed: function (result) { console.log(result) }
})
// example onSuccess output:
{
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320489,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0x80dbc117b8dc3868944cb8b7748ab53cec5a2d9f5041f882b04b0bf8a88e6172",
  input: "0x99ea0fd5",
  nonce: "0x5",
  r: "0x706eb8aee04faf21fd6da949f946df5fa118da35a619560af9b81fc05054715c",
  s: "0x60d3125aa3b1daabd37618fb80232037cdaef9c87a8d262826880f0e57fdb0d3",
  timestamp: 1501003133,
  to: "0xa7f3659c53820346176f7e0e350780df304db179",
  v: "0x2c",
  value: "0x0"
}

augur.api.Market.getOrCreateStakeToken({ 
  _payoutNumerators: _payoutNumerators, 
  _invalid: _invalid,
  onSent: function (result) { console.log(result) },
  onSuccess: function (result) { console.log(result) },
  onFailed: function (result) { console.log(result) }
}
// example onSuccess output:
{
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320489,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0x80dbc117b8dc3868944cb8b7748ab53cec5a2d9f5041f882b04b0bf8a88e6172",
  input: "0x99ea0fd5",
  nonce: "0x5",
  r: "0x706eb8aee04faf21fd6da949f946df5fa118da35a619560af9b81fc05054715c",
  s: "0x60d3125aa3b1daabd37618fb80232037cdaef9c87a8d262826880f0e57fdb0d3",
  timestamp: 1501003133,
  to: "0xa7f3659c53820346176f7e0e350780df304db179",
  v: "0x2c",
  value: "0x0"
}

augur.api.Market.migrateDueToNoReports({
  market: market,
  onSent: function (result) { console.log(result) },
  onSuccess: function (result) { console.log(result) },
  onFailed: function (result) { console.log(result) }
})
// example onSuccess output:
{
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320491,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0x76acc0f6322ec26e9623158f0b377777b8c7c3e4b4e700de08b39cf8accc39e5",
  input: "0x2c10270f",
  nonce: "0x7",
  r: "0x706eb8aee04faf21fd6da949f946df5fa118da35a619560af9b81fc05054715c",
  s: "0x60d3125aa3b1daabd37618fb80232037cdaef9c87a8d262826880f0e57fdb0d3",
  timestamp: 1501003133,
  to: "0xa7f3659c53820346176f7e0e350780df304db179",
  v: "0x2c",
  value: "0x0"
}

augur.api.Market.migrateThroughAllForks({
  market: market,
  onSent: function (result) { console.log(result) },
  onSuccess: function (result) { console.log(result) },
  onFailed: function (result) { console.log(result) }
})
// example onSuccess output:
{
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320492,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0x32bf0849d589b6dd639791c7ea49579ea654a648c41b3a614878d77608ef1b07",
  input: "0x00987265",
  nonce: "0x8",
  r: "0x706eb8aee04faf21fd6da949f946df5fa118da35a619560af9b81fc05054715c",
  s: "0x60d3125aa3b1daabd37618fb80232037cdaef9c87a8d262826880f0e57fdb0d3",
  timestamp: 1501003133,
  to: "0xa7f3659c53820346176f7e0e350780df304db179",
  v: "0x2c",
  value: "0x0"
}

augur.api.Market.migrateThroughOneFork({
  market: market,
  onSent: function (result) { console.log(result) },
  onSuccess: function (result) { console.log(result) },
  onFailed: function (result) { console.log(result) }
})
// example onSuccess output:
{
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320493,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0x32bf0849d589b6dd639791c7ea49579ea654a648c41b3a614878d77608ef1b07",
  input: "0x069b559c",
  nonce: "0x9",
  r: "0x706eb8aee04faf21fd6da949f946df5fa118da35a619560af9b81fc05054715c",
  s: "0x60d3125aa3b1daabd37618fb80232037cdaef9c87a8d262826880f0e57fdb0d3",
  timestamp: 1501003133,
  to: "0xa7f3659c53820346176f7e0e350780df304db179",
  v: "0x2c",
  value: "0x0"
}

augur.api.Market.tryFinalize({
  market: market,
  onSent: function (result) { console.log(result) },
  onSuccess: function (result) { console.log(result) },
  onFailed: function (result) { console.log(result) }
})
// example onSuccess output:
{
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320494,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0x6b506f0f96381638635948aa0969f4fbb0e918b7a752643cbe7619f0c1f9fc67",
  input: "0x338e579e",
  nonce: "0xa",
  r: "0x706eb8aee04faf21fd6da949f946df5fa118da35a619560af9b81fc05054715c",
  s: "0x60d3125aa3b1daabd37618fb80232037cdaef9c87a8d262826880f0e57fdb0d3",
  timestamp: 1501003133,
  to: "0xa7f3659c53820346176f7e0e350780df304db179",
  v: "0x2c",
  value: "0x0"
}

var _payoutDistributionHash = "0x4480ed40f94e2cb2ca244eb862df2d350300904a96039eb53cba0e34b8ace90a";
augur.api.Market.updateTentativeWinningPayoutDistributionHash({
  market: market,
  _payoutDistributionHash: _payoutDistributionHash,
  onSent: function (result) { console.log(result) },
  onSuccess: function (result) { console.log(result) },
  onFailed: function (result) { console.log(result) }
})
// example onSuccess output:
{
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320499,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0x7c5aff31c3c88edfb03d10ced2c561a7464326a6941db1eee868c0a46e7fc77d",
  input: "0xe36cd6e04480ed40f94e2cb2ca244eb862df2d350300904a96039eb53cba0e34b8ace90a",
  nonce: "0xf",
  r: "0x706eb8aee04faf21fd6da949f946df5fa118da35a619560af9b81fc05054715c",
  s: "0x60d3125aa3b1daabd37618fb80232037cdaef9c87a8d262826880f0e57fdb0d3",
  timestamp: 1501003133,
  to: "0xa7f3659c53820346176f7e0e350780df304db179",
  v: "0x2c",
  value: "0x0"
}

augur.api.Market.withdrawInEmergency {
  market: market,
  onSent: function (result) { console.log(result) },
  onSuccess: function (result) { console.log(result) },
  onFailed: function (result) { console.log(result) }
}
// example onSuccess output:
{
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320500,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0xf5681056bab571e0ec73411896a3e8f7a7b610e43f148ea96cd06f66a2e8472a",
  input: "0x00000001",
  nonce: "0x3",
  r: "0x706eb8aee04faf21fd6da949f946df5fa118da35a619560af9b81fc05054715c",
  s: "0x60d3125aa3b1daabd37618fb80232037cdaef9c87a8d262826880f0e57fdb0d3",
  timestamp: 1501003133,
  to: "0xa7f3659c53820346176f7e0e350780df304db179",
  v: "0x2c",
  value: "0x0"
}

Market Contract Code

augur.api.Market.derivePayoutDistributionHash({ market, _payoutNumerators, _invalid, onSent, onSuccess, onFailed })

Returns the Payout Distribution Hash for the _payoutNumerators and _invalid 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 and _invalid using keccak256.

augur.api.Market.disavowTokens({ 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({ 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. If the caller of this function would like to increase the number of Stake Tokens he or she has on an outcome other than the one reported by the Designated Reporter, that can be done by passing in an amount greater than 0 for _attotokens equal to the amount of Stake Tokens he or she would like to purchase. Additionally, _payoutNumerators should be an array of the specific Payout Set desired, and _invalid should be set to true or false, depending on whether the caller thinks the market should be resolved as invalid. Alternatively, if the caller does not wish to increase his or her amount of Stake Tokens on a particular outcome, these parameters will be ignored as long as _attotokens is less than 1.

augur.api.Market.disputeFirstReporters({ market, _payoutNumerators, _attotokens, _invalid, 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. If the caller of this function would like to increase the number of Stake Tokens he or she has on an outcome other than the one reported by the First Reporters, that can be done by passing in an amount greater than 0 for _attotokens equal to the amount of Stake Tokens he or she would like to purchase. Additionally, _payoutNumerators should be an array of the specific Payout Set desired, and _invalid should be set to true or false, depending on whether the caller thinks the market should be resolved as invalid. Alternatively, if the caller does not wish to increase his or her amount of Stake Tokens on a particular outcome, these parameters will be ignored as long as _attotokens is less than 1.

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

disputeLastReporters 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.getOrCreateStakeToken({ _payoutNumerators, _invalid , onSent, onSuccess, onFailed })

Returns the Stake Token address for _payoutNumerators and _invalid on the market specified. (If the Stake Token with the specified payoutNumerators does not exist, it will be created.) 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.migrateDueToNoReports({ 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({ 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({ 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.transferOwnership({ market, _newOwner, onSent, onSuccess, onFailed })

The transferOwnership transaction will change the current Market owner to the specified _newOwner. This is used to transfer ownership of a Market from one address to another. This transaction will fail if the msg.sender isn’t the owner of the specified market.

augur.api.Market.tryFinalize({ 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({ 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.

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

If a critical bug or vulnerability is found in Augur, the development team can put it the system into a haulted state until the issue is resolved. In such instances, most regularly-used functions in Augur’s backend will become unuseable until the system is returned to its normal state. When this happens, users can call the withdrawInEmergency function to withdraw their Reputation Tokens from a particular Market.

This transaction will fail if Augur is not currently in a haulted state.

It returns true if the Reputation Tokens were successfully withdrawn from the Market. (NOTE: The return value cannot be obtained reliably when calling externally.)

Participation Token Tx API

// Participation Token Transaction API Examples:
var participationToken = "0xe5d6eaefcfaf7ea1e17c4768a554d57800699ea4";
var _attotokens = 100;

augur.api.ParticipationToken.buy({
  participationToken: participationToken,
  _attotokens: _attotokens,
  onSent: function (result) { console.log(result) },
  onSuccess: function (result) { console.log(result) },
  onFailed: function (result) { console.log(result) }
});
// example onSuccess output:
{
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320486,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0xf5681056bab571e0ec73411896a3e8f7a7b610e43f148ea96cd06f66a2e8472a",
  input: "0x0000000000000000000000000000000000000000000000000000000000000100",
  nonce: "0x3",
  r: "0x706eb8aee04faf21fd6da949f946df5fa118da35a619560af9b81fc05054715c",
  s: "0x60d3125aa3b1daabd37618fb80232037cdaef9c87a8d262826880f0e57fdb0d3",
  timestamp: 1501003133,
  to: "0xa7f3659c53820346176f7e0e350780df304db179",
  v: "0x2c",
  value: "0x0"
}

var _forgoFees = true;
augur.api.ParticipationToken.redeem({
  participationToken: participationToken,
  _forgoFees: _forgoFees,
  onSent: function (result) { console.log(result) },
  onSuccess: function (result) { console.log(result) },
  onFailed: function (result) { console.log(result) }
});
// example onSuccess output:
{
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320487,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0xf5681056bab571e0ec73411896a3e8f7a7b610e43f148ea96cd06f66a2e8472a",
  input: "0x00000001",
  nonce: "0x3",
  r: "0x706eb8aee04faf21fd6da949f946df5fa118da35a619560af9b81fc05054715c",
  s: "0x60d3125aa3b1daabd37618fb80232037cdaef9c87a8d262826880f0e57fdb0d3",
  timestamp: 1501003133,
  to: "0xa7f3659c53820346176f7e0e350780df304db179",
  v: "0x2c",
  value: "0x0"
}

augur.api.ParticipationToken.withdrawInEmergency({
  participationToken: participationToken,
  onSent: function (result) { console.log(result) },
  onSuccess: function (result) { console.log(result) },
  onFailed: function (result) { console.log(result) }
});
// example onSuccess output:
{
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320488,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0xf5681056bab571e0ec73411896a3e8f7a7b610e43f148ea96cd06f66a2e8472a",
  input: "0x00000001",
  nonce: "0x3",
  r: "0x706eb8aee04faf21fd6da949f946df5fa118da35a619560af9b81fc05054715c",
  s: "0x60d3125aa3b1daabd37618fb80232037cdaef9c87a8d262826880f0e57fdb0d3",
  timestamp: 1501003133,
  to: "0xa7f3659c53820346176f7e0e350780df304db179",
  v: "0x2c",
  value: "0x0"
}

Participation Token Contract Code

augur.api.ParticipationToken.buy({ participationToken, _attotokens, onSent, onSuccess, onFailed })

Purchases the number of participation tokens specified by _attotokens.

This transaction will fail if:

Returns: true if the Participation Tokens were successfully purchased. (NOTE: The return value cannot be obtained reliably when calling externally.)

augur.api.ParticipationToken.redeem({ participationToken, _forgoFees, onSent, onSuccess, onFailed })

Converts the user’s Participation Tokens to Reputation Tokens. Due to the fact that Markets can sometimes take months to Finalize (and, therefore, fees can take months to claim), the parameter forgoFees can be set to true if the user would like to redeem his or her Participation Tokens immediately without having to wait.

This transaction will fail if msg.sender does not have any Participation Tokens.

It returns true if the Participation Tokens were successfully withdrawn and converted to Reputation Tokens. (NOTE: The return value cannot be obtained reliably when calling externally.)

augur.api.ParticipationToken.withdrawInEmergency({ participationToken, onSent, onSuccess, onFailed })

If a critical bug or vulnerability is found in Augur, the development team can put it the system into a haulted state until the issue is resolved. In such instances, most regularly-used functions in Augur’s backend will become unuseable until the system is returned to its normal state. When this happens, users can call the withdrawInEmergency function to withdraw their Participation Tokens and convert them into Reputation Tokens.

This transaction will fail if Augur is not currently in a haulted state.

It returns true if the Participation Tokens were successfully withdrawn and converted to Reputation Tokens. (NOTE: The return value cannot be obtained reliably when calling externally.)

Reputation Token Tx API

// Reputation Token Contract Transaction API Examples:
var reputationToken = "0x2a73cec0b62fcb8c3120bc80bdb2b1351c8c2d1e";
var _spender = "0xea674fdde714fd979de3edf0f56aa9716b898ec8";
var _from = "0x1a05071893b764109f0bbc5b75d78e3e38b69ab3";
var _value = "100000000000000000000";

augur.api.ReputationToken.approve({
  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 onSuccess output:
{
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320512,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0x915f8f0b13244b0dd9b7377b252d9245ef0fc109c82931a87410d1bdad671fe6",
  input: "0x83b58638000000000000000000000000ea674fdde714fd979de3edf0f56aa9716b898ec80000000000000000000000000000000000000000000000056bc75e2d63100000",
  nonce: "0xf2",
  r: "0x706eb8aee04faf21fd6da949f946df5fa118da35a619560af9b81fc05054715c",
  s: "0x60d3125aa3b1daabd37618fb80232037cdaef9c87a8d262826880f0e57fdb0d3",
  timestamp: 1501003133,
  to: "0xa7f3659c53820346176f7e0e350780df304db179",
  v: "0x2c",
  value: "0x0"
}

augur.api.ReputationToken.migrateFromLegacyReputationToken({
  reputationToken: reputationToken,
  onSent: function (result) { console.log(result) },
  onSuccess: function (result) { console.log(result) },
  onFailed: function (result) { console.log(result) }
});
// example onSuccess output:
{
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320513,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0xf1eb499764e9422d51a37b3567bb2513c022d63524518d520a9d4eabad0f0238",
  input: "0x3a15e7ca",
  nonce: "0xf3",
  r: "0x706eb8aee04faf21fd6da949f946df5fa118da35a619560af9b81fc05054715c",
  s: "0x60d3125aa3b1daabd37618fb80232037cdaef9c87a8d262826880f0e57fdb0d3",
  timestamp: 1501003133,
  to: "0xa7f3659c53820346176f7e0e350780df304db179",
  v: "0x2c",
  value: "0x0"
}

var _destination = "0x73295d3c0ca46113ca226222c81c79adabf9f391";
augur.api.ReputationToken.migrateOut({
  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 onSuccess output:
{
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320514,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0xeddcfa199671312d7dd90eba2895da3104801ab05220758c62bbc6ef059f6057",
  input: "0x5ca7a72700000000000000000000000073295d3c0ca46113ca226222c81c79adabf9f3910000000000000000000000001a05071893b764109f0bbc5b75d78e3e38b69ab30000000000000000000000000000000000000000000000056bc75e2d63100000",
  nonce: "0xf4",
  r: "0x706eb8aee04faf21fd6da949f946df5fa118da35a619560af9b81fc05054715c",
  s: "0x60d3125aa3b1daabd37618fb80232037cdaef9c87a8d262826880f0e57fdb0d3",
  timestamp: 1501003133,
  to: "0xa7f3659c53820346176f7e0e350780df304db179",
  v: "0x2c",
  value: "0x0"
}

augur.api.ReputationToken.transfer({
  reputationToken: reputationToken,
  _to: _spender,
  _value,
  onSent: function (result) { console.log(result) },
  onSuccess: function (result) { console.log(result) },
  onFailed: function (result) { console.log(result) }
});
// example onSuccess output:
{
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320515,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0x8f92137eff5e7824423ff6e79e15188b61d9dd9244fd2c436b020de6d8e721fe",
  input: "0x86744558000000000000000000000000ea674fdde714fd979de3edf0f56aa9716b898ec80000000000000000000000000000000000000000000000056bc75e2d63100000",
  nonce: "0xf5",
  r: "0x706eb8aee04faf21fd6da949f946df5fa118da35a619560af9b81fc05054715c",
  s: "0x60d3125aa3b1daabd37618fb80232037cdaef9c87a8d262826880f0e57fdb0d3",
  timestamp: 1501003133,
  to: "0xa7f3659c53820346176f7e0e350780df304db179",
  v: "0x2c",
  value: "0x0"
}

augur.api.ReputationToken.transferFrom({
  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 onSuccess output:
{
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320516,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0x2c678df877e01d343a4e7701b92dddcecafc095fd1e4d90423838cd73eadb7d7",
  input: "0x27f08b000000000000000000000000001a05071893b764109f0bbc5b75d78e3e38b69ab3000000000000000000000000ea674fdde714fd979de3edf0f56aa9716b898ec80000000000000000000000000000000000000000000000056bc75e2d63100000",
  nonce: "0xf6",
  r: "0x706eb8aee04faf21fd6da949f946df5fa118da35a619560af9b81fc05054715c",
  s: "0x60d3125aa3b1daabd37618fb80232037cdaef9c87a8d262826880f0e57fdb0d3",
  timestamp: 1501003133,
  to: "0xa7f3659c53820346176f7e0e350780df304db179",
  v: "0x2c",
  value: "0x0"
}

Reputation Token Contract Code

augur.api.ReputationToken.approve({ 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.migrateFromLegacyReputationToken({ 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({ 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({ 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({ 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.

Share Token Tx API

// Share Token Contract Transaction API Examples:
var shareToken = "0xa22c79a48f51df6d0863821bd1dd2c5d6f511bc5";
var _spender = "0x01f50356c280cd886dd058210937160c73700a4b";
var _attotokens = "100000000000000000000";

augur.api.ShareToken.approve({
  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 onSuccess output:
{
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320526,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0x02730239e82d37ec032ecde79f27ae75d7cc59c277ab44c6eb5b67520ee487e9",
  input: "0x83b5863800000000000000000000000001f50356c280cd886dd058210937160c73700a4b0000000000000000000000000000000000000000000000056bc75e2d63100000",
  nonce: "0xff1",
  r: "0x706eb8aee04faf21fd6da949f946df5fa118da35a619560af9b81fc05054715c",
  s: "0x60d3125aa3b1daabd37618fb80232037cdaef9c87a8d262826880f0e57fdb0d3",
  timestamp: 1501003133,
  to: "0xa7f3659c53820346176f7e0e350780df304db179",
  v: "0x2c",
  value: "0x0"
}
augur.api.ShareToken.transfer({
  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 onSuccess output:
{
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320527,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0x7dfbd9d87964814e0da2d874d8d7c2d886df6b852a46d69562018620d62fd773",
  input: "0x8674455800000000000000000000000001f50356c280cd886dd058210937160c73700a4b0000000000000000000000000000000000000000000000056bc75e2d63100000",
  nonce: "0xff2",
  r: "0x706eb8aee04faf21fd6da949f946df5fa118da35a619560af9b81fc05054715c",
  s: "0x60d3125aa3b1daabd37618fb80232037cdaef9c87a8d262826880f0e57fdb0d3",
  timestamp: 1501003133,
  to: "0xa7f3659c53820346176f7e0e350780df304db179",
  v: "0x2c",
  value: "0x0"
}

var _from = "0x4b01721f0244e7c5b5f63c20942850e447f5a5ee";
augur.api.ShareToken.transferFrom({
  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 onSuccess output:
{
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320528,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0x619a9d4a75f43cf5d5b8e81365f9859e60aa96554915e912cdf7ffd96f0d4d96",
  input: "0x27f08b000000000000000000000000004b01721f0244e7c5b5f63c20942850e447f5a5ee00000000000000000000000001f50356c280cd886dd058210937160c73700a4b0000000000000000000000000000000000000000000000056bc75e2d63100000",
  nonce: "0xff3",
  r: "0x706eb8aee04faf21fd6da949f946df5fa118da35a619560af9b81fc05054715c",
  s: "0x60d3125aa3b1daabd37618fb80232037cdaef9c87a8d262826880f0e57fdb0d3",
  timestamp: 1501003133,
  to: "0xa7f3659c53820346176f7e0e350780df304db179",
  v: "0x2c",
  value: "0x0"
}

Share Token Contract Code

augur.api.ShareToken.approve({ 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({ 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({ 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.

Stake Token Tx API

// Stake Token Contract Transaction API Examples:
var stakeToken = "0xbb87186146569514b8cd8b72e57eec3849e3981f";
var _spender = "0xfe9d0408be14d1d1ec28671b03bda1b80748977e";
var _attotokens = "100000000000000000000";

augur.api.StakeToken.approve({
  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 onSuccess output:
{
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320499,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0xb3f94e1ad1890d0a14b21e3fd46530eb8c18887edc810e01fc789ccbfb39f067",
  input: "0x83b58638000000000000000000000000fe9d0408be14d1d1ec28671b03bda1b80748977e0000000000000000000000000000000000000000000000056bc75e2d63100000",
  nonce: "0xc",
  r: "0x706eb8aee04faf21fd6da949f946df5fa118da35a619560af9b81fc05054715c",
  s: "0x60d3125aa3b1daabd37618fb80232037cdaef9c87a8d262826880f0e57fdb0d3",
  timestamp: 1501003133,
  to: "0xa7f3659c53820346176f7e0e350780df304db179",
  v: "0x2c",
  value: "0x0"
}

augur.api.StakeToken.buy({
  stakeToken: stakeToken,
  _attotokens: _attotokens,
  onSent: function (result) { console.log(result) },
  onSuccess: function (result) { console.log(result) },
  onFailed: function (result) { console.log(result) }
});
// example onSuccess output:
{
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320500,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0x99620dd1428671eb095de26ad02137916237844456e243cdaa9d9821affa5120",
  input: "0xe94030130000000000000000000000000000000000000000000000056bc75e2d63100000",
  nonce: "0xd",
  r: "0x706eb8aee04faf21fd6da949f946df5fa118da35a619560af9b81fc05054715c",
  s: "0x60d3125aa3b1daabd37618fb80232037cdaef9c87a8d262826880f0e57fdb0d3",
  timestamp: 1501003133,
  to: "0xa7f3659c53820346176f7e0e350780df304db179",
  v: "0x2c",
  value: "0x0"
}

augur.api.StakeToken.migrateLosingTokens({
  stakeToken: stakeToken,
  onSent: function (result) { console.log(result) },
  onSuccess: function (result) { console.log(result) },
  onFailed: function (result) { console.log(result) }
});
// example onSuccess output:
{
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320502,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0x75cb653f1ab81c95d0aad86c03e092a3fa9de7252603edfabee534b8e5183141",
  input: "0xe9aa05a1",
  nonce: "0xd2",
  r: "0x706eb8aee04faf21fd6da949f946df5fa118da35a619560af9b81fc05054715c",
  s: "0x60d3125aa3b1daabd37618fb80232037cdaef9c87a8d262826880f0e57fdb0d3",
  timestamp: 1501003133,
  to: "0xa7f3659c53820346176f7e0e350780df304db179",
  v: "0x2c",
  value: "0x0"
}

augur.api.StakeToken.redeemDisavowedTokens({
  stakeToken: stakeToken,
  _reporter: _spender,
  onSent: function (result) { console.log(result) },
  onSuccess: function (result) { console.log(result) },
  onFailed: function (result) { console.log(result) }
});
// example onSuccess output:
{
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320503,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0x3c7827f3cc51e4062c73bf9fdbd6ad51edec7d31842900cd88811e67d83eb514",
  input: "0x60b54d2e000000000000000000000000fe9d0408be14d1d1ec28671b03bda1b80748977e",
  nonce: "0xd3",
  r: "0x706eb8aee04faf21fd6da949f946df5fa118da35a619560af9b81fc05054715c",
  s: "0x60d3125aa3b1daabd37618fb80232037cdaef9c87a8d262826880f0e57fdb0d3",
  timestamp: 1501003133,
  to: "0xa7f3659c53820346176f7e0e350780df304db179",
  v: "0x2c",
  value: "0x0"
}

augur.api.StakeToken.redeemForkedTokens({
  stakeToken: stakeToken,
  onSent: function (result) { console.log(result) },
  onSuccess: function (result) { console.log(result) },
  onFailed: function (result) { console.log(result) }
});
// example onSuccess output:
{
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320504,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0x8cfc973a802f44e5c0a93a8a0d294e680fe4735ca4f49310038908d73bb4536c",
  input: "0x00633a30000000000000000000000000fe9d0408be14d1d1ec28671b03bda1b80748977e",
  nonce: "0xd4",
  r: "0x706eb8aee04faf21fd6da949f946df5fa118da35a619560af9b81fc05054715c",
  s: "0x60d3125aa3b1daabd37618fb80232037cdaef9c87a8d262826880f0e57fdb0d3",
  timestamp: 1501003133,
  to: "0xa7f3659c53820346176f7e0e350780df304db179",
  v: "0x2c",
  value: "0x0"
}

var _forgoFees = true;
augur.api.StakeToken.redeemWinningTokens({
  stakeToken: stakeToken,
  _forgoFees: _forgoFees,
  onSent: function (result) { console.log(result) },
  onSuccess: function (result) { console.log(result) },
  onFailed: function (result) { console.log(result) }
});
// example onSuccess output:
{
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320505,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0xa94d27cf876602ff5cbbce344e5d03ff30c60d61c2e2adf4bf9c54c303d51b81",
  input: "0xc165c7cc000000000000000000000000fe9d0408be14d1d1ec28671b03bda1b80748977e",
  nonce: "0xd5",
  r: "0x706eb8aee04faf21fd6da949f946df5fa118da35a619560af9b81fc05054715c",
  s: "0x60d3125aa3b1daabd37618fb80232037cdaef9c87a8d262826880f0e57fdb0d3",
  timestamp: 1501003133,
  to: "0xa7f3659c53820346176f7e0e350780df304db179",
  v: "0x2c",
  value: "0x0"
}

augur.api.StakeToken.transfer({
  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 onSuccess output:
{
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320500,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0x8f92137eff5e7824423ff6e79e15188b61d9dd9244fd2c436b020de6d8e721fe",
  input: "0x86744558000000000000000000000000fe9d0408be14d1d1ec28671b03bda1b80748977e0000000000000000000000000000000000000000000000056bc75e2d63100000",
  nonce: "0xe",
  r: "0x706eb8aee04faf21fd6da949f946df5fa118da35a619560af9b81fc05054715c",
  s: "0x60d3125aa3b1daabd37618fb80232037cdaef9c87a8d262826880f0e57fdb0d3",
  timestamp: 1501003133,
  to: "0xa7f3659c53820346176f7e0e350780df304db179",
  v: "0x2c",
  value: "0x0"
}

var _from = "0x34c85afe56c392e240c64dc09d2a7962afe2920a";
augur.api.StakeToken.transferFrom({
  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 onSuccess output:
{
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320501,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0x2c678df877e01d343a4e7701b92dddcecafc095fd1e4d90423838cd73eadb7d7",
  input: "0xc19cca5200000000000000000000000034c85afe56c392e240c64dc09d2a7962afe2920a000000000000000000000000fe9d0408be14d1d1ec28671b03bda1b80748977e0000000000000000000000000000000000000000000000056bc75e2d63100000",
  nonce: "0xf",
  r: "0x706eb8aee04faf21fd6da949f946df5fa118da35a619560af9b81fc05054715c",
  s: "0x60d3125aa3b1daabd37618fb80232037cdaef9c87a8d262826880f0e57fdb0d3",
  timestamp: 1501003133,
  to: "0xa7f3659c53820346176f7e0e350780df304db179",
  v: "0x2c",
  value: "0x0"
}

augur.api.StakeToken.withdrawInEmergency {
  stakeToken: stakeToken,
  onSent: function (result) { console.log(result) },
  onSuccess: function (result) { console.log(result) },
  onFailed: function (result) { console.log(result) }
}
// example onSuccess output:
{
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320502,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0xf5681056bab571e0ec73411896a3e8f7a7b610e43f148ea96cd06f66a2e8472a",
  input: "0x00000001",
  nonce: "0x3",
  r: "0x706eb8aee04faf21fd6da949f946df5fa118da35a619560af9b81fc05054715c",
  s: "0x60d3125aa3b1daabd37618fb80232037cdaef9c87a8d262826880f0e57fdb0d3",
  timestamp: 1501003133,
  to: "0xa7f3659c53820346176f7e0e350780df304db179",
  v: "0x2c",
  value: "0x0"
}

Stake Token Contract Code

augur.api.StakeToken.approve({ 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({ stakeToken, _attotokens, onSent, onSuccess, onFailed })

This transaction is used to purchase Stake Tokens using REP. The Stake Token’s Market must be in a 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({ 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({ 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({ 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({ stakeToken, _forgoFees, 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. Due to the fact that Markets can sometimes take months to Finalize (and, therefore, the fees can take months to claim), the parameter forgoFees can be set to true if the user would like to redeem his or her Stake Tokens immediately without having to wait. 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({ 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({ 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.

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

If a critical bug or vulnerability is found in Augur, the development team can put it the system into a haulted state until the issue is resolved. In such instances, most regularly-used functions in Augur’s backend will become unuseable until the system is returned to its normal state. When this happens, users can call the withdrawInEmergency function to withdraw their Stake Tokens and convert them into Reputation Tokens.

This transaction will fail if Augur is not currently in a haulted state.

It returns true if the Stake Tokens were successfully withdrawn and converted to Reputation Tokens. (NOTE: The return value cannot be obtained reliably when calling externally.)

Trade Tx API

// Trade Contract Transaction API Examples:
var _market = "0x7e8e07364ccde43ba5159537404924e86ca53c92";
var _outcome = "1";
var _fxpAmount = "10000000000000000000"; // 10.0
var _fxpPrice = "500000000000000000"; // 0.5
var _tradeGroupId = "0x0000000000000000000000000000000000000000000000000000000000000003";

augur.api.Trade.publicBuy({
  _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 onSuccess output:
{
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320530,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0x027e3b312f5949388830a0f5c945cbfcbf4ec06edc3b342ef8d6e85f631a50c3",
  input: "0x888b82010000000000000000000000007e8e07364ccde43ba5159537404924e86ca53c9200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000008ac7230489e8000000000000000000000000000000000000000000000000000006f05b59d3b200000000000000000000000000000000000000000000000000000000000000000001",
  nonce: "0xff5",
  r: "0x706eb8aee04faf21fd6da949f946df5fa118da35a619560af9b81fc05054715c",
  s: "0x60d3125aa3b1daabd37618fb80232037cdaef9c87a8d262826880f0e57fdb0d3",
  timestamp: 1501003133,
  to: "0xa7f3659c53820346176f7e0e350780df304db179",
  v: "0x2c",
  value: "0x0"
}

augur.api.Trade.publicSell({
  _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 onSuccess output:
{
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320531,
  callReturn: "1",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0x1072dd3501dd0796f3b986bb45704798d198265ca5b75303488a8eb69c76bae5",
  input: "0xf049066b0000000000000000000000007e8e07364ccde43ba5159537404924e86ca53c9200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000008ac7230489e8000000000000000000000000000000000000000000000000000006f05b59d3b200000000000000000000000000000000000000000000000000000000000000000001",
  nonce: "0xff6",
  r: "0x706eb8aee04faf21fd6da949f946df5fa118da35a619560af9b81fc05054715c",
  s: "0x60d3125aa3b1daabd37618fb80232037cdaef9c87a8d262826880f0e57fdb0d3",
  timestamp: 1501003133,
  to: "0xa7f3659c53820346176f7e0e350780df304db179",
  v: "0x2c",
  value: "0x0"
}

augur.api.Trade.publicTrade({
  _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 onSuccess output:
{
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320532,
  callReturn: "0xa754c0437ff499df19d163199dcb43a539cbd0a9670b976f0ac66f33a88b3ac6",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0x2dc8b6f31e83e0e558863528130af2c66309f582ed02d96c7d7cfbe6a2c7179f",
  input: "0x1ee6ba1000000000000000000000000000000000000000000000000000000000000000010000000000000000000000007e8e07364ccde43ba5159537404924e86ca53c9200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000008ac7230489e8000000000000000000000000000000000000000000000000000006f05b59d3b200000000000000000000000000000000000000000000000000000000000000000001",
  nonce: "0xff7",
  r: "0x706eb8aee04faf21fd6da949f946df5fa118da35a619560af9b81fc05054715c",
  s: "0x60d3125aa3b1daabd37618fb80232037cdaef9c87a8d262826880f0e57fdb0d3",
  timestamp: 1501003133,
  to: "0xa7f3659c53820346176f7e0e350780df304db179",
  v: "0x2c",
  value: "0x0"
}

augur.api.Trade.publicTakeBestOrder({
  _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 onSuccess output:
{
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320533,
  callReturn: "0",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0x7ab9bde926dfb9d1bbee93c07cbcf7d11ea4b995fa8f72d88d8322336d1aefd1",
  input: "0x048db15000000000000000000000000000000000000000000000000000000000000000020000000000000000000000007e8e07364ccde43ba5159537404924e86ca53c9200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000008ac7230489e8000000000000000000000000000000000000000000000000000006f05b59d3b200000000000000000000000000000000000000000000000000000000000000000001",
  nonce: "0xff8",
  r: "0x706eb8aee04faf21fd6da949f946df5fa118da35a619560af9b81fc05054715c",
  s: "0x60d3125aa3b1daabd37618fb80232037cdaef9c87a8d262826880f0e57fdb0d3",
  timestamp: 1501003133,
  to: "0xa7f3659c53820346176f7e0e350780df304db179",
  v: "0x2c",
  value: "0x0"
}

Trade Contract Code

augur.api.Trade.publicBuy({ _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({ _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({ _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({ _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.

TradingEscapeHatch Tx API

// TradingEscapeHatch Contract Transaction API Examples:
var _market = "0x465407364ccde43ba5159537404924e86ca53aaa";

augur.api.TradingEscapeHatch.claimSharesInUpdate({
  _market: _market,
  onSent: function (result) { console.log(result) },
  onSuccess: function (result) { console.log(result) },
  onFailed: function (result) { console.log(result) }
});
// example onSuccess output:
{
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320540,
  callReturn: "0",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0x7ab9bde926dfb9d1bbee93c07cbcf7d11ea4b995fa8f72d88d8322336d1aefd1",
  input: "0x3659bde926dfb9d1bbee93c07cbcf7d11ea4b995fa8f72d88d8322336d1ae7ac",
  nonce: "0xff8",
  r: "0x3db124c7a0ae32094e0afdcd020d51fb930cdc3877066433b910e9257c3232eb"
  s: "0x543251c0fb374e535c61c88b913816f791edba101517921e473384706ddd0256"
  timestamp: 1501003200,
  to: "0xa7f3659c53820346176f7e0e350780df304db179",
  v: "0x2c",
  value: "0x0"
}

augur.api.TradingEscapeHatch.claimSharesInUpdate({ _market, onSent, onSuccess, onFailed })

If Augur needs to be halted by the development team (for example, if a vulnerability is discovered), calling this function on a specific Market will withdraw the user’s funds from that Market and return them to the user’s address. This transaction will fail if Augur is not in a halted state.

Universe Tx API

// Universe Contract Transaction API Examples:
var _extraInfo = { 
  "resolutionSource": "http://www.spacex.com", 
  "tags": [ "SpaceX", "spaceflight" ], 
  "longDescription": "SpaceX hit a big milestone on Friday with NASA confirming on Friday that the Elon Musk-led space cargo business will launch astronauts to the International Space Station by 2017." 
};
augur.api.Universe.createBinaryMarket({
  _endTime: 1546329600,
  _feePerEthInWei: 1193046,
  _denominationToken: "0x74e88699f5d33f516500c3d9a2430f5e6ffb0689",
  _designatedReporterAddress: "0x01114f4bda09ed6c6715cf0baf606b5bce1dc96a",
  _topic: "space",
  _description: "Will SpaceX successfully complete a manned flight to the International Space Station by the end of 2018?",
  _extraInfo: JSON.stringify(_extraInfo),
  onSent: function (result) { console.log("onSent result:", result); },
  onSuccess: function (result) { 
    console.log("onSuccess result:", result);
    // Call `augur.createMarket.getMarketFromCreateMarketReceipt` to retrieve new market's address
  },
  onFailed: function (result) { console.log("onFailed result:", result); },
  tx: { 
    to: "0x6eabb9367012c0a84473e1e6d7a7ce39a54d77bb",
    value: 10000000006000000, 
    gas: augur.constants.CREATE_BINARY_MARKET_GAS
  }
});
// example onSuccess output:
onSuccess result: {
  blockHash: "0x8125127e415c1a242046f8ebbb036ebdefaa013ec697d8691da43727cd311155",
  blockNumber:1362465,
  callReturn: null,
  from: "0x40485264986740c8fb3d11e814bd94cf86012d29",
  gas: "0x5b8d80",
  gasFees: "0.02179245429087362",
  gasPrice: "0x1ce4eb7ee",
  hash: "0xc0583954449b26e2036212929620674bb1e7bafb904c4fae551297dd036ee769",
  input: "0x593...000",
  nonce: "0x1e",
  r: "0x9b013bbb8fda1635b419ff001fd57f651f648a1b4041c08d6506a13ff9d9ca21"
  s: "0x5b6358e1c1d71d233a659478b175dd3c51577889e17965546897275cb723ed39"
  timestamp: 1512491243,
  to: "0x6eabb9367012c0a84473e1e6d7a7ce39a54d77bb",
  transactionIndex: "0x1",
  v: "0x2c",
  value: "0x2386f2701c8d80"
}

var _extraInfo = { 
  "resolutionSource": "http://www.espn.com", 
  "tags": ["college football", "football"], 
  "outcomeNames": ["Georgia", "Florida"], 
  "longDescription": "" 
};
augur.api.Universe.createCategoricalMarket({
  _endTime: 1540875600,
  _feePerEthInWei: 1193046,
  _denominationToken: "0x74e88699f5d33f516500c3d9a2430f5e6ffb0689",
  _designatedReporterAddress: "0x01114f4bda09ed6c6715cf0baf606b5bce1dc96a",
  _outcomes: ["outcome1","outcome2"],
  _topic: "sports",
  _description: "Who will win the University of Georgia vs. University of Florida football game in 2018?",
  _extraInfo: JSON.stringify(_extraInfo),
  onSent: function (result) { console.log("onSent result:", result); },
  onSuccess: function (result) { 
    console.log("onSuccess result:", result);
    // Call `augur.createMarket.getMarketFromCreateMarketReceipt` to retrieve new market's address
  },
  onFailed: function (result) { console.log("onFailed result:", result); },
  tx: { 
    to: "0x6eabb9367012c0a84473e1e6d7a7ce39a54d77bb",
    value: 10000000006000000,
    gas: augur.constants.CREATE_CATEGORICAL_MARKET_GAS
  }
});
// example onSuccess output:
onSuccess result: {
  blockHash: "0x8125127e415c1a242046f8ebbb036ebdefaa013ec697d8691da43727cd311155",
  blockNumber:1362465,
  callReturn: null,
  from: "0x40485264986740c8fb3d11e814bd94cf86012d29",
  gas: "0x632ea0",
  gasFees: "0.021696129637146186",
  gasPrice: "0x1ce4eb7ee",
  hash: "0xb97f69a404805e81396a8fcc383b95edcb4a6fe6d17e0a33c994f05734a1cac6",
  input: "0x593...000",
  nonce: "0x1e",
  r: "0x9b013bbb8fda1635b419ff001fd57f651f648a1b4041c08d6506a13ff9d9ca21"
  s: "0x5b6358e1c1d71d233a659478b175dd3c51577889e17965546897275cb723ed39"
  timestamp: 1512491243,
  to: "0x6eabb9367012c0a84473e1e6d7a7ce39a54d77bb",
  v: "0x2c",
  value: "0x2386f2701c8d80"
}

var _extraInfo = { 
  "resolutionSource": "http://forecast.weather.gov", 
  "tags": ["San Francisco", "weather"], 
  "longDescription": "" 
};
augur.api.Universe.createScalarMarket({
  _endTime: 1530507600,
  _feePerEthInWei: 1193046,
  _denominationToken: "0x74e88699f5d33f516500c3d9a2430f5e6ffb0689",
  _designatedReporterAddress: "0x01114f4bda09ed6c6715cf0baf606b5bce1dc96a",
  _minPrice: -10,
  _maxPrice: 120,
  _numTicks: 10,
  _topic: "temperature",
  _description: "High temperature (in degrees Fahrenheit) in San Francisco, California, on July 1, 2018",
  _extraInfo: JSON.stringify(_extraInfo),
  onSent: function (result) { console.log("onSent result:", result); },
  onSuccess: function (result) { 
    console.log("onSuccess result:", result);
    // Call `augur.createMarket.getMarketFromCreateMarketReceipt` to retrieve new market's address
  },
  onFailed: function (result) { console.log("onFailed result:", result); },
  tx: { 
    to: "0x6eabb9367012c0a84473e1e6d7a7ce39a54d77bb",
    value: 10000000006000000,
    gas: augur.constants.CREATE_SCALAR_MARKET_GAS
  }
});
// example onSuccess output:
onSuccess result: {
  blockHash: "0x8125127e415c1a242046f8ebbb036ebdefaa013ec697d8691da43727cd311155",
  blockNumber:1362465,
  callReturn: null,
  from: "0x40485264986740c8fb3d11e814bd94cf86012d29",
  gas: "0x5b8d80",
  gasFees: "0.021695431576204446",
  gasPrice: "0x1ce4eb7ee",
  hash: "0xb97f69a404805e81396a8fcc383b95edcb4a6fe6d17e0a33c994f05734a1cac6",
  input: "0x593...000",
  nonce: "0x1e",
  r: "0x9b013bbb8fda1635b419ff001fd57f651f648a1b4041c08d6506a13ff9d9ca21"
  s: "0x5b6358e1c1d71d233a659478b175dd3c51577889e17965546897275cb723ed39"
  timestamp: 1512491243,
  to: "0x6eabb9367012c0a84473e1e6d7a7ce39a54d77bb",
  v: "0x2c",
  value: "0x2386f2701c8d80"
}

augur.api.Universe.getOrCacheDesignatedReportNoShowBond({
  onSent: function (result) { console.log("onSent result:", result); },
  onSuccess: function (result) { console.log("onSuccess result:", result); },
  onFailed: function (result) { console.log("onFailed result:", result); }
});
// example onSuccess output:
onSuccess result: {
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320554,
  callReturn: "0",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0x2fd618",
  gasFees: "0.00102297557556486",
  gasPrice: "0x5b793ccec",
  hash: "0x7ab9bde926dfb9d1bbee93c07cbcf7d11ea4b995fa8f72d88d8322336d1aefd1",
  input: "0x3659bde926dfb9d1bbee93c07cbcf7d11ea4b995fa8f72d88d8322336d1ae7ac",
  nonce: "0xff8",
  r: "0x3db124c7a0ae32094e0afdcd020d51fb930cdc3877066433b910e9257c3232eb"
  s: "0x543251c0fb374e535c61c88b913816f791edba101517921e473384706ddd0256"
  timestamp: 1501003133,
  to: "0xa7f3659c53820346176f7e0e350780df304db179",
  v: "0x2c",
  value: "0x0"
}

augur.api.Universe.getOrCacheDesignatedReportStake({
  onSent: function (result) { console.log("onSent result:", result); },
  onSuccess: function (result) { console.log("onSuccess result:", result); },
  onFailed: function (result) { console.log("onFailed result:", result); }
});
// example onSuccess output:
onSuccess result: {
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320555,
  callReturn: "0",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0x7ab9bde926dfb9d1bbee93c07cbcf7d11ea4b995fa8f72d88d8322336d1aefd1",
  input: "0x3659bde926dfb9d1bbee93c07cbcf7d11ea4b995fa8f72d88d8322336d1ae7ac",
  nonce: "0xff8",
  r: "0x706eb8aee04faf21fd6da949f946df5fa118da35a619560af9b81fc05054715c",
  s: "0x60d3125aa3b1daabd37618fb80232037cdaef9c87a8d262826880f0e57fdb0d3",
  timestamp: 1501003133,
  to: "0xa7f3659c53820346176f7e0e350780df304db179",
  v: "0x2c",
  value: "0x0"
}

augur.api.Universe.getOrCacheMarketCreationCost({
  onSent: function (result) { console.log("onSent result:", result); },
  onSuccess: function (result) { console.log("onSuccess result:", result); },
  onFailed: function (result) { console.log("onFailed result:", result); }
});
// example onSuccess output:
onSuccess result: {
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320556,
  callReturn: "0",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0x7ab9bde926dfb9d1bbee93c07cbcf7d11ea4b995fa8f72d88d8322336d1aefd1",
  input: "0x3659bde926dfb9d1bbee93c07cbcf7d11ea4b995fa8f72d88d8322336d1ae7ac",
  nonce: "0xff8",
  r: "0x706eb8aee04faf21fd6da949f946df5fa118da35a619560af9b81fc05054715c",
  s: "0x60d3125aa3b1daabd37618fb80232037cdaef9c87a8d262826880f0e57fdb0d3",
  timestamp: 1501003133,
  to: "0xa7f3659c53820346176f7e0e350780df304db179",
  v: "0x2c",
  value: "0x0"
}

augur.api.Universe.getOrCacheReportingFeeDivisor({
  onSent: function (result) { console.log("onSent result:", result); },
  onSuccess: function (result) { console.log("onSuccess result:", result); },
  onFailed: function (result) { console.log("onFailed result:", result); }
});
// example onSuccess output:
onSuccess result: {
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320557,
  callReturn: "0",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0x7ab9bde926dfb9d1bbee93c07cbcf7d11ea4b995fa8f72d88d8322336d1aefd1",
  input: "0x3659bde926dfb9d1bbee93c07cbcf7d11ea4b995fa8f72d88d8322336d1ae7ac",
  nonce: "0xff8",
  r: "0x706eb8aee04faf21fd6da949f946df5fa118da35a619560af9b81fc05054715c",
  s: "0x60d3125aa3b1daabd37618fb80232037cdaef9c87a8d262826880f0e57fdb0d3",
  timestamp: 1501003133,
  to: "0xa7f3659c53820346176f7e0e350780df304db179",
  v: "0x2c",
  value: "0x0"
}

augur.api.Universe.getOrCacheTargetReporterGasCosts({
  onSent: function (result) { console.log("onSent result:", result); },
  onSuccess: function (result) { console.log("onSuccess result:", result); },
  onFailed: function (result) { console.log("onFailed result:", result); }
});
// example onSuccess output:
onSuccess result: {
  blockHash: "0xdc5e31404be698a6866fbe7d7cf435a2c6fab7deb3acf41d6c9bb981a2630fed",
  blockNumber: 1330897,
  callReturn: "6000000",
  from: "0x40485264986740c8fb3d11e814bd94cf86012d29",
  gas: "0x2fd618",
  gasFees: "0.00081266",
  gasPrice: "0x4a817c800",
  hash: "0x1af308e9ea415f321f099b36bae21753bd5227812451694e75b3604aea87bf92",
  input: "0x39d26051",
  nonce: "0x0",
  r: "0x706eb8aee04faf21fd6da949f946df5fa118da35a619560af9b81fc05054715c",
  s: "0x60d3125aa3b1daabd37618fb80232037cdaef9c87a8d262826880f0e57fdb0d3",
  timestamp: 1512018567,
  to: "0xfc6bba7d664e8cc242857f069e9fb1e7c25ecb44",
  transactionIndex: "0x1",
  v: "0x2c",
  value: "0x0"
}

augur.api.Universe.getOrCacheValidityBond({
  onSent: function (result) { console.log("onSent result:", result); },
  onSuccess: function (result) { console.log("onSuccess result:", result); },
  onFailed: function (result) { console.log("onFailed result:", result); }
});
// example onSuccess output:
onSuccess result: {
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320558,
  callReturn: "0",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0x7ab9bde926dfb9d1bbee93c07cbcf7d11ea4b995fa8f72d88d8322336d1aefd1",
  input: "0x3659bde926dfb9d1bbee93c07cbcf7d11ea4b995fa8f72d88d8322336d1ae7ac",
  nonce: "0xff8",
  r: "0x706eb8aee04faf21fd6da949f946df5fa118da35a619560af9b81fc05054715c",
  s: "0x60d3125aa3b1daabd37618fb80232037cdaef9c87a8d262826880f0e57fdb0d3",
  timestamp: 1501003133,
  to: "0xa7f3659c53820346176f7e0e350780df304db179",
  v: "0x2c",
  value: "0x0"
}

var _parentPayoutDistributionHash = "0x7ab9bde926dfb9d1bbee93c07cbcf7d11ea4b995fa8f72d88d8322336d1aefd1";
augur.api.Universe.getOrCreateChildUniverse({
  _parentPayoutDistributionHash: _parentPayoutDistributionHash,
  onSent: function (result) { console.log("onSent result:", result); },
  onSuccess: function (result) { console.log("onSuccess result:", result); },
  onFailed: function (result) { console.log("onFailed result:", result); }
});
// example onSuccess output:
onSuccess result: {
  blockHash: "0x38c8f12c226b8829ae493da94a730d6c149bf9a0578aac151f43028032ea2efb",
  blockNumber: 320559,
  callReturn: "0",
  from: "0xa47eb7af47b8722c3100b49c256a94c742bb26b6",
  gas: "0xb10d2",
  gasFees: "0.005827878",
  gasPrice: "0x430e23400",
  hash: "0x7ab9bde926dfb9d1bbee93c07cbcf7d11ea4b995fa8f72d88d8322336d1aefd1",
  input: "0x3659bde926dfb9d1bbee93c07cbcf7d11ea4b995fa8f72d88d8322336d1ae7ac",
  nonce: "0xff8",
  r: "0x706eb8aee04faf21fd6da949f946df5fa118da35a619560af9b81fc05054715c",
  s: "0x60d3125aa3b1daabd37618fb80232037cdaef9c87a8d262826880f0e57fdb0d3",
  timestamp: 1501003133,
  to: "0xa7f3659c53820346176f7e0e350780df304db179",
  v: "0x2c",
  value: "0x0"
}

augur.api.Universe.createBinaryMarket({ _endTime, _feePerEthInWei, _denominationToken, _designatedReporterAddress, _topic, _description, _extraInfo, onSent, onSuccess, onFailed, tx })

Creates a new Binary Market. After the transaction has completed successfully, the Market address can be obtained by calling augur.createMarket.getMarketFromCreateMarketReceipt.

Parameters:

augur.api.Universe.createCategoricalMarket({ _endTime, _feePerEthInWei, _denominationToken, _designatedReporterAddress, _numOutcomes, _topic, _description, _extraInfo, onSent, onSuccess, onFailed, tx })

Creates a new Categorical Market. After the transaction has completed successfully, the Market address can be obtained by calling augur.createMarket.getMarketFromCreateMarketReceipt.

Parameters:

augur.api.Universe.createScalarMarket({ _endTime, _feePerEthInWei, _denominationToken, _designatedReporterAddress, _minPrice, _maxPrice, _numTicks, _topic, _description, _extraInfo, onSent, onSuccess, onFailed, tx })

Creates a new Scalar Market. After the transaction has completed successfully, the Market address can be obtained by calling augur.createMarket.getMarketFromCreateMarketReceipt.

augur.api.Universe.getOrCacheDesignatedReportNoShowBond({ onSent, onSuccess, onFailed })

Returns the Designated Report No-Show REP Bond for Markets in the Universe, priced in AttoREP. If the value of the Designated Report No-Show REP Bond for the current Reporting Window has not already been cached in the Universe contract, this function will cache it.

augur.api.Universe.getOrCacheDesignatedReportStake({ onSent, onSuccess, onFailed })

Returns the amount of stake in AttoREP that the Designated Reporter must put up when submitting a Designated Report in the Universe. If this value for the current Reporting Window has not already been cached in the Universe contract, this function will cache it.

augur.api.Universe.getOrCacheMarketCreationCost({ onSent, onSuccess, onFailed })

Returns the estimated amount of AttoETH required to create a Market in the Universe. The amount returned by this function is equivalent to the sum of augur.api.Universe.getOrCacheValidityBond() and augur.api.Universe.getOrCacheTargetReporterGasCosts(). If the values of the Validity Bond and the Designated Report No-Show Gas Bond for the current Reporting Window have not already been cached in the Universe contract, this function will cache them.

augur.api.Universe.getOrCacheReportingFeeDivisor({ onSent, onSuccess, onFailed })

Returns the number by which the total payout amount for a Market is divided in order to calculate the Reporting Fee. If this value for the current Reporting Window has not already been cached in the Universe contract, this function will cache it.

augur.api.Universe.getOrCacheTargetReporterGasCosts({ onSent, onSuccess, onFailed })

Returns the Designated Report No-Show Gas Bond in AttoETH that is paid to the First Reporter in the event of a Designated Report no-show, or refunded to the Market Creator Mailbox if the Designated Reporter does report. The amount returned by this function will typically be well above the actual cost to create a Market, just to ensure the Market creation will succeed. If the Designated Report No-Show Gas Bond for the current Reporting Window has not already been cached in the Universe contract, this function will cache it.

augur.api.Universe.getOrCacheValidityBond({ onSent, onSuccess, onFailed })

Returns the amount the Market Creator must pay for the Validity Bond, denominated in AttoETH, when creating a Market. If the Validity Bond for the current Reporting Window has not already been cached in the Universe contract, this function will cache it. (This amount will be refunded to the Market Creator if the Final Outcome of the Market is not invalid.)

augur.api.Universe.getOrCreateChildUniverse({ _parentPayoutDistributionHash, onSent, onSuccess, onFailed })

Returns a Child Universe corresponding to the specified _parentPayoutDistributionHash. If the Child Universe does not already exist, it will be created. This transaction will fail if the Universe does not have a Forked Market.

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 spender has been approved to spend value amount of ERC20 tokens on behalf of owner. owner, spender value
Burn VariableSupplyToken Burned (i.e., completely destroyed) value amount of target’s tokens. target value
DesignatedReportSubmitted Augur reporter has submitted a Designated Report for the market in universe with amountStaked Stake Tokens (at the address stakeToken) staked on the Outcome payoutNumerators. universe, reporter, market stakeToken, amountStaked, payoutNumerators
MarketCreated Augur marketCreator has created a marketType market with outcomes and topic in universe for a price of marketCreationFee and a price range of minPrice to maxPrice. Additional information about market can be found in description and extraInfo. topic, universe, marketCreator description, extraInfo, market, outcomes, marketCreationFee, minPrice, maxPrice, marketType
MarketFinalized Augur The Outcome of market in universe is now considered final. universe, market
Mint VariableSupplyToken value amount of brand new tokens were created for target. target value
OrderCanceled Augur sender’s Order (with ID orderId and type orderType) for the Share Token at address shareToken was canceled in universe, and sender was refunded either tokenRefund in ETH or sharesRefund Share Tokens. universe, shareToken, sender orderId, orderType, tokenRefund, sharesRefund
OrderCreated Augur creator placed an orderType Order with orderId in universe for amount of shareToken at price in the Trade Group tradeGroupId. creator put up either moneyEscrowed or sharesEscrowed. creator, universe, shareToken orderType, amount, price, moneyEscrowed, sharesEscrowed, tradeGroupId, orderId
OrderFilled Augur Order orderId in universe for Share Token at address shareToken was filled by filler in Trade Group tradeGroupId. The Order Creator escrowed numCreatorShares or numCreatorTokens in ETH, and filler put up numFillerShares or numFillerTokens in ETH. marketCreatorFees and reporterFees (denominated in attoETH) were spent to pay the Market Creator and Reporters. universe, shareToken filler, orderId, numCreatorShares, numCreatorTokens, numFillerShares, numFillerTokens, marketCreatorFees, reporterFees, tradeGroupId
ReportsDisputed Augur disputer disputed the Outcome of market in universe for the amount of disputeBondAmount during reportingPhase. universe, disputer, market reportingPhase, disputeBondAmount
ReportSubmitted Augur reporter submitted a Report for market in universe (either in the First Report Round or the Last Report Round). reporter staked amountStaked ETH on Outcome payoutNumerators using the Stake Token at address stakeToken. universe, reporter, market stakeToken, amountStaked, payoutNumerators
TokensBurned Augur Burned (i.e., completely destroyed) amount of target’s tokens (at address token) in universe. universe, token, target amount
TokensMinted Augur Created amount of brand new tokens (at address token) in universe for target. universe, token, target amount
TokensTransferred Augur value amount of the token at address token in universe has been transfered between account from and to. universe, token, from to, value
TradingProceedsClaimed Augur sender has collected trading profits from the Share Token at address shareToken in Finalized Market market in universe. sender had numShares Share Tokens, numPayoutTokens paid out, and a balance of finalTokenBalance. universe, shareToken, sender market, numShares, numPayoutTokens, finalTokenBalance
Transfer ERC20Basic Transferred value between accounts from and to. from, to value
UniverseCreated Augur childUniverse has been created from parentUniverse. parentUniverse, childUniverse
UniverseForked Augur A Market in universe has had its Proposed Outcome disputed during the Last Report Round, which has caused universe to Fork. universe
WinningTokensRedeemed Augur reporter has converted amountRedeemed stakeToken in market of universe to REP for the Outcome payoutNumerators. reporter also got reportingFeesReceived. universe, reporter, market stakeToken, amountRedeemed, reportingFeesReceived, payoutNumerators

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

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 Order Creator to sell Shares of one or more Outcomes. This is the opposite of a Bid Order.

Atto- (Prefix)

Atto- is a unit prefix in the metric system denoting a factor of 10^−18, or 0.000000000000000001. This prefix is used for a number of terms in Augur, including attoETH, attoREP, attoshares, attotoken, etc.

Bid Order

A Bid Order is an Order indicating the desire of the Order Creator 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 Creator and Filler 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 cannot be changed. 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 sells a Complete Set or when the Market has been Finalized and a user wants to close an 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 Designated Report No-Show 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 Filler provides what the Creator of the order is seeking in their order. If a Filler only provides some of what the Creator wants then it’s known as a partial fill. If the Filler provides exactly what the Creator 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 Designated Report No-Show Gas Bond and Designated Report No-Show REP Bond 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 Designated Report No-Show Gas Bond and Designated Report No-Show REP Bond, 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 Designated Report No-Show REP Bond added to their Stake and their Report transaction’s GAS cost covered by the Designated Report No-Show Gas Bond. This provides an incentive to submit the First Report as the First Reporter stands to gain the Designated Report No-Show REP Bond in REP if they Stake on the eventual Final Outcome.

Designated Report No-Show Gas Bond

The Designated Report No-Show 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 Designated Report No-Show 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 Designated Report No-Show Gas Bond. If the transaction costs less than the amount of the Designated Report No-Show Gas Bond then the remaining ETH is sent to the First Reporter.

Designated Report No-Show REP Bond

The Designated Report No-Show 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 Designated Report No-Show 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 is staked. 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.

Market Creator Mailbox

A Market Creator Mailbox is an address that belongs to the Creator of a Market. All of the fees that a Market Creator can collect (whether as ETH or as tokens) get sent to this address, where the Creator can then withdraw them. Funds that are potentially refunded to the Market creator (such as Validity Bonds, Designated Report No-Show Gas Bonds, and Designated Report No-Show REP Bonds) are also sent to the Market Creator Mailbox.

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 Creator 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 Order Creator’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 Order Creator 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 Order Creators and are Filled by Order Fillers. Orders are divided up by which type, or side, of order they are Bid or Ask. Orders are further divided up by Outcome.

Order Creator

An Order Creator is the person who places an Order on the Order Book. They escrow currency or Shares into their Order to buy or sell Shares of an Outcome of a Market.

Order Filler

An Order Filler either partially or fully Fills an Open Order on the Order Book. Order Fillers send currency or Shares to fill the Open Order and complete their half of the trade described in the Order.

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.

Participation Token

Participation Tokens are used to determine how reporting fees are divided up. The more Participation Tokens a user buys (purchased with REP), the larger his or her share of the fees. The user gets back that REP after fees are distributed, so it essentially acts like a deposit. It’s a way of encouraging Reporters to be active in the platform even when they’re not needed, so they’ll be around when they are needed. Buying Participation Tokens is not required. Participation Tokens can be purchased anytime before a Reporting Window ends. They are only used in the case that only Designated Reporters are needed for reporting (everyone shows up) and no one disputes the Designated Reporters. Participation Tokens are purchased after all Markets in the Reporting Window have finalized.

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 Hashes 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 Designated Report No-Show 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 Designated Report No-Show 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 Creator and Filler 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.

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!