Coder Social home page Coder Social logo

augurproject / augur-ui Goto Github PK

View Code? Open in Web Editor NEW
400.0 77.0 100.0 69.52 MB

Augur UI

Home Page: https://dev.augur.net

License: MIT License

JavaScript 82.06% CSS 12.53% HTML 0.22% Shell 0.21% TypeScript 4.94% Dockerfile 0.04%
ethereum react redux ui webpack webpack3 css-modules bem

augur-ui's People

Contributors

adrake33 avatar andrewdamelio avatar antazoey avatar bthaile avatar carver avatar epheph avatar joeykrug avatar johnallen avatar johndanz avatar justinbarry avatar kennsippell avatar kevinday avatar niran avatar nuevoalex avatar ogexoticsweb avatar paullinator avatar petong avatar pgebheim avatar phoebemirman avatar priecint avatar ryanberckmans avatar scottzer0 avatar sharkcrayon avatar smallfx avatar stephensprinkle avatar stephensprinkle-zz avatar swansontec avatar thinkloop avatar tinybike avatar tomkysar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

augur-ui's Issues

Allow users to "slash rep" to report colluding

From #23:

If someone tries to collude during the first half, and you can provide their salt and report and address to the network, you get their rep (because they are a cheater)!
Send a transaction to def slashRep(branch, votePeriod, salt, report:arr, reporter) to do this.

Refreshable market displays

Is it possible to make it so you can refresh the market pages? Right now it gives an error when you try to do this. (I noticed that the markets are identified by some kind of hash, but it doesn't appear to be the market ID -- my suggestion is to just make the identifier in the URL just be the market ID.)

Buy/Sell Shares Simulated Buy/sell not working

Uncaught TypeError: this.state.simulation.cost.toFixed is not a function

occurs upon an attempt to buy / sell shares

So getSimulatedBuy and getSimulatedSell were revamped: they return [cost, price] --- price being the new price for that outcome if you bought, and cost being how much money you will get paid if you sell, or how much money you will have to pay if you buy.

New markets are empty pages until refresh

When I create a market, wait for the "market successfully added" to appear in the console, then immediately click on the market when the pending label is removed, it takes me to a blank page. (The sidebar and navbar are still there, but nothing in the main panel.) Refreshing the page fixes this and I can visit the market normally.

Implement account details and assets pagetype

There should exist a page that displays all the users account details and assets. These would include but not limited to:

  • all accounts attached to the ethereum client, highlighting the primary and one used for augur
  • balances (cash, reputation)
  • outstanding shares/outcomes in markets
  • markets authored
  • recent transactions with link to transactions browser filtered for account

Ballot component

From https://github.com/AugurProject/augur-client/wiki/Specification:

Ballots show, at a glance, all the events a reporter needs to vote on. It shows the most useful information for reporters (particularly the highest priced outcome), and should link to the market detail page for the given event. Reporters indicate their vote for each event, then click a "cast ballot" button. The client generates a salted hash of the ballot, stores the ballot and salt locally, and broadcasts the hash to the network. The user is informed that they still need to run the client again to finish casting their ballot between the appropriate deadlines.

If a quorum has been reached and the reporting period is over, the client automatically broadcasts the users ballot and salt. When there's a use case for making that process manual, we'll add a way to disable automatic ballot broadcasting.

Voting deadlines are always clearly displayed. Reporters have half a period to submit their ballot hash. The ballot and salt must be submitted between half a period and two periods after the given voting period has ended.

Holdings component

From https://github.com/AugurProject/augur-client/wiki/Specification:

The holdings page displays a list of event outcomes with the number of outcome tokens held, their current price, and the current total value of the user's holdings of a given outcome. It also displays the total value of all held event outcomes. Each outcome links to its corresponding event detail page, where the user can buy and sell shares.

Users can send reputation to other accounts from the holdings page.

The Overview page

We need a welcoming and useful home page instead of the default markets view. This might have such things are some intro text, invitation to a tour, featured/trending markets, etc.

New market modal

The creation of markets is core to this app and the current modal is barely a placeholder. This modal should implement the following data collection and flow:

  • prompt for text/query with hints and guidance for well-formedness
  • market fee and explanation of what that is
  • setting initial liquidity
  • number of outcomes with types (true/false, arbitrary labels, decimal/integer range, etc.)

This modal should be a gem of the application and can even be multi-paged. It also can be slightly more heavy and rich because it doesn't suffer from any on-boarding syndrome.

Authors are motivated. Let's help them and make the experience fun and exiting!

Clean up stores

We made too many separate stores in the first pass. We should catalog the sets of stores that components listen to, and combine the stores that are always listened to together. Beyond that criteria, there's probably some simplicity to be gained in combining more of them.

Make getMarkets async

The async getMarkets should scale better, and will provide a good example of async the React/Flux way.

Ballot for the last period should always be the ballot we manipulate

Currently, we use the branch's current vote period value from the contract to determine which period's ballot to display, but you can never vote on any period except for branch (currentPeriod - 1). votePeriod is really only useful for determining whether to call dispatch.

Implement RESTful document data-store

It's clear that augur will need an alternative, CENTRALIZED data store for some of the data on market and possibly comments, etc. This would be an interim solution until decentralized solution mature. This would also be a way to reduce gas costs while augur grows up.

I'm recommending MongoDB, because it fits the bill, is very mature, fast and i'm familiar with it.

The store should accept a doc type and hash id as query and return any meta data seemed fit to supplement on-chain data.

account
(much of this will also be stored in the ethereum client's db and check there first)

  • list of contacts and associated address
  • profile data (blob of avatar, handle, name, etc.)

market

  • longer description of the market detailsing specific rules etc.
  • image blob

event

  • price history of each outcome (time stamp, price, ?)

Shares not staying bought when buying shares (although it spends my money)

Basically, I can buy shares in a market, the transaction is definitely completing (checking log) and going through because my cash balance decreases, but the UI doesn't continue to say that I hold shares after a refresh.

I buy, tx happens, UI says I own shares, I refresh, UI doesn't say I own any shares nor does the account modal.

getMarkets is slow

I'm guessing the sequential RPC calls are holding us up. Potential solutions:

  • Find a way to batch RPC calls.
  • Return some sort of stream so each market can be added to the UI as its calls finish.

Use a TransactionStore for managing transaction state

We currently rely on Augur.js callbacks to determine the state of transactions we send. That works, but I think it'll be easier to reason about our program if we make transactions part of our application state instead of using callbacks directly to modify other application state. It'll also make it easier to show users what they're spending on transaction costs.

Each time we send a transaction, we'll pass on onSent callback that adds the transaction hash to the store along with the transaction type (e.g. the augur.js method name) and arbitrary metadata to store for display purposes, like the name of the market that's being created. We'll add a call to NetworkActions.onNewBlock to update the TransactionStore with the current status (pending, success, failure) of each transaction. Transactions that failed or succeeded will be updated with their transaction costs.

Components that depend on a particular transaction succeeding can watch the TransactionStore and use the state of the transaction there to determine what to display. A new market, for instance, would have two pending transactions. Each time we load markets, we'd check the TransactionStore for pending addMarket and addEvent transactions, and use the metadata to display a pending market in the UI. Once the transactions get updated with a non-pending status, the code will ignore those transactions and just display whatever markets have successfully been stored on-chain.

Market detail component

img_20150426_003523

Sell buttons only show up if you own shares of that outcome. For elements that require Augur's web service (#6), we should just put in placeholders for now.

Buy/Sell take you to a trade screen with that keeps the same image/description header.

Purchase Shares

Yes

57%

_____ shares (X cash)

[ Buy ]

If the outcome of this question is Yes, your shares could
approach their maximum worth of Y cash.

Clicking "buy" pops up a confirmation modal.

Will Hillary Clinton win the 2016 U.S. Presidential Election?

Click confirm to purchase X shares of the **Yes** outcome for Y cash.

[ Cancel ] [ Confirm ]

Thoughts on this sketch?

DOM error when creating a market

Uncaught Error: Invariant Violation: Component (with keys: getDOMNode,_handleChange,props,context,state,refs,_reactInternalInstance) contains render method but is not mounted in the DOMinvariant @ augur.js:96509findDOMNode @ augur.js:95504ReactBrowserComponentMixin.getDOMNode @ augur.js:82198ReactClass.createClass.componentDidUpdate @ augur.js:86229assign.notifyAll @ augur.js:78723ON_DOM_READY_QUEUEING.close @ augur.js:91892Mixin.closeAll @ augur.js:94775Mixin.perform @ augur.js:94716Mixin.perform @ augur.js:94702assign.perform @ augur.js:92914flushBatchedUpdates @ augur.js:92994wrapper @ augur.js:91321Mixin.closeAll @ augur.js:94775Mixin.perform @ augur.js:94716ReactDefaultBatchingStrategy.batchedUpdates @ augur.js:87074batchedUpdates @ augur.js:92929ReactEventListener.dispatchEvent @ augur.js:88836

Closing a market

So as a market creator (or anyone involved) I want to be able to close markets:

make this call tradingPeriod = MARKETS.getTradingPeriod(market)

Then check in js if(BRANCHES.getVotePeriod(branch) > tradingPeriod)

Using both those calls if you get 1/true then a market is able to be closed.

To close the market call def closeMarket(branch, market)

Fractional share buy/sell

The back-end (and augur.js) support buying/selling fractional shares (e.g., 2.512 shares), so adding this as a feature request for the client.

Period info for ballot page

The ballot page should have some more info about the period. My suggestion:

  • Say something like Current period: {currentPeriod}
    and then below it have Reporting on: {currentPeriod - 1}

Period in reporting screen too high

If the period on the ballots component says 1293, we're actually voting on 1292.

For instance if it's period 101 right now as defined by block.num/periodLength then we should be voting on things in period 100, which is prob. what the ballots screen should show IMO.

Implement proof-of-concept whisper commenting for markets

It would be ideal to leverage the shh (whisper) protocol for persistent market commenting. The channel and tagging looks promising for associating them to market ids, but It's unclear to me if the messages remain on the blockchain and are persistent.

Let's explore this and see what we can come up with.

Reporting

So for reporting... to get a list of events happening in the current report period call
def makeBallot(branch, votePeriod) in expiring events --- votePeriod is (block.number/periodLength) - 1 This is a list of all events you need to report on in order.

Now make a report --- basically an array of values.
So for no no yes no yes indeterminate your array should look like:
[2**64, 2**64, 2*2**64, 2**64, 2*2**64, (3*2**64)/2]

Get (block.number/periodLength) - 1 via a call, go to makeReports and call
def checkReportValidity(branch, report:arr, votePeriod) with that vote period. Make sure to save the report securely client side.

Now call
def hashReport(report: arr, salt) using a random salt generated with some nice entropy.

You now have a report hash.

Submit this to the network with
def submitReportHash(branch, reportHash, votePeriod) using a live sendTransaction

Note: for the first half of the voting period (so the first 4 weeks you can submit this hash (and update it if you like).

Now during the second half of the vote period (the last 4 weeks) you can submit your real report

Send a transaction to def report(branch, report:arr, votePeriod, salt) and you'll have submitted a report.

As soon as a period changes (e.g. block.number/periodLength increases by 1, it's time to vote on (block.number/periodLength) - 1 again). Remember first half is hash, second is the plaintext report.

Now for something fun:
If someone tries to collude during the first half, and you can provide their salt and report and address to the network, you get their rep (because they are a cheater)!
Send a transaction to def slashRep(branch, votePeriod, salt, report:arr, reporter) to do this.

Dispatch Calling Over & Over

Dispatch is caught up and it just keeps spamming dispatch tx spending all my ether regardless of it already being caught up.

Let people know the average price they bought in at

I think an additional piece of data would be useful in the holdings modal. When you buy/sell shares, basically take the amount your cash decreased/increased by and divide by number of shares you bought/sold and that gives you the average price per share you bought/sold at. Would be useful to have this stored in the holdings modal.

Cash Bug

Seems you're not dividing by 2^64 I'd guess
screen shot 2015-05-18 at 7 03 13 pm

Markets & Accounts Page Update

After a market has matured and the event's outcome has been decided, remove the market from the markets/branch page.

Then, on the account holding page, show the user how much profit/loss they made on that market after it's closed. Once it has been closed (meaning the user has been paid out if they won) allow the user to click an x or something to remove that market from their holdings page.

Doing consensus

So people will need to be able to call consensus (it has to be called multiple times to do a full round - it has many calls). So basically call def checkQuorum(branch) from the checkQuorum contract, if that returns 1/true then consensus is ready to be called.

Anyone can call consensus.

Call def dispatch(branchNumber) multiple times until eventually it returns 9 which means that that round of consensus is complete.

implement insufficient ether user messaging

this may take several forms (modal, form validation, etc.) but for the alpha, we should have some basic user messaging for actions that require ether (add market, sending assets, buy/sell shares, etc.)

a modal could also have help text for mining or requesting it.

Feature request: auto-refresh and progress bar for addMarket

Since adding a market takes ~24 seconds or so in all, I think it would be great if there was a progress bar (or some other visual indicator). Maybe you could have a checklist appear somewhere (sidebar or something?) and visually check off:

  • event submitted
  • event accepted
  • market submitted
  • market accepted

But, maybe this would emphasize the difference between events/markets too much? I dunno, just a progress bar that jumped to 25%, 50%, 75%, 100% on the 4 steps listed above would be pretty cool.

Also, suggest making the markets display auto-refresh once the market is accepted -- maybe put that in the onSuccess callback in EthereumClient.addMarket?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.