Skip to content
This repository has been archived by the owner on Sep 20, 2023. It is now read-only.

Add approximate price in USD (or EUR) #36

Closed
wanderingstan opened this issue Jan 7, 2018 · 22 comments
Closed

Add approximate price in USD (or EUR) #36

wanderingstan opened this issue Jan 7, 2018 · 22 comments
Assignees
Labels

Comments

@wanderingstan
Copy link
Collaborator

Using this library:
https://www.npmjs.com/package/cryptocompare

@matthewliu matthewliu added good first issue Good for newcomers feature labels Apr 14, 2018
@matthewliu matthewliu added this to Not prioritized in Origin Project Sprints via automation Apr 14, 2018
@inkredabull
Copy link
Contributor

@wanderingstan I'll take this.

@ambertch
Copy link
Contributor

ambertch commented Apr 17, 2018

Would Origin emphasize cryptocurrency or real world currency more to customers at launch? The emphasized currency might be displayed in a more pronounced way, IE:

screenshot 2018-04-16 18 24 25

vs.

screenshot 2018-04-16 18 24 51

(@inkredabull)

@joshfraser
Copy link
Member

Great question. Showing prices in fiat seems way more friendly to me. A few things we need to keep in mind though:

  1. Our community is global, so we need to support a lot more fiat currencies than just USD
  2. We'll need to find free and reliable API's for doing the ETH/Fiat conversion (with a fallback plan if that data is not available for any reason)
  3. Users should be able to set their preferred currency in the DApp. It would be nice to make an intelligent guess from their location & or have whatever currency they choose be cached and remembered in localStorage.

We should always have an ETH price. A fiat equivalent may or may not be available depending on whether we know the users location and the local conversion rate.

@DanielVF
Copy link
Member

Ideally we'd use an on chain oracle to pull the exchange rates. It gives the user more privacy, since they aren't sending requests to a random API owned by someone else.

One example of such an onchain oracle is this one, from the Dai Stablecoin, that averages 13 other ETH/USD oracles

https://makerdao.com/feeds/#0x729d19f657bd0614b4985cf1d82531c67569197b

@joshfraser
Copy link
Member

Agree in principle, although not sure how performant that is going to be.

I could see this ending up as yet another function of your trusted bridge server.

@matthewliu
Copy link
Member

matthewliu commented Apr 17, 2018 via email

@DanielVF
Copy link
Member

It should be very performant - we just check the value once every fifteen minutes or so, and store it locally with an expiration time. It doesn't have to happen on every page load.

@DanielVF
Copy link
Member

I do agree however that this may want to go into the bridge server, since that way if an oracle goes haywire, existing daps aren't stuck with it.

@joshfraser
Copy link
Member

I was imagining far more real-time updates given how volatile crypto can be. Let's plan on 1 minute caching at most.

@matthewliu
Copy link
Member

matthewliu commented Apr 17, 2018 via email

@wanderingstan
Copy link
Collaborator Author

While it would be great to role our own, currency conversion is outside our scope.

There are numerous projects doing this, and Origin Dapp creators are free to use any API/service that they like. Demo-dapp is, after all, just an example.

According to this commit, Metamask is using the Cryptonator API. The commit notes, "Thankfully they don't have limits, so we can ping liberally".

Given that currently most of our users will be finalizing transactions in Metamask, I suggest it makes the most sense for Demo-Dapp to use the same conversion API.

@joshfraser
Copy link
Member

Cryptonator seems like a perfectly reasonable choice for now.

@ambertch
Copy link
Contributor

Should users be able to specify prices in either ETH or USD/etc? Having that feature would allow a user to peg their listing (otherwise, if a user had a listing on both Craigslist and Origin for instance, they'd have to adjust the Origin listing to track exchange rates)

@wanderingstan
Copy link
Collaborator Author

wanderingstan commented Apr 17, 2018

@ambertch - For now the listing price will remain constant (in ETH) and we'll just worry about displaying it also in the user's buyer's desired currency.

Giving the seller the option to price a listing in fiat (and have the eth/crypto price dynamically updated) is very cool and something we've discussed, but is not in scope for v1.

@inkredabull
Copy link
Contributor

inkredabull commented Apr 18, 2018

Taking a test-first approach but hung up on some local system issues around Watchman/getting tests running. Here is my initial idea: something functional that would take a 3-letter fiat.

@inkredabull
Copy link
Contributor

Making progress.

Limiting factor in my implementation is currently with nock; see commit msg

@inkredabull
Copy link
Contributor

RFC : #118

@inkredabull inkredabull self-assigned this Apr 23, 2018
@micahalcorn micahalcorn moved this from Backlog to In progress 4/18/18-5/1/18 in Origin Project Sprints Apr 26, 2018
@inkredabull
Copy link
Contributor

#118

@inkredabull
Copy link
Contributor

Ref : #130

@inkredabull
Copy link
Contributor

Sorry for the hold-up on this; I've attempted to hold myself to a TDD standard but given an infra issue this still is not ready.

I'm going to be fairly preoccupied next week (between work and Google I/O) so I'll look to do a PR with just the code change (and commented-out test) latest in two weeks.

@gaboesquivel
Copy link

related to #185

This was referenced May 16, 2018
joshfraser pushed a commit that referenced this issue May 18, 2018
* add approx price

* Alternate price display on the same line, two decimal places

* Nitpick: use space after `if`

Following convention of space after `if`, as it's not a function.

* Another layout for alternate price.

* Price layout, post Aure fixing up
@micahalcorn
Copy link
Member

Done via #188

Origin Project Sprints automation moved this from 🕵️In progress 5/16/18-5/29/18 to 🕵️Done 5/2/18-5/15/18 May 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
Origin Project Sprints
  
🕵️Done 5/2/18-5/15/18
Development

No branches or pull requests

8 participants