Skip to content

Commit

Permalink
Merge pull request #13 from smartcontractkit/170222529-create-friendl…
Browse files Browse the repository at this point in the history
…y-urls-in-aggregator-ui

Create friendly urls in aggregator ui
  • Loading branch information
hellobart authored and rupurt committed Jan 31, 2020
1 parent 2c270f9 commit b386871
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 57 deletions.
20 changes: 18 additions & 2 deletions feeds-ui/src/enhancers/withMainnet.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,55 +16,72 @@ const MAINNET_CONTRACTS = [
valuePrefix: '$',
answerName: 'AUD',
counter: 3600,
path: 'aud-usd',
},
{
contractAddress: '0xa18e0bf319a1316984c9fc9aba850e2a915cce0e',
name: 'EUR / USD aggregation',
valuePrefix: '$',
answerName: 'EUR',
counter: 3600,
path: 'eur-usd',
},
{
contractAddress: '0xb405aa39dca6ecf18691cd638a98c090c477dcf9',
name: 'CHF / USD aggregation',
valuePrefix: '$',
answerName: 'CHF',
counter: 3600,
path: 'chf-usd',
},
{
contractAddress: '0xf277717f64815b17aa687cce701fa154185db4d9',
name: 'GBP / USD aggregation',
valuePrefix: '$',
answerName: 'GBP',
counter: 3600,
path: 'gbp-usd',
},
{
contractAddress: '0x8C4a5746d70C1aCeD6c3feB0915f59e3faBb18c3',
name: 'JPY / USD aggregation',
valuePrefix: '$',
answerName: 'JPY',
counter: 3600,
path: 'jpy-usd',
},
{
contractAddress: '0xe1ec292422194cfa6bb6089566af3019803b1af2',
name: 'XAG / USD aggregation',
valuePrefix: '$',
answerName: 'XAG',
counter: 3600,
path: 'xag-usd',
},
{
contractAddress: '0x121df6cfe2426e6c9ae1b273f2e38d0c362c03fa',
name: 'XAU / USD aggregation',
valuePrefix: '$',
answerName: 'XAU',
counter: 3600,
path: 'xau-usd',
},
{
contractAddress: '0xF5fff180082d6017036B771bA883025c654BC935',
name: 'BTC / USD aggregation',
valuePrefix: '$',
answerName: 'BTC',
counter: 600,
path: 'btc-usd',
},
{
contractVersion: 1,
contractAddress: '0x79fEbF6B9F76853EDBcBc913e6aAE8232cFB9De9',
name: 'ETH / USD aggregation',
valuePrefix: '$',
answerName: 'ETH',
counter: 600,
path: 'eth-usd',
},
]

Expand All @@ -75,8 +92,7 @@ const withMainnet = BaseComponent => {
const Mainnet = props => {
const { params } = props.match
const hasContract = MAINNET_CONTRACTS.filter(
contract =>
contract.contractAddress.toLowerCase() === params.address.toLowerCase(),
contract => contract.path.toLowerCase() === params.pair.toLowerCase(),
)

if (!hasContract.length) {
Expand Down
17 changes: 15 additions & 2 deletions feeds-ui/src/enhancers/withRopsten.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,23 @@ const ROPSTEN_CONTRACTS = [
valuePrefix: '$',
answerName: 'BNB',
counter: 1800,
path: 'bnb-usd',
},
{
contractAddress: '0x1c44616CdB7FAe1ba69004ce6010248147CE019e',
name: 'BTC / USD aggregation',
valuePrefix: '$',
answerName: 'BTC',
counter: 3600,
path: 'btc-usd',
},
{
contractAddress: '0x46aD082e62D86089b7365320081685115F50d8B3',
name: 'SNX / USD aggregation',
valuePrefix: '$',
answerName: 'SNX',
counter: 1800,
path: 'snx-usd',
},
{
contractVersion: 2,
Expand All @@ -37,12 +40,14 @@ const ROPSTEN_CONTRACTS = [
valuePrefix: '$',
answerName: 'XTZ',
counter: 1800,
path: 'xtz-usd',
},
{
contractAddress: '0x0Be00A19538Fac4BE07AC360C69378B870c412BF',
name: 'ETH / USD aggregation',
valuePrefix: '$',
answerName: 'ETH',
path: 'eth-usd',
},
{
contractVersion: 2,
Expand All @@ -51,6 +56,7 @@ const ROPSTEN_CONTRACTS = [
valuePrefix: '$',
answerName: 'MKR',
counter: 1800,
path: 'mkr-usd',
},
{
contractVersion: 2,
Expand All @@ -59,6 +65,7 @@ const ROPSTEN_CONTRACTS = [
valuePrefix: '$',
answerName: 'TRX',
counter: 1800,
path: 'trx-usd',
},
{
contractVersion: 2,
Expand All @@ -67,6 +74,7 @@ const ROPSTEN_CONTRACTS = [
valuePrefix: '$',
answerName: 'AUD',
counter: 3600,
path: 'aud-usd',
},
{
contractVersion: 2,
Expand All @@ -75,6 +83,7 @@ const ROPSTEN_CONTRACTS = [
valuePrefix: '$',
answerName: 'XAG',
counter: 3600,
path: 'xag-usd',
},
{
contractVersion: 2,
Expand All @@ -83,6 +92,7 @@ const ROPSTEN_CONTRACTS = [
valuePrefix: '$',
answerName: 'CHF',
counter: 3600,
path: 'chf-usd',
},
{
contractVersion: 2,
Expand All @@ -91,6 +101,7 @@ const ROPSTEN_CONTRACTS = [
valuePrefix: '$',
answerName: 'GBP',
counter: 3600,
path: 'gbp-usd',
},
{
contractVersion: 2,
Expand All @@ -99,6 +110,7 @@ const ROPSTEN_CONTRACTS = [
valuePrefix: '$',
answerName: 'XAU',
counter: 3600,
path: 'xau-usd',
},
{
contractVersion: 2,
Expand All @@ -107,6 +119,7 @@ const ROPSTEN_CONTRACTS = [
valuePrefix: '$',
answerName: 'EUR',
counter: 3600,
path: 'eur-usd',
},
{
contractVersion: 2,
Expand All @@ -115,6 +128,7 @@ const ROPSTEN_CONTRACTS = [
valuePrefix: '$',
answerName: 'JPY',
counter: 3600,
path: 'jpy-usd',
},
]

Expand All @@ -125,8 +139,7 @@ const withRopsten = BaseComponent => {
const Ropsten = props => {
const { params } = props.match
const hasContract = ROPSTEN_CONTRACTS.filter(
contract =>
contract.contractAddress.toLowerCase() === params.address.toLowerCase(),
contract => contract.path.toLowerCase() === params.pair.toLowerCase(),
)

if (!hasContract.length) {
Expand Down
45 changes: 0 additions & 45 deletions feeds-ui/src/pages/Testnet.js

This file was deleted.

16 changes: 8 additions & 8 deletions feeds-ui/src/pages/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import React from 'react'
import { Route, BrowserRouter } from 'react-router-dom'
import { Route, BrowserRouter, Switch } from 'react-router-dom'
import { Header } from 'components/header'

import EthUsdPage from './EthUsdPage'
import Testnet from './Testnet'
import CreatePage from './Create'
import CustomPage from './Custom'
import RopstenPage from './Ropsten'
Expand All @@ -13,12 +12,13 @@ const AppRoutes = () => {
return (
<BrowserRouter>
<Header />
<Route exact path="/" component={EthUsdPage} />
<Route exact path="/testnet" component={Testnet} />
<Route exact path="/create" component={CreatePage} />
<Route exact path="/custom" component={CustomPage} />
<Route path="/ropsten/:address" component={RopstenPage} />
<Route path="/mainnet/:address" component={MainnetPage} />
<Switch>
<Route exact path="/" component={EthUsdPage} />
<Route exact path="/create" component={CreatePage} />
<Route exact path="/custom" component={CustomPage} />
<Route path="/ropsten/:pair" component={RopstenPage} />
<Route path="/:pair" component={MainnetPage} />
</Switch>
</BrowserRouter>
)
}
Expand Down

0 comments on commit b386871

Please sign in to comment.