NAV
Code

Overview

Augur is a decentralized prediction market platform that runs on Ethereum. For a detailed, high-level explanation of how Augur works, please refer to the Augur whitepaper.

If you want to use or help test Augur, please install the Augur App. If you want to use our cutting-edge development client, this is maintained at https://dev.augur.net. However, be warned – we push changes here pretty rapidly, so it can be a bit buggy!

Augur has its own dedicated Stack Exchange, which allows anyone 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 version 8 of Node.js (note that the version number is important), and Git.

Next, clone the Augur UI GitHub repository by opening a terminal window and typing:

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

Navigate to the newly created augur-ui folder by running:

$ cd augur-ui

Once this has been done, Augur’s dependencies will need to be installed. This can be done using 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. (Again, please note that version 8 of Node.js is required for Augur.) 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 development 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://dev.augur.net, which is configured to automatically talk to a local node, if present.

Note to Geth users: Since Geth’s RPC server uses regular (unencrypted) HTTP, the Augur app must also use regular HTTP to communicate with a local Geth node.

Hosted Ethereum Node

Since many users may not wish to go to the trouble of running a full Ethereum node solely to use Augur, the Augur development team maintains a public Ethereum node on the Rinkeby test network at rinkeby.ethereum.nodes.augur.net, which is used automatically by https://dev.augur.net.

Trading

Augur allows anyone to create an openly tradable Market about any upcoming event. Augur maintains 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 a trade, that trade request will be Filled immediately if there is an Order on the Order Book that will fulfill it. If there is no matching Order, or if the trade request can only be partially Filled, the remainder of what wasn’t filled of the trade will be placed on the Order Book as an Order. Order Creators may cancel their Order to remove it from the Order Book. Orders are executed on a “first come, first served” basis.

The Augur UI offers 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 the Order in the event that the best Order was filled before the transaction was sent. These backup/fallback Orders are always within the limit price set by the trader.

Trading Example

Let’s use an example Yes/No Market trading on the “super big event” coming up. For this example, we want to go long on Yes. We would submit a trade request to buy 100 Shares of Yes 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 Yes at a price of 0.5 ETH, or cheaper, then Augur will fill those Orders. We will now own 100 Shares of Yes 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 Yes 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, and cannot be changed once a Market is created. In addition to the Market Creator Fee, Market Creators can profit via spread by providing liquidity to the Markets they create.

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. Unlike the Creator Fee, the Reporting Fee isn’t set by the Market Creator. Instead, it is set by an off-Augur price feed. 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 * 7.5 / rep_market_cap)

The Reporting Fee will be updated once every 7 days, or once every Fee Window. If updates were 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 Position 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

Once a Market’s underlying event occurs, the Outcome must be determined in order for the Market to Finalize and begin Settlement. Outcomes are determined by Augur’s Decentralized Oracle, which consists of profit-motivated Reporters, who simply report the actual, real-world Outcome of the event. Anyone who owns REP may participate in the Reporting and Disputing of Outcomes. Reporters whose Reports are consistent with consensus are financially rewarded, while those whose Reports are not consistent with consensus are financially penalized.

Fee Windows

Augur’s reporting system runs on a cycle of consecutive 7-day long Fee Windows. A Reporting Fee collected by Augur during a given Fee Window are added to the Reporting Fee Fee Pool for that Fee Window. At the end of the Fee Window, the Reporting Fee Pool is paid out to REP holders who participated in that reporting process. Reporters receive rewards in proportion to the amount of REP they Staked during that Fee Window. Participation includes: Staking during an Initial Report, Disputing a Tentative Outcome, or purchasing Participation Tokens.

Participation Tokens

During any Fee Window, REP holders may purchase any number of Participation Tokens for an equivalent amount of REP. At the end of the Fee Window, they may redeem their Participation Tokens for the same amount of REP, plus a proportional share of the Fee Window’s Reporting Fee Pool. If there were no actions (e.g., submitting a Report or Disputing a Report submitted by another user) needed of a Reporter, the Reporter may purchase Participation Tokens to indicate that they showed up for the Fee Window. Just like Staked REP, Participation Tokens may be redeemed by their owners for a pro rata portion of fees in this Fee Window.

It is important that REP holders are ready to participate in Market resolution in the event of a Fork. The Participation Token provides an incentive for REP holders to monitor the platform at least once per week, and, thus, be ready to participate if the need arises. Even REP holders who do not want to participate in the reporting process are incentivized to check in with Augur once per 7-day Fee Window in order to buy Participation Tokens and collect fees. This regular, active checking in will ensure that they will be familiar with how to use Augur, will be aware of Forks when they occur, and thus should be more ready to participate in Forks when they happen.

Market State Progression

Augur Markets can be in seven different states after creation. The potential states, or “phases”, of an Augur Market are as follows:

The relationship between these states can be seen in the figure below:

Pre-Reporting State

The Pre-Reporting or trading phase is the time period that begins after trading has begun in the Market, but before the Market’s event has come to pass. Generally, this is the most active trading period for any given Augur Market. Once the event end date has passed, the Market enters the Designated Reporting Phase (state a in the figure above).

Designated Reporting State

When creating a Market, Market Creators are required to choose a Designated Reporter and post a No-Show Bond. During the Designated Reporting Phase (state a in the figure above), the Market’s Designated Reporter has up to three days to Report on the Outcome of the event. If the Designated Reporter fails to Report within the allotted 3 days, the Market Creator forfeits the No-Show Bond, and the Market automatically enters the Open Reporting Phase (state b in the figure above).

If the Designated Reporter submits a Report on time, then the No-Show Bond is returned to the Market Creator. The Designated Reporter is required to post the Designated Reporter Stake on its Reported Outcome, which it will forfeit if the Market finalizes to any Outcome other than the one they Reported. As soon as the Designated Reporter submits its Report, the Market enters the Waiting for the Next Fee Window to Begin Phase (state c in the figure above), and the Reported Outcome becomes the Market’s Tentative Outcome.

Open Reporting State

If the Designated Reporter fails to Report within the allotted 3 days, the Market Creator forfeits the No-Show Bond, and the Market immediately enters the Open Reporting Phase. As soon as the Market enters the Open Reporting Phase, anyone can report the Outcome of the Market. When the Designated Reporter fails to Report, the first Reporter who Reports on the Outcome of a Market is called the Market’s First Public Reporter.

The Market’s First Public Reporter receives the forfeited No-Show Bond in the form of Stake on their chosen Outcome, so they may claim the No-Show Bond only if their Reported Outcome agrees with the Market’s Final Outcome.

The First Public Reporter does not need to Stake any of their own REP when Reporting the Outcome of the Market. In this way, any Market whose Designated Reporter fails to Report is expected to have its Outcome reported by someone very soon after entering the Open Reporting Phase.

Once an Initial Report has been received from the Initial Reporter (whether it was the Designated Reporter or First Public Reporter), the Reported Outcome becomes the Market’s Tentative Outcome, and the Market enters the Waiting for the Next Fee Window to Begin Phase (state c in the figure above).

Waiting for the Next Fee Window to Begin State

Once the market receives its Initial Report it enters the Waiting for the Next Fee Window to Begin Phase (state c in the figure above). During this phase, Reporting for the Market is on hold until end of the current Fee Window. Once the next Fee Window begins, the Market enters the Dispute Round Phase.

Dispute Round State

The Dispute Round (state d in the figure above) is a 7-day period, during which any REP holder has the opportunity to Dispute the Market’s Tentative Outcome. (At the beginning of a Dispute Round, a Market’s Tentative Outcome is the outcome that will become the Market’s Final Outcome if it is not successfully disputed by REP holders.) A Dispute consists of Staking REP (referred to as Dispute Stake in this context) on an Outcome other than the Market’s current Tentative Outcome. A Dispute is successful if the total amount of Dispute Stake on some Outcome meets the Dispute Bond size required for the current round. The Dispute Bond sizes are chosen in such a way to ensure a fixed ROI of 50% for Reporters who successfully dispute false Outcomes. Details for how the Dispute Bond size is computed can be found in the Dispute Bond glossary entry.

The Dispute Bonds need not be paid in their entirety by a single user. The Augur platform allows participants to crowdsource the Dispute Bonds. Any user who sees an incorrect Tentative Outcome can Dispute that Outcome by Staking REP on some Outcome other than the Tentative Outcome. If any Outcome (other than the Tentative Outcome) receives enough Dispute Stake to fill its Dispute Bond, the current Tentative Outcome will be successfully Disputed.

In the case of a successful Dispute, the Market will either undergo another Dispute Round or it will enter the Fork Phase (state e in the figure above). If the size of the filled Dispute Bond is greater than the Fork Threshold, then the Market will enter the Fork Phase. If the size of the filled Dispute bond is less than the Fork Threshold, then the newly chosen Outcome becomes the Market’s new Tentative Outcome, and the Market undergoes another Dispute Round.

All Dispute Stake is held in escrow during the Dispute Round. If a Dispute Bond is unsuccessful, then the dispute Stake is returned to its owners at the end of the Dispute Round. If no Dispute is successful during the 7-day Dispute Round, the Market enters the Finalized State (state f in the figure above), and its Tentative Outcome is accepted as the Final Outcome. A Market’s Final Outcome is the Tentative Outcome that passes through a dispute Round without being successfully Disputed, or is determined via a Fork. Augur’s contracts treat Final Outcomes as truth and pay out accordingly.

All unsuccesful Dispute Stake is returned to the original owners at the end of every Dispute Round. All successful Dispute Stake is applied to the Outcome it championed, and remains there until the Market is Finalized (or until a Fork occurs in some other Augur Market). All Dispute Stake (whether successful or unsuccessful) will receive a portion of the Reporting Fee Pool from the current Fee Window.

Fork State

The Fork Phase is a special state that lasts up to 60 days. Forking is the Market resolution method of last resort; it is a very disruptive process and is intended to be a rare occurrence. A Fork is caused when there is a Market with an Outcome with a successfully filled Dispute Bond of at least 2.5% of all REP. This Market is referred to as the Forking Market.

When a Fork is initiated, a 60-day Forking Period begins. Disputing for all other non-Finalized Markets is put on hold until the end of this Forking Period. The Forking Period is much longer than the usual Fee Window because the platform needs to provide ample time for REP holders and service providers (such as wallets and exchanges) to prepare. A Fork’s Final Outcome cannot be Disputed.

Every Augur Market and all REP tokens exist in some Universe. REP tokens can be used to Report on Outcomes (and thus earn fees) only for Markets that exist in the same Universe as the REP tokens. When Augur first launches all Markets and all REP will exist together in a Genesis Universe.

When a Market Forks, new Universes are created. Forking creates a new Child Universe for each possible Outcome of the Forking Market (including the Invalid Outcome). For example, a Yes/No Market has 3 possible Outcomes: A, B, and Invalid. Thus a Yes/No Forking Market will create three new Child Universes: Universe A, Universe B, and Universe Invalid. Initially these newly created Universes are empty: they contain no Markets or REP tokens.

When a Fork is initiated, the Parent Universe becomes permanently Locked. In a Locked Universe, no new Markets may be created. Users may continue trading Shares in Markets in Locked Universes, and Markets in a Locked Universe may still receive their Initial Reports. However, no Reporting rewards are paid out there, and Markets in Locked Universes cannot be Finalized. In order for Markets or REP tokens in the Locked Universe to be useful, they must first be migrated to a Child Universe.

Holders of REP tokens in the Parent Universe may migrate their tokens to a Child Universe of their choice. This choice should be considered carefully, because migration is one-way; it cannot be reversed. Tokens cannot be sent from one sibling Universe to another. Migration is a permanent commitment of REP tokens to a particular Market Outcome. REP tokens that migrate to different Child Universes ought to be considered entirely separate tokens, and exchanges ought to list them as such.

When a Fork is initiated, all REP Staked on all non-Forking Markets is unstaked so that it is free to be migrated to a Child Universe during the Forking Period.

Whichever Child Universe receives the most migrated REP by the end of the Forking Period becomes the Winning Universe, and its corresponding Outcome becomes the Final Outcome of the Forking Market. Un-Finalized Markets in the Parent Universe may be migrated only to the Winning Universe and, if they are un-Finalized and have received an Initial Report, are reset back to the Waiting for the Next Fee Window to Begin Phase.

There is no time limit on migrating tokens from the Parent Universe to a Child Universe. Tokens may be migrated after the Forking Period, but they will not count towards the determination of the Winning Universe. To encourage greater participation during the Forking Period, all token holders who migrate their REP within 60 days of the start of a Fork will receive 5% additional REP in the Child Universe to which they migrated. This reward is paid for by minting new REP tokens.

Reporters that have Staked REP on one of the Forking Market’s Outcomes cannot change their position during a Fork. REP that was Staked on an Outcome in the Parent Universe can be migrated only to the Child Universe that corresponds to that Outcome. For example, if a Reporter helped fulfill a successful Dispute Bond in favor of Outcome A during some previous Dispute Round, then the REP they have Staked on Outcome A can only be migrated to Universe A during a Fork.

Sibling Universes are entirely disjoint. REP tokens that exist in one Universe cannot be used to Report on events or earn rewards from Markets in another Universe. Since users presumably will not want to create or trade on Markets in a Universe whose Oracle is untrustworthy, REP that exists in a Universe that does not correspond to objective reality is unlikely to earn its owner any fees, and therefore should not hold any significant market value.

Therefore, REP tokens migrated to a Universe which does not correspond to objective reality should hold no market value, regardless of whether or not the objectively false Universe ends up being the Winning Universe after a Fork.

Recall from the section on the Dispute Round State that any Stake successfully disputing an Outcome in favor of the Market’s Final Outcome will receive a 50% ROI on their Dispute Stake.

In the event of a Fork, any REP Staked on any of the Market’s false Outcomes should lose all economic value, while any REP Staked on the Market’s true Outcome is rewarded with 50% more REP (via newly minted REP) in the Child Universe that corresponds to the Market’s true Outcome (regardless of the Outcome of the Fork). Therefore, if pushed to a Fork, REP holders who Dispute false Outcomes in favor of true Outcomes will always come out ahead, while REP holders who Staked on false Outcomes will see their REP lose all economic value.

Finalized State

A Market enters the Finalized State (state f in the figure above) if it passes through a 7-day Dispute Round without having its Tentative Outcome successfully Disputed, or after completion of a Fork. The Outcome of a Fork cannot be Disputed and is always considered final at the end of the Forking Period. Once a Market is Finalized, traders can Settle their Positions directly with the Market. When a Market enters the Finalized State, we refer to its chosen Outcome as the Final Outcome.

Designated Reporting Details

During the creation of a Market, a Market Creator must assign a Designated Reporter. Designated Reporting is designed to be a quick way to bring about a Market Resolution. 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. The Designated Reporting Phase begins immediately following the End Time of a 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 Dispute Rounds. With the dispute system in place, we don’t actually lose any security or truth as an incorrect Tentative Outcome for a Market can be Challenged.

The Designated Reporting Phase lasts a maximum of three (3) days and ends immediately when the Designated Reporter submits their Report and the Tentative Outcome is set for the Market.

If the Designated Reporter fails to Report within the Designated Reporting Phase, the Market Creator forfeits the No-Show Bond, and the Market is moved into the Open Reporting Phase. The No-Show Bond is then used to add to the REP Staked by the First Public Reporter.

If the Designated Reporter does successfully Report within the Designated Reporting Phase, the No-Show Bond is refunded to the Market Creator immediately and the Market enters the Dispute Round Phase, which lasts for seven (7) days. During this 7-day period, any REP holder can Stake REP on an outcome other than the Tentative Outcome and receive a proportionate amount of Participation Tokens in return. The Participation Tokens allow the holder to collect fees at the end of the current Fee Window. The Staked REP goes toward filling the Dispute Bond for the Outcome on which it was Staked. If that outcome gets enough REP Staked on it to fill the Dispute Bond size, that Outcome becomes the new Tentative Outcome, and the Market returns to the Waiting for the Next Fee Window to Begin Phase (or Forks if the Outcome gets more than the Fork Threshold Staked on it). If the Market is left unchallenged for the duration of the Dispute Round Phase, then the Market’s Tentative Outcome becomes the Final Outcome and the Market is considered Finalized, allowing the Settlement of Shares.

Fee Window Details

Fee Windows continually occur and last for seven (7) days. During a Fee Window, any REP holder is able to Stake REP on any Outcome other than the Tentative Outcome. By doing so, they receive an equal number of Participation Tokens in return, and the REP they Stake goes toward to a Dispute Bond to Challenge the Tentative Outcome of the Market. In order to earn fees as a REP holder in the current Fee Window, users need to participate in the Market’s Dispute Round in some way, such as submitting a Designated Report or First Public Report, Disputing the Tentative Outcome (i.e., staking on an outcome other than the Tentative Outcome), or simply purchasing Participation Tokens directly.

Any fees collected by Augur during a given Fee Window are added to a Reporting Fee Pool for that Fee Window. The Reporting Fee Pool is used to reward REP holders who participate in Augur’s reporting process. At the end of the Fee Window, the Reporting Fee Pool is paid out to holders of Participation Tokens in proportion to the Staked REP they hold.

Markets are placed into the next available Fee Window once the Designated Reporter or First Public Reporter submits a Report. For example, if a Market’s Designated Report is submitted at 12:00 AM EST on January 3rd, 2053 and a Fee Window was just started on January 1st 2053, the Market would move into the next Fee Window that would be starting on January 8th, 2053, or 7 days since the start of the January 1st Window.

Any REP holder can participate in a Fee Window. In fact, in some cases, someone without any REP is able to successfully Report on Markets in the Open Reporting Phase. This case only occurs when the Market’s Designated Reporter fails to Report during the Designated Reporting Phase. In this situation, the first person to submit a Report can do so and Stake 0 REP on the Report. This is the true because the No-Show Bond is added to the First Public Reporter’s Stake, so in this case the Stake can be 0 as it will get the bond added to it. (The First Public Reporter must still pay the gas cost to submit the Report.) This creates a race to be the First Public Reporter so as to attempt to get free REP from reporting correctly and earning the No-Show Bond.

API Overview

augur.js is a JavaScript SDK that is the developer-facing component of Augur’s middleware. It is the recommended way to interact with Augur from a custom application, and it can be used to query for information about Augur’s Markets and interact with Augur’s back-end Solidity smart contracts, which can be found in the augur-core repository.

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. The Call and Transaction APIs provide direct mappings to Augur’s smart contract functions 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.

This API Overview section explains how to add augur.js to a custom application and how to connect it to an Ethereum node and an Augur Node. It also covers how augur.js’ account management works, how numbers should be used in augur.js, how to load and create Markets, and debugging options.

Augur Node

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 for many of its functions. 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.

It should be noted that batch RPC calls are not supported yet on incoming requests to Augur Node, and therefore batch RPC calls currently are not supported by augur.js.

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 in the Getting Started with augur.js section.

Getting Started with augur.js

// 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://rinkeby.augur.net/ethereum-http" // hosted http address for Geth node on the Rinkeby test network
  ],
  wsAddresses: [
    "ws://127.0.0.1:8546", // local WebSocket address for Geth node
    "wss://rinkeby.augur.net/ethereum-ws" // hosted WebSocket address for Geth node on the Rinkeby test network
  ]
  // ipc addresses can also be specified as:
  // ipcAddresses: [ ... ]
};
// 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"; // local WebSocket address for an Augur Node

// Attempt to connect to a local Ethereum node
// If that fails, fall back to the hosted Ethereum node
augur.connect({ ethereumNode, augurNode }, function (err, connectionInfo) { /* ... */ });
// example connectionInfo object:
{
  augurNode: "ws://127.0.0.1:9001",
  ethereumNode: {
    contracts: {
      Controller: "0xb1772d9e581e5a245ff429cca3e06c57d567c58c",
      Universe: "0xaa88b74da9e08d44c996f037ce13cb2711053cea",
      Augur: "0xdddc5d40979660308e8017d048b04782f17af4af",
      OrdersFinder: "0x01f2aba090b5fa26a64ea9e5afd32f6aab6ba3df",
      LegacyReputationToken: "0x59c98505653f68e8cc2a0ac1e84380a0393fd04e",
      CancelOrder: "0x4c0f599bdd8f9eac10cdfd152c3110ea9b803088",
      Cash: "0x5754d0bcb36b7f30999199031d1f323c4079d58d",
      ClaimTradingProceeds: "0xe408a58ff3eb050f39728fc45644f64e8e379e3d",
      CompleteSets: "0xb51a3aab3d5009f21cd9b47ae856aa780460b78c",
      CreateOrder: "0x19ef3d62d49e95e1b92c1fe12986a24a42c4f3c3",
      FillOrder: "0x57972b23e4e97cf33b456d292411308b1053d835",
      Order: "0x86416fd9eb6ca7797f799ccc2e08a4da4083ac17",
      Orders: "0x452cbdba8559a9b0199bb15105a42fc7ae373983",
      OrdersFetcher: "0xc9d0126e1aa921056af5981016904690ad73c0d3",
      ShareToken: "0x5c8b3117b65af65405980f3700542c03709a6436",
      Trade: "0x8d0677ee9f5330fd65db56da6c31711fd6810434",
      TradingEscapeHatch: "0x867d606553c3fc24b35e3b02d228dc1647786f88"
    },
    abi: {
      events: { /* ... */ },
      functions: { /* ... */ }
    },
  }
}

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

Once augur.js has been installed, it will need to be connected to an Ethereum node and an Augur node. These can be running locally or remotely (hosted).

To connect to the desired Ethereum node and Augur node, call the function augur.connect as shown to the right. Upon doing so, augur.js will iterate through the list of addresses provided in the ethereumNode argument and attempt to connect to each one until a successful connection is established or all attempts have failed. The Ethereum node may have multiple HTTP, WebSocket, or IPC addresses specified as arrays. The connection will be chosen automatically based on a preference of IPC > WS > HTTP. Note: if there is a global web3 object present, such as that injected by MetaMask, that global web3 will be automatically used in preference to any other connections available. So, if you’re using MetaMask, make sure it’s connected to the right network!

Similarly, augur.js will attempt to use the augurNode parameter to connect to an Augur Node. However, augurNode may only be specified as a single-address string, not as an object containing an array of addresses.

The Augur development team hosts Augur Nodes and Ethereum nodes on the Ethereum test networks. The addresses for these hosted nodes are as follows:

dev.augur.net Augur Node (WSS): wss://dev.augur.net/augur-node
dev.augur.net Ethereum Node (HTTPS): https://rinkeby.augur.net/ethereum-http
dev.augur.net Ethereum Node (WSS): wss://rinkeby.augur.net/ethereum-ws

Kovan Augur Node (WSS): Must connect to a locally-running augur-node (e.g., ws://127.0.0.1:9001)
Kovan Ethereum Node (HTTPS): https://kovan.augur.net/ethereum-http
Kovan Ethereum Node (WSS): wss://kovan.augur.net/ethereum-ws

Rinkeby Augur Node (WSS): wss://rinkeby.augur.net/augur-node
Rinkeby Ethereum Node (HTTPS): https://rinkeby.augur.net/ethereum-http
Rinkeby Ethereum Node (WSS): wss://rinkeby.augur.net/ethereum-ws

Ropsten Augur Node (WSS): Must connect to a locally-running augur-node (e.g., ws://127.0.0.1:9001)
Ropsten Ethereum Node (HTTPS): https://ropsten.augur.net/ethereum-http
Ropsten Ethereum Node (WSS): wss://ropsten.augur.net/ethereum-ws

srt.augur.net Augur Node (WSS): Must connect to a locally-running augur-node (e.g., ws://127.0.0.1:9001)
srt.augur.net Ethereum Node (HTTPS): https://srt.augur.net/ethereum-http
srt.augur.net Ethereum Node (WSS): wss://srt.augur.net/ethereum-ws

The Augur development team does not host any Augur Nodes or Ethereum nodes for the Ethereum main network. However, a list of these nodes that are hosted by trusted community members can be found at https://predictions.global/augur-public-ethereum-nodes.

In the example on the right, the first connection that will be tried is http://127.0.0.1:8545, which is a 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 on the Ethereum Rinkeby test network (rinkeby.ethereum.nodes.augur.net) as another attempt to make after the local Geth node. If a connection is successfully established, then the vitals object will be returned; otherwise an error message will be returned.

It should be noted that Augur’s back-end Solidity smart contracts are deployed from the perspective of augur.js, which means that augur.js contains a list of Augur’s smart contract addresses in the file augur.js/src/contracts/addresses.json.

The each group of addresses in the file maps to an Ethereum network ID or to the network ID of a local Ethereum node in a Docker image:

The file augur.js/src/contracts/addresses.json is generated by the script augur-core/source/libraries/ContractCompiler.ts in the augur-core repository.

Augur’s smart contract ABIs are generated and output to augur-core/output/contracts/abi.json in the augur-core repository by the script augur-core/source/libraries/ContractCompiler.ts. For further details on Augur’s smart contracts and their compiling/deployment process, please refer to the README file in the augur-core repository.

Numbers

It is strongly recommended that all numerical input values be passed into Call API functions and Transaction API functions as hexadecimal strings. This is because these API functions are direct bindings to the functions on Augur’s smart contracts, and passing in very large numbers in decimal form can result in the functions on Augur’s smart contracts failing.

The Simplified API functions, however, automatically convert numerical input values to hexadecimal form before passing them into Augur’s smart contracts.

For the Simplified API, there are three acceptable ways to pass numerical inputs:

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. More detailed market info (including prices) for each market can then be loaded using augur.markets.getMarketsInfo. augur.markets.getMarketsInfo does not return the Open Orders for the Market; to get the Open Orders, call augur.trading.getOrders.

Debugging Options

augur.rpc.setDebugOptions({ broadcast: true });
augur.api.Universe.getCurrentFeeWindow();
// 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

// Accounts Simplified API Examples:

augur.accounts.approveAugur({
  address: "0x0000000000000000000000000000000000000b0b", 
  meta: {
    accountType: "privateKey",
    address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
    signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
  },
  onSent: function(result) { console.log(result); },
  onSuccess: function(result) { console.log("Approval was successful."); },
  onFailed: function(result) { console.log("Approval failed due to error:", result); }
});
// example output:
"Approval was successful."

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: " 0x0100000000000000000000000000000000000000",
    value: "10",
    symbol: "shares",
    marketId: " 0x0000000000000000000000000000000000000001",
    outcome: 0,
    isInternalTransfer: 0,
  },
  {
    transactionHash: "0x00000000000000000000000000000000000000000000000000000000d3adb33f",
    logIndex: 0,
    creationBlockNumber: 1400001,
    blockHash: "0x1400001",
    creationTime: 1506473500,
    sender: " 0x000000000000000000000000000000000000d00d",
    recipient: " 0x0000000000000000000000000000000000000b0b",
    token: " 0x0100000000000000000000000000000000000000",
    value: "2",
    symbol: "shares",
    marketId: " 0x0000000000000000000000000000000000000001",
    outcome: 0,
    isInternalTransfer: 1,
  },
  {
    transactionHash: "0x00000000000000000000000000000000000000000000000000000000deadb33f",
    logIndex: 1,
    creationBlockNumber: 1400001,
    blockHash: "0x1400001",
    creationTime: 1506473500,
    sender: " 0x0000000000000000000000000000000000000b0b",
    recipient: " 0x000000000000000000000000000000000000d00d",
    token: " 0x7a305d9b681fb164dc5ad628b5992177dc66aec8",
    value: "47",
    symbol: "REP",
    marketId: null,
    outcome: null,
    isInternalTransfer: 0,
  }
]

augur.accounts.approveAugur(p)

Internally, Augur uses an ERC-20 token called Cash as a wrapper for ETH. Many of Augur’s transactions require Augur to be able to spend Cash on behalf of the account executing the transaction. However, the account must first approve Augur to spend that amount of Cash on its behalf. This function calls the function augur.api.Cash.approve to approve Augur to spend up to augur.constants.ETERNAL_APPROVAL_VALUE Cash on behalf of the account. augur.constants.ETERNAL_APPROVAL_VALUE is equal to 2^256 - 1, or the maximum amount of Cash that can be approved. This value is used so that augur.api.Cash.approve does not have to be called multiple times in order to execute multiple transactions.

Parameters:

Returns:

augur.accounts.getAccountTransferHistory(p, callback)

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

This function will fail if:

Parameters:

Returns:

Assets Functions

// Assets Simplified API Examples:

augur.assets.sendEther({
  etherToSend: "0.001",
  from: "0x8fa56abe36d8dc76cf85fecb6a3026733e0a12ac",
  to: "0x40485264986740c8fb3d11e814bd94cf86012d29",
  meta: {
    accountType: "privateKey",
    address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
    signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
  },
  onSent: function(result) { console.log(result); },
  onSuccess: function(result) { console.log(result); },
  onFailed: function(result) { console.log(result); }
});

augur.assets.sendReputation({
  universe: "0x1f732847fbbcc46ffe859f28e916d993b2b08831",
  reputationToSend: "0.001",
  _to: "0x40485264986740c8fb3d11e814bd94cf86012d29",
  meta: {
    accountType: "privateKey",
    address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
    signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
  },
  onSent: function(result) { console.log(result); },
  onSuccess: function(result) { console.log(result); },
  onFailed: function(result) { console.log(result); }
});

augur.assets.sendEther(p)

Sends Ether to a specified Ethereum address.

Parameters:

Returns:

augur.assets.sendReputation(p)

Sends REP to a specified Ethereum address. This function will trigger a TokensTransferred event if the REP is successfully sent.

Parameters:

Returns:

Augur Node Functions

// Augur Node Simplified API Examples:

augur.augurNode.connect(
  "ws://127.0.0.1:9001",
  function(error, wsTransport) {
    if (error) {
      console.log(error);
    } else {
      console.log("Connected to Augur Node!");
      console.log("WebSocket transport:");
      console.log(wsTransport);
    }
  }
);
// example output:
"Connected to Augur Node!"
"WebSocket transport:"
{
  address: "ws://127.0.0.1:9001",
  awaitingPump: false,
  backoffMilliseconds: 1,
  connected: true,
  disconnectListeners: { ... },
  maxRetries: 0,
  messageHandler: ƒ dispatchJsonRpcResponse(err, jsonRpcResponse),
  nextListenerToken: 1,
  reconnectListeners: { ... },
  timeout: 100,
  webSocketClient: { ... }
  workQueue: [],
}

augur.augurNode.disconnect();
// This function does not return a value.

augur.augurNode.getSyncData(
  function(error, result) {
    console.log(result);
  }
);
// example output:
{
  addresses: {
    Controller: "0x392be0a9d1ab1bde2931c2ddf1d722f9e13b6085",
    Universe: "0x1f732847fbbcc46ffe859f28e916d993b2b08831",
    Augur: "0x852684b374fe03ab77d06931f1b2831028fd58f5",
    OrdersFinder: "0x01f2aba090b5fa26a64ea9e5afd32f6aab6ba3df",
    LegacyReputationToken: "0x097c198dcc997086d1555ad9ae6f52375cfb58d0",
    CancelOrder: "0x389c0b3f0d51cfba9e4d214712a1142f5685814d",
    Cash: "0xd2ee83a8a2a904181ccfddd8292f178614062aa0",
    ClaimTradingProceeds: "0x8aa774927fb928ee1df0d0d3f94c8217658e0bce",
    CompleteSets: "0xbf749b00e42751dba8e0872e66d3ba854f6c2632",
    CreateOrder: "0xdadc071ecc3b7e97b139d2ef692defdc398c8211",
    FillOrder: "0x0c77f6af7b3b5fed8ca980414a97c62da283098a",
    Order: "0x4811d582f64e68e657bec21834012af38ef093bc",
    Orders: "0x1ba5cf0ce546bf7d7943c4d4fb21ea59f6bb0eee",
    OrdersFetcher: "0xb9f2cf78542de87ba7542d92e2937d0eedec5feb",
    ShareToken: "0x925bee44fec28deb228d2251e1a9d32f7c73ebed",
    Trade: "0x0dec7fd04933b8673cef99b64978113065b03926",
    TradingEscapeHatch: "0x157a8998f5470a2be3917aab31d334109f56c30c"
  },
  augurNodeVersion: "7.1.5",
  highestBlock: {
    hash: "0x9c1a28be182d755a053f4efe35f04558a318ea6ea925f827a7de8a30d5d23f58",
    number: 10019,
    timestamp: 1531977999,
  },
  isSyncFinished: true,
  lastProcessedBlock: {
    hash: "0x2dd3a600f9678a8a57b320e00b483502feb0d75977c10f0ec02ba86d6c455dab",
    number: 10013,
    timestamp: 1530856121,
  },
  netId: "102",
  net_version: "102",
  version: "6.1.4",
}

augur.augurNode.submitRequest(
  "getMarkets",
  {
    universe: "0x02149d40d255fceac54a3ee3899807b0539bad60",
    search: "category: Ethereum OR tags: ETH"
  },
  function(error, result) {
    console.log(result);
  }
);
// example output:
[
  "0x98c189f9254b5729eb870688f812b83ebd116798",
  "0xa47f967c4806d34859ec93013be5ebc4d68f3a64",
  "0xfa26157e03f05ca681997e63db25af1a95239243"
]

augur.augurNode.subscribeToEvent(
  "TokensTransferred",
  function(error, result) {
    console.log(error);
    console.log(result);
    console.log("Tokens transferred!");
  },
  function(error, subscriptionId) {
    console.log("Subscribed to event! Subscription ID:", subscriptionId);
  }
);
// example output:
"Subscribed to event! Subscription ID: 8cac9a4b-f5b8-4fb1-be50-5aa16dc99e67"

augur.augurNode.unsubcribeFromEvent(
  "8cac9a4b-f5b8-4fb1-be50-5aa16dc99e67",
  function(error) {
    if (!error) {
      console.log("Unsubscribe successful!");
    }
  }
);
// example output:
"Unsubscribed from 8cac9a4b-f5b8-4fb1-be50-5aa16dc99e67"
"Unsubscribe successful!"

augur.augurNode.unsubscribeFromAllEvents(
  function() {
    console.log("Unsubscribed from all events!");
  }
);
// example output:
"Unsubscribed from 32a81c04-8b35-47fa-a6d0-b12a34145108"
"Unsubscribed from a6354b5d-64a7-49db-acd9-ff56dcc54b4d"
"Unsubscribed from all events!"

augur.augurNode.connect(augurNodeUrl, callback)

Establishes a connection to an Augur Node.

Parameters:

Returns:

augur.augurNode.disconnect()

Disconnects augur.js from the Augur Node it is currently connected to. (To disconnect from the Ethereum node it is currently connected to, use augur.disconnect.)

Parameters:

Returns:

augur.augurNode.getContractAddresses(callback)

This function has been deprecated in favor of augur.augurNode.getSyncData.

augur.augurNode.getSyncData(callback)

Returns the version and contract address set from an Augur Node. Also returns information about the highest blockchain block and the last processed blockchain block.

This function will fail if:

Parameters:

Returns:

augur.augurNode.submitRequest(method, params, callback)

Submits an RPC request to an Augur Node.

This function will fail if:

Parameters:

Returns:

augur.augurNode.subscribeToEvent(eventName, subscriptionCallback, onComplete)

Listens to an Augur Node for when a specific event occurs.

This function will fail if:

Parameters:

Returns:

augur.augurNode.unsubscribeFromEvent(subscriptionId, callback)

Stops the specified subscription from listening on an Augur Node.

This function will fail if:

Parameters:

Returns:

augur.augurNode.unsubscribeFromAllEvents(callback)

Stops the current subscriptions from listening on an Augur Node.

This function will fail if:

Parameters:

Returns:

Connect Function

// Connect Simplified API Examples:

augur.connect({
  ethereumNode: {
    httpAddresses: [
      "http://127.0.0.1:8545", // local HTTP address for Geth node
      "https://rinkeby.ethereum.nodes.augur.net" // hosted HTTP address for Geth node on the Ethereum Rinkeby test network
    ],
    wsAddresses: [
      "ws://127.0.0.1:8546", // local WebSocket address for Geth node
      "wss://ws9000.augur.net" // hosted WebSocket address for Geth node
    ]
  },
  augurNode: "ws://127.0.0.1:9001" // local WebSocket address for an Augur Node
}, function (error, connectionInfo) {
  console.log(connectionInfo);
});
// example output:
connecting to augur-node: ws://127.0.0.1:9001
connecting to ethereum-node: {"httpAddresses":["http://127.0.0.1:8545","https://rinkeby.ethereum.nodes.augur.net"],"wsAddresses":["ws://127.0.0.1:8546","wss://websocket-rinkeby.ethereum.nodes.augur.net"]}
connected to augur
Web3: not connected
Sync: http://127.0.0.1:8545
HTTP: http://127.0.0.1:8545
WS: ws://127.0.0.1:8546
IPC: not connected
connected to ethereum
{
  augurNode: "ws://127.0.0.1:9001",
  ethereumNode: {
    abi: { ... },
    blockNumber: "0x184e24",
    coinbase: "0x40485264986740c8fb3d11e814bd94cf86012d29",
    contracts: { ... },
    gasPrice: 20000000000,
    networkId: "4"
    rpc: { ... }
  }
}

augur.disconnect();
// This function does not return a value.

augur.connect(connectOptions, callback)

Connects augur.js to an Ethereum node and an Augur Node.

Parameters:

Returns:

augur.disconnect()

Disconnects augur.js from the Ethereum node it is currently connected to. (To disconnect from the Augur Node it is currently connected to, use augur.augurNode.disconnect.)

Parameters:

Returns:

Create Market Functions

// Create Market Simplified API Examples:
var _extraInfo = {
  resolutionSource: "https://www.espn.com",
  tags: ["college football", "football"],
  outcomeNames: ["Georgia", "Florida"],
  longDescription: ""
};
augur.createMarket.createCategoricalMarket({
  universe: "0x1f732847fbbcc46ffe859f28e916d993b2b08831",
  _endTime: 1540875600,
  _feePerEthInWei: 1193046,
  _denominationToken: "0xd2ee83a8a2a904181ccfddd8292f178614062aa0",
  _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),
  meta: {
    accountType: "privateKey",
    address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
    signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
  },
  onSent: function (result) { console.log(result); },
  onSuccess: function (result) { console.log(result); },
  onFailed: function (result) { console.log(result); }
});
// example onSuccess output:
{
  "callReturn": "0xc841ee153e45e74074eae9685e815d08dee965eb",
  "blockHash": "0xf5aab811242a73fe433995fdf2212548385b81acef4d6e5634faec74014f39df",
  "blockNumber": 1657080,
  "from": "0x8fa56abe36d8dc76cf85fecb6a3026733e0a12ac",
  "gas": "0x5b8d80",
  "gasPrice": "0x1a13b8600",
  "hash": "0xb55fa7c2e9d43fc9d11badb33f1d571539859059bdd7447594748733b112f7d2",
  "input": "0x59381d2e000000000000000000000000000000000000000000000000000000005c2aad7f0000000000000000000000000000000000000000000000000000000000123456000000000000000000000000d2ee83a8a2a904181ccfddd8292f178614062aa00000000000000000000000008fa56abe36d8dc76cf85fecb6a3026733e0a12ac73746f636b73000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000000000000000000004d57696c6c2074686520446f77204a6f6e657320496e647573747269616c2041766572616765206578636565642032372c30303020617420616e7920706f696e7420647572696e6720323031383f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000085227b5c227265736f6c7574696f6e536f757263655c223a5c2268747470733a2f2f7777772e6d61726b657477617463682e636f6d2f696e76657374696e672f696e6465782f646a69615c222c5c22746167735c223a5b5c2253746f636b735c222c5c22444a49415c225d2c5c226c6f6e674465736372697074696f6e5c223a5c225c227d22000000000000000000000000000000000000000000000000000000",
  "nonce": "0x43",
  "to": "0x1f732847fbbcc46ffe859f28e916d993b2b08831",
  "transactionIndex": "0x0",
  "value": "0xa8c0ff92d4c000",
  "v": "0x2b",
  "r": "0x256cedf5b3ef2f49f6eef99d10ca53ba0484da0e9cbf4434bb3042f90fb376de",
  "s": "0x4161413a76a41468272e85ea7af8362393ea886f743b9882f42bea39fc6ec0b9",
  "timestamp": 1516925924,
  "gasFees": "0.022312465"
}

var _extraInfo = {
  resolutionSource: "https://forecast.weather.gov",
  tags: ["San Francisco", "weather"],
  longDescription: "",
  _scalarDenomination: "degrees Fahrenheit",
};
augur.createMarket.createScalarMarket({
  universe: "0x1f732847fbbcc46ffe859f28e916d993b2b08831",
  _endTime: 1530507600,
  _feePerEthInWei: 1193046,
  _denominationToken: "0xd2ee83a8a2a904181ccfddd8292f178614062aa0",
  _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),
  meta: {
    accountType: "privateKey",
    address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
    signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
  },
  onSent: function (result) { console.log(result); },
  onSuccess: function (result) { console.log(result); },
  onFailed: function (result) { console.log(result); }
});
// example onSuccess output:
{
  "callReturn": "0x008f89903707dbaaed3c42202ec00a94673e96db",
  "blockHash": "0xfbb0b8ced5dab79a5ef58dd0eb45c28e5124832e5c27c0479ea8d6947fef4ed2",
  "blockNumber": 1657371,
  "from": "0x8fa56abe36d8dc76cf85fecb6a3026733e0a12ac",
  "gas": "0x5b8d80",
  "gasPrice": "0x4a817c800",
  "hash": "0x7f52926eac45ec6483cc19b5da795b7425fd3caf191c3eeb208627f4ea0e43b9",
  "input": "0x72d61dfa000000000000000000000000000000000000000000000000000000005b39b1500000000000000000000000000000000000000000000000000000000000123456000000000000000000000000d2ee83a8a2a904181ccfddd8292f178614062aa00000000000000000000000008fa56abe36d8dc76cf85fecb6a3026733e0a12acffffffffffffffffffffffffffffffffffffffffffffffff7538dcfb761800000000000000000000000000000000000000000000000000068155a43676e00000000000000000000000000000000000000000000000000000000000000013d62074656d7065726174757265000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000001c00000000000000000000000000000000000000000000000000000000000000056486967682074656d70657261747572652028696e20646567726565732046616872656e686569742920696e2053616e204672616e636973636f2c2043616c69666f726e69612c206f6e204a756c7920312c203230313800000000000000000000000000000000000000000000000000000000000000000000000000000000007a227b5c227265736f6c7574696f6e536f757263655c223a5c22687474703a2f2f666f7265636173742e776561746865722e676f765c222c5c22746167735c223a5b5c2253616e204672616e636973636f5c222c5c22776561746865725c225d2c5c226c6f6e674465736372697074696f6e5c223a5c225c227d22000000000000",
  "nonce": "0x45",
  "to": "0x1f732847fbbcc46ffe859f28e916d993b2b08831",
  "transactionIndex": "0x0",
  "value": "0xa8c0ff92d4c000",
  "v": "0x2b",
  "r": "0xa8dee275a834a3dc9b2f36c0f7bb9564557d6943623013d772b966ce7045e029",
  "s": "0x14355beeb51c6565f923e2f2e4133261765cc6357a3d8038b18a4d25e874fec8",
  "timestamp": 1516930289,
  "gasFees": "0.0618542"
}

var _extraInfo = {
  resolutionSource: "https://www.nasdaq.com/symbol/msft",
  tags: [ "Stocks", "Microsoft" ],
  longDescription: ""
};
augur.createMarket.createYesNoMarket({
  universe: "0x1f732847fbbcc46ffe859f28e916d993b2b08831",
  _endTime: 1546300799,
  _feePerEthInWei: 1193046,
  _denominationToken: "0xd2ee83a8a2a904181ccfddd8292f178614062aa0",
  _designatedReporterAddress: "0x01114f4bda09ed6c6715cf0baf606b5bce1dc96a",
  _topic: "stocks",
  _description: "Will Microsoft stock (MSFT) be below $50 at any point during 2018?",
  _extraInfo: JSON.stringify(_extraInfo),
  meta: {
    accountType: "privateKey",
    address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
    signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
  },
  onSent: function (result) { console.log(result); },
  onSuccess: function (result) { console.log(result); },
  onFailed: function (result) { console.log(result); }
});
// example onSuccess output:
{
  "callReturn": "0xc841ee153e45e74074eae9685e815d08dee965eb",
  "blockHash": "0xf5aab811242a73fe433995fdf2212548385b81acef4d6e5634faec74014f39df",
  "blockNumber": 1657080,
  "from": "0x8fa56abe36d8dc76cf85fecb6a3026733e0a12ac",
  "gas": "0x5b8d80",
  "gasPrice": "0x1a13b8600",
  "hash": "0xb55fa7c2e9d43fc9d11badb33f1d571539859059bdd7447594748733b112f7d2",
  "input": "0x59381d2e000000000000000000000000000000000000000000000000000000005c2aad7f0000000000000000000000000000000000000000000000000000000000123456000000000000000000000000d2ee83a8a2a904181ccfddd8292f178614062aa00000000000000000000000008fa56abe36d8dc76cf85fecb6a3026733e0a12ac73746f636b73000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000000000000000000004d57696c6c2074686520446f77204a6f6e657320496e647573747269616c2041766572616765206578636565642032372c30303020617420616e7920706f696e7420647572696e6720323031383f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000085227b5c227265736f6c7574696f6e536f757263655c223a5c2268747470733a2f2f7777772e6d61726b657477617463682e636f6d2f696e76657374696e672f696e6465782f646a69615c222c5c22746167735c223a5b5c2253746f636b735c222c5c22444a49415c225d2c5c226c6f6e674465736372697074696f6e5c223a5c225c227d22000000000000000000000000000000000000000000000000000000",
  "nonce": "0x43",
  "to": "0x1f732847fbbcc46ffe859f28e916d993b2b08831",
  "transactionIndex": "0x0",
  "value": "0xa8c0ff92d4c000",
  "v": "0x2b",
  "r": "0x256cedf5b3ef2f49f6eef99d10ca53ba0484da0e9cbf4434bb3042f90fb376de",
  "s": "0x4161413a76a41468272e85ea7af8362393ea886f743b9882f42bea39fc6ec0b9",
  "timestamp": 1516925924,
  "gasFees": "0.022312465"
}

augur.createMarket.getMarketCreationCost({
    universe: "0x1f732847fbbcc46ffe859f28e916d993b2b08831",
}, function (error, result) {
  console.log(result);
});
// example output:
{
  designatedReportNoShowReputationBond: "0.174840291341145834",
  etherRequiredToCreateMarket: "0.025"
}

augur.createMarket.getMarketCreationCostBreakdown({
    universe: "0x1f732847fbbcc46ffe859f28e916d993b2b08831",
}, function (error, result) {
  console.log(result);
});
// example output:
{
  designatedReportNoShowReputationBond: "0.174840291341145834",
  validityBond: "0.01",
}

augur.createMarket.getMarketFromCreateMarketReceipt(
  "0xa50c02cf3de82139fc6f66a9c1726f59b93b4a94725bddbf9ecae0c38edc4f06", 
  function (error, result) {
    console.log(result);
  }
);
// example output: 
"0x5e05e281a4564077985debdb91159a825a6774d3"

augur.createMarket.createCategoricalMarket(p)

Creates a Categorical Market in a specified Universe. This function will trigger a MarketCreated event and TokensTransferred event if the Market is created successfully.

This transaction will fail if:

NOTE: The account attempting to create the new market must have sufficient REP in order for the market to be created. This is also true when calling eth_estimateGas, which essentially does a trial run of the transaction to determine what the gas cost would be to actually run it.

Parameters:

Returns:

augur.createMarket.createScalarMarket(p)

Creates a Scalar Market in a specified Universe. This function will trigger a MarketCreated event and TokensTransferred event if the Market is created successfully.

This transaction will fail if:

NOTE: The account attempting to create the new market must have sufficient REP in order for the market to be created. This is also true when calling eth_estimateGas, which essentially does a trial run of the transaction to determine what the gas cost would be to actually run it.

Parameters:

Returns:

augur.createMarket.createYesNoMarket(p)

Creates a Yes/No Market in a specified Universe. This function will trigger a MarketCreated event and TokensTransferred event if the Market is created successfully.

This transaction will fail if:

NOTE: The account attempting to create the new market must have sufficient REP in order for the market to be created. This is also true when calling eth_estimateGas, which essentially does a trial run of the transaction to determine what the gas cost would be to actually run it.

Parameters:

Returns:

augur.createMarket.getMarketCreationCost(p, callback)

Retrieves the No-Show Bond amount and total Ether required to create a new Market.

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

Parameters:

Returns:

augur.createMarket.getMarketCreationCostBreakdown(p, callback)

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 Public Reporter and the cost of the Validity Bond.

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

Parameters:

Returns:

augur.createMarket.getMarketFromCreateMarketReceipt(transactionHash, callback)

Uses a transaction hash to query an Augur Node for the address of the Market created by that transaction.

Parameters:

Returns:

Generate Contracts API Function

// No examples for Generate Contracts Simplified API

augur.generateContractApi(functionsAbi)

Generates a set of JavaScript bindings for the Solidity ABIs passed in.

Parameters:

Returns:

Get Gas Price Function

// Get Gas Price Simplified API Example:
augur.getGasPrice(function (result) {
  console.log(result);
});
// example output:
1000000000

augur.getGasPrice(newGasPriceFunction)

Returns the current gas price.

Parameters:

Returns:

Markets Functions

// Markets Simplified API Examples:

augur.markets.getCategories({
  universe: "0x000000000000000000000000000000000000000b",
}, function (error, result) {
  console.log(result);
});
// example output:
[
  {
    "categoryName": "TEST CATEGORY",
    "nonFinalizedOpenInterest": "4.16",
    "openInterest": "4.16",
    "liquidityTokens": "16",
    "tags": [
      {"nonFinalizedOpenInterest": "0", "numberOfMarketsWithThisTag": 6, "openInterest": "0", "liquidityTokens": "6", "tagName": "test tag 1"},
      {"nonFinalizedOpenInterest": "0", "numberOfMarketsWithThisTag": 6, "openInterest": "0", "liquidityTokens": "6", "tagName": "test tag 2"},
      {"nonFinalizedOpenInterest": "0", "numberOfMarketsWithThisTag": 2, "openInterest": "0", "liquidityTokens": "2", "tagName": "Finance"},
      {"nonFinalizedOpenInterest": "0", "numberOfMarketsWithThisTag": 2, "openInterest": "0", "liquidityTokens": "2", "tagName": "Augur"},
      {"nonFinalizedOpenInterest": "0", "numberOfMarketsWithThisTag": 1, "openInterest": "0", "liquidityTokens": "1", "tagName": "politics"},
      {"nonFinalizedOpenInterest": "0", "numberOfMarketsWithThisTag": 1, "openInterest": "0", "liquidityTokens": "1", "tagName": "ethereum"},
      {"nonFinalizedOpenInterest": "0", "numberOfMarketsWithThisTag": 5, "openInterest": "0", "liquidityTokens": "5", "tagName": "tagging it"},
      {"nonFinalizedOpenInterest": "0", "numberOfMarketsWithThisTag": 5, "openInterest": "0", "liquidityTokens": "5", "tagName": "tagged it"},
    ]
  },
  {
    "categoryName": "TeSt CaTeGoRy",
    "nonFinalizedOpenInterest": "0",
    "openInterest": "0",
    "liquidityTokens": "1",
    "tags": [
      {
        "nonFinalizedOpenInterest": "0",
        "numberOfMarketsWithThisTag": 1,
        "openInterest": "0",
        "liquidityTokens": "1",
        "tagName": "tEsT tag 1",
      },
      {
        "nonFinalizedOpenInterest": "0",
        "numberOfMarketsWithThisTag": 1,
        "openInterest": "0",
        "liquidityTokens": "1",
        "tagName": "test tag 2",
      },
    ],
  },
]

augur.markets.getMarketPriceHistory({
  marketId: "0x0000000000000000000000000000000000000001",
}, function (error, result) {
  console.log(result);
});
// example output:
{
  0: [
    {
      price: "5.5",
      amount: "0.2",
      timestamp: 1506474500,
    }, {
      amount: "2",
      price: "4.2",
      timestamp: 1509065474,
    },
  ],
}

augur.markets.getMarkets({
  universe: "0x000000000000000000000000000000000000000b",
  search: "category: Ethereum OR tags: ETH"
}, function (error, result) {
  console.log(result);
});
// example output:
[
  "0x98c189f9254b5729eb870688f812b83ebd116798",
  "0xa47f967c4806d34859ec93013be5ebc4d68f3a64",
  "0xfa26157e03f05ca681997e63db25af1a95239243",
]

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

augur.markets.getMarketsInfo({
  marketIds: [
    "0x0000000000000000000000000000000000000001",
    "0x0000000000000000000000000000000000000002",
  ],
}, function (error, result) {
  console.log(result);
});
// example output:
[
  0: {
    id: "0x0000000000000000000000000000000000000001",
    universe: "0x000000000000000000000000000000000000000b",
    marketType: "categorical",
    numOutcomes: 8,
    minPrice: "0",
    maxPrice: "1",
    cumulativeScale: "1",
    author: "0x0000000000000000000000000000000000000b0b",
    creationTime: 1506473474,
    creationBlock: 1400000,
    creationFee: "10",
    settlementFee: "0.04",
    reportingFeeRate: "0.02",
    marketCreatorFeeRate: "0.02",
    marketCreatorFeesBalance: "0",
    marketCreatorMailbox: "0xbbb0000000000000000000000000000000000001",
    marketCreatorMailboxOwner: "0x0000000000000000000000000000000000000b0b",
    initialReportSize: null,
    category: "TEST CATEGORY",
    tags: ["test tag 1", "test tag 2"],
    volume: "0",
    openInterest: "0",
    outstandingShares: "0",
    reportingState: "DESIGNATED_REPORTING",
    forking: 0,
    needsMigration: 0,
    feeWindow: "0x1000000000000000000000000000000000000000",
    endTime: 1506573470,
    finalizationBlockNumber: null,
    finalizationTime: null,
    lastTradeBlockNumber: 1506578,
    lastTradeTime: 1506573370,
    description: "This is a categorical test market created by b0b.",
    scalarDenomination: null,
    details: null,
    designatedReporter: "0x0000000000000000000000000000000000000b0b",
    designatedReportStake: "10",
    resolutionSource: "https://www.trusted-third-party.com",
    numTicks: "10000",
    tickSize: "0.0001",
    consensus: {
      isInvalid: false,
      payout: [
        "0",
        "10000",
      ],
    },
    outcomes: [{
      id: 0,
      volume: "100",
      price: "0.125",
      description: "outcome 0",
    }, {
      id: 1,
      volume: "100",
      price: "0.125",
      description: "outcome 1",
    }, {
      id: 2,
      volume: "100",
      price: "0.125",
      description: "outcome 2",
    }, {
      id: 3,
      volume: "100",
      price: "0.125",
      description: "outcome 3",
    }, {
      id: 4,
      volume: "100",
      price: "0.125",
      description: "outcome 4",
    }, {
      id: 5,
      volume: "100",
      price: "0.125",
      description: "outcome 5",
    }, {
      id: 6,
      volume: "100",
      price: "0.125",
      description: "outcome 6",
    }, {
      id: 7,
      volume: "100",
      price: "0.125",
      description: "outcome 7",
    }],
  },
  1: {
    id: "0x0000000000000000000000000000000000000002",
    universe: "0x000000000000000000000000000000000000000b",
    marketType: "yesNo",
    numOutcomes: 2,
    minPrice: "0",
    maxPrice: "1",
    cumulativeScale: "1",
    author: "0x0000000000000000000000000000000000000b0b",
    creationTime: 1506480000,
    creationBlock: 1400100,
    creationFee: "10",
    settlementFee: "0.04",
    reportingFeeRate: "0.02",
    marketCreatorFeeRate: "0.02",
    marketCreatorFeesBalance: "0",
    marketCreatorMailbox: "0xbbb0000000000000000000000000000000000002",
    marketCreatorMailboxOwner: "0x0000000000000000000000000000000000000b0b",
    initialReportSize: null,
    category: "TEST CATEGORY",
    tags: ["test tag 1", "test tag 2"],
    volume: "0",
    openInterest: "0",
    outstandingShares: "0",
    reportingState: "DESIGNATED_REPORTING",
    forking: 0,
    needsMigration: 0,
    feeWindow: "0x1000000000000000000000000000000000000000",
    endTime: 1506573480,
    finalizationBlockNumber: null,
    finalizationTime: null,
    lastTradeBlockNumber: 1506579,
    lastTradeTime: 1506573380,
    description: "This is a yesNo test market created by b0b.",
    scalarDenomination: null,
    details: null,
    designatedReporter: "0x0000000000000000000000000000000000000b0b",
    designatedReportStake: 10,
    resolutionSource: "http://www.trusted-third-party.com",
    numTicks: "10000",
    consensus: {
      isInvalid: false,
      payout: [
        "0",
        "10000",
      ],
    },
    outcomes: [{
      id: 0,
      volume: 1000,
      price: 0.5,
      description: "outcome 0",
    }, {
      id: 1,
      volume: "1000",
      price: "0.5",
      description: "outcome 1",
    }],
  }
]

augur.markets.getUnclaimedMarketCreatorFees({
  marketIds: [
    "0x0000000000000000000000000000000000000001",
    "0x0000000000000000000000000000000000000002"
  ]
}, function(error, result) {
  console.log(result);
});
// example output:
[
  0: {
    marketId: "0x0000000000000000000000000000000000000001",
    unclaimedFee: "0",
  },
  1: {
    marketId: "0x0000000000000000000000000000000000000002",
    unclaimedFee: "0",
  }
]

augur.markets.getCategories(p, callback)

Returns the Market Categories in a specific Universe.

This function will fail if:

Parameters:

Returns:

augur.markets.getMarketPriceHistory(p, callback)

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

This function will fail if:

Parameters:

Returns:

augur.markets.getMarkets(p, callback)

Returns an array of Markets in a specific Universe.

This function will fail if:

Parameters:

Returns:

augur.markets.getMarketsClosingInDateRange(p, callback)

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

This function will fail if:

Parameters:

Returns:

augur.markets.getMarketsInfo(p, callback)

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.

This function will fail if:

Parameters:

Returns:

augur.markets.getUnclaimedMarketCreatorFees(p, callback)

Returns the amount of unclaimed Creator Fees in a set of Markets. Fees are only available on Finalized Markets.

Parameters:

Returns:

Reporting Functions

// Reporting Simplified API Examples:

augur.reporting.claimReportingFeesForkedMarket({
  redeemer: "0x913da4198e6be1d5f5e4a40d0667f70c0b5430eb",
  forkedMarket: {
    crowdsourcers: [
      {
        crowdsourcerId: "0xfc2355a7e5a7adb23b51f54027e624bfe0e23001",
        needsFork: true,
      },
      {
        crowdsourcerId: "0xfc2355a7e5a7adb23b51f54027e624bfe0e23002",
        needsFork: false,
      },
    ],

    initialReporter: {
      initialReporterId: "0xfd2355a7e5a7adb23b51f54027e624bfe0e23001",
      needsFork: false,
    },
  },
  estimateGas: false,
  onSent(result) { },
  onSuccess(result) { console.log(result); },
  onFailed(errors) { console.log(errors); },
});
// example output:
{
  successfulTransactions: {
    crowdsourcerForkAndRedeem: [ 
      "0xfc2355a7e5a7adb23b51f54027e624bfe0e23001",
    ],
    initialReporterForkAndRedeem: [],
    crowdsourcerRedeem: [ 
      "0xfc2355a7e5a7adb23b51f54027e624bfe0e23002",
    ],
    initialReporterRedeem: [
      "0xfd2355a7e5a7adb23b51f54027e624bfe0e23001",
    ],
  }
}

augur.reporting.claimReportingFeesNonforkedMarkets({
  "redeemer": "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Eb",
  "feeWindows": [],
  "nonforkedMarkets": [
    {
      "marketId": "0xbeb2f42f5f495c0581893117eb210e5e9666170e",
      "crowdsourcersAreDisavowed": false,
      "isFinalized": true,
      "crowdsourcers": [],
      "initialReporter": "0x072e9db2836dc569f6173a8d56a25dfd4cbacc1c"
    }
  ],
  "estimateGas": true,
  onSent(result) { console.log(result); },
  onSuccess(result) { console.log(result); },
  onFailed(errors) { console.log(errors); },
});
// example output:
{
  "successfulTransactions": {
    "disavowCrowdsourcers": [],
    "feeWindowRedeem": [],
    "crowdsourcerRedeem": [],
    "initialReporterRedeem": [
      "0x072e9db2836dc569f6173a8d56a25dfd4cbacc1c"
    ]
  }
}

augur.reporting.finalizeMarket({
  market: "0x0000000000000000000000000000000000000011",
  meta: {
    accountType: "privateKey",
    address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
    signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
  },
  onSent: function(result) { console.log(result); },
  onSuccess: function(result) { console.log(result); },
  onFailed: function(result) { console.log(result); }
});
// This function does not return a value.

var secondsInFeeWindow = 604800;
var currentTimestamp = 1518648436;
augur.reporting.getCurrentPeriodProgress(secondsInFeeWindow, currentTimestamp);
// example output:
99.27843915343915

augur.reporting.getDisputeInfo({
  marketIds: [
    "0x0000000000000000000000000000000000000211",
    "0x0000000000000000000000000000000000000011",
  ],
  account: "0x0000000000000000000000000000000000000021",
}, function (error, result) {
  console.log(result);
});
// example output:
[
  {
    marketId: "0x0000000000000000000000000000000000000211",
    stakeCompletedTotal: "102",
    bondSizeOfNewStake: "204",
    stakes: [
      {
        payout: [
          "10000",
          "0",
        ],
        isInvalid: false,
        bondSizeCurrent: "204",
        stakeCurrent: "0",
        accountStakeCurrent: "0",
        accountStakeTotal: "0",
        stakeRemaining: "204",
        bondSizeTotal: "204",
        accountStakeCompleted: "0",
        stakeCompleted: "0",
        tentativeWinning: false,
      },
      {
        payout: [
          "0",
          "10000",
        ],
        isInvalid: false,
        accountStakeCompleted: "102",
        stakeCurrent: "0",
        stakeCompleted: "102",
        tentativeWinning: true,
      },
      {
        payout: [
          "5000",
          "5000",
        ],
        isInvalid: true,
        bondSizeCurrent: "204",
        stakeCurrent: "20",
        accountStakeCurrent: "0",
        accountStakeTotal: "0",
        stakeRemaining: "184",
        bondSizeTotal: "204",
        accountStakeCompleted: "0",
        stakeCompleted: "0",
        tentativeWinning: false,
      },
    ],
    disputeRound: 1,
  },
  {
    marketId: "0x0000000000000000000000000000000000000011",
    stakeCompletedTotal: "30102",
    bondSizeOfNewStake: "60204",
    stakes: [
      {
        payout: [
          "0",
          "2",
        ],
        isInvalid: false,
        bondSizeCurrent: "30000",
        stakeCurrent: "30000",
        accountStakeCurrent: "102",
        accountStakeTotal: "204",
        stakeRemaining: "0",
        bondSizeTotal: "40102",
        accountStakeCompleted: "102",
        stakeCompleted: "10102",
        tentativeWinning: false,
      },
      {
        payout: [
          "1",
          "1",
        ],
        isInvalid: true,
        accountStakeCompleted: "0",
        stakeCurrent: "0",
        stakeCompleted: "20000",
        tentativeWinning: true,
      },
    ],
    disputeRound: 3,
  },
]

augur.reporting.getDisputeTokens({
  universe: "0x000000000000000000000000000000000000000b",
  account: "0x0000000000000000000000000000000000000021",
  disputeTokenState: "UNFINALIZED",
}, function (error, result) {
  console.log(result);
});
// example output:
{
  "0x0000000000000000001000000000000000000001": {
    disputeToken: "0x0000000000000000001000000000000000000001",
    marketId: "0x0000000000000000000000000000000000000011",
    payout0: "0",
    payout1: "2",
    payout2: null,
    payout3: null,
    payout4: null,
    payout5: null,
    payout6: null,
    payout7: null,
    isInvalid: false,
    balance: "17",
    winningToken: null,
    tentativeWinning: 0,
    claimed: false,
    reportingState: "CROWDSOURCING_DISPUTE",
  },
}

augur.reporting.getFeeWindowCurrent({
  universe: "0x000000000000000000000000000000000000000b",
  reporter: "0x0000000000000000000000000000000000000b0b",
}, function (error, result) {
  console.log(result);
});
// example output:
{
  endTime: 1509670273,
  feeToken: "0x1230000000000000000000000000000000000000",
  feeWindow: "0x2000000000000000000000000000000000000000",
  feeWindowEthFees: "2000",
  feeWindowFeeTokens: "100",
  feeWindowId: 457,
  feeWindowParticipationTokens: "1000",
  feeWindowRepStaked: "1100",
  participantContributions: "102",
  participantContributionsCrowdsourcer: "0",
  participantContributionsInitialReport: "102",
  participantParticipationTokens: "30",
  participationTokens: "30",
  startTime: 1509065473,
  totalStake: "132",
  universe: "0x000000000000000000000000000000000000000b",
}

augur.reporting.getFeeWindows({
  universe: "0x000000000000000000000000000000000000000b",
  account: "0x0000000000000000000000000000000000000021",
  includeCurrent: true,
}, function (error, result) {
  console.log(result);
});
// example output:
{
  "0x1000000000000000000000000000000000000000": {
    startTime: 1506473473,
    endTime: 1506473515,
    balance: "100",
    expectedFees: "333.33333333333333333333",
  },
  "0x2000000000000000000000000000000000000000": {
    startTime: 1509065473,
    endTime: 1506473515,
    balance: "500",
    expectedFees: "909.09090909090909090909",
  },
}

augur.reporting.getInitialReporters({
  universe: "0x000000000000000000000000000000000000000b",
  reporter: "0x0000000000000000000000000000000000000b0b",
}, function (error, result) {
  console.log(result);
});
// example output:
{
  "0x0000000000000000000000000000000000abe111": {
    amountStaked: "102",
    blockNumber: 1400100,
    initialReporter: " 0x0000000000000000000000000000000000abe111",
    isDesignatedReporter: 1,
    logIndex: 0,
    marketId: " 0x0000000000000000000000000000000000000019",
    redeemed: 0,
    repBalance: "4000000",
    reporter: " 0x0000000000000000000000000000000000000b0b",
    timestamp: 1506480000,
    transactionHash: "0x0000000000000000000000000000000000000000000000000000000000000E00",
  },
  "0x0000000000000000000000000000000000abe123": {
    marketId: "0x0000000000000000000000000000000000000011",
    blockNumber: 1400100,
    logIndex: 0,
    timestamp: 1506480000,
    transactionHash: "0x0000000000000000000000000000000000000000000000000000000000000E00",
    reporter: "0x0000000000000000000000000000000000000b0b",
    amountStaked: "102",
    initialReporter: "0x0000000000000000000000000000000000abe123",
    redeemed: 0,
    isDesignatedReporter: 0,
    repBalance: "2000",
  },
  "0x0000000000000000000000000000000000abe321": {
    marketId: "0x0000000000000000000000000000000000000211",
    blockNumber: 1400100,
    logIndex: 0,
    timestamp: 1506480000,
    transactionHash: "0x0000000000000000000000000000000000000000000000000000000000000E00",
    reporter: "0x0000000000000000000000000000000000000b0b",
    amountStaked: "102",
    initialReporter: "0x0000000000000000000000000000000000abe321",
    redeemed: 0,
    isDesignatedReporter: 1,
    repBalance: "2000",
  },
}

augur.reporting.getReportingFees({
  universe: "0x000000000000000000000000000000000000000b",
  reporter: "0x0000000000000000000000000000000000000b0b",
}, function (error, result) {
  console.log(result);
});
// example output:
{
  total: {
    unclaimedEth: "1200",
    unclaimedRepEarned: "0",
    unclaimedRepStaked: "391",
    unclaimedForkEth: "0",
    unclaimedForkRepStaked: "331",
    lostRep: "0",
    participationTokenRepStaked: "60",
    unclaimedParticipationTokenEthFees: "200",
  },
  feeWindows: [
    "0x1000000000000000000000000000000000000000",
  ],
  forkedMarket: {
    crowdsourcers: [
      {
        crowdsourcerId: "0x0000000000000000001000000000000000000006",
        needsFork: true,
      },
    ],
    initialReporter: {
      initialReporterId: "0x0000000000000000000000000000000000abe222",
      needsFork: true,
    },
    isFinalized: 1,
    marketId: "0x00000000000000000000000000000000000000f1",
    universe: "0x000000000000000000000000000000000000000b",
  },
  nonforkedMarkets: [
    {
      marketId: "0x0000000000000000000000000000000000000019",
      crowdsourcers: ["0x0000000000000000001000000000000000000003"],
      crowdsourcersAreDisavowed: false,
      initialReporter: "0x0000000000000000000000000000000000abe111",
      isFinalized: true,
      isMigrated: true,
      universe: "0x000000000000000000000000000000000000000b",
      unclaimedEthFees: "1000",
      unclaimedRepTotal: "331",
    },
  ],
}

augur.reporting.getReportingHistory({
  reporter: "0x0000000000000000000000000000000000000021",
  universe: "0x000000000000000000000000000000000000000b",
}, function (error, result) {
  console.log(result);
});
// example output:
{
  "0x0000000000000000000000000000000000000011": {
    initialReporter: null,
    crowdsourcers: [
      {
        transactionHash: "0x0000000000000000000000000000000000000000000000000000000000000D00",
        logIndex: 0,
        creationBlockNumber: 1400051,
        blockHash: "0x1400051",
        creationTime: 1506474500,
        marketId: "0x0000000000000000000000000000000000000011",
        feeWindow: "0x1000000000000000000000000000000000000000",
        payoutNumerators: ["0", "2"],
        amountStaked: "17",
        crowdsourcerId: "0x0000000000000000001000000000000000000001",
        isCategorical: false,
        isScalar: false,
        isInvalid: false,
        isSubmitted: true,
      },
    ],
  },
  "0x0000000000000000000000000000000000000019": {
    initialReporter: null,
    crowdsourcers: [
      {
        transactionHash: "0x0000000000000000000000000000000000000000000000000000000000000D03",
        logIndex: 0,
        creationBlockNumber: 1400052,
        blockHash: "0x1400052",
        creationTime: 1506474515,
        marketId: "0x0000000000000000000000000000000000000019",
        feeWindow: "0x1000000000000000000000000000000000000000",
        payoutNumerators: ["10000", "0", "0", "0", "0"],
        amountStaked: "229",
        crowdsourcerId: "0x0000000000000000001000000000000000000003",
        isCategorical: false,
        isScalar: false,
        isInvalid: false,
        isSubmitted: true,
      },
    ],
  },
}

augur.reporting.getReportingSummary({
  feeWindow: "0x1000000000000000000000000000000000000000"
}, function (error, result) {
  console.log(result);
});
// example output:
{
  "AWAITING_FINALIZATION": 1,
  "DESIGNATED_REPORTING": 12,
  "CROWDSOURCING_DISPUTE": 2,
  "FINALIZED": 1,
  "PRE_REPORTING": 1,
}

augur.reporting.getStakeRequiredForDesignatedReporter({
    universe: "0x000000000000000000000000000000000000000b"
}, function (error, result) {
  console.log(result);
});
// example output:
"1.2345"

augur.reporting.claimReportingFeesForkedMarket(p)

Claims unclaimed Reporting Fees a user has in any InitialReporter/DisputeCrowdsourcer contracts of a specified Forked Market, or returns a gas estimate for claiming these fees if p.estimateGas is true.

The claiming process works as follows:

Parameters:

Returns:

augur.reporting.claimReportingFeesNonforkedMarkets(p)

Claims unclaimed Reporting Fees a user has in the InitialReporter/DisputeCrowdsourcer contracts the specified non-Forked Markets or Participation Tokens of specified Fee Windows. Alternatively, it can return gas estimates for claiming these fees if p.estimateGas is true.

The claiming process works as follows:

Parameters:

Returns:

augur.reporting.finalizeMarket(p)

Finalizes a Market, meaning it sets the winning Payout Distribution Hash for the Market, redistributes REP Staked on non-winning Outcomes to REP holders who Staked on the winning Outcome, and distributes the Validity Bond based on whether the Market resolved as Invalid. Then, once the Post-Finalization Waiting Period has elapsed, users can Settle their Shares. This transaction will trigger a MarketFinalized event if the Market Finalized without any errors.

This transaction will fail if:

Parameters:

Returns:

augur.reporting.getCurrentPeriodProgress(reportingPeriodDurationInSeconds, timestamp)

Returns the percentage of the current Fee Window that has elapsed.

Parameters:

Returns:

augur.reporting.getDisputeInfo(p, callback)

Returns information about the Dispute Stake in a list of Markets.

Parameters:

Returns:

augur.reporting.getDisputeTokens(p, callback)

Returns the Dispute Tokens owned by a specific user that are either unclaimed or are in Markets that have not been Finalized.

This function will fail if:

Parameters:

Returns:

augur.reporting.getFeeWindowCurrent(p, callback)

Returns information about the current Fee Window. If p.reporter is specified, this returned information will also include the total amount of attoREP the Reporter has Staked in the current Fee Window (this includes attoREP Staked in Initial Reports, as well as attoREP Staked in Dispute Crowdsourcers) and the amount of Participation Tokens the Reporter has purchased in the current Fee Window.

This function will fail if:

Parameters:

Returns:

augur.reporting.getFeeWindows(p, callback)

Returns the Fee Windows where a specific user has unclaimed Reporting Fees.

This function will fail if:

Parameters:

Returns:

augur.reporting.getInitialReporters(p, callback)

Returns a list of InitialReporter contracts that a given Reporter has Staked REP in, along with how much attoREP was Staked and how much has been redeemed.

Parameters:

Returns:

augur.reporting.getReportingFees(p, callback)

Returns information about the unclaimed ETH and REP Reporting Fees a user has in a specific Universe.

Parameters:

Returns:

augur.reporting.getReportingHistory(p, callback)

Returns information about the Reports submitted by a particular user. For Fee 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.

This function will fail if:

Parameters:

Returns:

augur.reporting.getReportingSummary(p, callback)

Returns the number of Markets in various reporting phases. For a list of all reporting state descriptions, refer to the REPORTING_STATE type definition.

This function will fail if:

Parameters:

Returns:

augur.reporting.getStakeRequiredForDesignatedReporter(p, callback)

Returns the amount of REP a Designated Reporter must Stake when submitting a Designated Report in a given Universe.

Parameters:

Returns:

Trading Functions

// Trading Simplified API Examples:

augur.trading.calculateProfitLoss({
  trades: [{
    type: "buy",
    amount: "1",
    price: "2",
    maker: false,
  }],
  lastPrice: "2"
});
// example output:
{
  position: "1",
  meanOpenPrice: "2",
  realized: "0",
  queued: "0",
  unrealized: "0"
}

augur.trading.calculateTradeCost({
  displayPrice: "2",
  displayAmount: "10",
  numTicks: "10000",
  maxDisplayPrice: "10",
  minDisplayPrice: "0",
  orderType: 0,
});
// example output:
{
  "cost": "20000000000000000000",
  "onChainAmount": "10000000000000000",
  "onChainPrice": "2000"
}

augur.trading.claimMarketsTradingProceeds({
  markets: [
    "0x0000000000000000000000000000000000000001",
    "0x0000000000000000000000000000000000000002",
  ],
  _shareHolder: "0x8fa56abe36d8dc76cf85fecb6a3026733e0a12ac",
  meta: {
    accountType: "privateKey",
    address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
    signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
  },
  onSent: function(result) { console.log(result); },
  onSuccess: function(result) { console.log(result); },
  onFailed: function(result) { console.log(result); }
});
// example onSuccess output:
[
  "0x0000000000000000000000000000000000000001",
  "0x0000000000000000000000000000000000000002",
]

augur.trading.claimTradingProceeds({
  _market: "0x0000000000000000000000000000000000000001",
  _shareHolder: "0x8fa56abe36d8dc76cf85fecb6a3026733e0a12ac",
  meta: {
    accountType: "privateKey",
    address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
    signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
  },
  onSent: function(result) { console.log(result); },
  onSuccess: function(result) { console.log(result); },
  onFailed: function(result) { console.log(result); }
});
// This function does not return a value.

augur.trading.denormalizePrice({
  minPrice: "0",
  maxPrice: "2",
  normalizedPrice: "0.2",
});
// example output:
"0.4"

// selling: 5 bids, 1 from user, 2 with price too low
augur.trading.filterAndSortByPrice({
  singleOutcomeOrderBookSide: {
    0x1000000000000000000000000000000000000000000000000000000000000000: {
      amount: "2",
      fullPrecisionPrice: "0.6",
      owner: "0x8fa56abe36d8dc76cf85fecb6a3026733e0a12ac",
    },
    0x2000000000000000000000000000000000000000000000000000000000000000: {
      amount: "1",
      fullPrecisionPrice: "0.5",
      owner: "0x8fa56abe36d8dc76cf85fecb6a3026733e0a12ac",
    },
    0x3000000000000000000000000000000000000000000000000000000000000000: {
      amount: "3",
      fullPrecisionPrice: "0.7",
      owner: "0x8fa56abe36d8dc76cf85fecb6a3026733e0a12ac",
    },
    0x4000000000000000000000000000000000000000000000000000000000000000: {
      amount: "42",
      fullPrecisionPrice: "0.4",
      owner: "0x8fa56abe36d8dc76cf85fecb6a3026733e0a12ac",
    },
  },
  orderType: 1,
  price: "0.6",
});
// example output:
[
  {
    amount: "3",
    fullPrecisionPrice: "0.7",
    owner: "0x8fa56abe36d8dc76cf85fecb6a3026733e0a12ac",
  }, {
    amount: "2",
    fullPrecisionPrice: "0.6",
    owner: "0x8fa56abe36d8dc76cf85fecb6a3026733e0a12ac",
  }
]

augur.trading.generateTradeGroupId();
// example output:
"0x80e8bdd8c5a8178a4ad29b31722f22c768135dff2709437c7a5ebd0a0ec475f1"

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",
  orderType: "buy",
  orderState: "OPEN",
}, function (error, result) {
  console.log(result);
});
// example output:
{
  "0x0000000000000000000000000000000000000001": {
    0: {
      buy: {
        "0x1000000000000000000000000000000000000000000000000000000000000000": {
          orderId: "0x1000000000000000000000000000000000000000000000000000000000000000",
          shareToken: "0x0100000000000000000000000000000000000000",
          transactionHash: "0x0000000000000000000000000000000000000000000000000000000000000A00",
          logIndex: 0,
          owner: "0x0000000000000000000000000000000000000b0b",
          creationTime: 1506473500,
          creationBlockNumber: 1400001,
          orderState: "OPEN",
          price: "0.7",
          amount: "1",
          originalAmount: "1",
          fullPrecisionPrice: "0.7",
          fullPrecisionAmount: "1",
          originalFullPrecisionAmount: "1",
          originalTokensEscrowed: "0.7",
          originalSharesEscrowed: "0",
          tokensEscrowed: "0.7",
          sharesEscrowed: "0",
        },
        "0x2000000000000000000000000000000000000000000000000000000000000000": {
          orderId: "0x2000000000000000000000000000000000000000000000000000000000000000",
          shareToken: "0x0100000000000000000000000000000000000000",
          transactionHash: "0x0000000000000000000000000000000000000000000000000000000000000A01",
          logIndex: 0,
          owner: "0x000000000000000000000000000000000000d00d",
          creationTime: 1506473515,
          creationBlockNumber: 1400002,
          orderState: "OPEN",
          price: "0.6",
          amount: "2",
          originalAmount: "2",
          fullPrecisionPrice: "0.600001",
          fullPrecisionAmount: "2",
          originalFullPrecisionAmount: "2",
          originalTokensEscrowed: "1.200002",
          originalSharesEscrowed: "0",
          tokensEscrowed: "1.200002",
          sharesEscrowed: "0",
        },
        "0x5000000000000000000000000000000000000000000000000000000000000000": {
          orderId: "0x5000000000000000000000000000000000000000000000000000000000000000",
          shareToken: "0x0100000000000000000000000000000000000000",
          transactionHash: "0x0000000000000000000000000000000000000000000000000000000000000A06",
          logIndex: 0,
          owner: "0x0000000000000000000000000000000000000b0b",
          creationTime: 1506473500,
          creationBlockNumber: 1400001,
          orderState: "OPEN",
          price: "0.73",
          amount: "1",
          originalAmount: "1",
          fullPrecisionPrice: "0.73",
          fullPrecisionAmount: "1",
          originalFullPrecisionAmount: "1",
          originalTokensEscrowed: "0.73",
          originalSharesEscrowed: "0",
          tokensEscrowed: "0.73",
          sharesEscrowed: "0",
        },
      },
    },
    1: {
      buy: {
        "0x3000000000000000000000000000000000000000000000000000000000000000": {
          orderId: "0x3000000000000000000000000000000000000000000000000000000000000000",
          shareToken: "0x2000000000000000000000000000000000000000",
          transactionHash: "0x0000000000000000000000000000000000000000000000000000000000000A02",
          logIndex: 0,
          owner: "0x000000000000000000000000000000000000d00d",
          creationTime: 1506473515,
          creationBlockNumber: 1400002,
          orderState: "OPEN",
          price: "0.6",
          amount: "2",
          originalAmount: "2",
          fullPrecisionPrice: "0.6",
          fullPrecisionAmount: "2.0000001",
          originalFullPrecisionAmount: "2.0000001",
          originalTokensEscrowed: "1.20000006",
          originalSharesEscrowed: "0",
          tokensEscrowed: "1.20000006",
          sharesEscrowed: "0",
        },
      },
    },
  },
}

augur.trading.getPositionInMarket({
  address: "0x25ff5dc79a7c4e34254ff0f4a19d69e491201dd3",
  market: "0x2221185d7f125b84ac4a1837a0688d2bb58e8491",
  tickSize: "0.0001",
}, function (error, result) {
  console.log(result);
});
// example output:
["1", "0.5", "1", "0", "0", "1", "1.5"]

augur.trading.getUserTradingHistory({
  account: "0x000000000000000000000000000000000000d00d",
  marketId: "0x0000000000000000000000000000000000000001",
  outcome: 0,
  sortBy: "price",
}, function (error, result) {
  console.log(result);
});
// example output:
[
  {
    transactionHash: "0x0000000000000000000000000000000000000000000000000000000000000C00",
    logIndex: 0,
    orderId: "0x1100000000000000000000000000000000000000000000000000000000000000",
    type: "buy",
    price: "5.5",
    amount: "0.2",
    maker: false,
    marketCreatorFees: "0",
    reporterFees: "0",
    selfFilled: false,
    creator: "0x0000000000000000000000000000000000000b0b",
    filler: "0x000000000000000000000000000000000000d00d",
    settlementFees: "0",
    marketId: "0x0000000000000000000000000000000000000001",
    outcome: 0,
    shareToken: "0x0100000000000000000000000000000000000000",
    timestamp: 1506474500,
    tradeGroupId: null,
  }, {
    amount: "2",
    logIndex: 0,
    maker: false,
    marketCreatorFees: "0",
    marketId: "0x0000000000000000000000000000000000000001",
    orderId: "0x1990000000000000000000000000000000000000000000000000000000000000",
    outcome: 0,
    price: "4.2",
    reporterFees: "0",
    selfFilled: false,
    creator: "0x0000000000000000000000000000000000000b0b",
    filler: "0x000000000000000000000000000000000000d00d",
    settlementFees: "0",
    shareToken: "0x0100000000000000000000000000000000000000",
    timestamp: 1509065474,
    tradeGroupId: null,
    transactionHash: "0x00000000000000000000000000000000000000000000000000000000d3adb33f",
    type: "sell",
  }
]

augur.trading.getUserTradingPositions({
  universe: "0x02149d40d255fceac54a3ee3899807b0539bad60",
  account: "0xE4EC477Bc4Abd2B18225Bb8CBa14BF57867f082B",
}, function (error, result) {
  console.log(result);
});
// example output:
{
  tradingPositions: [
    {
      position: "0.901",
      marketId: "0x37adbd757099107946ceebb1791c5c6acda635fe",
      outcome: 1,
      timestamp: 1556857905,
      netPosition: "0.901",
      realized: "0",
      unrealized: "0.4505",
      total: "0.4505",
      averagePrice: "0.5",
      unrealizedCost: "0.4505",
      realizedCost: "0",
      totalCost: "0.4505",
      realizedPercent: "0",
      unrealizedPercent: "1",
      totalPercent: "1",
      unrealizedRevenue: "0.901",
      frozenFunds: "0.4505",
      lastTradePrice: "1",
      lastTradePrice24hAgo: "1",
      lastTradePrice24hChangePercent: "0",
      unrealizedRevenue24hAgo: "0.901",
      unrealizedRevenue24hChangePercent: "0"
    },
    {
      position: "0.011",
      marketId: "0x76a0067b4d3a6db11187a849b50a076e030e95ce",
      outcome: 1,
      timestamp: 1556857905,
      netPosition: "0.011",
      realized: "0",
      unrealized: "0.00993999999999999999996",
      total: "0.00993999999999999999996",
      averagePrice: "0.09636363636363636364",
      unrealizedCost: "0.00106000000000000000004",
      realizedCost: "0",
      totalCost: "0.00106000000000000000004",
      realizedPercent: "0",
      unrealizedPercent: "9.37735849056603773546",
      totalPercent: "9.37735849056603773546",
      unrealizedRevenue: "0.011",
      frozenFunds: "0.00106",
      lastTradePrice: "1",
      lastTradePrice24hAgo: "1",
      lastTradePrice24hChangePercent: "0",
      unrealizedRevenue24hAgo: "0.011",
      unrealizedRevenue24hChangePercent: "0"
    },
    {
      position: "0",
      marketId: "0x448d1d8280844513c38b2b73bde8a539d0022954",
      outcome: 1,
      timestamp: 1556857905,
      netPosition: "-0.01",
      realized: "0",
      unrealized: "-0.0019",
      total: "-0.0019",
      averagePrice: "0.01",
      unrealizedCost: "0.0099",
      realizedCost: "0",
      totalCost: "0.0099",
      realizedPercent: "0",
      unrealizedPercent: "-0.19191919191919191919",
      totalPercent: "-0.19191919191919191919",
      unrealizedRevenue: "0.008",
      frozenFunds: "0.0099",
      lastTradePrice: "0.2",
      lastTradePrice24hAgo: "0.2",
      lastTradePrice24hChangePercent: "0",
      unrealizedRevenue24hAgo: "0.008",
      unrealizedRevenue24hChangePercent: "0"
    },
    {
      position: "0",
      marketId: "0x6f5a05c21ff65c476d4b91f886984cd9c6797576",
      outcome: 1,
      timestamp: 1556857905,
      netPosition: "-0.1",
      realized: "0",
      unrealized: "-0.21",
      total: "-0.21",
      averagePrice: "40",
      unrealizedCost: "0.92",
      realizedCost: "0",
      totalCost: "0.92",
      realizedPercent: "0",
      unrealizedPercent: "-0.2282608695652173913",
      totalPercent: "-0.2282608695652173913",
      unrealizedRevenue: "0.71",
      frozenFunds: "0.92",
      lastTradePrice: "42.1",
      lastTradePrice24hAgo: "75.9",
      lastTradePrice24hChangePercent: "-0.8028503562945368171",
      unrealizedRevenue24hAgo: "-2.67",
      unrealizedRevenue24hChangePercent: "-1.26591760299625468165"
    },
    {
      position: "0",
      marketId: "0x84c47b8af766f19f14d1deb9bbcd99782422bba4",
      outcome: 1,
      timestamp: 1556857905,
      netPosition: "-0.009",
      realized: "0.0005",
      unrealized: "-0.252",
      total: "-0.2515",
      averagePrice: "12",
      unrealizedCost: "0.288",
      realizedCost: "0.032",
      totalCost: "0.32",
      realizedPercent: "0.015625",
      unrealizedPercent: "-0.875",
      totalPercent: "-0.7859375",
      unrealizedRevenue: "0.036",
      frozenFunds: "0.321",
      lastTradePrice: "40",
      lastTradePrice24hAgo: "51",
      lastTradePrice24hChangePercent: "-0.275",
      unrealizedRevenue24hAgo: "-0.063",
      unrealizedRevenue24hChangePercent: "-1.57142857142857142857"
    }
  ],
  tradingPositionsPerMarket: {
    "0x37adbd757099107946ceebb1791c5c6acda635fe": {
      timestamp: 1556857905,
      marketId: "0x37adbd757099107946ceebb1791c5c6acda635fe",
      realizedPercent: "0",
      unrealizedPercent: "1",
      totalPercent: "1",
      unrealizedRevenue24hChangePercent: "0",
      realized: "0",
      unrealized: "0.4505",
      total: "0.4505",
      unrealizedCost: "0.4505",
      realizedCost: "0",
      totalCost: "0.4505",
      unrealizedRevenue: "0.901",
      frozenFunds: "0.4505",
      unrealizedRevenue24hAgo: "0.901"
    },
    "0x76a0067b4d3a6db11187a849b50a076e030e95ce": {
      timestamp: 1556857905,
      marketId: "0x76a0067b4d3a6db11187a849b50a076e030e95ce",
      realizedPercent: "0",
      unrealizedPercent: "9.37735849056603773546",
      totalPercent: "9.37735849056603773546",
      unrealizedRevenue24hChangePercent: "0",
      realized: "0",
      unrealized: "0.00993999999999999999996",
      total: "0.00993999999999999999996",
      unrealizedCost: "0.00106000000000000000004",
      realizedCost: "0",
      totalCost: "0.00106000000000000000004",
      unrealizedRevenue: "0.011",
      frozenFunds: "0.00106",
      unrealizedRevenue24hAgo: "0.011"
    },
    "0x448d1d8280844513c38b2b73bde8a539d0022954": {
      timestamp: 1556857905,
      marketId: "0x448d1d8280844513c38b2b73bde8a539d0022954",
      realizedPercent: "0",
      unrealizedPercent: "-0.19191919191919191919",
      totalPercent: "-0.19191919191919191919",
      unrealizedRevenue24hChangePercent: "0",
      realized: "0",
      unrealized: "-0.0019",
      total: "-0.0019",
      unrealizedCost: "0.0099",
      realizedCost: "0",
      totalCost: "0.0099",
      unrealizedRevenue: "0.008",
      frozenFunds: "0.0099",
      unrealizedRevenue24hAgo: "0.008"
    },
    "0x6f5a05c21ff65c476d4b91f886984cd9c6797576": {
      timestamp: 1556857905,
      marketId: "0x6f5a05c21ff65c476d4b91f886984cd9c6797576",
      realizedPercent: "0",
      unrealizedPercent: "-0.2282608695652173913",
      totalPercent: "-0.2282608695652173913",
      unrealizedRevenue24hChangePercent: "-1.26591760299625468165",
      realized: "0",
      unrealized: "-0.21",
      total: "-0.21",
      unrealizedCost: "0.92",
      realizedCost: "0",
      totalCost: "0.92",
      unrealizedRevenue: "0.71",
      frozenFunds: "0.92",
      unrealizedRevenue24hAgo: "-2.67"
    },
    "0x84c47b8af766f19f14d1deb9bbcd99782422bba4": {
      timestamp: 1556857905,
      marketId: "0x84c47b8af766f19f14d1deb9bbcd99782422bba4",
      realizedPercent: "0.015625",
      unrealizedPercent: "-0.875",
      totalPercent: "-0.7859375",
      unrealizedRevenue24hChangePercent: "-1.57142857142857142857",
      realized: "0.0005",
      unrealized: "-0.252",
      total: "-0.2515",
      unrealizedCost: "0.288",
      realizedCost: "0.032",
      totalCost: "0.32",
      unrealizedRevenue: "0.036",
      frozenFunds: "0.321",
      unrealizedRevenue24hAgo: "-0.063"
    }
  },
  tradingPositionsTotal: {
    realizedPercent: "0.015625",
    unrealizedPercent: "-0.00207252644567704527",
    totalPercent: "-0.00173968239041764132",
    unrealizedRevenue24hChangePercent: "-1.91891891891891891892",
    realized: "0.0005",
    unrealized: "-0.00346000000000000000004",
    total: "-0.00296000000000000000004",
    unrealizedCost: "1.66946000000000000000004",
    realizedCost: "0.032",
    totalCost: "1.70146000000000000000004",
    unrealizedRevenue: "1.666",
    frozenFunds: "1.70246",
    unrealizedRevenue24hAgo: "-1.813"
  },
  frozenFundsTotal: {
    frozenFunds: "1.70246"
  }
}

augur.trading.normalizePrice({
  minPrice: "0",
  maxPrice: "2",
  price: "0.4",
});
// example output:
"0.2"

augur.trading.placeTrade({
  amount: "10",
  sharesProvided: "0",
  limitPrice: "2",
  minPrice: "1",
  maxPrice: "3",
  numTicks: "10000",
  _direction: 0,
  _market: "0x8092bdf939e23a0e926021ffce5a062d0f598d1f",
  _outcome: 0,
  doNotCreateOrders: false,
  meta: {
    accountType: "privateKey",
    address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
    signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
  },
  onSent: function(result) { console.log(result); },
  onSuccess: function(result) { console.log(result); },
  onFailed: function(result) { console.log(result); }
});
// This function does not return a value, but it calls the function `augur.trading.tradeUntilAmountIsZero`, which logs information to the console as it places Orders. To see this output, refer to the JS sample code for `augur.trading.tradeUntilAmountIsZero`.

augur.trading.simulateTrade({
  orderType: 0,
  outcome: 0,
  shares: "3",
  shareBalances: ["0", "5"],
  tokenBalance: "0",
  minPrice: "0",
  maxPrice: "1",
  numTicks: "10000",
  price: "0.7",
  marketCreatorFeeRate: "0",
  reportingFeeRate: "0.01",
  shouldCollectReportingFees: 1,
  singleOutcomeOrderBook: {
    buy: {
      0x1000000000000000000000000000000000000000000000000000000000000000: {
        amount: "2",
        fullPrecisionPrice: "0.7",
        sharesEscrowed: "2",
        owner: "0x2228238db7ad03e505840bd361dc2f521a72adbc",
      },
    },
    sell: {
      0x2000000000000000000000000000000000000000000000000000000000000000: {
        amount: "2",
        fullPrecisionPrice: "0.7",
        sharesEscrowed: "2",
        owner: "0x2228238db7ad03e505840bd361dc2f521a72adbc",
      },
    },
  },
}, function (error, result) {
  console.log(result);
});
// example output:
{
  sharesFilled: "2",
  settlementFees: "0.006",
  worstCaseFees: "0.009",
  otherSharesDepleted: "3",
  sharesDepleted: "0",
  tokensDepleted: "0",
  shareBalances: ["0", "2"],
}

augur.trading.tradeUntilAmountIsZero({
  _price: "0.5",
  _fxpAmount: "10",
  sharesProvided: "0",
  numTicks: "10000",
  minPrice: "0",
  maxPrice: "1",
  _direction: 0,
  _market: "0x8092bdf939e23a0e926021ffce5a062d0f598d1f",
  _outcome: 0,
  numOutcomes: 2,
  doNotCreateOrders: false,
  meta: {
    accountType: "privateKey",
    address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
    signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
  },
  onSent: function(result) { console.log(result); },
  onSuccess: function(result) { console.log(result); },
  onFailed: function(result) { console.log(result); }
});
// This function does not return a value, but it does log information to the console as it places Orders:
"tradeUntilAmountIsZero: "
{
  "_price": "0.5",
  "_fxpAmount": "10",
  "numTicks": "10000",
  "minPrice": "0",
  "maxPrice": "1",
  "_direction": 0,
  "_market": "0x524925edb7a29cc35d886968253cb5e209655cf4",
  "_outcome": 0,
  "numOutcomes": 2,
  "doNotCreateOrders": false
}
{"cost":"5000000000000000000","onChainAmount":"1000000000000000","onChainPrice":"5000"}
"cost: 5000000000000000000 wei 5 eth"
undefined
"estimated gas cost: 6175000000000000 wei 0.006175 eth"
{
  "hash": "0xb134d37fb8a72957cb26267170ce4ca294e1e3d239622416529b7b795330ca08",
  "callReturn": "0x4bbc239211b4e207eb9a05a071b3a5bb96b5b5573b29d26c18e2c31ffc70d105"
}
"TokensTransferred: "
{
  "from": "0x913da4198e6be1d5f5e4a40d0667f70c0b5430eb",
  "to": "0x524925edb7a29cc35d886968253cb5e209655cf4",
  "value": "5000000000000000000",
  "address": "0xd3a7c274e3e7b1990a9c23bec98adc2b7c448ac5",
  "removed": false,
  "transactionHash": "0xb134d37fb8a72957cb26267170ce4ca294e1e3d239622416529b7b795330ca08",
  "transactionIndex": 0,
  "logIndex": 1,
  "blockNumber": 18336,
  "blockHash": "0xb79a66c248ae8888f49773569ac19bd97ebb565222e4e37e5f903e5a82d9c97d",
  "contractName": "Cash",
  "eventName": "Transfer",
  "sender": "0x913da4198e6be1d5f5e4a40d0667f70c0b5430eb",
  "recipient": "0x524925edb7a29cc35d886968253cb5e209655cf4",
  "token": "0xd3a7c274e3e7b1990a9c23bec98adc2b7c448ac5"
}
"convertLogToTransaction Transfer"
{
  "from": "0x913da4198e6be1d5f5e4a40d0667f70c0b5430eb",
  "to": "0x524925edb7a29cc35d886968253cb5e209655cf4",
  "value": "5000000000000000000",
  "address": "0xd3a7c274e3e7b1990a9c23bec98adc2b7c448ac5",
  "removed": false,
  "transactionHash": "0xb134d37fb8a72957cb26267170ce4ca294e1e3d239622416529b7b795330ca08",
  "transactionIndex": 0,
  "logIndex": 1,
  "blockNumber": 18336,
  "blockHash": "0xb79a66c248ae8888f49773569ac19bd97ebb565222e4e37e5f903e5a82d9c97d",
  "contractName": "Cash",
  "eventName": "Transfer",
  "sender": "0x913da4198e6be1d5f5e4a40d0667f70c0b5430eb",
  "recipient": "0x524925edb7a29cc35d886968253cb5e209655cf4",
  "token": "0xd3a7c274e3e7b1990a9c23bec98adc2b7c448ac5"
}
"Order Created: "
{
  "orderType": "buy",
  "amount": "10",
  "price": "0.5",
  "creator": "0x913da4198e6be1d5f5e4a40d0667f70c0b5430eb",
  "moneyEscrowed": "5000000000000000000",
  "sharesEscrowed": "0",
  "tradeGroupId": "0x0000000000000000000000000000000000000000000000000000000000000000",
  "orderId": "0xe7505184c6ab0bab27793dc2804fb066465541e282c135232fa2ef7e964e2e7d",
  "universe": "0x04252fa3b79b7626ffc87144dafeed0838eecd59",
  "shareToken": "0x9315db4f8e425fa0ba47ae5fce58bbe9e9b18fea",
  "address": "0x25ff5dc79a7c4e34254ff0f4a19d69e491201dd3",
  "removed": false,
  "transactionHash": "0xb134d37fb8a72957cb26267170ce4ca294e1e3d239622416529b7b795330ca08",
  "transactionIndex": 0,
  "logIndex": 2,
  "blockNumber": 18336,
  "blockHash": "0xb79a66c248ae8888f49773569ac19bd97ebb565222e4e37e5f903e5a82d9c97d",
  "contractName": "Augur",
  "eventName": "OrderCreated",
  "marketId": "0x524925edb7a29cc35d886968253cb5e209655cf4",
  "outcome": 0,
  "orderCreator": "0x913da4198e6be1d5f5e4a40d0667f70c0b5430eb",
  "orderState": "OPEN",
  "fullPrecisionPrice": "0.5",
  "fullPrecisionAmount": "10",
  "tokensEscrowed": "5"
}
"convertTradeLogToTransaction CreateOrder"
{
  "0x524925edb7a29cc35d886968253cb5e209655cf4": {
    "0": [
      {
        "orderType": "buy",
        "amount": "10",
        "price": "0.5",
        "creator": "0x913da4198e6be1d5f5e4a40d0667f70c0b5430eb",
        "moneyEscrowed": "5000000000000000000",
        "sharesEscrowed": "0",
        "tradeGroupId": "0x0000000000000000000000000000000000000000000000000000000000000000",
        "orderId": "0xe7505184c6ab0bab27793dc2804fb066465541e282c135232fa2ef7e964e2e7d",
        "universe": "0x04252fa3b79b7626ffc87144dafeed0838eecd59",
        "shareToken": "0x9315db4f8e425fa0ba47ae5fce58bbe9e9b18fea",
        "address": "0x25ff5dc79a7c4e34254ff0f4a19d69e491201dd3",
        "removed": false,
        "transactionHash": "0xb134d37fb8a72957cb26267170ce4ca294e1e3d239622416529b7b795330ca08",
        "transactionIndex": 0,
        "logIndex": 2,
        "blockNumber": 18336,
        "blockHash": "0xb79a66c248ae8888f49773569ac19bd97ebb565222e4e37e5f903e5a82d9c97d",
        "contractName": "Augur",
        "eventName": "OrderCreated",
        "marketId": "0x524925edb7a29cc35d886968253cb5e209655cf4",
        "outcome": 0,
        "orderCreator": "0x913da4198e6be1d5f5e4a40d0667f70c0b5430eb",
        "orderState": "OPEN",
        "fullPrecisionPrice": "0.5",
        "fullPrecisionAmount": "10",
        "tokensEscrowed": "5"
      }
    ]
  }
}
"constructTradingTransaction: CreateOrder "
{
  "orderType": "buy",
  "amount": "10",
  "price": "0.5",
  "creator": "0x913da4198e6be1d5f5e4a40d0667f70c0b5430eb",
  "moneyEscrowed": "5000000000000000000",
  "sharesEscrowed": "0",
  "tradeGroupId": "0x0000000000000000000000000000000000000000000000000000000000000000",
  "orderId": "0xe7505184c6ab0bab27793dc2804fb066465541e282c135232fa2ef7e964e2e7d",
  "universe": "0x04252fa3b79b7626ffc87144dafeed0838eecd59",
  "shareToken": "0x9315db4f8e425fa0ba47ae5fce58bbe9e9b18fea",
  "address": "0x25ff5dc79a7c4e34254ff0f4a19d69e491201dd3",
  "removed": false,
  "transactionHash": "0xb134d37fb8a72957cb26267170ce4ca294e1e3d239622416529b7b795330ca08",
  "transactionIndex": 0,
  "logIndex": 2,
  "blockNumber": 18336,
  "blockHash": "0xb79a66c248ae8888f49773569ac19bd97ebb565222e4e37e5f903e5a82d9c97d",
  "contractName": "Augur",
  "eventName": "OrderCreated",
  "marketId": "0x524925edb7a29cc35d886968253cb5e209655cf4",
  "outcome": 0,
  "orderCreator": "0x913da4198e6be1d5f5e4a40d0667f70c0b5430eb",
  "orderState": "OPEN",
  "fullPrecisionPrice": "0.5",
  "fullPrecisionAmount": "10",
  "tokensEscrowed": "5"
}
"getTradeAmountRemaining initial amount remaining: 1000000000000000 ocs 10 shares"
"starting amount:  1000000000000000 ocs 10 shares"
"remaining amount: 0 ocs 0 shares"
"actual cost:      5000000000000000000 wei 5 eth"
"tradeUntilAmountIsZero: "
{
  "_price": "0.5",
  "_fxpAmount": "0",
  "numTicks": "10000",
  "minPrice": "0",
  "maxPrice": "1",
  "_direction": 0,
  "_market": "0x524925edb7a29cc35d886968253cb5e209655cf4",
  "_outcome": 0,
  "numOutcomes": 2,
  "doNotCreateOrders": false,
  "estimatedCost": null
}
{"cost":"0","onChainAmount":"0","onChainPrice":"5000"}
"cost: 0 wei 0 eth"
null

augur.trading.calculateProfitLoss(p)

Calculates realized and unrealized profit/loss for trades in a single Outcome. Note: buy/sell labels are from taker’s point of view.

Parameters:

Returns:

augur.trading.calculateTradeCost(p)

Returns the cost for placing a specific trade.

Parameters:

Returns:

augur.trading.claimMarketsTradingProceeds(p)

Similar to the function augur.trading.claimTradingProceeds, but attempts to collect trading profits in Ether from a user’s outstanding Shares in multiple Finalized Markets instead of a single Finalized Market.

Parameters:

Returns:

augur.trading.claimTradingProceeds(p)

Attempts to collect trading profits in Ether from a user’s outstanding Shares in a single Finalized Market.

This function will fail if:

Parameters:

Returns:

augur.trading.denormalizePrice(p)

Rescales a price to its display range [minPrice, maxPrice]: displayPrice = normalizedPrice*(maxPrice - minPrice) + minPrice.

Parameters:

Returns:

augur.trading.filterAndSortByPrice(p)

Accepts a SingleOutcomeOrderBookSide object, and filters out all Orders where the price is below p.price (for Bid Orders) or above p.price (for Ask Orders). Returns the remaining Orders sorted by p.price. Bid Orders are sorted descendingly, Ask Orders are sorted ascendingly.

Parameters:

Returns:

augur.trading.generateTradeGroupId(tradeGroupIdNumBytes)

Returns a randomly-generated trade group ID. (Trade group IDs are used by Augur’s UI to group orders.)

Parameters:

Returns:

augur.trading.getBetterWorseOrders(p, callback)

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.)

This function will fail if:

Parameters:

Returns:

augur.trading.getOrders(p, callback)

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

This function will fail if:

Parameters:

Returns:

augur.trading.getPositionInMarket(p, callback)

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

Parameters:

Returns:

augur.trading.getUserTradingHistory(p, callback)

Returns information about the trades a specific user has made.

This function will fail if:

Parameters:

Returns:

augur.trading.getUserTradingPositions(p, callback)

Returns the trading positions held by a specific user.

This function will fail if:

Parameters:

Returns:

augur.trading.normalizePrice(p)

Rescales a price to lie on [0, 1]: normalizedPrice = (price - minPrice) / (maxPrice - minPrice).

Parameters:

Returns:

augur.trading.placeTrade(p)

Parameters:

Returns:

augur.trading.simulateTrade(p, callback)

Determines the sequence of makes/takes that will be executed to Fill the specified Order, and returns the user’s projected balances and fees paid after this sequence is completed. Note: This function automatically normalizes Share prices, so “display prices” can be passed in directly for minPrice, maxPrice, and price.

Parameters:

Returns:

augur.trading.tradeUntilAmountIsZero(p, callback)

If p.doNotCreateOrders is set to true, this function will place trades until all Orders equal to or better than the specified price limit are removed from the Order Book.

If p.doNotCreateOrders is set to false, this function will place trades until the user’s request has been fulfilled. This is done by attempting to trade until all Orders equal to or better than the specified limit price are removed from the Order Book and then creating a new Order with whatever amount is remaining in the user’s request.

Parameters:

Returns:

Utils Functions

// Utils Simplified API Examples:

// Note: The examples below are executed in Node.js and require the BigNumber library (https://github.com/MikeMcl/bignumber.js/).
var BigNumber = require("bigNumber.js");

var bigNumber = new BigNumber("300000000000000000000000000000000000000000000000000");
console.log(augur.utils.convertBigNumberToHexString(bigNumber));
// example output:
"0xcd44b141ecb73397784c0f9ef9202c000000000000"

var displayAmount = new BigNumber("10");
var tickSize = new BigNumber("0.0001");
console.log(augur.utils.convertDisplayAmountToOnChainAmount(displayAmount, tickSize));
// example output:
BigNumber { s: 1, e: 15, c: [10] }

var displayPrice = new BigNumber("10");
var minDisplayPrice = new BigNumber("0");
var tickSize = new BigNumber("0.0001");
console.log(augur.utils.convertDisplayPriceToOnChainPrice(displayPrice, minDisplayPrice, tickSize));
// example output:
BigNumber { s: 1, e: 5, c: [100000] }

var onChainAmount = new BigNumber("1000000000000000");
var tickSize = new BigNumber("0.0001");
console.log(augur.utils.convertOnChainAmountToDisplayAmount(onChainAmount, tickSize));
// example output:
BigNumber { s: 1, e: 1, c: [10] }

var onChainPrice = new BigNumber("100000");
var minDisplayPrice = new BigNumber("0");
var tickSize = new BigNumber("0.0001");
console.log(augur.utils.convertOnChainPriceToDisplayPrice(onChainPrice, minDisplayPrice, tickSize));
// example output:
BigNumber { s: 1, e: 1, c: [10] }

augur.utils.convertBigNumberToHexString

Returns a hexadecimal string that is equivalent to bigNumber.

Parameters:

Returns:

(string) A hexadecimal string that is equivalent to bigNumber.

augur.utils.convertDisplayAmountToOnChainAmount

Converts a given number of Shares (as it is displayed by Augur’s UI) to the equivalent number of Shares as it is stored on the Ethereum blockchain.

Parameters:

Returns:

(BigNumber) Equivalent number of Shares as it is stored on the Ethereum blockchain.

augur.utils.convertDisplayPriceToOnChainPrice

Converts a Maximum Display Price (as displayed by Augur’s UI) to the equivalent price as it is stored on the Ethereum blockchain.

Parameters:

Returns:

(BigNumber) Equivalent price as it is stored on the Ethereum blockchain.

augur.utils.convertOnChainAmountToDisplayAmount

Converts a given number of Shares (as it is stored on the Ethereum blockchain) to the equivalent number of Shares as it is displayed in Augur’s UI.

Parameters:

Returns:

(BigNumber) Equivalent number of Shares as it is displayed in Augur’s UI.

augur.utils.convertOnChainPriceToDisplayPrice

Converts a Maximum Display Price (as it is stored on the Ethereum blockchain) to the equivalent price as it is displayed in Augur’s UI.

Parameters:

Returns:

(BigNumber) Equivalent price as it is displayed in Augur’s UI.

Call API

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

var market = "0x9368ff3e9ce1c0459b309fac6dd4e69229b91a42";

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

augur.api.Market.getNumberOfOutcomes({ 
  tx: { to: market } 
}, function (error, numberOfOutcomes) {
  console.log(error);
  console.log(numberOfOutcomes);
});
// console prints 2

The Call API of augur.js is made up of “getter” functions that retrieve information from Augur’s Solidity smart contracts using Ethereum’s eth_call RPC; however, these functions do not write any information to the Ethereum blockchain. The Call API is intended for more granular “gets” than the Simplified API allows, and its functions are mapped directly to the public functions of Augur’s Solidity smart contracts.

All functions in the Call API accept two arguments:

  1. p, a parameters object containing any key/value pairs matching the input parameters for the contract method, and (in some cases) a tx object with the Ethereum contract address to call. The tx object is described in more detail in the Transaction API section.
  2. A callback function.

The Call API functions are part of the augur.api object and follow a pattern of augur.api.<Contract Name>.<Contract Function>(<Parameters Object>, <Callback Function>).

Augur Call API

augur.api.Augur.isKnownCrowdsourcer({ 
  _universe: "0x3336eaefcfaf7ea1e17c4768a554d57800699555"
}, function (error, isKnownCrowdsourcer) { 
  console.log(isKnownCrowdsourcer); 
});
// example output:
true

augur.api.Augur.isKnownUniverse({ 
  _universe: "0x22d6eaefcfaf7ea1e17c4768a554d57800699ecc"
}, function (error, isKnownUniverse) { 
  console.log(isKnownUniverse); 
});
// example output:
true

Provides JavaScript bindings for the Augur Solidity Contract, which handles Universe creation and event logging.

augur.api.Augur.isKnownCrowdsourcer(p, callback)

Augur keeps track of its Crowdsourcers internally. This function returns whether the specified Crowdsourcer is a contract address that is known to Augur.

Parameters:

Returns:

augur.api.Augur.isKnownUniverse(p, callback)

Augur keeps track of its Genesis Universes and all Child Universes internally. This function returns whether the specified Universe is a Universe contract address that is known to Augur.

Parameters:

Returns:

Cash Call API

// Cash Call API Examples:

// The Ethereum contract address for Augur.sol can be 
// obtained by calling `augur.augurNode.getSyncData`.
var _augurContractAddress = "0x67cbf60a24ab922af99e6f335c0ff2b084d5bdbe";

augur.api.Cash.allowance({
  _owner: "0x913da4198e6be1d5f5e4a40d0667f70c0b5430eb",
  _spender: _augurContractAddress,
}, function(error, allowance) {
  console.log(allowance); 
});
// example output:
"115792089237316195423570985008687907853269984665640564039457584007913129639935"

Provides JavaScript bindings for the Cash Solidity Contract, which is used internally by Augur as an ERC-20 wrapper for ETH.

augur.api.Cash.allowance(p, callback)

Returns the amount of attoCash that a given Ethereum contract is allowed to spend on behalf of a particular user.

Parameters:

Returns:

(string) Amount of attoCash the contract is allowed to spend on behalf of the specified user.

Claim Trading Proceeds Call API

// Claim Trading Proceeds Call API Examples:
var _market = "0xc4ba20cbafe3a3655a2f2e4df4ac7f942a722017";

augur.api.ClaimTradingProceeds.calculateCreatorFee({
  _market: _market,
  _amount: "0xc3280e4b4b",
}, function(error, creatorFee) {
  console.log(creatorFee); 
});
// example output:
"1"

augur.api.ClaimTradingProceeds.calculateProceeds({
  _market: _market,
  _outcome: "0x0",
  _numberOfShares: "0x2b5e3af16b1880000"
}, function(error, proceeds) {
  console.log(proceeds); 
});
// example output:
"122"

Provides JavaScript bindings for the ClaimTradingProceeds Solidity Contract, which allows profits earned from trading to be claimed.

augur.api.ClaimTradingProceeds.calculateCreatorFee(p, callback)

Calculates the Creator Fee that will be paid when settling a specific number of Shares in a given Market.

Parameters:

Returns:

augur.api.ClaimTradingProceeds.calculateProceeds(p, callback)

Calculates the amount of attoETH that a number of Shares in a particular Outcome of a given Market are worth. (NOTE: This calculation does not deduct Reporting Fees.

Parameters:

Returns:

Controller Call API

// Controller Contract Call API Examples:
augur.api.Controller.getTimestamp({
}, function (error, timestamp) { 
  console.log(timestamp); 
});
// example output:
"1516744206"

Provides JavaScript bindings for the Controller Solidity Contract, which is used to manage whitelisting of contracts and and halt the normal use of Augur’s contracts (e.g., if there is a vulnerability found in Augur). From a developer standpoint, it can be used to get Augur’s internal timestamp.

augur.api.Controller.getTimestamp(p, callback)

Returns Augur’s internal Unix timestamp.

Parameters:

Returns:

Dispute Crowdsourcer Call API

// Dispute Crowdsourcer Contract Call API Examples:

// Dispute Crowdsourcer contract addresses for a Market can be 
// obtained by calling `augur.api.Market.getReportingParticipant` 
// or `augur.api.Market.derivePayoutDistributionHash`, followed 
// by `augur.api.Market.getCrowdsourcer`.
var disputeCrowdsourcer = "0xafa6eaefcfaf7ea1e17c4768a554d57800699ec5";

augur.api.DisputeCrowdsourcer.getFeeWindow({ 
  tx: { to: disputeCrowdsourcer } 
}, function (error, feeWindow) { 
  console.log(feeWindow); 
});
// example output:
"0x1f90cc6b4e89303e451c9b852827b5791667f570"

augur.api.DisputeCrowdsourcer.getMarket({ 
  tx: { to: disputeCrowdsourcer } 
}, function (error, market) { 
  console.log(market); 
});
// example output:
"0xaa90cc6b4e89303e451c9b852827b5791667f5aa"

augur.api.DisputeCrowdsourcer.getPayoutDistributionHash({ 
  tx: { to: disputeCrowdsourcer } 
}, function (error, payoutDistributionHash) { 
  console.log(payoutDistributionHash); 
});
// example output:
"0x4480ed40f94e2cb2ca244eb862df2d350300904a96039eb53cba0e34b8ace90a"

augur.api.DisputeCrowdsourcer.getPayoutNumerator({ 
  _outcome: "0x0",
  tx: { to: disputeCrowdsourcer }, 
}, function (error, payoutNumerator) { 
  console.log(payoutNumerator); 
});
// example output:
"1000"

augur.api.DisputeCrowdsourcer.getReputationToken({ 
  tx: { to: disputeCrowdsourcer } 
}, function (error, reputationToken) { 
  console.log(reputationToken); 
});
// example output:
"0xff90cc6b4e89303e451c9b852827b5791667f5ff"

augur.api.DisputeCrowdsourcer.getSize({ 
  tx: { to: disputeCrowdsourcer } 
}, function (error, size) { 
  console.log(size); 
});
// example output:
"174435000000000000"

augur.api.DisputeCrowdsourcer.getStake({ 
  tx: { to: disputeCrowdsourcer } 
}, function (error, stake) { 
  console.log(stake); 
});
// example output:
"78123523"

augur.api.DisputeCrowdsourcer.isDisavowed({ 
  tx: { to: disputeCrowdsourcer } 
}, function (error, isDisavowed) { 
  console.log(isDisavowed); 
});
// example output:
true

augur.api.DisputeCrowdsourcer.isInvalid({ 
  tx: { to: disputeCrowdsourcer } 
}, function (error, isInvalid) { 
  console.log(isInvalid); 
});
// example output:
true

Provides JavaScript bindings for the DisputeCrowdsourcer Solidity Contract, which allows users to Stake and redeem REP on Outcomes other than a Market’s Tentative Outcome.

augur.api.DisputeCrowdsourcer.getFeeWindow(p, callback)

Gets the Fee Window to which a Dispute Crowdsourcer belongs.

Parameters:

Returns:

augur.api.DisputeCrowdsourcer.getMarket(p, callback)

Gets the Market to which a Dispute Crowdsourcer belongs.

Parameters:

Returns:

augur.api.DisputeCrowdsourcer.getPayoutDistributionHash(p, callback)

Gets the Payout Distribution Hash for a Dispute Crowdsourcer.

Parameters:

Returns:

augur.api.DisputeCrowdsourcer.getPayoutNumerator(p, callback)

Gets the Payout Numerator of a given Outcome for a Dispute Crowdsourcer.

Parameters:

Returns:

augur.api.DisputeCrowdsourcer.getReputationToken(p, callback)

Gets the Reputation Token in which a Dispute Crowdsourcer is denominated.

Parameters:

Returns:

augur.api.DisputeCrowdsourcer.getSize(p, callback)

Gets the total amount of attoREP that must to be Staked on a Dispute Crowdsourcer’s Outcome in order to Challenge the Tentative Outcome of its Market.

Parameters:

Returns:

augur.api.DisputeCrowdsourcer.getStake(p, callback)

Gets the amount of attoREP that has been Staked on a Dispute Crowdsourcer.

Parameters:

Returns:

augur.api.DisputeCrowdsourcer.isDisavowed(p, callback)

Returns whether a Dispute Crowdsourcer has been “disavowed”. A disavowed Dispute Crowdsourcer is one from which Staked REP and/or Reporting Fees can be redeemed (by calling augur.api.DisputeCrowdsourcer.redeem) and whose Market has not necessarily been Finalized. A Dispute Crowdsourcer can become disavowed if any of the following occurs:

  1. Another Dispute Crowdsourcer belonging to the same Market and in the same Fee Window successfully fills its Dispute Bond.
  2. A Market other than the Dispute Crowdsourcer’s Market causes a Fork, and augur.api.Market.disavowCrowdsourcers is called on the Dispute Crowdsourcer’s Market.
  3. The Dispute Crowdsourcer’s Market Forks, and augur.api.DisputeCrowdsourcer.fork is called on the Dispute Crowdsourcer.

Parameters:

Returns:

augur.api.DisputeCrowdsourcer.isInvalid(p, callback)

Returns whether a Dispute Crowdsourcer represents the Invalid Outcome for its Market.

Parameters:

Returns:

Fee Window Call API

// Fee Window Contract Call API Examples:

// Fee Window contract addresses can be obtained using a variety of Call API functions, 
// including `augur.api.Universe.getCurrentFeeWindow` and `augur.api.Universe.getFeeWindowByTimestamp`.
var feeWindow = "0x37a809f8139e5637fd94c7d34912cb15c6496111";

augur.api.FeeWindow.getEndTime({ 
  tx: { to: feeWindow } 
}, function (error, endTime) { 
  console.log(endTime); 
});
// example output:
"1517443200"

augur.api.FeeWindow.getNumDesignatedReportNoShows({ 
  tx: { to: feeWindow } 
}, function (error, numDesignatedReportNoShows) { 
  console.log(numDesignatedReportNoShows); 
});
// example output:
"2"

augur.api.FeeWindow.getNumIncorrectDesignatedReportMarkets({ 
  tx: { to: feeWindow } 
}, function (error, numIncorrectDesignatedReportMarkets) { 
  console.log(numIncorrectDesignatedReportMarkets); 
});
// example output:
"10"

augur.api.FeeWindow.getNumInvalidMarkets({ 
  tx: { to: feeWindow } 
}, function (error, numInvalidMarkets) { 
  console.log(numInvalidMarkets); 
});
// example output:
"3"

augur.api.FeeWindow.getNumMarkets({ 
  tx: { to: feeWindow } 
}, function (error, numMarkets) { 
  console.log(numMarkets); 
});
// example output:
"65"

augur.api.FeeWindow.getReputationToken({ 
  tx: { to: feeWindow } 
}, function (error, reputationToken) { 
  console.log(reputationToken); 
});
// example output:
"0x2a73cec0b62fcb8c3120bc80bdb2b1351c8c2d1e"

augur.api.FeeWindow.getStartTime({ 
  tx: { to: feeWindow } 
}, function (error, startTime) { 
  console.log(startTime); 
});
// example output:
"1516838400"

augur.api.FeeWindow.getUniverse({ 
  tx: { to: feeWindow } 
}, function (error, universe) { 
  console.log(universe); 
});
// example output:
"0x0920d1513057572be46580b7ef75d1d01a99a3e5"

augur.api.FeeWindow.isActive({ 
  tx: { to: feeWindow } 
}, function (error, isActive) { 
  console.log(isActive); 
});
// example output:
true

augur.api.FeeWindow.isOver({ 
  tx: { to: feeWindow } 
}, function (error, isOver) { 
  console.log(isOver); 
});
// example output:
false

Provides JavaScript bindings for the FeeWindow Solidity Contract, which allows for the buying and redeeming of Participation Tokens.

augur.api.FeeWindow.getEndTime(p, callback)

Returns a Unix timestamp for when the specified Fee Window will end. A Fee Window is considered active for a total of 7 days, then ends, and is no longer considered to be active.

Parameters:

Returns:

augur.api.FeeWindow.getNumDesignatedReportNoShows(p, callback)

Returns the number of Markets belonging to the specified Fee Window, in which the Designated Reporter failed to Report during the Designated Reporting Phase. These Markets will have a No-Show Bond up for grabs for the First Public 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 Tentative Outcome was Challenged.

Parameters:

Returns:

augur.api.FeeWindow.getNumIncorrectDesignatedReportMarkets(p, callback)

Returns the number of Unfinalized Markets belonging to the specified Fee Window in which Designated Reporter’s Tentative Outcome was Challenged during the current Dispute Round Phase, or the Designated Reporter failed to submit a Designated Report.

Parameters:

Returns:

augur.api.FeeWindow.getNumInvalidMarkets(p, callback)

Returns the number of Markets that were Reported to be Invalid during the specified Fee Window. Invalid Markets are Markets that aren’t clearly defined or do not 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.

Parameters:

Returns:

augur.api.FeeWindow.getNumMarkets(p, callback)

Returns the total number of Markets that are in the Dispute Round Phase for the specified Fee Window.

Parameters:

Returns:

augur.api.FeeWindow.getReputationToken(p, callback)

Returns the Reputation Token (REP) used by the specified Fee Window. Every Fee Window has a Dispute Phase where Reporters can Challenge the Tentative Outcome of Markets. In order to Challenge a Tentative Outcome, Reporters need to Stake REP. A Fee Window only accepts one REP contract as the source of Staked REP, and this function returns that contract’s address.

Parameters:

Returns:

augur.api.FeeWindow.getStartTime(p, callback)

Returns a Unix timestamp of when a Fee Window becomes active and starts. A Fee Window is considered active for a total of 7 days, then ends, and is no longer considered to be active. Only active Fee Windows allow Reporters to Challenge the Tentative Outcomes of Markets contained in the Fee Window.

Parameters:

Returns:

augur.api.FeeWindow.getUniverse(p, callback)

Returns the Universe to which the specified Fee Window belongs. Every Fee Window belongs to a specific Universe in which they were created and can operate.

Parameters:

Returns:

augur.api.FeeWindow.isActive(p, callback)

Returns whether the specified Fee Window is currently active. Fee Windows are considered active during the Window’s Dispute Round Phase, which last a total of 7 days.

Parameters:

Returns:

augur.api.FeeWindow.isOver(p, callback)

Returns whether the 7-day Fee Window specified has ended.

Parameters:

Returns:

Initial Reporter Call API

// Initial Reporter Contract Call API Examples:

// The Ethereum address of a Market's InitialReporter contract 
// can be obtained by calling `augur.api.Market.getInitialReporter`.
var initialReporter = "0xbcb6eaefcfaf7ea1e17c4768a554d57800699ed3";

augur.api.InitialReporter.designatedReporterShowed({ 
  tx: { to: initialReporter } 
}, function (error, designatedReporterShowed) { 
  console.log(designatedReporterShowed); 
});
// example output:
true

augur.api.InitialReporter.designatedReporterWasCorrect({ 
  tx: { to: initialReporter } 
}, function (error, designatedReporterWasCorrect) { 
  console.log(designatedReporterWasCorrect); 
});
// example output:
true

augur.api.InitialReporter.getDesignatedReporter({ 
  tx: { to: initialReporter } 
}, function (error, designatedReporter) { 
  console.log(designatedReporter); 
});
// example output:
"0xca3edca4ed326bbcb77e914b379913b12d49654d"

augur.api.InitialReporter.getFeeWindow({ 
  tx: { to: initialReporter } 
}, function (error, feeWindow) { 
  console.log(feeWindow); 
});
// example output:
"0x1f90cc6b4e89303e451c9b852827b5791667f570"

augur.api.InitialReporter.getMarket({ 
  tx: { to: initialReporter } 
}, function (error, market) { 
  console.log(market); 
});
// example output:
"0xaa90cc6b4e89303e451c9b852827b5791667f5aa"

augur.api.InitialReporter.getPayoutDistributionHash({ 
  tx: { to: disputeCrowdsourcer } 
}, function (error, payoutDistributionHash) { 
  console.log(payoutDistributionHash); 
});
// example output:
"0x4480ed40f94e2cb2ca244eb862df2d350300904a96039eb53cba0e34b8ace90a"

augur.api.InitialReporter.getPayoutNumerator({ 
  _outcome: "0x0",
  tx: { to: initialReporter }, 
}, function (error, payoutNumerator) { 
  console.log(payoutNumerator); 
});
// example output:
"1000"

augur.api.InitialReporter.getReportTimestamp({ 
  tx: { to: initialReporter } 
}, function (error, reportTimestamp) { 
  console.log(reportTimestamp); 
});
// example output:
"1514956848"

augur.api.InitialReporter.getReputationToken({ 
  tx: { to: initialReporter } 
}, function (error, reputationToken) { 
  console.log(reputationToken); 
});
// example output:
"0x2a73cec0b62fcb8c3120bc80bdb2b1351c8c2d1e"

augur.api.InitialReporter.getSize({ 
  tx: { to: initialReporter } 
}, function (error, size) { 
  console.log(size); 
});
// example output:
"87443500000000000"

augur.api.InitialReporter.getStake({ 
  tx: { to: initialReporter } 
}, function (error, stake) { 
  console.log(stake); 
});
// example output:
"78000"

augur.api.InitialReporter.isInvalid({ 
  tx: { to: initialReporter } 
}, function (error, isInvalid) { 
  console.log(isInvalid); 
});
// example output:
true

Provides JavaScript bindings for the InitialReporter Solidity Contract, which enables functionality related to Initial Reports.

augur.api.InitialReporter.designatedReporterShowed(p, callback)

Returns whether the Designated Reporter submitted a Report within the Designated Reporting Phase.

Parameters:

Returns:

augur.api.InitialReporter.designatedReporterWasCorrect(p, callback)

Returns whether the Payout Distribution Hash submitted in the Designated Report is the same as the winning Payout Distribution Hash for the InitialReporter contract.

Parameters:

Returns:

augur.api.InitialReporter.getDesignatedReporter(p, callback)

Returns the Ethereum address for the Designated Reporter for the InitialReporter contract.

Parameters:

Returns:

augur.api.InitialReporter.getFeeWindow(p, callback)

Returns the Ethereum contract address of the Fee Window to which the InitialReporter contract belongs.

Parameters:

Returns:

augur.api.InitialReporter.getMarket(p, callback)

Returns the Ethereum contract address of the Market to which the InitialReporter contract belongs.

Parameters:

Returns:

augur.api.InitialReporter.getPayoutDistributionHash(p, callback)

Returns the Payout Distribution Hash for the InitialReporter contract.

Parameters:

Returns:

augur.api.InitialReporter.getPayoutNumerator(p, callback)

Returns the Payout Numerator of a given Outcome for the InitialReporter contract.

Parameters:

Returns:

augur.api.InitialReporter.getReportTimestamp(p, callback)

Returns the Unix timestamp of when the Initial Report (either the Designated Report or the First Public Report) was submitted.

Parameters:

Returns:

augur.api.InitialReporter.getReputationToken(p, callback)

Returns the Reputation Token (REP) Ethereum contract address used by the InitialReporter contract.

Parameters:

Returns:

augur.api.InitialReporter.getSize(p, callback)

Returns the amount of attoREP required to be Staked on an Outcome in order to submit the Initial Report. For Initial Reports, this value will always be the same as the value returned by augur.api.InitialReporter.getStake.

Parameters:

Returns:

augur.api.InitialReporter.getStake(p, callback)

Returns the amount of attoREP Staked on the Reported Outcome of the specified InitialReporter contract. For Initial Reports, this value will always be the same as the value returned by augur.api.InitialReporter.getSize.

Parameters:

Returns:

augur.api.InitialReporter.isInvalid(p, callback)

Returns whether the submitted Initial Report said theMarket for the InitialReporter contract was Invalid.

Parameters:

Returns:

Market Call API

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

augur.api.Market.deriveMarketCreatorFeeAmount({
  _amount: "0xc3280e4b4b",
  tx: { to: market }
}, function (error, isInvalid) { 
  console.log(isInvalid); 
});
// example output:
"1"

augur.api.Market.derivePayoutDistributionHash({
  _payoutNumerators: [ "0x0", "0x2710" ],
  _invalid: false,
  tx: { to: market },
}, function (error, payoutDistributionHash) { 
  console.log(payoutDistributionHash); 
});
// example output:
"0x4480ed40f94e2cb2ca244eb862df2d350300904a96039eb53cba0e34b8ace90a"

augur.api.Market.designatedReporterShowed({ 
  tx: { to: market } 
}, function (error, designatedReporterShowed) { 
  console.log(designatedReporterShowed); 
});
// example output:
true

augur.api.Market.designatedReporterWasCorrect({ 
  tx: { to: market } 
}, function (error, designatedReporterWasCorrect) { 
  console.log(designatedReporterWasCorrect); 
});
// example output:
true

augur.api.Market.getCrowdsourcer({ 
  _payoutDistributionHash: "0x5580ed40f94e2cb2ca244eb862df2d350300904a96039eb53cba0e34b8ace90a",
  tx: { to: market } 
}, function (error, crowdsourcer) { 
  console.log(crowdsourcer); 
});
// example output:
"0xbbb0cc6b4e89303e451c9b852827b5791667face"

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

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

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

augur.api.Market.getFeeWindow({ 
  tx: { to: market }, 
}, function (error, feeWindow) { 
  console.log(feeWindow); 
});
// example output:
"0x1f90cc6b4e89303e451c9b852827b5791667f570"

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

augur.api.Market.getForkingMarket({ 
  tx: { to: market } 
}, function (error, forkedMarket) { 
  console.log(forkedMarket); 
});
// example output:
"0x1230cc6b4e89303e451c9b852827b5791667f234"

augur.api.Market.getInitialReporter({ 
  tx: { to: market } 
}, function (error, initialReporter) { 
  console.log(initialReporter); 
});
// example output:
"0xaad0cc6b4e89303e451c9b852827b5791667fddd"

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

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

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

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

augur.api.Market.getReportingParticipant({ 
  _index: "0x0",
  tx: { to: market } 
}, function (error, reportingParticipant) { 
  console.log(reportingParticipant); 
});
// example output:
"0xdda0cc6b4e89303e451c9b852827b5791667faaa"

augur.api.Market.getReputationToken({ 
  tx: { to: market } 
}, function (error, reputationToken) { 
  console.log(reputationToken); 
});
// example output:
"0x23b17188ce3c491f6ab4427258d92452be5c8045"

augur.api.Market.getShareToken({
  _outcome: "0x1",
  tx: { to: market },
}, function (error, shareToken) { 
  console.log(shareToken); 
});
// example output:
"0x18b17188ce3c491f6ab4427258d92452be5c8054"

augur.api.Market.getStakeInOutcome({ 
  _payoutDistributionHash: "0x4480ed40f94e2cb2ca244eb862df2d350300904a96039eb53cba0e34b8ace90a",
  tx: { to: market }, 
}, function (error, stakeInOutcome) { 
  console.log(stakeInOutcome); 
});
// example output:
"12378786123"

augur.api.Market.getParticipantStake({ 
  tx: { to: market } 
}, function (error, totalStake) { 
  console.log(totalStake); 
});
// example output:
"161278368761238475"

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

augur.api.Market.getValidityBondAttoeth(
  tx: { to: market } 
}, function (error, validityBondAttoeth) { 
  console.log(validityBondAttoeth); 
});
// example output:
"13570000000000000"

augur.api.Market.getWinningPayoutDistributionHash({ 
  tx: { to: market } 
}, function (error, winningDistributionHash) { 
  console.log(winningDistributionHash); 
});
// example output:
"0x4480ed40f94e2cb2ca244eb862df2d350300904a96039eb53cba0e34b8ace90a"

augur.api.Market.getWinningPayoutNumerator({
  _outcome: "0x0",
  tx: { to: market },
}, function (error, winningPayoutNumerator) { 
  console.log(winningPayoutNumerator); 
});
// example output:
"1000"

augur.api.Market.getWinningReportingParticipant({ 
  tx: { to: market } 
}, function (error, winningReportingParticipant) { 
  console.log(winningReportingParticipant); 
});
// example output:
"0xbbb0cc6b4e89303e451c9b852827b5791667face"

augur.api.Market.isContainerForReportingParticipant({
  _shadyReportingParticipant: "0x18b17188ce3c491f6ab4427258d92452be5c8054",
  tx: { to: market },
}, function (error, isContainerForReportingParticipant) { 
  console.log(isContainerForReportingParticipant); 
});
// example output:
true

augur.api.Market.isContainerForShareToken({
  _shadyShareToken: "0x18b17188ce3c491f6ab4427258d92452be5c8054",
  tx: { to: market },
}, function (error, isContainerForShareToken) { 
  console.log(isContainerForShareToken); 
});
// example output:
true

augur.api.Market.isFinalized({
  tx: { to: market },
}, function (error, isFinalized) { 
  console.log(isFinalized); 
});
// example output:
true

augur.api.Market.isInvalid({
  tx: { to: market }
}, function (error, isInvalid) { 
  console.log(isInvalid); 
});
// example output:
true

Provides JavaScript bindings for the Market Solidity Contract, which enables functionality for Augur’s Markets.

augur.api.Market.deriveMarketCreatorFeeAmount(p, callback)

Calculates the Creator Fee that will be paid when settling a specific number of Shares in a given Market.

Parameters:

Returns:

augur.api.Market.derivePayoutDistributionHash(p, callback)

Returns the Payout Distribution Hash of the specified Market by hashing Payout Numerators _payoutNumerators and Invalid status _invalid using the keccak256 algorithm.

This call will fail if:

Parameters:

Returns:

augur.api.Market.designatedReporterShowed(p, callback)

Returns whether the Designated Reporter submitted a Report within the Designated Reporting Phase.

Parameters:

Returns:

augur.api.Market.designatedReporterWasCorrect(p, callback)

Returns whether the Payout Distribution Hash submitted in the Designated Report is the same as the winning Payout Distribution Hash for the specified Market.

Parameters:

Returns:

augur.api.Market.getCrowdsourcer(p, callback)

Returns the Ethereum address for the DisputeCrowdsourcer contract that corresponds to the given Payout Distribution Hash.

Note: Calling this function only works for retrieving a DisputeCrowdsourcer if the Dispute Round has not been completed yet.

Parameters:

Returns:

augur.api.Market.getDenominationToken(p, callback)

Returns the Ethereum contract address of the token used to denominate the specified Market. A Denomination Token is the ERC-20 Token used as the currency to trade on the Outcome of a Market. Currently, this function will always return the address of a Cash contract; however, Augur will eventually support other types of Denomination Tokens.

Parameters:

Returns:

augur.api.Market.getDesignatedReporter(p, callback)

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

Parameters:

Returns:

augur.api.Market.getEndTime(p, callback)

Returns the Unix timestamp for when the specified Market’s event has come to pass. When the Market’s End Time passes, the Market enters the Designated Reporting Phase.

Parameters:

Returns:

augur.api.Market.getFeeWindow(p, callback)

Returns the Ethereum contract address of the Market’s Fee Window.

Parameters:

Returns:

augur.api.Market.getFinalizationTime(p, callback)

Returns the Unix 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.

Parameters:

Returns:

augur.api.Market.getForkingMarket(p, callback)

Returns the Ethereum contract 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.

Parameters:

Returns:

augur.api.Market.getInitialReporter(p, callback)

Returns the Ethereum address of the InitialReporter contract for a given Market.

Parameters:

Returns:

augur.api.Market.getMarketCreatorMailbox(p, callback)

Returns the Ethereum address of the Market Creator Mailbox for the specified Market. Market Creators can use this address to collect their fees.

Parameters:

Returns:

augur.api.Market.getMarketCreatorSettlementFeeDivisor(p, callback)

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

Parameters:

Returns:

augur.api.Market.getNumberOfOutcomes(p, callback)

Returns the number of Outcomes for the specified Market. The number of Outcomes is the number of potential results for the Market event.

Parameters:

Returns:

augur.api.Market.getNumTicks(p, 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.

Parameters:

Returns:

augur.api.Market.getParticipantStake(p, callback)

Returns the total amount of attoREP Staked on all Outcomes of the specified Market. This amount is combined total of attoREP Staked on the Initial Report and attoREP Staked on every successful Dispute Crowdsourcer.

Parameters:

Returns:

augur.api.Market.getReportingParticipant(p, callback)

Within Augur’s code, the InitialReporter class and DisputeCrowdsourcer class are child classes of a class called ReportingParticipant. When an Initial Report is submitted or a Dispute Crowdsourcer fills its Dispute Bond, the corresponding Market pushes that InitialReporter contract or DisputeCrowdsourcer contract to an array that keeps track of all contracts that have ever been the Tentative Outcome. The function augur.api.Market.getReportingParticipant returns the Ethereum address of the contract at a specific index in that array.

Note: To get the address of the ReportingParticipant that is currently winning in a Market, call augur.api.Market.getWinningReportingParticipant.

Parameters:

Returns:

augur.api.Market.getReputationToken(p, callback)

Returns the Ethereum contract address of the Reputation Token (REP) for the specified Market, as a 20-byte hexadecimal string. REP is Staked whenever an Initial Report is submitted or when users attempt to Challenge the Tentative Outcome of a Market. A Market only accepts one REP contract as the source of Staked REP, and this method returns that contract’s address.

Parameters:

Returns:

augur.api.Market.getShareToken(p, callback)

Returns the Ethereum contract address of the Share Token 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. Share Tokens are used within Augur to represent Shares.

Parameters:

Returns:

augur.api.Market.getStakeInOutcome(p, callback)

Returns the amount of attoREP that has been Staked on the Outcome with the specified Payout Distribution Hash in a given Market.

Parameters:

Returns:

augur.api.Market.getUniverse(p, callback)

Returns the Etherem address of the Universe in which the specified Market exists. All Markets are created in a specific Universe, and new Universes are created if a Fork occurs.

Parameters:

Returns:

augur.api.Market.getValidityBondAttoeth(p, callback)

Returns the amount the Market Creator must pay for the Validity Bond, denominated in AttoETH, when creating a Market. (This amount will be refunded to the Market Creator if the Final Outcome of the Market is not invalid.)

Parameters:

Returns:

augur.api.Market.getWinningPayoutDistributionHash(p, callback)

Returns the winning Payout Distribution Hash for a particular Market.

Parameters:

Returns:

augur.api.Market.getWinningPayoutNumerator(p, callback)

Returns the winning Payout Numerator for an Outcome in a particular Market.

This call will fail if:

Parameters:

Returns:

augur.api.Market.getWinningReportingParticipant(p, callback)

Within Augur’s code, the InitialReporter class and DisputeCrowdsourcer class are child classes of a class called ReportingParticipant. When an Initial Report is submitted or a Dispute Crowdsourcer fills its Dispute Bond, the corresponding Market pushes that InitialReporter contract or DisputeCrowdsourcer contract to an array that keeps track of all contracts that have ever been the Tentative Outcome. The function augur.api.Market.getWinningReportingParticipant returns the Ethereum address of the ReportingParticipant contract that corresponds to the Market’s Tentative Outcome.

Parameters:

Returns:

augur.api.Market.isContainerForReportingParticipant(p, callback)

Returns whether the ReportingParticipant contract _shadyReportingParticipant belongs to the specified Market. (Both the DisputeCrowdsourcer and InitialReporter classes in Augur’s Solidity smart contracts are considered Reporting Participants, since they have the parent class BaseReportingParticipant.)

Parameters:

Returns:

augur.api.Market.isContainerForShareToken(p, callback)

Returns whether the given Market is a container for the specified Share Token Ethereum contract address.

Parameters:

Returns:

augur.api.Market.isFinalized(p, callback)

Returns whether the Market has been Finalized (that is, its winning Payout Distribution Hash is set).

Parameters:

Returns:

augur.api.Market.isInvalid(p, callback)

Returns whether the specified Market has been Finalized as Invalid.

This call will fail if:

Parameters:

Returns:

Orders Call API

// Orders Contract Call API Examples:
var _orderId = "0x7ca90ca9118db456d87e3d743b97782a857200b55039f7ffe8de94e5d920f870";
var _type = "0x1";
var _market = "0x9368ff3e9ce1c0459b309fac6dd4e69229b91a42";
var _outcome = "0x1";

augur.api.Orders.getAmount({ 
  _orderId: _orderId 
}, function (error, amount) { 
  console.log(amount); 
});
// example output:
"15"

augur.api.Orders.getBestOrderId({
  _type: _type,
  _market: _market,
  _outcome: _outcome
}, function (error, bestOrderId) { 
  console.log(bestOrderdD); 
});
// example output:
"0x7ca90ca9118db456d87e3d743b97782a857200b55039f7ffe8de94e5d920f870"

augur.api.Orders.getBetterOrderId({ 
  _orderId: "0x49cb49f610b5f6e31ee163a8ad65f964af1088e38c8a1b07f1218177b5e006b5"
}, function (error, betterOrderId) { 
  console.log(betterOrderId); 
});
// example output:
"0x7ca90ca9118db456d87e3d743b97782a857200b55039f7ffe8de94e5d920f870"

augur.api.Orders.getLastOutcomePrice({
  _market: _market,
  _outcome: _outcome
}, function (error, lastOutcomePrice) { 
  console.log(lastOutcomePrice); 
});
// example output:
"490000000000000000"

augur.api.Orders.getMarket({ 
  _orderId: _orderId
}, function (error, market) { 
  console.log(market); 
});
// example output:
"0x9368ff3e9ce1c0459b309fac6dd4e69229b91a42";

augur.api.Orders.getOrderCreator({ 
  _orderId: _orderId 
}, function (error, creator) { 
  console.log(creator); 
});
// example output:
"0x438f2aeb8a16745b1cd711e168581ebce744ffaa";

augur.api.Orders.getOrderMoneyEscrowed({ 
  _orderId: _orderId 
}, function (error, orderMoneyEscrowed) { 
  console.log(orderMoneyEscrowed); 
});
// example output:
"5000000000000000000"

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

augur.api.Orders.getOrderType({ 
  _orderId: _orderId 
}, function (error, orderType) { 
  console.log(orderType); 
});
// example output:
"1"

augur.api.Orders.getOutcome({ 
  _orderId: _orderId 
}, function (error, outcome) { 
  console.log(outcome); 
});
// example output:
"1"

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

augur.api.Orders.getTotalEscrowed({ 
  _market: _market 
}, function (error, volume) { 
  console.log(volume); 
});
// example output:
"100000000000000000000000"

augur.api.Orders.getWorseOrderId({ 
  _orderId: "0x4b538f4de2517f7d7bbb227161981c51c40bf725da9941b3dc02e6c14cafd1f1" 
}, function (error, worseOrderId) { 
  console.log(worseOrderId); 
});
// example output:
"0x9a8d5523ed521813533d1f8469f5040fa1404fcf470b9da43bccfe38c80ad035"

augur.api.Orders.getWorstOrderId({
  _type: _type,
  _market: _market,
  _outcome: _outcome
}, function (error, worstOrderId) { 
  console.log(worstOrderId); 
});
// example output:
"0x9a8d5523ed521813533d1f8469f5040fa1404fcf470b9da43bccfe38c80ad035"

var _price = "0x63eb89da4ed0000"; // 0.45
augur.api.Orders.isBetterPrice({
  _type: _type,
  _price: _price,
  _orderId: _orderId
}, function (error, isBetterPrice) { 
  console.log(isBetterPrice); 
});
// example output:
false

augur.api.Orders.isWorsePrice({
  _type: _type,
  _price: _price,
  _orderId: _orderId
}, function (error, isWorsePrice) { 
  console.log(isWorsePrice); 
});
// example output:
true

Provides JavaScript bindings for the Orders Solidity Contract, which handles functionality related to the Order Book.

augur.api.Orders.getAmount(p, callback)

Returns the amount of Shares requested when a particular Order was placed.

Parameters:

Returns:

augur.api.Orders.getBestOrderId(p, callback)

Returns the Order ID of the best Order of a particular type (either Ask Orders or Bid Orders), for a specific Outcome, in a given Market.

Parameters:

Returns:

augur.api.Orders.getBetterOrderId(p, callback)

Returns the Order ID of an Order with a better price than the specified Order.

Parameters:

Returns:

augur.api.Orders.getLastOutcomePrice(p, callback)

Returns the last price traded for a specific Outcome in a given Market.

Parameters:

Returns:

augur.api.Orders.getMarket(p, callback)

Returns the Ethereum contract address of the Market for the specified Order.

Parameters:

Returns:

augur.api.Orders.getOrderCreator(p, callback)

Returns the Ethereum address of the Creator of the specified Order.

Parameters:

Returns:

augur.api.Orders.getOrderMoneyEscrowed(p, callback)

Returns the amount of money escrowed by the Order Creator for a given Order.

Parameters:

Returns:

augur.api.Orders.getOrderSharesEscrowed(p, callback)

Returns the number of Shares escrowed by the Order Creator for a given Order.

Parameters:

Returns:

augur.api.Orders.getOrderType(p, callback)

Returns the order type (Bid Order or Ask Order) of a given Order.

Parameters:

Returns:

augur.api.Orders.getOutcome(p, callback)

Returns the Outcome being traded on for the specified Order.

Parameters:

Returns:

augur.api.Orders.getPrice(p, callback)

Returns the price of a specified Order.

Parameters:

Returns:

augur.api.Orders.getTotalEscrowed(p, callback)

Returns the total amount of attoETH currently escrowed for open Orders in the specified Market.

Parameters:

Returns:

augur.api.Orders.getWorseOrderId(p, callback)

Returns the Order ID of an Order with a worse price than the specified Order.

Parameters:

Returns:

augur.api.Orders.getWorstOrderId(p, callback)

Returns the Order ID of the worst Order of a particular type (either Ask Orders or Bid Orders), for a specific Outcome, in a given Market.

Parameters:

Returns:

augur.api.Orders.isBetterPrice(p, callback)

Returns whether a given price is greater than the price of a particular Order (for Bid Orders), or whether the price is less than the price of the Order (for Ask Orders).

Parameters:

Returns:

augur.api.Orders.isWorsePrice(p, callback)

Returns whether a given price is less than/equal to the price of a particular Order (for Bid Orders), or whether the price is greater than/equal to the price of the Order (for Ask Orders).

Parameters:

Returns:

Orders Fetcher Call API

// Orders Fetcher Contract Call API Examples:
var _orderId = "0x7ca90ca9118db456d87e3d743b97782a857200b55039f7ffe8de94e5d920f870";
var _type = "0x1";
var _market = "0x9368ff3e9ce1c0459b309fac6dd4e69229b91a42";
var _outcome = "0x1";
var _price = "0x63eb89da4ed0000"; // 0.45

augur.api.OrdersFetcher.ascendOrderList({
  _type: _type,
  _price: _price,
  _lowestOrderId: _orderId
}, function (error, ascendingOrderList) { console.log(ascendingOrderList); });
// example output:
[ "0x7ca90ca9118db456d87e3d743b97782a857200b55039f7ffe8de94e5d920f870",
  "0x4a8d07c2c9cd996484c04b7077d1fc4aeaeb8aa4750d7f26f2a896c4393fb6b0" ]

augur.api.OrdersFetcher.descendOrderList({
  _type: _type,
  _price: _price,
  _highestOrderId: _orderId
}, function (error, decendingOrderList) { console.log(decendingOrderList); });
// example output:
[ "0x09502d4c2765d61a8e47fd4ada696966f3bc3bce6b780ecedded035e616c272e",
  "0x7ca90ca9118db456d87e3d743b97782a857200b55039f7ffe8de94e5d920f870"]

augur.api.OrdersFetcher.findBoundingOrders({
  _type: _type,
  _price: _price,
  _bestOrderId: _orderId,
  _worstOrderId: "0x0",
  _betterOrderId: "0x0",
  _worseOrderId: "0x0"
}, function (error, boundingOrders) { console.log(boundingOrders); });
// example output:
[ "0x4a8d07c2c9cd996484c04b7077d1fc4aeaeb8aa4750d7f26f2a896c4393fb6b0",
  "0x09502d4c2765d61a8e47fd4ada696966f3bc3bce6b780ecedded035e616c272e" ]

Provides JavaScript bindings for the OrdersFetcher Solidity Contract, which handles functionality related retrieving Orders from the Order Book.

augur.api.OrdersFetcher.ascendOrderList(p, callback)

Traverses the Order Book in ascending order and returns an array containing the better Order ID and worse Order ID, respectively, for a specified price and Order type.

Parameters:

Returns:

augur.api.OrdersFetcher.descendOrderList(p, callback)

Traverses the Order Book in descending order and returns an array containing the better Order ID and worse Order ID, respectively, for a specified price and Order type.

Parameters:

Returns:

augur.api.OrdersFetcher.findBoundingOrders(p, callback)

Returns an array containing the Order IDs from the Order Book that should be set to better Order ID and worse Order ID, respectively, for an Order placed with price p._price.

Parameters:

Returns:

Orders Finder Call API

// Orders Finder Contract Call API Examples:

// All OrdersFinder functions can be called like the example below, but return different array lengths.
var ordersFinder = "0xf28fc4b34a7c4534dd3e40e0ad5df6f2cb69aec0";
augur.api.OrdersFinder.getExistingOrders5({ 
  _type: "0x1",
  _market: "0xd8e090ac1282fd54d4f7ff5474f6e363cf30049e",
  _outcome: "0x1",
  tx: { to: ordersFinder } 
}, function (error, feeWindow) { 
  console.log(feeWindow); 
});
[
  "0xfa76427aaada4f319a831f6b2579557ee30579dac997cbe6d7737b438a788a2b",
  "0xf77843d1520fe797874779a2447cd8727a3ff985975cbe2e0f660e6aa27fff8f",
  "0x38e6d59a9d4953dbdda92de3561c044b86640236ed8398666155a031bfd77e69",
  "0x1673d59a9d497384dda92de3561c044b86640236ed8398666155a031bfd89263",
  "0x8245959a9d4953dbdda92de3561c044b86640236ed8398666155a031bfd09837"
]

Provides JavaScript bindings for the OrdersFinder Solidity Contract, which retrieves Orders from the Order Book.

augur.api.OrdersFinder.getExistingOrders5(p, callback)

Returns the 5 best Orders on the Order Book for a particular Market, based on Order Type and Outcome.

Parameters:

Returns:

augur.api.OrdersFinder.getExistingOrders10(p, callback)

Similar to augur.api.OrdersFinder.getExistingOrders5, but returns the 10 best Orders on the Order Book for a particular Market, based on Order Type and Outcome.

Parameters:

Returns:

augur.api.OrdersFinder.getExistingOrders20(p, callback)

Similar to augur.api.OrdersFinder.getExistingOrders5, but returns the 20 best Orders on the Order Book for a particular Market, based on Order Type and Outcome.

Parameters:

Returns:

augur.api.OrdersFinder.getExistingOrders50(p, callback)

Similar to augur.api.OrdersFinder.getExistingOrders5, but returns the 50 best Orders on the Order Book for a particular Market, based on Order Type and Outcome.

Parameters:

Returns:

augur.api.OrdersFinder.getExistingOrders100(p, callback)

Similar to augur.api.OrdersFinder.getExistingOrders5, but returns the 100 best Orders on the Order Book for a particular Market, based on Order Type and Outcome.

Parameters:

Returns:

augur.api.OrdersFinder.getExistingOrders200(p, callback)

Similar to augur.api.OrdersFinder.getExistingOrders5, but returns the 200 best Orders on the Order Book for a particular Market, based on Order Type and Outcome.

Parameters:

Returns:

augur.api.OrdersFinder.getExistingOrders500(p, callback)

Similar to augur.api.OrdersFinder.getExistingOrders5, but returns the 500 best Orders on the Order Book for a particular Market, based on Order Type and Outcome.

Parameters:

Returns:

augur.api.OrdersFinder.getExistingOrders1000(p, callback)

Similar to augur.api.OrdersFinder.getExistingOrders5, but returns the 1000 best Orders on the Order Book for a particular Market, based on Order Type and Outcome.

Parameters:

Returns:

Reputation Token Call API

// Reputation Token Contract Call API Examples:

// The Ethereum contract address for Augur.sol can be 
// obtained by calling `augur.augurNode.getSyncData`.
var _augurContractAddress = "0x67cbf60a24ab922af99e6f335c0ff2b084d5bdbe";
// The Ethereum contract address for a Universe's Reputation Token 
// can be obtained by calling `augur.api.Universe.getReputationToken`.
var reputationToken = "0x13fa2334966b3cb6263ed56148323014c2ece753";

augur.api.ReputationToken.allowance({
  _owner: "0x913da4198e6be1d5f5e4a40d0667f70c0b5430eb",
  _spender: _augurContractAddress,
  tx: { to: reputationToken } 
}, function(error, allowance) {
  console.log(allowance); 
});
// example output:
"115792089237316195423570985008687907853269984665640564039457584007913129639935"

augur.api.ReputationToken.getUniverse({ 
  tx: { to: reputationToken } 
}, function (error, universe) { 
  console.log(universe); 
});
// example output:
"0x1f732847fbbcc46ffe859f28e916d993b2b08831"

augur.api.ReputationToken.getTotalMigrated({ 
  tx: { to: reputationToken } 
}, function (error, totalMigrated) { 
  console.log(totalMigrated); 
});
"0"

augur.api.ReputationToken.getTotalTheoreticalSupply({ 
  tx: { to: reputationToken } 
}, function (error, totalTheoreticalSupply) { 
  console.log(totalTheoreticalSupply); 
});
"11000000000000000000000000"

Provides JavaScript bindings for the ReputationToken Solidity Contract, which handles the approval, migration, and transfering of Reputation Tokens.

The Reputation Token, or REP, 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.allowance(p, callback)

Returns the amount of attoREP that a given Ethereum contract is allowed to spend on behalf of a particular user.

Parameters:

Returns:

(string) Amount of attoREP the contract is allowed to spend on behalf of the specified user.

augur.api.ReputationToken.getUniverse(p, callback)

Returns the Ethereum contract address of the Universe in which the REP of the ReputationToken contract can be used.

Parameters:

Returns:

augur.api.ReputationToken.getTotalMigrated(p, callback)

Returns total amount of REP that has been migrated into the current ReputationToken contract from the ReputationToken contract of its Universe’s Parent Universe.

Parameters:

Returns:

augur.api.ReputationToken.getTotalTheoreticalSupply(p, callback)

Returns the total Theoretical REP Supply for this ReputationToken contract. Note: To ensure this number is as accurate as possible, augur.api.ReputationToken.updateParentTotalTheoreticalSupply should first be called on the ReputationToken contract, and augur.api.ReputationToken.updateSiblingMigrationTotal should be called on any ReputationToken contracts that have the same Parent Universe.

Parameters:

Returns:

Share Token Call API

// Share Token Contract Call API Examples:

// The Ethereum contract address for Augur.sol can be 
// obtained by calling `augur.augurNode.getSyncData`.
var _augurContractAddress = "0x67cbf60a24ab922af99e6f335c0ff2b084d5bdbe";
// Share Token contract addresses for a Market can be 
// obtained by calling `augur.api.Market.getShareToken`.
var shareToken = "0x18b17188ce3c491f6ab4427258d92452be5c8054";

augur.api.ShareToken.allowance({
  _owner: "0x913da4198e6be1d5f5e4a40d0667f70c0b5430eb",
  _spender: _augurContractAddress,
}, function(error, allowance) {
  console.log(allowance); 
});
// example output:
"115792089237316195423570985008687907853269984665640564039457584007913129639935"

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

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

Provides JavaScript bindings for the ShareToken Solidity Code, which handles the approval and transferring of Shares in Augur.

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. Within Augur, it represents Shares in Market Outcomes.

augur.api.ShareToken.allowance(p, callback)

Returns the amount of Share Units that a given Ethereum contract is allowed to spend on behalf of a particular user.

Parameters:

Returns:

(string) Amount of Share Units the contract is allowed to spend on behalf of the specified user.

augur.api.ShareToken.getMarket(p, callback)

Returns the Ethereum contract address of the Market for the specified ShareToken.

Parameters:

Returns:

augur.api.ShareToken.getOutcome(p, callback)

Returns the Outcome of the Market that the specified ShareToken is for.

Parameters:

Returns:

Universe Call API

// Universe Contract Call API Examples:

// The Ethereum contract address of Augur's current default Universe 
// can be obtained by calling `augur.augurNode.getSyncData`.
var universe = "0x0920d1513057572be46580b7ef75d1d01a99a3e5";

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

augur.api.Universe.getCurrentFeeWindow({ 
  tx: { to: universe } 
}, function (error, currFeeWindow) { 
  console.log(currFeeWindow); 
});
// example output:
"0x1f90cc6b4e89303e451c9b852827b5791667f570"

augur.api.Universe.getDisputeRoundDurationInSeconds({ 
  tx: { to: universe } 
}, function (error, disputeRoundDuration) { 
  console.log(disputeRoundDuration); 
});
// example output:
"604800"

augur.api.Universe.getFeeWindow({ 
  _feeWindowId: "0x242",
  tx: { to: universe }, 
}, function (error, feeWindow) { 
  console.log(feeWindow); 
});
// example output:
"0x1f90cc6b4e89303e451c9b852827b5791667f570"

augur.api.Universe.getFeeWindowByTimestamp({ 
  _timestamp: "0x5a45710f",
  tx: { to: universe },
}, function (error, feeWindow) { 
  console.log(feeWindow); 
});
// example output:
"0x1f90cc6b4e89303e451c9b852827b5791667f570"

augur.api.Universe.getFeeWindowId({ 
  _timestamp: "0x5a45710f",
  tx: { to: universe },
}, function (error, feeWindowId) {
  console.log(feeWindowId); 
});
// example output:
"578"

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

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

augur.api.Universe.getForkReputationGoal({ 
  tx: { to: universe } 
}, function (error, forkReputationGoal) { 
  console.log(forkReputationGoal); 
});
// example output:
"5500000000000000000000000"

augur.api.Universe.getNextFeeWindow({ 
  tx: { to: universe } 
}, function (error, nextFeeWindow) { 
  console.log(nextFeeWindow); 
});
// example output:
"0x45659544b89cce1dd53b1b566862189b25adec49"

augur.api.Universe.getOpenInterestInAttoEth({ 
  tx: { to: universe } 
}, function (error, openInterestInAttoEth) { 
  console.log(openInterestInAttoEth); 
});
// example output:
"42250000000000000000"

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

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

augur.api.Universe.getPreviousFeeWindow({ 
  tx: { to: universe } 
}, function (error, previousFeeWindow) { 
  console.log(previousFeeWindow); 
});
// example output:
"0xc0adccd7c65ea05c2e91a148af988d776e683643"

augur.api.Universe.getRepMarketCapInAttoeth({ 
  tx: { to: universe } 
}, function (error, repMarketCapInAttoeth) { 
  console.log(repMarketCapInAttoeth); 
});
// example output:
"36000000000000000000000000000000000000000"

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

augur.api.Universe.getTargetRepMarketCapInAttoeth({ 
  tx: { to: universe } 
}, function (error, targetRepMarketCapInAttoeth) { 
  console.log(targetRepMarketCapInAttoeth); 
});
// example output:
"211250000000000000000"

augur.api.Universe.getWinningChildUniverse({ 
  tx: { to: universe } 
}, function (error, winningChildUniverse) { 
  console.log(winningChildUniverse); 
});
// example output:
"0x432561b2bdbcd1ae1995bdd6aff6776d6f4292f2"

augur.api.Universe.isContainerForFeeToken({
  _shadyFeeToken: "0x2a73cec0b62fcb8c3120bc80bdb2b1351c8c2d1e",
  tx: { to: universe },
}, function (error, isContainerForFeeToken) { 
  console.log(isContainerForFeeToken); 
});
// example output:
true

augur.api.Universe.isContainerForFeeWindow({
  _shadyFeeWindow: "0x1233cec0b62fcb8c3120bc80bdb2b1351c8c2d1e",
  tx: { to: universe },
}, function (error, isContainerForFeeWindow) { 
  console.log(isContainerForFeeWindow); 
});
// example output:
true

augur.api.Universe.isContainerForMarket({
  _shadyMarket: "0x9368ff3e9ce1c0459b309fac6dd4e69229b91a42",
  tx: { to: universe },
}, function (error, isContainerForMarket) { 
  console.log(isContainerForMarket); 
});
// example output:
false

augur.api.Universe.isContainerForReportingParticipant({
  _shadyReportingParticipant: "0x6788ff3e9ce1c0459b309fac6dd4e69229b91a41",
  tx: { to: universe },
}, function (error, isContainerForReportingParticipant) { 
  console.log(isContainerForReportingParticipant); 
});
// example output:
true

augur.api.Universe.isContainerForShareToken({
  _shadyShareToken: "0x9328ff3e9ce1c0459b309fac6dd4e69229b91a61",
  tx: { to: universe },
}, function (error, isContainerForShareToken) { 
  console.log(isContainerForShareToken); 
});
// example output:
true

augur.api.Universe.isForking({ 
  tx: { to: universe } 
}, function (error, isForking) { 
  console.log(isForking); 
});
// example output:
false

augur.api.Universe.isParentOf({
  _shadyChild: "0xb4e8c1f85c4382d64954aca187f9f386c8bb1a6c",
  tx: { to: universe },
}, function (error, isParentOf) { 
  console.log(isParentOf); 
});
// example output:
true

Provides JavaScript bindings for the Universe Solidity Contract, which allows for the creation of Markets and provides functions for obtaining information about a given Universe.

augur.api.Universe.getChildUniverse(p, callback)

Returns the Ethereum contract address of a Universe’s Child Universe that has Final Outcome set to a specific Payout Distribution Hash.

Parameters:

Returns:

augur.api.Universe.getCurrentFeeWindow(p, callback)

Returns the Ethereum contract address of the current running Fee Window of a Universe. Every Universe has a Fee Window that runs for a duration of 7 days before immediately starting the next Window.

Parameters:

Returns:

augur.api.Universe.getDisputeRoundDurationInSeconds(p, callback)

Returns the number of seconds in a Dispute Round within the specified Universe.

Parameters:

Returns:

augur.api.Universe.getFeeWindow(p, callback)

Returns the Ethereum contract address of a given Fee Window in the specified Universe.

Parameters:

Returns:

augur.api.Universe.getFeeWindowByTimestamp(p, callback)

Returns the Ethereum contract address of the Fee Window running at a given timestamp in the Universe.

Parameters:

Returns:

augur.api.Universe.getFeeWindowId(p, callback)

Returns the Fee Window ID for the Universe at the specified timestamp. This ID is calculated by dividing the timestamp by the Universe’s Fee Window duration in seconds.

Parameters:

Returns:

augur.api.Universe.getForkEndTime(p, callback)

Returns the Unix timestamp for when the Fork Phase ends that was started on the specified Universe.

Parameters:

Returns:

augur.api.Universe.getForkingMarket(p, callback)

Returns the Ethereum contract address of the Market that the specified Universe is Forking over.

Parameters:

Returns:

augur.api.Universe.getForkReputationGoal(p, callback)

Returns the estimated amount of attoREP that must be migrated to one Child Universe in order to allow a Fork in the specified Universe to be Finalized before the end of the Fork Phase.

Parameters:

Returns:

augur.api.Universe.getNextFeeWindow(p, callback)

Returns the Ethereum contract address of the Fee Window coming up after the current Fee Window ends in the specified Universe.

Parameters:

Returns:

augur.api.Universe.getOpenInterestInAttoEth(p, callback)

Returns the total value of all Complete Sets that exist across all Markets the specified Universe.

Parameters:

Returns:

augur.api.Universe.getParentPayoutDistributionHash(p, callback)

Returns the Payout Distribution Hash of the specified Universe’s Parent Universe. The Payout Distribution Hash is a hash of the winning Outcome of the Forked Market.

Parameters:

Returns:

augur.api.Universe.getParentUniverse(p, callback)

Returns the Ethereum contract address of the Parent Universe for the specified Universe.

Parameters:

Returns:

augur.api.Universe.getPreviousFeeWindow(p, callback)

Returns the Ethereum contract address of the previous Fee Window for the specified Universe.

Parameters:

Returns:

augur.api.Universe.getRepMarketCapInAttoeth(p, callback)

Returns an estimate for the REP market cap of the specified Universe. This estimate is updated manually by the Augur development team, roughly once every Fee Window. It is used by Augur to set the price of the Reporting Fee.

Parameters:

Returns:

augur.api.Universe.getReputationToken(p, callback)

Returns the Ethereum contract address of the Reputation Token for the specified Universe. REP associated with this contract address are usable only within this Universe.

Parameters:

Returns:

augur.api.Universe.getTargetRepMarketCapInAttoeth(p, callback)

Returns the REP market cap that Augur targets when calculating Reporting Fees. Augur attempts to set Reporting Fees such that the REP market cap equals 7.5 times the amount of Open Interest.

Parameters:

Returns:

augur.api.Universe.getWinningChildUniverse(p, callback)

Returns the Ethereum contract address of the Winning Universe for a particular Universe that has Forked.

Parameters:

Returns:

augur.api.Universe.isContainerForFeeToken(p, callback)

Returns whether the given Universe is a container for a particular Fee Token. Every Fee Token belongs to a Universe, and this method is used to see if a specific Fee Token address belongs to the Universe in question.

This call will fail if:

Parameters:

Returns:

augur.api.Universe.isContainerForFeeWindow(p, callback)

Returns whether the given Universe is a container for a particular Fee Window. Every Fee Window belongs to a Universe, and this method is used to see if a specific Fee Window address belongs to the Universe in question.

Parameters:

Returns:

augur.api.Universe.isContainerForMarket(p, callback)

Returns whether the specific universe is a container for the Market _shadyMarket Ethereum address. All Markets are created within a Universe, and this function is used to confirm if a Market exists within the Universe in question.

Parameters:

Returns:

augur.api.Universe.isContainerForReportingParticipant(p, callback)

Returns whether the specified Universe is a container for a particular Reporting Participant. Both the DisputeCrowdsourcers and InitialReporter classes in Augur’s Solidity smart contracts are considered Reporting Participants, since they have the parent class BaseReportingParticipant.

Parameters:

Returns:

augur.api.Universe.isContainerForShareToken(p, callback)

Returns whether the specific Universe is a container for a given Share Token. (Shares are represented within Augur’s smart contracts as ERC-20 tokens called Share Tokens.)

Parameters:

Returns:

augur.api.Universe.isForking(p, callback)

Returns whether the specified Universe has a Market that has Forked.

Parameters:

Returns:

augur.api.Universe.isParentOf(p, callback)

Returns whether the Universe is the Parent Universe for the specified Child Universe.

Parameters:

Returns:

Transaction API

// Transaction API example:

// Internally, Augur uses an ERC-20 token called Cash as a wrapper for ETH. 
// Many of Augur's transactions require the Augur.sol contract to be able 
// to spend Cash on behalf of the account executing the transaction. 
// However, the account must first approve Augur to spend that amount of 
// Cash on its behalf by calling `augur.api.Cash.approve`.

// The Ethereum contract addresses for Augur.sol and Cash.sol 
// can be obtained by calling `augur.augurNode.getSyncData`.
var _augurContractAddress = "0x67cbf60a24ab922af99e6f335c0ff2b084d5bdbe";
var cashContractAddress = "0xec28e64edbce62bde48a14b04f0b557b974a22a9";

// Amount of Cash (in attotokens) to approve the Augur.sol contract to 
// spend on this Ethereum account's behalf.
// This example approves the maximum amount, which is 
// augur.constants.ETERNAL_APPROVAL_VALUE, or 2^256 - 1.
var _attoCashTokens = augur.constants.ETERNAL_APPROVAL_VALUE;

// The Augur API is organized by Contract and then Method like so:
// augur.api.<Contract>.<Method>(<argument object>);
augur.api.Cash.approve({
  _spender: _augurContractAddress,
  _value: _attoCashTokens,
  tx: { 
    to: cashContractAddress,
    gas: "0x632ea0" 
  },
  meta: {
    accountType: "privateKey",
    address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
    signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
  },
  onSent: function (result) { console.log(result); },
  onSuccess: function (result) { console.log(result); },
  onFailed: function (result) { console.log(result); }
});

// example onSent output:
{
  callReturn: null,
  hash: '0x3cd4a2eb35cc0cd3449c252737255863e60aa521d757d615cefbf280b54313fb'
}
// example onSuccess output:
{
  blockHash: "0xb1379380e458710f25fea54ae03358832076eadc17825edef482efca3c43a9de",
  blockNumber: 1707928,
  callReturn: null,
  from: "0x8fa56abe36d8dc76cf85fecb6a3026733e0a12ac",
  gas: "0x632ea0",
  gasFees: "0.000206912",
  gasPrice: "0xee6b2800",
  hash: "0x3cd4a2eb35cc0cd3449c252737255863e60aa521d757d615cefbf280b54313fb",
  input: "0x095ea7b300000000000000000000000067cbf60a24ab922af99e6f335c0ff2b084d5bdbeffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
  nonce: "0x97",
  r: "0x804b2a14352d3fa9844c296eb8b9a6b8fed45ca5d56550d1eb558c6571abbaf4",
  s: "0x3793c21fd315e14950b48a2200e8368ca0d25a2b6291eca9b5bb19753026859f",
  timestamp: 1517688651,
  to: "0xec28e64edbce62bde48a14b04f0b557b974a22a9",
  transactionIndex: "0x1",
  v: "0x2b",
  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>). 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.

Arguments

All Transaction API methods accept a single object argument, containing the following:

The tx Object

The tx object must contain a to property, which is the Ethereum address of the contract containing the transaction function, as a 20-byte hexadecimal string. This allows augur.js to know which contract to run the transaction on. A gas property can also be specified for Transaction API functions (though this should not be specified for Call API functions). The gas property represents the gas limit to use when executing the transaction. The gasPrice property represents the gas price (in attoETH, or wei) to use. For Transaction API functions that have the payable modifier in Augur’s Solidity smart contracts, a value property must also be specified, which is the amount of attoETH to send to the function. Some of the Transaction API functions can either be made as a call (which will return a cached value and not use gas) or as a transaction (which will calculate the value and use gas to do so). By default, augur.js will call these functions as transactions, but they can be made as calls instead by specifying the send property as false.

The other properties that can be specified in the tx object are discussed in the Using Transact Directly section.

The meta Object

All Transaction API functions accept a meta object as a parameter in order to sign the transaction. The meta object contains a signer property, which should be set to the private key buffer or a signing function, provided by a hardware wallet, of the account that wishes to initiate the transaction. (When logged in using an Edge account, the private key buffer can be obtained by outputting the value state.loginAccount.meta.signer.) The meta object also contains an accountType property, which should be set to “privateKey”, “ledger”, “trezor”, “edge”, or “unlockedEthereumNode”. The Transaction API functions attempt to modify information on the blockchain, which requires the transaction to be signed. The meta parameter is not required when calling Transaction API functions while using MetaMask (which will pop up a separate window asking to confirm the transaction).

Callbacks

Whereas the callback function parameter used by Call API is optional, but strongly recommended, the three callback function parameters used by the Transaction API functions are required. 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 tx 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 function’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.

Approving Augur’s ERC-20 Tokens

Developers will need to grant the Augur.sol contract approval to spend Cash (which is an ERC-20 wrapper for ETH) before many of the Transaction API functions can be called. This can be done by calling the augur.api.Cash.approve function, as shown to the right. Attempting to call many of Augur’s Transaction API functions without doing this first will result in these transactions failing.

Transaction Return Values

It is important to note that Ethereum nodes discard all transaction return values, which causes the callReturn property of the object passed into a transaction’s onSuccess callback to always be null. As a result, there is no way to get a transaction’s return value.

There is, however, a workaround for this issue when calling functions that create Markets, such as augur.api.Universe.createYesNoMarket, augur.api.Universe.createCategoricalMarket, and augur.api.Universe.createScalarMarket. The function augur.createMarket.getMarketFromCreateMarketReceipt can be called in the onSuccess callback of these functions to retrieve the Ethereum contract address of the newly-created Market. augur.createMarket.getMarketFromCreateMarketReceipt does this by querying the Augur Node for the event log associated with the new Market’s creation.

Using Transact Directly

// Example using `augur.rpc.transact` directly
// `tx` object (generated by transfer method of the ReputationToken contract):
var tx = {
  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). This example uses the Buffer returned from the `augur.accounts.login` function.
var privateKeyOrSigner = [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25];

// accountType is a string set to "privateKey", "ledger", "trezor", "edge", or "unlockedEthereumNode".
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(tx, privateKeyOrSigner, accountType, onSent, onSuccess, onFailed);
// example onSent output:
Transaction sent: {
  callReturn: null,
  hash: "0x269011fe4ed9c7370f8e8237c525062988e8fcce485d93a1a6a419bb3a8e70d3"
}
// example onSuccess output:
Transaction successful: {
  blockHash: "0x5090c1a25a2accf4cb47a1d99f4fa4215146ac29402688ad3e554169af332e4c",
  blockNumber: 1348278,
  callReturn: null,
  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)

Transactions can be broadcast to the Ethereum Network by calling augur.rpc.transact directly. When calling this function directly, the payload object (also known as the tx object) must be constructed carefully as follows:

Required:

Optional:

The signature and params fields are required if the transaction function being called 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 when attempting to execute a transaction that will modify the blockchain (eth_sendTransaction). If the function is simply getting information (eth_call) privateKeyOrSigner can be null. Otherwise, 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”, “ledger”, “trezor”, “edge”, or “unlockedEthereumNode”, 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 first attempts 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 the transaction is malformed, does not provide enough gas, or will fail, 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 sends an 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, the error is passed to the onFailed handler, and the augur.rpc.transact sequence terminates. Otherwise, the onSent handler is called and returns an object containing the txHash and callReturn.

  3. After calling the onSent handler, Augur adds the transaction to the transactions object (which is indexed by transaction hash, e.g. transactions[txHash]) and assigns the transaction a status of "pending". The function augur.rpc.getTransactions can be used 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 means 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, Augur will attempt to re-submit the transaction to augur.rpc.transact as long as the number of attempts has not exceeded augur.constants.TX_RETRY_MAX. Once the number of attempts exceeds this threshold, a TRANSACTION_RETRY_MAX_EXCEEDED error is 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 number of confirmations of the transaction exceeds augur.constants.REQUIRED_CONFIRMATIONS, the transaction’s status is updated to "confirmed". A callReturn field is added to the transaction object, which is then passed to the onSuccess handler, completing the sequence.

Augur Tx API

// Augur Transaction API Examples:

// The Ethereum address of Augur's default Augur contract
// can be obtained by calling `augur.augurNode.getSyncData`.
var augurAddress = "0x852684b374fe03ab77d06931f1b2831028fd58f5";

augur.api.Augur.createGenesisUniverse({
  tx: { 
    to: augurAddress,
    gas: "0x632ea0" 
  },
  meta: {
    accountType: "privateKey",
    address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
    signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
  },
  onSent: function (result) { console.log(result); },
  onSuccess: function (result) { console.log(result); },
  onFailed: function (result) { console.log(result); }
});

Provides JavaScript bindings for the Augur Solidity Contract, which handles Universe creation and event logging.

augur.api.Augur.createGenesisUniverse(p)

Allows the caller to create a new Genesis Universe. Users may wish to create a new Genesis Universe if, for example, they would like to create a separate Universe to compete with an existing Universe. Whenever a new Genesis Universe is created, it does not initially contain any Markets or REP supply. In order to add a supply of REP, users must migrate their Legacy REP from the Legacy REP smart contract into the Reputation Token smart contract of the new Genesis Universe using the function augur.api.ReputationToken.migrateFromLegacyReputationToken.

Parameters:

Returns:

Cancel Order Tx API

// Cancel Order Transaction API Examples:

// The Ethereum address of Augur's default CancelOrder contract
// can be obtained by calling `augur.augurNode.getSyncData`.
var cancelOrderAddress = "0x389c0b3f0d51cfba9e4d214712a1142f5685814d";

var _orderId = "0x7ca90ca9118db456d87e3d743b97782a857200b55039f7ffe8de94e5d920f870";
augur.api.CancelOrder.cancelOrder({
  _orderId: _orderId,
  tx: { 
    to: cancelOrderAddress,
    gas: "0x632ea0" 
  },
  meta: {
    accountType: "privateKey",
    address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
    signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
  },
  onSent: function (result) { console.log(result); },
  onSuccess: function (result) { console.log(result); },
  onFailed: function (result) { console.log(result); }
});

Provides JavaScript bindings for the CancelOrder Solidity Contract, which allows for cancellation of Orders on the Order Book.

augur.api.CancelOrder.cancelOrder(p)

Cancels and refunds an existing Order on the Order Book with ID p._orderId. This transaction will trigger an OrderCanceled event if the Order is canceled without any errors.

This function will fail if:

Parameters:

Returns:

Cash Tx API

// Cash Transaction API Examples:

// The Ethereum contract address for Augur.sol can be 
// obtained by calling `augur.augurNode.getSyncData`.
var _augurContractAddress = "0x67cbf60a24ab922af99e6f335c0ff2b084d5bdbe";
// The Ethereum address of Augur's Cash contract can be 
// obtained by calling `augur.augurNode.getSyncData`.
var cashContractAddress = "0xec28e64edbce62bde48a14b04f0b557b974a22a9";

// Amount of Cash (in attoCash) to approve the Augur.sol 
// contract to spend on this Ethereum account's behalf.
// This example approves the maximum amount, which is 
// augur.constants.ETERNAL_APPROVAL_VALUE, or 2^256 - 1.
var _attoCash = augur.constants.ETERNAL_APPROVAL_VALUE;

augur.api.Cash.approve({
  _spender: _augurContractAddress,
  _value: _attoCash,
  tx: { 
    to: cashContractAddress,
    gas: "0x632ea0" 
  },
  meta: {
    accountType: "privateKey",
    address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
    signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
  },
  onSent: function (result) { console.log(result); },
  onSuccess: function (result) { console.log(result); },
  onFailed: function (result) { console.log(result); }
});

augur.api.Cash.decreaseApproval({
  _spender: _augurContractAddress,
  _subtractedValue: "0x3e8",
  tx: { 
    to: cashContractAddress,
    gas: "0x632ea0" 
  },
  meta: {
    accountType: "privateKey",
    address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
    signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
  },
  onSent: function (result) { console.log(result); },
  onSuccess: function (result) { console.log(result); },
  onFailed: function (result) { console.log(result); }
});

augur.api.Cash.increaseApproval({
  _spender: "",
  _addedValue: "0x3e8",
  tx: { 
    to: cashContractAddress,
    gas: "0x632ea0" 
  },
  meta: {
    accountType: "privateKey",
    address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
    signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
  },
  onSent: function (result) { console.log(result); },
  onSuccess: function (result) { console.log(result); },
  onFailed: function (result) { console.log(result); }
});

augur.api.Cash.withdrawEtherToIfPossible({
  _to: "0x555e64edbce62bde48a14b04f0b557b974a25555",
  _amount: "0x3e8",
  tx: { 
    to: cashContractAddress,
    gas: "0x632ea0" 
  },
  meta: {
    accountType: "privateKey",
    address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
    signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
  },
  onSent: function (result) { console.log(result); },
  onSuccess: function (result) { console.log(result); },
  onFailed: function (result) { console.log(result); }
});

Provides JavaScript bindings for the Cash Solidity Contract, which is used internally by Augur as an ERC-20 wrapper for ETH.

augur.api.Cash.approve(p)

Many of the transaction functions in Augur’s smart contracts will only work if the Augur.sol contract has been approved to spend Cash on behalf of the account executing the transaction. This function allows p._spender to spend up to p._value Cash for the msg.sender of this transaction. This transaction will trigger an Approval event, which will record the owner address (msg.sender), p._spender, and p._value in attoCash approved. The amount that p.spender is approved to spend can be increased or decreased later by calling augur.api.Cash.increaseApproval or augur.api.Cash.decreaseApproval.

Parameters:

Returns:

augur.api.Cash.decreaseApproval(p)

Decreases the amount of Cash p._spender is approved to spend on behalf of msg.sender.

Parameters:

Returns:

augur.api.Cash.increaseApproval(p)

Increases the amount of Cash p._spender is approved to spend on behalf of msg.sender.

Parameters:

Returns:

augur.api.Cash.withdrawEtherToIfPossible(p)

Withdraws a certain amount of the user’s Cash to a particular address as ETH (as long as the user has the amount of Cash specified).

Parameters:

Returns:

Claim Trading Proceeds Tx API

// Claim Trading Proceeds Transaction API Examples:

// The Ethereum address of Augur's default ClaimTradingProceeds contract
// can be obtained by calling `augur.augurNode.getSyncData`.
var claimTradingProceedsAddress = "0x53ebdf8b5babda8e59a217436266696efcd8d166";

var _market = "0xc4ba20cbafe3a3655a2f2e4df4ac7f942a722017";

augur.api.ClaimTradingProceeds.calculateReportingFee({
  _market: _market,
  _amount: "0xc3280e4b4b",
  tx: { 
    to: claimTradingProceedsAddress,
    send: false,
  }
}, function (error, reportingFee) { 
    console.log(reportingFee); 
});
// example output:
"83819064"

var _shareHolder = "0x5678ff3e9ce1c0459b309fac6dd4e69229b91567";
augur.api.ClaimTradingProceeds.claimTradingProceeds({
  _market: _market,
  _shareHolder: _shareHolder,
  tx: { 
    to: claimTradingProceedsAddress,
    gas: "0x632ea0" 
  },
  meta: {
    accountType: "privateKey",
    address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
    signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
  },
  onSent: function (result) { console.log(result); },
  onSuccess: function (result) { console.log(result); },
  onFailed: function (result) { console.log(result); }
});

Provides JavaScript bindings for the ClaimTradingProceeds Solidity Contract, which allows profits earned from trading to be claimed.

augur.api.ClaimTradingProceeds.calculateReportingFee(p)

Calculates the Reporting Fee that will be paid when settling a specific number of Shares in a given Market.

Parameters:

Returns:

augur.api.ClaimTradingProceeds.claimTradingProceeds(p)

Collects trading profits from outstanding Shares in Finalized Market p._market owned by p._shareHolder. This transaction will trigger a TradingProceedsClaimed event if the trading proceeds are claimed without any errors.

This transaction will fail if:

Parameters:

Returns:

Complete Sets Tx API

// Complete Sets Transaction API Examples:

// The Ethereum address of Augur's default CompleteSets contract
// can be obtained by calling `augur.augurNode.getSyncData`.
var completeSetsAddress = "0x8aa774927fb928ee1df0d0d3f94c8217658e0bce";

var _market = "0x9368ff3e9ce1c0459b309fac6dd4e69229b91a42";
var _amount = "0x2b5e3af16b1880000"; // 50.0 shares
augur.api.CompleteSets.publicBuyCompleteSets({
  _market: _market,
  _amount: _amount,
  tx: { 
    to: completeSetsAddress,
    value: "0x16345785d8a0000",
    gas: "0x632ea0" 
  },
  meta: {
    accountType: "privateKey",
    address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
    signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
  },
  onSent: function (result) { console.log(result); },
  onSuccess: function (result) { console.log(result); },
  onFailed: function (result) { console.log(result); }
});

augur.api.CompleteSets.publicBuyCompleteSetsWithCash({
  _market: _market,
  _amount: _amount,
  tx: { 
    to: completeSetsAddress,
    value: "0x16345785d8a0000",
    gas: "0x632ea0" 
  },
  meta: {
    accountType: "privateKey",
    address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
    signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
  },
  onSent: function (result) { console.log(result); },
  onSuccess: function (result) { console.log(result); },
  onFailed: function (result) { console.log(result); }
});

augur.api.CompleteSets.publicSellCompleteSets({
  _market: _market,
  _amount: _amount,
  tx: { 
    to: completeSetsAddress,
    gas: "0x632ea0" 
  },
  meta: {
    accountType: "privateKey",
    address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
    signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
  },
  onSent: function (result) { console.log(result); },
  onSuccess: function (result) { console.log(result); },
  onFailed: function (result) { console.log(result); }
});

augur.api.CompleteSets.publicSellCompleteSetsWithCash({
  _market: _market,
  _amount: _amount,
  tx: { 
    to: completeSetsAddress,
    gas: "0x632ea0" 
  },
  meta: {
    accountType: "privateKey",
    address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
    signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
  },
  onSent: function (result) { console.log(result); },
  onSuccess: function (result) { console.log(result); },
  onFailed: function (result) { console.log(result); }
});

Provides JavaScript bindings for the CompleteSets Solidity Contract, which allows for buying and selling of Complete Sets.

augur.api.CompleteSets.publicBuyCompleteSets(p)

Purchases p._amount worth of Shares in all Outcomes of Market p._market.

This transaction will fail if:

When successful, this transaction will trigger a CompleteSetsPurchased event, which will record to the Ethereum blockchain msg.sender, p._market, the Universe in which p._market exists, and p._amount purchased.

Parameters:

Returns:

augur.api.CompleteSets.publicBuyCompleteSetsWithCash(p)

This function is not fully implemented yet, but is a intended to be a point-of-contact that would work similarly to augur.api.CompleteSets.publicBuyCompleteSets and allow for a 0x-style trading system.

Parameters:

Returns:

augur.api.CompleteSets.publicSellCompleteSets(p)

Sell p._amount worth of Shares in all Outcomes of Market p._market.

This transaction will fail if:

When successful, this transaction will trigger a CompleteSetsSold event, which will record to the Ethereum blockchain msg.sender, p._market, the Universe in which p._market exists, and p._amount sold.

Parameters:

Returns:

augur.api.CompleteSets.publicSellCompleteSetsWithCash(p)

This function is not fully implemented yet, but is a intended to be a point-of-contact that would work similarly to augur.api.CompleteSets.publicSellCompleteSets and allow for a 0x-style trading system.

Parameters:

Returns:

Create Order Tx API

// Create Order Transaction API Examples:

// The Ethereum address of Augur's default CreateOrder contract
// can be obtained by calling `augur.augurNode.getSyncData`.
var createOrderAddress = "0xdadc071ecc3b7e97b139d2ef692defdc398c8211";

// The _betterOrderId/_worseOrderId to use when creating an Order 
// can be obtained by calling `augur.trading.getBetterWorseOrders`. 
// In the example below, `augur.trading.getBetterWorseOrders` returned
var _betterOrderId = "0x12328a31378e925ea122ea73e8c81baaf5c731d408487f6884d2e4c81baa3456";
var _worseOrderId = "0x91c28a31378e925ea122ea73e8c81baaf5c731d408487f6884d2e4c81baa39dd";

augur.api.CreateOrder.publicCreateOrder({
  _type: "0x0",
  _attoshares: "0x5af3107a4000",
  _displayPrice: "0x64",
  _market: "0xc4ba20cbafe3a3655a2f2e4df4ac7f942a722017",
  _outcome: "0x0",
  _betterOrderId: _betterOrderId,
  _worseOrderId: _worseOrderId,
  _tradeGroupId: "0x0000000000000000000000000000000000000000000000000000000000000000",
  tx: { 
    to: createOrderAddress,
    value: "0x470de4df820000", 
  },
  meta: {
    accountType: "privateKey",
    address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
    signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
  },
  onSent: function (result) { console.log(result); },
  onSuccess: function (result) { console.log(result); },
  onFailed: function (result) { console.log(result); }
});

Provides JavaScript bindings for the CreateOrder Solidity Contract, which enables new Orders to be created.

augur.api.CreateOrder.publicCreateOrder(p)

Creates a new Bid Order or Ask Order on the Order Book. The parameters p._betterOrderId and p._worseOrderId are the Orders with the next best/next worse price after p._displayPrice, and they are used to optimize the process of sorting the new Order on the Order Book. Their IDs can be obtained by calling augur.trading.getBetterWorseOrders. This transaction will trigger an OrderCreated event if the Order is created without any errors.

This transaction will fail if:

Parameters:

Returns:

Dispute Crowdsourcer Tx API

// Dispute Crowdsourcer Transaction API Examples:

// Dispute Crowdsourcer contract addresses for a Market can be 
// obtained by calling `augur.api.Market.getReportingParticipant` 
// or `augur.api.Market.derivePayoutDistributionHash`, followed 
// by `augur.api.Market.getCrowdsourcer`.
var disputeCrowdsourcerAddress = "0xe5d6eaefcfaf7ea1e17c4768a554d57800699ea4";

augur.api.DisputeCrowdsourcer.forkAndRedeem({
  tx: { 
    to: disputeCrowdsourcerAddress,
    gas: "0x632ea0" 
  }, 
  meta: {
    accountType: "privateKey",
    address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
    signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
  },
  onSent: function (result) { console.log(result); },
  onSuccess: function (result) { console.log(result); },
  onFailed: function (result) { console.log(result); }
});

var _redeemer = "0x55d6eaefcfaf7ea1e17c4768a554d57800699ae4";
augur.api.DisputeCrowdsourcer.redeem({
  _redeemer: _redeemer,
  tx: { 
    to: disputeCrowdsourcerAddress,
    gas: "0x632ea0" 
  }, 
  meta: {
    accountType: "privateKey",
    address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
    signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
  },
  onSent: function (result) { console.log(result); },
  onSuccess: function (result) { console.log(result); },
  onFailed: function (result) { console.log(result); }
});

augur.api.DisputeCrowdsourcer.withdrawInEmergency({
  tx: { 
    to: disputeCrowdsourcerAddress,
    gas: "0x632ea0" 
  }, 
  meta: {
    accountType: "privateKey",
    address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
    signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
  },
  onSent: function (result) { console.log(result); },
  onSuccess: function (result) { console.log(result); },
  onFailed: function (result) { console.log(result); }
});

Provides JavaScript bindings for the DisputeCrowdsourcer Solidity Contract, which allows users to Stake and redeem REP on Outcomes other than a Market’s Tentative Outcome.

augur.api.DisputeCrowdsourcer.forkAndRedeem(p)

Causes a Child Universe to be created for the Outcome of the Dispute Crowdsourcer and migrates the REP in the Crowdsourcer to the Child Universe. This function can be called only on the Crowdsourcers of a Forked Market, and it can be called at any time after the Fork has begun (including after the Market has been Finalized). When called by a user who Staked on the Dispute Crowdsourcer’s Outcome, it will redeem their Staked REP and collect any Reporting Fees (in Ether) that they are owed.

This transaction will trigger a ReportingParticipantDisavowed event if the DisputeCrowdsourcer was forked without any errors.

This transaction will fail if:

This transaction will trigger a ReportingParticipantDisavowed event if the DisputeCrowdsourcer was forked without any errors.

Parameters:

Returns:

augur.api.DisputeCrowdsourcer.redeem(p)

Redeems REP that p._redeemer Staked on a particular Dispute Crowdsourcer, as well as any Reporting Fees (in Ether) that p._redeemer is owed.

If the Dispute Crowdsourcer’s Market has been Finalized, and the Dispute Crowdsourcer filled its Dispute Bond, the user will receive their Reporting Fees for the Fee Window plus 1.5 times the amount of REP they Staked (if the Outcome of the Dispute Crowdsourcer is the Final Outcome of the Market), or the user will just receive Reporting Fees for the Fee Window (if the Outcome of the Dispute Crowdsourcer is not the Final Outcome of the Market).

If the Dispute Crowdsourcer’s Market has been Finalized, and the Dispute Crowdsourcer did not fill its Dispute Bond, the user will receive Reporting Fees for the Fee Window (but not the REP they originally Staked).

If a Fork has occurred, all non-Forked Markets will have their Tentative Outcome reset to the Outcome submitted in the Initial Report and be put back in the Waiting for the Next Fee Window to Begin Phase. All non-Forked Markets will need to have augur.api.Market.disavowCrowdsourcers called before the redeem transaction can be called on any of their Dispute Crowdsourcers. Furthermore, all Dispute Crowdsourcers of the Forked Market will need to have augur.api.DisputeCrowdsourcer.forkAndRedeem called on them.

When redeem is called on Dispute Crowdsourcers of non-Forked Markets, this transaction will redeem any REP that p._redeemer Staked on that Crowdsourcer, as well as any Reporting Fees (in Ether) that p._redeemer is owed, to the Universe containing the Forked Market.

When redeem is called on Dispute Crowdsourcers of a Forked Market, it will redeem any REP that p._redeemer Staked on that Crowdsourcer, as well as any Reporting Fees (in Ether) that p._redeemer is owed, to the Child Universe for the Outcome of that Crowdsourcer.

This transaction will trigger a DisputeCrowdsourcerRedeemed event if the REP/Ether was redeemed without any errors.

This transaction will fail if:

Parameters:

Returns:

augur.api.DisputeCrowdsourcer.withdrawInEmergency(p)

If a critical bug or vulnerability is found in Augur, the Augur development team can put Augur into a halted 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 the REP they Staked on the Dispute Crowdsourcer’s Outcome. Calling this function will not redeem any Reporting Fees because the total amount of Reporting Fees is not known until the end of the Fee Window.

This transaction will fail if:

Parameters:

Returns:

Fee Window Tx API

// Fee Window Transaction API Examples:

// Fee Window contract addresses can be obtained using a variety of Call API functions, 
// including `augur.api.Universe.getCurrentFeeWindow` and `augur.api.Universe.getFeeWindowByTimestamp`.
var feeWindowAddress = "0xe5d6eaefcfaf7ea1e17c4768a554d57800699ea4";

var _attotokens = "0x64";
augur.api.FeeWindow.buy({
  _attotokens: _attotokens,
  tx: { 
    to: feeWindowAddress,
    gas: "0x632ea0" 
  }, 
  meta: {
    accountType: "privateKey",
    address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
    signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
  },
  onSent: function (result) { console.log(result); },
  onSuccess: function (result) { console.log(result); },
  onFailed: function (result) { console.log(result); }
});

var _sender = "0x8886eaefcfaf7ea1e17c4768a554d57800699888";
augur.api.FeeWindow.redeem({
  _sender: _sender,
  tx: { 
    to: feeWindowAddress,
    gas: "0x632ea0" 
  }, 
  meta: {
    accountType: "privateKey",
    address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
    signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
  },
  onSent: function (result) { console.log(result); },
  onSuccess: function (result) { console.log(result); },
  onFailed: function (result) { console.log(result); }
});

augur.api.FeeWindow.withdrawInEmergency({
  tx: { 
    to: feeWindowAddress,
    gas: "0x632ea0" 
  }, 
  meta: {
    accountType: "privateKey",
    address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
    signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
  },
  onSent: function (result) { console.log(result); },
  onSuccess: function (result) { console.log(result); },
  onFailed: function (result) { console.log(result); }
});

Provides JavaScript bindings for the FeeWindow Solidity Contract, which allows for the buying and redeeming of Participation Tokens.

augur.api.FeeWindow.buy(p)

Purchases the number of Participation Tokens specified by p._attotokens.

This transaction will fail if:

These Participation Tokens can be redeemed later once the Fee Window is no longer active using the function augur.api.FeeWindow.redeem.

Parameters:

Returns:

augur.api.FeeWindow.redeem(p)

Converts any Participation Tokens p._sender has in the specified Fee Window to Reputation Tokens, and gives the user any Reporting Fees he or she is owed in Ether. The parameter p._sender is the Ethereum address of the user redeeming the Participation Tokens, as a 20-byte hexadecimal string.

This transaction will trigger a FeeWindowRedeemed event if the REP/Ether was redeemed without any errors.

Parameters:

Returns:

augur.api.FeeWindow.withdrawInEmergency(p)

If a critical bug or vulnerability is found in Augur, the Augur development team can put Augur into a halted 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:

Parameters:

Returns:

Fill Order Tx API

// Fill Order Transaction API Examples:

// The Ethereum address of Augur's default FillOrder contract
// can be obtained by calling `augur.augurNode.getSyncData`.
var fillOrderAddress = "0x0c77f6af7b3b5fed8ca980414a97c62da283098a";

var _orderId = "0xea2c7476e61f5e2625e57df17fcce74741d3c2004ac657675f686a23d06e6091";
var _amountFillerWants = "0x8ac7230489e80000"; // 10.0 shares
var _tradeGroupId = "0x0000000000000000000000000000000000000000000000000000000000000002";

augur.api.FillOrder.publicFillOrder({
  _orderId: _orderId,
  _amountFillerWants: _amountFillerWants,
  _tradeGroupId: _tradeGroupId,
  tx: { 
    to: fillOrderAddress,
    value: "0x16345785d8a0000", 
    gas: "0x632ea0" 
  }, 
  meta: {
    accountType: "privateKey",
    address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
    signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
  },
  onSent: function (result) { console.log(result); },
  onSuccess: function (result) { console.log(result); },
  onFailed: function (result) { console.log(result); }
});

Provides JavaScript bindings for the FillOrder Solidity Contract, which allows for the Filling of Orders on the Order Book.

augur.api.FillOrder.publicFillOrder(p)

Attempts to Fill p._amountFillerWants Share Units for Order p._orderId. If p._amountFillerWants is enough to Fill the Order completely, the Order will be removed from the Order Book. Otherwise, it will be adjusted to only include the remaining amount after Filling the p._amountFillerWants value that the Filler requests. This transaction will trigger an OrderFilled event if the Order is Filled without any errors.

This transaction will fail if:

Parameters:

Returns:

Initial Reporter Tx API

// Initial Reporter Transaction API Examples:

// The Ethereum address of a Market's InitialReporter contract 
// can be obtained by calling `augur.api.Market.getInitialReporter`.
var initialReporterAddress = "0x0c77f6af7b3b5fed8ca980414a97c62da283098a";

augur.api.InitialReporter.forkAndRedeem({
  tx: { 
    to: initialReporterAddress,
    gas: "0x632ea0" 
  }, 
  meta: {
    accountType: "privateKey",
    address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
    signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
  },
  onSent: function (result) { console.log(result); },
  onSuccess: function (result) { console.log(result); },
  onFailed: function (result) { console.log(result); }
});

augur.api.InitialReporter.redeem({
  "": initialReporterAddress, // This parameter's key must be the empty string, and its value can be any address-length string.
  tx: { 
    to: initialReporterAddress,
    gas: "0x632ea0" 
  }, 
  meta: {
    accountType: "privateKey",
    address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
    signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
  },
  onSent: function (result) { console.log(result); },
  onSuccess: function (result) { console.log(result); },
  onFailed: function (result) { console.log(result); }
});

augur.api.InitialReporter.transferOwnership({
  _newOwner: "0x9998ff3e9ce1c0459b309fac6dd4e69229b91777",
  tx: { 
    to: initialReporterAddress,
    gas: "0x632ea0" 
  }, 
  meta: {
    accountType: "privateKey",
    address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
    signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
  },
  onSent: function (result) { console.log(result); },
  onSuccess: function (result) { console.log(result); },
  onFailed: function (result) { console.log(result); }
});

augur.api.InitialReporter.withdrawInEmergency({
  tx: { 
    to: initialReporterAddress,
    gas: "0x632ea0" 
  }, 
  meta: {
    accountType: "privateKey",
    address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
    signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
  },
  onSent: function (result) { console.log(result); },
  onSuccess: function (result) { console.log(result); },
  onFailed: function (result) { console.log(result); }
});

Provides JavaScript bindings for the InitialReporter Solidity Contract, which enables functionality related to Initial Reports.

augur.api.InitialReporter.forkAndRedeem(p)

Causes a Child Universe to be created for the Outcome of the Initial Report and migrates the REP Staked by the Initial Reporter to the Child Universe. This transaction can be called at any time after the Fork has begun (including after the Market has been Finalized). When called by a user who who submitted the Initial Report, it will also transfer the REP Staked on the Initial Report’s Outcome to the Initial Reporter of the Forked Market.

This transaction will trigger a ReportingParticipantDisavowed event if the InitialReporter was forked without any errors.

This transaction will fail if:

Parameters:

Returns:

augur.api.InitialReporter.redeem(p)

Redeems the REP that the Designated Reporter or First Public Reporter Staked on the Outcome of the Initial Report.

This transaction will trigger an InitialReporterRedeemed event if the REP/Ether was redeemed without any errors.

Parameters:

Returns:

augur.api.InitialReporter.transferOwnership(p)

Changes the owner of the Initial Reporter contract from the existing owner to p._newOwner.

This function will fail if:

This transaction will trigger an InitialReporterTransferred event if the REP/Ether was transferred without any errors.

Parameters:

Returns:

augur.api.InitialReporter.withdrawInEmergency(p)

If a critical bug or vulnerability is found in Augur, the Augur development team can put Augur into a halted 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, Initial Reporters can call the withdrawInEmergency function to withdraw the REP they Staked on the Initial Report Outcome (in cases where the First Public Reporter submitted the Initial Report instead of the Designated Reporter).

This transaction will fail if:

Parameters:

Returns:

Mailbox Tx API

// Mailbox Transaction API Examples:

// The Ethereum address of a Market Creator's mailbox can be obtained
// by calling `augur.api.Market.getMarketCreatorMailbox`.
var mailboxAddress = "0x9368ff3e9ce1c0459b309fac6dd4e69229b91a42";

augur.api.Mailbox.transferOwnership({
  _newOwner: "0x8fa56abe36d8dc76cf85fecb6a3026733e0a12ac",
  tx: { 
    to: mailboxAddress,
    gas: "0x632ea0" 
  }, 
  meta: {
    accountType: "privateKey",
    address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
    signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
  },
  onSent: function (result) { console.log(result); },
  onSuccess: function (result) { console.log(result); },
  onFailed: function (result) { console.log(result); }
});

augur.api.Mailbox.withdrawEther({
  tx: { 
    to: mailboxAddress,
    gas: "0x632ea0" 
  }, 
  meta: {
    accountType: "privateKey",
    address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
    signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
  },
  onSent: function (result) { console.log(result); },
  onSuccess: function (result) { console.log(result); },
  onFailed: function (result) { console.log(result); }
});

var _repTokenAddress = "0x9368ff3e9ce1c0459b309fac6dd4e69229b91a42";
augur.api.Mailbox.withdrawTokens({
  _token: _repTokenAddress,
  tx: { 
    to: mailboxAddress,
    gas: "0x632ea0" 
  }, 
  meta: {
    accountType: "privateKey",
    address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
    signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
  },
  onSent: function (result) { console.log(result); },
  onSuccess: function (result) { console.log(result); },
  onFailed: function (result) { console.log(result); }
});

Provides JavaScript bindings for the Mailbox Solidity Contract, which enables the functionality of the Market Creator Mailbox.

augur.api.Mailbox.transferOwnership(p)

Changes the current owner of Market Creator Mailbox to p._newOwner. This transaction will trigger a MarketMailboxTransferred event, which will record the Market Creator Mailbox, the Market & Universe it belongs to, as well as the old owner’s address and the new owner’s address.

This transaction will fail if:

Parameters:

Returns:

augur.api.Mailbox.withdrawEther(p)

Transfers all Ether in the Market Creator Mailbox to the Market Creator’s Ethereum address.

This transaction will fail if:

Parameters:

Returns:

augur.api.Mailbox.withdrawTokens(p)

Transfers all tokens of type p._token in the Market Creator Mailbox to the Market Creator’s Ethereum address.

This transaction will fail if:

Parameters:

Returns:

Market Tx API

// Market Transaction API Examples:
var marketAddress = "0x9368ff3e9ce1c0459b309fac6dd4e69229b91a42";

var _payoutNumerators = [ "0x0", "0x2710" ];
var _invalid = false;
var _amount = "0x64";
augur.api.Market.contribute({
  _payoutNumerators: _payoutNumerators,
  _invalid: _invalid,
  _amount: _amount,
  tx: { 
    to: marketAddress,
    gas: "0x632ea0" 
  }, 
  meta: {
    accountType: "privateKey",
    address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
    signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
  },
  onSent: function (result) { console.log(result); },
  onSuccess: function (result) { console.log(result); },
  onFailed: function (result) { console.log(result); }
});

augur.api.Market.disavowCrowdsourcers({
  tx: { 
    to: marketAddress,
    gas: "0x632ea0" 
  }, 
  meta: {
    accountType: "privateKey",
    address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
    signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
  },
  onSent: function (result) { console.log(result); },
  onSuccess: function (result) { console.log(result); },
  onFailed: function (result) { console.log(result); }
});

augur.api.Market.doInitialReport({
  _payoutNumerators: _payoutNumerators,
  _invalid: _invalid,
  tx: { 
    to: marketAddress,
    gas: "0x632ea0" 
  }, 
  meta: {
    accountType: "privateKey",
    address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
    signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
  },
  onSent: function (result) { console.log(result); },
  onSuccess: function (result) { console.log(result); },
  onFailed: function (result) { console.log(result); }
});

augur.api.Market.finalize({
  tx: { 
    to: marketAddress,
    gas: "0x632ea0" 
  }, 
  meta: {
    accountType: "privateKey",
    address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
    signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
  },
  onSent: function (result) { console.log(result); },
  onSuccess: function (result) { console.log(result); },
  onFailed: function (result) { console.log(result); }
});

augur.api.Market.finalizeFork({
  tx: { 
    to: marketAddress,
    gas: "0x632ea0" 
  }, 
  meta: {
    accountType: "privateKey",
    address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
    signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
  },
  onSent: function (result) { console.log(result); },
  onSuccess: function (result) { console.log(result); },
  onFailed: function (result) { console.log(result); }
});

augur.api.Market.migrateThroughOneFork({
  tx: { 
    to: marketAddress,
    gas: "0x632ea0" 
  }, 
  meta: {
    accountType: "privateKey",
    address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
    signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
  },
  onSent: function (result) { console.log(result); },
  onSuccess: function (result) { console.log(result); },
  onFailed: function (result) { console.log(result); }
});

augur.api.Market.transferOwnership({
  _newOwner: "0x8fa56abe36d8dc76cf85fecb6a3026733e0a12ac",
  tx: { 
    to: marketAddress,
    gas: "0x632ea0" 
  }, 
  meta: {
    accountType: "privateKey",
    address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
    signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
  },
  onSent: function (result) { console.log(result); },
  onSuccess: function (result) { console.log(result); },
  onFailed: function (result) { console.log(result); }
});

augur.api.Market.withdrawInEmergency({
  tx: { 
    to: marketAddress,
    gas: "0x632ea0" 
  }, 
  meta: {
    accountType: "privateKey",
    address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
    signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
  },
  onSent: function (result) { console.log(result); },
  onSuccess: function (result) { console.log(result); },
  onFailed: function (result) { console.log(result); }
});

Provides JavaScript bindings for the Market Solidity Contract, which enables functionality for Augur’s Markets.

augur.api.Market.contribute(p)

Contributes p._amount REP to the Dispute Crowdsourcer represented by Payout Set p._payoutNumerators and p._invalid in order to help Challenge the Market’s Tentative Outcome. If the amount of REP in the Dispute Crowdsourcer plus p._amount is greater than the total REP required to fill the Dispute Bond, this function will only contribute the remaining amount of REP required to fill the Dispute Bond on behalf of the caller.

This transaction will trigger a DisputeCrowdsourcerContribution event if it executes without any errors. It will also trigger a DisputeCrowdsourcerCompleted event if the Dispute Bond is successfullly filled, and it will trigger a UniverseForked event if enough REP has been Staked in the Dispute Crowdsourcer to cause the Market to Fork.

This function will fail if:

Parameters:

Returns:

augur.api.Market.disavowCrowdsourcers(p)

“Disavows” all Dispute Crowdsourcers of a Market, meaning the Market’s Tentative Outcome is reset back to the Outcome of the Initial Report, and all REP Staked in the Crowdsourcers are redeemable by users who contributed to them using the function augur.api.DisputeCrowdsourcer.redeem. This transaction may only be called on non-Forked Markets in the event that another Market in the same Universe Forks.

This transaction will trigger a MarketParticipantsDisavowed event if the Market’s InitialReporter and DisputeCrowdsourcers were disavowed without any errors.

This function will fail if:

Parameters:

Returns:

augur.api.Market.doInitialReport(p)

Submits an Initial Report for the Market. This transaction will trigger an InitialReportSubmitted event if it submits the Initial Report successfully.

This transaction will fail if:

Parameters:

Returns:

augur.api.Market.finalize(p)

Finalizes the Market, meaning it sets the winning Payout Distribution Hash for the Market, redistributes REP Staked on non-winning Outcomes to REP holders who Staked on the winning Outcome, and distributes the Validity Bond based on whether the Market resolved as Invalid. Then, once the Post-Finalization Waiting Period has elapsed, users can Settle their Shares. This transaction will trigger a MarketFinalized event if the Market Finalized without any errors.

This transaction will fail if:

Parameters:

Returns:

augur.api.Market.finalizeFork(p)

Finalizes the Forked Market, meaning it sets the winning Payout Distribution Hash for the Market. Then, once the Post-Finalization Waiting Period has elapsed, users can Settle their Shares.

This transaction will fail if:

Parameters:

Returns:

augur.api.Market.migrateThroughOneFork(p)

Migrates the Market into a winning Child Universe from a Forked Parent Universe. When a Fork occurs, there is a Fork Period, wherein 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 is declared the Winning Universe. Calling this function attempts to move the Market from a Parent Universe to the Winning Universe after it’s been decided. This function also migrates the No-Show Bond to the winning Universe and migrates REP staked in the InitialReporter contract to the ReputationToken contract associated with the Child Universe.

This transaction will fail if:

Parameters:

Returns:

augur.api.Market.transferOwnership(p)

Changes the owner of the Market from the current owner to p._newOwner. This transaction will trigger a MarketTransferred event, which will record the Market and Universe it belongs to, as well as the old owner’s address and the new owner’s address.

This transaction will fail if:

Parameters:

Returns:

augur.api.Market.withdrawInEmergency(p)

If a critical bug or vulnerability is found in Augur, the development team can put it the system into a halted 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:

Parameters:

Returns:

Reputation Token Tx API

// Reputation Token Transaction API Examples:

// The Ethereum contract address for Augur.sol can be 
// obtained by calling `augur.augurNode.getSyncData`.
var _augurContractAddress = "0x67cbf60a24ab922af99e6f335c0ff2b084d5bdbe";
// The Ethereum contract address for a Universe's Reputation Token 
// can be obtained by calling `augur.api.Universe.getReputationToken`.
var reputationTokenAddress = "0xd2ee83a8a2a904181ccfddd8292f178614062aa0";

augur.api.ReputationToken.approve({
  _spender: _augurContractAddress,
  _value: "0xff",
  tx: { 
    to: reputationTokenAddress,
    gas: "0x632ea0" 
  }, 
  meta: {
    accountType: "privateKey",
    address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
    signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
  },
  onSent: function (result) { console.log(result); },
  onSuccess: function (result) { console.log(result); },
  onFailed: function (result) { console.log(result); }
});

augur.api.ReputationToken.decreaseApproval({
  _spender: _augurContractAddress,
  _subtractedValue: "0x3e8",
  tx: { 
    to: reputationTokenAddress,
    gas: "0x632ea0" 
  },
  meta: {
    accountType: "privateKey",
    address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
    signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
  },
  onSent: function (result) { console.log(result); },
  onSuccess: function (result) { console.log(result); },
  onFailed: function (result) { console.log(result); }
});

augur.api.ReputationToken.increaseApproval({
  _spender: _augurContractAddress,
  _addedValue: "0x3e8",
  tx: { 
    to: reputationTokenAddress,
    gas: "0x632ea0" 
  },
  meta: {
    accountType: "privateKey",
    address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
    signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
  },
  onSent: function (result) { console.log(result); },
  onSuccess: function (result) { console.log(result); },
  onFailed: function (result) { console.log(result); }
});

augur.api.ReputationToken.migrateFromLegacyReputationToken({
  tx: { 
    to: reputationTokenAddress,
    gas: "0x632ea0" 
  }, 
  meta: {
    accountType: "privateKey",
    address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
    signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
  },
  onSent: function (result) { console.log(result); },
  onSuccess: function (result) { console.log(result); },
  onFailed: function (result) { console.log(result); }
});

var _destination = "0x73295d3c0ca46113ca226222c81c79adabf9f391";
augur.api.ReputationToken.migrateOut({
  _destination: _destination,
  _attotokens: "0xa",
  tx: { 
    to: reputationTokenAddress,
    gas: "0x632ea0" 
  }, 
  meta: {
    accountType: "privateKey",
    address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
    signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
  },
  onSent: function (result) { console.log(result); },
  onSuccess: function (result) { console.log(result); },
  onFailed: function (result) { console.log(result); }
});

augur.api.ReputationToken.migrateOutByPayout({
  _payoutNumerators: ["0x1", "0x270F"],
  _invalid: false,
  _attotokens: "0xa",
  tx: { 
    to: reputationTokenAddress,
    gas: "0x632ea0" 
  }, 
  meta: {
    accountType: "privateKey",
    address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
    signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
  },
  onSent: function (result) { console.log(result); },
  onSuccess: function (result) { console.log(result); },
  onFailed: function (result) { console.log(result); }
});

augur.api.ReputationToken.transfer({
  _to: "0x8fa56abe36d8dc76cf85fecb6a3026733e0a12ac",
  _value: "0xff",
  tx: { 
    to: reputationTokenAddress,
    gas: "0x632ea0" 
  }, 
  meta: {
    accountType: "privateKey",
    address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
    signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
  },
  onSent: function (result) { console.log(result); },
  onSuccess: function (result) { console.log(result); },
  onFailed: function (result) { console.log(result); }
});

augur.api.ReputationToken.transferFrom({
  _from: "0x1a05071893b764109f0bbc5b75d78e3e38b69ab3",
  _to: "0x8fa56abe36d8dc76cf85fecb6a3026733e0a12ac",
  _value: "0xff",
  tx: { 
    to: reputationTokenAddress,
    gas: "0x632ea0" 
  }, 
  meta: {
    accountType: "privateKey",
    address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
    signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
  },
  onSent: function (result) { console.log(result); },
  onSuccess: function (result) { console.log(result); },
  onFailed: function (result) { console.log(result); }
});

augur.api.ReputationToken.updateParentTotalTheoreticalSupply({
  tx: { 
    to: reputationTokenAddress,
    gas: "0x632ea0" 
  }, 
  meta: {
    accountType: "privateKey",
    address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
    signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
  },
  onSent: function (result) { console.log(result); },
  onSuccess: function (result) { console.log(result); },
  onFailed: function (result) { console.log(result); }
});

augur.api.ReputationToken.updateSiblingMigrationTotal({
  tx: { 
    to: reputationTokenAddress,
    gas: "0x632ea0" 
  }, 
  meta: {
    accountType: "privateKey",
    address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
    signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
  },
  onSent: function (result) { console.log(result); },
  onSuccess: function (result) { console.log(result); },
  onFailed: function (result) { console.log(result); }
});

Provides JavaScript bindings for the ReputationToken Solidity Contract, which handles the approval, migration, and transfering of Reputation Tokens.

The Reputation Token, or REP, 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.approve(p)

Allows p._spender to spend up to p._value REP for the msg.sender of this transaction. This transaction will trigger an Approval event, which will record the owner address (msg.sender), p._spender, and p._value in attoREP approved. The amount that p.spender is approved to spend can be increased or decreased later by calling augur.api.ReputationToken.increaseApproval or augur.api.ReputationToken.decreaseApproval.

Parameters:

Returns:

augur.api.ReputationToken.decreaseApproval(p)

Decreases the amount of REP p._spender is approved to spend on behalf of msg.sender.

Parameters:

Returns:

augur.api.ReputationToken.increaseApproval(p)

Increases the amount of REP p._spender is approved to spend on behalf of msg.sender.

Parameters:

Returns:

augur.api.ReputationToken.migrateFromLegacyReputationToken(p)

Migrates Legacy REP tokens owned by msg.sender from the Legacy REP contract to the reputationToken provided. This transaction will add whatever msg.sender’s balance was for the Legacy REP contract to the reputationToken contract.

Parameters:

Returns:

augur.api.ReputationToken.migrateOut(p)

This transaction migrates p._attotokens of msg.sender’s REP from contract address p.tx.to to p._destination contract address in the case of a Fork.

This transaction will fail if:

Parameters:

Returns:

augur.api.ReputationToken.migrateOutByPayout(p)

Creates a Child Universe (if it does not already exist) for the ReputationToken contract’s Universe, where the Forked Market has the Payout Set p._payoutNumerators. If the Forked Market is deemed to have an Invalid Outcome, p._invalid should be set to true; otherwise, it should be set to false. Once the Child Universe exists, the function will migrate p._attotokens REP from the ReputationToken contract of the Parent Universe to the ReputationToken contract of the Child Universe.

This transaction will fail if:

Parameters:

Returns:

augur.api.ReputationToken.transfer(p)

Sends p._value worth of attoREP to the Ethereum address p._to. If this transaction transfers without any errors, it will trigger a Transfer event, which will record the from address (msg.sender), p._to address, and p._value amount transferred.

This transaction will fail if:

Parameters:

Returns:

augur.api.ReputationToken.transferFrom(p)

Sends p._value worth of attoREP from the Ethereum addres p._from to the Ethereum address p._to. If this transaction transfers without any errors, it will trigger a Transfer event, which will record the p._from address, p._to address, and p._value (in attoREP) amount transferred.

This transaction will fail if:

Parameters:

Returns:

augur.api.ReputationToken.updateParentTotalTheoreticalSupply(p)

Gets the current Theoretical REP Supply for this ReputationToken contract’s Parent Universe, and updates this ReputationToken contract’s Theoretical REP Supply accordingly.

Parameters:

Returns:

augur.api.ReputationToken.updateSiblingMigrationTotal(p)

Gets the current Theoretical REP Supply for a ReputationToken contract sharing the same Parent Universe as the specified ReputationToken, and updates the specified ReputationToken contract’s Theoretical REP Supply accordingly.

This transaction will fail if:

Parameters:

Returns:

Share Token Tx API

// Share Token Transaction API Examples:

// The Ethereum contract address for Augur.sol can be 
// obtained by calling `augur.augurNode.getSyncData`.
var _augurContractAddress = "0x67cbf60a24ab922af99e6f335c0ff2b084d5bdbe";
// Share Token contract addresses for a Market can be 
// obtained by calling `augur.api.Market.getShareToken`.
var shareTokenAddress = "0x925bee44fec28deb228d2251e1a9d32f7c73ebed";

var _attotokens = "0x56bc75e2d63100000";

augur.api.ShareToken.approve({
  _spender: _augurContractAddress,
  _value: _attotokens,
  tx: { 
    to: shareTokenAddress,
    gas: "0x632ea0" 
  }, 
  meta: {
    accountType: "privateKey",
    address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
    signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
  },
  onSent: function (result) { console.log(result); },
  onSuccess: function (result) { console.log(result); },
  onFailed: function (result) { console.log(result); }
});

augur.api.ShareToken.decreaseApproval({
  _spender: _augurContractAddress,
  _subtractedValue: "0x3e8",
  tx: { 
    to: shareTokenAddress,
    gas: "0x632ea0" 
  },
  meta: {
    accountType: "privateKey",
    address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
    signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
  },
  onSent: function (result) { console.log(result); },
  onSuccess: function (result) { console.log(result); },
  onFailed: function (result) { console.log(result); }
});

augur.api.ShareToken.increaseApproval({
  _spender: _augurContractAddress,
  _addedValue: "0x3e8",
  tx: { 
    to: shareTokenAddress,
    gas: "0x632ea0" 
  },
  meta: {
    accountType: "privateKey",
    address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
    signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
  },
  onSent: function (result) { console.log(result); },
  onSuccess: function (result) { console.log(result); },
  onFailed: function (result) { console.log(result); }
});

augur.api.ShareToken.transfer({
  _to: "0x01f50356c280cd886dd058210937160c73700a4b",
  _value: _attotokens,
  tx: { 
    to: shareTokenAddress,
    gas: "0x632ea0" 
  }, 
  meta: {
    accountType: "privateKey",
    address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
    signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
  },
  onSent: function (result) { console.log(result); },
  onSuccess: function (result) { console.log(result); },
  onFailed: function (result) { console.log(result); }
});

augur.api.ShareToken.transferFrom({
  _from: "0x4b01721f0244e7c5b5f63c20942850e447f5a5ee",
  _to: "0xa1f50356c280cd886dd058210937160c73700a4b",
  _value: _attotokens,
  tx: { 
    to: shareTokenAddress,
    gas: "0x632ea0" 
  }, 
  meta: {
    accountType: "privateKey",
    address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
    signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
  },
  onSent: function (result) { console.log(result); },
  onSuccess: function (result) { console.log(result); },
  onFailed: function (result) { console.log(result); }
});

Provides JavaScript bindings for the ShareToken Solidity Code, which handles the approval and transferring of Shares in Augur.

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. Within Augur, it represents Shares in Market Outcomes.

augur.api.ShareToken.approve(p)

Allows p._spender to spend up to p._value Shares for the msg.sender of this transaction. This transaction will trigger an Approval event, which will record the owner address (msg.sender), p._spender, and p._value, in Share Units, approved. The amount that p.spender is approved to spend can be increased or decreased later by calling augur.api.ShareToken.increaseApproval or augur.api.ShareToken.decreaseApproval.

Parameters:

Returns:

augur.api.ShareToken.decreaseApproval(p)

Decreases the amount of Shares p._spender is approved to spend on behalf of msg.sender.

Parameters:

Returns:

augur.api.ShareToken.increaseApproval(p)

Increases the amount of Shares p._spender is approved to spend on behalf of msg.sender.

Parameters:

Returns:

augur.api.ShareToken.transfer(p)

Sends p._value worth of Share Units to the Ethereum address p._to. If this transaction transfers without any errors, it will trigger a Transfer event, which will record the from address (msg.sender), p._to address, and p._value amount transferred.

This transaction will fail if:

Parameters:

Returns:

augur.api.ShareToken.transferFrom(p)

Sends p._value worth of Share Units from the Ethereum addres p._from to the Ethereum address p._to. If this transaction transfers without any errors, it will trigger a Transfer event, which will record the p._from address, p._to address, and p._value (in Share Units) amount transferred.

This transaction will fail if:

Parameters:

Returns:

Trade Tx API

// Trade Transaction API Examples:

// The Ethereum address of Augur's default Trade contract
// can be obtained by calling `augur.augurNode.getSyncData`.
var tradeAddress = "0x0dec7fd04933b8673cef99b64978113065b03926";

var _market = "0x7e8e07364ccde43ba5159537404924e86ca53c92";
var _outcome = "0x1";
var _fxpAmount = "0x8ac7230489e80000"; // 10.0
var _price = "0x6f05b59d3b20000"; // 0.5
var _betterOrderId = "0xea2c7476e61f5e2625e57df17fcce74741d3c2004ac657675f686a23d06e6091";
var _worseOrderId = "0xed42c0fab97ee6fbde7c47dc62dc3ad09e8d3af53517245c77c659f7cd561426";
var _tradeGroupId = "0x0000000000000000000000000000000000000000000000000000000000000003";
var _loopLimit = "0x2";
augur.api.Trade.publicBuy({
  _market: _market,
  _outcome: _outcome,
  _fxpAmount: _fxpAmount,
  _price: _price,
  _betterOrderId: _betterOrderId,
  _worseOrderId: _worseOrderId,
  _tradeGroupId: _tradeGroupId,
  tx: { 
    to: tradeAddress,
    value: "0x16345785d8a0000", 
    gas: "0x632ea0" 
  }, 
  meta: {
    accountType: "privateKey",
    address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
    signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
  },
  onSent: function (result) { console.log(result); },
  onSuccess: function (result) { console.log(result); },
  onFailed: function (result) { console.log(result); }
});

augur.api.Trade.publicBuyWithLimit({
  _market: _market,
  _outcome: _outcome,
  _fxpAmount: _fxpAmount,
  _price: _price,
  _betterOrderId: _betterOrderId,
  _worseOrderId: _worseOrderId,
  _tradeGroupId: _tradeGroupId,
  _loopLimit: _loopLimit,
  tx: { 
    to: tradeAddress,
    value: "0x16345785d8a0000", 
    gas: "0x632ea0" 
  }, 
  meta: {
    accountType: "privateKey",
    address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
    signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
  },
  onSent: function (result) { console.log(result); },
  onSuccess: function (result) { console.log(result); },
  onFailed: function (result) { console.log(result); }
});

augur.api.Trade.publicFillBestOrder({
  _direction: "0x1",
  _market: _market,
  _outcome: _outcome,
  _fxpAmount: _fxpAmount,
  _price: _price,
  _tradeGroupId: _tradeGroupId,
  tx: { 
    to: tradeAddress,
    value: "0x16345785d8a0000", 
    gas: "0x632ea0" 
  }, 
  meta: {
    accountType: "privateKey",
    address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
    signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
  },
  onSent: function (result) { console.log(result); },
  onSuccess: function (result) { console.log(result); },
  onFailed: function (result) { console.log(result); }
});

augur.api.Trade.publicFillBestOrderWithLimit({
  _direction: "0x1",
  _market: _market,
  _outcome: _outcome,
  _fxpAmount: _fxpAmount,
  _price: _price,
  _tradeGroupId: _tradeGroupId,
  _loopLimit: _loopLimit,
  tx: { 
    to: tradeAddress,
    value: "0x16345785d8a0000", 
    gas: "0x632ea0" 
  }, 
  meta: {
    accountType: "privateKey",
    address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
    signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
  },
  onSent: function (result) { console.log(result); },
  onSuccess: function (result) { console.log(result); },
  onFailed: function (result) { console.log(result); }
});

augur.api.Trade.publicSell({
  _market: _market,
  _outcome: _outcome,
  _fxpAmount: _fxpAmount,
  _price: _price,
  _betterOrderId: _betterOrderId,
  _worseOrderId: _worseOrderId,
  _tradeGroupId: _tradeGroupId,
  tx: { 
    to: tradeAddress,
    value: "0x16345785d8a0000", 
    gas: "0x632ea0" 
  }, 
  meta: {
    accountType: "privateKey",
    address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
    signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
  },
  onSent: function (result) { console.log(result); },
  onSuccess: function (result) { console.log(result); },
  onFailed: function (result) { console.log(result); }
});

augur.api.Trade.publicSellWithLimit({
  _market: _market,
  _outcome: _outcome,
  _fxpAmount: _fxpAmount,
  _price: _price,
  _betterOrderId: _betterOrderId,
  _worseOrderId: _worseOrderId,
  _tradeGroupId: _tradeGroupId,
  _loopLimit: _loopLimit,
  tx: { 
    to: tradeAddress,
    value: "0x16345785d8a0000", 
    gas: "0x632ea0" 
  }, 
  meta: {
    accountType: "privateKey",
    address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
    signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
  },
  onSent: function (result) { console.log(result); },
  onSuccess: function (result) { console.log(result); },
  onFailed: function (result) { console.log(result); }
});

augur.api.Trade.publicTrade({
  _direction: "0x0",
  _market: _market,
  _outcome: _outcome,
  _fxpAmount: _fxpAmount,
  _price: _price,
  _betterOrderId: _betterOrderId,
  _worseOrderId: _worseOrderId,
  _tradeGroupId: _tradeGroupId,
  tx: { 
    to: tradeAddress,
    value: "0x16345785d8a0000", 
    gas: "0x632ea0" 
  }, 
  meta: {
    accountType: "privateKey",
    address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
    signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
  },
  onSent: function (result) { console.log(result); },
  onSuccess: function (result) { console.log(result); },
  onFailed: function (result) { console.log(result); }
});

augur.api.Trade.publicTradeWithLimit({
  _direction: "0x0",
  _market: _market,
  _outcome: _outcome,
  _fxpAmount: _fxpAmount,
  _price: _price,
  _betterOrderId: _betterOrderId,
  _worseOrderId: _worseOrderId,
  _tradeGroupId: _tradeGroupId,
  _loopLimit: _loopLimit,
  tx: { 
    to: tradeAddress,
    value: "0x16345785d8a0000", 
    gas: "0x632ea0" 
  }, 
  meta: {
    accountType: "privateKey",
    address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
    signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
  },
  onSent: function (result) { console.log(result); },
  onSuccess: function (result) { console.log(result); },
  onFailed: function (result) { console.log(result); }
});

Provides JavaScript bindings for the Trade Solidity Contract, which allows for the buying and selling of Shares of a particular Outcome in a Market.

augur.api.Trade.publicBuy(p)

Buys p._fxpAmount number of Shares in Outcome p._outcome of Market p._market at p._price attoETH per Share. This transaction takes Orders off the Order Book that can be Filled with this request, otherwise it creates a new Order to buy p._fxpAmount of Share Units at p._price. The parameters p._betterOrderId and p._worseOrderId are the Orders with the next best/next worse price after p._price, and they are used to optimize the process of sorting the new Order on the Order Book. Their IDs can be obtained by calling augur.trading.getBetterWorseOrders. This transaction will trigger an OrderCreated event if the Order is created without any errors.

This transaction will fail if:

Parameters:

Returns:

augur.api.Trade.publicBuyWithLimit(p)

Works like augur.api.Trade.publicBuy, but uses the parameter _loopLimit to determine how many Fill Order operations to perform. The function augur.api.Trade.publicBuy will do as many Fill Order operations as the amount of gas passed to it will permit, based on a hard-coded value for how much gas is needed to Fill an Order. If the gas cost drops significantly from where it is at Augur’s launch, the Trade contract would require far more gas than is actually needed. Therefore, in such a scenario, augur.api.Trade.publicBuyWithLimit could be used instead.

Parameters:

Returns:

augur.api.Trade.publicFillBestOrder(p)

Works similarly to augur.api.Trade.publicTrade, except it does not create an Order if the request can’t be Filled. Instead, it will take the best Order available on the Order Book.

Parameters:

Returns:

augur.api.Trade.publicFillBestOrderWithLimit(p)

Works like augur.api.Trade.publicFillBestOrder, but uses the parameter _loopLimit to determine how many Fill Order operations to perform. The function augur.api.Trade.publicFillBestOrder will do as many Fill Order operations as the amount of gas passed to it will permit, based on a hard-coded value for how much gas is needed to Fill an Order. If the gas cost drops significantly from where it is at Augur’s launch, the Trade contract would require far more gas than is actually needed. Therefore, in such a scenario, augur.api.Trade.publicFillBestOrderWithLimit could be used instead.

Parameters:

Returns:

augur.api.Trade.publicSell(p)

Sells p._fxpAmount number of Share Units in Outcome p._outcome of Market p._market at p._price attoETH per Share. This transaction takes Orders off the Order Book that can be Filled with this request, otherwise it creates a new Order to sell p._fxpAmount of Share Units. The parameters p._betterOrderId and p._worseOrderId are the Orders with the next best/next worse price with respect to p._price, and they are used to optimize the process of sorting the new Order on the Order Book. Their IDs can be obtained by calling augur.trading.getBetterWorseOrders. This transaction will trigger an OrderCreated event if the Order is created without any errors.

This transaction will fail if:

Parameters:

Returns:

augur.api.Trade.publicSellWithLimit(p)

Works like augur.api.Trade.publicSell, but uses the parameter _loopLimit to determine how many Fill Order operations to perform. The function augur.api.Trade.publicSell will do as many Fill Order operations as the amount of gas passed to it will permit, based on a hard-coded value for how much gas is needed to Fill an Order. If the gas cost drops significantly from where it is at Augur’s launch, the Trade contract would require far more gas than is actually needed. Therefore, in such a scenario, augur.api.Trade.publicSellWithLimit could be used instead.

Parameters:

Returns:

augur.api.Trade.publicTrade(p)

Works similarly to augur.api.Trade.publicBuy and augur.api.Trade.publicSell; however a direction must be specified. The p._direction must be either “0x0” for long or “0x1” for short. This transaction will trigger an OrderCreated event if the Order is created without any errors.

This transaction will fail if:

The value of the Order (calculated as p._price * (Market’s number of Ticks - p._fxpAmount) for a sell Order and p._price * p._fxpAmount for a buy Order) is less than the minimum value for an Order, which is 10**14 attoETH.

Parameters:

Returns:

augur.api.Trade.publicTradeWithLimit(p)

Works like augur.api.Trade.publicTrade, but uses the parameter _loopLimit to determine how many Fill Order operations to perform. The function augur.api.Trade.publicTrade will do as many Fill Order operations as the amount of gas passed to it will permit, based on a hard-coded value for how much gas is needed to Fill an Order. If the gas cost drops significantly from where it is at Augur’s launch, the Trade contract would require far more gas than is actually needed. Therefore, in such a scenario, augur.api.Trade.publicTradeWithLimit could be used instead.

Parameters:

Returns:

Trading Escape Hatch Tx API

// Trading Escape Hatch Transaction API Examples:

// The Ethereum address of Augur's default TradingEscapeHatch contract
// can be obtained by calling `augur.augurNode.getSyncData`.
var tradingEscapeHatch = "0x157a8998f5470a2be3917aab31d334109f56c30c";

var _market = "0x465407364ccde43ba5159537404924e86ca53aaa";
augur.api.TradingEscapeHatch.claimSharesInUpdate({
  _market: _market,
  tx: { 
    to: tradingEscapeHatch,
    gas: "0x632ea0" 
  }, 
  meta: {
    accountType: "privateKey",
    address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
    signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
  },
  onSent: function (result) { console.log(result); },
  onSuccess: function (result) { console.log(result); },
  onFailed: function (result) { console.log(result); }
});

augur.api.TradingEscapeHatch.getFrozenShareValueInMarket({
  _market: _market,
  tx: { 
    to: tradingEscapeHatch,
    gas: "0x632ea0" 
  }, 
  meta: {
    accountType: "privateKey",
    address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
    signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
  },
  onSent: function (result) { console.log(result); },
  onSuccess: function (result) { console.log(result); },
  onFailed: function (result) { console.log(result); }
});

Provides JavaScript bindings for the TradingEscapeHatch Solidity Contract, which allows funds to be withdrawn from Augur in the event that Augur needs to be halted by the development team.

augur.api.TradingEscapeHatch.claimSharesInUpdate(p)

If Augur needs to be halted by the development team (for example, if a vulnerability is discovered), calling this function on the specified Market will cash out the caller’s Shares to the Market’s denomination token and send the cashed-out funds to the caller’s Ethereum address. (Currently, Augur only denominates Markets in attoETH.)

This transaction will fail if:

Parameters:

Returns:

augur.api.TradingEscapeHatch.getFrozenShareValueInMarket(p)

If Augur needs to be halted by the development team (for example, if a vulnerability is discovered), calling this function on the specified Market will return the value of the user’s Shares in that Market, in the Market’s denomination token. (Currently, Augur only denominates Markets in attoETH.)

This transaction will fail if:

Parameters:

Returns:

Universe Tx API

// Universe Transaction API Examples:

// The Ethereum contract address of Augur's current default Universe 
// can be obtained by calling `augur.augurNode.getSyncData`.
var universeAddress = "0x1f732847fbbcc46ffe859f28e916d993b2b08831";

// The cost of creating a Market (in attoETH) can be obtained by calling
// the function `augur.createMarket.getMarketCreationCost` and multiplying
// the `etherRequiredToCreateMarket` value that's returned by 10^18 .
var ethCostToCreateMarket = "0x58d15e17628000"; 
// Use the Cash contract for `p._denominationToken` when creating new Markets.
var cashAddress = "0xd2ee83a8a2a904181ccfddd8292f178614062aa0";

var _extraInfo = {
  resolutionSource: "http://www.espn.com",
  tags: ["college football", "football"],
  outcomeNames: ["Georgia", "Florida"],
  longDescription: ""
};
augur.api.Universe.createCategoricalMarket({
  _endTime: "0x5bd7e550",
  _feePerEthInWei: "0x123456",
  _denominationToken: cashAddress,
  _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),
  tx: {
    to: universeAddress,
    value: ethCostToCreateMarket,
    gas: augur.constants.CREATE_CATEGORICAL_MARKET_GAS
  },
  meta: {
    accountType: "privateKey",
    address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
    signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
  },
  onSent: function (result) { console.log("onSent result:", result); },
  onSuccess: function (result) {
    console.log("onSuccess result:", result);
    // Call the function `augur.createMarket.getMarketFromCreateMarketReceipt` 
    // to retrieve new Market's address
  },
  onFailed: function (result) { console.log("onFailed result:", result); },
});

var _parentPayoutNumerators = [ "0x0", "0x2710" ];
var _parentInvalid = false;
augur.api.Universe.createChildUniverse({
  _parentPayoutNumerators: _parentPayoutNumerators,
  _parentInvalid: _parentInvalid,
  tx: { 
    to: universeAddress,
    gas: "0x632ea0" 
  }, 
  meta: {
    accountType: "privateKey",
    address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
    signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
  },
  onSent: function (result) { console.log("onSent result:", result); },
  onSuccess: function (result) { console.log("onSuccess result:", result); },
  onFailed: function (result) { console.log("onFailed result:", result); }
});

var _extraInfo = {
  resolutionSource: "https://forecast.weather.gov",
  tags: ["San Francisco", "weather"],
  longDescription: "",
  _scalarDenomination: "degrees Fahrenheit",
};
augur.api.Universe.createScalarMarket({
  _endTime: "0x5b39b150",
  _feePerEthInWei: "0x123456",
  _denominationToken: cashAddress,
  _designatedReporterAddress: "0x01114f4bda09ed6c6715cf0baf606b5bce1dc96a",
  _minPrice: "-10",
  _maxPrice: "0x78",
  _numTicks: "0xa",
  _topic: "temperature",
  _description: "High temperature (in degrees Fahrenheit) in San Francisco, California, on July 1, 2018",
  _extraInfo: JSON.stringify(_extraInfo),
  tx: {
    to: universeAddress,
    value: ethCostToCreateMarket,
    gas: augur.constants.CREATE_SCALAR_MARKET_GAS
  },
  meta: {
    accountType: "privateKey",
    address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
    signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
  },
  onSent: function (result) { console.log("onSent result:", result); },
  onSuccess: function (result) {
    console.log("onSuccess result:", result);
    // Call the function `augur.createMarket.getMarketFromCreateMarketReceipt` 
    // to retrieve new Market's address
  },
  onFailed: function (result) { console.log("onFailed result:", result); },
});

var _extraInfo = {
  resolutionSource: "https://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.createYesNoMarket({
  _endTime: "0x5c2b1e00",
  _feePerEthInWei: "0x123456",
  _denominationToken: cashAddress,
  _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),
  tx: {
    to: universeAddress,
    value: ethCostToCreateMarket,
    gas: augur.constants.CREATE_YES_NO_MARKET_GAS
  },
  meta: {
    accountType: "privateKey",
    address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
    signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
  },
  onSent: function (result) { console.log("onSent result:", result); },
  onSuccess: function (result) {
    console.log("onSuccess result:", result);
    // Call the function `augur.createMarket.getMarketFromCreateMarketReceipt` 
    // to retrieve new Market's address
  },
  onFailed: function (result) { console.log("onFailed result:", result); },
});

augur.api.Universe.getInitialReportStakeSize({ 
  tx: { 
    to: universeAddress,
    send: false
  }
}, function (error, initialReportStakeSize) { 
    console.log(initialReportStakeSize); 
});
// example output:
"349680582682291667"

augur.api.Universe.getOrCacheDesignatedReportNoShowBond({
  tx: { 
    to: universeAddress,
    send: false
  }
}, function (error, designatedReportNoShowBond) { 
    console.log(designatedReportNoShowBond); 
});
// example output:
"349680582682291667"

augur.api.Universe.getOrCacheDesignatedReportStake({
  tx: { 
    to: universeAddress,
    send: false
  }
}, function (error, designatedReportStake) { 
    console.log(designatedReportStake); 
});
// example output:
"349680582682291667"

augur.api.Universe.getOrCacheMarketCreationCost({
  tx: { 
    to: universeAddress,
    send: false
  }
}, function (error, marketCreationCost) { 
    console.log(marketCreationCost); 
});
// example output:
"19000000000000000"

augur.api.Universe.getOrCacheReportingFeeDivisor({
  tx: { 
    to: universeAddress,
    send: false
  }
}, function (error, reportingFeeDivisor) { 
    console.log(reportingFeeDivisor); 
});
// example output:
"10000"

augur.api.Universe.getOrCacheValidityBond({
  tx: { 
    to: universeAddress,
    send: false
  }
}, function (error, validityBond) { 
    console.log(validityBond); 
});
// example output:
"10000000000000000"

augur.api.Universe.getOrCreateCurrentFeeWindow({
  tx: { 
    to: universeAddress,
    send: false
  }
}, function (error, currentFeeWindowAddress) { 
    console.log(currentFeeWindowAddress); 
});
// example output:
"0x90b2a6a6c5a0e7b572cc3745328a74abbfed31d0"

var _timestamp = 1401003133;
augur.api.Universe.getOrCreateFeeWindowByTimestamp({
  _timestamp: _timestamp,
  tx: { 
    to: universeAddress,
    send: false
  }
}, function (error, feeWindowAddress) { 
    console.log(feeWindowAddress); 
});
// example output:
"0x90b2a6a6c5a0e7b572cc3745328a74abbfed31d0"

augur.api.Universe.getOrCreateNextFeeWindow({
  tx: { 
    to: universeAddress,
    send: false
  }
}, function (error, feeWindowAddress) { 
    console.log(feeWindowAddress); 
});
// example output:
"0x90b2a6a6c5a0e7b572cc3745328a74abbfed31d0"

augur.api.Universe.getOrCreatePreviousFeeWindow({
  tx: { 
    to: universeAddress,
    send: false
  }
}, function (error, feeWindowAddress) { 
    console.log(feeWindowAddress); 
});
// example output:
"0x4844c13d539fe040ded440a9f9947f14b2b4c423"

var _reportingParticipants = [ "0xd1b8f991589174315015a7a000638891ab3cd52a" ];
var _feeWindows = [ "0x59d919af0c79c2fdbb7af29627642bddbfcd2178" ];
augur.api.Universe.redeemStake({
  _reportingParticipants: _reportingParticipants,
  _feeWindows: _feeWindows,
  tx: { 
    to: universeAddress,
    gas: "0x632ea0" 
  }, 
  meta: {
    accountType: "privateKey",
    address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
    signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
  },
  onSent: function (result) { console.log("onSent result:", result); },
  onSuccess: function (result) { console.log("onSuccess result:", result); },
  onFailed: function (result) { console.log("onFailed result:", result); }
});

Provides JavaScript bindings for the Universe Solidity Contract, which allows for the creation of Markets and provides functions for obtaining information about a given Universe.

augur.api.Universe.createCategoricalMarket(p)

Creates a new Categorical Market. This transaction will trigger a MarketCreated event if the Market is created successfully. After the transaction has completed successfully, the Market address can be obtained by calling augur.createMarket.getMarketFromCreateMarketReceipt.

This transaction will fail if:

NOTE: The account attempting to create the new market must have sufficient REP in order for the market to be created. This is also true when calling eth_estimateGas, which essentially does a trial run of the transaction to determine what the gas cost would be to actually run it.

Parameters:

Returns:

augur.api.Universe.createChildUniverse(p)

Creates a new Child Universe (if it does not already exist) with the given Payout Set p._parentPayoutNumerators and p._parentInvalid. This transaction will trigger a UniverseCreated event if the Child Universe has not been created yet.

This transaction will fail if:

Parameters:

Returns:

augur.api.Universe.createScalarMarket(p)

Creates a new Scalar Market. This transaction will trigger a MarketCreated event if the Market is created successfully. After the transaction has completed successfully, the Market address can be obtained by calling augur.createMarket.getMarketFromCreateMarketReceipt.

This transaction will fail if:

NOTE: The account attempting to create the new market must have sufficient REP in order for the market to be created. This is also true when calling eth_estimateGas, which essentially does a trial run of the transaction to determine what the gas cost would be to actually run it.

Parameters:

Returns:

augur.api.Universe.createYesNoMarket(p)

Creates a new Yes/No Market. This transaction will trigger a MarketCreated event if the Market is created successfully. After the transaction has completed successfully, the Market address can be obtained by calling augur.createMarket.getMarketFromCreateMarketReceipt.

This transaction will fail if:

NOTE: The account attempting to create the new market must have sufficient REP in order for the market to be created. This is also true when calling eth_estimateGas, which essentially does a trial run of the transaction to determine what the gas cost would be to actually run it.

Parameters:

Returns:

augur.api.Universe.getInitialReportStakeSize(p, callback)

Returns either the size of the No-Show Bond or the size of the Stake placed on the Designated Report (whichever is greater).

Parameters:

Returns:

augur.api.Universe.getOrCacheDesignatedReportNoShowBond(p)

Gets the No-Show Bond for Markets in the specified Universe. If the value of the No-Show Bond for the current Fee Window has not already been cached in the Universe contract, this function will cache it.

Parameters:

Returns:

augur.api.Universe.getOrCacheDesignatedReportStake(p)

Gets the amount of Staked REP the Designated Reporter must put up when submitting a Designated Report in the Universe. If this value for the current Fee Window has not already been cached in the Universe contract, this function will cache it.

Parameters:

Returns:

augur.api.Universe.getOrCacheMarketCreationCost(p)

Gets the estimated amount of attoETH required to create a Market in the specified Universe. The amount returned by this function is equivalent to the value returned by the transaction augur.api.Universe.getOrCacheValidityBond. If the value of the Validity Bond for the current Fee Window has not already been cached in the Universe contract, this function will cache it.

Parameters:

Returns:

augur.api.Universe.getOrCacheReportingFeeDivisor(p)

Gets 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 Fee Window has not already been cached in the Universe contract, this function will cache it.

Parameters:

Returns:

augur.api.Universe.getOrCacheValidityBond(p)

Gets the amount the Market Creator must pay for the Validity Bond when creating a Market. If the Validity Bond for the current Fee 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.)

Parameters:

Returns:

augur.api.Universe.getOrCreateCurrentFeeWindow(p)

Gets the Ethereum contract address of the Fee Window that is currently active in the specified Universe. If the contract address for the Fee Window does not exist yet, this function will create it.

Parameters:

Returns:

augur.api.Universe.getOrCreateFeeWindowByTimestamp(p)

Gets the Ethereum contract address of the active Fee Window at the specified Unix timestamp in a given Universe. If the Ethereum contract address for the Fee Window does not already exist, this function will create it. This transaction will trigger a FeeWindowCreated event if the Fee Window is created without any errors.

Parameters:

Returns:

augur.api.Universe.getOrCreateNextFeeWindow(p)

Gets the Ethereum contract address of the Fee Window that will be active after the current Fee Window ends in the specified Universe. If the contract address for the Fee Window does not exist yet, this function will create it.

Parameters:

Returns:

augur.api.Universe.getOrCreatePreviousFeeWindow(p)

Gets the Ethereum contract address of the Fee Window that was active just before the current Fee Window in the specified Universe. If the contract address for the Fee Window does not exist yet, this function will create it.

Parameters:

Returns:

augur.api.Universe.redeemStake(p)

Calls the redeem function for all Ethereum contract addresses in the arrays p._reportingParticipants and p._feeWindows using the caller’s Ethereum address as the redeemer. p._reportingParticipants can contain Ethereum contract addresses for DisputeCrowdsourcers, InitialReporters, or both, as hexadecimal strings. p._feeWindows can only contain the Ethereum contract addresses of Fee Windows. This function is intended as easy way to redeem Staked REP and/or Ether in multiple Dispute Crowdsourcers, Initial Reports, and Fee Windows at once.

Parameters:

Returns:

Events API

There are a variety of “events” that are emitted by the Augur contracts. Each event is triggered by a user doing something on Augur, such as submitting an Initial Report, Finalizing a Market, Filling an Open Order, etc. For a full list, please refer to the Event Types section.

The augur.js Events API includes event listeners, which provide notifications of events that are currently happening. The functions augur.events.startAugurNodeEventListeners, augur.events.startBlockchainEventListeners, and augur.events.startBlockListeners can be used to listen for incoming events.

The function augur.events.getAllAugurLogs can be used to get an array of all Augur-related events that have been logged in the past.

Events Functions

augur.events.getAllAugurLogs({
  fromBlock: 2580310,
}, function(batchedAugurLogs) {
  console.log(batchedAugurLogs);
}, function(error) {
  if (error) {
    console.log(error);
  } else {
    console.log("Finished retrieving logs");
  }
});
// example output:
[
  {
    [0: {
      "target": "0x913da4198e6be1d5f5e4a40d0667f70c0b5430eb",
      "value": "100000000000000000000000",
      "address": "0x6e968fe21894a35ba59ee8ec6f60ea0ddc3a59e5",
      "removed": false,
      "transactionHash": "0x78d918bce994b637bac7e80711b8d46bb2aea066bac26bdaf01afc0d93d6e309",
      "transactionIndex": 0,
      "logIndex": 0,
      "blockNumber": 23,
      "blockHash": "0x803c4f62e4ee742cc2f120de4c55a2ed1528b65521afcc4d7a8d5d7693c46688",
      "contractName": "LegacyReputationToken",
      "eventName": "Mint"
      },
      ...
    ]
  }
  ...
]

// No example for `augur.events.hashEventAbi`

augur.events.startAugurNodeEventListeners({
  TokensTransferred: function(error, result){
    console.log("A new TokensTransferred event has occurred: ", result); 
  }
}, function() {
  console.log("Started Augur Node event listeners!");
});
// example output:
"Started Augur Node event listeners!"
// example output after a TokensTransferred event occurs:
"A new TokensTransferred event has occurred:"
{
  "transactionHash": "0xbcb517796168347d92ef9448c8aec6f3112dfd5a41ebd9de0c097927cb01ca6b",
  "logIndex": 1,
  "sender": "0x8fa56abe36d8dc76cf85fecb6a3026733e0a12ac",
  "recipient": "0x40485264986740c8fb3d11e814bd94cf86012d29",
  "token": "0x13fa2334966b3cb6263ed56148323014c2ece753",
  "value": "0.001",
  "blockNumber": 1600771
}

augur.events.startBlockchainEventListeners(
  {
    Augur: ["TokensTransferred"],
  }, 
  3414977, 
  function(blockHash, logsAdded) {
    console.log("Logs added");
    console.log(logsAdded);
  },
  function(blockHash, logsRemoved) {
    console.log("Logs removed");
    console.log(logsRemoved);
  }
);
// example output: 
"Starting blockstream at block  3414977"
"Logs added"
[
  {
    "topic": "SPORTS",
    "description": "Will the Golden State Warriors win the 2019 NBA Championship?",
    "extraInfo": {
      "longDescription": "",
      "resolutionSource": "",
      "tags": []
    },
    "universe": "0x02149d40d255fceac54a3ee3899807b0539bad60",
    "market": "0x54776758502ea895b588ceb1312267d688307445",
    "marketCreator": "0xc789597aa0f2c986a5b7313abacd5c37c8d00a56",
    "marketCreationFee": "0.01",
    "minPrice": "0",
    "maxPrice": "1",
    "marketType": "0",
    "address": "0x990b2d2af7e87cd015a607c3a95d7622c9bbede1",
    "removed": false,
    "transactionHash": "0x533f031c7ac6c344664ef4f1b64d0d2d1bfd59a5edf474434362d8229ebd14dd",
    "transactionIndex": 6,
    "logIndex": 18,
    "blockNumber": 3414977,
    "blockHash": "0xe192a15519d000c76956bde5178c5ab4172af151de1f4893453b65b6bc706521",
    "contractName": "Augur",
    "eventName": "MarketCreated"
  }
]

augur.events.startBlockListeners({
  onAdded: function(block) {
    console.log("New block added!", block);
  }, 
  onRemoved: function(block) {
    console.log("Block removed!", block);
  }
});
// example output:
"true"
// example output after a block is added to the Ethereum blockchain:
"New block added!"
{
  "difficulty": "0x2",
  "extraData": "0xd783010703846765746887676f312e392e32856c696e75780000000000000000e76b9e0b0711c73221a771804a8c61f01d1ebf0cf6c8bafb17f93e671d38944422c9d3503d5e9ea9763907af5dd1064256b5bdb320f9c5247708a486dfd4292b01",
  "gasLimit": "0x6a9bc4",
  "gasUsed": "0x337bf",
  "hash": "0xaae5645ad53b51f85c55971ffcbfad7c5e44a940794fac1fab6fd93560c5055b",
  "logsBloom": "0x00000000040000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000020000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000011000000000000000000000",
  "miner": "0x0000000000000000000000000000000000000000",
  "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
  "nonce": "0x0000000000000000",
  "number": "0x1877a7",
  "parentHash": "0xcb656990d8b7993183bed724f1af4b74d8a5e9ab1e6f7abdb3e5209504272cd2",
  "receiptsRoot": "0x4a0b60d86057241ca030d4ebe75df43ca7857ad30a542c21db8876fa7f6c836b",
  "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
  "size": "0x5b4",
  "stateRoot": "0xd13fadf3b2edc48c2597900aa0bda6a97d17f4e907161eb061e34821b6067af0",
  "timestamp": "0x5a5e3023",
  "totalDifficulty": "0x2d6a4a",
  "transactions": [
    "0xce2fa17a608bfad0f1520e307b16f4bffbe1d8b6ec399fc5af7f8b6ab3327e1d",
    "0xcd54f9e1335e723448690876794664f21a270984f0f34153e891577df181c3d9",
    "0x776fbb3f73dee8f40361b06f642406909551d67e146d3e80ffe5a6fdf6f087a9",
    "0xc2efc2f39bf738cfbbf00f7d6ee89ecb6edaac2d0e0c1ae6a495786daf68b168",
    "0x422095f55a36c1f752328a82873a5724fde7c29b49b545a27762037303cac71f",
    "0x439b923062e2d23aa672a09ff221afdb81b6d0622fc29981ee742702a3157524"
  ],
  "transactionsRoot": "0x1b1b70c302dc90d27075af34bfb4bd42bb505822570b5f8131cfcc8cf0368396",
  "uncles": []
}

augur.events.stopAugurNodeEventListeners(
  function() {
    console.log("Stopped Augur Node event listeners!");
  }
);
// example output:
"Unsubscribed from 1e08901c-0797-49f2-b13f-e688e5695905"
"Stopped Augur Node event listeners!"

augur.events.stopBlockchainEventListeners();
// example output: 
"true"

augur.events.stopBlockListeners();
// example output:
"true"

augur.events.getAllAugurLogs(p, batchCallback, finalCallback)

Returns all Augur event logs on the Ethereum blockchain within a certain block range, sorted by blockNumber and logIndex. These logs get returned in groups, or batches.

Note: Depending on how many event logs there are to be retrieved, this function can take a long time to complete.

Parameters:

Returns:

augur.events.hashEventAbi(eventAbi)

Generates a set of JavaScript bindings for the Solidity ABI passed in.

Parameters:

Returns:

(string) 32-byte hexadecimal hash of the eventAbi.

augur.events.startAugurNodeEventListeners(eventCallbacks, onSetupComplete)

Begins listening for events emitted by an Augur Node.

Parameters:

augur.events.startBlockchainEventListeners(eventCallbacks, startingBlockNumber, onSetupComplete)

Begins listening for events emitted by the Ethereum blockchain.

Parameters:

augur.events.startBlockListeners()

Start listening for blocks being added/removed from the Ethereum blockchain.

Parameters:

Returns:

augur.events.stopAugurNodeEventListeners(callback)

Removes all active listeners for events emitted by Augur Node.

Parameters:

augur.events.stopBlockchainEventListeners()

Removes all active listeners for events emitted by the Ethereum blockchain.

Returns:

augur.events.stopBlockListeners()

Stop listening for blocks and block removals.

Returns:

Event Types

The following table shows the different types of events that Augur’s smart contracts log to the Ethereum blockchain. In this table, the Contract field refers to the Solidity contract in which the event is defined (source code / contract addresses), and and the Data (indexed) field describes which event fields are indexed on the Ethereum blockchain.

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 value amount of target’s tokens have been burned (i.e., completely destroyed). target value
CompleteSetsPurchased Augur The Ethereum address account purchased numCompleteSets in market of universe. universe, market, account numCompleteSets
CompleteSetsSold Augur The Ethereum address account sold numCompleteSets in market of universe. universe, market, account numCompleteSets
DisputeCrowdsourcerCompleted Augur The Ethereum contract address disputeCrowdsourcer for market in universe filled the Dispute Bond required to Challenge market’s Tentative Outcome. universe, market disputeCrowdsourcer
DisputeCrowdsourcerContribution Augur The Ethereum address reporter Staked amountStaked REP on the Outcome for disputeCrowdsourcer in market of universe. universe, reporter, market disputeCrowdsourcer, amountStaked
DisputeCrowdsourcerCreated Augur The Ethereum contract address disputeCrowdsourcer with Payout Set payoutNumerators and Dispute Bond size size was created in market of universe. universe, market disputeCrowdsourcer, payoutNumerators, size
DisputeCrowdsourcerRedeemed Augur reporter redeemed amountRedeemed REP and received repReceived additional REP, plus reportingFeesReceived attoETH, from disputeCrowdsourcer (with payoutNumerators) in market of universe. universe, reporter, market disputeCrowdsourcer, amountRedeemed, repReceived, reportingFeesReceived, payoutNumerators
EscapeHatchChanged Augur In the event that the Augur development team must halt Augur, normal functionality will be suspended, and users will be able to withdraw any ETH/REP funds they have in Augur throught the TradingEscapeHatch contract. Once the system is no longer halted, regular functionality will resume, and the TradingEscapeHatch contract’s functionality will be disabled. Whenever the TradingEscapeHatch is toggled, the EscapeHatchChanged event will be logged, with the isOn parameter representing whether it is enabled or disabled. isOn
FeeWindowCreated Augur The Ethereum contract address feeWindow has created a new Fee Window (with ID id and running from startTime to endTime) in universe. universe feeWindow, startTime, endTime, id
FeeWindowRedeemed Augur reporter redeemed amountRedeemed REP and received reportingFeesReceived attoETH from feeWindow in market of universe. universe, reporter, feeWindow amountRedeemed, reportingFeesReceived
InitialReporterRedeemed Augur reporter redeemed amountRedeemed REP and received repReceived additional REP, plus reportingFeesReceived attoETH, from market of universe. universe, reporter, market amountRedeemed, repReceived, reportingFeesReceived, payoutNumerators
InitialReportSubmitted Augur reporter has submitted an Initial Report for the market in universe with amountStaked REP staked on the Outcome payoutNumerators. If reporter is the Designated Reporter (as opposed to the First Public Reporter), isDesignatedReporter is set to true. universe, reporter, market amountStaked, isDesignatedReporter, payoutNumerators
InitialReporterTransferred Augur Ownership of an InitialReporter contract was transferred between Ethereum addresses from and to for market in universe. universe, market from, to
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
MarketMigrated Augur market was migrated from originalUniverse to newUniverse. market, originalUniverse, newUniverse
MarketMailboxTransferred Augur Ownership of Market Creator Mailbox mailbox for market in universe was transferred from from address to to address. universe, market, mailbox from, to
MarketParticipantsDisavowed Augur The DisputeCrowdsourcers belonging to market in universe has been disavowed. universe, market
MarketTransferred Augur Ownership of market in universe was transferred from from address to to address. universe, market from, to
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 attoETH 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 attoETH, and filler put up numFillerShares or numFillerTokens in attoETH. amountFilled Share Units were filled, and 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, amountFilled, tradeGroupId
ReportingParticipantDisavowed Augur The reportingParticipant (can be either a DisputeCrowdsourcer or an InitialReporter) belonging to market in universe has had its fork (or forkAndRedeem) function called on it. universe, market reportingParticipant
TimestampSet Augur The timestamp used by Augur was set/updated to newTimestamp. This event will be logged whenever TimeControlled.setTimestamp or TimeControlled.incrementTimestamp is called by the owner of the TimeControlled contract. newTimestamp
TokensBurned Augur Burned (i.e., completely destroyed) amount of target’s attotokens in market (if applicable) of universe. The destroyed tokens were of type tokenType, whose contract address is token. (Token types are as follows: ReputationToken = 0, ShareToken = 1, DisputeCrowdsourcer = 2, FeeWindow = 3, FeeToken = 4. FeeWindow tokens are Participation Tokens. FeeTokens are only used internally for accounting purposes so that Stake holders can get Fees for every Fee Window in which they have Stake.) universe, token, target amount, tokenType, market
TokensMinted Augur Created amount brand new attotokens for target in market (if applicable) of universe . The minted tokens are of type tokenType, whose contract address is token. (Token types are as follows: ReputationToken = 0, ShareToken = 1, DisputeCrowdsourcer = 2, FeeWindow = 3, FeeToken = 4. FeeWindow tokens are Participation Tokens. FeeTokens are only used internally for accounting purposes so that Stake holders can get Fees for every Fee Window in which they have Stake.) universe, token, target amount, tokenType, market
TokensTransferred Augur value amount of the tokens in market (if applicable) of universe have been transferred between account from and to. The transferred tokens are of type tokenType, whose contract address is token. (Token types are as follows: ReputationToken = 0, ShareToken = 1, DisputeCrowdsourcer = 2, FeeWindow = 3, FeeToken = 4. FeeWindow tokens are Participation Tokens. FeeTokens are only used internally for accounting purposes so that Stake holders can get Fees for every Fee Window in which they have Stake.) universe, token, from to, value, tokenType, market
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 attotokens between accounts from and to. from, to value
UniverseCreated Augur childUniverse has been created from parentUniverse where payoutNumerators and invalid represent the Payout Set of the Forking Market in parentUniverse and whether it was determined to be an Invalid Market. parentUniverse, childUniverse payoutNumerators, invalid
UniverseForked Augur A Market in universe has had its Tentative Outcome Challenged with a Dispute Bond greater than the Fork Threshold, which has caused universe to Fork. universe

API Type Definitions

augur.js’ functions accept and return a variety of different objects, which are described below.

AccountTransfer (Object)

Properties:

AggregatedTradingPosition (Object)

Properties:

AugurEventLog (Object)

Note: Other properties will be present in this object, depending on what event type it is. For a list of which values are logged for which events, refer to the Event Types section.

Properties:

BetterWorseOrders (Object)

Properties:

Category (Object)

Properties:

ClaimReportingFeesForkedMarket (Object)

ClaimReportingFeesForkedMarketGasEstimates (Object)

Properties:

ClaimReportingFeesForkedMarketResponse (Object)

Properties:

ClaimReportingFeesNonforkedMarket (Object)

ClaimReportingFeesNonforkedMarketsGasEstimates (Object)

Properties:

ClaimReportingFeesNonforkedMarketsResponse (Object)

Properties:

ConnectOptions (Object)

Properties:

CrowdsourcerState (Object)

DISPUTE_TOKEN_STATE (Object)

Serves as an enum for the state of a Dispute Token.

Properties:

DisputeToken (Object)

Properties:

EthereumNode (Object)

Properties:

ExtraInfo (Object)

Properties:

FailedTransactionsForkedMarket (Object)

Properties:

FailedTransactionsNonforkedMarkets (Object)

Properties:

FeeWindowCurrent (Object)

Properties:

FrozenFunds (Object)

Properties:

GasEstimateInfo (Object)

Properties:

GasEstimatesForkedMarketTotals (Object)

Properties:

GasEstimatesNonforkedMarketsTotals (Object)

Properties:

GetReportingFeesForkedMarket (Object)

GetReportingFeesInfo (Object)

Properties:

GetReportingFeesNonforkedMarket (Object)

GetReportingFeesTotal (Object)

Properties:

InitialReporter (Object)

Properties:

InitialReporterState (Object)

MarketCreatorFee (Object)

Properties:

MarketCreationCost (Object)

Properties:

MarketCreationCostBreakdown (Object)

Properties:

MarketInfo (Object)

Properties:

MarketPriceTimeSeries (Object)

Properties:

MarketTradingPosition (Object)

Properties:

Meta (Object)

Authentication metadata for raw transactions.

Properties:

NoKeystoreAccount (Object)

Properties:

NormalizedPayout (Object)

Properties:

Order (Object)

Properties:

ORDER_STATE (Object)

Serves as an enum for the state of an order.

Properties:

OutcomeInfo (Object)

Properties:

ProfitLoss (Object)

Properties:

Report (Object)

Properties:

ReportingParticipant (Object)

Properties:

REPORTING_STATE (Object)

Serves as an enum for the state of a Market.

Properties:

SimulatedTrade (Object)

Properties:

SingleSideOrderBook (Object)

Properties:

SingleOutcomePriceTimeSeries (Object)

Properties:

StakeDetails (Object)

Properties:

StakeInfo (Object)

Properties:

SuccessfulTransactionsForkedMarket (Object)

Properties:

SuccessfulTransactionsNonforkedMarkets (Object)

Properties:

SyncData (Object)

Properties:

SyncDataBlock (Object)

Properties:

Tag (Object)

Properties:

TimestampedPrice (Object)

Properties:

TradeCost (Object)

Properties:

TradingPosition (Object)

Properties:

UnclaimedFeeWindowInfo (Object)

Properties:

UserTrade (Object)

Properties:

UserTradePosition (Object)

Properties:

WebSocket (Object)

Properties:

WsTransport (Object)

Properties:

API Constants

augur.js contains a number of constants in the augur.constants object, which are listed below.

augur.constants.AUGUR_UPLOAD_BLOCK_NUMBER (string)

Ethereum block number from which to start looking up event logs.

augur.constants.BLOCKS_PER_CHUNK (number)

Number of block to read from the blockchain at a time. Set to 1/8 day’s worth (i.e., seconds * minutes * hours / blocks_per_second / 8, or 60 * 60 * 24 / 15 / 8). Used by augur.events.getAllAugurLogs.

augur.constants.CANCEL_ORDER_GAS (string)

Gas limit used when canceling an Order on the Order Book.

augur.constants.CONTRACT_INTERVAL (Object)

Object that acts as an enum containing the following values:

augur.constants.CONTRACT_TYPE (Object)

Object that acts as an enum for different types of smart contracts.

augur.constants.DEFAULT_CONNECTION_TIMEOUT (number)

Default connection timeout Augur uses when connecting to an Ethereum node, in milliseconds.

augur.constants.DEFAULT_GASPRICE (number)

Default gas price Augur uses when making transactions.

augur.constants.DEFAULT_MAX_GAS (string)

Default maximum gas limit Augur uses when making transactions, as a hexadecimal string.

augur.constants.DEFAULT_NETWORK_ID (string)

Default Ethereum network to connect to.

augur.constants.DEFAULT_NUM_TICKS (Object)

Object containing the default number of Ticks used when creating a new Categorical Market, keyed by number of Outcomes the Market has.

augur.constants.DEFAULT_SCALAR_TICK_SIZE (string)

Tick size that is used when creating a Scalar Market if one is not specified.

augur.constants.ETERNAL_APPROVAL_VALUE (string)

Used when calling the approve function for Cash, which is an ERC-20 wrapper for ETH that Augur uses internally. It is equal to 2^256 - 1, which is the maximum amount of Cash that can be approved for Augur to spend on behalf of a particular account.

augur.constants.GET_LOGS_DEFAULT_FROM_BLOCK (string)

Block number at which Augur Node will begin scanning for logged events emitted from Augur’s smart contracts.

augur.constants.GET_LOGS_DEFAULT_TO_BLOCK (string)

Block number up to which Augur Node will scan for logged events emitted from Augur’s smart contracts.

augur.constants.MAX_GAS_LIMIT_FOR_TRADE

Maximum gas limit used when calling augur.trading.tradeUntilAmountIsZero.

augur.constants.MAX_FILLS_PER_TX (BigNumber)

Maximum number of Orders that augur.trading.tradeUntilAmountIsZero will attempt to fill in a single transaction.

augur.constants.MAX_LOG_BYTES_PER_BLOCK (number)

Used to calculate how large a WebSocket frame to allow. This is a theoretical limit based on a block being completely filled with Transfer transactions.

augur.constants.MAX_WEBSOCKET_FRAME_SIZE (number)

Uses augur.constants.MAX_LOG_BYTES_PER_BLOCK to calculate the maximum WebSocket frame size. Comes out to under 0.25GB (in the most extreme case) but prevents errors from being thrown.

augur.constants.MINIMUM_TRADE_SIZE (BigNumber)

Minimum number of Share Units that can be bought/sold in a trade.

augur.constants.ONE (BigNumber)

A BigNumber with the value of 1.

augur.constants.ORDER_STATE (Object)

Object that acts as an enum containing the constants used to represent each of the states an Order can be in.

augur.constants.PARALLEL_LIMIT (number)

Maximum number of transactions to auto-submit in parallel.

augur.constants.PLACE_ORDER_NO_SHARES (Object)

Object containing the gas cost for placing an Order that does not escrow shares, keyed by the number of Outcomes for the Market. Used by augur.trading.tradeUntilAmountIsZero.

augur.constants.PLACE_ORDER_WITH_SHARES (Object)

Object containing the gas cost for placing an Order that escrows shares, keyed by the number of Outcomes for the Market. Used by augur.trading.tradeUntilAmountIsZero.

augur.constants.PRECISION (Object)

Object that acts as an enum for different types of precision using BigNumbers.

augur.constants.REPORTING_STATE (Object)

Object that acts as an enum containing the constants used to represent each of the Reporting states a Market can be in.

augur.constants.STAKE_TOKEN_STATE (Object)

Object that acts as an enum for all of the possible states for a Stake Token (typically referred to as a Dispute Token).

augur.constants.SUBSCRIPTION_EVENT_NAMES (Object)

Object that acts as an enum for all of the events emitted by Augur Node.

augur.constants.TRADE_GAS (string)

Gas limit used when calling augur.trading.tradeUntilAmountIsZero.

augur.constants.TRADE_GAS_BUFFER (BigNumber)

Buffer used by augur.trading.tradeUntilAmountIsZero when estimating gas for filling orders. This is used to account for the fluctuation in the cost of fills.

augur.constants.TRADE_GROUP_ID_NUM_BYTES (number)

Number of bytes that comprise a trade group ID. (Trade group IDs are used by Augur’s UI to uniquely identify a trade.)

augur.constants.WORST_CASE_FILL (Object)

Object containing constants used by augur.trading.tradeUntilAmountIsZero to calculate the gas limit for placing trades, keyed by the number of Outcomes of the Market.

augur.constants.ZERO (BigNumber)

A BigNumber with the value of 0.

Tests

The Augur UI 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-ui

augur-ui has a suite of unit tests that can be run using npm or yarn. To run these tests, first make sure you have installed the dependencies by using the following command:

$ npm install

or if you are using yarn:

$ yarn

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

$ npm test

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

$ yarn test

Additionally, the augur-ui code has a series of integration tests. Before running these, the dependencies must be installed (as described above), and a local Ethereum node and Augur Node must be running. To quickly start up a Geth Ethereum node and Augur Node using Docker, run the following command:

npm run docker:spin-up

or

yarn docker:spin-up

Then, in a seperate terminal window, start up the Augur UI with the --auto-login option by running:

npm run dev --auto-login

or

yarn dev --auto-login

After that, the integration tests can be started in another termial window by running:

$ npm run integration

to run all tests. To run a specific integration test, such as create-market.test.ts, execute the command:

$ npm run integration create-market.test.ts

To do this in yarn, it’s:

$ yarn integration

and

$ yarn integration create-market.test.ts

The augur-ui repository also follows 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

Numbers

Mathematical operations, such as addition, multiplication, greater-than/less-than comparisions, etc., should only ever be performed within the UI using the BigNumber data type.

When outputting decimal numbers to the UI, the following rules should be adhered to:

  1. By default, 4 decimal places should be shown.
  2. Scientific notation should never be shown.
  3. If the number can be rounded to a number that’s visible in the 4 decimal places, it should be (e.g., 0.000998 should be rounded to 0.0010).
  4. If a number, when rounded, results in nothing being shown in the first 4 decimals, it should be displayed to the first two significant digits. Anything smaller than 0.00005 should be treated this way. Significant digits include all non-zero digits, and any zeroes that are between two non-zero digits. For example:
    • 0.00000101 should be displayed as 0.0000010.
    • 0.000034052400 should be displayed as 0.000034.
    • 0.00000021034 should be displayed as 0.00000021.
  5. At most, only 8 decimals should ever be displayed. Any number not containing significant digits in the first 8 decimals should just be displayed as 0.0000.

Dates/Timestamps

In general, the current timestamp should only ever be obtained using the value blockchain.currentAugurTimestamp (as opposed to calling the JavaScript function Date.now). This value can be obtained using the selectors getCurrentTimestampInSeconds (which returns the timestamp of the latest block on the Ethereum blockchain) or getCurrentTimestamp (which returns the same timestamp, in milliseconds). This means that Date.now() should not be used, and moment() and new Date() should not be used for getting the current timestamp.

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:

Running Tests

To execute a specific UI test, run:

npm run test <path_to_test>

Fixing Linting Errors

To fix many of the low-hanging-fruit linting errors, run:

npm run lint --fix

CSS Units

When deciding whether to use rem or em, it is helpful to ask, “In relation to what element should this size be derived?”

If it is local to that element or it’s siblings, then it’s most likely em. If it doesn’t matter or is relative to the view/general layout, then it’s most likely rem. It’s highly contextual as to when/how to apply, but if a component’s layout can scale based on root font size, then rem is fine. However, if the layout needs to scale in relation to itself or its peers, it is probably better leverage em.

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, 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.

Cash

Cash is an ERC-20 token that is used within Augur’s Solidity smart contracts and acts as a wrapper for ETH to facilitate some of Augur’s functionality. Users do not interact directly with Cash tokens in Augur.

Categorical Market

A Categorical Market is a Market with more than 2 potential Outcomes, but no more than 8. As with all Markets, Invalid is also a potential Outcome, but it does not count toward the 8-Outcome maximum. Categorical Markets are best for multiple choice questions, such as “Which team will win Tournament X?” or “What color tie will the U.S. President wear at the next presidential press conference?”. If a Market is based around a simple yes-or-no question, it is better to use a Yes/No Market. For a Market about what a particular stock price will be on a given date, a Scalar Market should be used, as 8 potential outcomes would not be sufficient.

Challenge

Challenge is used to describe the act of a REP holder Staking REP on a Market Outcome other than the Tentative Outcome for that Market. This REP is sent to a Crowdsourcer and goes toward filling a Dispute Bond for that Outcome in order to Dispute or “challenge” the Tentative Outcome of a Market before it is Finalized. If the Dispute Bond is successfully filled, and that Outcome becomes the Final Outcome for the Market, the users who Staked REP on that Outcome can get back 1.5x the amount of REP they originally Staked, once the Market is Finalized. If the Dispute Bond is successfully filled, but that Outcome does not become the Final Outcome for the Market, the users who Staked REP on that Outcome will forfeit all of the REP they Staked. If the Dispute Bond is not successfully filled, the users who Staked on that Outcome can redeem their REP once the Fee Window has elapsed.

Child Universe

A Child Universe is a Universe created after a Market Forks. Child Universes have a Parent Universe, which is the Universe where the Forked Market resides. Locked Universes always have Child Universes because the Forking process causes the Universe containing the Forked Market to become Locked and creates the Child Universes.

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. Therefore, users who get a larger payout from Settlement also pay a larger portion of the fees. The Settlement Fees extracted from Share Settlement go toward paying for the Reporting system, in the form of a Reporting Fee, and paying the Market Creator their set Creator Fee.

Creator Fee

A Creator Fee is a percentage fee, in ETH, that is collected by the Market Creator whenever Shares are Settled. It is set by the Market Creator when he or she creates a new Market. The Creator Fee must be between 0% and 50%, and it cannot be changed once it has been set. 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.

Crowdsourcer

Each Outcome of a Market has its own Crowdsourcer, which is a Solidity smart contract that keeps track of how much REP has been Staked on a particular Outcome during a given Fee Window. If users Stake enough REP on that Outcome to fill the Dispute Bond and Challenge the Tentative Outcome, that Outcome will become the new Tentative Outcome (and the Market will go through another Dispute Round), or the Market will Fork (if a Dispute Bond greater than the Fork Threshold is filled). If the Dispute Bond is successfully filled, and that Outcome becomes the Final Outcome for the Market, the users who Staked REP on that Outcome can get back 1.5x the amount of REP they originally Staked, once the Market is Finalized. If the Dispute Bond is successfully filled, but that Outcome does not become the Final Outcome for the Market, the users who Staked REP on that Outcome will forfeit all of the REP they Staked. If the Dispute Bond is not successfully filled, the users who Staked on that Outcome can redeem their REP once the Fee Window has elapsed.

Decentralized Oracle

The heart of Augur is its Decentralized Oracle, which allows users and smart contracts to propose questions to Augur and discover accurate information about the real world (based on how REP holders have voted on Market Outcomes) without having to trust a single person, AI, or organization. Augur’s Oracle allows information to be migrated from the real world to a blockchain without relying on a centralized, trusted third party.

Designated Report

A Designated Report occurs when a Designated Reporter Stakes REP on a particular Outcome in a Market. This Outcome then becomes the Tentative Outcome for the Market, and the Market changes to the Waiting for the Next Fee Window to Begin Phase.

Designated Reporter

A Designated Reporter is a single Ethereum address designated to submit the Tentative Outcome for a Market during the Designated Reporting Phase. The Designated Reporter is set by the Market Creator during Market creation. All Markets must have a Designated Reporter.

Designated Reporter Stake

When a Designated Reporter submits a Report, they must put up an amount of REP on an Outcome that is equal to the Designated Reporter Stake. Note that this amount is calculated differently than the No-Show Bond.

During the very first Fee Window after launch, the amount of the Designated Reporter Stake will be set at 0.35 REP. The amount of the Designated Reporter Stake is dynamically adjusted according to how many Designated Reports were incorrect (failed to concur with the Market’s Final Outcome) during the previous Fee Window. In particular, we let δ be the proportion of Designated Reports that were incorrect during the previous Fee Window, and we let bd be the amount of the Designated Reporter Stake during the previous Fee Window, then the amount of the Designated Reporter Stake for the current Fee Window is max {0.35, bdf(δ)}.

Designated Reporting

Designated Reporting is the first and fastest way that a Market can be Reported on. One Ethereum address will be responsible for submitting a Tentative Outcome for the Market and will have 3 days to do so after a Market’s End Time, known as the Designated Reporting Phase.

Designated Reporting Phase

The Designated Reporting Phase lasts up to three (3) days and begins immediately following the End Time of a Market. During this time, the Designated Reporter is expected to Report a Tentative Outcome for the Market. When the Designated Reporter submits a Report, the Market will enter the Waiting for the Next Fee Window to Begin Phase. If the Designated Reporter fails to Report on the Market within the Designated Reporting Phase, then the Market goes to the Open Reporting Phase. When this happens, the Market Creator does not get refunded the No-Show Bond. Instead, the No-Show Bond goes toward covering the Stake of the First Public Reporter when they submit the First Public Report.

Developer Mode

During Augur’s early stages, its Solidity smart contracts will allow for some special “developer mode” functionality. This functionality has been added as a security precaution in case an attacker attempts to compromise Augur’s Decentralized Oracle system. If a security exploit is found, the Augur development team can halt Augur, which will stop all normal functionality, such as trading, reporting, and disputing, and allow users to withdraw their REP and ETH from any Market.

Eventually, once Augur has been thoroughly tested and the Augur development team is confident that it is secure, this functionality will be removed so that it is not available to anyone (including the Augur development team).

Dispute

Disputing is synonymous with the act of Challenging a Tenative Outcome.

Dispute Bond

When a Market is in the Dispute Round Phase, users may Stake REP on an Outcome other than the Tentative Outcome if they believe the Tentative Outcome is incorrect. Doing so contributes to a Dispute Bond for that Outcome. Each Outcome other than the Tentative Outcome has its own Dispute Bond that can be filled. Dispute Bonds need not be paid in their entirety by a single user. Augur allows participants to Crowdsource the Dispute Bonds. Any user who sees an incorrect Tentative Outcome can dispute that Outcome by Staking some REP on an Outcome other than the Tentative Outcome. If, collectively, some Outcome (other than the Tentative Outcome) receives enough Dispute Stake to fill its Dispute Bond, the current Tentative Outcome will be successfully Challenged. For information about how Dispute Stake gets returned to users, refer to the Dispute Stake glossary entry.

The amount of REP required to fill a Dispute Bond is calculated as follows.

Let An denote the total Stake over all of this Market’s Outcomes at the beginning of Dispute Round n. Let ω be any Market Outcome other than the Market’s Tentative Outcome at the beginning of this Dispute Round. Let S(ω, n) denote the total amount of Stake on Outcome ω at the beginning of dispute n. Then the size of the Dispute Bond needed to successfully Dispute the current Tentative Outcome in favor of the new Outcome ω during round n is denoted B(ω,n) and is given by:

B(ω,n)=2An-3S(ω,n)

The Dispute Bond sizes are chosen this way to ensure a fixed ROI of 50% for Reporters who successfully Dispute false outcomes.

Dispute Round

A Dispute Round is one 7-day round out of a maximum of 20 such rounds that can occur during the Dispute Round Phase and before a Fork occurs in a Market. During a Dispute Round, REP holders who do not agree that the Market’s Tentative Outcome is accurate can Stake REP on a different Outcome in an attempt to Challenge it. If the Challenge is successful, the Tentative Outcome will be changed to the Outcome that was Staked on, or the Market will Fork if a Dispute Bond greater than the Fork Threshold is filled.

Dispute Round Phase

The Dispute Round Phase is a seven (7) day window after a Market has been Reported on. During the Dispute Round Phase, REP holders who do not agree that the Market’s Tentative Outcome is accurate can Stake REP on a different Outcome in an attempt to Challenge it. If the Challenge is successful, the Tentative Outcome will be changed to the Outcome that was Staked on, or the Market will Fork if a Dispute Bond greater than the Fork Threshold is filled. With each Dispute Round that successfully Challenges the Tentative Outcome, the next Dispute Round will require an even higher Dispute Bond to Challenge the Tentative Outcome. For details on how the Dispute Bond is calculated, refer to the the Dispute Bond glossary entry.

Dispute Stake

When a Market is in the Dispute Round Phase, users can put up REP on any Outcome other than the Tenative Outcome. The amount of REP they put up goes toward filling the crowdsourced Dispute Bond, and can range from 1 attoREP to the amount still needed to fill the Dispute Bond.

All unsuccesful Dispute Stake is returned to the original owners at the end of every Dispute Round. All successful Dispute Stake is applied to the Outcome it championed, and will remain there until the Market is Finalized (or until a Fork occurs in some other Augur Market). Once the Market is Finalized, all users who Staked on the Final Outcome during a Dispute Round will receive 1.5x the amount of REP they originally Staked. REP holders who staked on an Outcome other than the Final Outcome forfeit their REP. All Dispute Stake (whether successful or unsuccessful) will receive a portion of the Reporting Fee Pool from the current Fee Window in ETH. (This ETH comes from trading and winning Share redemption: fees are collected in ETH whenever a Complete Set is sold or winning Shares are redeemed and given to Fee Windows.)

By design, the Dispute Bond sizes for each Dispute Round are chosen such that anyone who successfully Challenges an Outcome in favor of the Market’s Final Outcome is rewarded with a 50% ROI on their Dispute Stake. For details on how the Dispute Bond is calculated, refer to the Dispute Bond glossary entry.

Dispute Token

When a user Stakes REP in a Crowdsourcer, that Crowdsourcer will allocate an equal amount of Dispute Tokens to that user. Then, when the Crowdsourcer’s Market is Finalized, these Dispute Tokens are used by Augur’s smart contracts to determine the payout that user should receive. Dispute Tokens are only used internally by Augur, and users do not interact with them directly; however, they are implemented as ERC-20 tokens, so they potentially can be traded between users. (For example, a user might want to sell their Dispute Tokens to another user at a discounted price if a Market is being Disputed for a long time and the user wishes to cash out their Dispute Tokens before the Market is Finalized.)

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 eventually Finalized.

Fee Token

Fee Tokens are not tokens that users interact with directly; however, they are used internally by Augur’s Solidity smart contracts to allow users to redeem REP Staked either in a First Public Report or in a Crowdsourcer. When a First Public Reporter submits a First Public Report in a given Fee Window, Augur creates an amount of Fee Tokens equal to the amount of REP they Staked and associates those Fee Tokens with the Ethereum address of the First Public Reporter. Similarly, when a user Stakes REP in a Crowdsourcer to Challenge a Tentative Outcome, Augur creates an amount of Fee Tokens equal to the amount of REP they Staked and associates those Fee Tokens with the Ethereum address of that user. Once the Fee Window is over, and a user redeems their Staked REP, Augur uses the amount of Fee Tokens associated their Ethereum address to determine what proportion of the Fee Window’s Reporting Fees (in ETH) to distribute to them.

Fee Window

Augur’s Reporting system runs on a cycle of consecutive 7-day long Fee Windows. Any fees collected by Augur during a given Fee Window are added to a Reporting Fee Pool for that Fee Window. The Reporting Fee Pool is used to reward REP holders who participate in Augur’s Reporting process. REP holders who Stake REP during a given Fee Window will receive an amount of fees from the Reporting Fee Pool that is proportionate to the amount of REP they Staked. In this way, all REP holders who participate during a Fee Window will receive a portion of the fees collected during that Window. Participation includes Designated or Open Reporting, Disputing an Outcome, or simply purchasing Participation Tokens directly.

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 Tentative Outcome that is not Challenged through a Dispute Round Phase or is determined through a Fork. At this point, the Market becomes Finalized and moves to the Finalized Phase. A Market’s Final Outcome cannot be challenged or changed.

Finalized Market

A Finalized Market is a Market that has not had its Tentative Outcome Challenged through a Dispute Round Phase, or has gone through the Fork Phase. Its Tentative Outcome is now considered final, and the Market will allow Share holders to Settle their Shares with the Market once the Post-Finalization Waiting Period has elapsed.

Finalized Phase

This is the last phase a Market can be in, and it occurs once the Market has been Finalized.

First Public Report

When a Market’s Designated Reporter fails to submit a Designated Report, the Market moves to the Open Reporting Phase. When this happens, the No-Show Bond put up by the Market Creator can be used by any user to Stake REP on a Tentative Outcome. This Report is called the First Public Report. The First Public Reporter must pay the gas cost of submitting the First Public Reporter.

First Public Reporter

The First Public Reporter is any user who Stakes REP on a Tentative Outcome during the Open Reporting Phase.

First Public Reporter Stake

When a Market’s Designated Reporter fails to submit a Designated Report, and the First Public Reporter submits a Report instead, the No-Show Bond gets used to Stake on a Tentative Outcome. If that Tentative Outcome becomes the Final Outcome, the First Public Reporter will receive the No-Show Bond back.

Fork

A Fork occurs if the Tentative Outcome for a Market is Challenged with a Dispute Bond greater than the Fork Threshold. A Fork causes Augur to create multiple new Universes. Each new Universe is empty except for the Forked Market; they contain no markets or REP tokens. There will be a Universe created for each possible Outcome of the Market, including the Invalid Outcome, 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. In the event of a Fork, all non-Forked Markets in each Child Universe will have their Tentative Outcome reset to the Outcome that was reported by the Initial Reporter, and any REP Staked on a Dispute Crowdsourcer in these Markets will be redeemable by the users who originally Staked that REP. These Markets will start off back in the Waiting for the Next Fee Window to Begin Phase.

Fork Period

The Fork Period, or Fork Phase, is period lasting a maximum of sixty (60) days once a Fork has begun. Once a majority of REP has been migrated to a specific Child Universe or sixty days have elapsed, the Market will become Finalized.

Forked Market

A Forked Market is a Market whose Tentative Outcome is Challenged with a Dispute Bond greater than the Fork Threshold, thus causing 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.

Fork Threshold

The Fork Threshold is the amount of REP that must be Staked on a Dispute Crowdsourcer in order to cause a Market to Fork. In Augur, if 2.5% of all existing REP is Staked on the Dispute Crowdsourcer of a Market, that Market will Fork.

Genesis Universe

A Genesis Universe is a Universe that does not have a Parent Universe. At the launch of Augur, only a single Genesis Universe exists. However, users can create other Genesis Universes using the augur.api.Augur.createGenesisUniverse function. (One reason they may want to do this, for example, is if they wish to create a competing Genesis Universe because they do not agree with the Final Outcome of a particular Market in the original Genesis Universe.) Initially, a new Genesis Universe does not contain any Markets, nor any supply of REP. In order to add a REP supply to a Genesis Universe, users must migrate their Legacy REP to the REP smart contract for that Genesis Universe using the function augur.api.ReputationToken.migrateFromLegacyReputationToken.

Initial Report

The Initial Report is simply the first Report placed on a Market. The Initial Report often will come from the Designated Reporter for the Market, which would immediately refund the No-Show Bond to the Market Creator. However, if the Designated Reporter fails to Report on the Market within the Designated Reporting Phase, then the Market goes to the Open Reporting Phase. When this happens, the Market Creator does not get refunded the No-Show Bond. Instead, the No-Show Bond goes toward covering the Stake of the First Public Reporter when they submit the First Public Report. This provides an incentive to submit the First Public Report, since the First Public Reporter stands to gain the No-Show Bond in REP if they Stake on the eventual Final Outcome.

Initial Reporter

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

Invalid Outcome

A Market should be considered Invalid if any of the following are true:

If the Outcome of a Market is Invalid, Reporters can Report its Tentative Outcome as Invalid. Additionally, if the Market is in a Dispute Round, users can Stake REP on Invalid as the Tentative Outcome, or if the Market has Forked, users can migrate their REP to the Child Universe where the Outcome is Invalid. If the Market’s Final Outcome becomes Invalid, its Payout Set will be the Number of Ticks divided evenly among each Outcome. For example, in a Categorical Market with 10,000 Ticks and 4 potential Outcomes, the Payout Set would be [2500, 2500, 2500, 2500]. This is done to ensure that the holders for each type of Share in the Market receive the same payout during Settlement.

Legacy REP

Legacy Reputation Tokens, or Legacy REP, are REP that exist in the Legacy REP smart contract and have not been migrated to the Reputation Token smart contract, for a particular Universe. Legacy REP must be migrated to the Reputation Token smart contract by calling the augur.api.ReputationToken.migrateFromLegacyReputationToken function before they can be used within Augur.

Liquidity Token

Each Market has a Liquidity Token value for a given Spread Percent. These Liquidity Tokens are an accrued/running total revenue for Complete Sets sold into the Order Book.

Long Position

In Augur, opening a Long Position in the Outcome of a Market means purchasing Shares in that Outcome. Opening a Long Position costs (price per Share * number of Shares). For more information on trading, please refer to the Trading section.

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

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 changed, and 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: Yes/No, Categorical, and Scalar.

Market Creator

A Market Creator is a user who created a Market. They are charged a small fee to make a new Market but can set 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 posed, the type of Market (i.e., Yes/No, Categorical, or Scalar), the number of Outcomes, End Time, and a Topic.

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 and No-Show Bond) are also sent to the Market Creator Mailbox.

Market Resolution

Market Resolution is the process of Finalizing a Market. Designated Reporting, Open Reporting, Dispute 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 Yes/No 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 Yes/No 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.

No-Show Bond

The No-Show Bond is paid for using REP by the Market Creator during Market creation. If the Designated Reporter submits a Report during the Designated Reporting Phase, the Bond is refunded to the Market Creator. If the Designated Reporter fails to Report during the Designated Reporting Phase, then the No-Show Bond is applied as Stake on the Tentative Outcome Reported by the First Public Reporter. If the Tentative Outcome selected by the First Public Reporter becomes the Final Outcome of the Market, the First Public Reporter receives the No-Show Bond. If the Tentative Outcome selected by the First Public Reporter is Disputed and then still becomes the Final Outcome of the Market, the First Public Reporter receives the No-Show Bond plus an additional 50% of the Bond amount. This actually allows for someone to stake 0 REP for the First Public 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 purchase any. (Note that they will have to pay the gas cost to submit the Report.)

During the very first Fee Window after launch, the No-Show Bond will be set at 0.35 REP. As with the Validity Bond, the No-Show Bond is adjusted up or down, targeting a 1% no-show rate with a floor of 0.35 REP. Specifically, we let ρ be the proportion of Markets in the previous Fee Window whose Designated Reporters failed to Report on time, and we let br be amount of the No-Show Bond from the previous Fee Window. Then the amount of the No-Show Bond for the current Fee Window is max {0.35, brf(ρ)}.

Number of Ticks

A Market’s Number of Ticks can be thought of as the number of possible prices, or Ticks, between the Minimum Display Price and Maximum Display Price for that Market. It is also the amount of attoETH that must be escrowed with the Market contract to purchase a single Complete Set of indivisible Shares for a Market. Each Outcome in the Payout Set of an Invalid Market is set to the Number of Ticks divided by the number of Outcomes (in order to ensure that the holders of each type of Share in the Market receive the same payout during Settlement).

After Market Finalization, each winning Share can be Settled by sending it to the Market contract in exchange for an amount of attoETH equal to the Number of Ticks. In the event that the Market Finalizes as Invalid, each Share of the Market can be returned to the Market contract in exchange for an amount of attoETH equal to (Number of Ticks / Number of Outcomes). In cases where (Number of Ticks / Number of Outcomes) does not equal a whole number, the remainder will be subtracted equally from each Outcome and left on the Market contract as “dust” ETH. For example, if a 3-Outcome Market with no Creator Fee resolves to Invalid, the Payout Set would be [3333, 3333, 3333].

The attoETH yielded when a Complete Set of Shares is Settled 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.

For Yes/No and Categorical Markets, the Number of Ticks is always set to 10,000. For Scalar Markets, the Number of Ticks is determined implicitly by the range and precision set by the Market Creator, and must be evenly divisible by 2. In particular, the Number of Ticks equals (rangeMax - rangeMin) / precision. For example, if the Market Creator sets the range of Outcomes to [-10, 30] and the precision to 0.01, then the Number of Ticks equals (30-(-10)) / 0.01, or 4,000.

Open Interest

Open Interest is the value of all of the Complete Sets that exist in a Market, normalized to the denomination token for all of the Markets (which is currently ETH).

Open Order

An Open Order is an Order that is currently on the Order Book and has not been completely Filled.

Open Reporting

Open Reporting occurs if a Market’s Designated Reporter fails to submit a Designated Report and another user submits a First Public Report instead by Staking REP on an Outcome.

Open Reporting Phase

In the event that a Market’s Designated Reporter fails to submit a Designated Report, the Market moves to the Open Reporting Phase. When this happens, any user can submit a First Public Report by Staking REP on an Outcome.

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 part 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 part 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 part of the trade described in the Order.

Orphaned Order

Orders in Augur can sometimes become “orphaned”, meaning they do not get displayed in the Order Book, and do not get filled like non-Orphaned Orders when calling most of Augur’s API functions. This is an unintended behavior in Augur that can occur under the following scenario:

Suppose one side of a Market’s Order Book is empty, and two Orders for the same price are created on that side of the Order Book. At this point, neither of these Orders has been orphaned, but that side of the Order Book is now in a state where Orders potentially can become orphaned. Any subsequent Orders created for that price on that side of the Order Book will cause all such Orders to become orphaned, except the oldest and newest.

Creating an Order with a worse price on that side of the Order Book while still in that state will cause the previous Order with the same price to become orphaned. However, that side of the Order Book will no longer be in a state where Orders can be orphaned. Similarly, creating an Order with a better price on that side of the Order Book while still in that state will have the same effect, but without causing any other Orders to become orphaned.

Since Orphaned Orders are not displayed in Augur’s UI, the only way to fill one is by doing so directly using the Order’s ID and an API function such as augur.api.FillOrder.publicFillOrder. The Augur UI will alert the user when they have created an Orphaned Order and allow them to cancel it.

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 resolved as 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

At any time during a Fee Window, users can purchase Participation Tokens in exchange for REP. Once the Fee Window ends, users can redeem their Participation Tokens for a portion of the Reporting Fees (in Ether) that Augur collected during that Fee Window. The more Participation Tokens a user purchases, the bigger the portion of the Reporting Fees they will receive. Users are not required to purchase Participation Tokens, but their purpose is to incentivize users to be active on Augur in the event that they will be needed, such as when a Market Forks.

Payout Distribution Hash

The Payout Distribution Hash is a SHA-3 hash of the Payout Set. When a Market’s event has occurred, but the Market has not been Finalized yet, it is said to have a tentative Payout Distribution Hash. Once the Market is Finalized, this 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 “Payout Numerators” in Augur’s smart contract functions, 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 equal to the Number of Ticks for the Market.

For example, in a Yes/No Market with 1000 Ticks, a Report that Stakes REP on Outcome 0 would submit a Payout Set that looks like [1000, 0]. Payout Sets are a breakdown of the Payout Distribution, or how Markets should pay out for each Share when Finalized. In the example above, the Payout Numerators are the values 1000 and 0, and only Shares of Outcome 0 (index 0 of the array) will pay out on the Finalized Market because the Payout Numerator for Outcome 1 is 0. Valid Payout Sets are hashed using the SHA-3 hashing algorithm, which is a Payout Distribution Hash.

The Payout Set for a Categorical Market is similar to that of a Yes/No Market, except that Categorical Markets can have up to 8 Outcomes, so an example Payout Set for a Categorical Market with 8,000 Ticks might look like [0, 0, 8000, 0, 0, 0, 0, 0]. The same Categorical Market with an Invalid Outcome would have a Payout Set like [1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000]. This is because each Outcome in the Payout Set of an Invalid Market is set to the Number of Ticks divided by the number of Outcomes, in order to ensure that the holders of each type of Share in the Market receive the same payout during Settlement. (In cases where Number of Ticks / Outcomes is not a whole number, the remainder will be deducted from each Outcome in the Payout Set and left on the Market contract as “dust” ETH. For example, a 3-Outcome Market with no Creator Fee that resolves to Invalid will have a Payout Set of [3333, 3333, 3333].)

The Payout Set for a Scalar Market is determined differently than for Yes/No Markets and Categorical Markets. Scalar Markets have just 2 possible Outcomes: 0 (for a Short Position) and 1 (for a Long Position). Suppose that a Scalar Market exists with $0 as the Minimum Display Price, $100 as the Maximum Display Price, 10,000 as the Number of Ticks, and $75 as the reported Outcome. The Payout Set for this Market would be determined as follows:

  1. Normalize the reported Outcome to the Minimum Display Price by subtracting the Minimum Display Price from the reported Outcome: 75 - 0 = 75.
  2. Scale the reported outcome to be between 0 and 1 by dividing by (maxPrice - minPrice): 75 / (100 - 0) = 0.75.
  3. Scale the reported Outcome to the Number of Ticks by multiplying by the Number of Ticks: 0.75 * 10000 = 7500.
  4. Calculate the other Outcome by subtracting the result from the Number of Ticks: 10000 - 7500 = 2500.
  5. Put them in an array where the zero index is the Short Position, and one index is the Long Position: [2500, 7500]. Note: When calculating the Payout Set for a Scalar Market using integer-only math, the order of steps (2) and (3) should be switched (i.e., always multiply before dividing in integer math).

Position

A Position is the amount of Shares that are 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 means the Position holder currently own the Shares, whereas a closed position means they have redeemed their Shares and have cashed out for currency. Closing a Short Position means a trader is buying Shares of an Outcome they are short on, whereas closing a Long Position means they are selling the Shares they own.

Post-Finalization Waiting Period

Once a Market has Finalized, users must wait three (3) days before claiming their trading proceeds. This waiting period is intended as a security precaution. In the event that an attacker could somehow cause a Market to Finalize incorrectly, the Augur development team would have 3 days to notice and halt the Augur system before the attacker could claim the proceeds. When the Augur development team is confident that Augur is secure, this waiting period will be removed.

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 to pay the No-Show Bond when creating a Market, to Stake on an Outcome in the Designated Report or First Public Report of a Market, to Challenge a Tentative Outcome by Staking on a different Outcome when a Market is in the Dispute Round Phase, and to purchase Participation Tokens.

Report

A Report, or Reporting, is the Staking of REP on a particular Outcome in a Market that’s passed its End Time. Reporting as a term can be used to describe the act of submitting a Designated Report or First Public Report, or Challenging a Market’s Tentative Outcome by Staking REP on an Outcome other than the Tentative Outcome.

Reporter

A Reporter is a REP holder who Stakes REP on an Outcome of a Market that has an End Time that has passed. Reporters can include the Designated Reporter, First Public Reporter, or users who Challenge a Market’s Tentative Outcome by Staking REP on an Outcome other than the Tentative Outcome.

Reporting Fee

The Reporting Fee is used to help pay for Augur’s Decentralized Oracle system. When Shares are Settled (i.e., destroyed), before paying out to the Share holders, Augur will extract Settlement Fees in ETH. These Settlement Fees include the Creator Fee and the Reporting Fee.

The Reporting Fee is a dynamic amount based on the price of REP and the value of the Open Interest across all of Augur’s Markets. Augur sets the Reporting Fee so as to target a REP market cap that is 7.5 times the value of the Open Interest across all of Augur’s markets. This means the Reporting Fee will go up if the market cap of REP is not sufficiently high (but will never be higher than 33.3%) and will go down if it is higher than this target.

The Reporting Fee is sent to the Fee Window that contains the Market being traded on, and is later used to pay REP holders for engaging in Reporting.

Reporting Fee Pool

Any Reporting Fees (in ETH) collected during a Fee Window get added to a Reporting Fee Pool. At the end of the Fee Window, the Reporting Fee Pool is paid out to users in proportion to the number of REP they Staked during that Fee Window. In this way, all users who participate during a Fee Window will receive a portion of the Settlement Fees collected during that Window. Participation includes Designated or Open Reporting, Challenging an Outcome, or simply purchasing Participation Tokens directly.

Scalar Market

A Scalar Market is a Market with a wide range of potential Outcomes. An example of a Scalar Market would be “According to finance.yahoo.com, what will be the price of MSFT on January 3rd, 2062 at exactly 1:00pm?”. In this example Market, the minDisplayPrice might be set to $0 and the maxDisplayPrice to $500. This would allow the Market to Settle on any number between the two. Sometimes, a range of potential Outcomes is not needed, and a small number of choices will suffice. In these cases, it is better to use a Yes/No or Categorical Market.

Settlement

A trader can close their Position in one of two ways: by selling the Shares they hold to another trader in exchange for Ether, or by Settling their Shares with Augur’s smart contracts. Every Share in a Market comes into existence as part of a Complete Set when an amount of Ether equal to the Number of Ticks for that Market has been escrowed with Augur. To get that Ether out of escrow, traders must give Augur either a Complete Set, or — if the Market has Finalized — a Share of the winning Outcome. This exchange is referred to as Settlement.

For example, consider a non-Finalized Market with possible Outcomes A and B. Suppose Alice has a Share of Outcome A that she wants to sell for 0.70 ETH and Bob has a Share of Outcome B that he wants to sell for 0.30 ETH. First, Augur matches these Orders and collects the A and B Shares from the participants. Then Augur gives 0.70 ETH (minus Settlement Fees) to Alice and 0.30 ETH (minus Settlement Fees) to Bob.

As a second example, consider a Finalized Market whose winning Outcome is A. Alice has a Share of A and wants to cash it in. She sends her share of A to Augur and in return receives 1 ETH (minus Settlement Fees).

The Settlement Fees, which include 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.

Share

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 ETH to the Market to complete an Order. Shares are Settled (destroyed) when a Complete Set is sold back to the Market.

Share Unit

Used interchangably with Share. This is the smallest, indivisible unit of Shares that can be bought/sold in a Market’s Outcome’s value.

Short Position

Opening a Short Position, or shorting, is the selling of a security that is not owned by the seller. Shorting is done with the belief that a security’s price will decrease in the future, allowing it to be bought back at a lower price to make a profit.

In Augur, betting on the “No” Outcome of a Yes/No Market is done by shorting the “Yes” Outcome. This effectively means the user is selling “Yes” Shares they do not own. For Yes/No Markets and Scalar Markets, these are listed as negative quantities of Shares on the Portfolio:Positions view of Augur’s user interface.

Opening a Short Position costs ((cost of a Complete Set - price per Share) * number of Shares), where a Complete Set is a Share of every Outcome in a Market. For example, suppose a user thinks the “Yes” Outcome of a Yes/No Market is unlikely to happen and expects the price of a “Yes” Share in this Market to decrease in the future. If a Complete Set in this Market costs 1 ETH, and one Share of “Yes” costs 0.55 ETH, a Short Position in 1 Share of the “Yes” Outcome can be opened for (1 - 0.55) 1 = 0.45 ETH.

For more information on trading, please refer to the Trading section.

Spread Percent

Spread Percent is a liquidity metric for each of the Outcomes in a Market. It measures the difference between best Bid Orders and Ask Orders of the Order Book for an Outcome. Lower Spread Percent is better and means that Outcome’s best Bid Orders/Ask Orders on the Order Book are closer together and of higher quality from the standpoint of a taker/bettor. Spread Percent ranges from 0% (perfect spread) to 100% (empty Order Book). A Market’s Spread Percent is defined as the max (worst) Spread Percent of its Outcomes.

Tentative Outcome

The Tentative Outcome is the currently reported Outcome for a Market that has not been Finalized yet. In other words, it’s either the Outcome that the Designated Reporter or First Public Reporter has Staked REP on, or it’s the Outcome that had enough REP Staked on it in the last Dispute Round to Challenge the previous Tentative Outcome and make it the new Tentative Outcome. If a Market completes a Dispute Round without being Challenged, or if the Market passes through the Fork Phase, then the Market will become Finalized, and the Tentative Outcome will become a Final Outcome.

Theoretical REP Supply

The Theoretical REP Supply for a Universe is the amount of REP that has been migrated to it, plus the REP supply of its Parent Universe.

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

All Markets created on Augur belong to a Universe. Augur has only one Universe at launch (the Genesis 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 Child Universes will be created, one for each Outcome of the Forked Market. Once a Fork Phase begins, REP holders can choose to migrate their REP to one of the new Child Universes. They don’t have to migrate, but Locked Universes do not allow the creation of new Markets, and therefore there will be no Markets to Report on in the future and no Fees to earn. All Child Universes can continue to operate after the Fork Phase ends.

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.

The Validity Bond is a dynamic amount based on the percentage of Markets in Augur that are being Finalized as Invalid. Augur targets having 1% of its Markets Finalized as Invalid. During the very first Fee Window after launch, the Validity Bond will be set at 0.01 ETH. Then, if more than 1% of the Finalized Markets in the previous Fee Window were Invalid, the Validity Bond will be increased. If less than 1% of the Finalized Markets in the previous Fee Window were Invalid, then the Validity Bond will be decreased (but will never be lower than 0.01 ETH). In particular, we let ν be the proportion of Finalized Markets in the previous Fee Window that were Invalid, and bv be the amount of the Validity Bond from the previous Fee Window. Then the Validity Bond for the current window is max {1/100, bvf(ν)}.

Waiting for the Next Fee Window to Begin Phase

Once a Designated Report or First Public Report has been submitted, the Market will enter the Waiting for the Next Fee Window to Begin Phase until the current 7-day Fee Window has ended. At that point, the Market will move to the Dispute Round Phase of the next Fee Window.

Winning Universe

When a Fork occurs, the Child Universe that has the most REP migrated to it by the end of the Fork Phase is the Winning Universe for that particular Fork.

Yes/No Market

A Yes/No Market is a Market with only two Outcomes (as well as Invalid, which is always a possible Outcome). Yes/No Markets are for yes-or-no questions; if more potential Outcomes are needed, a Categorical or Scalar Market should be used.

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 on Discord. (We also have an IRC gateway in #augur on Freenode that is connected to our Discord chat!) Our Discord conversations are 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!