Overview
Augur is a decentralized prediction market platform that runs on Ethereum. For a detailed, high-level explanation of how Augur works, please refer to the Augur whitepaper.
If you want to use or help test Augur, please install the Augur App. If you want to use our cutting-edge development client, this is maintained at https://dev.augur.net. However, be warned – we push changes here pretty rapidly, so it can be a bit buggy!
Augur has its own dedicated Stack Exchange, which allows anyone to ask questions about Augur and get answers to those questions. It’s a great resource to find the answers for questions you might have that aren’t answered directly in these documents. Additionally, you can chat with us on Discord. If you’d like to join the conversation, just go to invite.augur.net and sign up. Most questions are best asked in the #dev
or #general
channels.
Getting Started
If you would like to help develop Augur, you’ll need to build the client from source. To do this, first install version 8 of Node.js (note that the version number is important), and Git.
Next, clone the Augur UI GitHub repository by opening a terminal window and typing:
$ git clone https://github.com/AugurProject/augur-ui.git
Navigate to the newly created augur-ui
folder by running:
$ cd augur-ui
Once this has been done, Augur’s dependencies will need to be installed. This can be done using npm
or yarn
. Both methods are detailed in the next sections.
If you plan on submitting a pull request to the Augur Project, please be sure to read through the Contributing section of these documents before submitting the request.
Using NPM
Node.js comes with a built in package manager called npm
. (Again, please note that version 8 of Node.js is required for Augur.) npm
is used to install dependencies for Augur, build the Augur project from source code, run tests, and start a web server to host Augur, among other things. To install Augur’s dependencies using npm
, run the following command:
$ npm install
To build Augur from the source code, run:
$ npm run build
After building Augur from the source files, a local web server will need to be started. This can be done using the following command:
$ npm start
To enable hot-reloading (which automatically loads changes made locally), run the following instead of npm start
:
$ npm run dev
Doing this is an easy way to do some hacking on the Augur source code and see the changes reflected in real time.
Now open a web browser and go to http://localhost:8080. This should load Augur’s most popular categories page.
Congratulations, you’re ready to start hacking!
Using Yarn
Some people prefer to use yarn instead of npm
. To use yarn, execute the following command to install the Augur dependencies:
$ yarn
To build Augur from the source code, run:
$ yarn build
After building, the following command will start a local web server:
$ yarn start
To enable hot-reloading for development purposes, run the following instead of yarn start
:
$ yarn dev
Finally, open a web browser and go to http://localhost:8080. This should load Augur’s most popular categories page.
Congratulations, you’re ready to start hacking!
Architecture
Augur is designed to work with a locally-running Ethereum node; however, if one is not available, Augur can be configured to use a hosted Ethereum node instead. A hosted Ethereum node is one that is hosted on a public server by the Augur development team. The sections below explain a bit about each setup and provide a diagram of what’s going on under the hood.
Local Ethereum Node
Running a local Ethereum node, such as Geth, while using Augur provides the best performance and overall experience. This is because Augur sends RPC requests to a hosted Ethereum node takes more time than sending them to a local node. To use a local Ethereum node with Augur, either download and run the Augur app locally, or simply visit https://dev.augur.net, which is configured to automatically talk to a local node, if present.
Note to Geth users: Since Geth’s RPC server uses regular (unencrypted) HTTP, the Augur app must also use regular HTTP to communicate with a local Geth node.
Hosted Ethereum Node
Since many users may not wish to go to the trouble of running a full Ethereum node solely to use Augur, the Augur development team maintains a public Ethereum node on the Rinkeby test network at rinkeby.ethereum.nodes.augur.net
, which is used automatically by https://dev.augur.net.
Trading
Augur allows anyone to create an openly tradable Market about any upcoming event. Augur maintains an Order Book for each of the Markets created. Any trader can place or take an Order on the Market’s Order Book. When placing a trade, that trade request will be Filled immediately if there is an Order on the Order Book that will fulfill it. If there is no matching Order, or if the trade request can only be partially Filled, the remainder of what wasn’t filled of the trade will be placed on the Order Book as an Order. Order Creators may cancel their Order to remove it from the Order Book. Orders are executed on a “first come, first served” basis.
The Augur UI offers users the best prices first when displaying the Order Book on each Market page. Orders are never executed at a worse price than the limit price set by the trader, however they can settle for better than the limit price. Orders can also be partially filled. The UI will automatically include multiple backup/fallback Orders to attempt to fill the Order in the event that the best Order was filled before the transaction was sent. These backup/fallback Orders are always within the limit price set by the trader.
Trading Example
Let’s use an example Yes/No Market trading on the “super big event” coming up. For this example, we want to go long on Yes
. We would submit a trade request to buy 100
Shares of Yes
with a limit price of 0.5 ETH
, which will cost 50.0 ETH
plus gas used to send the transaction.
If there are Orders on the Order Book that match our request for 100
Shares of Yes
at a price of 0.5 ETH
, or cheaper, then Augur will fill those Orders. We will now own 100
Shares of Yes
and we will have lost 50.0 ETH
plus gas cost.
If no Order is available on the Order Book that would partially or completely fill our trade request then a Bid Order would be placed on the Order Book. Whenever an Order is placed on the Order Book something of value is escrowed by the Market. In our example, the value we are giving to the Market to place our bid would be our 50.0 ETH
. If we were attempting to sell Shares that we currently owned then we would escrow the Shares instead of ETH
. If we cancel our Order we can get our 50.0 ETH
back, the only currency lost would be the gas used to pay to place the trade and cancel the trade. When a Filler decides to fill our Order on the Order Book, we will get our 100
shares of Yes
transferred to us.
For more information on how to trade using the Augur API, check the trade section of the Transaction API.
Settlement Fees Explained
Creating a Market costs a small amount of ETH
. Without some incentive people won’t create Markets as they get nothing in return for the ETH
they spent to create it. Augur solves this problem by allowing Market Creators to set a Creator Fee for their Market. The Creator Fee must be between 0
and 50
percent, and cannot be changed once a Market is created. In addition to the Market Creator Fee, Market Creators can profit via spread by providing liquidity to the Markets they create.
Augur also extracts Fees to help support the Reporting System known as the Reporting Fee. Settlement Fees refer to both the Creator Fee and the Reporting Fee combined. Unlike the Creator Fee, the Reporting Fee isn’t set by the Market Creator. Instead, it is set by an off-Augur price feed. Once the REP price is known, Augur can calculate the REP Market cap and the appropriate Reporting Fee to ensure the security of the Reporting System.
The Augur contracts will track the Open Interest of all Markets passively as people interact with Augur, which allows Augur to always have access to the Open Interest numbers. Once the Open Interest and REP market caps are known Augur can then determine wether the Reporting Fee is too high or too low. Augur then calculates the new Reporter Fee using the following formula:
current_reporting_fee * (augur_open_interest * 7.5 / rep_market_cap)
The Reporting Fee will be updated once every 7 days, or once every Fee Window. If updates were to occur too frequently, the Market will not have time to adjust to the new fees. If we update too infrequently, then we are at risk of the security model becoming invalid due to a sudden growth in Augur that isn’t yet accounted for by the fee system.
Settlement Fees are extracted anytime Settlement occurs and Shares are destroyed. This can happen for two reasons:
- Selling a Complete Set
- Redeeming shares for the finalized outcome in a Finalized Market
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 ETHOrder 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 ETHOrder 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:
- Pre-Reporting
- Designated Reporting
- Open Reporting
- Waiting for the Next Fee Window to Begin
- Dispute Round
- Fork
- Finalized
The relationship between these states can be seen in the figure below:
Pre-Reporting State
The Pre-Reporting or trading phase is the time period that begins after trading has begun in the Market, but before the Market’s event has come to pass. Generally, this is the most active trading period for any given Augur Market. Once the event end date has passed, the Market enters the Designated Reporting Phase (state a in the figure above).
Designated Reporting State
When creating a Market, Market Creators are required to choose a Designated Reporter and post a No-Show Bond. During the Designated Reporting Phase (state a in the figure above), the Market’s Designated Reporter has up to three days to Report on the Outcome of the event. If the Designated Reporter fails to Report within the allotted 3 days, the Market Creator forfeits the No-Show Bond, and the Market automatically enters the Open Reporting Phase (state b in the figure above).
If the Designated Reporter submits a Report on time, then the No-Show Bond is returned to the Market Creator. The Designated Reporter is required to post the Designated Reporter Stake on its Reported Outcome, which it will forfeit if the Market finalizes to any Outcome other than the one they Reported. As soon as the Designated Reporter submits its Report, the Market enters the Waiting for the Next Fee Window to Begin Phase (state c in the figure above), and the Reported Outcome becomes the Market’s Tentative Outcome.
Open Reporting State
If the Designated Reporter fails to Report within the allotted 3 days, the Market Creator forfeits the No-Show Bond, and the Market immediately enters the Open Reporting Phase. As soon as the Market enters the Open Reporting Phase, anyone can report the Outcome of the Market. When the Designated Reporter fails to Report, the first Reporter who Reports on the Outcome of a Market is called the Market’s First Public Reporter.
The Market’s First Public Reporter receives the forfeited No-Show Bond in the form of Stake on their chosen Outcome, so they may claim the No-Show Bond only if their Reported Outcome agrees with the Market’s Final Outcome.
The First Public Reporter does not need to Stake any of their own REP when Reporting the Outcome of the Market. In this way, any Market whose Designated Reporter fails to Report is expected to have its Outcome reported by someone very soon after entering the Open Reporting Phase.
Once an Initial Report has been received from the Initial Reporter (whether it was the Designated Reporter or First Public Reporter), the Reported Outcome becomes the Market’s Tentative Outcome, and the Market enters the Waiting for the Next Fee Window to Begin Phase (state c in the figure above).
Waiting for the Next Fee Window to Begin State
Once the market receives its Initial Report it enters the Waiting for the Next Fee Window to Begin Phase (state c in the figure above). During this phase, Reporting for the Market is on hold until end of the current Fee Window. Once the next Fee Window begins, the Market enters the Dispute Round Phase.
Dispute Round State
The Dispute Round (state d in the figure above) is a 7-day period, during which any REP holder has the opportunity to Dispute the Market’s Tentative Outcome. (At the beginning of a Dispute Round, a Market’s Tentative Outcome is the outcome that will become the Market’s Final Outcome if it is not successfully disputed by REP holders.) A Dispute consists of Staking REP (referred to as Dispute Stake in this context) on an Outcome other than the Market’s current Tentative Outcome. A Dispute is successful if the total amount of Dispute Stake on some Outcome meets the Dispute Bond size required for the current round. The Dispute Bond sizes are chosen in such a way to ensure a fixed ROI of 50% for Reporters who successfully dispute false Outcomes. Details for how the Dispute Bond size is computed can be found in the Dispute Bond glossary entry.
The Dispute Bonds need not be paid in their entirety by a single user. The Augur platform allows participants to crowdsource the Dispute Bonds. Any user who sees an incorrect Tentative Outcome can Dispute that Outcome by Staking REP on some Outcome other than the Tentative Outcome. If any Outcome (other than the Tentative Outcome) receives enough Dispute Stake to fill its Dispute Bond, the current Tentative Outcome will be successfully Disputed.
In the case of a successful Dispute, the Market will either undergo another Dispute Round or it will enter the Fork Phase (state e in the figure above). If the size of the filled Dispute Bond is greater than the Fork Threshold, then the Market will enter the Fork Phase. If the size of the filled Dispute bond is less than the Fork Threshold, then the newly chosen Outcome becomes the Market’s new Tentative Outcome, and the Market undergoes another Dispute Round.
All Dispute Stake is held in escrow during the Dispute Round. If a Dispute Bond is unsuccessful, then the dispute Stake is returned to its owners at the end of the Dispute Round. If no Dispute is successful during the 7-day Dispute Round, the Market enters the Finalized State (state f in the figure above), and its Tentative Outcome is accepted as the Final Outcome. A Market’s Final Outcome is the Tentative Outcome that passes through a dispute Round without being successfully Disputed, or is determined via a Fork. Augur’s contracts treat Final Outcomes as truth and pay out accordingly.
All unsuccesful Dispute Stake is returned to the original owners at the end of every Dispute Round. All successful Dispute Stake is applied to the Outcome it championed, and remains there until the Market is Finalized (or until a Fork occurs in some other Augur Market). All Dispute Stake (whether successful or unsuccessful) will receive a portion of the Reporting Fee Pool from the current Fee Window.
Fork State
The Fork Phase is a special state that lasts up to 60 days. Forking is the Market resolution method of last resort; it is a very disruptive process and is intended to be a rare occurrence. A Fork is caused when there is a Market with an Outcome with a successfully filled Dispute Bond of at least 2.5% of all REP. This Market is referred to as the Forking Market.
When a Fork is initiated, a 60-day Forking Period begins. Disputing for all other non-Finalized Markets is put on hold until the end of this Forking Period. The Forking Period is much longer than the usual Fee Window because the platform needs to provide ample time for REP holders and service providers (such as wallets and exchanges) to prepare. A Fork’s Final Outcome cannot be Disputed.
Every Augur Market and all REP tokens exist in some Universe. REP tokens can be used to Report on Outcomes (and thus earn fees) only for Markets that exist in the same Universe as the REP tokens. When Augur first launches all Markets and all REP will exist together in a Genesis Universe.
When a Market Forks, new Universes are created. Forking creates a new Child Universe for each possible Outcome of the Forking Market (including the Invalid Outcome). For example, a Yes/No Market has 3 possible Outcomes: A, B, and Invalid. Thus a Yes/No Forking Market will create three new Child Universes: Universe A, Universe B, and Universe Invalid. Initially these newly created Universes are empty: they contain no Markets or REP tokens.
When a Fork is initiated, the Parent Universe becomes permanently Locked. In a Locked Universe, no new Markets may be created. Users may continue trading Shares in Markets in Locked Universes, and Markets in a Locked Universe may still receive their Initial Reports. However, no Reporting rewards are paid out there, and Markets in Locked Universes cannot be Finalized. In order for Markets or REP tokens in the Locked Universe to be useful, they must first be migrated to a Child Universe.
Holders of REP tokens in the Parent Universe may migrate their tokens to a Child Universe of their choice. This choice should be considered carefully, because migration is one-way; it cannot be reversed. Tokens cannot be sent from one sibling Universe to another. Migration is a permanent commitment of REP tokens to a particular Market Outcome. REP tokens that migrate to different Child Universes ought to be considered entirely separate tokens, and exchanges ought to list them as such.
When a Fork is initiated, all REP Staked on all non-Forking Markets is unstaked so that it is free to be migrated to a Child Universe during the Forking Period.
Whichever Child Universe receives the most migrated REP by the end of the Forking Period becomes the Winning Universe, and its corresponding Outcome becomes the Final Outcome of the Forking Market. Un-Finalized Markets in the Parent Universe may be migrated only to the Winning Universe and, if they are un-Finalized and have received an Initial Report, are reset back to the Waiting for the Next Fee Window to Begin Phase.
There is no time limit on migrating tokens from the Parent Universe to a Child Universe. Tokens may be migrated after the Forking Period, but they will not count towards the determination of the Winning Universe. To encourage greater participation during the Forking Period, all token holders who migrate their REP within 60 days of the start of a Fork will receive 5% additional REP in the Child Universe to which they migrated. This reward is paid for by minting new REP tokens.
Reporters that have Staked REP on one of the Forking Market’s Outcomes cannot change their position during a Fork. REP that was Staked on an Outcome in the Parent Universe can be migrated only to the Child Universe that corresponds to that Outcome. For example, if a Reporter helped fulfill a successful Dispute Bond in favor of Outcome A during some previous Dispute Round, then the REP they have Staked on Outcome A can only be migrated to Universe A during a Fork.
Sibling Universes are entirely disjoint. REP tokens that exist in one Universe cannot be used to Report on events or earn rewards from Markets in another Universe. Since users presumably will not want to create or trade on Markets in a Universe whose Oracle is untrustworthy, REP that exists in a Universe that does not correspond to objective reality is unlikely to earn its owner any fees, and therefore should not hold any significant market value.
Therefore, REP tokens migrated to a Universe which does not correspond to objective reality should hold no market value, regardless of whether or not the objectively false Universe ends up being the Winning Universe after a Fork.
Recall from the section on the Dispute Round State that any Stake successfully disputing an Outcome in favor of the Market’s Final Outcome will receive a 50% ROI on their Dispute Stake.
In the event of a Fork, any REP Staked on any of the Market’s false Outcomes should lose all economic value, while any REP Staked on the Market’s true Outcome is rewarded with 50% more REP (via newly minted REP) in the Child Universe that corresponds to the Market’s true Outcome (regardless of the Outcome of the Fork). Therefore, if pushed to a Fork, REP holders who Dispute false Outcomes in favor of true Outcomes will always come out ahead, while REP holders who Staked on false Outcomes will see their REP lose all economic value.
Finalized State
A Market enters the Finalized State (state f in the figure above) if it passes through a 7-day Dispute Round without having its Tentative Outcome successfully Disputed, or after completion of a Fork. The Outcome of a Fork cannot be Disputed and is always considered final at the end of the Forking Period. Once a Market is Finalized, traders can Settle their Positions directly with the Market. When a Market enters the Finalized State, we refer to its chosen Outcome as the Final Outcome.
Designated Reporting Details
During the creation of a Market, a Market Creator must assign a Designated Reporter. Designated Reporting is designed to be a quick way to bring about a Market Resolution. This is pleasing to Traders who want to Settle their Shares and collect their earnings as soon as possible after a Market’s End Time has passed. The Designated Reporting Phase begins immediately following the End Time of a Market. The result of Designated Reporting is still Challengeable with a Dispute Bond so if the Designated Reporter does incorrectly Report the Outcome of the Market, it can be adjudicated by Dispute Rounds. With the dispute system in place, we don’t actually lose any security or truth as an incorrect Tentative Outcome for a Market can be Challenged.
The Designated Reporting Phase lasts a maximum of three (3) days and ends immediately when the Designated Reporter submits their Report and the Tentative Outcome is set for the Market.
If the Designated Reporter fails to Report within the Designated Reporting Phase, the Market Creator forfeits the No-Show Bond, and the Market is moved into the Open Reporting Phase. The No-Show Bond is then used to add to the REP Staked by the First Public Reporter.
If the Designated Reporter does successfully Report within the Designated Reporting Phase, the No-Show Bond is refunded to the Market Creator immediately and the Market enters the Dispute Round Phase, which lasts for seven (7) days. During this 7-day period, any REP holder can Stake REP on an outcome other than the Tentative Outcome and receive a proportionate amount of Participation Tokens in return. The Participation Tokens allow the holder to collect fees at the end of the current Fee Window. The Staked REP goes toward filling the Dispute Bond for the Outcome on which it was Staked. If that outcome gets enough REP Staked on it to fill the Dispute Bond size, that Outcome becomes the new Tentative Outcome, and the Market returns to the Waiting for the Next Fee Window to Begin Phase (or Forks if the Outcome gets more than the Fork Threshold Staked on it). If the Market is left unchallenged for the duration of the Dispute Round Phase, then the Market’s Tentative Outcome becomes the Final Outcome and the Market is considered Finalized, allowing the Settlement of Shares.
Fee Window Details
Fee Windows continually occur and last for seven (7) days. During a Fee Window, any REP holder is able to Stake REP on any Outcome other than the Tentative Outcome. By doing so, they receive an equal number of Participation Tokens in return, and the REP they Stake goes toward to a Dispute Bond to Challenge the Tentative Outcome of the Market. In order to earn fees as a REP holder in the current Fee Window, users need to participate in the Market’s Dispute Round in some way, such as submitting a Designated Report or First Public Report, Disputing the Tentative Outcome (i.e., staking on an outcome other than the Tentative Outcome), or simply purchasing Participation Tokens directly.
Any fees collected by Augur during a given Fee Window are added to a Reporting Fee Pool for that Fee Window. The Reporting Fee Pool is used to reward REP holders who participate in Augur’s reporting process. At the end of the Fee Window, the Reporting Fee Pool is paid out to holders of Participation Tokens in proportion to the Staked REP they hold.
Markets are placed into the next available Fee Window once the Designated Reporter or First Public Reporter submits a Report. For example, if a Market’s Designated Report is submitted at 12:00 AM EST on January 3rd, 2053 and a Fee Window was just started on January 1st 2053, the Market would move into the next Fee Window that would be starting on January 8th, 2053, or 7 days since the start of the January 1st Window.
Any REP holder can participate in a Fee Window. In fact, in some cases, someone without any REP is able to successfully Report on Markets in the Open Reporting Phase. This case only occurs when the Market’s Designated Reporter fails to Report during the Designated Reporting Phase. In this situation, the first person to submit a Report can do so and Stake 0 REP on the Report. This is the true because the No-Show Bond is added to the First Public Reporter’s Stake, so in this case the Stake can be 0 as it will get the bond added to it. (The First Public Reporter must still pay the gas cost to submit the Report.) This creates a race to be the First Public Reporter so as to attempt to get free REP from reporting correctly and earning the No-Show Bond.
API Overview
augur.js is a JavaScript SDK that is the developer-facing component of Augur’s middleware. It is the recommended way to interact with Augur from a custom application, and it can be used to query for information about Augur’s Markets and interact with Augur’s back-end Solidity smart contracts, which can be found in the augur-core repository.
The documentation for augur.js is divided into four sections: the Simplified API, the Call API, the Transaction API, and the Events API. The Simplified API provides general information about Markets within Augur, and many of its functions require a connection to an Augur Node. The Call and Transaction APIs provide direct mappings to Augur’s smart contract functions via the augur.api
object. The Call API uses eth_call
to make “get” requests for information stored on the blockchain. The Transaction API uses eth_sendTransaction
to make “set” requests to the blockchain in order to modify the blockchain’s information in some way, like creating a new Order on the Order Book. The Events API enables listening for certain logged events and searching for them. The Call, Transaction, and Events APIs do not require a connection to an Augur Node. Each of these four components of augur.js is covered in greater detail in their respective sections below.
This API Overview section explains how to add augur.js to a custom application and how to connect it to an Ethereum node and an Augur Node. It also covers how augur.js’ account management works, how numbers should be used in augur.js, how to load and create Markets, and debugging options.
Augur Node
Anyone wishing to query for information about Augur’s markets will need to use the augur.js Simplified API, which requires a connection to an Augur Node for many of its functions. Augur Node is a standalone application that scans the Ethereum blockchain for all Augur event logs and stores them to a SQLite or PostgresSQL database.
Instead of looking up information about Augur-related events directly on the Ethereum blockchain, the Simplified API sends query requests to an Augur Node’s database. This is because looking up information directly on the blockchain can be a slow and difficult process, especially when sorting is required. For example, to run a query for all Markets created by a specific user, sorted by volume and limited to 100 results, would require scanning the blockchain for all Market creation events by that user, saving the results locally, querying each Market to obtain its volume, saving those results locally, and then sorting the Markets created by the user and discarding everything after the first 100 results. This would require a large number of RPC requests and would take a long time to complete.
To alleviate this problem, the Simplified API executes queries by submitting an RPC request to an Augur Node that is either running locally or remotely (hosted). The Augur Node then runs the request against its database and returns the result. This allows queries to be run on Augur much more quickly than would otherwise be possible.
It should be noted that batch RPC calls are not supported yet on incoming requests to Augur Node, and therefore batch RPC calls currently are not supported by augur.js.
To set up a local Augur Node, follow the instructions described in the Augur Node GitHub repository. Once a local Augur Node is running (or if the WebSocket address of a hosted node is known), a connection to it can be established by specifying the WebSocket address as shown by the JavaScript sample code in the Getting Started with augur.js section.
Getting Started with augur.js
// After installing, just require augur.js to use it.
var Augur = require('augur.js');
var augur = new Augur();
var ethereumNode = {
httpAddresses: [
"http://127.0.0.1:8545", // local HTTP address for Geth node
"https://rinkeby.augur.net/ethereum-http" // hosted http address for Geth node on the Rinkeby test network
],
wsAddresses: [
"ws://127.0.0.1:8546", // local WebSocket address for Geth node
"wss://rinkeby.augur.net/ethereum-ws" // hosted WebSocket address for Geth node on the Rinkeby test network
]
// ipc addresses can also be specified as:
// ipcAddresses: [ ... ]
};
// To connect to a hosted Augur Node instead of a local Augur Node, substitute its WebSocket address below.
var augurNode = "ws://127.0.0.1:9001"; // local WebSocket address for an Augur Node
// Attempt to connect to a local Ethereum node
// If that fails, fall back to the hosted Ethereum node
augur.connect({ ethereumNode, augurNode }, function (err, connectionInfo) { /* ... */ });
// example connectionInfo object:
{
augurNode: "ws://127.0.0.1:9001",
ethereumNode: {
contracts: {
Controller: "0xb1772d9e581e5a245ff429cca3e06c57d567c58c",
Universe: "0xaa88b74da9e08d44c996f037ce13cb2711053cea",
Augur: "0xdddc5d40979660308e8017d048b04782f17af4af",
OrdersFinder: "0x01f2aba090b5fa26a64ea9e5afd32f6aab6ba3df",
LegacyReputationToken: "0x59c98505653f68e8cc2a0ac1e84380a0393fd04e",
CancelOrder: "0x4c0f599bdd8f9eac10cdfd152c3110ea9b803088",
Cash: "0x5754d0bcb36b7f30999199031d1f323c4079d58d",
ClaimTradingProceeds: "0xe408a58ff3eb050f39728fc45644f64e8e379e3d",
CompleteSets: "0xb51a3aab3d5009f21cd9b47ae856aa780460b78c",
CreateOrder: "0x19ef3d62d49e95e1b92c1fe12986a24a42c4f3c3",
FillOrder: "0x57972b23e4e97cf33b456d292411308b1053d835",
Order: "0x86416fd9eb6ca7797f799ccc2e08a4da4083ac17",
Orders: "0x452cbdba8559a9b0199bb15105a42fc7ae373983",
OrdersFetcher: "0xc9d0126e1aa921056af5981016904690ad73c0d3",
ShareToken: "0x5c8b3117b65af65405980f3700542c03709a6436",
Trade: "0x8d0677ee9f5330fd65db56da6c31711fd6810434",
TradingEscapeHatch: "0x867d606553c3fc24b35e3b02d228dc1647786f88"
},
abi: {
events: { /* ... */ },
functions: { /* ... */ }
},
}
}
The easiest way to install augur.js is using npm:
$ npm install augur.js
Alternatively, this can be done using yarn, as follows:
$ yarn add augur.js
Once augur.js has been installed, it will need to be connected to an Ethereum node and an Augur node. These can be running locally or remotely (hosted).
To connect to the desired Ethereum node and Augur node, call the function augur.connect
as shown to the right. Upon doing so, augur.js will iterate through the list of addresses provided in the ethereumNode
argument and attempt to connect to each one until a successful connection is established or all attempts have failed. The Ethereum node may have multiple HTTP, WebSocket, or IPC addresses specified as arrays. The connection will be chosen automatically based on a preference of IPC > WS > HTTP. Note: if there is a global web3
object present, such as that injected by MetaMask, that global web3
will be automatically used in preference to any other connections available. So, if you’re using MetaMask, make sure it’s connected to the right network!
Similarly, augur.js will attempt to use the augurNode
parameter to connect to an Augur Node. However, augurNode
may only be specified as a single-address string, not as an object containing an array of addresses.
The Augur development team hosts Augur Nodes and Ethereum nodes on the Ethereum test networks. The addresses for these hosted nodes are as follows:
dev.augur.net Augur Node (WSS): wss://dev.augur.net/augur-node
dev.augur.net Ethereum Node (HTTPS): https://rinkeby.augur.net/ethereum-http
dev.augur.net Ethereum Node (WSS): wss://rinkeby.augur.net/ethereum-ws
Kovan Augur Node (WSS): Must connect to a locally-running augur-node (e.g., ws://127.0.0.1:9001)
Kovan Ethereum Node (HTTPS): https://kovan.augur.net/ethereum-http
Kovan Ethereum Node (WSS): wss://kovan.augur.net/ethereum-ws
Rinkeby Augur Node (WSS): wss://rinkeby.augur.net/augur-node
Rinkeby Ethereum Node (HTTPS): https://rinkeby.augur.net/ethereum-http
Rinkeby Ethereum Node (WSS): wss://rinkeby.augur.net/ethereum-ws
Ropsten Augur Node (WSS): Must connect to a locally-running augur-node (e.g., ws://127.0.0.1:9001)
Ropsten Ethereum Node (HTTPS): https://ropsten.augur.net/ethereum-http
Ropsten Ethereum Node (WSS): wss://ropsten.augur.net/ethereum-ws
srt.augur.net Augur Node (WSS): Must connect to a locally-running augur-node (e.g., ws://127.0.0.1:9001)
srt.augur.net Ethereum Node (HTTPS): https://srt.augur.net/ethereum-http
srt.augur.net Ethereum Node (WSS): wss://srt.augur.net/ethereum-ws
The Augur development team does not host any Augur Nodes or Ethereum nodes for the Ethereum main network. However, a list of these nodes that are hosted by trusted community members can be found at https://predictions.global/augur-public-ethereum-nodes.
In the example on the right, the first connection that will be tried is http://127.0.0.1:8545
, which is a local Ethereum node being run using the Geth client. If a connection to the local Geth node cannot be established, the next provided address will be tried. In this case, we have provided a single hosted node on the Ethereum Rinkeby test network (rinkeby.ethereum.nodes.augur.net
) as another attempt to make after the local Geth node. If a connection is successfully established, then the vitals
object will be returned; otherwise an error message will be returned.
It should be noted that Augur’s back-end Solidity smart contracts are deployed from the perspective of augur.js, which means that augur.js contains a list of Augur’s smart contract addresses in the file augur.js/src/contracts/addresses.json
.
The each group of addresses in the file maps to an Ethereum network ID or to the network ID of a local Ethereum node in a Docker image:
- 1 - Main network
- 3 - Ropsten test network
- 4 - Rinkeby test network
- 19 - Thunder network
- 42 - Kovan test network
- 101 - Network ID for a local node (used when running Docker image
dev-node-geth
in augur.js) - 102 - Network ID for local node (used when running Docker image
dev-pop-geth
in augur.js) - 103 - Network ID for local node (used when running Docker image
dev-pop-normtime-geth
in augur.js) - 104 - Network ID for local node (used when running Docker image
dev-pop-geth-45
in augur.js) - 8995 - Network ID for local node (used when running Docker image
dev-node-parity
in augur.js)
The file augur.js/src/contracts/addresses.json
is generated by the script augur-core/source/libraries/ContractCompiler.ts
in the augur-core repository.
Augur’s smart contract ABIs are generated and output to augur-core/output/contracts/abi.json
in the augur-core repository by the script augur-core/source/libraries/ContractCompiler.ts
. For further details on Augur’s smart contracts and their compiling/deployment process, please refer to the README file in the augur-core repository.
Numbers
It is strongly recommended that all numerical input values be passed into Call API functions and Transaction API functions as hexadecimal strings. This is because these API functions are direct bindings to the functions on Augur’s smart contracts, and passing in very large numbers in decimal form can result in the functions on Augur’s smart contracts failing.
The Simplified API functions, however, automatically convert numerical input values to hexadecimal form before passing them into Augur’s smart contracts.
For the Simplified API, there are three acceptable ways to pass numerical inputs:
primitive JS numbers (e.g.,
1010101
): ok for integers, but use strings for floating point numbers (see below)stringified numbers (e.g.,
"1010101"
)hexadecimal strings (e.g.,
"0xf69b5"
)
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:
broadcast
- When set to true, this enables printing of verbose, low-level information related to sending/receiving transactions, such as the transaction JSON that gets sent out over the wire, incoming eth_subscription messages, etc.connect
- When set to true, this enables printing of the result of the initial connection of ethrpc to the underlying Ethereum node, as well as which endpoints are connected, on which protocolstx
- When set to true, this enables printing of information related to transaction construction/submission/confirmation. This information includes the intermediate “transaction” object with human-readable parameters, the (best-guess) return value fetched from the follow-up eth_call when a transaction gets resubmitted, and the transaction hash once the transaction is submitted.
Simplified API
Accounts Functions
// Accounts Simplified API Examples:
augur.accounts.approveAugur({
address: "0x0000000000000000000000000000000000000b0b",
meta: {
accountType: "privateKey",
address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
},
onSent: function(result) { console.log(result); },
onSuccess: function(result) { console.log("Approval was successful."); },
onFailed: function(result) { console.log("Approval failed due to error:", result); }
});
// example output:
"Approval was successful."
augur.accounts.getAccountTransferHistory({
account: "0x0000000000000000000000000000000000000b0b",
token: null,
isSortDescending: false
}, function (error, result) {
console.log(result);
});
// example output:
[
{
transactionHash: "0x00000000000000000000000000000000000000000000000000000000deadbeef",
logIndex: 0,
creationBlockNumber: 1400000,
blockHash: "0x1400000",
creationTime: 1506473474,
sender: " 0x0000000000000000000000000000000000000b0b",
recipient: " 0x000000000000000000000000000000000000d00d",
token: " 0x0100000000000000000000000000000000000000",
value: "10",
symbol: "shares",
marketId: " 0x0000000000000000000000000000000000000001",
outcome: 0,
isInternalTransfer: 0,
},
{
transactionHash: "0x00000000000000000000000000000000000000000000000000000000d3adb33f",
logIndex: 0,
creationBlockNumber: 1400001,
blockHash: "0x1400001",
creationTime: 1506473500,
sender: " 0x000000000000000000000000000000000000d00d",
recipient: " 0x0000000000000000000000000000000000000b0b",
token: " 0x0100000000000000000000000000000000000000",
value: "2",
symbol: "shares",
marketId: " 0x0000000000000000000000000000000000000001",
outcome: 0,
isInternalTransfer: 1,
},
{
transactionHash: "0x00000000000000000000000000000000000000000000000000000000deadb33f",
logIndex: 1,
creationBlockNumber: 1400001,
blockHash: "0x1400001",
creationTime: 1506473500,
sender: " 0x0000000000000000000000000000000000000b0b",
recipient: " 0x000000000000000000000000000000000000d00d",
token: " 0x7a305d9b681fb164dc5ad628b5992177dc66aec8",
value: "47",
symbol: "REP",
marketId: null,
outcome: null,
isInternalTransfer: 0,
}
]
augur.accounts.approveAugur(p)
Internally, Augur uses an ERC-20 token called Cash as a wrapper for ETH. Many of Augur’s transactions require Augur to be able to spend Cash on behalf of the account executing the transaction. However, the account must first approve Augur to spend that amount of Cash on its behalf. This function calls the function augur.api.Cash.approve
to approve Augur to spend up to augur.constants.ETERNAL_APPROVAL_VALUE
Cash on behalf of the account. augur.constants.ETERNAL_APPROVAL_VALUE
is equal to 2^256 - 1, or the maximum amount of Cash that can be approved. This value is used so that augur.api.Cash.approve
does not have to be called multiple times in order to execute multiple transactions.
Parameters:
p
(Object) Parameters object.p.address
(string) Ethereum address of the account making the approval.p.meta
(Meta) <optional> Authentication metadata for raw transactions.p.onSent
(function) Called if/when the transaction is broadcast to the network.p.onSuccess
(function) Called if/when the transaction is sealed and confirmed.p.onFailed
(function) Called if/when the transaction fails.
Returns:
- Does not return a value.
augur.accounts.getAccountTransferHistory(p, callback)
Returns the token transfers made to or from a specific Ethereum address.
This function will fail if:
- A connection to an Augur Node has not been established.
Parameters:
p
(Object) Parameters object.p.account
(string) Ethereum address of the account for which to get transfer history, as a 20-byte hexadecimal string.p.token
(string) <optional> Contract address of the token contract by which to limit the history results, as a 20-byte hexadecimal string.isInternalTransfer
(boolean) <optional> When set totrue
, only trade/order transfers will be returned; otherwise, all transfers for the account are returned. (This is not perfectly accurate, as it is possible for a trade and a non-trade/order-related transfer to appear in the same transaction. This can occur if done via a smart contract, which performs a standard transfer and a trade in the same transaction.) Defaults tofalse
.p.earliestCreationTime
(number) <optional> Earliest timestamp, in seconds, at which to truncate history results. (This timestamp is when the block on the Ethereum blockchain containing the transfer was created.)p.latestCreationTime
(number) <optional> Latest timestamp, in seconds, at which to truncate history results. (This timestamp is when the block on the Ethereum blockchain containing the transfer was created.)p.sortBy
(string) <optional> Field name by which to sort transfer history.p.isSortDescending
(boolean) <optional> Whether to sort transfers in descending order by sortBy field.p.limit
(number) <optional> Maximum number of transfers to return.p.offset
(number) <optional> Number of transfers to truncate from the beginning of the history results.
callback
(function) Called after the account transfer history has been retrieved.
Returns:
- (Array.<AccountTransfer>) Array representing the account’s transfer history.
Assets Functions
// Assets Simplified API Examples:
augur.assets.sendEther({
etherToSend: "0.001",
from: "0x8fa56abe36d8dc76cf85fecb6a3026733e0a12ac",
to: "0x40485264986740c8fb3d11e814bd94cf86012d29",
meta: {
accountType: "privateKey",
address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
},
onSent: function(result) { console.log(result); },
onSuccess: function(result) { console.log(result); },
onFailed: function(result) { console.log(result); }
});
augur.assets.sendReputation({
universe: "0x1f732847fbbcc46ffe859f28e916d993b2b08831",
reputationToSend: "0.001",
_to: "0x40485264986740c8fb3d11e814bd94cf86012d29",
meta: {
accountType: "privateKey",
address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
},
onSent: function(result) { console.log(result); },
onSuccess: function(result) { console.log(result); },
onFailed: function(result) { console.log(result); }
});
augur.assets.sendEther(p)
Sends Ether to a specified Ethereum address.
Parameters:
p
(Object) Parameters object.p.etherToSend
(string) Amount of Ether to send, as a base-10 string.p.from
(string) Ethereum address of the sender, as a 20-byte hexadecimal string.p.to
(string) Ethereum address of the recipient, as a 20-byte hexadecimal string.p.meta
(Meta) <optional> Authentication metadata for raw transactions.p.onSent
(function) Called if/when the transaction is broadcast to the network.p.onSuccess
(function) Called if/when the transaction is sealed and confirmed.p.onFailed
(function) Called if/when the transaction fails.
Returns:
- Return value cannot be obtained because Ethereum nodes discard transaction return values.
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:
p
(Object) Parameters object.p.universe
(string) The universe of Reputation to use.p.reputationToSend
(string) Amount of Reputation to send, as a base-10 string.p._to
(string) Ethereum address of the recipient, as a 20-byte hexadecimal string.p.meta
(Meta) <optional> Authentication metadata for raw transactions.p.onSent
(function) Called if/when the transaction is broadcast to the network.p.onSuccess
(function) Called if/when the transaction is sealed and confirmed.p.onFailed
(function) Called if/when the transaction fails.
Returns:
- Return value cannot be obtained because Ethereum nodes discard transaction return values.
Augur Node Functions
// Augur Node Simplified API Examples:
augur.augurNode.connect(
"ws://127.0.0.1:9001",
function(error, wsTransport) {
if (error) {
console.log(error);
} else {
console.log("Connected to Augur Node!");
console.log("WebSocket transport:");
console.log(wsTransport);
}
}
);
// example output:
"Connected to Augur Node!"
"WebSocket transport:"
{
address: "ws://127.0.0.1:9001",
awaitingPump: false,
backoffMilliseconds: 1,
connected: true,
disconnectListeners: { ... },
maxRetries: 0,
messageHandler: ƒ dispatchJsonRpcResponse(err, jsonRpcResponse),
nextListenerToken: 1,
reconnectListeners: { ... },
timeout: 100,
webSocketClient: { ... }
workQueue: [],
}
augur.augurNode.disconnect();
// This function does not return a value.
augur.augurNode.getSyncData(
function(error, result) {
console.log(result);
}
);
// example output:
{
addresses: {
Controller: "0x392be0a9d1ab1bde2931c2ddf1d722f9e13b6085",
Universe: "0x1f732847fbbcc46ffe859f28e916d993b2b08831",
Augur: "0x852684b374fe03ab77d06931f1b2831028fd58f5",
OrdersFinder: "0x01f2aba090b5fa26a64ea9e5afd32f6aab6ba3df",
LegacyReputationToken: "0x097c198dcc997086d1555ad9ae6f52375cfb58d0",
CancelOrder: "0x389c0b3f0d51cfba9e4d214712a1142f5685814d",
Cash: "0xd2ee83a8a2a904181ccfddd8292f178614062aa0",
ClaimTradingProceeds: "0x8aa774927fb928ee1df0d0d3f94c8217658e0bce",
CompleteSets: "0xbf749b00e42751dba8e0872e66d3ba854f6c2632",
CreateOrder: "0xdadc071ecc3b7e97b139d2ef692defdc398c8211",
FillOrder: "0x0c77f6af7b3b5fed8ca980414a97c62da283098a",
Order: "0x4811d582f64e68e657bec21834012af38ef093bc",
Orders: "0x1ba5cf0ce546bf7d7943c4d4fb21ea59f6bb0eee",
OrdersFetcher: "0xb9f2cf78542de87ba7542d92e2937d0eedec5feb",
ShareToken: "0x925bee44fec28deb228d2251e1a9d32f7c73ebed",
Trade: "0x0dec7fd04933b8673cef99b64978113065b03926",
TradingEscapeHatch: "0x157a8998f5470a2be3917aab31d334109f56c30c"
},
augurNodeVersion: "7.1.5",
highestBlock: {
hash: "0x9c1a28be182d755a053f4efe35f04558a318ea6ea925f827a7de8a30d5d23f58",
number: 10019,
timestamp: 1531977999,
},
isSyncFinished: true,
lastProcessedBlock: {
hash: "0x2dd3a600f9678a8a57b320e00b483502feb0d75977c10f0ec02ba86d6c455dab",
number: 10013,
timestamp: 1530856121,
},
netId: "102",
net_version: "102",
version: "6.1.4",
}
augur.augurNode.submitRequest(
"getMarkets",
{
universe: "0x02149d40d255fceac54a3ee3899807b0539bad60",
search: "category: Ethereum OR tags: ETH"
},
function(error, result) {
console.log(result);
}
);
// example output:
[
"0x98c189f9254b5729eb870688f812b83ebd116798",
"0xa47f967c4806d34859ec93013be5ebc4d68f3a64",
"0xfa26157e03f05ca681997e63db25af1a95239243"
]
augur.augurNode.subscribeToEvent(
"TokensTransferred",
function(error, result) {
console.log(error);
console.log(result);
console.log("Tokens transferred!");
},
function(error, subscriptionId) {
console.log("Subscribed to event! Subscription ID:", subscriptionId);
}
);
// example output:
"Subscribed to event! Subscription ID: 8cac9a4b-f5b8-4fb1-be50-5aa16dc99e67"
augur.augurNode.unsubcribeFromEvent(
"8cac9a4b-f5b8-4fb1-be50-5aa16dc99e67",
function(error) {
if (!error) {
console.log("Unsubscribe successful!");
}
}
);
// example output:
"Unsubscribed from 8cac9a4b-f5b8-4fb1-be50-5aa16dc99e67"
"Unsubscribe successful!"
augur.augurNode.unsubscribeFromAllEvents(
function() {
console.log("Unsubscribed from all events!");
}
);
// example output:
"Unsubscribed from 32a81c04-8b35-47fa-a6d0-b12a34145108"
"Unsubscribed from a6354b5d-64a7-49db-acd9-ff56dcc54b4d"
"Unsubscribed from all events!"
augur.augurNode.connect(augurNodeUrl, callback)
Establishes a connection to an Augur Node.
Parameters:
augurNodeUrl
(string) WebSocket URL of an Augur Node to connect to.callback
(function) Called after attempting to connect to an Augur Node.
Returns:
- (WsTransport) WebSocket transfer object containing information about the WebSocket connection to the Augur Node.
augur.augurNode.disconnect()
Disconnects augur.js from the Augur Node it is currently connected to. (To disconnect from the Ethereum node it is currently connected to, use augur.disconnect
.)
Parameters:
- This function does not accept any parameters.
Returns:
- This function does not return a value.
augur.augurNode.getContractAddresses(callback)
This function has been deprecated in favor of augur.augurNode.getSyncData
.
augur.augurNode.getSyncData(callback)
Returns the version and contract address set from an Augur Node. Also returns information about the highest blockchain block and the last processed blockchain block.
This function will fail if:
- A connection to an Augur Node has not been established.
Parameters:
callback
(function) Called after the Augur Node information has been retrieved.
Returns:
- (SyncData) An object containing the information from Augur Node.
augur.augurNode.submitRequest(method, params, callback)
Submits an RPC request to an Augur Node.
This function will fail if:
- A connection to an Augur Node has not been established.
Parameters:
method
(string) Method name to call.params
(Object) Parameters to pass intomethod
.callback
(function) Called once the Augur Node responds to the RPC request.
Returns:
- (Data type can vary based on the method being called.) Result from the RPC request.
augur.augurNode.subscribeToEvent(eventName, subscriptionCallback, onComplete)
Listens to an Augur Node for when a specific event occurs.
This function will fail if:
- A connection to an Augur Node has not been established.
Parameters:
eventName
(string) Type of event to listen for.subscriptionCallback
(function) Called whenever the Augur Node detects a new occurrence of the specified event.onComplete
(function) Called after attempting to set up the subscription to listen on the Augur Node.
Returns:
- (string) ID of the subscription that was created.
augur.augurNode.unsubscribeFromEvent(subscriptionId, callback)
Stops the specified subscription from listening on an Augur Node.
This function will fail if:
- A connection to an Augur Node has not been established.
Parameters:
subscriptionId
(string) Subscription ID to stop listening.callback
(function) Called after attempting to stop the subscription from listening on the Augur Node.
Returns:
- This function does not return a value.
augur.augurNode.unsubscribeFromAllEvents(callback)
Stops the current subscriptions from listening on an Augur Node.
This function will fail if:
- A connection to an Augur Node has not been established.
Parameters:
callback
(function) Called after attempting to stop all subscriptions from listening on the Augur Node.
Returns:
- This function does not return a value.
Connect Function
// Connect Simplified API Examples:
augur.connect({
ethereumNode: {
httpAddresses: [
"http://127.0.0.1:8545", // local HTTP address for Geth node
"https://rinkeby.ethereum.nodes.augur.net" // hosted HTTP address for Geth node on the Ethereum Rinkeby test network
],
wsAddresses: [
"ws://127.0.0.1:8546", // local WebSocket address for Geth node
"wss://ws9000.augur.net" // hosted WebSocket address for Geth node
]
},
augurNode: "ws://127.0.0.1:9001" // local WebSocket address for an Augur Node
}, function (error, connectionInfo) {
console.log(connectionInfo);
});
// example output:
connecting to augur-node: ws://127.0.0.1:9001
connecting to ethereum-node: {"httpAddresses":["http://127.0.0.1:8545","https://rinkeby.ethereum.nodes.augur.net"],"wsAddresses":["ws://127.0.0.1:8546","wss://websocket-rinkeby.ethereum.nodes.augur.net"]}
connected to augur
Web3: not connected
Sync: http://127.0.0.1:8545
HTTP: http://127.0.0.1:8545
WS: ws://127.0.0.1:8546
IPC: not connected
connected to ethereum
{
augurNode: "ws://127.0.0.1:9001",
ethereumNode: {
abi: { ... },
blockNumber: "0x184e24",
coinbase: "0x40485264986740c8fb3d11e814bd94cf86012d29",
contracts: { ... },
gasPrice: 20000000000,
networkId: "4"
rpc: { ... }
}
}
augur.disconnect();
// This function does not return a value.
augur.connect(connectOptions, callback)
Connects augur.js to an Ethereum node and an Augur Node.
Parameters:
connectOptions
(ConnectOptions) Options used to connect to an Ethereum node and an Augur Node.callback
(function) <optional> Callback function.
Returns:
- (Object) Transport object containing information about the Augur Node and Ethereum node connections.
augur.disconnect()
Disconnects augur.js from the Ethereum node it is currently connected to. (To disconnect from the Augur Node it is currently connected to, use augur.augurNode.disconnect
.)
Parameters:
- This function does not accept any parameters.
Returns:
- This function does not return a value.
Create Market Functions
// Create Market Simplified API Examples:
var _extraInfo = {
resolutionSource: "https://www.espn.com",
tags: ["college football", "football"],
outcomeNames: ["Georgia", "Florida"],
longDescription: ""
};
augur.createMarket.createCategoricalMarket({
universe: "0x1f732847fbbcc46ffe859f28e916d993b2b08831",
_endTime: 1540875600,
_feePerEthInWei: 1193046,
_denominationToken: "0xd2ee83a8a2a904181ccfddd8292f178614062aa0",
_designatedReporterAddress: "0x01114f4bda09ed6c6715cf0baf606b5bce1dc96a",
_outcomes: ["outcome1","outcome2"],
_topic: "sports",
_description: "Who will win the University of Georgia vs. University of Florida football game in 2018?",
_extraInfo: JSON.stringify(_extraInfo),
meta: {
accountType: "privateKey",
address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
},
onSent: function (result) { console.log(result); },
onSuccess: function (result) { console.log(result); },
onFailed: function (result) { console.log(result); }
});
// example onSuccess output:
{
"callReturn": "0xc841ee153e45e74074eae9685e815d08dee965eb",
"blockHash": "0xf5aab811242a73fe433995fdf2212548385b81acef4d6e5634faec74014f39df",
"blockNumber": 1657080,
"from": "0x8fa56abe36d8dc76cf85fecb6a3026733e0a12ac",
"gas": "0x5b8d80",
"gasPrice": "0x1a13b8600",
"hash": "0xb55fa7c2e9d43fc9d11badb33f1d571539859059bdd7447594748733b112f7d2",
"input": "0x59381d2e000000000000000000000000000000000000000000000000000000005c2aad7f0000000000000000000000000000000000000000000000000000000000123456000000000000000000000000d2ee83a8a2a904181ccfddd8292f178614062aa00000000000000000000000008fa56abe36d8dc76cf85fecb6a3026733e0a12ac73746f636b73000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000000000000000000004d57696c6c2074686520446f77204a6f6e657320496e647573747269616c2041766572616765206578636565642032372c30303020617420616e7920706f696e7420647572696e6720323031383f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000085227b5c227265736f6c7574696f6e536f757263655c223a5c2268747470733a2f2f7777772e6d61726b657477617463682e636f6d2f696e76657374696e672f696e6465782f646a69615c222c5c22746167735c223a5b5c2253746f636b735c222c5c22444a49415c225d2c5c226c6f6e674465736372697074696f6e5c223a5c225c227d22000000000000000000000000000000000000000000000000000000",
"nonce": "0x43",
"to": "0x1f732847fbbcc46ffe859f28e916d993b2b08831",
"transactionIndex": "0x0",
"value": "0xa8c0ff92d4c000",
"v": "0x2b",
"r": "0x256cedf5b3ef2f49f6eef99d10ca53ba0484da0e9cbf4434bb3042f90fb376de",
"s": "0x4161413a76a41468272e85ea7af8362393ea886f743b9882f42bea39fc6ec0b9",
"timestamp": 1516925924,
"gasFees": "0.022312465"
}
var _extraInfo = {
resolutionSource: "https://forecast.weather.gov",
tags: ["San Francisco", "weather"],
longDescription: "",
_scalarDenomination: "degrees Fahrenheit",
};
augur.createMarket.createScalarMarket({
universe: "0x1f732847fbbcc46ffe859f28e916d993b2b08831",
_endTime: 1530507600,
_feePerEthInWei: 1193046,
_denominationToken: "0xd2ee83a8a2a904181ccfddd8292f178614062aa0",
_designatedReporterAddress: "0x01114f4bda09ed6c6715cf0baf606b5bce1dc96a",
_minPrice: -10,
_maxPrice: 120,
_numTicks: 10,
_topic: "temperature",
_description: "High temperature (in degrees Fahrenheit) in San Francisco, California, on July 1, 2018",
_extraInfo: JSON.stringify(_extraInfo),
meta: {
accountType: "privateKey",
address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
},
onSent: function (result) { console.log(result); },
onSuccess: function (result) { console.log(result); },
onFailed: function (result) { console.log(result); }
});
// example onSuccess output:
{
"callReturn": "0x008f89903707dbaaed3c42202ec00a94673e96db",
"blockHash": "0xfbb0b8ced5dab79a5ef58dd0eb45c28e5124832e5c27c0479ea8d6947fef4ed2",
"blockNumber": 1657371,
"from": "0x8fa56abe36d8dc76cf85fecb6a3026733e0a12ac",
"gas": "0x5b8d80",
"gasPrice": "0x4a817c800",
"hash": "0x7f52926eac45ec6483cc19b5da795b7425fd3caf191c3eeb208627f4ea0e43b9",
"input": "0x72d61dfa000000000000000000000000000000000000000000000000000000005b39b1500000000000000000000000000000000000000000000000000000000000123456000000000000000000000000d2ee83a8a2a904181ccfddd8292f178614062aa00000000000000000000000008fa56abe36d8dc76cf85fecb6a3026733e0a12acffffffffffffffffffffffffffffffffffffffffffffffff7538dcfb761800000000000000000000000000000000000000000000000000068155a43676e00000000000000000000000000000000000000000000000000000000000000013d62074656d7065726174757265000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000001c00000000000000000000000000000000000000000000000000000000000000056486967682074656d70657261747572652028696e20646567726565732046616872656e686569742920696e2053616e204672616e636973636f2c2043616c69666f726e69612c206f6e204a756c7920312c203230313800000000000000000000000000000000000000000000000000000000000000000000000000000000007a227b5c227265736f6c7574696f6e536f757263655c223a5c22687474703a2f2f666f7265636173742e776561746865722e676f765c222c5c22746167735c223a5b5c2253616e204672616e636973636f5c222c5c22776561746865725c225d2c5c226c6f6e674465736372697074696f6e5c223a5c225c227d22000000000000",
"nonce": "0x45",
"to": "0x1f732847fbbcc46ffe859f28e916d993b2b08831",
"transactionIndex": "0x0",
"value": "0xa8c0ff92d4c000",
"v": "0x2b",
"r": "0xa8dee275a834a3dc9b2f36c0f7bb9564557d6943623013d772b966ce7045e029",
"s": "0x14355beeb51c6565f923e2f2e4133261765cc6357a3d8038b18a4d25e874fec8",
"timestamp": 1516930289,
"gasFees": "0.0618542"
}
var _extraInfo = {
resolutionSource: "https://www.nasdaq.com/symbol/msft",
tags: [ "Stocks", "Microsoft" ],
longDescription: ""
};
augur.createMarket.createYesNoMarket({
universe: "0x1f732847fbbcc46ffe859f28e916d993b2b08831",
_endTime: 1546300799,
_feePerEthInWei: 1193046,
_denominationToken: "0xd2ee83a8a2a904181ccfddd8292f178614062aa0",
_designatedReporterAddress: "0x01114f4bda09ed6c6715cf0baf606b5bce1dc96a",
_topic: "stocks",
_description: "Will Microsoft stock (MSFT) be below $50 at any point during 2018?",
_extraInfo: JSON.stringify(_extraInfo),
meta: {
accountType: "privateKey",
address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
},
onSent: function (result) { console.log(result); },
onSuccess: function (result) { console.log(result); },
onFailed: function (result) { console.log(result); }
});
// example onSuccess output:
{
"callReturn": "0xc841ee153e45e74074eae9685e815d08dee965eb",
"blockHash": "0xf5aab811242a73fe433995fdf2212548385b81acef4d6e5634faec74014f39df",
"blockNumber": 1657080,
"from": "0x8fa56abe36d8dc76cf85fecb6a3026733e0a12ac",
"gas": "0x5b8d80",
"gasPrice": "0x1a13b8600",
"hash": "0xb55fa7c2e9d43fc9d11badb33f1d571539859059bdd7447594748733b112f7d2",
"input": "0x59381d2e000000000000000000000000000000000000000000000000000000005c2aad7f0000000000000000000000000000000000000000000000000000000000123456000000000000000000000000d2ee83a8a2a904181ccfddd8292f178614062aa00000000000000000000000008fa56abe36d8dc76cf85fecb6a3026733e0a12ac73746f636b73000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000000000000000000004d57696c6c2074686520446f77204a6f6e657320496e647573747269616c2041766572616765206578636565642032372c30303020617420616e7920706f696e7420647572696e6720323031383f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000085227b5c227265736f6c7574696f6e536f757263655c223a5c2268747470733a2f2f7777772e6d61726b657477617463682e636f6d2f696e76657374696e672f696e6465782f646a69615c222c5c22746167735c223a5b5c2253746f636b735c222c5c22444a49415c225d2c5c226c6f6e674465736372697074696f6e5c223a5c225c227d22000000000000000000000000000000000000000000000000000000",
"nonce": "0x43",
"to": "0x1f732847fbbcc46ffe859f28e916d993b2b08831",
"transactionIndex": "0x0",
"value": "0xa8c0ff92d4c000",
"v": "0x2b",
"r": "0x256cedf5b3ef2f49f6eef99d10ca53ba0484da0e9cbf4434bb3042f90fb376de",
"s": "0x4161413a76a41468272e85ea7af8362393ea886f743b9882f42bea39fc6ec0b9",
"timestamp": 1516925924,
"gasFees": "0.022312465"
}
augur.createMarket.getMarketCreationCost({
universe: "0x1f732847fbbcc46ffe859f28e916d993b2b08831",
}, function (error, result) {
console.log(result);
});
// example output:
{
designatedReportNoShowReputationBond: "0.174840291341145834",
etherRequiredToCreateMarket: "0.025"
}
augur.createMarket.getMarketCreationCostBreakdown({
universe: "0x1f732847fbbcc46ffe859f28e916d993b2b08831",
}, function (error, result) {
console.log(result);
});
// example output:
{
designatedReportNoShowReputationBond: "0.174840291341145834",
validityBond: "0.01",
}
augur.createMarket.getMarketFromCreateMarketReceipt(
"0xa50c02cf3de82139fc6f66a9c1726f59b93b4a94725bddbf9ecae0c38edc4f06",
function (error, result) {
console.log(result);
}
);
// example output:
"0x5e05e281a4564077985debdb91159a825a6774d3"
augur.createMarket.createCategoricalMarket(p)
Creates a Categorical Market in a specified Universe. This function will trigger a MarketCreated
event and TokensTransferred
event if the Market is created successfully.
This transaction will fail if:
p._outcomes
contains fewer than 2 outcomes or more than 8 outcomes.p._designatedReporterAddress
is set to the null address.p._feePerEthInWei
is greater than the maximum fee (0.5 ETH).p._endTime
has already passed.- The Universe is Forking.
NOTE: The account attempting to create the new market must have sufficient REP in order for the market to be created. This is also true when calling eth_estimateGas
, which essentially does a trial run of the transaction to determine what the gas cost would be to actually run it.
Parameters:
p
(Object) Parameters object.p.universe
(string) Universe in which to create a Categorical Market.p._endTime
(number) Categorical Market expiration timestamp, in seconds.p._feePerEthInWei
(string) <optional> Amount of wei per ether settled that goes to the Market Creator, as a base-10 string.p._denominationToken
(string) Ethereum address of the token used as this Market’s currency.p._designatedReporterAddress
(string) Ethereum address of this Market’s Designated Reporter.p._outcomes
(Array.<string>) Array of names for all possible outcomes for the Market event.p._topic
(string) The topic (category) to which this Market belongs, as a UTF8 string. Note: This string is limited to 32-characters.p._description
(string) Description of the Market, as a UTF8 string.p._extraInfo
(ExtraInfo) <optional> Extra info which will be converted to JSON and logged to the chain in theMarketCreated
event.p.meta
(Meta) <optional> Authentication metadata for raw transactions.p.onSent
(function) Called if/when the createCategoricalMarket transaction is broadcast to the network.p.onSuccess
(function) Called if/when the createCategoricalMarket transaction is sealed and confirmed.p.onFailed
(function) Called if/when the createCategoricalMarket transaction fails.
Returns:
- (Object) Object containing information about the Market creation transaction. The
callReturn
property of this object contains the Ethereum address of the Market that was created.
augur.createMarket.createScalarMarket(p)
Creates a Scalar Market in a specified Universe. This function will trigger a MarketCreated
event and TokensTransferred
event if the Market is created successfully.
This transaction will fail if:
p._designatedReporterAddress
is set to the null address.p._numTicks
is less than 2.p._feePerEthInWei
is greater than the maximum fee (0.5 ETH).p._endTime
has already passed.- The Universe is Forking.
NOTE: The account attempting to create the new market must have sufficient REP in order for the market to be created. This is also true when calling eth_estimateGas
, which essentially does a trial run of the transaction to determine what the gas cost would be to actually run it.
Parameters:
p
(Object) Parameters object.p.universe
(string) Universe in which to create this market.p._endTime
(number) Market expiration timestamp, in seconds.p._feePerEthInWei
(string) <optional> Amount of wei per ether settled that goes to the Market Creator, as a base-10 string.p._denominationToken
(string) Ethereum address of the token used as this Market’s currency.p._minPrice
(string) Minimum display (non-normalized) price for this Market, as a base-10 string.p._maxPrice
(string) Maximum display (non-normalized) price for this Market, as a base-10 string.p._designatedReporterAddress
(string) Ethereum address of this Market’s Designated Reporter.p._topic
(string) The topic (category) to which this Market belongs, as a UTF8 string. Note: This string is limited to 32-characters.p._description
(string) Description of the Market, as a UTF8 string.p.tickSize
(string) <optional> The Tick size for this Market, as a base-10 string.p._extraInfo
(ExtraInfo) <optional> Extra info which will be converted to JSON and logged to the chain in theMarketCreated
event.p.meta
(Meta) <optional> Authentication metadata for raw transactions.p.onSent
(function) Called if/when the createScalarMarket transaction is broadcast to the network.p.onSuccess
(function) Called if/when the createScalarMarket transaction is sealed and confirmed.p.onFailed
(function) Called if/when the createScalarMarket transaction fails.
Returns:
- (Object) Object containing information about the Market creation transaction. The
callReturn
property of this object contains the Ethereum address of the Market that was created.
augur.createMarket.createYesNoMarket(p)
Creates a Yes/No Market in a specified Universe. This function will trigger a MarketCreated
event and TokensTransferred
event if the Market is created successfully.
This transaction will fail if:
p._designatedReporterAddress
is set to the null address.p._feePerEthInWei
is greater than the maximum fee (0.5 ETH).p._endTime
has already passed.- The Universe is Forking.
NOTE: The account attempting to create the new market must have sufficient REP in order for the market to be created. This is also true when calling eth_estimateGas
, which essentially does a trial run of the transaction to determine what the gas cost would be to actually run it.
Parameters:
p
(Object) Parameters object.p.universe
(string) Universe in which to create a Yes/No Market.p._endTime
(number) Yes/No Market expiration timestamp, in seconds.p._feePerEthInWei
(string) <optional> Amount of wei per ether settled that goes to the Market Creator, as a base-10 string.p._denominationToken
(string) Ethereum address of the token used as this Market’s currency.p._designatedReporterAddress
(string) Ethereum address of this Market’s Designated Reporter.p._topic
(string) The topic (category) to which this Market belongs, as a UTF8 string. Note: This string is limited to 32-characters.p._description
(string) Description of the Market, as a UTF8 string.p._extraInfo
(ExtraInfo) <optional> Extra info which will be converted to JSON and logged to the chain in theMarketCreated
event.p.meta
(Meta) <optional> Authentication metadata for raw transactions.p.onSent
(function) Called if/when the createYesNoMarket transaction is broadcast to the network.p.onSuccess
(function) Called if/when the createYesNoMarket transaction is sealed and confirmed.p.onFailed
(function) Called if/when the createYesNoMarket transaction fails.
Returns:
- (Object) Object containing information about the Market creation transaction. The
callReturn
property of this object contains the Ethereum address of the Market that was created.
augur.createMarket.getMarketCreationCost(p, callback)
Retrieves the No-Show Bond amount and total Ether required to create a new Market.
Note: This function will send a transaction if needed to create the current Fee Window.
Parameters:
p
(Object) Parameters object.p.universe
(string) Universe on which to create this Market.
callback
(function) Called after the Market creation cost has been looked up.
Returns:
- (MarketCreationCost) Costs of creating a new Market.
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:
p
(Object) Parameters object.p.universe
(string) Universe on which to create this Market.
callback
(function) Called when all Market creation costs have been looked up.
Returns:
- (MarketCreationCostBreakdown) Cost breakdown for creating a new Market.
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:
transactionHash
(string) Hash returned in the receipt of the transaction that created the Market, as a 32-byte hexadecimal string.callback
(function) Called when all Market creation costs have been looked up.
Returns:
- (string) Ethereum contract address of the Market that was created in the transaction with the specified hash, as a 20-byte hexadecimal value.
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:
functionsAbi
(Object) Parameters object.
Returns:
- (Array) Two-dimensional array of contracts APIs, keyed by contract name and function name.
Get Gas Price Function
// Get Gas Price Simplified API Example:
augur.getGasPrice(function (result) {
console.log(result);
});
// example output:
1000000000
augur.getGasPrice(newGasPriceFunction)
Returns the current gas price.
Parameters:
newGasPriceFunction
(function) Callback function to be used to retrieve the current gas price. By default, ethrpc’sgetGasPrice
function will be called, and the result will be passed into this callback function.
Returns:
- (Number) Current gas price.
Markets Functions
// Markets Simplified API Examples:
augur.markets.getCategories({
universe: "0x000000000000000000000000000000000000000b",
}, function (error, result) {
console.log(result);
});
// example output:
[
{
"categoryName": "TEST CATEGORY",
"nonFinalizedOpenInterest": "4.16",
"openInterest": "4.16",
"liquidityTokens": "16",
"tags": [
{"nonFinalizedOpenInterest": "0", "numberOfMarketsWithThisTag": 6, "openInterest": "0", "liquidityTokens": "6", "tagName": "test tag 1"},
{"nonFinalizedOpenInterest": "0", "numberOfMarketsWithThisTag": 6, "openInterest": "0", "liquidityTokens": "6", "tagName": "test tag 2"},
{"nonFinalizedOpenInterest": "0", "numberOfMarketsWithThisTag": 2, "openInterest": "0", "liquidityTokens": "2", "tagName": "Finance"},
{"nonFinalizedOpenInterest": "0", "numberOfMarketsWithThisTag": 2, "openInterest": "0", "liquidityTokens": "2", "tagName": "Augur"},
{"nonFinalizedOpenInterest": "0", "numberOfMarketsWithThisTag": 1, "openInterest": "0", "liquidityTokens": "1", "tagName": "politics"},
{"nonFinalizedOpenInterest": "0", "numberOfMarketsWithThisTag": 1, "openInterest": "0", "liquidityTokens": "1", "tagName": "ethereum"},
{"nonFinalizedOpenInterest": "0", "numberOfMarketsWithThisTag": 5, "openInterest": "0", "liquidityTokens": "5", "tagName": "tagging it"},
{"nonFinalizedOpenInterest": "0", "numberOfMarketsWithThisTag": 5, "openInterest": "0", "liquidityTokens": "5", "tagName": "tagged it"},
]
},
{
"categoryName": "TeSt CaTeGoRy",
"nonFinalizedOpenInterest": "0",
"openInterest": "0",
"liquidityTokens": "1",
"tags": [
{
"nonFinalizedOpenInterest": "0",
"numberOfMarketsWithThisTag": 1,
"openInterest": "0",
"liquidityTokens": "1",
"tagName": "tEsT tag 1",
},
{
"nonFinalizedOpenInterest": "0",
"numberOfMarketsWithThisTag": 1,
"openInterest": "0",
"liquidityTokens": "1",
"tagName": "test tag 2",
},
],
},
]
augur.markets.getMarketPriceHistory({
marketId: "0x0000000000000000000000000000000000000001",
}, function (error, result) {
console.log(result);
});
// example output:
{
0: [
{
price: "5.5",
amount: "0.2",
timestamp: 1506474500,
}, {
amount: "2",
price: "4.2",
timestamp: 1509065474,
},
],
}
augur.markets.getMarkets({
universe: "0x000000000000000000000000000000000000000b",
search: "category: Ethereum OR tags: ETH"
}, function (error, result) {
console.log(result);
});
// example output:
[
"0x98c189f9254b5729eb870688f812b83ebd116798",
"0xa47f967c4806d34859ec93013be5ebc4d68f3a64",
"0xfa26157e03f05ca681997e63db25af1a95239243",
]
augur.markets.getMarketsClosingInDateRange({
universe: "0x000000000000000000000000000000000000000b",
earliestClosingTime: 1506573450,
latestClosingTime: 1506573470,
limit: 10,
}, function (error, result) {
console.log(result);
});
// example output:
[
"0x0000000000000000000000000000000000000001",
]
augur.markets.getMarketsInfo({
marketIds: [
"0x0000000000000000000000000000000000000001",
"0x0000000000000000000000000000000000000002",
],
}, function (error, result) {
console.log(result);
});
// example output:
[
0: {
id: "0x0000000000000000000000000000000000000001",
universe: "0x000000000000000000000000000000000000000b",
marketType: "categorical",
numOutcomes: 8,
minPrice: "0",
maxPrice: "1",
cumulativeScale: "1",
author: "0x0000000000000000000000000000000000000b0b",
creationTime: 1506473474,
creationBlock: 1400000,
creationFee: "10",
settlementFee: "0.04",
reportingFeeRate: "0.02",
marketCreatorFeeRate: "0.02",
marketCreatorFeesBalance: "0",
marketCreatorMailbox: "0xbbb0000000000000000000000000000000000001",
marketCreatorMailboxOwner: "0x0000000000000000000000000000000000000b0b",
initialReportSize: null,
category: "TEST CATEGORY",
tags: ["test tag 1", "test tag 2"],
volume: "0",
openInterest: "0",
outstandingShares: "0",
reportingState: "DESIGNATED_REPORTING",
forking: 0,
needsMigration: 0,
feeWindow: "0x1000000000000000000000000000000000000000",
endTime: 1506573470,
finalizationBlockNumber: null,
finalizationTime: null,
lastTradeBlockNumber: 1506578,
lastTradeTime: 1506573370,
description: "This is a categorical test market created by b0b.",
scalarDenomination: null,
details: null,
designatedReporter: "0x0000000000000000000000000000000000000b0b",
designatedReportStake: "10",
resolutionSource: "https://www.trusted-third-party.com",
numTicks: "10000",
tickSize: "0.0001",
consensus: {
isInvalid: false,
payout: [
"0",
"10000",
],
},
outcomes: [{
id: 0,
volume: "100",
price: "0.125",
description: "outcome 0",
}, {
id: 1,
volume: "100",
price: "0.125",
description: "outcome 1",
}, {
id: 2,
volume: "100",
price: "0.125",
description: "outcome 2",
}, {
id: 3,
volume: "100",
price: "0.125",
description: "outcome 3",
}, {
id: 4,
volume: "100",
price: "0.125",
description: "outcome 4",
}, {
id: 5,
volume: "100",
price: "0.125",
description: "outcome 5",
}, {
id: 6,
volume: "100",
price: "0.125",
description: "outcome 6",
}, {
id: 7,
volume: "100",
price: "0.125",
description: "outcome 7",
}],
},
1: {
id: "0x0000000000000000000000000000000000000002",
universe: "0x000000000000000000000000000000000000000b",
marketType: "yesNo",
numOutcomes: 2,
minPrice: "0",
maxPrice: "1",
cumulativeScale: "1",
author: "0x0000000000000000000000000000000000000b0b",
creationTime: 1506480000,
creationBlock: 1400100,
creationFee: "10",
settlementFee: "0.04",
reportingFeeRate: "0.02",
marketCreatorFeeRate: "0.02",
marketCreatorFeesBalance: "0",
marketCreatorMailbox: "0xbbb0000000000000000000000000000000000002",
marketCreatorMailboxOwner: "0x0000000000000000000000000000000000000b0b",
initialReportSize: null,
category: "TEST CATEGORY",
tags: ["test tag 1", "test tag 2"],
volume: "0",
openInterest: "0",
outstandingShares: "0",
reportingState: "DESIGNATED_REPORTING",
forking: 0,
needsMigration: 0,
feeWindow: "0x1000000000000000000000000000000000000000",
endTime: 1506573480,
finalizationBlockNumber: null,
finalizationTime: null,
lastTradeBlockNumber: 1506579,
lastTradeTime: 1506573380,
description: "This is a yesNo test market created by b0b.",
scalarDenomination: null,
details: null,
designatedReporter: "0x0000000000000000000000000000000000000b0b",
designatedReportStake: 10,
resolutionSource: "http://www.trusted-third-party.com",
numTicks: "10000",
consensus: {
isInvalid: false,
payout: [
"0",
"10000",
],
},
outcomes: [{
id: 0,
volume: 1000,
price: 0.5,
description: "outcome 0",
}, {
id: 1,
volume: "1000",
price: "0.5",
description: "outcome 1",
}],
}
]
augur.markets.getUnclaimedMarketCreatorFees({
marketIds: [
"0x0000000000000000000000000000000000000001",
"0x0000000000000000000000000000000000000002"
]
}, function(error, result) {
console.log(result);
});
// example output:
[
0: {
marketId: "0x0000000000000000000000000000000000000001",
unclaimedFee: "0",
},
1: {
marketId: "0x0000000000000000000000000000000000000002",
unclaimedFee: "0",
}
]
augur.markets.getCategories(p, callback)
Returns the Market Categories in a specific Universe.
This function will fail if:
- A connection to an Augur Node has not been established.
Parameters:
p
(Object) Parameters object.p.universe
(string) Contract address of the Universe from which to retrieve the categories, as a 20-byte hexadecimal string.
callback
(function) Called after the categories have been retrieved.
Returns:
- (Array.<Category>) Array representing the categories in the specified Universe.
augur.markets.getMarketPriceHistory(p, callback)
Returns the prices and timestamps of a specific Market’s Outcomes over time.
This function will fail if:
- A connection to an Augur Node has not been established.
Parameters:
p
(Object) Parameters object.p.marketId
(string) Market contract address for which to look up orders, as a 20-byte hexadecimal string.
callback
(function) Called after the price time-series has been received and parsed.
Returns:
- (MarketPriceTimeSeries) The Market’s price time-series, keyed by outcome ID.
augur.markets.getMarkets(p, callback)
Returns an array of Markets in a specific Universe.
This function will fail if:
- A connection to an Augur Node has not been established.
Parameters:
p
(Object) Parameters object.p.universe
(string) Contract address of the Universe from which to get transfer history.p.creator
(string) <optional> Ethereum address of a Market Creator by which to filter the returned results, as a 20-byte hexadecimal string.p.category
(string) <optional> Market category by which to filter the returned results.p.search
(string) <optional> Query string used to determine which Markets are returned byaugur.markets.getMarkets
. By default, a full-text search will be performed on this string. However, it is also possible to search across specific market properties, by specifyingmarketId
,category
,tags
,shortDescription
,longDescription
,resolutionSource
, andscalarDenomination
. For example, to search within market categories,p.search
can be set to “category: ETH”. More complex queries can be formed using “AND” and “OR”. For example, settingp.search
to “category: Ethereum OR tags: ETH” will search for all markets with the category “Ethereum” or the tag “ETH”.p.reportingState
(string|Array<string>) <optional> REPORTING_STATE (or array of REPORTING_STATEs) by which to filter the returned results.p.feeWindow
(string) <optional> Ethereum address of a Fee Window by which to filter the returned results, as a 20-byte hexadecimal string.p.designatedReporter
(string) <optional> Ethereum address of a Designated Reporter by which to filter the returned results, as a 20-byte hexadecimal string.p.maxFee
(number) <optional> Maximum trading Settlement Fee by which to filter the returned results, as a decimal number. (For example, if the desired maximum Settlement Fee is 1.0201%,maxFee
should be set to 0.010201.)p.maxEndTime
(number) <optional> Maximum Market end time by which to filter Markets, as a Unix timestamp.p.liquiditySortSpreadPercent
(number) <optional> Must be included if and only ifp.sortBy
is set to “liquidityTokens”. Each Market hasliquidityTokens
defined for multiple Spread Percents.p.liquiditySortSpreadPercent
determines which of these is included in markets result set.p.enableInvalidFilter
(boolean) <optional> If set totrue
, Markets detected as potentially Invalid will not be returned.p.hasOrders
(boolean) <optional> If set totrue
, only Markets having Open Orders on the Order Book will be returned. Defaults tofalse
.p.sortBy
(string) <optional> Field name by which to sort the Markets.p.isSortDescending
(boolean) <optional> Whether to sort the Markets in descending order by sortBy field.p.limit
(number) <optional> Maximum number of Markets to return.p.offset
(number) <optional> Number of Markets to truncate from the beginning of the results.
callback
(function) Called after the Markets have been retrieved.
Returns:
- (Array.<string>) Array of Market addresses in the Universe, as hexadecimal strings.
augur.markets.getMarketsClosingInDateRange(p, callback)
Returns the Markets closing between a given time range in a specific Universe.
This function will fail if:
- A connection to an Augur Node has not been established.
Parameters:
p
(Object) Parameters object.p.universe
(string) Contract address of the Universe from which to get the Markets, as a 20-byte hexadecimal string.p.earliestClosingTime
(number) Earliest Market close timestamp at which to truncate Market results, in seconds.p.latestClosingTime
(number) Latest Market close timestamp at which to truncate Market results, in seconds.p.sortBy
(string) <optional> Field name by which to sort the Markets.p.isSortDescending
(boolean) <optional> Whether to sort the Markets in descending order by sortBy field.p.limit
(number) <optional> Maximum number of Markets to return.p.offset
(number) <optional> Number of Markets to truncate from the beginning of the results.
callback
(function) Called after the Markets have been retrieved.
Returns:
- (Array.<string>) Array of closing Market addresses, as hexadecimal strings.
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:
- A connection to an Augur Node has not been established.
Parameters:
p
(Object) Parameters object.p.marketIds
(Array.<string>) Contract addresses of the Markets for which to get details, as hexadecimal strings.
callback
(function) Called after the Market info has been retrieved.
Returns:
- (Array.<MarketInfo>) Array of MarketInfo objects.
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:
p
(Object) Parameters object.p.marketIds
(Array.<string>) Contract addresses of the Markets for which to get unclaimed Creator Fees, as 20-byte hexadecimal values.
callback
(function) Called after the Market Creator Fee information has been retrieved.
Returns:
- (Array.<MarketCreatorFee>>) Array of MarketCreatorFee objects.
Reporting Functions
// Reporting Simplified API Examples:
augur.reporting.claimReportingFeesForkedMarket({
redeemer: "0x913da4198e6be1d5f5e4a40d0667f70c0b5430eb",
forkedMarket: {
crowdsourcers: [
{
crowdsourcerId: "0xfc2355a7e5a7adb23b51f54027e624bfe0e23001",
needsFork: true,
},
{
crowdsourcerId: "0xfc2355a7e5a7adb23b51f54027e624bfe0e23002",
needsFork: false,
},
],
initialReporter: {
initialReporterId: "0xfd2355a7e5a7adb23b51f54027e624bfe0e23001",
needsFork: false,
},
},
estimateGas: false,
onSent(result) { },
onSuccess(result) { console.log(result); },
onFailed(errors) { console.log(errors); },
});
// example output:
{
successfulTransactions: {
crowdsourcerForkAndRedeem: [
"0xfc2355a7e5a7adb23b51f54027e624bfe0e23001",
],
initialReporterForkAndRedeem: [],
crowdsourcerRedeem: [
"0xfc2355a7e5a7adb23b51f54027e624bfe0e23002",
],
initialReporterRedeem: [
"0xfd2355a7e5a7adb23b51f54027e624bfe0e23001",
],
}
}
augur.reporting.claimReportingFeesNonforkedMarkets({
"redeemer": "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Eb",
"feeWindows": [],
"nonforkedMarkets": [
{
"marketId": "0xbeb2f42f5f495c0581893117eb210e5e9666170e",
"crowdsourcersAreDisavowed": false,
"isFinalized": true,
"crowdsourcers": [],
"initialReporter": "0x072e9db2836dc569f6173a8d56a25dfd4cbacc1c"
}
],
"estimateGas": true,
onSent(result) { console.log(result); },
onSuccess(result) { console.log(result); },
onFailed(errors) { console.log(errors); },
});
// example output:
{
"successfulTransactions": {
"disavowCrowdsourcers": [],
"feeWindowRedeem": [],
"crowdsourcerRedeem": [],
"initialReporterRedeem": [
"0x072e9db2836dc569f6173a8d56a25dfd4cbacc1c"
]
}
}
augur.reporting.finalizeMarket({
market: "0x0000000000000000000000000000000000000011",
meta: {
accountType: "privateKey",
address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
},
onSent: function(result) { console.log(result); },
onSuccess: function(result) { console.log(result); },
onFailed: function(result) { console.log(result); }
});
// This function does not return a value.
var secondsInFeeWindow = 604800;
var currentTimestamp = 1518648436;
augur.reporting.getCurrentPeriodProgress(secondsInFeeWindow, currentTimestamp);
// example output:
99.27843915343915
augur.reporting.getDisputeInfo({
marketIds: [
"0x0000000000000000000000000000000000000211",
"0x0000000000000000000000000000000000000011",
],
account: "0x0000000000000000000000000000000000000021",
}, function (error, result) {
console.log(result);
});
// example output:
[
{
marketId: "0x0000000000000000000000000000000000000211",
stakeCompletedTotal: "102",
bondSizeOfNewStake: "204",
stakes: [
{
payout: [
"10000",
"0",
],
isInvalid: false,
bondSizeCurrent: "204",
stakeCurrent: "0",
accountStakeCurrent: "0",
accountStakeTotal: "0",
stakeRemaining: "204",
bondSizeTotal: "204",
accountStakeCompleted: "0",
stakeCompleted: "0",
tentativeWinning: false,
},
{
payout: [
"0",
"10000",
],
isInvalid: false,
accountStakeCompleted: "102",
stakeCurrent: "0",
stakeCompleted: "102",
tentativeWinning: true,
},
{
payout: [
"5000",
"5000",
],
isInvalid: true,
bondSizeCurrent: "204",
stakeCurrent: "20",
accountStakeCurrent: "0",
accountStakeTotal: "0",
stakeRemaining: "184",
bondSizeTotal: "204",
accountStakeCompleted: "0",
stakeCompleted: "0",
tentativeWinning: false,
},
],
disputeRound: 1,
},
{
marketId: "0x0000000000000000000000000000000000000011",
stakeCompletedTotal: "30102",
bondSizeOfNewStake: "60204",
stakes: [
{
payout: [
"0",
"2",
],
isInvalid: false,
bondSizeCurrent: "30000",
stakeCurrent: "30000",
accountStakeCurrent: "102",
accountStakeTotal: "204",
stakeRemaining: "0",
bondSizeTotal: "40102",
accountStakeCompleted: "102",
stakeCompleted: "10102",
tentativeWinning: false,
},
{
payout: [
"1",
"1",
],
isInvalid: true,
accountStakeCompleted: "0",
stakeCurrent: "0",
stakeCompleted: "20000",
tentativeWinning: true,
},
],
disputeRound: 3,
},
]
augur.reporting.getDisputeTokens({
universe: "0x000000000000000000000000000000000000000b",
account: "0x0000000000000000000000000000000000000021",
disputeTokenState: "UNFINALIZED",
}, function (error, result) {
console.log(result);
});
// example output:
{
"0x0000000000000000001000000000000000000001": {
disputeToken: "0x0000000000000000001000000000000000000001",
marketId: "0x0000000000000000000000000000000000000011",
payout0: "0",
payout1: "2",
payout2: null,
payout3: null,
payout4: null,
payout5: null,
payout6: null,
payout7: null,
isInvalid: false,
balance: "17",
winningToken: null,
tentativeWinning: 0,
claimed: false,
reportingState: "CROWDSOURCING_DISPUTE",
},
}
augur.reporting.getFeeWindowCurrent({
universe: "0x000000000000000000000000000000000000000b",
reporter: "0x0000000000000000000000000000000000000b0b",
}, function (error, result) {
console.log(result);
});
// example output:
{
endTime: 1509670273,
feeToken: "0x1230000000000000000000000000000000000000",
feeWindow: "0x2000000000000000000000000000000000000000",
feeWindowEthFees: "2000",
feeWindowFeeTokens: "100",
feeWindowId: 457,
feeWindowParticipationTokens: "1000",
feeWindowRepStaked: "1100",
participantContributions: "102",
participantContributionsCrowdsourcer: "0",
participantContributionsInitialReport: "102",
participantParticipationTokens: "30",
participationTokens: "30",
startTime: 1509065473,
totalStake: "132",
universe: "0x000000000000000000000000000000000000000b",
}
augur.reporting.getFeeWindows({
universe: "0x000000000000000000000000000000000000000b",
account: "0x0000000000000000000000000000000000000021",
includeCurrent: true,
}, function (error, result) {
console.log(result);
});
// example output:
{
"0x1000000000000000000000000000000000000000": {
startTime: 1506473473,
endTime: 1506473515,
balance: "100",
expectedFees: "333.33333333333333333333",
},
"0x2000000000000000000000000000000000000000": {
startTime: 1509065473,
endTime: 1506473515,
balance: "500",
expectedFees: "909.09090909090909090909",
},
}
augur.reporting.getInitialReporters({
universe: "0x000000000000000000000000000000000000000b",
reporter: "0x0000000000000000000000000000000000000b0b",
}, function (error, result) {
console.log(result);
});
// example output:
{
"0x0000000000000000000000000000000000abe111": {
amountStaked: "102",
blockNumber: 1400100,
initialReporter: " 0x0000000000000000000000000000000000abe111",
isDesignatedReporter: 1,
logIndex: 0,
marketId: " 0x0000000000000000000000000000000000000019",
redeemed: 0,
repBalance: "4000000",
reporter: " 0x0000000000000000000000000000000000000b0b",
timestamp: 1506480000,
transactionHash: "0x0000000000000000000000000000000000000000000000000000000000000E00",
},
"0x0000000000000000000000000000000000abe123": {
marketId: "0x0000000000000000000000000000000000000011",
blockNumber: 1400100,
logIndex: 0,
timestamp: 1506480000,
transactionHash: "0x0000000000000000000000000000000000000000000000000000000000000E00",
reporter: "0x0000000000000000000000000000000000000b0b",
amountStaked: "102",
initialReporter: "0x0000000000000000000000000000000000abe123",
redeemed: 0,
isDesignatedReporter: 0,
repBalance: "2000",
},
"0x0000000000000000000000000000000000abe321": {
marketId: "0x0000000000000000000000000000000000000211",
blockNumber: 1400100,
logIndex: 0,
timestamp: 1506480000,
transactionHash: "0x0000000000000000000000000000000000000000000000000000000000000E00",
reporter: "0x0000000000000000000000000000000000000b0b",
amountStaked: "102",
initialReporter: "0x0000000000000000000000000000000000abe321",
redeemed: 0,
isDesignatedReporter: 1,
repBalance: "2000",
},
}
augur.reporting.getReportingFees({
universe: "0x000000000000000000000000000000000000000b",
reporter: "0x0000000000000000000000000000000000000b0b",
}, function (error, result) {
console.log(result);
});
// example output:
{
total: {
unclaimedEth: "1200",
unclaimedRepEarned: "0",
unclaimedRepStaked: "391",
unclaimedForkEth: "0",
unclaimedForkRepStaked: "331",
lostRep: "0",
participationTokenRepStaked: "60",
unclaimedParticipationTokenEthFees: "200",
},
feeWindows: [
"0x1000000000000000000000000000000000000000",
],
forkedMarket: {
crowdsourcers: [
{
crowdsourcerId: "0x0000000000000000001000000000000000000006",
needsFork: true,
},
],
initialReporter: {
initialReporterId: "0x0000000000000000000000000000000000abe222",
needsFork: true,
},
isFinalized: 1,
marketId: "0x00000000000000000000000000000000000000f1",
universe: "0x000000000000000000000000000000000000000b",
},
nonforkedMarkets: [
{
marketId: "0x0000000000000000000000000000000000000019",
crowdsourcers: ["0x0000000000000000001000000000000000000003"],
crowdsourcersAreDisavowed: false,
initialReporter: "0x0000000000000000000000000000000000abe111",
isFinalized: true,
isMigrated: true,
universe: "0x000000000000000000000000000000000000000b",
unclaimedEthFees: "1000",
unclaimedRepTotal: "331",
},
],
}
augur.reporting.getReportingHistory({
reporter: "0x0000000000000000000000000000000000000021",
universe: "0x000000000000000000000000000000000000000b",
}, function (error, result) {
console.log(result);
});
// example output:
{
"0x0000000000000000000000000000000000000011": {
initialReporter: null,
crowdsourcers: [
{
transactionHash: "0x0000000000000000000000000000000000000000000000000000000000000D00",
logIndex: 0,
creationBlockNumber: 1400051,
blockHash: "0x1400051",
creationTime: 1506474500,
marketId: "0x0000000000000000000000000000000000000011",
feeWindow: "0x1000000000000000000000000000000000000000",
payoutNumerators: ["0", "2"],
amountStaked: "17",
crowdsourcerId: "0x0000000000000000001000000000000000000001",
isCategorical: false,
isScalar: false,
isInvalid: false,
isSubmitted: true,
},
],
},
"0x0000000000000000000000000000000000000019": {
initialReporter: null,
crowdsourcers: [
{
transactionHash: "0x0000000000000000000000000000000000000000000000000000000000000D03",
logIndex: 0,
creationBlockNumber: 1400052,
blockHash: "0x1400052",
creationTime: 1506474515,
marketId: "0x0000000000000000000000000000000000000019",
feeWindow: "0x1000000000000000000000000000000000000000",
payoutNumerators: ["10000", "0", "0", "0", "0"],
amountStaked: "229",
crowdsourcerId: "0x0000000000000000001000000000000000000003",
isCategorical: false,
isScalar: false,
isInvalid: false,
isSubmitted: true,
},
],
},
}
augur.reporting.getReportingSummary({
feeWindow: "0x1000000000000000000000000000000000000000"
}, function (error, result) {
console.log(result);
});
// example output:
{
"AWAITING_FINALIZATION": 1,
"DESIGNATED_REPORTING": 12,
"CROWDSOURCING_DISPUTE": 2,
"FINALIZED": 1,
"PRE_REPORTING": 1,
}
augur.reporting.getStakeRequiredForDesignatedReporter({
universe: "0x000000000000000000000000000000000000000b"
}, function (error, result) {
console.log(result);
});
// example output:
"1.2345"
augur.reporting.claimReportingFeesForkedMarket(p)
Claims unclaimed Reporting Fees a user has in any InitialReporter/DisputeCrowdsourcer contracts of a specified Forked Market, or returns a gas estimate for claiming these fees if p.estimateGas
is true.
The claiming process works as follows:
- For each InitialReporter/DisputeCrowdsourcer contract of the Forked Market in which the user has unclaimed fees:
- If
DisputeCrowdsourcer.fork
/InitialReporter.fork
has not been called:- Call
DisputeCrowdsourcer.forkAndRedeem
/InitialReporter.forkAndRedeem
- Call
- Else:
- Call
DisputeCrowdsourcer.redeem
/InitialReporter.redeem
- Call
- If
Parameters:
p
(Object) Parameters object.p.redeemer
(string) Ethereum address attempting to redeem reporting fees, as a hexadecimal string.p.forkedMarket
(ClaimReportingFeesForkedMarket) Object containing information about the Forked Market in which the user has unclaimed fees in the current universe .p.estimateGas
(boolean) Whether to return gas estimates for the transactions instead of actually making the transactions.p.meta
(Meta) <optional> Authentication metadata for raw transactions.p.onSent
(function) Called if/when the transactions are broadcast to the network. (Currently used as a placeholder and not actually used by this function.)p.onSuccess
(function) Called if/when all transactions are sealed and confirmed.p.onFailed
(function) Called if/when all transactions have been attempted and at least one transaction has failed. Error message shows which transactions succeeded and which ones failed.
Returns:
- (ClaimReportingFeesForkedMarketResponse|ClaimReportingFeesForkedMarketGasEstimates) Object containing information about which contracts successfully had fees claimed from them, or a breakdown of gas estimates.
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:
If a Forked Market exists in the current Universe:
- For all non-Forked Markets in current Universe where the user has unclaimed fees in InitialReporter/DisputeCrowdsourcer contracts:
- If the non-Forked Market is not Finalized and has not had its Crowdsourcers disavowed:
- Call
Market.disavowCrowdsourcers
- Call
- If the non-Forked Market is not Finalized and has not had its Crowdsourcers disavowed:
- For all non-Forked Markets in current Universe where the user has unclaimed fees in InitialReporter/DisputeCrowdsourcer contracts:
Once the above has been completed:
- Call
FeeWindow.redeem
on all Fee Windows in the current Universe where the user has unclaimed Participation Tokens - For InitialReporter/DisputeCrowdsourcer contracts of non-Forked Markets:
- Call
DisputeCrowdsourcer.redeem
- For InitialReporter contracts of non-Forked Markets:
- If a Forked Market exists in the current Universe:
- If the InitialReporter contract belongs to a Finalized Market, call
InitialReporter.redeem
- If the InitialReporter contract belongs to a Finalized Market, call
- Else call
InitialReporter.redeem
- If a Forked Market exists in the current Universe:
- Call
- Call
Parameters:
p
(Object) Parameters object.p.redeemer
(string) Ethereum address attempting to redeem reporting fees, as a hexadecimal string.p.feeWindows
(Array.<string>) Array of Fee Window Ethereum contract addresses, as hexadecimal strings.p.nonforkedMarkets
(Array.<ClaimReportingFeesNonforkedMarket>) Array of ClaimReportingFeesNonforkedMarket objects.p.estimateGas
(boolean) Whether to return gas estimates for the transactions instead of actually making the transactions.p.meta
(Meta) <optional> Authentication metadata for raw transactions.p.onSent
(function) Called if/when the transactions are broadcast to the network. (Currently used as a placeholder and not actually used by this function.)p.onSuccess
(function) Called if/when all transactions are sealed and confirmed.p.onFailed
(function) Called if/when all transactions have been attempted and at least one transaction has failed. Error message shows which transactions succeeded and which ones failed.
Returns:
- (ClaimReportingFeesNonforkedMarketsResponse|ClaimReportingFeesNonforkedMarketsGasEstimates) Object containing information about which contracts successfully had fees claimed from them, or a breakdown of gas estimates.
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:
- The Initial Report has not been submitted.
- The Fee Window has not ended.
- The Market passed in is a Forked Market.
Parameters:
p
(Object) Parameters object.p.market
(string) Address of the Market to Finalize, as a hex string.p.meta
(Meta) <optional> Authentication metadata for raw transactions.p.onSent
(function) Called if/when the transaction is broadcast to the network.p.onSuccess
(function) Called if/when the transaction is sealed and confirmed.p.onFailed
(function) Called if/when the transaction fails.
Returns:
- This function does not return a value.
augur.reporting.getCurrentPeriodProgress(reportingPeriodDurationInSeconds, timestamp)
Returns the percentage of the current Fee Window that has elapsed.
Parameters:
reportingPeriodDurationInSeconds
(number) Number of seconds in a Fee Window.timestamp
(number) <optional> Unix timestamp at which to check what percentage of the Fee Window has elapsed. (If not specified, the current Unix timestamp will be used.)
Returns:
- (number) Percentage of the current Fee Window that has elapsed.
augur.reporting.getDisputeInfo(p, callback)
Returns information about the Dispute Stake in a list of Markets.
Parameters:
p
(Object) Parameters object.p.marketIds
(Array.<string>) Array of Market Ethereum contract addresses, as 20-byte hexadecimal strings.p.account
(string) <optional> Ethereum address (as a 20-byte hexadecimal string) of a user by which to filter the returned results.
Returns:
- (Array.<StakeInfo>) Array of objects containing information about the Dispute Stake in the list of Markets.
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:
- A connection to an Augur Node has not been established.
Parameters:
p
(Object) Parameters object.p.universe
(string) Contract address of the Universe in which to retrieve the Dispute Tokens, as a 20-byte hexadecimal string.p.account
(string) Contract address of the account for which to retrieve the Dispute Tokens, as a 20-byte hexadecimal string.p.stakeTokenState
(DISPUTE_TOKEN_STATE) <optional> Token state by which to filter results.
callback
(function) Called after the Dispute Tokens have been retrieved.
Returns:
- (Array.<DisputeToken>) Dispute Token details, keyed by Dispute Token ID.
augur.reporting.getFeeWindowCurrent(p, callback)
Returns information about the current Fee Window. If p.reporter
is specified, this returned information will also include the total amount of attoREP the Reporter has Staked in the current Fee Window (this includes attoREP Staked in Initial Reports, as well as attoREP Staked in Dispute Crowdsourcers) and the amount of Participation Tokens the Reporter has purchased in the current Fee Window.
This function will fail if:
- A connection to an Augur Node has not been established.
Parameters:
p
(Object) Parameters object.p.universe
(string) Ethereum contract address of the Universe in which the Fee Windows exist, as a 20-byte hexadecimal string.p.reporter
(string) <optional> Ethereum address of a Reporter for which to return the amount of attoREP they have Staked in the current Fee Window.
callback
(function) Called after the Fee Windows have been retrieved.
Returns:
- (FeeWindowCurrent) Object containing information about the current Fee Window.
augur.reporting.getFeeWindows(p, callback)
Returns the Fee Windows where a specific user has unclaimed Reporting Fees.
This function will fail if:
- A connection to an Augur Node has not been established.
Parameters:
p
(Object) Parameters object.p.universe
(string) Ethereum contract address of the Universe in which the Fee Windows exist, as a 20-byte hexadecimal string.p.account
(string) Ethereum address of the user who has unclaimed Reporting Fees, as a 20-byte hexadecimal string.p.includeCurrent
(boolean) <optional> Whether to include the current Fee Window in the returned results.
callback
(function) Called after the Fee Windows have been retrieved.
Returns:
- (Object) Object containing UnclaimedFeeWindowInfo objects, indexed by the Ethereum address of each FeeWindow contract.
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:
p
(Object) Parameters object.p.reporter
(string) Ethereum address of a Reporter who has Staked REP in InitialReporter contracts, as a 20-byte hexadecimal string.p.universe
(string) Ethereum address of the Universe in which the desired Initial Reporters exist.p.redeemed
(boolean) <optional> If true, the returned results will include only InitialReporter contracts where the Reporter has redeemed Staked REP; if false, the returned results will include only InitialReporter contracts where the Reporter has not redeemed Staked REP. If not specified, the results will include all InitialReporters in which the Repoter has Staked REP.p.withRepBalance
(boolean) <optional> Whether the InitialReporter contract has a balance greater than 0. If set totrue
, only InitialReporters with a balance greater than 0 will be returned.
callback
(function) Called after the InitialReporters have been retrieved.
Returns:
- (Object) Object containing InitialReporter objects, keyed by the Ethereum contract address of the InitialReporter.
augur.reporting.getReportingFees(p, callback)
Returns information about the unclaimed ETH and REP Reporting Fees a user has in a specific Universe.
Parameters:
p
(Object) Parameters object.p.reporter
(string) Ethereum address of the Reporter for which to retrieve Reporting Fees, as a 20-byte hexadecimal string.p.universe
(string) Contract address of the Universe in which to look up the Reporting Fees, as a 20-byte hexadecimal string.
Returns:
- (GetReportingFeesInfo) information about the unclaimed ETH and REP Reporting Fees a user has in a specific Universe.
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:
- A connection to an Augur Node has not been established.
Parameters:
p
(Object) Parameters object.p.reporter
(string) Ethereum address of the Reporter for which to retrieve reporting history, as a 20-byte hexadecimal string.p.universe
(string) <optional> Contract address of the Universe in which to look up the reporting history, as a 20-byte hexadecimal string. Either this parameter, the Market ID, or the Fee Window must be specified.p.marketId
(string) <optional> Contract address of the Market in which to look up the reporting history, as a 20-byte hexadecimal string. Either this parameter, the Universe, or the Fee Window must be specified.p.feeWindow
(string) <optional> Contract address of the Fee Window in which to look up the reporting history, as a 20-byte hexadecimal string. Either this parameter, the Universe, or the Market ID must be specified.p.earliestCreationTime
(number) <optional> Earliest timestamp, in seconds, at which to truncate history results. (This timestamp is when the block on the Ethereum blockchain containing the report submission was created.)p.latestCreationTime
(number) <optional> Latest timestamp, in seconds, at which to truncate history results. (This timestamp is when the block on the Ethereum blockchain containing the report submission was created.)p.sortBy
(string) <optional> Field name by which to sort the reporting history.p.isSortDescending
(boolean) <optional> Whether to sort the reporting history in descending order by sortBy field.p.limit
(number) <optional> Maximum number of reporting history reports to return.p.offset
(number) <optional> Number of reporting history reports to truncate from the beginning of the results.
callback
(function) Called when reporting history has been received and parsed.
Returns:
- (Object) Reporting history, keyed by Universe or Market ID. Each report is of type Report.
augur.reporting.getReportingSummary(p, callback)
Returns the number of Markets in various reporting phases. For a list of all reporting state descriptions, refer to the REPORTING_STATE type definition.
This function will fail if:
- A connection to an Augur Node has not been established.
Parameters:
p
(Object) Parameters object.p.feeWindow
(string) Contract address of the Fee Window for which to get the summary, as a 20-byte hexadecimal string.
callback
(function) Called after the reporting summary has been retrieved.
Returns:
- (Object) Summary of the number of Markets in each reporting phase, keyed by reporting phase.
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:
p
(Object) Parameters object.p.universe
(string) Ethereum address of a Universe.
callback
(function) Called after Stake required has been retrieved.
Returns:
- (string) Amount of Stake required for the Designated Reporter on this Universe, as a base-10 string.
Trading Functions
// Trading Simplified API Examples:
augur.trading.calculateProfitLoss({
trades: [{
type: "buy",
amount: "1",
price: "2",
maker: false,
}],
lastPrice: "2"
});
// example output:
{
position: "1",
meanOpenPrice: "2",
realized: "0",
queued: "0",
unrealized: "0"
}
augur.trading.calculateTradeCost({
displayPrice: "2",
displayAmount: "10",
numTicks: "10000",
maxDisplayPrice: "10",
minDisplayPrice: "0",
orderType: 0,
});
// example output:
{
"cost": "20000000000000000000",
"onChainAmount": "10000000000000000",
"onChainPrice": "2000"
}
augur.trading.claimMarketsTradingProceeds({
markets: [
"0x0000000000000000000000000000000000000001",
"0x0000000000000000000000000000000000000002",
],
_shareHolder: "0x8fa56abe36d8dc76cf85fecb6a3026733e0a12ac",
meta: {
accountType: "privateKey",
address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
},
onSent: function(result) { console.log(result); },
onSuccess: function(result) { console.log(result); },
onFailed: function(result) { console.log(result); }
});
// example onSuccess output:
[
"0x0000000000000000000000000000000000000001",
"0x0000000000000000000000000000000000000002",
]
augur.trading.claimTradingProceeds({
_market: "0x0000000000000000000000000000000000000001",
_shareHolder: "0x8fa56abe36d8dc76cf85fecb6a3026733e0a12ac",
meta: {
accountType: "privateKey",
address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
},
onSent: function(result) { console.log(result); },
onSuccess: function(result) { console.log(result); },
onFailed: function(result) { console.log(result); }
});
// This function does not return a value.
augur.trading.denormalizePrice({
minPrice: "0",
maxPrice: "2",
normalizedPrice: "0.2",
});
// example output:
"0.4"
// selling: 5 bids, 1 from user, 2 with price too low
augur.trading.filterAndSortByPrice({
singleOutcomeOrderBookSide: {
0x1000000000000000000000000000000000000000000000000000000000000000: {
amount: "2",
fullPrecisionPrice: "0.6",
owner: "0x8fa56abe36d8dc76cf85fecb6a3026733e0a12ac",
},
0x2000000000000000000000000000000000000000000000000000000000000000: {
amount: "1",
fullPrecisionPrice: "0.5",
owner: "0x8fa56abe36d8dc76cf85fecb6a3026733e0a12ac",
},
0x3000000000000000000000000000000000000000000000000000000000000000: {
amount: "3",
fullPrecisionPrice: "0.7",
owner: "0x8fa56abe36d8dc76cf85fecb6a3026733e0a12ac",
},
0x4000000000000000000000000000000000000000000000000000000000000000: {
amount: "42",
fullPrecisionPrice: "0.4",
owner: "0x8fa56abe36d8dc76cf85fecb6a3026733e0a12ac",
},
},
orderType: 1,
price: "0.6",
});
// example output:
[
{
amount: "3",
fullPrecisionPrice: "0.7",
owner: "0x8fa56abe36d8dc76cf85fecb6a3026733e0a12ac",
}, {
amount: "2",
fullPrecisionPrice: "0.6",
owner: "0x8fa56abe36d8dc76cf85fecb6a3026733e0a12ac",
}
]
augur.trading.generateTradeGroupId();
// example output:
"0x80e8bdd8c5a8178a4ad29b31722f22c768135dff2709437c7a5ebd0a0ec475f1"
augur.trading.getBetterWorseOrders({
marketId: "0x0000000000000000000000000000000000000001",
outcome: 0,
orderType: "buy",
price: "0.65",
}, function (error, result) {
console.log(result);
});
// example output:
{
betterOrderId: "0x1000000000000000000000000000000000000000000000000000000000000000",
worseOrderId: "0x2000000000000000000000000000000000000000000000000000000000000000",
}
augur.trading.getOrders({
marketId: "0x0000000000000000000000000000000000000001",
universe: "0x000000000000000000000000000000000000000b",
orderType: "buy",
orderState: "OPEN",
}, function (error, result) {
console.log(result);
});
// example output:
{
"0x0000000000000000000000000000000000000001": {
0: {
buy: {
"0x1000000000000000000000000000000000000000000000000000000000000000": {
orderId: "0x1000000000000000000000000000000000000000000000000000000000000000",
shareToken: "0x0100000000000000000000000000000000000000",
transactionHash: "0x0000000000000000000000000000000000000000000000000000000000000A00",
logIndex: 0,
owner: "0x0000000000000000000000000000000000000b0b",
creationTime: 1506473500,
creationBlockNumber: 1400001,
orderState: "OPEN",
price: "0.7",
amount: "1",
originalAmount: "1",
fullPrecisionPrice: "0.7",
fullPrecisionAmount: "1",
originalFullPrecisionAmount: "1",
originalTokensEscrowed: "0.7",
originalSharesEscrowed: "0",
tokensEscrowed: "0.7",
sharesEscrowed: "0",
},
"0x2000000000000000000000000000000000000000000000000000000000000000": {
orderId: "0x2000000000000000000000000000000000000000000000000000000000000000",
shareToken: "0x0100000000000000000000000000000000000000",
transactionHash: "0x0000000000000000000000000000000000000000000000000000000000000A01",
logIndex: 0,
owner: "0x000000000000000000000000000000000000d00d",
creationTime: 1506473515,
creationBlockNumber: 1400002,
orderState: "OPEN",
price: "0.6",
amount: "2",
originalAmount: "2",
fullPrecisionPrice: "0.600001",
fullPrecisionAmount: "2",
originalFullPrecisionAmount: "2",
originalTokensEscrowed: "1.200002",
originalSharesEscrowed: "0",
tokensEscrowed: "1.200002",
sharesEscrowed: "0",
},
"0x5000000000000000000000000000000000000000000000000000000000000000": {
orderId: "0x5000000000000000000000000000000000000000000000000000000000000000",
shareToken: "0x0100000000000000000000000000000000000000",
transactionHash: "0x0000000000000000000000000000000000000000000000000000000000000A06",
logIndex: 0,
owner: "0x0000000000000000000000000000000000000b0b",
creationTime: 1506473500,
creationBlockNumber: 1400001,
orderState: "OPEN",
price: "0.73",
amount: "1",
originalAmount: "1",
fullPrecisionPrice: "0.73",
fullPrecisionAmount: "1",
originalFullPrecisionAmount: "1",
originalTokensEscrowed: "0.73",
originalSharesEscrowed: "0",
tokensEscrowed: "0.73",
sharesEscrowed: "0",
},
},
},
1: {
buy: {
"0x3000000000000000000000000000000000000000000000000000000000000000": {
orderId: "0x3000000000000000000000000000000000000000000000000000000000000000",
shareToken: "0x2000000000000000000000000000000000000000",
transactionHash: "0x0000000000000000000000000000000000000000000000000000000000000A02",
logIndex: 0,
owner: "0x000000000000000000000000000000000000d00d",
creationTime: 1506473515,
creationBlockNumber: 1400002,
orderState: "OPEN",
price: "0.6",
amount: "2",
originalAmount: "2",
fullPrecisionPrice: "0.6",
fullPrecisionAmount: "2.0000001",
originalFullPrecisionAmount: "2.0000001",
originalTokensEscrowed: "1.20000006",
originalSharesEscrowed: "0",
tokensEscrowed: "1.20000006",
sharesEscrowed: "0",
},
},
},
},
}
augur.trading.getPositionInMarket({
address: "0x25ff5dc79a7c4e34254ff0f4a19d69e491201dd3",
market: "0x2221185d7f125b84ac4a1837a0688d2bb58e8491",
tickSize: "0.0001",
}, function (error, result) {
console.log(result);
});
// example output:
["1", "0.5", "1", "0", "0", "1", "1.5"]
augur.trading.getUserTradingHistory({
account: "0x000000000000000000000000000000000000d00d",
marketId: "0x0000000000000000000000000000000000000001",
outcome: 0,
sortBy: "price",
}, function (error, result) {
console.log(result);
});
// example output:
[
{
transactionHash: "0x0000000000000000000000000000000000000000000000000000000000000C00",
logIndex: 0,
orderId: "0x1100000000000000000000000000000000000000000000000000000000000000",
type: "buy",
price: "5.5",
amount: "0.2",
maker: false,
marketCreatorFees: "0",
reporterFees: "0",
selfFilled: false,
creator: "0x0000000000000000000000000000000000000b0b",
filler: "0x000000000000000000000000000000000000d00d",
settlementFees: "0",
marketId: "0x0000000000000000000000000000000000000001",
outcome: 0,
shareToken: "0x0100000000000000000000000000000000000000",
timestamp: 1506474500,
tradeGroupId: null,
}, {
amount: "2",
logIndex: 0,
maker: false,
marketCreatorFees: "0",
marketId: "0x0000000000000000000000000000000000000001",
orderId: "0x1990000000000000000000000000000000000000000000000000000000000000",
outcome: 0,
price: "4.2",
reporterFees: "0",
selfFilled: false,
creator: "0x0000000000000000000000000000000000000b0b",
filler: "0x000000000000000000000000000000000000d00d",
settlementFees: "0",
shareToken: "0x0100000000000000000000000000000000000000",
timestamp: 1509065474,
tradeGroupId: null,
transactionHash: "0x00000000000000000000000000000000000000000000000000000000d3adb33f",
type: "sell",
}
]
augur.trading.getUserTradingPositions({
universe: "0x02149d40d255fceac54a3ee3899807b0539bad60",
account: "0xE4EC477Bc4Abd2B18225Bb8CBa14BF57867f082B",
}, function (error, result) {
console.log(result);
});
// example output:
{
tradingPositions: [
{
position: "0.901",
marketId: "0x37adbd757099107946ceebb1791c5c6acda635fe",
outcome: 1,
timestamp: 1556857905,
netPosition: "0.901",
realized: "0",
unrealized: "0.4505",
total: "0.4505",
averagePrice: "0.5",
unrealizedCost: "0.4505",
realizedCost: "0",
totalCost: "0.4505",
realizedPercent: "0",
unrealizedPercent: "1",
totalPercent: "1",
unrealizedRevenue: "0.901",
frozenFunds: "0.4505",
lastTradePrice: "1",
lastTradePrice24hAgo: "1",
lastTradePrice24hChangePercent: "0",
unrealizedRevenue24hAgo: "0.901",
unrealizedRevenue24hChangePercent: "0"
},
{
position: "0.011",
marketId: "0x76a0067b4d3a6db11187a849b50a076e030e95ce",
outcome: 1,
timestamp: 1556857905,
netPosition: "0.011",
realized: "0",
unrealized: "0.00993999999999999999996",
total: "0.00993999999999999999996",
averagePrice: "0.09636363636363636364",
unrealizedCost: "0.00106000000000000000004",
realizedCost: "0",
totalCost: "0.00106000000000000000004",
realizedPercent: "0",
unrealizedPercent: "9.37735849056603773546",
totalPercent: "9.37735849056603773546",
unrealizedRevenue: "0.011",
frozenFunds: "0.00106",
lastTradePrice: "1",
lastTradePrice24hAgo: "1",
lastTradePrice24hChangePercent: "0",
unrealizedRevenue24hAgo: "0.011",
unrealizedRevenue24hChangePercent: "0"
},
{
position: "0",
marketId: "0x448d1d8280844513c38b2b73bde8a539d0022954",
outcome: 1,
timestamp: 1556857905,
netPosition: "-0.01",
realized: "0",
unrealized: "-0.0019",
total: "-0.0019",
averagePrice: "0.01",
unrealizedCost: "0.0099",
realizedCost: "0",
totalCost: "0.0099",
realizedPercent: "0",
unrealizedPercent: "-0.19191919191919191919",
totalPercent: "-0.19191919191919191919",
unrealizedRevenue: "0.008",
frozenFunds: "0.0099",
lastTradePrice: "0.2",
lastTradePrice24hAgo: "0.2",
lastTradePrice24hChangePercent: "0",
unrealizedRevenue24hAgo: "0.008",
unrealizedRevenue24hChangePercent: "0"
},
{
position: "0",
marketId: "0x6f5a05c21ff65c476d4b91f886984cd9c6797576",
outcome: 1,
timestamp: 1556857905,
netPosition: "-0.1",
realized: "0",
unrealized: "-0.21",
total: "-0.21",
averagePrice: "40",
unrealizedCost: "0.92",
realizedCost: "0",
totalCost: "0.92",
realizedPercent: "0",
unrealizedPercent: "-0.2282608695652173913",
totalPercent: "-0.2282608695652173913",
unrealizedRevenue: "0.71",
frozenFunds: "0.92",
lastTradePrice: "42.1",
lastTradePrice24hAgo: "75.9",
lastTradePrice24hChangePercent: "-0.8028503562945368171",
unrealizedRevenue24hAgo: "-2.67",
unrealizedRevenue24hChangePercent: "-1.26591760299625468165"
},
{
position: "0",
marketId: "0x84c47b8af766f19f14d1deb9bbcd99782422bba4",
outcome: 1,
timestamp: 1556857905,
netPosition: "-0.009",
realized: "0.0005",
unrealized: "-0.252",
total: "-0.2515",
averagePrice: "12",
unrealizedCost: "0.288",
realizedCost: "0.032",
totalCost: "0.32",
realizedPercent: "0.015625",
unrealizedPercent: "-0.875",
totalPercent: "-0.7859375",
unrealizedRevenue: "0.036",
frozenFunds: "0.321",
lastTradePrice: "40",
lastTradePrice24hAgo: "51",
lastTradePrice24hChangePercent: "-0.275",
unrealizedRevenue24hAgo: "-0.063",
unrealizedRevenue24hChangePercent: "-1.57142857142857142857"
}
],
tradingPositionsPerMarket: {
"0x37adbd757099107946ceebb1791c5c6acda635fe": {
timestamp: 1556857905,
marketId: "0x37adbd757099107946ceebb1791c5c6acda635fe",
realizedPercent: "0",
unrealizedPercent: "1",
totalPercent: "1",
unrealizedRevenue24hChangePercent: "0",
realized: "0",
unrealized: "0.4505",
total: "0.4505",
unrealizedCost: "0.4505",
realizedCost: "0",
totalCost: "0.4505",
unrealizedRevenue: "0.901",
frozenFunds: "0.4505",
unrealizedRevenue24hAgo: "0.901"
},
"0x76a0067b4d3a6db11187a849b50a076e030e95ce": {
timestamp: 1556857905,
marketId: "0x76a0067b4d3a6db11187a849b50a076e030e95ce",
realizedPercent: "0",
unrealizedPercent: "9.37735849056603773546",
totalPercent: "9.37735849056603773546",
unrealizedRevenue24hChangePercent: "0",
realized: "0",
unrealized: "0.00993999999999999999996",
total: "0.00993999999999999999996",
unrealizedCost: "0.00106000000000000000004",
realizedCost: "0",
totalCost: "0.00106000000000000000004",
unrealizedRevenue: "0.011",
frozenFunds: "0.00106",
unrealizedRevenue24hAgo: "0.011"
},
"0x448d1d8280844513c38b2b73bde8a539d0022954": {
timestamp: 1556857905,
marketId: "0x448d1d8280844513c38b2b73bde8a539d0022954",
realizedPercent: "0",
unrealizedPercent: "-0.19191919191919191919",
totalPercent: "-0.19191919191919191919",
unrealizedRevenue24hChangePercent: "0",
realized: "0",
unrealized: "-0.0019",
total: "-0.0019",
unrealizedCost: "0.0099",
realizedCost: "0",
totalCost: "0.0099",
unrealizedRevenue: "0.008",
frozenFunds: "0.0099",
unrealizedRevenue24hAgo: "0.008"
},
"0x6f5a05c21ff65c476d4b91f886984cd9c6797576": {
timestamp: 1556857905,
marketId: "0x6f5a05c21ff65c476d4b91f886984cd9c6797576",
realizedPercent: "0",
unrealizedPercent: "-0.2282608695652173913",
totalPercent: "-0.2282608695652173913",
unrealizedRevenue24hChangePercent: "-1.26591760299625468165",
realized: "0",
unrealized: "-0.21",
total: "-0.21",
unrealizedCost: "0.92",
realizedCost: "0",
totalCost: "0.92",
unrealizedRevenue: "0.71",
frozenFunds: "0.92",
unrealizedRevenue24hAgo: "-2.67"
},
"0x84c47b8af766f19f14d1deb9bbcd99782422bba4": {
timestamp: 1556857905,
marketId: "0x84c47b8af766f19f14d1deb9bbcd99782422bba4",
realizedPercent: "0.015625",
unrealizedPercent: "-0.875",
totalPercent: "-0.7859375",
unrealizedRevenue24hChangePercent: "-1.57142857142857142857",
realized: "0.0005",
unrealized: "-0.252",
total: "-0.2515",
unrealizedCost: "0.288",
realizedCost: "0.032",
totalCost: "0.32",
unrealizedRevenue: "0.036",
frozenFunds: "0.321",
unrealizedRevenue24hAgo: "-0.063"
}
},
tradingPositionsTotal: {
realizedPercent: "0.015625",
unrealizedPercent: "-0.00207252644567704527",
totalPercent: "-0.00173968239041764132",
unrealizedRevenue24hChangePercent: "-1.91891891891891891892",
realized: "0.0005",
unrealized: "-0.00346000000000000000004",
total: "-0.00296000000000000000004",
unrealizedCost: "1.66946000000000000000004",
realizedCost: "0.032",
totalCost: "1.70146000000000000000004",
unrealizedRevenue: "1.666",
frozenFunds: "1.70246",
unrealizedRevenue24hAgo: "-1.813"
},
frozenFundsTotal: {
frozenFunds: "1.70246"
}
}
augur.trading.normalizePrice({
minPrice: "0",
maxPrice: "2",
price: "0.4",
});
// example output:
"0.2"
augur.trading.placeTrade({
amount: "10",
sharesProvided: "0",
limitPrice: "2",
minPrice: "1",
maxPrice: "3",
numTicks: "10000",
_direction: 0,
_market: "0x8092bdf939e23a0e926021ffce5a062d0f598d1f",
_outcome: 0,
doNotCreateOrders: false,
meta: {
accountType: "privateKey",
address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
},
onSent: function(result) { console.log(result); },
onSuccess: function(result) { console.log(result); },
onFailed: function(result) { console.log(result); }
});
// This function does not return a value, but it calls the function `augur.trading.tradeUntilAmountIsZero`, which logs information to the console as it places Orders. To see this output, refer to the JS sample code for `augur.trading.tradeUntilAmountIsZero`.
augur.trading.simulateTrade({
orderType: 0,
outcome: 0,
shares: "3",
shareBalances: ["0", "5"],
tokenBalance: "0",
minPrice: "0",
maxPrice: "1",
numTicks: "10000",
price: "0.7",
marketCreatorFeeRate: "0",
reportingFeeRate: "0.01",
shouldCollectReportingFees: 1,
singleOutcomeOrderBook: {
buy: {
0x1000000000000000000000000000000000000000000000000000000000000000: {
amount: "2",
fullPrecisionPrice: "0.7",
sharesEscrowed: "2",
owner: "0x2228238db7ad03e505840bd361dc2f521a72adbc",
},
},
sell: {
0x2000000000000000000000000000000000000000000000000000000000000000: {
amount: "2",
fullPrecisionPrice: "0.7",
sharesEscrowed: "2",
owner: "0x2228238db7ad03e505840bd361dc2f521a72adbc",
},
},
},
}, function (error, result) {
console.log(result);
});
// example output:
{
sharesFilled: "2",
settlementFees: "0.006",
worstCaseFees: "0.009",
otherSharesDepleted: "3",
sharesDepleted: "0",
tokensDepleted: "0",
shareBalances: ["0", "2"],
}
augur.trading.tradeUntilAmountIsZero({
_price: "0.5",
_fxpAmount: "10",
sharesProvided: "0",
numTicks: "10000",
minPrice: "0",
maxPrice: "1",
_direction: 0,
_market: "0x8092bdf939e23a0e926021ffce5a062d0f598d1f",
_outcome: 0,
numOutcomes: 2,
doNotCreateOrders: false,
meta: {
accountType: "privateKey",
address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
},
onSent: function(result) { console.log(result); },
onSuccess: function(result) { console.log(result); },
onFailed: function(result) { console.log(result); }
});
// This function does not return a value, but it does log information to the console as it places Orders:
"tradeUntilAmountIsZero: "
{
"_price": "0.5",
"_fxpAmount": "10",
"numTicks": "10000",
"minPrice": "0",
"maxPrice": "1",
"_direction": 0,
"_market": "0x524925edb7a29cc35d886968253cb5e209655cf4",
"_outcome": 0,
"numOutcomes": 2,
"doNotCreateOrders": false
}
{"cost":"5000000000000000000","onChainAmount":"1000000000000000","onChainPrice":"5000"}
"cost: 5000000000000000000 wei 5 eth"
undefined
"estimated gas cost: 6175000000000000 wei 0.006175 eth"
{
"hash": "0xb134d37fb8a72957cb26267170ce4ca294e1e3d239622416529b7b795330ca08",
"callReturn": "0x4bbc239211b4e207eb9a05a071b3a5bb96b5b5573b29d26c18e2c31ffc70d105"
}
"TokensTransferred: "
{
"from": "0x913da4198e6be1d5f5e4a40d0667f70c0b5430eb",
"to": "0x524925edb7a29cc35d886968253cb5e209655cf4",
"value": "5000000000000000000",
"address": "0xd3a7c274e3e7b1990a9c23bec98adc2b7c448ac5",
"removed": false,
"transactionHash": "0xb134d37fb8a72957cb26267170ce4ca294e1e3d239622416529b7b795330ca08",
"transactionIndex": 0,
"logIndex": 1,
"blockNumber": 18336,
"blockHash": "0xb79a66c248ae8888f49773569ac19bd97ebb565222e4e37e5f903e5a82d9c97d",
"contractName": "Cash",
"eventName": "Transfer",
"sender": "0x913da4198e6be1d5f5e4a40d0667f70c0b5430eb",
"recipient": "0x524925edb7a29cc35d886968253cb5e209655cf4",
"token": "0xd3a7c274e3e7b1990a9c23bec98adc2b7c448ac5"
}
"convertLogToTransaction Transfer"
{
"from": "0x913da4198e6be1d5f5e4a40d0667f70c0b5430eb",
"to": "0x524925edb7a29cc35d886968253cb5e209655cf4",
"value": "5000000000000000000",
"address": "0xd3a7c274e3e7b1990a9c23bec98adc2b7c448ac5",
"removed": false,
"transactionHash": "0xb134d37fb8a72957cb26267170ce4ca294e1e3d239622416529b7b795330ca08",
"transactionIndex": 0,
"logIndex": 1,
"blockNumber": 18336,
"blockHash": "0xb79a66c248ae8888f49773569ac19bd97ebb565222e4e37e5f903e5a82d9c97d",
"contractName": "Cash",
"eventName": "Transfer",
"sender": "0x913da4198e6be1d5f5e4a40d0667f70c0b5430eb",
"recipient": "0x524925edb7a29cc35d886968253cb5e209655cf4",
"token": "0xd3a7c274e3e7b1990a9c23bec98adc2b7c448ac5"
}
"Order Created: "
{
"orderType": "buy",
"amount": "10",
"price": "0.5",
"creator": "0x913da4198e6be1d5f5e4a40d0667f70c0b5430eb",
"moneyEscrowed": "5000000000000000000",
"sharesEscrowed": "0",
"tradeGroupId": "0x0000000000000000000000000000000000000000000000000000000000000000",
"orderId": "0xe7505184c6ab0bab27793dc2804fb066465541e282c135232fa2ef7e964e2e7d",
"universe": "0x04252fa3b79b7626ffc87144dafeed0838eecd59",
"shareToken": "0x9315db4f8e425fa0ba47ae5fce58bbe9e9b18fea",
"address": "0x25ff5dc79a7c4e34254ff0f4a19d69e491201dd3",
"removed": false,
"transactionHash": "0xb134d37fb8a72957cb26267170ce4ca294e1e3d239622416529b7b795330ca08",
"transactionIndex": 0,
"logIndex": 2,
"blockNumber": 18336,
"blockHash": "0xb79a66c248ae8888f49773569ac19bd97ebb565222e4e37e5f903e5a82d9c97d",
"contractName": "Augur",
"eventName": "OrderCreated",
"marketId": "0x524925edb7a29cc35d886968253cb5e209655cf4",
"outcome": 0,
"orderCreator": "0x913da4198e6be1d5f5e4a40d0667f70c0b5430eb",
"orderState": "OPEN",
"fullPrecisionPrice": "0.5",
"fullPrecisionAmount": "10",
"tokensEscrowed": "5"
}
"convertTradeLogToTransaction CreateOrder"
{
"0x524925edb7a29cc35d886968253cb5e209655cf4": {
"0": [
{
"orderType": "buy",
"amount": "10",
"price": "0.5",
"creator": "0x913da4198e6be1d5f5e4a40d0667f70c0b5430eb",
"moneyEscrowed": "5000000000000000000",
"sharesEscrowed": "0",
"tradeGroupId": "0x0000000000000000000000000000000000000000000000000000000000000000",
"orderId": "0xe7505184c6ab0bab27793dc2804fb066465541e282c135232fa2ef7e964e2e7d",
"universe": "0x04252fa3b79b7626ffc87144dafeed0838eecd59",
"shareToken": "0x9315db4f8e425fa0ba47ae5fce58bbe9e9b18fea",
"address": "0x25ff5dc79a7c4e34254ff0f4a19d69e491201dd3",
"removed": false,
"transactionHash": "0xb134d37fb8a72957cb26267170ce4ca294e1e3d239622416529b7b795330ca08",
"transactionIndex": 0,
"logIndex": 2,
"blockNumber": 18336,
"blockHash": "0xb79a66c248ae8888f49773569ac19bd97ebb565222e4e37e5f903e5a82d9c97d",
"contractName": "Augur",
"eventName": "OrderCreated",
"marketId": "0x524925edb7a29cc35d886968253cb5e209655cf4",
"outcome": 0,
"orderCreator": "0x913da4198e6be1d5f5e4a40d0667f70c0b5430eb",
"orderState": "OPEN",
"fullPrecisionPrice": "0.5",
"fullPrecisionAmount": "10",
"tokensEscrowed": "5"
}
]
}
}
"constructTradingTransaction: CreateOrder "
{
"orderType": "buy",
"amount": "10",
"price": "0.5",
"creator": "0x913da4198e6be1d5f5e4a40d0667f70c0b5430eb",
"moneyEscrowed": "5000000000000000000",
"sharesEscrowed": "0",
"tradeGroupId": "0x0000000000000000000000000000000000000000000000000000000000000000",
"orderId": "0xe7505184c6ab0bab27793dc2804fb066465541e282c135232fa2ef7e964e2e7d",
"universe": "0x04252fa3b79b7626ffc87144dafeed0838eecd59",
"shareToken": "0x9315db4f8e425fa0ba47ae5fce58bbe9e9b18fea",
"address": "0x25ff5dc79a7c4e34254ff0f4a19d69e491201dd3",
"removed": false,
"transactionHash": "0xb134d37fb8a72957cb26267170ce4ca294e1e3d239622416529b7b795330ca08",
"transactionIndex": 0,
"logIndex": 2,
"blockNumber": 18336,
"blockHash": "0xb79a66c248ae8888f49773569ac19bd97ebb565222e4e37e5f903e5a82d9c97d",
"contractName": "Augur",
"eventName": "OrderCreated",
"marketId": "0x524925edb7a29cc35d886968253cb5e209655cf4",
"outcome": 0,
"orderCreator": "0x913da4198e6be1d5f5e4a40d0667f70c0b5430eb",
"orderState": "OPEN",
"fullPrecisionPrice": "0.5",
"fullPrecisionAmount": "10",
"tokensEscrowed": "5"
}
"getTradeAmountRemaining initial amount remaining: 1000000000000000 ocs 10 shares"
"starting amount: 1000000000000000 ocs 10 shares"
"remaining amount: 0 ocs 0 shares"
"actual cost: 5000000000000000000 wei 5 eth"
"tradeUntilAmountIsZero: "
{
"_price": "0.5",
"_fxpAmount": "0",
"numTicks": "10000",
"minPrice": "0",
"maxPrice": "1",
"_direction": 0,
"_market": "0x524925edb7a29cc35d886968253cb5e209655cf4",
"_outcome": 0,
"numOutcomes": 2,
"doNotCreateOrders": false,
"estimatedCost": null
}
{"cost":"0","onChainAmount":"0","onChainPrice":"5000"}
"cost: 0 wei 0 eth"
null
augur.trading.calculateProfitLoss(p)
Calculates realized and unrealized profit/loss for trades in a single Outcome. Note: buy/sell labels are from taker’s point of view.
Parameters:
p
(Object) Parameters object.p.trades
(Array.<Object>) Trades for a single Outcome {type: string, amount: string, price: string, maker: boolean}.p.lastPrice
(string) <optional> Price of this Outcome’s most recent trade, as a base-10 string. Defaults to 0.
Returns:
- (ProfitLoss) Realized and unrealized P/L.
augur.trading.calculateTradeCost(p)
Returns the cost for placing a specific trade.
Parameters:
p
(Object) Parameters object.p.displayPrice
(string) Normalized limit price for this trade, as a base-10 string.p.displayAmount
(string) Number of Shares to trade, as a base-10 string.p.sharesProvided
(string) <optional> Number of shares already owned and provided for this trade, as a base-10 string.p.numTicks
(string) The Number of Ticks for this Market.p.maxDisplayPrice
(string) The Maximum Display Price for this Market, as a base-10 string.p.minDisplayPrice
(string) The Minimum Display Price for this Market, as a base-10 string.p.orderType
(number) Order type (0 for “buy”, 1 for “sell”).
Returns:
- (TradeCost) Object containing information about the cost of placing the trade specified by the parameters in
p
.
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:
p
(Object) Parameters object.p.markets
(Array.<string>) Array of Market addresses for which to claim proceeds.p._shareHolder
(string) User address that holds the shares, as a 20-byte hexadecimal string.p.meta
(Meta) <optional> Authentication metadata for raw transactions.p.onSent
(function) Called if/when each transaction is broadcast to the network.p.onSuccess
(function) Called if/when all transactions are sealed and confirmed.p.onFailed
(function) Called if/when any of the transactions fail.
Returns:
- (Array.<string>) Array of Market addresses from which trading proceeds were attempted to be claimed, as 20-byte hexadecimal strings.
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:
p._market
is not Finalized.- The Post-Finalization Waiting Period has not passed.
Parameters:
p
(Object) Parameters object.p._market
(string) Market address for which to claim proceeds.p._shareHolder
(string) Ethereum address that holds the shares, as a 20-byte hexadecimal string.p.meta
(Meta) <optional> Authentication metadata for raw transactions.p.onSent
(function) Called if/when each transaction is broadcast to the network.p.onSuccess
(function) Called if/when all transactions are sealed and confirmed.p.onFailed
(function) Called if/when any of the transactions fail.
Returns:
- This function does not return a value.
augur.trading.denormalizePrice(p)
Rescales a price to its display range [minPrice, maxPrice]: displayPrice = normalizedPrice*(maxPrice - minPrice) + minPrice.
Parameters:
p
(Object) Parameters object.p.minPrice
(BigNumber|string) This Market’s minimum possible price, as a BigNumber or base-10 string.p.maxPrice
(BigNumber|string) This Market’s maximum possible price, as a BigNumber or base-10 string.p.normalizedPrice
(BigNumber|string) The price to be denormalized, as a BigNumber or base-10 string.
Returns:
- (string) Price rescaled to [minPrice, maxPrice], as a base-10 string.
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:
p
(Object) Parameters object.p.singleOutcomeOrderBookSide
(SingleOutcomeOrderBookSide) Bid Orders or Ask Orders for a particular Market and Outcome.p.orderType
(number) Order type (0 for “buy”, 1 for “sell”).p.price
(string) Limit price for this Order (i.e. the worst price the user will accept), as a base-10 string.
Returns:
- (Array.<Order>) Array of filtered and sorted Orders.
augur.trading.generateTradeGroupId(tradeGroupIdNumBytes)
Returns a randomly-generated trade group ID. (Trade group IDs are used by Augur’s UI to group orders.)
Parameters:
p
(Object) Parameters object.tradeGroupIdNumBytes
(number) <optional> Number of bytes the returned trade group ID should be. Defaults toaugur.constants.TRADE_GROUP_ID_NUM_BYTES
.
Returns:
- (string) Randomly-generated trade group ID.
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:
- A connection to an Augur Node has not been established.
Parameters:
p
(Object) Parameters object.p.marketId
(string) Contract address of the Market for which to retrieve the better/worse Orders, as a 20-byte hexadecimal string.p.outcome
(number) Market Outcome for which to find better/worse Orders. Valid values are in the range [0,7].p.orderType
(string) Desired type of Order. Valid values are “buy” and “sell”.p.price
(string) Price point at which to find better/worse Orders.
callback
(function) Called when better/worse Orders have been retrieved.
Returns:
- (BetterWorseOrders) Object containing the better/worse Order IDs, as hexadecimal strings.
augur.trading.getOrders(p, callback)
Returns a list of orders in a given Universe or Market.
This function will fail if:
- A connection to an Augur Node has not been established.
Parameters:
p
(Object) Parameters object.p.universe
(string) <optional> Contract address of the Universe from which to retrieve orders, as a 20-byte hexadecimal string. Either this parameter or the marketId must be specified.p.marketId
(string) <optional> Contract address of the Market from which to retrieve Orders, as a 20-byte hexadecimal string. Either this parameter or the Universe must be specified.p.outcome
(number) <optional> Market Outcome to filter results by. Valid values are in the range [0,7].p.orderType
(string) <optional> Type of trade. Valid values are “buy” and “sell”.p.creator
(string) <optional> Ethereum address of the Order creator, as a 20-byte hexadecimal string.p.orderState
(ORDER_STATE) <optional> State of orders by which to filter results. Valid values are “ALL”, “CANCELED”, “CLOSED”, & “OPEN”.p.orphaned
(boolean) <optional> When set totrue
, this parameter causes the function to return only Orphaned Orders; otherwise, the function returns non-Orphaned Orders. Defaults tofalse
.p.earliestCreationTime
(number) <optional> Earliest timestamp, in seconds, at which to truncate order results. (This timestamp is when the block on the Ethereum blockchain containing the transfer was created.)p.latestCreationTime
(number) <optional> Latest timestamp, in seconds, at which to truncate order results. (This timestamp is when the block on the Ethereum blockchain containing the transfer was created.)p.sortBy
(string) <optional> Field name by which to sort the orders.p.isSortDescending
(boolean) <optional> Whether to sort orders in descending order by sortBy field.p.limit
(number) <optional> Maximum number of orders to return.p.offset
(number) <optional> Number of orders to truncate from the beginning of the results.
callback
(function) Called when the requested orders for this Market/Universe have been received and parsed.
Returns:
- (Object) Object containing a SingleSideOrderBook object for one side of the Order Book (buy or sell), keyed by Universe/Market and Outcome.
augur.trading.getPositionInMarket(p, callback)
Gets the number of Shares held by a specific Ethereum address for each Outcome of a Market.
Parameters:
p
(Object) Parameters object.p.address
(string) Address for which to look up Share balances.p.market
(string) Market for which to look up Share balances.p.tickSize
(string) Tick size (interval) for this Market.
callback
(function) Called when the requested Market position has been received and parsed.
Returns:
- (Array.<string>) Number of Shares for each Outcome of this Market.
augur.trading.getUserTradingHistory(p, callback)
Returns information about the trades a specific user has made.
This function will fail if:
- A connection to an Augur Node has not been established.
Parameters:
p
(Object) Parameters object.p.account
(string) Ethereum address of the user for which to retrieve trading history, as a 20-byte hexadecimal string.p.universe
(string) <optional> Contract address of the Universe in which to look up the trading history, as a 20-byte hexadecimal string. Either this parameter or the Market ID must be specified.p.marketId
(string|Array<string>) <optional> Contract address(es) of the Market(s) in which to look up the trading history, as a 20-byte hexadecimal string. Either this parameter or the Universe must be specified.p.outcome
(number) Outcome of the Share being bought/sold. Valid values are in the range [0,7].p.orderType
(string) Type of trade. Valid values are “buy” and “sell”.p.ignoreSelfTrades
(boolean) <optional> Whether to ignore trades a user made with himself/herself when retrieving results. Defaults tofalse
.p.sortBy
(string) <optional> Field name by which to sort the trading history.p.isSortDescending
(boolean) <optional> Whether to sort the trading history in descending order bysortBy
field.p.limit
(number) <optional> Maximum number of trading history reports to return.p.offset
(number) <optional> Number of trading history reports to truncate from the beginning of the results.
callback
(function) Called when trading history has been received and parsed.
Returns:
- (Array.<UserTrade>) Array of the user’s trades, keyed by Universe/Market ID.
augur.trading.getUserTradingPositions(p, callback)
Returns the trading positions held by a specific user.
This function will fail if:
- A connection to an Augur Node has not been established.
Parameters:
p
(Object) Parameters object.p.account
(string) Ethereum address of the user for which to retrieve trading positions, as a 20-byte hexadecimal string.p.universe
(string) <optional> Contract address of the Universe in which to look up the trading positions, as a 20-byte hexadecimal string. Either this parameter orp.marketId
must be specified.p.marketId
(string) <optional> Contract address of the Market in which to look up the trading positions, as a 20-byte hexadecimal string. Either this parameter orp.universe
must be specified.p.outcome
(number) <optional> Outcome of the Share held for the Market. Valid values are in the range [0,7].p.endTime
(number) <optional> Unix timestamp after which user trading positions will be filtered from returned results. Defaults to the current timestamp.p.sortBy
(string) <optional> Field name by which to sort the trading positions.p.isSortDescending
(boolean) <optional> Whether to sort the trading positions in descending order bysortBy
field.p.limit
(number) <optional> Maximum number of trading positions reports to return.p.offset
(number) <optional> Number of trading positions reports to truncate from the beginning of the results.
callback
(function) Called when the trading positions have been received and parsed.
Returns:
- (Array.<UserTradePosition>) Array of the user’s trading positions.
augur.trading.normalizePrice(p)
Rescales a price to lie on [0, 1]: normalizedPrice = (price - minPrice) / (maxPrice - minPrice).
Parameters:
p
(Object) Parameters object.p.minPrice
(BigNumber|string) This Market’s minimum possible price, as a BigNumber or base-10 string.p.maxPrice
(BigNumber|string) This Market’s maximum possible price, as a BigNumber or base-10 string.p.normalizedPrice
(BigNumber|string) The price to be normalized, as a BigNumber or base-10 string.
Returns:
- (string) Price rescaled to [0, 1], as a base-10 string.
augur.trading.placeTrade(p)
Parameters:
p
(Object) Parameters object.p.amount
(string) Number of Shares to trade, as a base-10 string.p.sharesProvided
(string) Number of shares already owned and provided for this trade, as a base-10 string.p.limitPrice
(string) Display (non-normalized) limit price for this trade, as a base-10 string.p.minPrice
(string) The Minimum Display Price (non-normalized) for this Market, as a base-10 string.p.maxPrice
(string) The Maximum Display Price (non-normalized) for this Market, as a base-10 string.p.numTicks
(string) The number of Ticks for this market.p._direction
(number) Order type (0 for “buy”, 1 for “sell”).p._market
(string) Ethereum contract address of the Market in which to trade, as a 20-byte hexadecimal stringp._outcome
(number) Outcome ID to trade, must be an integer value in between 0 and 7.p._tradeGroupId
(string) <optional> ID logged with each trade transaction, as a hexadecimal string. (This is generally just used by Augur’s UI to group trades client-side.)p.doNotCreateOrders
(boolean) <optional> If set to true, this trade will only take existing Orders off the Order Book, not create new ones Defaults tofalse
.p.meta
(Meta) <optional> Authentication metadata for raw transactions.p.onSent
(function) Called when the first trading transaction is broadcast to the network.p.onSuccess
(function) Called when the full trade completes successfully.p.onFailed
(function) Called if any part of the trade fails.
Returns:
- This function does not return a value.
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:
p
(Object) Trade simulation parameters.p.orderType
(number) Order type (0 for “buy”, 1 for “sell”).p.outcome
(number) Outcome ID to trade. Valid values are in the range [0,7].p.shareBalances
(string[]) Number of Shares the user owns of each Outcome in ascending order, as an array of base-10 strings.p.tokenBalance
(string) Number of tokens (e.g., wrapped Ether) the user owns, as a base-10 string.p.minPrice
(string) This Market’s minimum possible price, as a base-10 string.p.maxPrice
(string) This Market’s maximum possible price, as a base-10 string.p.numTicks
(string) The number of Ticks for this Market.p.price
(string|null) Limit price for this Order (i.e. the worst price the user will accept), as a base-10 string.p.shares
(string) Number of Shares to trade, as a base-10 string.p.marketCreatorFeeRate
(string) The fee rate charged by the Market creator (e.g., pass in “0.01” if the fee is 1%), as a base-10 string.p.marketOrderBook
(SingleOutcomeOrderBook) The full Order Book (buy and sell) for this Market and Outcome.p.shouldCollectReportingFees
(boolean) <optional> False if reporting fees are not collected; this is rare and only occurs in disowned Markets. Defaults totrue
.
Returns:
- (SimulatedTrade) Projected fees paid, shares and tokens spent, and final balances after the trade is complete.
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:
p
(Object) Parameters object.p._price
(string) Normalized limit price for this trade, as a base-10 string.p._fxpAmount
(string) Number of Shares to trade, as a base-10 string.p.sharesProvided
(string) Number of shares already owned and provided for this trade, as a base-10 string.p.numTicks
(string) The number of Ticks for this Market.p._direction
(number) Order type (0 for “buy”, 1 for “sell”).p._market
(string) Market in which to trade, as a hex string.p._outcome
(number) Outcome ID to trade, must be an integer value on [0, 7].p.numOutcomes
(number) The number of outcomes in the market, must be an integer value on [2, 8].p.minPrice
(string) The Minimum Display Price for this Market, as a base-10 string.p.maxPrice
(string) The Maximum Display Price for this Market, as a base-10 string.p._tradeGroupId
(string) <optional> ID logged with each trade transaction, as a hexadecimal string. (This is generally just used by Augur’s UI to group trades client-side.)p.doNotCreateOrders
(boolean) <optional> If set to true, this trade will only take existing orders off the book, not create new ones. Defaults tofalse
.p.meta
(Meta) <optional> Authentication metadata for raw transactions.p.onSent
(function) Called when the first trading transaction is broadcast to the network.p.onSuccess
(function) Called when the full trade completes successfully.p.onFailed
(function) Called if any part of the trade fails.
Returns:
- This function does not return a value.
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:
bigNumber
(BigNumber)
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:
displayAmount
(BigNumber) Number of Shares displayed in Augur’s UI.tickSize
(BigNumber) Tick size.
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:
displayPrice
(BigNumber) Maximum Display Price for a Market, as it is displayed in Augur’s UI.minDisplayPrice
(BigNumber) Minimum Display Price for a Market.tickSize
(BigNumber) Tick size.
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:
onChainAmount
(BigNumber) Number of Shares as it is stored on the Ethereum blockchain.tickSize
(BigNumber) Tick size.
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:
onChainPrice
(BigNumber) Maximum Display Price for a Market, as it is stored on the Ethereum blockchain.minDisplayPrice
(BigNumber) Minimum Display Price for a Market.tickSize
(BigNumber) Tick size.
Returns:
(BigNumber) Equivalent price as it is displayed in Augur’s UI.
Call API
// Call API Example
/**
* Get the Number of Outcomes for the Market at address:
* 0x9368ff3e9ce1c0459b309fac6dd4e69229b91a42
*/
var market = "0x9368ff3e9ce1c0459b309fac6dd4e69229b91a42";
// augur.api.<Contract Name>.<Contract Method>(<Params Object>, <Callback Function>);
augur.api.Market.getNumberOfOutcomes({
tx: { to: market }
}, function (error, numberOfOutcomes) {
console.log(error);
console.log(numberOfOutcomes);
});
// console prints 2
The Call API of augur.js is made up of “getter” functions that retrieve information from Augur’s Solidity smart contracts using Ethereum’s eth_call
RPC; however, these functions do not write any information to the Ethereum blockchain. The Call API is intended for more granular “gets” than the Simplified API allows, and its functions are mapped directly to the public functions of Augur’s Solidity smart contracts.
All functions in the Call API accept two arguments:
p
, a parameters object containing any key/value pairs matching the input parameters for the contract method, and (in some cases) atx
object with the Ethereum contract address to call. Thetx
object is described in more detail in the Transaction API section.- A callback function.
The Call API functions are part of the augur.api
object and follow a pattern of augur.api.<Contract Name>.<Contract Function>(<Parameters Object>, <Callback Function>)
.
Augur Call API
augur.api.Augur.isKnownCrowdsourcer({
_universe: "0x3336eaefcfaf7ea1e17c4768a554d57800699555"
}, function (error, isKnownCrowdsourcer) {
console.log(isKnownCrowdsourcer);
});
// example output:
true
augur.api.Augur.isKnownUniverse({
_universe: "0x22d6eaefcfaf7ea1e17c4768a554d57800699ecc"
}, function (error, isKnownUniverse) {
console.log(isKnownUniverse);
});
// example output:
true
Provides JavaScript bindings for the Augur Solidity Contract, which handles Universe creation and event logging.
augur.api.Augur.isKnownCrowdsourcer(p, callback)
Augur keeps track of its Crowdsourcers internally. This function returns whether the specified Crowdsourcer is a contract address that is known to Augur.
Parameters:
p
(Object) Parameters object.
p._crowdsourcer
(string) Crowdsourcer contract address, as a 20-byte hexadecimal value.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (boolean)
true
if the specified Crowdsourcer is in Augur’s list of known Crowdsoucers, orfalse
otherwise.
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:
p
(Object) Parameters object.
p._universe
(string) Universe contract address, as a 20-byte hexadecimal value.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (boolean)
true
if the specified Universe is in Augur’s list of known Universe, orfalse
otherwise.
Cash Call API
// Cash Call API Examples:
// The Ethereum contract address for Augur.sol can be
// obtained by calling `augur.augurNode.getSyncData`.
var _augurContractAddress = "0x67cbf60a24ab922af99e6f335c0ff2b084d5bdbe";
augur.api.Cash.allowance({
_owner: "0x913da4198e6be1d5f5e4a40d0667f70c0b5430eb",
_spender: _augurContractAddress,
}, function(error, allowance) {
console.log(allowance);
});
// example output:
"115792089237316195423570985008687907853269984665640564039457584007913129639935"
Provides JavaScript bindings for the Cash Solidity Contract, which is used internally by Augur as an ERC-20 wrapper for ETH.
augur.api.Cash.allowance(p, callback)
Returns the amount of attoCash that a given Ethereum contract is allowed to spend on behalf of a particular user.
Parameters:
p
(Object) Parameters object.
p._owner
(string) Ethereum address of the owner of the Cash, as a 20-byte hexadecimal value.p._spender
(string) Ethereum address of the contract allowed to spend on behalf ofp._owner
, as a 20-byte hexadecimal string. (This should be the address of the Augur.sol contract.)
callback
(function) <optional> Called after the function’s result has been retrieved.
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:
p
(Object) Parameters object.
p._market
(string) Ethereum address of the Market in which to calculate the Creator Fee, as a 20-byte hexadecimal value.p._amount
(string) Number of Share Units, as a hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (string) Creator Fee, in attoETH, as a stringified unsigned integer.
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:
p
(Object) Parameters object.
p._market
(string) Ethereum address of the Market in which to calculate trading proceeds, as a 20-byte hexadecimal value.p._outcome
(string) Outcome for which to calculate trading proceeds, as a hexadecimal string.p._numberOfShares
(string) Quantity of Share Units for which to calculate trading proceeds, as a hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (string) Amount of attoETH that a number of Shares in a particular Outcome of a given Market are worth, as a stringified unsigned integer.
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:
p
(Object) Parameters object.callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (string) Augur’s internal Unix timestamp, as a stringified unsigned integer.
Dispute Crowdsourcer Call API
// Dispute Crowdsourcer Contract Call API Examples:
// Dispute Crowdsourcer contract addresses for a Market can be
// obtained by calling `augur.api.Market.getReportingParticipant`
// or `augur.api.Market.derivePayoutDistributionHash`, followed
// by `augur.api.Market.getCrowdsourcer`.
var disputeCrowdsourcer = "0xafa6eaefcfaf7ea1e17c4768a554d57800699ec5";
augur.api.DisputeCrowdsourcer.getFeeWindow({
tx: { to: disputeCrowdsourcer }
}, function (error, feeWindow) {
console.log(feeWindow);
});
// example output:
"0x1f90cc6b4e89303e451c9b852827b5791667f570"
augur.api.DisputeCrowdsourcer.getMarket({
tx: { to: disputeCrowdsourcer }
}, function (error, market) {
console.log(market);
});
// example output:
"0xaa90cc6b4e89303e451c9b852827b5791667f5aa"
augur.api.DisputeCrowdsourcer.getPayoutDistributionHash({
tx: { to: disputeCrowdsourcer }
}, function (error, payoutDistributionHash) {
console.log(payoutDistributionHash);
});
// example output:
"0x4480ed40f94e2cb2ca244eb862df2d350300904a96039eb53cba0e34b8ace90a"
augur.api.DisputeCrowdsourcer.getPayoutNumerator({
_outcome: "0x0",
tx: { to: disputeCrowdsourcer },
}, function (error, payoutNumerator) {
console.log(payoutNumerator);
});
// example output:
"1000"
augur.api.DisputeCrowdsourcer.getReputationToken({
tx: { to: disputeCrowdsourcer }
}, function (error, reputationToken) {
console.log(reputationToken);
});
// example output:
"0xff90cc6b4e89303e451c9b852827b5791667f5ff"
augur.api.DisputeCrowdsourcer.getSize({
tx: { to: disputeCrowdsourcer }
}, function (error, size) {
console.log(size);
});
// example output:
"174435000000000000"
augur.api.DisputeCrowdsourcer.getStake({
tx: { to: disputeCrowdsourcer }
}, function (error, stake) {
console.log(stake);
});
// example output:
"78123523"
augur.api.DisputeCrowdsourcer.isDisavowed({
tx: { to: disputeCrowdsourcer }
}, function (error, isDisavowed) {
console.log(isDisavowed);
});
// example output:
true
augur.api.DisputeCrowdsourcer.isInvalid({
tx: { to: disputeCrowdsourcer }
}, function (error, isInvalid) {
console.log(isInvalid);
});
// example output:
true
Provides JavaScript bindings for the DisputeCrowdsourcer Solidity Contract, which allows users to Stake and redeem REP on Outcomes other than a Market’s Tentative Outcome.
augur.api.DisputeCrowdsourcer.getFeeWindow(p, callback)
Gets the Fee Window to which a Dispute Crowdsourcer belongs.
Parameters:
p
(Object) Parameters object.
p.tx
(Object) Object containing details about how this function call should be made.p.tx.to
(string) Ethereum contract address of the Dispute Crowdsourcer on which to call this function, as a 20-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (string) Ethereum contract address of the Dispute Crowdsourcer’s Fee Window, as a 20-byte hexadecimal string.
augur.api.DisputeCrowdsourcer.getMarket(p, callback)
Gets the Market to which a Dispute Crowdsourcer belongs.
Parameters:
p
(Object) Parameters object.
p.tx
(Object) Object containing details about how this function call should be made.p.tx.to
(string) Ethereum contract address of the Dispute Crowdsourcer on which to call this function, as a 20-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (string) Ethereum contract address of the Dispute Crowdsourcer’s Market, as a 20-byte hexadecimal string.
augur.api.DisputeCrowdsourcer.getPayoutDistributionHash(p, callback)
Gets the Payout Distribution Hash for a Dispute Crowdsourcer.
Parameters:
p
(Object) Parameters object.
p.tx
(Object) Object containing details about how this function call should be made.p.tx.to
(string) Ethereum contract address of the Dispute Crowdsourcer on which to call this function, as a 20-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (string) Payout Distribution Hash for the Dispute Crowdsourcer, as a 32-byte hexadecimal string.
augur.api.DisputeCrowdsourcer.getPayoutNumerator(p, callback)
Gets the Payout Numerator of a given Outcome for a Dispute Crowdsourcer.
Parameters:
p
(Object) Parameters object.
p._outcome
(string) Outcome for which to get the Payout Numerator, as a hexadecimal string.p.tx
(Object) Object containing details about how this function call should be made.p.tx.to
(string) Ethereum contract address of the Dispute Crowdsourcer on which to call this function, as a 20-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (string) Payout Numerator for the Dispute Crowdsourcer, as a stringified unsigned integer.
augur.api.DisputeCrowdsourcer.getReputationToken(p, callback)
Gets the Reputation Token in which a Dispute Crowdsourcer is denominated.
Parameters:
p
(Object) Parameters object.
p.tx
(Object) Object containing details about how this function call should be made.p.tx.to
(string) Ethereum contract address of the Dispute Crowdsourcer on which to call this function, as a 20-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (string) Ethereum contract address of the Dispute Crowdsourcer’s Reputation Token, as a 20-byte hexadecimal string.
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:
p
(Object) Parameters object.
p.tx
(Object) Object containing details about how this function call should be made.p.tx.to
(string) Ethereum contract address of the Dispute Crowdsourcer on which to call this function, as a 20-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (string) attoREP required by the Dispute Crowdsourcer to Challenge the Tentative Outcome of its Market, as a stringified unsigned integer.
augur.api.DisputeCrowdsourcer.getStake(p, callback)
Gets the amount of attoREP that has been Staked on a Dispute Crowdsourcer.
Parameters:
p
(Object) Parameters object.
p.tx
(Object) Object containing details about how this function call should be made.p.tx.to
(string) Ethereum contract address of the Dispute Crowdsourcer on which to call this function, as a 20-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (string) attoREP Staked on the Dispute Crowdsourcer, as a stringified unsigned integer.
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:
- Another Dispute Crowdsourcer belonging to the same Market and in the same Fee Window successfully fills its Dispute Bond.
- 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. - The Dispute Crowdsourcer’s Market Forks, and
augur.api.DisputeCrowdsourcer.fork
is called on the Dispute Crowdsourcer.
Parameters:
p
(Object) Parameters object.
p.tx
(Object) Object containing details about how this function call should be made.p.tx.to
(string) Ethereum contract address of the Dispute Crowdsourcer on which to call this function, as a 20-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (boolean)
true
if the Dispute Crowdsourcer has been disavowed, orfalse
otherwise.
augur.api.DisputeCrowdsourcer.isInvalid(p, callback)
Returns whether a Dispute Crowdsourcer represents the Invalid Outcome for its Market.
Parameters:
p
(Object) Parameters object.
p.tx
(Object) Object containing details about how this function call should be made.p.tx.to
(string) Ethereum contract address of the Dispute Crowdsourcer on which to call this function, as a 20-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (boolean)
true
if the Dispute Crowdsourcer represents the Invalid Outcome for its Market, orfalse
otherwise.
Fee Window Call API
// Fee Window Contract Call API Examples:
// Fee Window contract addresses can be obtained using a variety of Call API functions,
// including `augur.api.Universe.getCurrentFeeWindow` and `augur.api.Universe.getFeeWindowByTimestamp`.
var feeWindow = "0x37a809f8139e5637fd94c7d34912cb15c6496111";
augur.api.FeeWindow.getEndTime({
tx: { to: feeWindow }
}, function (error, endTime) {
console.log(endTime);
});
// example output:
"1517443200"
augur.api.FeeWindow.getNumDesignatedReportNoShows({
tx: { to: feeWindow }
}, function (error, numDesignatedReportNoShows) {
console.log(numDesignatedReportNoShows);
});
// example output:
"2"
augur.api.FeeWindow.getNumIncorrectDesignatedReportMarkets({
tx: { to: feeWindow }
}, function (error, numIncorrectDesignatedReportMarkets) {
console.log(numIncorrectDesignatedReportMarkets);
});
// example output:
"10"
augur.api.FeeWindow.getNumInvalidMarkets({
tx: { to: feeWindow }
}, function (error, numInvalidMarkets) {
console.log(numInvalidMarkets);
});
// example output:
"3"
augur.api.FeeWindow.getNumMarkets({
tx: { to: feeWindow }
}, function (error, numMarkets) {
console.log(numMarkets);
});
// example output:
"65"
augur.api.FeeWindow.getReputationToken({
tx: { to: feeWindow }
}, function (error, reputationToken) {
console.log(reputationToken);
});
// example output:
"0x2a73cec0b62fcb8c3120bc80bdb2b1351c8c2d1e"
augur.api.FeeWindow.getStartTime({
tx: { to: feeWindow }
}, function (error, startTime) {
console.log(startTime);
});
// example output:
"1516838400"
augur.api.FeeWindow.getUniverse({
tx: { to: feeWindow }
}, function (error, universe) {
console.log(universe);
});
// example output:
"0x0920d1513057572be46580b7ef75d1d01a99a3e5"
augur.api.FeeWindow.isActive({
tx: { to: feeWindow }
}, function (error, isActive) {
console.log(isActive);
});
// example output:
true
augur.api.FeeWindow.isOver({
tx: { to: feeWindow }
}, function (error, isOver) {
console.log(isOver);
});
// example output:
false
Provides JavaScript bindings for the FeeWindow Solidity Contract, which allows for the buying and redeeming of Participation Tokens.
augur.api.FeeWindow.getEndTime(p, callback)
Returns a Unix timestamp for when the specified Fee Window will end. A Fee Window is considered active for a total of 7 days, then ends, and is no longer considered to be active.
Parameters:
p
(Object) Parameters object.
p.tx
(Object) Object containing details about how this function call should be made.p.tx.to
(string) Ethereum contract address of the Fee Window on which to call this function, as a 20-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (string) Unix timestamp at which the Fee Window ends, as a stringified unsigned integer.
augur.api.FeeWindow.getNumDesignatedReportNoShows(p, callback)
Returns the number of Markets belonging to the specified Fee Window, in which the Designated Reporter failed to Report during the Designated Reporting Phase. These Markets will have a No-Show Bond up for grabs for the First Public Reporter because these Markets have yet to receive a Report. This only includes Markets where Designated Reporters failed to Report, and does not include Markets where the Designated Reporter’s Tentative Outcome was Challenged.
Parameters:
p
(Object) Parameters object.
p.tx
(Object) Object containing details about how this function call should be made.p.tx.to
(string) Ethereum contract address of the Fee Window on which to call this function, as a 20-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (string) Number of Markets belonging to the Fee Window, where the Designated Reporter failed to Report during the Designated Reporting Phase, as a stringified unsigned integer.
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:
p
(Object) Parameters object.
p.tx
(Object) Object containing details about how this function call should be made.p.tx.to
(string) Ethereum contract address of the Fee Window on which to call this function, as a 20-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (string) Number of Markets in the Fee Window, where the Designated Report was Challenged in the current Dispute Round Phase or the Designated Reporter did not Report, as a stringified unsigned integer.
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:
p
(Object) Parameters object.
p.tx
(Object) Object containing details about how this function call should be made.p.tx.to
(string) Ethereum contract address of the Fee Window on which to call this function, as a 20-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (string) Number of Markets Reported as Invalid in the Fee Window, as a stringified unsigned integer.
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:
p
(Object) Parameters object.
p.tx
(Object) Object containing details about how this function call should be made.p.tx.to
(string) Ethereum contract address of the Fee Window on which to call this function, as a 20-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (string) Number of Markets in the Dispute Round Phase for the Fee Window, as a stringified unsigned integer.
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:
p
(Object) Parameters object.
p.tx
(Object) Object containing details about how this function call should be made.p.tx.to
(string) Ethereum contract address of the Fee Window on which to call this function, as a 20-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (string) Ethereum contract address of the Reputation Token used by the Fee Window, as a 20-byte hexadecimal string.
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:
p
(Object) Parameters object.
p.tx
(Object) Object containing details about how this function call should be made.p.tx.to
(string) Ethereum contract address of the Fee Window on which to call this function, as a 20-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (string) Unix timestamp at which the Fee Window starts, as a stringified unsigned integer.
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:
p
(Object) Parameters object.
p.tx
(Object) Object containing details about how this function call should be made.p.tx.to
(string) Ethereum contract address of the Fee Window on which to call this function, as a 20-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (string) Ethereum contract address of the Universe to which the Fee Window belongs, as a 20-byte hexadecimal string.
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:
p
(Object) Parameters object.
p.tx
(Object) Object containing details about how this function call should be made.p.tx.to
(string) Ethereum contract address of the Fee Window on which to call this function, as a 20-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
true
if the specified Fee Window is active, orfalse
otherwise.
augur.api.FeeWindow.isOver(p, callback)
Returns whether the 7-day Fee Window specified has ended.
Parameters:
p
(Object) Parameters object.
p.tx
(Object) Object containing details about how this function call should be made.p.tx.to
(string) Ethereum contract address of the Fee Window on which to call this function, as a 20-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (boolean)
true
if the Fee Window has ended, orfalse
otherwise.
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:
p
(Object) Parameters object.
p.tx
(Object) Object containing details about how this function call should be made.p.tx.to
(string) Ethereum contract address of the InitialReporter contract on which to call this function, as a 20-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (boolean)
true
if the Designated Reporter submitted a Report within the Designated Reporting Phase, orfalse
otherwise.
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:
p
(Object) Parameters object.
p.tx
(Object) Object containing details about how this function call should be made.p.tx.to
(string) Ethereum contract address of the InitialReporter contract on which to call this function, as a 20-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (boolean)
true
if the Payout Distribution Hash submitted in the Designated Report is the same as the winning Payout Distribution Hash for the InitialReporter contract, orfalse
otherwise.
augur.api.InitialReporter.getDesignatedReporter(p, callback)
Returns the Ethereum address for the Designated Reporter for the InitialReporter contract.
Parameters:
p
(Object) Parameters object.
p.tx
(Object) Object containing details about how this function call should be made.p.tx.to
(string) Ethereum contract address of the InitialReporter contract on which to call this function, as a 20-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (string) Ethereum address of the Designated Reporter for the InitialReporter contract, as a 20-byte hexadecimal string.
augur.api.InitialReporter.getFeeWindow(p, callback)
Returns the Ethereum contract address of the Fee Window to which the InitialReporter contract belongs.
Parameters:
p
(Object) Parameters object.
p.tx
(Object) Object containing details about how this function call should be made.p.tx.to
(string) Ethereum contract address of the InitialReporter contract on which to call this function, as a 20-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (string) Ethereum contract address of the Fee Window to which the InitialReporter contract belongs, as a 20-byte hexadecimal string.
augur.api.InitialReporter.getMarket(p, callback)
Returns the Ethereum contract address of the Market to which the InitialReporter contract belongs.
Parameters:
p
(Object) Parameters object.
p.tx
(Object) Object containing details about how this function call should be made.p.tx.to
(string) Ethereum contract address of the InitialReporter contract on which to call this function, as a 20-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (string) Ethereum contract address of the Market to which the InitialReporter contract belongs, as a 20-byte hexadecimal string.
augur.api.InitialReporter.getPayoutDistributionHash(p, callback)
Returns the Payout Distribution Hash for the InitialReporter contract.
Parameters:
p
(Object) Parameters object.
p.tx
(Object) Object containing details about how this function call should be made.p.tx.to
(string) Ethereum contract address of the InitialReporter contract on which to call this function, as a 20-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (string) Payout Distribution Hash for the InitialReporter contract, as a 32-byte hexadecimal string.
augur.api.InitialReporter.getPayoutNumerator(p, callback)
Returns the Payout Numerator of a given Outcome for the InitialReporter contract.
Parameters:
p
(Object) Parameters object.
p._outcome
(string) Outcome for which to get the Payout Numerator, as a hexadecimal string.p.tx
(Object) Object containing details about how this function call should be made.p.tx.to
(string) Ethereum contract address of the InitialReporter contract on which to call this function, as a 20-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (string) Payout Numerator of a given Outcome for the InitialReporter contract, as a stringified unsigned integer.
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:
p
(Object) Parameters object.
p.tx
(Object) Object containing details about how this function call should be made.p.tx.to
(string) Ethereum contract address of the InitialReporter contract on which to call this function, as a 20-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (string) Unix timestamp of when the Initial Report was submitted, as a stringified unsigned integer.
augur.api.InitialReporter.getReputationToken(p, callback)
Returns the Reputation Token (REP) Ethereum contract address used by the InitialReporter contract.
Parameters:
p
(Object) Parameters object.
p.tx
(Object) Object containing details about how this function call should be made.p.tx.to
(string) Ethereum contract address of the InitialReporter contract on which to call this function, as a 20-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (string) Reputation Token Ethereum contract address used by the InitialReporter contract, as a 20-byte hexadecimal string.
augur.api.InitialReporter.getSize(p, callback)
Returns the amount of attoREP required to be Staked on an Outcome in order to submit the Initial Report. For Initial Reports, this value will always be the same as the value returned by augur.api.InitialReporter.getStake
.
Parameters:
p
(Object) Parameters object.
p.tx
(Object) Object containing details about how this function call should be made.p.tx.to
(string) Ethereum contract address of the InitialReporter contract on which to call this function, as a 20-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (string) Amount of attoREP Staked on the Reported Outcome of the Initial Report, as a stringified unsigned integer.
augur.api.InitialReporter.getStake(p, callback)
Returns the amount of attoREP Staked on the Reported Outcome of the specified InitialReporter contract. For Initial Reports, this value will always be the same as the value returned by augur.api.InitialReporter.getSize
.
Parameters:
p
(Object) Parameters object.
p.tx
(Object) Object containing details about how this function call should be made.p.tx.to
(string) Ethereum contract address of the InitialReporter contract on which to call this function, as a 20-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (string) Amount of attoREP Staked on the Initial Report for the Market of the specified InitialReporter contract, as a stringified unsigned integer.
augur.api.InitialReporter.isInvalid(p, callback)
Returns whether the submitted Initial Report said theMarket for the InitialReporter contract was Invalid.
Parameters:
p
(Object) Parameters object.
p.tx
(Object) Object containing details about how this function call should be made.p.tx.to
(string) Ethereum contract address of the InitialReporter contract on which to call this function, as a 20-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (boolean)
true
if the Initial Report said the Market for the InitialReporter contract was Invalid, orfalse
otherwise.
Market Call API
// Market Contract Call API Examples:
var market = "0x9368ff3e9ce1c0459b309fac6dd4e69229b91a42";
augur.api.Market.deriveMarketCreatorFeeAmount({
_amount: "0xc3280e4b4b",
tx: { to: market }
}, function (error, isInvalid) {
console.log(isInvalid);
});
// example output:
"1"
augur.api.Market.derivePayoutDistributionHash({
_payoutNumerators: [ "0x0", "0x2710" ],
_invalid: false,
tx: { to: market },
}, function (error, payoutDistributionHash) {
console.log(payoutDistributionHash);
});
// example output:
"0x4480ed40f94e2cb2ca244eb862df2d350300904a96039eb53cba0e34b8ace90a"
augur.api.Market.designatedReporterShowed({
tx: { to: market }
}, function (error, designatedReporterShowed) {
console.log(designatedReporterShowed);
});
// example output:
true
augur.api.Market.designatedReporterWasCorrect({
tx: { to: market }
}, function (error, designatedReporterWasCorrect) {
console.log(designatedReporterWasCorrect);
});
// example output:
true
augur.api.Market.getCrowdsourcer({
_payoutDistributionHash: "0x5580ed40f94e2cb2ca244eb862df2d350300904a96039eb53cba0e34b8ace90a",
tx: { to: market }
}, function (error, crowdsourcer) {
console.log(crowdsourcer);
});
// example output:
"0xbbb0cc6b4e89303e451c9b852827b5791667face"
augur.api.Market.getDenominationToken({
tx: { to: market }
}, function (error, denominationToken) {
console.log(denominationToken);
});
// example output:
"0x30e3852448f4ab5d62bbf7544ca3c92daca5c957"
augur.api.Market.getDesignatedReporter({
tx: { to: market }
}, function (error, designatedReporter) {
console.log(designatedReporter);
});
// example output:
"0xca3edca4ed326bbcb77e914b379913b12d49654d"
augur.api.Market.getEndTime({
tx: { to: market }
}, function (error, endTime) {
console.log(endTime);
});
// example output:
"1500388730";
augur.api.Market.getFeeWindow({
tx: { to: market },
}, function (error, feeWindow) {
console.log(feeWindow);
});
// example output:
"0x1f90cc6b4e89303e451c9b852827b5791667f570"
augur.api.Market.getFinalizationTime({
tx: { to: market }
}, function (error, finalizationTime) {
console.log(finalizationTime);
});
// example output:
"1500647930";
augur.api.Market.getForkingMarket({
tx: { to: market }
}, function (error, forkedMarket) {
console.log(forkedMarket);
});
// example output:
"0x1230cc6b4e89303e451c9b852827b5791667f234"
augur.api.Market.getInitialReporter({
tx: { to: market }
}, function (error, initialReporter) {
console.log(initialReporter);
});
// example output:
"0xaad0cc6b4e89303e451c9b852827b5791667fddd"
augur.api.Market.getMarketCreatorMailbox({
tx: { to: market }
}, function (error, marketCreatorMailbox) {
console.log(marketCreatorMailbox);
});
// example output:
"0xeabdeaefcfaf7ea1e17c4768a554d5780069eabd"
augur.api.Market.getMarketCreatorSettlementFeeDivisor({
tx: { to: market }
}, function (error, marketCreatorSettlementFee) {
console.log(marketCreatorSettlementFee);
});
// example output:
"20000000000000000"
augur.api.Market.getNumberOfOutcomes({
tx: { to: market }
}, function (error, numOutcomes) {
console.log(numOutcomes);
});
// example output:
"2"
augur.api.Market.getNumTicks({
tx: { to: market }
}, function (error, numTicks) {
console.log(numTicks);
});
// example output:
"1000"
augur.api.Market.getReportingParticipant({
_index: "0x0",
tx: { to: market }
}, function (error, reportingParticipant) {
console.log(reportingParticipant);
});
// example output:
"0xdda0cc6b4e89303e451c9b852827b5791667faaa"
augur.api.Market.getReputationToken({
tx: { to: market }
}, function (error, reputationToken) {
console.log(reputationToken);
});
// example output:
"0x23b17188ce3c491f6ab4427258d92452be5c8045"
augur.api.Market.getShareToken({
_outcome: "0x1",
tx: { to: market },
}, function (error, shareToken) {
console.log(shareToken);
});
// example output:
"0x18b17188ce3c491f6ab4427258d92452be5c8054"
augur.api.Market.getStakeInOutcome({
_payoutDistributionHash: "0x4480ed40f94e2cb2ca244eb862df2d350300904a96039eb53cba0e34b8ace90a",
tx: { to: market },
}, function (error, stakeInOutcome) {
console.log(stakeInOutcome);
});
// example output:
"12378786123"
augur.api.Market.getParticipantStake({
tx: { to: market }
}, function (error, totalStake) {
console.log(totalStake);
});
// example output:
"161278368761238475"
augur.api.Market.getUniverse({
tx: { to: market }
}, function (error, universe) {
console.log(universe);
});
// example output:
"0x0920d1513057572be46580b7ef75d1d01a99a3e5"
augur.api.Market.getValidityBondAttoeth(
tx: { to: market }
}, function (error, validityBondAttoeth) {
console.log(validityBondAttoeth);
});
// example output:
"13570000000000000"
augur.api.Market.getWinningPayoutDistributionHash({
tx: { to: market }
}, function (error, winningDistributionHash) {
console.log(winningDistributionHash);
});
// example output:
"0x4480ed40f94e2cb2ca244eb862df2d350300904a96039eb53cba0e34b8ace90a"
augur.api.Market.getWinningPayoutNumerator({
_outcome: "0x0",
tx: { to: market },
}, function (error, winningPayoutNumerator) {
console.log(winningPayoutNumerator);
});
// example output:
"1000"
augur.api.Market.getWinningReportingParticipant({
tx: { to: market }
}, function (error, winningReportingParticipant) {
console.log(winningReportingParticipant);
});
// example output:
"0xbbb0cc6b4e89303e451c9b852827b5791667face"
augur.api.Market.isContainerForReportingParticipant({
_shadyReportingParticipant: "0x18b17188ce3c491f6ab4427258d92452be5c8054",
tx: { to: market },
}, function (error, isContainerForReportingParticipant) {
console.log(isContainerForReportingParticipant);
});
// example output:
true
augur.api.Market.isContainerForShareToken({
_shadyShareToken: "0x18b17188ce3c491f6ab4427258d92452be5c8054",
tx: { to: market },
}, function (error, isContainerForShareToken) {
console.log(isContainerForShareToken);
});
// example output:
true
augur.api.Market.isFinalized({
tx: { to: market },
}, function (error, isFinalized) {
console.log(isFinalized);
});
// example output:
true
augur.api.Market.isInvalid({
tx: { to: market }
}, function (error, isInvalid) {
console.log(isInvalid);
});
// example output:
true
Provides JavaScript bindings for the Market Solidity Contract, which enables functionality for Augur’s Markets.
augur.api.Market.deriveMarketCreatorFeeAmount(p, callback)
Calculates the Creator Fee that will be paid when settling a specific number of Shares in a given Market.
Parameters:
p
(Object) Parameters object.
p._amount
(string) Number of Share Units, as a hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (string) Creator Fee, in attoETH, as a stringified unsigned integer.
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:
p._invalid
istrue
and the values inp._payoutNumerators
are not all the same.
Parameters:
p
(Object) Parameters object.
p._payoutNumerators
(Array.<string>) Payout Numerators, as hexadecimal strings, from which to derive the Payout Distribution Hash.p._invalid
(boolean) Whether the Market is Invalid.p.tx
(Object) Object containing details about how this function call should be made.p.tx.to
(string) Ethereum contract address of the Market contract on which to call this function, as a 20-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (string) Payout Distribution Hash of the specified Market, as a 32-byte hexadecimal string.
augur.api.Market.designatedReporterShowed(p, callback)
Returns whether the Designated Reporter submitted a Report within the Designated Reporting Phase.
Parameters:
p
(Object) Parameters object.
p.tx
(Object) Object containing details about how this function call should be made.p.tx.to
(string) Ethereum contract address of the Market contract on which to call this function, as a 20-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (boolean)
true
if the Designated Reporter submitted a Report within the Designated Reporting Phase, orfalse
otherwise.
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:
p
(Object) Parameters object.
p.tx
(Object) Object containing details about how this function call should be made.p.tx.to
(string) Ethereum contract address of the Market contract on which to call this function, as a 20-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (boolean)
true
if the Payout Distribution Hash submitted in the Designated Report is the same as the winning Payout Distribution Hash for the specified Market, orfalse
otherwise.
augur.api.Market.getCrowdsourcer(p, callback)
Returns the Ethereum address for the DisputeCrowdsourcer contract that corresponds to the given Payout Distribution Hash.
Note: Calling this function only works for retrieving a DisputeCrowdsourcer if the Dispute Round has not been completed yet.
Parameters:
p
(Object) Parameters object.p._payoutDistributionHash
(string) Payout Distribution Hash for the Outcome of the Dispute Crowdsourcer, as a 32-byte hexadecimal string.p.tx
(Object) Object containing details about how this function call should be made.p.tx.to
(string) Ethereum contract address of the Market contract on which to call this function, as a 20-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (string) Ethereum address for the DisputeCrowdsourcer contract that corresponds to the given Payout Distribution Hash, as a 20-byte hexadecimal string.
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:
p
(Object) Parameters object.
p.tx
(Object) Object containing details about how this function call should be made.p.tx.to
(string) Ethereum contract address of the Market contract on which to call this function, as a 20-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (string) Ethereum contract address of the token used to denominate the specified Market, as a 20-byte hexadecimal string.
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:
p
(Object) Parameters object.
p.tx
(Object) Object containing details about how this function call should be made.p.tx.to
(string) Ethereum contract address of the Market contract on which to call this function, as a 20-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (string) Ethereum address of the Designated Reporter for the Market, as a 20-byte hexadecimal string.
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:
p
(Object) Parameters object.
p.tx
(Object) Object containing details about how this function call should be made.p.tx.to
(string) Ethereum contract address of the Market contract on which to call this function, as a 20-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (string) Unix timestamp for when the specified Market’s event has come to pass, as a stringified unsigned integer.
augur.api.Market.getFeeWindow(p, callback)
Returns the Ethereum contract address of the Market’s Fee Window.
Parameters:
p
(Object) Parameters object.
p.tx
(Object) Object containing details about how this function call should be made.p.tx.to
(string) Ethereum contract address of the Market contract on which to call this function, as a 20-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (string) Ethereum contract address of the Market’s Fee Window, as a 20-byte hexadecimal string.
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:
p
(Object) Parameters object.
p.tx
(Object) Object containing details about how this function call should be made.p.tx.to
(string) Ethereum contract address of the Market contract on which to call this function, as a 20-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (string) Unix timestamp for when the Market was Finalized, as a stringified unsigned integer. If the Market does not have a finalization time yet, “0” will be returned.
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:
p
(Object) Parameters object.
p.tx
(Object) Object containing details about how this function call should be made.p.tx.to
(string) Ethereum contract address of the Market contract on which to call this function, as a 20-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (string) Ethereum contract address of the Forked Market for the Universe in which the specified Market exists, as a 20-byte hexadecimal string.
augur.api.Market.getInitialReporter(p, callback)
Returns the Ethereum address of the InitialReporter contract for a given Market.
Parameters:
p
(Object) Parameters object.
p.tx
(Object) Object containing details about how this function call should be made.p.tx.to
(string) Ethereum contract address of the Market contract on which to call this function, as a 20-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (string) Ethereum address of the Market’s InitialReporter contract, as a 20-byte hexadecimal string.
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:
p
(Object) Parameters object.
p.tx
(Object) Object containing details about how this function call should be made.p.tx.to
(string) Ethereum contract address of the Market contract on which to call this function, as a 20-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (string) Ethereum address of the Market Creator Mailbox for the Market, as a 20-byte hexadecimal string.
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:
p
(Object) Parameters object.
p.tx
(Object) Object containing details about how this function call should be made.p.tx.to
(string) Ethereum contract address of the Market contract on which to call this function, as a 20-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (string) Creator Fee set by the Market Creator, denominated in attotokens per Settlement of a Complete Set, as a stringified unsigned integer.
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:
p
(Object) Parameters object.
p.tx
(Object) Object containing details about how this function call should be made.p.tx.to
(string) Ethereum contract address of the Market contract on which to call this function, as a 20-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (string) Number of Outcomes for the Market, as a stringified unsigned integer.
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:
p
(Object) Parameters object.
p.tx
(Object) Object containing details about how this function call should be made.p.tx.to
(string) Ethereum contract address of the Market contract on which to call this function, as a 20-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (string) Number of Ticks for the Market, as a stringified unsigned integer.
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:
p
(Object) Parameters object.
p.tx
(Object) Object containing details about how this function call should be made.p.tx.to
(string) Ethereum contract address of the Market contract on which to call this function, as a 20-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (string) Total attoREP Staked on the Market, as a stringified unsigned integer.
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:
p
(Object) Parameters object.p._index
(string) Index of the ReportingParticipant in the Market’s array of ReportingParticipant contracts, as a hexadecimal string.p.tx
(Object) Object containing details about how this function call should be made.p.tx.to
(string) Ethereum contract address of the Market contract on which to call this function, as a 20-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (string) Ethereum address of a ReportingParticipant contract for the Market, as a 20-byte hexadecimal string.
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:
p
(Object) Parameters object.
p.tx
(Object) Object containing details about how this function call should be made.p.tx.to
(string) Ethereum contract address of the Market contract on which to call this function, as a 20-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (string) Ethereum contract address of the Reputation Token for the Market, as a 20-byte hexadecimal string.
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:
p
(Object) Parameters object.
p._outcome
(string) Outcome for which to get the Share Token Ethereum contract address, as a hexadecimal string.p.tx
(Object) Object containing details about how this function call should be made.p.tx.to
(string) Ethereum contract address of the Market contract on which to call this function, as a 20-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (string) Ethereum contract address of the Share Token for the specified Market and Outcome, as a 20-byte hexadecimal string.
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:
p
(Object) Parameters object.
p._payoutDistributionHash
(string) Payout Distribution Hash for which to the the amount of attoREP Staked, as a 32-byte hexadecimal string.p.tx
(Object) Object containing details about how this function call should be made.p.tx.to
(string) Ethereum contract address of the Market contract on which to call this function, as a 20-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (string) Amount of attoREP Staked on the Outcome with the specified Payout Distribution Hash in the Market, as a stringified unsigned integer.
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:
p
(Object) Parameters object.
p.tx
(Object) Object containing details about how this function call should be made.p.tx.to
(string) Ethereum contract address of the Market contract on which to call this function, as a 20-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (string) Etherem address of the Universe in which the Market exists, as a 20-byte hexadecimal string.
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:
p
(Object) Parameters object.
p.tx
(Object) Object containing details about how this function call should be made.p.tx.to
(string) Ethereum contract address of the Market contract on which to call this function, as a 20-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (string) Amount the Market Creator must pay for the Validity Bond, denominated in attoETH.
augur.api.Market.getWinningPayoutDistributionHash(p, callback)
Returns the winning Payout Distribution Hash for a particular Market.
Parameters:
p
(Object) Parameters object.
p.tx
(Object) Object containing details about how this function call should be made.p.tx.to
(string) Ethereum contract address of the Market contract on which to call this function, as a 20-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (string) Winning Payout Distribution Hash for the Market, as a 32-byte hexadecimal string.
augur.api.Market.getWinningPayoutNumerator(p, callback)
Returns the winning Payout Numerator for an Outcome in a particular Market.
This call will fail if:
- The specified Market is not Finalized.
Parameters:
p
(Object) Parameters object.
p._outcome
(string) Outcome for which to get the winning Payout Numerator, as a hexadecimal string.p.tx
(Object) Object containing details about how this function call should be made.p.tx.to
(string) Ethereum contract address of the Market contract on which to call this function, as a 20-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (string) Winning Payout Numerator for an Outcome in the Market, as a stringified unsigned integer.
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:
p
(Object) Parameters object.p.tx
(Object) Object containing details about how this function call should be made.p.tx.to
(string) Ethereum contract address of the Market contract on which to call this function, as a 20-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (string) Ethereum address of the ReportingParticipant contract corresponding to the Market’s Tentative Outcome, as a 20-byte hexadecimal string.
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:
p
(Object) Parameters object.
p._shadyReportingParticipant
(string) ReportingParticipant Ethereum contract address for which to check if the Market is a container, as a 20-byte hexadecimal string.p.tx
(Object) Object containing details about how this function call should be made.p.tx.to
(string) Ethereum contract address of the Market contract on which to call this function, as a 20-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (boolean)
true
if the Market is a container for the ReportingParticipant contract, orfalse
otherwise.
augur.api.Market.isContainerForShareToken(p, callback)
Returns whether the given Market is a container for the specified Share Token Ethereum contract address.
Parameters:
p
(Object) Parameters object.
p._shadyShareToken
(string) ShareToken Ethereum contract address for which to check if the Market is a container, as a 20-byte hexadecimal string.p.tx
(Object) Object containing details about how this function call should be made.p.tx.to
(string) Ethereum contract address of the Market contract on which to call this function, as a 20-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (boolean)
true
if the Market is a container for the specified Share Token, orfalse
otherwise.
augur.api.Market.isFinalized(p, callback)
Returns whether the Market has been Finalized (that is, its winning Payout Distribution Hash is set).
Parameters:
p
(Object) Parameters object.
p.tx
(Object) Object containing details about how this function call should be made.p.tx.to
(string) Ethereum contract address of the Market contract on which to call this function, as a 20-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (boolean)
true
if the Market has been Finalized, orfalse
otherwise.
augur.api.Market.isInvalid(p, callback)
Returns whether the specified Market has been Finalized as Invalid.
This call will fail if:
- The Market is not Finalized.
Parameters:
p
(Object) Parameters object.
p.tx
(Object) Object containing details about how this function call should be made.p.tx.to
(string) Ethereum contract address of the Market contract on which to call this function, as a 20-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (boolean)
true
if the Market has been Finalized as Invalid, or returnsfalse
otherwise.
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:
p
(Object) Parameters object.
p._orderId
(string) ID of the Order, as a 32-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (string) Amount of Shares requested when the Order was placed, as a stringified unsigned integer.
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:
p
(Object) Parameters object.
p._type
(string) Type of Order, as a hexadecimal string (“0x0” for a Bid Order, “0x1” for an Ask Order).p._market
(string) Ethereum contract address of the Market for which to get the best Order ID, as a 20-byte hexadecimal string.p._outcome
(string) Outcome of the Market, as a hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (string) Order ID with the best price, as a 32-byte hexadecimal string.
augur.api.Orders.getBetterOrderId(p, callback)
Returns the Order ID of an Order with a better price than the specified Order.
Parameters:
p
(Object) Parameters object.
p._orderId
(string) Order ID, as a 32-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (string) ID of an Order with a better price than the specified Order, as a 32-byte hexadecimal string.
augur.api.Orders.getLastOutcomePrice(p, callback)
Returns the last price traded for a specific Outcome in a given Market.
Parameters:
p
(Object) Parameters object.
p._market
(string) Ethereum contract address of a Market, as a 20-byte hexadecimal string.p._outcome
(string) Outcome of the Market, as a hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (string) Last price traded for a specific Outcome in a given Market, as a stringified unsigned integer.
augur.api.Orders.getMarket(p, callback)
Returns the Ethereum contract address of the Market for the specified Order.
Parameters:
p
(Object) Parameters object.
p._orderId
(string) Order ID, as a 32-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (string) Ethereum contract address of the Market for the specified Order, as a 20-byte hexadecimal string.
augur.api.Orders.getOrderCreator(p, callback)
Returns the Ethereum address of the Creator of the specified Order.
Parameters:
p
(Object) Parameters object.
p._orderId
(string) Order ID, as a 32-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (string) Ethereum address of the Creator of the specified Order, as a 20-byte hexadecimal string.
augur.api.Orders.getOrderMoneyEscrowed(p, callback)
Returns the amount of money escrowed by the Order Creator for a given Order.
Parameters:
p
(Object) Parameters object.
p._orderId
(string) Order ID, as a 32-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (string) Amount of money escrowed by the Order Creator for a given Order, as a stringified unsigned integer.
augur.api.Orders.getOrderSharesEscrowed(p, callback)
Returns the number of Shares escrowed by the Order Creator for a given Order.
Parameters:
p
(Object) Parameters object.
p._orderId
(string) Order ID, as a 32-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (string) Number of Shares escrowed by the Order Creator for a given Order, as a stringified unsigned integer.
augur.api.Orders.getOrderType(p, callback)
Returns the order type (Bid Order or Ask Order) of a given Order.
Parameters:
p
(Object) Parameters object.
p._orderId
(string) Order ID, as a 32-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (string) Order type of the Order, as a stringified unsigned integer (“1” for Bid Orders, or “2” for Ask Orders).
augur.api.Orders.getOutcome(p, callback)
Returns the Outcome being traded on for the specified Order.
Parameters:
p
(Object) Parameters object.
p._orderId
(string) Order ID, as a 32-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (string) Outcome being traded on for the specified Order, as a stringified unsigned integer.
augur.api.Orders.getPrice(p, callback)
Returns the price of a specified Order.
Parameters:
p
(Object) Parameters object.
p._orderId
(string) Order ID, as a 32-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (string) Price of the Order, as a stringified unsigned integer.
augur.api.Orders.getTotalEscrowed(p, callback)
Returns the total amount of attoETH currently escrowed for open Orders in the specified Market.
Parameters:
p
(Object) Parameters object.
p._market
(string) Ethereum contract address of a Market, as a 20-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (string) Volume of the Market, as a stringified unsigned integer.
augur.api.Orders.getWorseOrderId(p, callback)
Returns the Order ID of an Order with a worse price than the specified Order.
Parameters:
p
(Object) Parameters object.
p._orderId
(string) Order ID, as a 32-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (string) ID of an Order with a worse price than the specified Order, as a 32-byte hexadecimal string.
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:
p
(Object) Parameters object.
p._type
(string) Type of Order, as a hexadecimal string (“0x0” for a Bid Order, “0x1” for an Ask Order).p._market
(string) Ethereum contract address of the Market for which to get the worst Order ID, as a 20-byte hexadecimal string.p._outcome
(string) Outcome of the Market, as a hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (string) Order ID with the worst price, as a 32-byte hexadecimal string.
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:
p
(Object) Parameters object.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (boolean)
true
if the price is greater than the Order price (for Bid Orders), or if the price is less than the Order price (for Ask Orders). Otherwise, the function will returnfalse
.
augur.api.Orders.isWorsePrice(p, callback)
Returns whether a given price is less than/equal to the price of a particular Order (for Bid Orders), or whether the price is greater than/equal to the price of the Order (for Ask Orders).
Parameters:
p
(Object) Parameters object.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (boolean)
true
if the price is less than the Order price (for Bid Orders), or if the price is greater than the Order price (for Ask Orders). Otherwise, the function will returnfalse
.
Orders Fetcher Call API
// Orders Fetcher Contract Call API Examples:
var _orderId = "0x7ca90ca9118db456d87e3d743b97782a857200b55039f7ffe8de94e5d920f870";
var _type = "0x1";
var _market = "0x9368ff3e9ce1c0459b309fac6dd4e69229b91a42";
var _outcome = "0x1";
var _price = "0x63eb89da4ed0000"; // 0.45
augur.api.OrdersFetcher.ascendOrderList({
_type: _type,
_price: _price,
_lowestOrderId: _orderId
}, function (error, ascendingOrderList) { console.log(ascendingOrderList); });
// example output:
[ "0x7ca90ca9118db456d87e3d743b97782a857200b55039f7ffe8de94e5d920f870",
"0x4a8d07c2c9cd996484c04b7077d1fc4aeaeb8aa4750d7f26f2a896c4393fb6b0" ]
augur.api.OrdersFetcher.descendOrderList({
_type: _type,
_price: _price,
_highestOrderId: _orderId
}, function (error, decendingOrderList) { console.log(decendingOrderList); });
// example output:
[ "0x09502d4c2765d61a8e47fd4ada696966f3bc3bce6b780ecedded035e616c272e",
"0x7ca90ca9118db456d87e3d743b97782a857200b55039f7ffe8de94e5d920f870"]
augur.api.OrdersFetcher.findBoundingOrders({
_type: _type,
_price: _price,
_bestOrderId: _orderId,
_worstOrderId: "0x0",
_betterOrderId: "0x0",
_worseOrderId: "0x0"
}, function (error, boundingOrders) { console.log(boundingOrders); });
// example output:
[ "0x4a8d07c2c9cd996484c04b7077d1fc4aeaeb8aa4750d7f26f2a896c4393fb6b0",
"0x09502d4c2765d61a8e47fd4ada696966f3bc3bce6b780ecedded035e616c272e" ]
Provides JavaScript bindings for the OrdersFetcher Solidity Contract, which handles functionality related retrieving Orders from the Order Book.
augur.api.OrdersFetcher.ascendOrderList(p, callback)
Traverses the Order Book in ascending order and returns an array containing the better Order ID and worse Order ID, respectively, for a specified price and Order type.
Parameters:
p
(Object) Parameters object.
p._type
(string) Type of Order, as a hexadecimal string (“0x0” for a Bid Order, “0x1” for an Ask Order).p._price
(string) Price (in attoETH) in the Order Book for which to find a better Order ID and worse Order ID, as a hexadecimal string.p._lowestOrderId
(string) Order ID expected to be a worse price thanp._price
, as a 32-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (Array.<string>) Array containing the better Order ID and worse Order ID, respectively, for the specified price and Order type.
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:
p
(Object) Parameters object.
p._type
(string) Type of Order, as a hexadecimal string (“0x0” for a Bid Order, “0x1” for an Ask Order).p._price
(string) Price (in attoETH) in the Order Book for which to find a better Order ID and worse Order ID, as a hexadecimal string.p._highestOrderId
(string) Order ID expected to be a better price thanp._price
, as a 32-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (Array.<string>) Array containing the better Order ID and worse Order ID, respectively, for the specified price and Order type.
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:
p
(Object) Parameters object.
p._type
(string) Type of Order, as a hexadecimal string (“0x0” for a Bid Order, “0x1” for an Ask Order).p._price
(string) Price (in attoETH) to comparep._orderId
to, as a hexadecimal string.p._bestOrderId
(string) Best Order ID on the Order Book forp._type
, as a 32-byte hexadecimal string.p._worstOrderId
(string) Worst Order ID on the Order Book forp._type
, as a 32-byte hexadecimal string.p._betterOrderId
(string) Order ID with a better price thanp._price
, as a 32-byte-hexadecimal string.p._worseOrderId
(string) Order ID with a worse price thanp._price
, as a 32-byte-hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (Array.<string>) Array containing the better Order ID and worse Order ID, respectively, for the specified price and Order type.
Orders Finder Call API
// Orders Finder Contract Call API Examples:
// All OrdersFinder functions can be called like the example below, but return different array lengths.
var ordersFinder = "0xf28fc4b34a7c4534dd3e40e0ad5df6f2cb69aec0";
augur.api.OrdersFinder.getExistingOrders5({
_type: "0x1",
_market: "0xd8e090ac1282fd54d4f7ff5474f6e363cf30049e",
_outcome: "0x1",
tx: { to: ordersFinder }
}, function (error, feeWindow) {
console.log(feeWindow);
});
[
"0xfa76427aaada4f319a831f6b2579557ee30579dac997cbe6d7737b438a788a2b",
"0xf77843d1520fe797874779a2447cd8727a3ff985975cbe2e0f660e6aa27fff8f",
"0x38e6d59a9d4953dbdda92de3561c044b86640236ed8398666155a031bfd77e69",
"0x1673d59a9d497384dda92de3561c044b86640236ed8398666155a031bfd89263",
"0x8245959a9d4953dbdda92de3561c044b86640236ed8398666155a031bfd09837"
]
Provides JavaScript bindings for the OrdersFinder Solidity Contract, which retrieves Orders from the Order Book.
augur.api.OrdersFinder.getExistingOrders5(p, callback)
Returns the 5 best Orders on the Order Book for a particular Market, based on Order Type and Outcome.
Parameters:
p
(Object) Parameters object.
Returns:
- (Array.<string>) Array of the 5 best Order IDs for the specified Market, Order Type, and Outcome, as 32-byte hexadecimal strings.
augur.api.OrdersFinder.getExistingOrders10(p, callback)
Similar to augur.api.OrdersFinder.getExistingOrders5
, but returns the 10 best Orders on the Order Book for a particular Market, based on Order Type and Outcome.
Parameters:
p
(Object) Parameters object.
Returns:
- (Array.<string>) Array of the 10 best Order IDs for the specified Market, Order Type, and Outcome, as 32-byte hexadecimal strings.
augur.api.OrdersFinder.getExistingOrders20(p, callback)
Similar to augur.api.OrdersFinder.getExistingOrders5
, but returns the 20 best Orders on the Order Book for a particular Market, based on Order Type and Outcome.
Parameters:
p
(Object) Parameters object.
Returns:
- (Array.<string>) Array of the 20 best Order IDs for the specified Market, Order Type, and Outcome, as 32-byte hexadecimal strings.
augur.api.OrdersFinder.getExistingOrders50(p, callback)
Similar to augur.api.OrdersFinder.getExistingOrders5
, but returns the 50 best Orders on the Order Book for a particular Market, based on Order Type and Outcome.
Parameters:
p
(Object) Parameters object.
Returns:
- (Array.<string>) Array of the 50 best Order IDs for the specified Market, Order Type, and Outcome, as 32-byte hexadecimal strings.
augur.api.OrdersFinder.getExistingOrders100(p, callback)
Similar to augur.api.OrdersFinder.getExistingOrders5
, but returns the 100 best Orders on the Order Book for a particular Market, based on Order Type and Outcome.
Parameters:
p
(Object) Parameters object.
Returns:
- (Array.<string>) Array of the 100 best Order IDs for the specified Market, Order Type, and Outcome, as 32-byte hexadecimal strings.
augur.api.OrdersFinder.getExistingOrders200(p, callback)
Similar to augur.api.OrdersFinder.getExistingOrders5
, but returns the 200 best Orders on the Order Book for a particular Market, based on Order Type and Outcome.
Parameters:
p
(Object) Parameters object.
Returns:
- (Array.<string>) Array of the 200 best Order IDs for the specified Market, Order Type, and Outcome, as 32-byte hexadecimal strings.
augur.api.OrdersFinder.getExistingOrders500(p, callback)
Similar to augur.api.OrdersFinder.getExistingOrders5
, but returns the 500 best Orders on the Order Book for a particular Market, based on Order Type and Outcome.
Parameters:
p
(Object) Parameters object.
Returns:
- (Array.<string>) Array of the 500 best Order IDs for the specified Market, Order Type, and Outcome, as 32-byte hexadecimal strings.
augur.api.OrdersFinder.getExistingOrders1000(p, callback)
Similar to augur.api.OrdersFinder.getExistingOrders5
, but returns the 1000 best Orders on the Order Book for a particular Market, based on Order Type and Outcome.
Parameters:
p
(Object) Parameters object.
Returns:
- (Array.<string>) Array of the 1000 best Order IDs for the specified Market, Order Type, and Outcome, as 32-byte hexadecimal strings.
Reputation Token Call API
// Reputation Token Contract Call API Examples:
// The Ethereum contract address for Augur.sol can be
// obtained by calling `augur.augurNode.getSyncData`.
var _augurContractAddress = "0x67cbf60a24ab922af99e6f335c0ff2b084d5bdbe";
// The Ethereum contract address for a Universe's Reputation Token
// can be obtained by calling `augur.api.Universe.getReputationToken`.
var reputationToken = "0x13fa2334966b3cb6263ed56148323014c2ece753";
augur.api.ReputationToken.allowance({
_owner: "0x913da4198e6be1d5f5e4a40d0667f70c0b5430eb",
_spender: _augurContractAddress,
tx: { to: reputationToken }
}, function(error, allowance) {
console.log(allowance);
});
// example output:
"115792089237316195423570985008687907853269984665640564039457584007913129639935"
augur.api.ReputationToken.getUniverse({
tx: { to: reputationToken }
}, function (error, universe) {
console.log(universe);
});
// example output:
"0x1f732847fbbcc46ffe859f28e916d993b2b08831"
augur.api.ReputationToken.getTotalMigrated({
tx: { to: reputationToken }
}, function (error, totalMigrated) {
console.log(totalMigrated);
});
"0"
augur.api.ReputationToken.getTotalTheoreticalSupply({
tx: { to: reputationToken }
}, function (error, totalTheoreticalSupply) {
console.log(totalTheoreticalSupply);
});
"11000000000000000000000000"
Provides JavaScript bindings for the ReputationToken Solidity Contract, which handles the approval, migration, and transfering of Reputation Tokens.
The Reputation Token, or REP, is an ERC-20 token that implements all of the required functions listed in the ERC-20 Token Standard. It does not, however, implement the optional functions.
augur.api.ReputationToken.allowance(p, callback)
Returns the amount of attoREP that a given Ethereum contract is allowed to spend on behalf of a particular user.
Parameters:
p
(Object) Parameters object.
p._owner
(string) Ethereum address of the owner of the REP, as a 20-byte hexadecimal value.p._spender
(string) Ethereum address of the contract allowed to spend on behalf ofp._owner
, as a 20-byte hexadecimal string. (This should be the address of the Augur.sol contract.)p.tx
(Object) Object containing details about how this function call should be made.p.tx.to
(string) Ethereum contract address of the ReputationToken contract on which to call this function, as a 20-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
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:
p
(Object) Parameters object.
p.tx
(Object) Object containing details about how this function call should be made.p.tx.to
(string) Ethereum contract address of the ReputationToken contract on which to call this function, as a 20-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (string) Ethereum contract address of the Universe in which the REP of the ReputationToken contract can be used, as a 20-byte hexadecimal string.
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:
p
(Object) Parameters object.
p.tx
(Object) Object containing details about how this function call should be made.p.tx.to
(string) Ethereum contract address of the ReputationToken contract on which to call this function, as a 20-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (string) Total amount of REP that has been migrated into the current ReputationToken contract from the ReputationToken contract of its Universe’s Parent Universe, as a stringified unsigned integer.
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:
p
(Object) Parameters object.
p.tx
(Object) Object containing details about how this function call should be made.p.tx.to
(string) Ethereum contract address of the ReputationToken contract on which to call this function, as a 20-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (string) Total Theoretical REP Supply for this ReputationToken contract, as a stringified unsigned integer.
Share Token Call API
// Share Token Contract Call API Examples:
// The Ethereum contract address for Augur.sol can be
// obtained by calling `augur.augurNode.getSyncData`.
var _augurContractAddress = "0x67cbf60a24ab922af99e6f335c0ff2b084d5bdbe";
// Share Token contract addresses for a Market can be
// obtained by calling `augur.api.Market.getShareToken`.
var shareToken = "0x18b17188ce3c491f6ab4427258d92452be5c8054";
augur.api.ShareToken.allowance({
_owner: "0x913da4198e6be1d5f5e4a40d0667f70c0b5430eb",
_spender: _augurContractAddress,
}, function(error, allowance) {
console.log(allowance);
});
// example output:
"115792089237316195423570985008687907853269984665640564039457584007913129639935"
augur.api.ShareToken.getMarket({
tx: { to: shareToken }
}, function (error, market) {
console.log(market);
});
// example output:
"0x9368ff3e9ce1c0459b309fac6dd4e69229b91a42"
augur.api.ShareToken.getOutcome({
tx: { to: shareToken }
}, function (error, outcome) {
console.log(outcome);
});
// example output:
"1"
Provides JavaScript bindings for the ShareToken Solidity Code, which handles the approval and transferring of Shares in Augur.
The Share Token is an ERC-20 token that implements all of the required functions listed in the ERC-20 Token Standard. It does not, however, implement the optional functions. Within Augur, it represents Shares in Market Outcomes.
augur.api.ShareToken.allowance(p, callback)
Returns the amount of Share Units that a given Ethereum contract is allowed to spend on behalf of a particular user.
Parameters:
p
(Object) Parameters object.
p._owner
(string) Ethereum address of the owner of the Shares, as a 20-byte hexadecimal value.p._spender
(string) Ethereum address of the contract allowed to spend on behalf ofp._owner
, as a 20-byte hexadecimal string. (This should be the address of the Augur.sol contract.)
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
(string) Amount of Share Units the contract is allowed to spend on behalf of the specified user.
augur.api.ShareToken.getMarket(p, callback)
Returns the Ethereum contract address of the Market for the specified ShareToken.
Parameters:
p
(Object) Parameters object.
p.tx
(Object) Object containing details about how this function call should be made.p.tx.to
(string) Ethereum contract address of the ShareToken contract on which to call this function, as a 20-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (string) Returns the Ethereum contract address of the Market for the specified ShareToken, as a 20-byte hexadecimal string.
augur.api.ShareToken.getOutcome(p, callback)
Returns the Outcome of the Market that the specified ShareToken is for.
Parameters:
p
(Object) Parameters object.
p.tx
(Object) Object containing details about how this function call should be made.p.tx.to
(string) Ethereum contract address of the ShareToken contract on which to call this function, as a 20-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (string) Returns the Outcome of the Market that the specified ShareToken is for, as a stringified unsigned integer.
Universe Call API
// Universe Contract Call API Examples:
// The Ethereum contract address of Augur's current default Universe
// can be obtained by calling `augur.augurNode.getSyncData`.
var universe = "0x0920d1513057572be46580b7ef75d1d01a99a3e5";
augur.api.Universe.getChildUniverse({
_parentPayoutDistributionHash: "0x4480ed40f94e2cb2ca244eb862df2d350300904a96039eb53cba0e34b8ace90a",
tx: { to: universe },
}, function (error, childUniverse) {
console.log(childUniverse);
});
// example output:
"0xb4e8c1f85c4382d64954aca187f9f386c8bb1a6c"
augur.api.Universe.getCurrentFeeWindow({
tx: { to: universe }
}, function (error, currFeeWindow) {
console.log(currFeeWindow);
});
// example output:
"0x1f90cc6b4e89303e451c9b852827b5791667f570"
augur.api.Universe.getDisputeRoundDurationInSeconds({
tx: { to: universe }
}, function (error, disputeRoundDuration) {
console.log(disputeRoundDuration);
});
// example output:
"604800"
augur.api.Universe.getFeeWindow({
_feeWindowId: "0x242",
tx: { to: universe },
}, function (error, feeWindow) {
console.log(feeWindow);
});
// example output:
"0x1f90cc6b4e89303e451c9b852827b5791667f570"
augur.api.Universe.getFeeWindowByTimestamp({
_timestamp: "0x5a45710f",
tx: { to: universe },
}, function (error, feeWindow) {
console.log(feeWindow);
});
// example output:
"0x1f90cc6b4e89303e451c9b852827b5791667f570"
augur.api.Universe.getFeeWindowId({
_timestamp: "0x5a45710f",
tx: { to: universe },
}, function (error, feeWindowId) {
console.log(feeWindowId);
});
// example output:
"578"
augur.api.Universe.getForkEndTime({
tx: { to: universe }
}, function (error, forkEndTime) {
console.log(forkEndTime);
});
// example output:
"1489855429"
augur.api.Universe.getForkingMarket({
tx: { to: universe }
}, function (error, forkingMarket) {
console.log(forkingMarket);
});
// example output:
"0x78f7b43150d27c464359e735781c16ac585f52a8"
augur.api.Universe.getForkReputationGoal({
tx: { to: universe }
}, function (error, forkReputationGoal) {
console.log(forkReputationGoal);
});
// example output:
"5500000000000000000000000"
augur.api.Universe.getNextFeeWindow({
tx: { to: universe }
}, function (error, nextFeeWindow) {
console.log(nextFeeWindow);
});
// example output:
"0x45659544b89cce1dd53b1b566862189b25adec49"
augur.api.Universe.getOpenInterestInAttoEth({
tx: { to: universe }
}, function (error, openInterestInAttoEth) {
console.log(openInterestInAttoEth);
});
// example output:
"42250000000000000000"
augur.api.Universe.getParentPayoutDistributionHash({
tx: { to: universe }
}, function (error, universeParentPayoutDistributionHash) {
console.log(universeParentPayoutDistributionHash);
});
// example output:
"0xa310ca2018af3cb2ca244eb862df2d350300904a96039eb53cbaff012c92d10c"
augur.api.Universe.getParentUniverse({
tx: { to: universe }
}, function (error, parentUniverse) {
console.log(parentUniverse);
});
// example output:
"0x63c59544b89cce1dd53b1b566862189b25adec41"
augur.api.Universe.getPreviousFeeWindow({
tx: { to: universe }
}, function (error, previousFeeWindow) {
console.log(previousFeeWindow);
});
// example output:
"0xc0adccd7c65ea05c2e91a148af988d776e683643"
augur.api.Universe.getRepMarketCapInAttoeth({
tx: { to: universe }
}, function (error, repMarketCapInAttoeth) {
console.log(repMarketCapInAttoeth);
});
// example output:
"36000000000000000000000000000000000000000"
augur.api.Universe.getReputationToken({
tx: { to: universe }
}, function (error, reputationTokenAddress) {
console.log(reputationTokenAddress);
});
// example output:
"0x2fb561b2bdbcd1ae1995bdd6aff6776d6f4292f2"
augur.api.Universe.getTargetRepMarketCapInAttoeth({
tx: { to: universe }
}, function (error, targetRepMarketCapInAttoeth) {
console.log(targetRepMarketCapInAttoeth);
});
// example output:
"211250000000000000000"
augur.api.Universe.getWinningChildUniverse({
tx: { to: universe }
}, function (error, winningChildUniverse) {
console.log(winningChildUniverse);
});
// example output:
"0x432561b2bdbcd1ae1995bdd6aff6776d6f4292f2"
augur.api.Universe.isContainerForFeeToken({
_shadyFeeToken: "0x2a73cec0b62fcb8c3120bc80bdb2b1351c8c2d1e",
tx: { to: universe },
}, function (error, isContainerForFeeToken) {
console.log(isContainerForFeeToken);
});
// example output:
true
augur.api.Universe.isContainerForFeeWindow({
_shadyFeeWindow: "0x1233cec0b62fcb8c3120bc80bdb2b1351c8c2d1e",
tx: { to: universe },
}, function (error, isContainerForFeeWindow) {
console.log(isContainerForFeeWindow);
});
// example output:
true
augur.api.Universe.isContainerForMarket({
_shadyMarket: "0x9368ff3e9ce1c0459b309fac6dd4e69229b91a42",
tx: { to: universe },
}, function (error, isContainerForMarket) {
console.log(isContainerForMarket);
});
// example output:
false
augur.api.Universe.isContainerForReportingParticipant({
_shadyReportingParticipant: "0x6788ff3e9ce1c0459b309fac6dd4e69229b91a41",
tx: { to: universe },
}, function (error, isContainerForReportingParticipant) {
console.log(isContainerForReportingParticipant);
});
// example output:
true
augur.api.Universe.isContainerForShareToken({
_shadyShareToken: "0x9328ff3e9ce1c0459b309fac6dd4e69229b91a61",
tx: { to: universe },
}, function (error, isContainerForShareToken) {
console.log(isContainerForShareToken);
});
// example output:
true
augur.api.Universe.isForking({
tx: { to: universe }
}, function (error, isForking) {
console.log(isForking);
});
// example output:
false
augur.api.Universe.isParentOf({
_shadyChild: "0xb4e8c1f85c4382d64954aca187f9f386c8bb1a6c",
tx: { to: universe },
}, function (error, isParentOf) {
console.log(isParentOf);
});
// example output:
true
Provides JavaScript bindings for the Universe Solidity Contract, which allows for the creation of Markets and provides functions for obtaining information about a given Universe.
augur.api.Universe.getChildUniverse(p, callback)
Returns the Ethereum contract address of a Universe’s Child Universe that has Final Outcome set to a specific Payout Distribution Hash.
Parameters:
p
(Object) Parameters object.
p._parentPayoutDistributionHash
(string) Payout Distribution Hash for Final Outcome of the desired Child Universe, as a 32-byte hexadecimal string.p.tx
(Object) Object containing details about how this function call should be made.p.tx.to
(string) Ethereum contract address of the Universe contract on which to call this function, as a 20-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (string) Ethereum contract address of the Universe’s Child Universe that has its Final Outcome set to the specified Payout Distribution Hash, as a 20-byte hexadecimal string. If no such Child Universe exists, the address “0x0000000000000000000000000000000000000000” will be returned.
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:
p
(Object) Parameters object.
p.tx
(Object) Object containing details about how this function call should be made.p.tx.to
(string) Ethereum contract address of the Universe contract on which to call this function, as a 20-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (string) Ethereum contract address of the current running Fee Window of the Universe, as a 20-byte hexadecimal string.
augur.api.Universe.getDisputeRoundDurationInSeconds(p, callback)
Returns the number of seconds in a Dispute Round within the specified Universe.
Parameters:
p
(Object) Parameters object.
p.tx
(Object) Object containing details about how this function call should be made.p.tx.to
(string) Ethereum contract address of the Universe contract on which to call this function, as a 20-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (string) Number of seconds in a Universe’s Dispute Round, as a stringified unsigned integer.
augur.api.Universe.getFeeWindow(p, callback)
Returns the Ethereum contract address of a given Fee Window in the specified Universe.
Parameters:
p
(Object) Parameters object.
p._feeWindowId
(string) Fee Window ID, as a hexadecimal string.p.tx
(Object) Object containing details about how this function call should be made.p.tx.to
(string) Ethereum contract address of the Universe contract on which to call this function, as a 20-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (string) Ethereum contract address of the given Fee Window in the Universe, as a 20-byte hexadecimal string. If a Fee Window with the specified ID does not exist, the address “0x0000000000000000000000000000000000000000” will be returned.
augur.api.Universe.getFeeWindowByTimestamp(p, callback)
Returns the Ethereum contract address of the Fee Window running at a given timestamp in the Universe.
Parameters:
p
(Object) Parameters object.
p._timestamp
(string) Unix timestamp for which to get the corresponding Fee Window, as a hexadecimal string.p.tx
(Object) Object containing details about how this function call should be made.p.tx.to
(string) Ethereum contract address of the Universe contract on which to call this function, as a 20-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (string) Ethereum contract address of the Fee Window running in the Universe at the specified timestamp, as a 20-byte hexadecimal string. If a Fee Window with the specified timestamp does not exist, the address “0x0000000000000000000000000000000000000000” will be returned.
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:
p
(Object) Parameters object.
p._timestamp
(string) Unix timestamp for which to get the corresponding Fee Window, as a hexadecimal string.p.tx
(Object) Object containing details about how this function call should be made.p.tx.to
(string) Ethereum contract address of the Universe contract on which to call this function, as a 20-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (string) ID of the Fee Window running the the Universe at the specified timestamp, as a stringified unsigned integer. If the Fee Window contract does not currently exist, “0” will be returned.
augur.api.Universe.getForkEndTime(p, callback)
Returns the Unix timestamp for when the Fork Phase ends that was started on the specified Universe.
Parameters:
p
(Object) Parameters object.
p.tx
(Object) Object containing details about how this function call should be made.p.tx.to
(string) Ethereum contract address of the Universe contract on which to call this function, as a 20-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (string) Unix timestamp when the Fork Phase ends that was started on the specified Universe, as a stringified unsigned integer. If a Fork has not occurred in the Universe, “0” will be returned.
augur.api.Universe.getForkingMarket(p, callback)
Returns the Ethereum contract address of the Market that the specified Universe is Forking over.
Parameters:
p
(Object) Parameters object.
p.tx
(Object) Object containing details about how this function call should be made.p.tx.to
(string) Ethereum contract address of the Universe contract on which to call this function, as a 20-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (string) Ethereum contract address of the Market that the specified Universe is Forking over, as a 20-byte hexadecimal string. If the Universe does not contain a Forked Market, the address “0x0000000000000000000000000000000000000000” will be returned.
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:
p
(Object) Parameters object.
p.tx
(Object) Object containing details about how this function call should be made.p.tx.to
(string) Ethereum contract address of the Universe contract on which to call this function, as a 20-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (string) 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, as a stringified unsigned integer.
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:
p
(Object) Parameters object.
p.tx
(Object) Object containing details about how this function call should be made.p.tx.to
(string) Ethereum contract address of the Universe contract on which to call this function, as a 20-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (string) Ethereum contract address of the Fee Window coming up after the current Fee Window ends in the specified Universe, as a 20-byte hexadecimal string. If the Fee Window contract for the next Fee Window does not exist yet, the address “0x0000000000000000000000000000000000000000” will be returned.
augur.api.Universe.getOpenInterestInAttoEth(p, callback)
Returns the total value of all Complete Sets that exist across all Markets the specified Universe.
Parameters:
p
(Object) Parameters object.
p.tx
(Object) Object containing details about how this function call should be made.p.tx.to
(string) Ethereum contract address of the Universe contract on which to call this function, as a 20-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (string) Total value of all Complete Sets that exist across all Markets the specified Universe, priced in attoETH, as a stringified unsigned integer.
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:
p
(Object) Parameters object.
p.tx
(Object) Object containing details about how this function call should be made.p.tx.to
(string) Ethereum contract address of the Universe contract on which to call this function, as a 20-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (string) Payout Distribution Hash of the Universe’s Parent Universe, as a 32-byte hexadecimal string. If the Universe does not have a Parent Universe (that is, it is a Genesis Universe), the string “0x0000000000000000000000000000000000000000000000000000000000000000” will be returned.
augur.api.Universe.getParentUniverse(p, callback)
Returns the Ethereum contract address of the Parent Universe for the specified Universe.
Parameters:
p
(Object) Parameters object.
p.tx
(Object) Object containing details about how this function call should be made.p.tx.to
(string) Ethereum contract address of the Universe contract on which to call this function, as a 20-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (string) Ethereum contract address of the Parent Universe for the specified Universe. If the Universe does not have a Parent Universe (that is, it is a Genesis Universe), the address “0x0000000000000000000000000000000000000000” will be returned.
augur.api.Universe.getPreviousFeeWindow(p, callback)
Returns the Ethereum contract address of the previous Fee Window for the specified Universe.
Parameters:
p
(Object) Parameters object.
p.tx
(Object) Object containing details about how this function call should be made.p.tx.to
(string) Ethereum contract address of the Universe contract on which to call this function, as a 20-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (string) Ethereum contract address of the previous Fee Window for the specified Universe, as a 20-byte hexadecimal string. If the Fee Window contract for the previous Fee Window does not exist yet, the address “0x0000000000000000000000000000000000000000” will be returned.
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:
p
(Object) Parameters object.
p.tx
(Object) Object containing details about how this function call should be made.p.tx.to
(string) Ethereum contract address of the Universe contract on which to call this function, as a 20-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (string) Estimated REP market cap of the specified Universe, priced in attoETH, as a stringified unsigned integer.
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:
p
(Object) Parameters object.
p.tx
(Object) Object containing details about how this function call should be made.p.tx.to
(string) Ethereum contract address of the Universe contract on which to call this function, as a 20-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (string) Ethereum contract address of the Reputation Token for the specified Universe.
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:
p
(Object) Parameters object.
p.tx
(Object) Object containing details about how this function call should be made.p.tx.to
(string) Ethereum contract address of the Universe contract on which to call this function, as a 20-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (string) REP market cap that Augur targets when calculating Reporting Fees, in attoETH, as a stringified unsigned integer.
augur.api.Universe.getWinningChildUniverse(p, callback)
Returns the Ethereum contract address of the Winning Universe for a particular Universe that has Forked.
Parameters:
p
(Object) Parameters object.
p.tx
(Object) Object containing details about how this function call should be made.p.tx.to
(string) Ethereum contract address of the Universe contract on which to call this function, as a 20-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (string) Ethereum contract address of the Winning Universe for a Universe that has Forked, as a 20-byte hexadecimal string.
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:
- The Universe is not a container for the Fee Window of the Fee Token.
Parameters:
p
(Object) Parameters object.
p._shadyFeeToken
(string) Ethereum contract address of the Fee Token for which to check if it belongs to the Universe, as a 20-byte hexadecimal string.p.tx
(Object) Object containing details about how this function call should be made.p.tx.to
(string) Ethereum contract address of the Universe contract on which to call this function, as a 20-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (boolean)
true
if the Fee Token belongs to the Universe, orfalse
otherwise.
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:
p
(Object) Parameters object.
p._shadyFeeWindow
(string) Ethereum contract address of the Fee Window for which to check if it belongs to the Universe, as a 20-byte hexadecimal string.p.tx
(Object) Object containing details about how this function call should be made.p.tx.to
(string) Ethereum contract address of the Universe contract on which to call this function, as a 20-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (boolean)
true
if the Fee Window belongs to the Universe, orfalse
otherwise.
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:
p
(Object) Parameters object.
p._shadyMarket
(string) Ethereum contract address of the Market for which to check if it belongs to the Universe, as a 20-byte hexadecimal string.p.tx
(Object) Object containing details about how this function call should be made.p.tx.to
(string) Ethereum contract address of the Universe contract on which to call this function, as a 20-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (boolean)
true
if the Market belongs to the Universe, orfalse
otherwise.
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:
p
(Object) Parameters object.
p._shadyReportingParticipant
(string) Ethereum contract address of the Reporting Participant for which to check if it belongs to the Universe, as a 20-byte hexadecimal string.p.tx
(Object) Object containing details about how this function call should be made.p.tx.to
(string) Ethereum contract address of the Universe contract on which to call this function, as a 20-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (boolean)
true
if the Reporting Participant belongs to the Universe, orfalse
otherwise.
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:
p
(Object) Parameters object.
p._shadyShareToken
(string) Ethereum contract address of the Share Token for which to check if it belongs to the Universe, as a 20-byte hexadecimal string.p.tx
(Object) Object containing details about how this function call should be made.p.tx.to
(string) Ethereum contract address of the Universe contract on which to call this function, as a 20-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (boolean)
true
if the Share Token belongs to the Universe, orfalse
otherwise.
augur.api.Universe.isForking(p, callback)
Returns whether the specified Universe has a Market that has Forked.
Parameters:
p
(Object) Parameters object.
p.tx
(Object) Object containing details about how this function call should be made.p.tx.to
(string) Ethereum contract address of the Universe contract on which to call this function, as a 20-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (boolean)
true
if the specified Universe has a Market that has Forked, orfalse
otherwise.
augur.api.Universe.isParentOf(p, callback)
Returns whether the Universe is the Parent Universe for the specified Child Universe.
Parameters:
p
(Object) Parameters object.
p._shadyChild
(string) Ethereum contract address of the Universe for which to check if it is a Child Universe of the Universe, as a 20-byte hexadecimal string.p.tx
(Object) Object containing details about how this function call should be made.p.tx.to
(string) Ethereum contract address of the Universe contract on which to call this function, as a 20-byte hexadecimal string.
callback
(function) <optional> Called after the function’s result has been retrieved.
Returns:
- (boolean)
true
if the specified Universe is a Child Universe, orfalse
otherwise.
Transaction API
// Transaction API example:
// Internally, Augur uses an ERC-20 token called Cash as a wrapper for ETH.
// Many of Augur's transactions require the Augur.sol contract to be able
// to spend Cash on behalf of the account executing the transaction.
// However, the account must first approve Augur to spend that amount of
// Cash on its behalf by calling `augur.api.Cash.approve`.
// The Ethereum contract addresses for Augur.sol and Cash.sol
// can be obtained by calling `augur.augurNode.getSyncData`.
var _augurContractAddress = "0x67cbf60a24ab922af99e6f335c0ff2b084d5bdbe";
var cashContractAddress = "0xec28e64edbce62bde48a14b04f0b557b974a22a9";
// Amount of Cash (in attotokens) to approve the Augur.sol contract to
// spend on this Ethereum account's behalf.
// This example approves the maximum amount, which is
// augur.constants.ETERNAL_APPROVAL_VALUE, or 2^256 - 1.
var _attoCashTokens = augur.constants.ETERNAL_APPROVAL_VALUE;
// The Augur API is organized by Contract and then Method like so:
// augur.api.<Contract>.<Method>(<argument object>);
augur.api.Cash.approve({
_spender: _augurContractAddress,
_value: _attoCashTokens,
tx: {
to: cashContractAddress,
gas: "0x632ea0"
},
meta: {
accountType: "privateKey",
address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
},
onSent: function (result) { console.log(result); },
onSuccess: function (result) { console.log(result); },
onFailed: function (result) { console.log(result); }
});
// example onSent output:
{
callReturn: null,
hash: '0x3cd4a2eb35cc0cd3449c252737255863e60aa521d757d615cefbf280b54313fb'
}
// example onSuccess output:
{
blockHash: "0xb1379380e458710f25fea54ae03358832076eadc17825edef482efca3c43a9de",
blockNumber: 1707928,
callReturn: null,
from: "0x8fa56abe36d8dc76cf85fecb6a3026733e0a12ac",
gas: "0x632ea0",
gasFees: "0.000206912",
gasPrice: "0xee6b2800",
hash: "0x3cd4a2eb35cc0cd3449c252737255863e60aa521d757d615cefbf280b54313fb",
input: "0x095ea7b300000000000000000000000067cbf60a24ab922af99e6f335c0ff2b084d5bdbeffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
nonce: "0x97",
r: "0x804b2a14352d3fa9844c296eb8b9a6b8fed45ca5d56550d1eb558c6571abbaf4",
s: "0x3793c21fd315e14950b48a2200e8368ca0d25a2b6291eca9b5bb19753026859f",
timestamp: 1517688651,
to: "0xec28e64edbce62bde48a14b04f0b557b974a22a9",
transactionIndex: "0x1",
v: "0x2b",
value: "0x0"
}
// example onFailed output:
{
error: '0x',
message: 'no response or bad input'
}
Augur’s Transaction API (“Tx API” for short) is made up of “setter” methods that can both read from and write to the blockchain using Ethereum’s eth_sendTransaction
RPC. Under the hood, the API uses augur.js’s convenience wrapper for eth_sendTransaction
which can be accessed using augur.rpc.transact
. Although it is possible to call augur.rpc.transact
directly (which is discussed in greater detail below), it is generally better and easier to use the built-in API functions. The API functions are attached to the augur.api
object and follow a pattern of augur.api.<Contract>.<Method>(<Argument Object>)
. The API method name, as well as its parameters as keys in the params object, are generally identical to those of the underlying smart contract method.
Arguments
All Transaction API methods accept a single object argument, containing the following:
- All required parameters for the smart contract function as key/value pairs.
- A
tx
object (sometimes referred to as thepayload
object), which contains details about how the transaction should be made. - A
meta
object, which contains information for signing the transaction. onSent
,onSuccess
, andonFailed
callback functions.
The tx
Object
The tx
object must contain a to
property, which is the Ethereum address of the contract containing the transaction function, as a 20-byte hexadecimal string. This allows augur.js to know which contract to run the transaction on. A gas
property can also be specified for Transaction API functions (though this should not be specified for Call API functions). The gas
property represents the gas limit to use when executing the transaction. The gasPrice
property represents the gas price (in attoETH, or wei) to use. For Transaction API functions that have the payable
modifier in Augur’s Solidity smart contracts, a value
property must also be specified, which is the amount of attoETH to send to the function. Some of the Transaction API functions can either be made as a call (which will return a cached value and not use gas) or as a transaction (which will calculate the value and use gas to do so). By default, augur.js will call these functions as transactions, but they can be made as calls instead by specifying the send
property as false
.
The other properties that can be specified in the tx
object are discussed in the Using Transact Directly section.
The meta
Object
All Transaction API functions accept a meta
object as a parameter in order to sign the transaction. The meta
object contains a signer
property, which should be set to the private key buffer or a signing function, provided by a hardware wallet, of the account that wishes to initiate the transaction. (When logged in using an Edge account, the private key buffer can be obtained by outputting the value state.loginAccount.meta.signer
.) The meta
object also contains an accountType
property, which should be set to “privateKey”, “ledger”, “trezor”, “edge”, or “unlockedEthereumNode”. The Transaction API functions attempt to modify information on the blockchain, which requires the transaction to be signed. The meta
parameter is not required when calling Transaction API functions while using MetaMask (which will pop up a separate window asking to confirm the transaction).
Callbacks
Whereas the callback function parameter used by Call API is optional, but strongly recommended, the three callback function parameters used by the Transaction API functions are required. The following keys are used for each callback:
onSent(sentResponse)
Fires when the initial eth_sendTransaction
response is received. If the transaction was broadcast to the network without problems, sentResponse
will have two fields: txHash
(the transaction hash as a hex string) and callReturn
(the value returned by the invoked contract method). The optional returns
field in the tx
object sent to augur.rpc.transact
can be used to specify the format of the callReturn
value.
onSuccess(successResponse)
Fires when the transaction is successfully incorporated into a block and added to the blockchain, as indicated by a nonzero blockHash
value. successResponse
is structured the same way as eth_getTransactionByHash
responses (see code example for details), with the addition of a callReturn
field which contains the contract function’s return value.
onFailed(failedResponse)
Fires if the transaction is unsuccessful. failedResponse
has error
(error code) and message
(error description) fields, describing the way in which the transaction failed.
Approving Augur’s ERC-20 Tokens
Developers will need to grant the Augur.sol contract approval to spend Cash (which is an ERC-20 wrapper for ETH) before many of the Transaction API functions can be called. This can be done by calling the augur.api.Cash.approve
function, as shown to the right. Attempting to call many of Augur’s Transaction API functions without doing this first will result in these transactions failing.
Transaction Return Values
It is important to note that Ethereum nodes discard all transaction return values, which causes the callReturn
property of the object passed into a transaction’s onSuccess
callback to always be null
. As a result, there is no way to get a transaction’s return value.
There is, however, a workaround for this issue when calling functions that create Markets, such as augur.api.Universe.createYesNoMarket
, augur.api.Universe.createCategoricalMarket
, and augur.api.Universe.createScalarMarket
. The function augur.createMarket.getMarketFromCreateMarketReceipt
can be called in the onSuccess
callback of these functions to retrieve the Ethereum contract address of the newly-created Market. augur.createMarket.getMarketFromCreateMarketReceipt
does this by querying the Augur Node for the event log associated with the new Market’s creation.
Using Transact Directly
// Example using `augur.rpc.transact` directly
// `tx` object (generated by transfer method of the ReputationToken contract):
var tx = {
constant: false,
from: "0x40485264986740c8fb3d11e814bd94cf86012d29",
name: "getOrCacheMarketCreationCost",
params: [],
returns: "uint256",
send: true,
to: "0x6eabb9367012c0a84473e1e6d7a7ce39a54d77bb"
};
// privateKeyorSigner is either the privateKey buffer of the account trying to send the transaction or a function to sign a transaction (generally from a hardware wallet). This example uses the Buffer returned from the `augur.accounts.login` function.
var privateKeyOrSigner = [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25];
// accountType is a string set to "privateKey", "ledger", "trezor", "edge", or "unlockedEthereumNode".
var accountType = "privateKey";
// onSent callback fires when the initial eth_sendTransaction response is received
var onSent = function (sentResponse) { console.log("Transaction sent: ", sentResponse); };
// onSuccess callback fires
var onSuccess = function (successResponse) { console.log("Transaction successful: ", successResponse); };
// onFailed callback fires when the transaction is malformed, fails to confirm,
// or an object with an error field is received
var onFailed = function (failedResponse) { console.error("Transaction failed: ", failedResponse); };
augur.rpc.transact(tx, privateKeyOrSigner, accountType, onSent, onSuccess, onFailed);
// example onSent output:
Transaction sent: {
callReturn: null,
hash: "0x269011fe4ed9c7370f8e8237c525062988e8fcce485d93a1a6a419bb3a8e70d3"
}
// example onSuccess output:
Transaction successful: {
blockHash: "0x5090c1a25a2accf4cb47a1d99f4fa4215146ac29402688ad3e554169af332e4c",
blockNumber: 1348278,
callReturn: null,
from: "0x40485264986740c8fb3d11e814bd94cf86012d29",
gas: "0x2fd618",
gasFees: "0.001882121837379",
gasPrice: "0x5b793ccec",
hash: "0x0f8e4cdf3de1aa3c01bea8b12cbde32b2bc7701d2bc1b6403634cdd5999ad729",
input: "0xec86fdbd",
nonce: "0x12",
r: "0x3bedf73900da86c9afb6721e472a268108c66694a589b3083935a3c3cc0cc764",
s: "0x2c9c24f3bbdd63ba2218de2eddb120f52e966d36fa82989ef6b1e3df0b205ce2",
timestamp: 1512278406,
to: "0x6eabb9367012c0a84473e1e6d7a7ce39a54d77bb",
transactionIndex: "0x1",
v: "0x2c",
value: "0x0"
}
//example onFailed output:
Transaction failed: {
error: 501,
message: 'polled network but could not confirm transaction'
}
augur.rpc.transact(payload, privateKeyOrSigner, accountType, onSent, onSuccess, onFailed)
Transactions can be broadcast to the Ethereum Network by calling augur.rpc.transact
directly. When calling this function directly, the payload
object (also known as the tx
object) must be constructed carefully as follows:
Required:
- to:
<contract address> (hexstring)
- name:
<function name> (string)
- signature:
<function signature, e.g. ["int256", "bytes", "int256[]"]> (array)
- params:
<parameters passed to the function>
Optional:
- gas:
<gas limit (in attoETH, or wei) to use for transaction (defaults to "0x2fd618")> (hexstring)
- gasPrice:
<gas price (in attoETH, or wei) to use for transaction (default value varies). If transactions are taking a while, using 40-50 gwei as the gas price is recommended.> (hexstring)
- send:
<true to sendTransaction, false to call (default)>
- from:
<sender's address> (hexstring; defaults to the coinbase account)
- returns:
<"int256" (default), "int", "number", "int256[]", "number[]", or "string">
The signature
and params
fields are required if the transaction function being called accepts parameters; otherwise, these fields can be excluded. The returns
field is used only to format the output, and does not affect the actual RPC request.
The privateKeyOrSigner
is required when attempting to execute a transaction that will modify the blockchain (eth_sendTransaction
). If the function is simply getting information (eth_call
) privateKeyOrSigner
can be null. Otherwise, privateKeyOrSigner
should be the Private Key Buffer for the logged-in account or a function to sign transactions provided by a hardware wallet.
The accountType
is a string that can be “privateKey”, “ledger”, “trezor”, “edge”, or “unlockedEthereumNode”, depending on the type of account that is sending the transaction.
Under the hood, augur.rpc.transact
carries out the following sequence:
augur.rpc.transact
first attempts to useeth_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 theonFailed
handler, and theaugur.rpc.transact
sequence terminates.After confirming that the Transaction is valid,
augur.rpc.transact
sends aneth_sendTransaction
RPC request (oreth_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 theonFailed
handler, and theaugur.rpc.transact
sequence terminates. Otherwise, theonSent
handler is called and returns an object containing thetxHash
andcallReturn
.After calling the
onSent
handler, Augur adds the transaction to thetransactions
object (which is indexed by transaction hash, e.g.transactions[txHash]
) and assigns the transaction astatus
of"pending"
. The functionaugur.rpc.getTransactions
can be used to access thetransactions
object.Augur then uses
eth_getTransactionByHash
to determine if the transaction has been mined or not, indicated by anull
response. Anull
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 anull
response is received frometh_getTransactionByHash
, Augur will attempt to re-submit the transaction toaugur.rpc.transact
as long as the number of attempts has not exceededaugur.constants.TX_RETRY_MAX
. Once the number of attempts exceeds this threshold, aTRANSACTION_RETRY_MAX_EXCEEDED
error is sent to theonFailed
handler, and theaugur.rpc.transact
sequence will terminate.Once the transaction has been successfully mined (
eth_getTransactionByHash
successfully returns the transaction object) the transaction is updated to include theblockNumber
andblockHash
and itsstatus
is changed to"sealed"
.When the number of confirmations of the transaction exceeds
augur.constants.REQUIRED_CONFIRMATIONS
, the transaction’s status is updated to"confirmed"
. AcallReturn
field is added to the transaction object, which is then passed to theonSuccess
handler, completing the sequence.
Augur Tx API
// Augur Transaction API Examples:
// The Ethereum address of Augur's default Augur contract
// can be obtained by calling `augur.augurNode.getSyncData`.
var augurAddress = "0x852684b374fe03ab77d06931f1b2831028fd58f5";
augur.api.Augur.createGenesisUniverse({
tx: {
to: augurAddress,
gas: "0x632ea0"
},
meta: {
accountType: "privateKey",
address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
},
onSent: function (result) { console.log(result); },
onSuccess: function (result) { console.log(result); },
onFailed: function (result) { console.log(result); }
});
Provides JavaScript bindings for the Augur Solidity Contract, which handles Universe creation and event logging.
augur.api.Augur.createGenesisUniverse(p)
Allows the caller to create a new Genesis Universe. Users may wish to create a new Genesis Universe if, for example, they would like to create a separate Universe to compete with an existing Universe. Whenever a new Genesis Universe is created, it does not initially contain any Markets or REP supply. In order to add a supply of REP, users must migrate their Legacy REP from the Legacy REP smart contract into the Reputation Token smart contract of the new Genesis Universe using the function augur.api.ReputationToken.migrateFromLegacyReputationToken
.
Parameters:
p
(Object) Parameters object.
p.tx
(Object) Object containing details about how this transaction should be made.p.tx.to
(string) Ethereum contract address on which to call this function, as a 20-byte hexadecimal string.p.tx.gas
(string) Gas limit to use when submitting this transaction, as a hexadecimal string.
p.meta
(Meta) <optional> Authentication metadata for raw transactions.p.onSent
(function) Callback function that executes once the transaction has been sent.p.onSuccess
(function) <optional> Callback function that executes if the transaction returned successfully.p.onFailed
(function) <optional> Callback function that executes if the transaction failed.
Returns:
- Return value cannot be obtained because Ethereum nodes discard transaction return values.
Cancel Order Tx API
// Cancel Order Transaction API Examples:
// The Ethereum address of Augur's default CancelOrder contract
// can be obtained by calling `augur.augurNode.getSyncData`.
var cancelOrderAddress = "0x389c0b3f0d51cfba9e4d214712a1142f5685814d";
var _orderId = "0x7ca90ca9118db456d87e3d743b97782a857200b55039f7ffe8de94e5d920f870";
augur.api.CancelOrder.cancelOrder({
_orderId: _orderId,
tx: {
to: cancelOrderAddress,
gas: "0x632ea0"
},
meta: {
accountType: "privateKey",
address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
},
onSent: function (result) { console.log(result); },
onSuccess: function (result) { console.log(result); },
onFailed: function (result) { console.log(result); }
});
Provides JavaScript bindings for the CancelOrder Solidity Contract, which allows for cancellation of Orders on the Order Book.
augur.api.CancelOrder.cancelOrder(p)
Cancels and refunds an existing Order on the Order Book with ID p._orderId
. This transaction will trigger an OrderCanceled
event if the Order is canceled without any errors.
This function will fail if:
msg.sender
isn’t the owner of the Order.p._orderId
is undefined.
Parameters:
p
(Object) Parameters object.
p._orderId
(string) ID of the Order to cancel, as a 32-byte hexadecimal value. (To get the order ID for a specific order, call the functionaugur.api.Order.getOrderId
.)p.tx
(Object) Object containing details about how this transaction should be made.p.tx.to
(string) Ethereum contract address on which to call this function, as a 20-byte hexadecimal string.p.tx.gas
(string) Gas limit to use when submitting this transaction, as a hexadecimal string.
p.meta
(Meta) <optional> Authentication metadata for raw transactions.p.onSent
(function) Callback function that executes once the transaction has been sent.p.onSuccess
(function) <optional> Callback function that executes if the transaction returned successfully.p.onFailed
(function) <optional> Callback function that executes if the transaction failed.
Returns:
- Return value cannot be obtained because Ethereum nodes discard transaction return values.
Cash Tx API
// Cash Transaction API Examples:
// The Ethereum contract address for Augur.sol can be
// obtained by calling `augur.augurNode.getSyncData`.
var _augurContractAddress = "0x67cbf60a24ab922af99e6f335c0ff2b084d5bdbe";
// The Ethereum address of Augur's Cash contract can be
// obtained by calling `augur.augurNode.getSyncData`.
var cashContractAddress = "0xec28e64edbce62bde48a14b04f0b557b974a22a9";
// Amount of Cash (in attoCash) to approve the Augur.sol
// contract to spend on this Ethereum account's behalf.
// This example approves the maximum amount, which is
// augur.constants.ETERNAL_APPROVAL_VALUE, or 2^256 - 1.
var _attoCash = augur.constants.ETERNAL_APPROVAL_VALUE;
augur.api.Cash.approve({
_spender: _augurContractAddress,
_value: _attoCash,
tx: {
to: cashContractAddress,
gas: "0x632ea0"
},
meta: {
accountType: "privateKey",
address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
},
onSent: function (result) { console.log(result); },
onSuccess: function (result) { console.log(result); },
onFailed: function (result) { console.log(result); }
});
augur.api.Cash.decreaseApproval({
_spender: _augurContractAddress,
_subtractedValue: "0x3e8",
tx: {
to: cashContractAddress,
gas: "0x632ea0"
},
meta: {
accountType: "privateKey",
address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
},
onSent: function (result) { console.log(result); },
onSuccess: function (result) { console.log(result); },
onFailed: function (result) { console.log(result); }
});
augur.api.Cash.increaseApproval({
_spender: "",
_addedValue: "0x3e8",
tx: {
to: cashContractAddress,
gas: "0x632ea0"
},
meta: {
accountType: "privateKey",
address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
},
onSent: function (result) { console.log(result); },
onSuccess: function (result) { console.log(result); },
onFailed: function (result) { console.log(result); }
});
augur.api.Cash.withdrawEtherToIfPossible({
_to: "0x555e64edbce62bde48a14b04f0b557b974a25555",
_amount: "0x3e8",
tx: {
to: cashContractAddress,
gas: "0x632ea0"
},
meta: {
accountType: "privateKey",
address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
},
onSent: function (result) { console.log(result); },
onSuccess: function (result) { console.log(result); },
onFailed: function (result) { console.log(result); }
});
Provides JavaScript bindings for the Cash Solidity Contract, which is used internally by Augur as an ERC-20 wrapper for ETH.
augur.api.Cash.approve(p)
Many of the transaction functions in Augur’s smart contracts will only work if the Augur.sol contract has been approved to spend Cash on behalf of the account executing the transaction. This function allows p._spender
to spend up to p._value
Cash for the msg.sender
of this transaction. This transaction will trigger an Approval
event, which will record the owner address (msg.sender
), p._spender
, and p._value
in attoCash approved. The amount that p.spender
is approved to spend can be increased or decreased later by calling augur.api.Cash.increaseApproval
or augur.api.Cash.decreaseApproval
.
Parameters:
p
(Object) Parameters object.p._spender
(string) Ethereum address of the desired spender, as a 20-byte hexadecimal value.p._value
(string) Number of attoCash to allowp._spender
to spend on behalf ofmsg.sender
, as a hexadecimal string.p.tx
(Object) Object containing details about how this transaction should be made.p.tx.to
(string) Ethereum contract address on which to call this function, as a 20-byte hexadecimal string.p.tx.gas
(string) Gas limit to use when submitting this transaction, as a hexadecimal string.
p.meta
(Meta) <optional> Authentication metadata for raw transactions.p.onSent
(function) Callback function that executes once the transaction has been sent.p.onSuccess
(function) <optional> Callback function that executes if the transaction returned successfully.p.onFailed
(function) <optional> Callback function that executes if the transaction failed.
Returns:
- Return value cannot be obtained because Ethereum nodes discard transaction return values.
augur.api.Cash.decreaseApproval(p)
Decreases the amount of Cash p._spender
is approved to spend on behalf of msg.sender
.
Parameters:
p
(Object) Parameters object.p._spender
(string) Ethereum address of the desired spender, as a 20-byte hexadecimal value.p._subtractedValue
(string) Number of attoCash by which to decrease the amountp._spender
may spend on behalf ofmsg.sender
, as a hexadecimal string.p.tx
(Object) Object containing details about how this transaction should be made.p.tx.to
(string) Ethereum contract address on which to call this function, as a 20-byte hexadecimal string.p.tx.gas
(string) Gas limit to use when submitting this transaction, as a hexadecimal string.
p.meta
(Meta) <optional> Authentication metadata for raw transactions.p.onSent
(function) Callback function that executes once the transaction has been sent.p.onSuccess
(function) <optional> Callback function that executes if the transaction returned successfully.p.onFailed
(function) <optional> Callback function that executes if the transaction failed.
Returns:
- Return value cannot be obtained because Ethereum nodes discard transaction return values.
augur.api.Cash.increaseApproval(p)
Increases the amount of Cash p._spender
is approved to spend on behalf of msg.sender
.
Parameters:
p
(Object) Parameters object.p._spender
(string) Ethereum address of the desired spender, as a 20-byte hexadecimal value.p._addedValue
(string) Number of attoCash by which to increase the amountp._spender
may spend on behalf ofmsg.sender
, as a hexadecimal string.p.tx
(Object) Object containing details about how this transaction should be made.p.tx.to
(string) Ethereum contract address on which to call this function, as a 20-byte hexadecimal string.p.tx.gas
(string) Gas limit to use when submitting this transaction, as a hexadecimal string.
p.meta
(Meta) <optional> Authentication metadata for raw transactions.p.onSent
(function) Callback function that executes once the transaction has been sent.p.onSuccess
(function) <optional> Callback function that executes if the transaction returned successfully.p.onFailed
(function) <optional> Callback function that executes if the transaction failed.
Returns:
- Return value cannot be obtained because Ethereum nodes discard transaction return values.
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:
p
(Object) Parameters object.p._to
(string) Ethereum address to transfer attoETH to, as a 20-byte hexadecimal value.p._amount
(string) Amount of attoETH to transfer, as a hexadecimal string.p.tx
(Object) Object containing details about how this transaction should be made.p.tx.to
(string) Ethereum contract address on which to call this function, as a 20-byte hexadecimal string.p.tx.gas
(string) Gas limit to use when submitting this transaction, as a hexadecimal string.
p.meta
(Meta) <optional> Authentication metadata for raw transactions.p.onSent
(function) Callback function that executes once the transaction has been sent.p.onSuccess
(function) <optional> Callback function that executes if the transaction returned successfully.p.onFailed
(function) <optional> Callback function that executes if the transaction failed.
Returns:
- Return value cannot be obtained because Ethereum nodes discard transaction return values.
Claim Trading Proceeds Tx API
// Claim Trading Proceeds Transaction API Examples:
// The Ethereum address of Augur's default ClaimTradingProceeds contract
// can be obtained by calling `augur.augurNode.getSyncData`.
var claimTradingProceedsAddress = "0x53ebdf8b5babda8e59a217436266696efcd8d166";
var _market = "0xc4ba20cbafe3a3655a2f2e4df4ac7f942a722017";
augur.api.ClaimTradingProceeds.calculateReportingFee({
_market: _market,
_amount: "0xc3280e4b4b",
tx: {
to: claimTradingProceedsAddress,
send: false,
}
}, function (error, reportingFee) {
console.log(reportingFee);
});
// example output:
"83819064"
var _shareHolder = "0x5678ff3e9ce1c0459b309fac6dd4e69229b91567";
augur.api.ClaimTradingProceeds.claimTradingProceeds({
_market: _market,
_shareHolder: _shareHolder,
tx: {
to: claimTradingProceedsAddress,
gas: "0x632ea0"
},
meta: {
accountType: "privateKey",
address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
},
onSent: function (result) { console.log(result); },
onSuccess: function (result) { console.log(result); },
onFailed: function (result) { console.log(result); }
});
Provides JavaScript bindings for the ClaimTradingProceeds Solidity Contract, which allows profits earned from trading to be claimed.
augur.api.ClaimTradingProceeds.calculateReportingFee(p)
Calculates the Reporting Fee that will be paid when settling a specific number of Shares in a given Market.
Parameters:
p
(Object) Parameters object.p._market
(string) Ethereum address of the Market in which to claim trading proceeds, as a 20-byte hexadecimal value.p._amount
(string) Number of Share Units, as a hexadecimal string.p.tx
(Object) Object containing details about how this transaction should be made.p.tx.to
(string) Ethereum contract address on which to call this function, as a 20-byte hexadecimal string.p.tx.send
(boolean) <optional> Whether this function should be executed as a transaction. When set totrue
, this function will be executed as a transaction, which will calculate the value (and thus uses gas). When set tofalse
, this function will be executed as a call, which will return the Reporting Fee amount and will not use any gas.p.tx.gas
(string) Gas limit to use when submitting this transaction, as a hexadecimal string.
p.meta
(Meta) <optional> Authentication metadata for raw transactions.p.onSent
(function) Callback function that executes once the transaction has been sent.p.onSuccess
(function) <optional> Callback function that executes if the transaction returned successfully.p.onFailed
(function) <optional> Callback function that executes if the transaction failed.
Returns:
- (null|string) Return value cannot be obtained when executed as a transaction because Ethereum nodes discard transaction return values. However, if
p.tx.send
is set tofalse
, this function will be executed as a call and will return the Reporting Fee amount, in attoETH, as a stringified unsigned integer.
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:
p._market
has not been Finalized.- The Post-Finalization Waiting Period has not passed.
Parameters:
p
(Object) Parameters object.p._market
(string) Ethereum address of the Market in which to claim trading proceeds, as a 20-byte hexadecimal value.p._shareHolder
(string) Ethereum address of the Share holder for which to claim trading proceeds, as a 20-byte hexadecimal value.p.tx
(Object) Object containing details about how this transaction should be made.p.tx.to
(string) Ethereum contract address on which to call this function, as a 20-byte hexadecimal string.p.tx.gas
(string) Gas limit to use when submitting this transaction, as a hexadecimal string.
p.meta
(Meta) <optional> Authentication metadata for raw transactions.p.onSent
(function) Callback function that executes once the transaction has been sent.p.onSuccess
(function) <optional> Callback function that executes if the transaction returned successfully.p.onFailed
(function) <optional> Callback function that executes if the transaction failed.
Returns:
- Return value cannot be obtained because Ethereum nodes discard transaction return values.
Complete Sets Tx API
// Complete Sets Transaction API Examples:
// The Ethereum address of Augur's default CompleteSets contract
// can be obtained by calling `augur.augurNode.getSyncData`.
var completeSetsAddress = "0x8aa774927fb928ee1df0d0d3f94c8217658e0bce";
var _market = "0x9368ff3e9ce1c0459b309fac6dd4e69229b91a42";
var _amount = "0x2b5e3af16b1880000"; // 50.0 shares
augur.api.CompleteSets.publicBuyCompleteSets({
_market: _market,
_amount: _amount,
tx: {
to: completeSetsAddress,
value: "0x16345785d8a0000",
gas: "0x632ea0"
},
meta: {
accountType: "privateKey",
address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
},
onSent: function (result) { console.log(result); },
onSuccess: function (result) { console.log(result); },
onFailed: function (result) { console.log(result); }
});
augur.api.CompleteSets.publicBuyCompleteSetsWithCash({
_market: _market,
_amount: _amount,
tx: {
to: completeSetsAddress,
value: "0x16345785d8a0000",
gas: "0x632ea0"
},
meta: {
accountType: "privateKey",
address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
},
onSent: function (result) { console.log(result); },
onSuccess: function (result) { console.log(result); },
onFailed: function (result) { console.log(result); }
});
augur.api.CompleteSets.publicSellCompleteSets({
_market: _market,
_amount: _amount,
tx: {
to: completeSetsAddress,
gas: "0x632ea0"
},
meta: {
accountType: "privateKey",
address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
},
onSent: function (result) { console.log(result); },
onSuccess: function (result) { console.log(result); },
onFailed: function (result) { console.log(result); }
});
augur.api.CompleteSets.publicSellCompleteSetsWithCash({
_market: _market,
_amount: _amount,
tx: {
to: completeSetsAddress,
gas: "0x632ea0"
},
meta: {
accountType: "privateKey",
address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
},
onSent: function (result) { console.log(result); },
onSuccess: function (result) { console.log(result); },
onFailed: function (result) { console.log(result); }
});
Provides JavaScript bindings for the CompleteSets Solidity Contract, which allows for buying and selling of Complete Sets.
augur.api.CompleteSets.publicBuyCompleteSets(p)
Purchases p._amount
worth of Shares in all Outcomes of Market p._market
.
This transaction will fail if:
msg.sender
doesn’t have enough ofp._market
’s denomination token to be able to affordp._amount
Shares in all Outcomes.p._amount
is not a number between 1 and 2254.
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:
p
(Object) Parameters object.p._market
(string) Ethereum address of the Market in which to buy Complete Sets, as a 20-byte hexadecimal value.p._amount
(string) Number of Share Units to purchase of each Outcome, as a hexadecimal string.p.tx
(Object) Object containing details about how this transaction should be made.p.tx.to
(string) Ethereum contract address on which to call this function, as a 20-byte hexadecimal string.p.tx.value
(string) Number of attoETH required to buy a Complete Set, as a hexadecimal string.p.tx.gas
(string) Gas limit to use when submitting this transaction, as a hexadecimal string.
p.meta
(Meta) <optional> Authentication metadata for raw transactions.p.onSent
(function) Callback function that executes once the transaction has been sent.p.onSuccess
(function) <optional> Callback function that executes if the transaction returned successfully.p.onFailed
(function) <optional> Callback function that executes if the transaction failed.
Returns:
- Return value cannot be obtained because Ethereum nodes discard transaction return values.
augur.api.CompleteSets.publicBuyCompleteSetsWithCash(p)
This function is not fully implemented yet, but is a intended to be a point-of-contact that would work similarly to augur.api.CompleteSets.publicBuyCompleteSets
and allow for a 0x-style trading system.
Parameters:
p
(Object) Parameters object.p._market
(string) Ethereum address of the Market in which to buy Complete Sets, as a 20-byte hexadecimal value.p._amount
(string) Number of Share Units to purchase of each Outcome, as a hexadecimal string.p.tx
(Object) Object containing details about how this transaction should be made.p.tx.to
(string) Ethereum contract address on which to call this function, as a 20-byte hexadecimal string.p.tx.value
(string) Number of attoETH required to buy a Complete Set, as a hexadecimal string.p.tx.gas
(string) Gas limit to use when submitting this transaction, as a hexadecimal string.
p.meta
(Meta) <optional> Authentication metadata for raw transactions.p.onSent
(function) Callback function that executes once the transaction has been sent.p.onSuccess
(function) <optional> Callback function that executes if the transaction returned successfully.p.onFailed
(function) <optional> Callback function that executes if the transaction failed.
Returns:
- Return value cannot be obtained because Ethereum nodes discard transaction return values.
augur.api.CompleteSets.publicSellCompleteSets(p)
Sell p._amount
worth of Shares in all Outcomes of Market p._market
.
This transaction will fail if:
msg.sender
doesn’t ownp._amount
Shares of all Outcomes inp._market
.p._amount
is not a number between 1 and 2254.
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:
p
(Object) Parameters object.p._market
(string) Ethereum address of the Market in which to sell Complete Sets, as a 20-byte hexadecimal value.p._amount
(string) Number of Share Units to sell of each Outcome, as a hexadecimal string.p.tx
(Object) Object containing details about how this transaction should be made.p.tx.to
(string) Ethereum contract address on which to call this function, as a 20-byte hexadecimal string.p.tx.gas
(string) Gas limit to use when submitting this transaction, as a hexadecimal string.
p.meta
(Meta) <optional> Authentication metadata for raw transactions.p.onSent
(function) Callback function that executes once the transaction has been sent.p.onSuccess
(function) <optional> Callback function that executes if the transaction returned successfully.p.onFailed
(function) <optional> Callback function that executes if the transaction failed.
Returns:
- Return value cannot be obtained because Ethereum nodes discard transaction return values.
augur.api.CompleteSets.publicSellCompleteSetsWithCash(p)
This function is not fully implemented yet, but is a intended to be a point-of-contact that would work similarly to augur.api.CompleteSets.publicSellCompleteSets
and allow for a 0x-style trading system.
Parameters:
p
(Object) Parameters object.p._market
(string) Ethereum address of the Market in which to sell Complete Sets, as a 20-byte hexadecimal value.p._amount
(string) Number of Share Units to sell of each Outcome, as a hexadecimal string.p.tx
(Object) Object containing details about how this transaction should be made.p.tx.to
(string) Ethereum contract address on which to call this function, as a 20-byte hexadecimal string.p.tx.gas
(string) Gas limit to use when submitting this transaction, as a hexadecimal string.
p.meta
(Meta) <optional> Authentication metadata for raw transactions.p.onSent
(function) Callback function that executes once the transaction has been sent.p.onSuccess
(function) <optional> Callback function that executes if the transaction returned successfully.p.onFailed
(function) <optional> Callback function that executes if the transaction failed.
Returns:
- Return value cannot be obtained because Ethereum nodes discard transaction return values.
Create Order Tx API
// Create Order Transaction API Examples:
// The Ethereum address of Augur's default CreateOrder contract
// can be obtained by calling `augur.augurNode.getSyncData`.
var createOrderAddress = "0xdadc071ecc3b7e97b139d2ef692defdc398c8211";
// The _betterOrderId/_worseOrderId to use when creating an Order
// can be obtained by calling `augur.trading.getBetterWorseOrders`.
// In the example below, `augur.trading.getBetterWorseOrders` returned
var _betterOrderId = "0x12328a31378e925ea122ea73e8c81baaf5c731d408487f6884d2e4c81baa3456";
var _worseOrderId = "0x91c28a31378e925ea122ea73e8c81baaf5c731d408487f6884d2e4c81baa39dd";
augur.api.CreateOrder.publicCreateOrder({
_type: "0x0",
_attoshares: "0x5af3107a4000",
_displayPrice: "0x64",
_market: "0xc4ba20cbafe3a3655a2f2e4df4ac7f942a722017",
_outcome: "0x0",
_betterOrderId: _betterOrderId,
_worseOrderId: _worseOrderId,
_tradeGroupId: "0x0000000000000000000000000000000000000000000000000000000000000000",
tx: {
to: createOrderAddress,
value: "0x470de4df820000",
},
meta: {
accountType: "privateKey",
address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
},
onSent: function (result) { console.log(result); },
onSuccess: function (result) { console.log(result); },
onFailed: function (result) { console.log(result); }
});
Provides JavaScript bindings for the CreateOrder Solidity Contract, which enables new Orders to be created.
augur.api.CreateOrder.publicCreateOrder(p)
Creates a new Bid Order or Ask Order on the Order Book. The parameters p._betterOrderId
and p._worseOrderId
are the Orders with the next best/next worse price after p._displayPrice
, and they are used to optimize the process of sorting the new Order on the Order Book. Their IDs can be obtained by calling augur.trading.getBetterWorseOrders
. This transaction will trigger an OrderCreated
event if the Order is created without any errors.
This transaction will fail if:
p._type
is not a valid value of 0 or 1.p._attoshares
is less than 0.p._market
is undefined.p._outcome
is less than 0 or greater than the total number of Outcomes forp._market
.p._displayPrice
is below thep._market
’s Minimum Display Price or above themarket
’s Maximum Display Price.
Parameters:
p
(Object) Parameters object.p._type
(string) Type of Order to create, as a hexadecimal string (“0x0” for a Bid Order, “0x1” for an Ask Order).p._attoshares
(string) Number of Share Units to buy or sell, as a hexadecimal string.p._displayPrice
(string) Desired price at which to purchase Shares, in attoETH.p._market
(string) Market contract address in which to place the Order, as a 20-byte hexadecimal value.p._outcome
(string) Outcome for which to place the Order, as a hexadecimal string.p._betterOrderId
(string) Order ID of an existing Order on the Order Book with the next-best price with respect to the Order this transaction is intending to create, as a 32-byte hexadecimal value. The Order ID forp._betterOrderId
can be obtained by callingaugur.trading.getBetterWorseOrders
.p._worseOrderId
(string) Order ID of an existing Order on the Order Book with the next-worse price with respect to the Order this transaction is intending to create, as a 32-byte hexadecimal value. The Order ID forp._worseOrderId
can be obtained by callingaugur.trading.getBetterWorseOrders
.p._tradeGroupId
(string) <optional> ID used by the Augur UI to group transactions, as a 32-byte hexadecimal value.p.tx
(Object) Object containing details about how this transaction should be made.p.tx.to
(string) Ethereum contract address on which to call this function, as a 20-byte hexadecimal string.p.tx.value
(string) Number of attoETH required to create the Order, as a hexadecimal string.p.tx.gas
(string) Gas limit to use when submitting this transaction, as a hexadecimal string.
p.meta
(Meta) <optional> Authentication metadata for raw transactions.p.onSent
(function) Callback function that executes once the transaction has been sent.p.onSuccess
(function) <optional> Callback function that executes if the transaction returned successfully.p.onFailed
(function) <optional> Callback function that executes if the transaction failed.
Returns:
- Return value cannot be obtained because Ethereum nodes discard transaction return values.
Dispute Crowdsourcer Tx API
// Dispute Crowdsourcer Transaction API Examples:
// Dispute Crowdsourcer contract addresses for a Market can be
// obtained by calling `augur.api.Market.getReportingParticipant`
// or `augur.api.Market.derivePayoutDistributionHash`, followed
// by `augur.api.Market.getCrowdsourcer`.
var disputeCrowdsourcerAddress = "0xe5d6eaefcfaf7ea1e17c4768a554d57800699ea4";
augur.api.DisputeCrowdsourcer.forkAndRedeem({
tx: {
to: disputeCrowdsourcerAddress,
gas: "0x632ea0"
},
meta: {
accountType: "privateKey",
address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
},
onSent: function (result) { console.log(result); },
onSuccess: function (result) { console.log(result); },
onFailed: function (result) { console.log(result); }
});
var _redeemer = "0x55d6eaefcfaf7ea1e17c4768a554d57800699ae4";
augur.api.DisputeCrowdsourcer.redeem({
_redeemer: _redeemer,
tx: {
to: disputeCrowdsourcerAddress,
gas: "0x632ea0"
},
meta: {
accountType: "privateKey",
address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
},
onSent: function (result) { console.log(result); },
onSuccess: function (result) { console.log(result); },
onFailed: function (result) { console.log(result); }
});
augur.api.DisputeCrowdsourcer.withdrawInEmergency({
tx: {
to: disputeCrowdsourcerAddress,
gas: "0x632ea0"
},
meta: {
accountType: "privateKey",
address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
},
onSent: function (result) { console.log(result); },
onSuccess: function (result) { console.log(result); },
onFailed: function (result) { console.log(result); }
});
Provides JavaScript bindings for the DisputeCrowdsourcer Solidity Contract, which allows users to Stake and redeem REP on Outcomes other than a Market’s Tentative Outcome.
augur.api.DisputeCrowdsourcer.forkAndRedeem(p)
Causes a Child Universe to be created for the Outcome of the Dispute Crowdsourcer and migrates the REP in the Crowdsourcer to the Child Universe. This function can be called only on the Crowdsourcers of a Forked Market, and it can be called at any time after the Fork has begun (including after the Market has been Finalized). When called by a user who Staked on the Dispute Crowdsourcer’s Outcome, it will redeem their Staked REP and collect any Reporting Fees (in Ether) that they are owed.
This transaction will trigger a ReportingParticipantDisavowed event if the DisputeCrowdsourcer was forked without any errors.
This transaction will fail if:
- The DisputeCrowdsourcer belongs to a Market that is not Forked.
This transaction will trigger a ReportingParticipantDisavowed event if the DisputeCrowdsourcer was forked without any errors.
Parameters:
p
(Object) Parameters object.p.tx
(Object) Object containing details about how this transaction should be made.p.tx.to
(string) Ethereum contract address on which to call this function, as a 20-byte hexadecimal string.p.tx.gas
(string) Gas limit to use when submitting this transaction, as a hexadecimal string.
p.meta
(Meta) <optional> Authentication metadata for raw transactions.p.onSent
(function) Callback function that executes once the transaction has been sent.p.onSuccess
(function) <optional> Callback function that executes if the transaction returned successfully.p.onFailed
(function) <optional> Callback function that executes if the transaction failed.
Returns:
- Return value cannot be obtained because Ethereum nodes discard transaction return values.
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:
- The DisputeCrowdsourcer belongs to a non-Forked Market in the same Universe as the Forked Market, and that non-Forked Market has not had
augur.api.Market.disavowCrowdsourcers
called on it. - The DisputeCrowdsourcer belongs to the Forked Market and has not had
augur.api.DisputeCrowdsourcer.forkAndRedeem
called on it.
Parameters:
p
(Object) Parameters object.p._redeemer
(string) Ethereum address to send redeemed REP/Ether to, as a 20-byte hexadecimal value.p.tx
(Object) Object containing details about how this transaction should be made.p.tx.to
(string) Ethereum contract address on which to call this function, as a 20-byte hexadecimal string.p.tx.gas
(string) Gas limit to use when submitting this transaction, as a hexadecimal string.
p.meta
(Meta) <optional> Authentication metadata for raw transactions.p.onSent
(function) Callback function that executes once the transaction has been sent.p.onSuccess
(function) <optional> Callback function that executes if the transaction returned successfully.p.onFailed
(function) <optional> Callback function that executes if the transaction failed.
Returns:
- Return value cannot be obtained because Ethereum nodes discard transaction return values.
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:
- Augur is not currently in a halted state.
Parameters:
p
(Object) Parameters object.p.tx
(Object) Object containing details about how this transaction should be made.p.tx.to
(string) Ethereum contract address on which to call this function, as a 20-byte hexadecimal string.p.tx.gas
(string) Gas limit to use when submitting this transaction, as a hexadecimal string.
p.meta
(Meta) <optional> Authentication metadata for raw transactions.p.onSent
(function) Callback function that executes once the transaction has been sent.p.onSuccess
(function) <optional> Callback function that executes if the transaction returned successfully.p.onFailed
(function) <optional> Callback function that executes if the transaction failed.
Returns:
- Return value cannot be obtained because Ethereum nodes discard transaction return values.
Fee Window Tx API
// Fee Window Transaction API Examples:
// Fee Window contract addresses can be obtained using a variety of Call API functions,
// including `augur.api.Universe.getCurrentFeeWindow` and `augur.api.Universe.getFeeWindowByTimestamp`.
var feeWindowAddress = "0xe5d6eaefcfaf7ea1e17c4768a554d57800699ea4";
var _attotokens = "0x64";
augur.api.FeeWindow.buy({
_attotokens: _attotokens,
tx: {
to: feeWindowAddress,
gas: "0x632ea0"
},
meta: {
accountType: "privateKey",
address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
},
onSent: function (result) { console.log(result); },
onSuccess: function (result) { console.log(result); },
onFailed: function (result) { console.log(result); }
});
var _sender = "0x8886eaefcfaf7ea1e17c4768a554d57800699888";
augur.api.FeeWindow.redeem({
_sender: _sender,
tx: {
to: feeWindowAddress,
gas: "0x632ea0"
},
meta: {
accountType: "privateKey",
address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
},
onSent: function (result) { console.log(result); },
onSuccess: function (result) { console.log(result); },
onFailed: function (result) { console.log(result); }
});
augur.api.FeeWindow.withdrawInEmergency({
tx: {
to: feeWindowAddress,
gas: "0x632ea0"
},
meta: {
accountType: "privateKey",
address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
},
onSent: function (result) { console.log(result); },
onSuccess: function (result) { console.log(result); },
onFailed: function (result) { console.log(result); }
});
Provides JavaScript bindings for the FeeWindow Solidity Contract, which allows for the buying and redeeming of Participation Tokens.
augur.api.FeeWindow.buy(p)
Purchases the number of Participation Tokens specified by p._attotokens
.
This transaction will fail if:
p._attotokens
is <= 0.- Reporting is not currently active in the Fee Window.
- The Fee Window’s Universe has a Forked Market.
These Participation Tokens can be redeemed later once the Fee Window is no longer active using the function augur.api.FeeWindow.redeem
.
Parameters:
p
(Object) Parameters object.p._attotokens
(string) Number of Participation Tokens to purchase, in attotokens, as a hexadecimal string.p.tx
(Object) Object containing details about how this transaction should be made.p.tx.to
(string) Ethereum contract address on which to call this function, as a 20-byte hexadecimal string.p.tx.gas
(string) Gas limit to use when submitting this transaction, as a hexadecimal string.
p.meta
(Meta) <optional> Authentication metadata for raw transactions.p.onSent
(function) Callback function that executes once the transaction has been sent.p.onSuccess
(function) <optional> Callback function that executes if the transaction returned successfully.p.onFailed
(function) <optional> Callback function that executes if the transaction failed.
Returns:
- Return value cannot be obtained because Ethereum nodes discard transaction return values.
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:
p
(Object) Parameters object.p._sender
(string) Ethereum address to send redeemed REP/Ether to, as a 20-byte hexadecimal value.p.tx
(Object) Object containing details about how this transaction should be made.p.tx.to
(string) Ethereum contract address on which to call this function, as a 20-byte hexadecimal string.p.tx.gas
(string) Gas limit to use when submitting this transaction, as a hexadecimal string.
p.meta
(Meta) <optional> Authentication metadata for raw transactions.p.onSent
(function) Callback function that executes once the transaction has been sent.p.onSuccess
(function) <optional> Callback function that executes if the transaction returned successfully.p.onFailed
(function) <optional> Callback function that executes if the transaction failed.
Returns:
- Return value cannot be obtained because Ethereum nodes discard transaction return values.
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:
- Augur is not currently in a halted state.
Parameters:
p
(Object) Parameters object.p.tx
(Object) Object containing details about how this transaction should be made.p.tx.to
(string) Ethereum contract address on which to call this function, as a 20-byte hexadecimal string.p.tx.gas
(string) Gas limit to use when submitting this transaction, as a hexadecimal string.
p.meta
(Meta) <optional> Authentication metadata for raw transactions.p.onSent
(function) Callback function that executes once the transaction has been sent.p.onSuccess
(function) <optional> Callback function that executes if the transaction returned successfully.p.onFailed
(function) <optional> Callback function that executes if the transaction failed.
Returns:
- Return value cannot be obtained because Ethereum nodes discard transaction return values.
Fill Order Tx API
// Fill Order Transaction API Examples:
// The Ethereum address of Augur's default FillOrder contract
// can be obtained by calling `augur.augurNode.getSyncData`.
var fillOrderAddress = "0x0c77f6af7b3b5fed8ca980414a97c62da283098a";
var _orderId = "0xea2c7476e61f5e2625e57df17fcce74741d3c2004ac657675f686a23d06e6091";
var _amountFillerWants = "0x8ac7230489e80000"; // 10.0 shares
var _tradeGroupId = "0x0000000000000000000000000000000000000000000000000000000000000002";
augur.api.FillOrder.publicFillOrder({
_orderId: _orderId,
_amountFillerWants: _amountFillerWants,
_tradeGroupId: _tradeGroupId,
tx: {
to: fillOrderAddress,
value: "0x16345785d8a0000",
gas: "0x632ea0"
},
meta: {
accountType: "privateKey",
address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
},
onSent: function (result) { console.log(result); },
onSuccess: function (result) { console.log(result); },
onFailed: function (result) { console.log(result); }
});
Provides JavaScript bindings for the FillOrder Solidity Contract, which allows for the Filling of Orders on the Order Book.
augur.api.FillOrder.publicFillOrder(p)
Attempts to Fill p._amountFillerWants
Share Units for Order p._orderId
. If p._amountFillerWants
is enough to Fill the Order completely, the Order will be removed from the Order Book. Otherwise, it will be adjusted to only include the remaining amount after Filling the p._amountFillerWants
value that the Filler requests. This transaction will trigger an OrderFilled
event if the Order is Filled without any errors.
This transaction will fail if:
p._orderId
orp._amountFillerWants
isundefined
.msg.sender
of this transaction is the Creator ofp._orderId
.
Parameters:
p
(Object) Parameters object.
p._orderId
(string) Ethereum address of an Order on the Order Book, as a 32-byte hexadecimal value.p._amountFillerWants
(string) Number of Shares to Fill, as a hexadecimal string.p._tradeGroupId
(string) <optional> ID used by the Augur UI to group transactions, as a 32-byte hexadecimal value.p.tx
(Object) Object containing details about how this transaction should be made.p.tx.to
(string) Ethereum contract address on which to call this function, as a 20-byte hexadecimal string.p.tx.value
(string) Number of attoETH required to fill the Order, as a hexadecimal string.p.tx.gas
(string) Gas limit to use when submitting this transaction, as a hexadecimal string.
p.meta
(Meta) <optional> Authentication metadata for raw transactions.p.onSent
(function) Callback function that executes once the transaction has been sent.p.onSuccess
(function) <optional> Callback function that executes if the transaction returned successfully.p.onFailed
(function) <optional> Callback function that executes if the transaction failed.
Returns:
- Return value cannot be obtained because Ethereum nodes discard transaction return values.
Initial Reporter Tx API
// Initial Reporter Transaction API Examples:
// The Ethereum address of a Market's InitialReporter contract
// can be obtained by calling `augur.api.Market.getInitialReporter`.
var initialReporterAddress = "0x0c77f6af7b3b5fed8ca980414a97c62da283098a";
augur.api.InitialReporter.forkAndRedeem({
tx: {
to: initialReporterAddress,
gas: "0x632ea0"
},
meta: {
accountType: "privateKey",
address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
},
onSent: function (result) { console.log(result); },
onSuccess: function (result) { console.log(result); },
onFailed: function (result) { console.log(result); }
});
augur.api.InitialReporter.redeem({
"": initialReporterAddress, // This parameter's key must be the empty string, and its value can be any address-length string.
tx: {
to: initialReporterAddress,
gas: "0x632ea0"
},
meta: {
accountType: "privateKey",
address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
},
onSent: function (result) { console.log(result); },
onSuccess: function (result) { console.log(result); },
onFailed: function (result) { console.log(result); }
});
augur.api.InitialReporter.transferOwnership({
_newOwner: "0x9998ff3e9ce1c0459b309fac6dd4e69229b91777",
tx: {
to: initialReporterAddress,
gas: "0x632ea0"
},
meta: {
accountType: "privateKey",
address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
},
onSent: function (result) { console.log(result); },
onSuccess: function (result) { console.log(result); },
onFailed: function (result) { console.log(result); }
});
augur.api.InitialReporter.withdrawInEmergency({
tx: {
to: initialReporterAddress,
gas: "0x632ea0"
},
meta: {
accountType: "privateKey",
address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
},
onSent: function (result) { console.log(result); },
onSuccess: function (result) { console.log(result); },
onFailed: function (result) { console.log(result); }
});
Provides JavaScript bindings for the InitialReporter Solidity Contract, which enables functionality related to Initial Reports.
augur.api.InitialReporter.forkAndRedeem(p)
Causes a Child Universe to be created for the Outcome of the Initial Report and migrates the REP Staked by the Initial Reporter to the Child Universe. This transaction can be called at any time after the Fork has begun (including after the Market has been Finalized). When called by a user who who submitted the Initial Report, it will also transfer the REP Staked on the Initial Report’s Outcome to the Initial Reporter of the Forked Market.
This transaction will trigger a ReportingParticipantDisavowed event if the InitialReporter was forked without any errors.
This transaction will fail if:
- The InitialReporter does not belong to a Forked Market.
Parameters:
p
(Object) Parameters object.p.tx
(Object) Object containing details about how this transaction should be made.p.tx.to
(string) Ethereum contract address on which to call this function, as a 20-byte hexadecimal string.p.tx.gas
(string) Gas limit to use when submitting this transaction, as a hexadecimal string.
p.meta
(Meta) <optional> Authentication metadata for raw transactions.p.onSent
(function) Callback function that executes once the transaction has been sent.p.onSuccess
(function) <optional> Callback function that executes if the transaction returned successfully.p.onFailed
(function) <optional> Callback function that executes if the transaction failed.
Returns:
- Return value cannot be obtained because Ethereum nodes discard transaction return values.
augur.api.InitialReporter.redeem(p)
Redeems the REP that the Designated Reporter or First Public Reporter Staked on the Outcome of the Initial Report.
This transaction will trigger an InitialReporterRedeemed
event if the REP/Ether was redeemed without any errors.
Parameters:
p
(Object) Parameters object.- **
p[""]
(string) Theredeem
function inInitialReporter.sol
requires an unnamed parameter to be passed in so that it can fulfill an interface. When callingaugur.api.InitialReporter.redeem
, this parameter should be passed using the empty string as the key. Since this function does not actually use this parameter, it’s value can be any address-length string. (Please refer to example code for this function.) p.tx
(Object) Object containing details about how this transaction should be made.p.tx.to
(string) Ethereum contract address on which to call this function, as a 20-byte hexadecimal string.p.tx.gas
(string) Gas limit to use when submitting this transaction, as a hexadecimal string.
p.meta
(Meta) <optional> Authentication metadata for raw transactions.p.onSent
(function) Callback function that executes once the transaction has been sent.p.onSuccess
(function) <optional> Callback function that executes if the transaction returned successfully.p.onFailed
(function) <optional> Callback function that executes if the transaction failed.
- **
Returns:
- Return value cannot be obtained because Ethereum nodes discard transaction return values.
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:
msg.sender
isn’t the owner of the InitialReporter.
This transaction will trigger an InitialReporterTransferred
event if the REP/Ether was transferred without any errors.
Parameters:
p
(Object) Parameters object.p._newOwner
(string) Ethereum address of the desired new owner for the InitialReporter, as a 20-byte hexadecimal value.p.tx
(Object) Object containing details about how this transaction should be made.p.tx.to
(string) Ethereum contract address on which to call this function, as a 20-byte hexadecimal string.p.tx.gas
(string) Gas limit to use when submitting this transaction, as a hexadecimal string.
p.meta
(Meta) <optional> Authentication metadata for raw transactions.p.onSent
(function) Callback function that executes once the transaction has been sent.p.onSuccess
(function) <optional> Callback function that executes if the transaction returned successfully.p.onFailed
(function) <optional> Callback function that executes if the transaction failed.
Returns:
- Return value cannot be obtained because Ethereum nodes discard transaction return values.
augur.api.InitialReporter.withdrawInEmergency(p)
If a critical bug or vulnerability is found in Augur, the Augur development team can put Augur into a halted state until the issue is resolved. In such instances, most regularly-used functions in Augur’s backend will become unuseable until the system is returned to its normal state. When this happens, Initial Reporters can call the withdrawInEmergency
function to withdraw the REP they Staked on the Initial Report Outcome (in cases where the First Public Reporter submitted the Initial Report instead of the Designated Reporter).
This transaction will fail if:
- Augur is not currently in a halted state.
Parameters:
p
(Object) Parameters object.p.tx
(Object) Object containing details about how this transaction should be made.p.tx.to
(string) Ethereum contract address on which to call this function, as a 20-byte hexadecimal string.p.tx.gas
(string) Gas limit to use when submitting this transaction, as a hexadecimal string.
p.meta
(Meta) <optional> Authentication metadata for raw transactions.p.onSent
(function) Callback function that executes once the transaction has been sent.p.onSuccess
(function) <optional> Callback function that executes if the transaction returned successfully.p.onFailed
(function) <optional> Callback function that executes if the transaction failed.
Returns:
- Return value cannot be obtained because Ethereum nodes discard transaction return values.
Mailbox Tx API
// Mailbox Transaction API Examples:
// The Ethereum address of a Market Creator's mailbox can be obtained
// by calling `augur.api.Market.getMarketCreatorMailbox`.
var mailboxAddress = "0x9368ff3e9ce1c0459b309fac6dd4e69229b91a42";
augur.api.Mailbox.transferOwnership({
_newOwner: "0x8fa56abe36d8dc76cf85fecb6a3026733e0a12ac",
tx: {
to: mailboxAddress,
gas: "0x632ea0"
},
meta: {
accountType: "privateKey",
address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
},
onSent: function (result) { console.log(result); },
onSuccess: function (result) { console.log(result); },
onFailed: function (result) { console.log(result); }
});
augur.api.Mailbox.withdrawEther({
tx: {
to: mailboxAddress,
gas: "0x632ea0"
},
meta: {
accountType: "privateKey",
address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
},
onSent: function (result) { console.log(result); },
onSuccess: function (result) { console.log(result); },
onFailed: function (result) { console.log(result); }
});
var _repTokenAddress = "0x9368ff3e9ce1c0459b309fac6dd4e69229b91a42";
augur.api.Mailbox.withdrawTokens({
_token: _repTokenAddress,
tx: {
to: mailboxAddress,
gas: "0x632ea0"
},
meta: {
accountType: "privateKey",
address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
},
onSent: function (result) { console.log(result); },
onSuccess: function (result) { console.log(result); },
onFailed: function (result) { console.log(result); }
});
Provides JavaScript bindings for the Mailbox Solidity Contract, which enables the functionality of the Market Creator Mailbox.
augur.api.Mailbox.transferOwnership(p)
Changes the current owner of Market Creator Mailbox to p._newOwner
. This transaction will trigger a MarketMailboxTransferred
event, which will record the Market Creator Mailbox, the Market & Universe it belongs to, as well as the old owner’s address and the new owner’s address.
This transaction will fail if:
msg.sender
isn’t the owner of the Market Creator Mailbox.
Parameters:
p
(Object) Parameters object.p._newOwner
(string) Ethereum address of the desired new owner of the Mailbox, as a 20-byte hexadecimal value.p.tx
(Object) Object containing details about how this transaction should be made.p.tx.to
(string) Ethereum contract address on which to call this function, as a 20-byte hexadecimal string.p.tx.gas
(string) Gas limit to use when submitting this transaction, as a hexadecimal string.
p.meta
(Meta) <optional> Authentication metadata for raw transactions.p.onSent
(function) Callback function that executes once the transaction has been sent.p.onSuccess
(function) <optional> Callback function that executes if the transaction returned successfully.p.onFailed
(function) <optional> Callback function that executes if the transaction failed.
Returns:
- Return value cannot be obtained because Ethereum nodes discard transaction return values.
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:
msg.sender
isn’t the owner of the specified Mailbox.
Parameters:
p
(Object) Parameters object.p.tx
(Object) Object containing details about how this transaction should be made.p.tx.to
(string) Ethereum contract address on which to call this function, as a 20-byte hexadecimal string.p.tx.gas
(string) Gas limit to use when submitting this transaction, as a hexadecimal string.
p.meta
(Meta) <optional> Authentication metadata for raw transactions.p.onSent
(function) Callback function that executes once the transaction has been sent.p.onSuccess
(function) <optional> Callback function that executes if the transaction returned successfully.p.onFailed
(function) <optional> Callback function that executes if the transaction failed.
Returns:
- Return value cannot be obtained because Ethereum nodes discard transaction return values.
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:
msg.sender
isn’t the owner of the specified Mailbox.
Parameters:
p
(Object) Parameters object.p._token
(string) Ethereum address of an ERC20Basic token contract, as a 20-byte hexadecimal value.p.tx
(Object) Object containing details about how this transaction should be made.p.tx.to
(string) Ethereum contract address on which to call this function, as a 20-byte hexadecimal string.p.tx.gas
(string) Gas limit to use when submitting this transaction, as a hexadecimal string.
p.meta
(Meta) <optional> Authentication metadata for raw transactions.p.onSent
(function) Callback function that executes once the transaction has been sent.p.onSuccess
(function) <optional> Callback function that executes if the transaction returned successfully.p.onFailed
(function) <optional> Callback function that executes if the transaction failed.
Returns:
- Return value cannot be obtained because Ethereum nodes discard transaction return values.
Market Tx API
// Market Transaction API Examples:
var marketAddress = "0x9368ff3e9ce1c0459b309fac6dd4e69229b91a42";
var _payoutNumerators = [ "0x0", "0x2710" ];
var _invalid = false;
var _amount = "0x64";
augur.api.Market.contribute({
_payoutNumerators: _payoutNumerators,
_invalid: _invalid,
_amount: _amount,
tx: {
to: marketAddress,
gas: "0x632ea0"
},
meta: {
accountType: "privateKey",
address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
},
onSent: function (result) { console.log(result); },
onSuccess: function (result) { console.log(result); },
onFailed: function (result) { console.log(result); }
});
augur.api.Market.disavowCrowdsourcers({
tx: {
to: marketAddress,
gas: "0x632ea0"
},
meta: {
accountType: "privateKey",
address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
},
onSent: function (result) { console.log(result); },
onSuccess: function (result) { console.log(result); },
onFailed: function (result) { console.log(result); }
});
augur.api.Market.doInitialReport({
_payoutNumerators: _payoutNumerators,
_invalid: _invalid,
tx: {
to: marketAddress,
gas: "0x632ea0"
},
meta: {
accountType: "privateKey",
address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
},
onSent: function (result) { console.log(result); },
onSuccess: function (result) { console.log(result); },
onFailed: function (result) { console.log(result); }
});
augur.api.Market.finalize({
tx: {
to: marketAddress,
gas: "0x632ea0"
},
meta: {
accountType: "privateKey",
address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
},
onSent: function (result) { console.log(result); },
onSuccess: function (result) { console.log(result); },
onFailed: function (result) { console.log(result); }
});
augur.api.Market.finalizeFork({
tx: {
to: marketAddress,
gas: "0x632ea0"
},
meta: {
accountType: "privateKey",
address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
},
onSent: function (result) { console.log(result); },
onSuccess: function (result) { console.log(result); },
onFailed: function (result) { console.log(result); }
});
augur.api.Market.migrateThroughOneFork({
tx: {
to: marketAddress,
gas: "0x632ea0"
},
meta: {
accountType: "privateKey",
address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
},
onSent: function (result) { console.log(result); },
onSuccess: function (result) { console.log(result); },
onFailed: function (result) { console.log(result); }
});
augur.api.Market.transferOwnership({
_newOwner: "0x8fa56abe36d8dc76cf85fecb6a3026733e0a12ac",
tx: {
to: marketAddress,
gas: "0x632ea0"
},
meta: {
accountType: "privateKey",
address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
},
onSent: function (result) { console.log(result); },
onSuccess: function (result) { console.log(result); },
onFailed: function (result) { console.log(result); }
});
augur.api.Market.withdrawInEmergency({
tx: {
to: marketAddress,
gas: "0x632ea0"
},
meta: {
accountType: "privateKey",
address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
},
onSent: function (result) { console.log(result); },
onSuccess: function (result) { console.log(result); },
onFailed: function (result) { console.log(result); }
});
Provides JavaScript bindings for the Market Solidity Contract, which enables functionality for Augur’s Markets.
augur.api.Market.contribute(p)
Contributes p._amount
REP to the Dispute Crowdsourcer represented by Payout Set p._payoutNumerators
and p._invalid
in order to help Challenge the Market’s Tentative Outcome. If the amount of REP in the Dispute Crowdsourcer plus p._amount
is greater than the total REP required to fill the Dispute Bond, this function will only contribute the remaining amount of REP required to fill the Dispute Bond on behalf of the caller.
This transaction will trigger a DisputeCrowdsourcerContribution
event if it executes without any errors. It will also trigger a DisputeCrowdsourcerCompleted
event if the Dispute Bond is successfullly filled, and it will trigger a UniverseForked
event if enough REP has been Staked in the Dispute Crowdsourcer to cause the Market to Fork.
This function will fail if:
- The Market is in a Fee Window that is not active.
- The Market’s Universe has a Forked Market.
- The Outcome specified by
p._payoutNumerators
andp._invalid
is already the Tentative Outcome of the Market. p._invalid
is true and the Numerators inp._payoutNumerators
are not all the same value. (For information about what the Payout Set should look like for an Invalid Market, refer to the Invalid Outcome glossary entry.)
Parameters:
p
(Object) Parameters object.p._payoutNumerators
(Array.<number>|Array.<string>) Array representing the Market’s Payout Set.p._invalid
(boolean) Whether the Outcome of the Market is Invalid.p._amount
(string) Amount to contribute to the Dispute Crowdsourcer, in attoREP.p.tx
(Object) Object containing details about how this transaction should be made.p.tx.to
(string) Ethereum contract address on which to call this function, as a 20-byte hexadecimal string.p.tx.gas
(string) Gas limit to use when submitting this transaction, as a hexadecimal string.
p.meta
(Meta) <optional> Authentication metadata for raw transactions.p.onSent
(function) Callback function that executes once the transaction has been sent.p.onSuccess
(function) <optional> Callback function that executes if the transaction returned successfully.p.onFailed
(function) <optional> Callback function that executes if the transaction failed.
Returns:
- Return value cannot be obtained because Ethereum nodes discard transaction return values.
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:
- There is not a Forked Market in the Market’s Universe.
- The Market is a Forked Market.
- The Market is Finalized.
Parameters:
p
(Object) Parameters object.p.tx
(Object) Object containing details about how this transaction should be made.p.tx.to
(string) Ethereum contract address on which to call this function, as a 20-byte hexadecimal string.p.tx.gas
(string) Gas limit to use when submitting this transaction, as a hexadecimal string.
p.meta
(Meta) <optional> Authentication metadata for raw transactions.p.onSent
(function) Callback function that executes once the transaction has been sent.p.onSuccess
(function) <optional> Callback function that executes if the transaction returned successfully.p.onFailed
(function) <optional> Callback function that executes if the transaction failed.
Returns:
- Return value cannot be obtained because Ethereum nodes discard transaction return values.
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:
- The Market’s event end time has not passed.
- The caller of the function is not the Designated Reporter and the Designated Reporting Phase has not ended.
p._invalid
is true and the Numerators inp._payoutNumerators
are not all the same value. (For information about what the Payout Set should look like for an Invalid Market, refer to the Invalid Outcome glossary entry.)
Parameters:
p
(Object) Parameters object.p._payoutNumerators
(Array.<number>|Array.<string>) Array representing the Market’s Payout Set.p._invalid
(boolean) Whether the Outcome of the Market is Invalid.p.tx
(Object) Object containing details about how this transaction should be made.p.tx.to
(string) Ethereum contract address on which to call this function, as a 20-byte hexadecimal string.p.tx.gas
(string) Gas limit to use when submitting this transaction, as a hexadecimal string.
p.meta
(Meta) <optional> Authentication metadata for raw transactions.p.onSent
(function) Callback function that executes once the transaction has been sent.p.onSuccess
(function) <optional> Callback function that executes if the transaction returned successfully.p.onFailed
(function) <optional> Callback function that executes if the transaction failed.
Returns:
- Return value cannot be obtained because Ethereum nodes discard transaction return values.
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:
- The Initial Report has not been submitted.
- The Fee Window has not ended.
- The Market is a Forked Market.
Parameters:
p
(Object) Parameters object.p.tx
(Object) Object containing details about how this transaction should be made.p.tx.to
(string) Ethereum contract address on which to call this function, as a 20-byte hexadecimal string.p.tx.gas
(string) Gas limit to use when submitting this transaction, as a hexadecimal string.
p.meta
(Meta) <optional> Authentication metadata for raw transactions.p.onSent
(function) Callback function that executes once the transaction has been sent.p.onSuccess
(function) <optional> Callback function that executes if the transaction returned successfully.p.onFailed
(function) <optional> Callback function that executes if the transaction failed.
Returns:
- Return value cannot be obtained because Ethereum nodes discard transaction return values.
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:
- The Market is not a Forked Market.
- The Fork Threshold has not been reached, and the Fork Period is not over.
Parameters:
p
(Object) Parameters object.p.tx
(Object) Object containing details about how this transaction should be made.p.tx.to
(string) Ethereum contract address on which to call this function, as a 20-byte hexadecimal string.p.tx.gas
(string) Gas limit to use when submitting this transaction, as a hexadecimal string.
p.meta
(Meta) <optional> Authentication metadata for raw transactions.p.onSent
(function) Callback function that executes once the transaction has been sent.p.onSuccess
(function) <optional> Callback function that executes if the transaction returned successfully.p.onFailed
(function) <optional> Callback function that executes if the transaction failed.
Returns:
- Return value cannot be obtained because Ethereum nodes discard transaction return values.
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:
- The Market is Finalized.
- The Forked Market is not Finalized (i.e., the Fork Period is not over, so there is no Winning Universe to migrate to).
Parameters:
p
(Object) Parameters object.p.tx
(Object) Object containing details about how this transaction should be made.p.tx.to
(string) Ethereum contract address on which to call this function, as a 20-byte hexadecimal string.p.tx.gas
(string) Gas limit to use when submitting this transaction, as a hexadecimal string.
p.meta
(Meta) <optional> Authentication metadata for raw transactions.p.onSent
(function) Callback function that executes once the transaction has been sent.p.onSuccess
(function) <optional> Callback function that executes if the transaction returned successfully.p.onFailed
(function) <optional> Callback function that executes if the transaction failed.
Returns:
- Return value cannot be obtained because Ethereum nodes discard transaction return values.
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:
msg.sender
isn’t the owner of the Market.
Parameters:
p
(Object) Parameters object.p._newOwner
(string) Ethereum address of the desired new owner of the Market, as a 20-byte hexadecimal value.p.tx
(Object) Object containing details about how this transaction should be made.p.tx.to
(string) Ethereum contract address on which to call this function, as a 20-byte hexadecimal string.p.tx.gas
(string) Gas limit to use when submitting this transaction, as a hexadecimal string.
p.meta
(Meta) <optional> Authentication metadata for raw transactions.p.onSent
(function) Callback function that executes once the transaction has been sent.p.onSuccess
(function) <optional> Callback function that executes if the transaction returned successfully.p.onFailed
(function) <optional> Callback function that executes if the transaction failed.
Returns:
- Return value cannot be obtained because Ethereum nodes discard transaction return values.
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:
- Augur is not currently in a halted state.
Parameters:
p
(Object) Parameters object.p.tx
(Object) Object containing details about how this transaction should be made.p.tx.to
(string) Ethereum contract address on which to call this function, as a 20-byte hexadecimal string.p.tx.gas
(string) Gas limit to use when submitting this transaction, as a hexadecimal string.
p.meta
(Meta) <optional> Authentication metadata for raw transactions.p.onSent
(function) Callback function that executes once the transaction has been sent.p.onSuccess
(function) <optional> Callback function that executes if the transaction returned successfully.p.onFailed
(function) <optional> Callback function that executes if the transaction failed.
Returns:
- Return value cannot be obtained because Ethereum nodes discard transaction return values.
Reputation Token Tx API
// Reputation Token Transaction API Examples:
// The Ethereum contract address for Augur.sol can be
// obtained by calling `augur.augurNode.getSyncData`.
var _augurContractAddress = "0x67cbf60a24ab922af99e6f335c0ff2b084d5bdbe";
// The Ethereum contract address for a Universe's Reputation Token
// can be obtained by calling `augur.api.Universe.getReputationToken`.
var reputationTokenAddress = "0xd2ee83a8a2a904181ccfddd8292f178614062aa0";
augur.api.ReputationToken.approve({
_spender: _augurContractAddress,
_value: "0xff",
tx: {
to: reputationTokenAddress,
gas: "0x632ea0"
},
meta: {
accountType: "privateKey",
address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
},
onSent: function (result) { console.log(result); },
onSuccess: function (result) { console.log(result); },
onFailed: function (result) { console.log(result); }
});
augur.api.ReputationToken.decreaseApproval({
_spender: _augurContractAddress,
_subtractedValue: "0x3e8",
tx: {
to: reputationTokenAddress,
gas: "0x632ea0"
},
meta: {
accountType: "privateKey",
address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
},
onSent: function (result) { console.log(result); },
onSuccess: function (result) { console.log(result); },
onFailed: function (result) { console.log(result); }
});
augur.api.ReputationToken.increaseApproval({
_spender: _augurContractAddress,
_addedValue: "0x3e8",
tx: {
to: reputationTokenAddress,
gas: "0x632ea0"
},
meta: {
accountType: "privateKey",
address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
},
onSent: function (result) { console.log(result); },
onSuccess: function (result) { console.log(result); },
onFailed: function (result) { console.log(result); }
});
augur.api.ReputationToken.migrateFromLegacyReputationToken({
tx: {
to: reputationTokenAddress,
gas: "0x632ea0"
},
meta: {
accountType: "privateKey",
address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0, 85, 109, 158, 25],
},
onSent: function (result) { console.log(result); },
onSuccess: function (result) { console.log(result); },
onFailed: function (result) { console.log(result); }
});
var _destination = "0x73295d3c0ca46113ca226222c81c79adabf9f391";
augur.api.ReputationToken.migrateOut({
_destination: _destination,
_attotokens: "0xa",
tx: {
to: reputationTokenAddress,
gas: "0x632ea0"
},
meta: {
accountType: "privateKey",
address: "0x913dA4198E6bE1D5f5E4a40D0667f70C0B5430Ec",
signer: [252, 111, 32, 94, 233, 213, 105, 71, 89, 162, 243, 247, 56, 81, 213, 103, 239, 75, 212, 240, 234, 95, 8, 201, 217, 55, 225, 0,