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.

The stable Augur application is built and hosted at https://stable.augur.net. 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! We suggest simply using https://stable.augur.net for a more stable experience.)

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 GitHub repository by opening a terminal window and typing:

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

Navigate to the newly created augur folder by running:

$ cd augur

Once this has been done, Augur’s dependencies will need to be installed. This can be done using 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://app.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 (while in beta) at rinkeby.ethereum.nodes.augur.net, which is used automatically by https://app.augur.net (and by local.augur.net if a local Ethereum node is not detected).

Trading

Augur allows anyone to create an openly tradable Market about any upcoming event. Augur 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 an 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 where to occur too frequently, the Market will not have time to adjust to the new fees. If we update too infrequently, then we are at risk of the security model becoming invalid due to a sudden growth in Augur that isn’t yet accounted for by the fee system.

Settlement Fees are extracted anytime Settlement occurs and Shares are destroyed. This can happen for two reasons:

Selling a Complete Set can be thought of as exiting your market Position. Complete Sets are a set of Shares for each Outcome. Complete Sets are priced differently for each Market, and are determined by the Number of Ticks, which represents all possible price points, or Ticks, for a Market as well as the amount of attoETH it costs to purchase a Complete Set for the Market. If you own a set of Shares in each Outcome, you can Settle those Shares and receive ETH back for their value minus Settlement Fees.

Calculating Trades

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

The Formulas for determining how much opening a Long 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 REP Bond only if their Reported Outcome agrees with the Market’s Final Outcome. They also receive the No-Show Gas Bond after the Market has Finalized 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. 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 Gensis 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, regarless of whether or not the objectively false Universe ends up being the Winning Universe after a Fork.

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 REP Bond and the No-Show Gas Bond, and the Market is moved into the Open Reporting Phase. These No-Show Bonds are then used to help pay for the gas costs and 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 REP Bond and the No-Show Gas 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 REP 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, but they will receive the No-Show Gas Bond once the Market Finalizes if the Outcome they picked becomes the Final Outcome.) 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 REP Bond.

API Overview

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

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.

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
    "rinkeby.ethereum.nodes.augur.net" // 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://websocket-rinkeby.ethereum.nodes.augur.net" // 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",
      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](#connect-function) 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 an Augur Node and Ethereum node on the Ethereum test network, Rinkeby. They host Augur Nodes and Ethereum nodes on private chains using Clique (Geth’s Proof-of-Authority protocol) and Aura (Parity’s Proof-of-Authority protocol). The addresses for these hosted nodes are as follows:

Rinkeby Augur Node (WSS): wss://rinkeby.augur.nodes.augur.net
Rinkeby Ethereum Node (HTTPS): https://rinkeby.ethereum.nodes.augur.net
Rinkeby Ethereum Node (WSS): wss://websocket-rinkeby.ethereum.nodes.augur.net

Clique Augur Node (WSS): wss://clique.augur.nodes.augur.net
Clique Ethereum Node (HTTPS): https://clique.ethereum.nodes.augur.net

Aura Augur Node (WSS): wss://aura.augur.nodes.augur.net
Aura Ethereum Node (HTTPS): https://aura.ethereum.nodes.augur.net

The statuses of these hosted nodes can be viewed at http://stats.augur.net.

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.

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

augur.accounts.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: {
    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],
    accountType: "privateKey"
  },
  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: {
    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],
    accountType: "privateKey"
  },
  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) {
    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",
  "timeout": 100,
  "workQueue": [],
  "awaitingPump": false,
  "connected": true,
  "backoffMilliseconds": 1,
  "nextListenerToken": 1,
  "reconnectListeners": { ... },
  "disconnectListeners": { ... },
  "webSocketClient": { ... }
}

augur.augurNode.getContractAddresses(
  function(error, result) {
    console.log(result);
  }
);
// example output:
{
  "version": "4.7.0-47",
  "net_version": "4",
  "netId": "4",
  "isSyncFinished": true,
  "addresses": {
    "Controller": "0x392be0a9d1ab1bde2931c2ddf1d722f9e13b6085",
    "Universe": "0x1f732847fbbcc46ffe859f28e916d993b2b08831",
    "Augur": "0x852684b374fe03ab77d06931f1b2831028fd58f5",
    "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"
  }
}

augur.augurNode.submitRequest(
  "getMarketsInCategory",
  {
    universe: "0x1f732847fbbcc46ffe859f28e916d993b2b08831",
    category: "sports"
  },
  function(error, result) {
    console.log(result);
  }
);
// example output:
[
  "0x55132e5b02c94bef39983f31392091c626a4b8f0",
  "0x5e44a67cfef54f6e5af5c9aa762204e85cf1c319",
  "0xbf8efd9b940cddeb6eb31f28dae47245cd6ee6a1"
]

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.getContractAddresses(callback)

Returns the version and contract address set from an Augur Node.

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.connect(connectOptions, callback)

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

Parameters:

Returns:

Create Market Functions

// Create Market Simplified API Examples:
var _extraInfo = {
  "resolutionSource": "http://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: {
    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],
    accountType: "privateKey"
  },
  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": "http://forecast.weather.gov",
  "tags": ["San Francisco", "weather"],
  "longDescription": ""
};
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: {
    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],
    accountType: "privateKey"
  },
  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": "http://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: {
    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],
    accountType: "privateKey"
  },
  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:
{
  validityBond: "0.01",
  designatedReportNoShowReputationBond: "0.174840291341145834",
  targetReporterGasCosts: "0.015"
}

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.

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.

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.

Parameters:

Returns:

augur.createMarket.getMarketCreationCost(p, callback)

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

Note: This function will send a transaction if needed to create the current 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:

Markets Functions

// Markets Simplified API Examples:

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

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

augur.markets.getMarkets({
  universe: "0x000000000000000000000000000000000000000b",
  reportingState: "DESIGNATED_REPORTING",
  designatedReporter: "0x000000000000000000000000000000000000d00d",
}, function (error, result) {
  console.log(result);
});
// example output:
[
  "0x0000000000000000000000000000000000000003",
]

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

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

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

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.03",
    reportingFeeRate: "0.02",
    marketCreatorFeeRate: "0.01",
    marketCreatorFeesBalance: "0",
    marketCreatorMailbox: "0xbbb0000000000000000000000000000000000001",
    marketCreatorMailboxOwner: "0x0000000000000000000000000000000000000b0b",
    initialReportSize: null,
    category: "test category",
    tags: ["test tag 1", "test tag 2"],
    volume: "0",
    outstandingShares: "0",
    reportingState: "DESIGNATED_REPORTING",
    forking: 0,
    needsMigration: 0,
    feeWindow: "0x1000000000000000000000000000000000000000",
    endTime: 1506573470,
    finalizationBlockNumber: null,
    finalizationTime: null,
    description: "This is a categorical test market created by b0b.",
    scalarDenomination: null,
    details: null,
    designatedReporter: "0x0000000000000000000000000000000000000b0b",
    designatedReportStake: "10",
    resolutionSource: "http://www.trusted-third-party.com",
    numTicks: "10000",
    tickSize: "0.0001",
    consensus: null,
    outcomes: [{
      id: 0,
      volume: "100",
      price: "0.125",
      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.03",
    reportingFeeRate: "0.02",
    marketCreatorFeeRate: "0.01",
    marketCreatorFeesBalance: "0",
    marketCreatorMailbox: "0xbbb0000000000000000000000000000000000002",
    marketCreatorMailboxOwner: "0x0000000000000000000000000000000000000b0b",
    initialReportSize: null,
    category: "test category",
    tags: ["test tag 1", "test tag 2"],
    volume: "0",
    outstandingShares: "0",
    reportingState: "DESIGNATED_REPORTING",
    forking: 0,
    needsMigration: 0,
    feeWindow: "0x1000000000000000000000000000000000000000",
    endTime: 1506573480,
    finalizationBlockNumber: null,
    finalizationTime: null,
    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: null,
    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:
{
  "0x0000000000000000000000000000000000000001": 0,
  "0x0000000000000000000000000000000000000002": 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.getMarketsCreatedByUser(p, callback)

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

This function will fail if:

Parameters:

Returns:

augur.markets.getMarketsInCategory(p, callback)

Returns the Markets within a specific category.

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: {
    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],
    accountType: "privateKey"
  },
  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: "0",
        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: 0,
  },
  {
    marketId: "0x0000000000000000000000000000000000000011",
    stakeCompletedTotal: "30000",
    bondSizeOfNewStake: "60000",
    stakes: [
      {
        payout: [
          "0",
          "2",
        ],
        isInvalid: false,
        bondSizeCurrent: "30000",
        stakeCurrent: "30000",
        accountStakeCurrent: "0",
        accountStakeTotal: "17",
        stakeRemaining: "0",
        bondSizeTotal: "40000",
        accountStakeCompleted: "17",
        stakeCompleted: "10000",
        tentativeWinning: false,
      },
      {
        payout: [
          "1",
          "1",
        ],
        isInvalid: true,
        accountStakeCompleted: "500",
        stakeCurrent: "0",
        stakeCompleted: "20000",
        tentativeWinning: true,
      },
    ],
    disputeRound: 2,
  },
]

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,
  feeWindow: "0x2000000000000000000000000000000000000000",
  feeWindowId: 457,
  startTime: 1509065473,
  totalStake: "132",
  participantContributions: "102",
  participationTokens: "30",
  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",
  },
  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",
    },
  ],
}

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": 8,
  "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).

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, including “DESIGNATED_REPORTING”, “FIRST_REPORTING”, “LAST_REPORTING”, “AWAITING_FINALIZATION” (when a Market has been Reported on and is in a Dispute Round Phase), “FORKING” (for the Market that has Forked), “AWAITING_FORK_MIGRATION” (for Markets that are waiting for a Forked Market to resolve), and “FINALIZED”.

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: {
    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],
    accountType: "privateKey"
  },
  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: {
    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],
    accountType: "privateKey"
  },
  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: {
    BID_0: {
      amount: "2",
      fullPrecisionPrice: "0.6",
      owner: "0x8fa56abe36d8dc76cf85fecb6a3026733e0a12ac",
    },
    BID_1: {
      amount: "1",
      fullPrecisionPrice: "0.5",
      owner: "0x8fa56abe36d8dc76cf85fecb6a3026733e0a12ac",
    },
    BID_4: {
      amount: "3",
      fullPrecisionPrice: "0.7",
      owner: "0x8fa56abe36d8dc76cf85fecb6a3026733e0a12ac",
    },
    BID_5: {
      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",
  outcome: null,
  orderType: "buy",
  creator: null,
  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",
          fullPrecisionPrice: "0.7",
          fullPrecisionAmount: "1",
          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",
          fullPrecisionPrice: "0.600001",
          fullPrecisionAmount: "2",
          tokensEscrowed: "1.200002",
          sharesEscrowed: "0",
        },
        "0x5000000000000000000000000000000000000000000000000000000000000000": {
          orderId: "0x5000000000000000000000000000000000000000000000000000000000000000",
          amount: "1",
          creationBlockNumber: 1400001,
          creationTime: 1506473500,
          transactionHash: "0x0000000000000000000000000000000000000000000000000000000000000A06",
          logIndex: 0,
          fullPrecisionAmount: "1",
          fullPrecisionPrice: "0.73",
          orderState: "OPEN",
          owner: "0x0000000000000000000000000000000000000b0b",
          price: "0.73",
          shareToken: "0x1000000000000000000000000000000000000000",
          sharesEscrowed: "0",
          tokensEscrowed: "0.73",
        },
      },
    },
    1: {
      buy: {
        "0x3000000000000000000000000000000000000000000000000000000000000000": {
          orderId: "0x3000000000000000000000000000000000000000000000000000000000000000",
          shareToken: "0x2000000000000000000000000000000000000000",
          transactionHash: "0x0000000000000000000000000000000000000000000000000000000000000A02",
          logIndex: 0,
          owner: "0x000000000000000000000000000000000000d00d",
          creationTime: 1506473515,
          creationBlockNumber: 1400002,
          orderState: "OPEN",
          price: "0.6",
          amount: "2",
          fullPrecisionPrice: "0.6",
          fullPrecisionAmount: "2.0000001",
          tokensEscrowed: "1.20000006",
          sharesEscrowed: "0",
        },
      },
    },
  },
}

augur.trading.getPositionInMarket({
  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",
  universe: null, 
  marketId: "0x0000000000000000000000000000000000000001",
  outcome: 0,
  orderType: null,
  sortBy: null,
  isSortDescending: null,
  limit: null,
  offset: null,
}, function (error, result) {
  console.log(result);
});
// example output:
[
  {
    transactionHash: "0x0000000000000000000000000000000000000000000000000000000000000C00",
    logIndex: 0,
    orderId: "0x1100000000000000000000000000000000000000000000000000000000000000",
    type: "buy",
    price: "5.5",
    amount: "0.2",
    maker: false,
    marketCreatorFees: "0",
    reporterFees: "0",
    selfFilled: false,
    settlementFees: "0",
    marketId: "0x0000000000000000000000000000000000000001",
    outcome: 0,
    shareToken: "0x0100000000000000000000000000000000000000",
    timestamp: 1506474500,
    tradeGroupId: null,
  }
]

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

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: {
    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],
    accountType: "privateKey"
  },
  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: {
      BID_0: {
        amount: "2",
        fullPrecisionPrice: "0.7",
        sharesEscrowed: "2",
        owner: "0x2228238db7ad03e505840bd361dc2f521a72adbc",
      },
    },
    sell: {
      ASK_0: {
        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,
  doNotCreateOrders: false,
  meta: {
    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],
    accountType: "privateKey"
  },
  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,
  "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,
  "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>);

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

// Synchronous call -- Possible, but not recommended.
var outcomes = augur.api.Market.getNumberOfOutcomes(error, params);
// outcomes = 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>).

While technically optional, the Augur development team strongly recommends using a callback. Without it, the calls will be synchronous, which can lock up the web browser until they complete.

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.getContractAddresses`.
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.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.getAvgReportingGasPrice({ 
  tx: { to: feeWindow } 
}, function (error, avgReportingGasPrice) { 
  console.log(avgReportingGasPrice); 
});
// example output:
"12500000000"

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.getAvgReportingGasPrice(p, callback)

Returns the average amount of gas spent to submit either a Designated Report or First Public Report in the specified Fee Window.

Parameters:

Returns:

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 Designated Report No-Show Gas Bond and Designated Report No-Show REP 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 Staked on the Reported Outcome of the Initial Report.

Parameters:

Returns:

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

Returns the amount of attoREP Staked on the Initial Report for the Market of the specified InitialReporter contract.

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.getReporterGasCostsFeeAttoeth(
  tx: { to: market } 
}, function (error, reporterGasCostsFeeAttoeth) { 
  console.log(reporterGasCostsFeeAttoeth); 
});
// example output:
"17246000000000000"

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.

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.getReporterGasCostsFeeAttoeth(p, callback)

Returns the Designated Report No-Show Gas Bond in AttoETH that is paid to the Initial Reporter in the event of a Designated Report no-show, or refunded to the Market Creator Mailbox if the Designated Reporter does show up. The Market must be specified in tx. The amount returned by this function will typically be well above the actual cost to create a Market, just to ensure the Market creation will succeed.

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 the price of a particular Order (for Bid Orders), or whether the price is greater than 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 Orders 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:

Reputation Token Call API

// Reputation Token Contract Call API Examples:

// The Ethereum contract address for Augur.sol can be 
// obtained by calling `augur.augurNode.getContractAddresses`.
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.getContractAddresses`.
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 attoShares that a given Ethereum contract is allowed to spend on behalf of a particular user.

Parameters:

Returns:

(string) Amount of attoShares 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.getContractAddresses`.
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.getContractAddresses`.
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: {
    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],
    accountType: "privateKey"
  },
  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 Airbitz 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”, or “uPort”. 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", or "uPort".
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”, “uPort”, or “ledger”, depending on the type of account that is sending the transaction.

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

  1. augur.rpc.transact 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.getContractAddresses`.
var augurAddress = "0x852684b374fe03ab77d06931f1b2831028fd58f5";

augur.api.Augur.createGenesisUniverse({
  tx: { 
    to: augurAddress,
    gas: "0x632ea0" 
  },
  meta: {
    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],
    accountType: "privateKey"
  },
  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.getContractAddresses`.
var cancelOrderAddress = "0x389c0b3f0d51cfba9e4d214712a1142f5685814d";

var _orderId = "0x7ca90ca9118db456d87e3d743b97782a857200b55039f7ffe8de94e5d920f870";
augur.api.CancelOrder.cancelOrder({
  _orderId: _orderId,
  tx: { 
    to: cancelOrderAddress,
    gas: "0x632ea0" 
  },
  meta: {
    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],
    accountType: "privateKey"
  },
  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.getContractAddresses`.
var _augurContractAddress = "0x67cbf60a24ab922af99e6f335c0ff2b084d5bdbe";
// The Ethereum address of Augur's Cash contract can be 
// obtained by calling `augur.augurNode.getContractAddresses`.
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: {
    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],
    accountType: "privateKey"
  },
  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: {
    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],
    accountType: "privateKey"
  },
  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: {
    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],
    accountType: "privateKey"
  },
  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: {
    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],
    accountType: "privateKey"
  },
  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.getContractAddresses`.
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: {
    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],
    accountType: "privateKey"
  },
  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.getContractAddresses`.
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: {
    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],
    accountType: "privateKey"
  },
  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: {
    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],
    accountType: "privateKey"
  },
  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.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:

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.getContractAddresses`.
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", 
    gas: augur.constants.CREATE_ORDER_GAS 
  },
  meta: {
    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],
    accountType: "privateKey"
  },
  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.getCrowdsourcer`.
var disputeCrowdsourcerAddress = "0xe5d6eaefcfaf7ea1e17c4768a554d57800699ea4";

augur.api.DisputeCrowdsourcer.forkAndRedeem({
  tx: { 
    to: disputeCrowdsourcerAddress,
    gas: "0x632ea0" 
  }, 
  meta: {
    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],
    accountType: "privateKey"
  },
  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: {
    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],
    accountType: "privateKey"
  },
  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: {
    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],
    accountType: "privateKey"
  },
  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: {
    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],
    accountType: "privateKey"
  },
  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: {
    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],
    accountType: "privateKey"
  },
  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: {
    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],
    accountType: "privateKey"
  },
  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.getContractAddresses`.
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: {
    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],
    accountType: "privateKey"
  },
  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 attoshares 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: {
    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],
    accountType: "privateKey"
  },
  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: {
    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],
    accountType: "privateKey"
  },
  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: {
    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],
    accountType: "privateKey"
  },
  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: {
    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],
    accountType: "privateKey"
  },
  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 (and the No-Show Gas Bond, in Ether, if applicable) 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. If the First Public Reporter submitted the Initial Report, this function will also redeem the No-Show Gas Bond in Ether.

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, as well as the No-Show Gas Bond (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: {
    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],
    accountType: "privateKey"
  },
  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: {
    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],
    accountType: "privateKey"
  },
  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: {
    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],
    accountType: "privateKey"
  },
  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: {
    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],
    accountType: "privateKey"
  },
  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: {
    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],
    accountType: "privateKey"
  },
  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: {
    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],
    accountType: "privateKey"
  },
  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: {
    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],
    accountType: "privateKey"
  },
  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: {
    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],
    accountType: "privateKey"
  },
  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: {
    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],
    accountType: "privateKey"
  },
  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: {
    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],
    accountType: "privateKey"
  },
  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: {
    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],
    accountType: "privateKey"
  },
  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.getContractAddresses`.
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: {
    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],
    accountType: "privateKey"
  },
  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: {
    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],
    accountType: "privateKey"
  },
  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: {
    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],
    accountType: "privateKey"
  },
  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: {
    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],
    accountType: "privateKey"
  },
  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: {
    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],
    accountType: "privateKey"
  },
  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: {
    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],
    accountType: "privateKey"
  },
  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: {
    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],
    accountType: "privateKey"
  },
  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: {
    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],
    accountType: "privateKey"
  },
  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: {
    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],
    accountType: "privateKey"
  },
  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: {
    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],
    accountType: "privateKey"
  },
  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 reputationToken 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.getContractAddresses`.
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: {
    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],
    accountType: "privateKey"
  },
  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: {
    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],
    accountType: "privateKey"
  },
  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: {
    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],
    accountType: "privateKey"
  },
  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: {
    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],
    accountType: "privateKey"
  },
  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: {
    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],
    accountType: "privateKey"
  },
  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 attoshares 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: