Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update prod with beta branch #252

Merged
merged 129 commits into from
Aug 20, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
129 commits
Select commit Hold shift + click to select a range
8484e92
start lp pages
ianlapham Jun 19, 2020
5b39168
update styles start historical
ianlapham Jun 22, 2020
6eeabe1
stash changes
ianlapham Jun 30, 2020
0e5aece
refactor to new subgraph, add search to main page
ianlapham Jul 2, 2020
d6285a5
add logs to global data
ianlapham Jul 2, 2020
3a5de6f
fetch latest from v2
ianlapham Jul 2, 2020
5aeca6f
add dynamic numbers on chart
ianlapham Jul 2, 2020
97d70e0
Time travel testing
Jul 3, 2020
1d54ad2
update chart to filter in ASC order
ianlapham Jul 7, 2020
c9f415f
grab Calebs work on returns and fix conflict
ianlapham Jul 13, 2020
819174c
start user returns
ianlapham Jul 13, 2020
5975276
add first pass at return values
ianlapham Jul 14, 2020
d066eba
add global aggregations
ianlapham Jul 14, 2020
594e443
hard code stablecoins and WETH before launch timestamp
ianlapham Jul 14, 2020
00a5b5d
update returns
ianlapham Jul 14, 2020
4b74490
update return logic, fix chart history logic
ianlapham Jul 15, 2020
76eda40
add cost basis
ianlapham Jul 15, 2020
897a978
update nav and lp UI
ianlapham Jul 16, 2020
c49ce60
expand lp page width max
ianlapham Jul 16, 2020
219b7b2
update chart width
ianlapham Jul 16, 2020
dcc11e2
add roi charts per pair
ianlapham Jul 17, 2020
b8baf6f
add back animation
ianlapham Jul 17, 2020
ed6e5dc
add start of historical dynamic totals
ianlapham Jul 17, 2020
030da4b
update with new headings and amounts
ianlapham Jul 22, 2020
8bc69ba
cleanup code, update cost basis, update edge cases
ianlapham Jul 23, 2020
c0acd2d
update returns setup
ianlapham Jul 23, 2020
c14e812
update edge case for bad timestamps
ianlapham Jul 23, 2020
67cc499
merge with latest
ianlapham Jul 23, 2020
3f19563
Begin new styles (Hompage)
callil Jul 23, 2020
162e75a
Merge branch 'lp-pages' of https://github.com/ianlapham/uniswap-info …
callil Jul 23, 2020
f07dd60
fix broken imports
callil Jul 23, 2020
f7474ed
stash version with multiple metrics before consolidation
ianlapham Jul 24, 2020
55e056b
Merge branch 'lp-pages' of https://github.com/ianlapham/uniswap-info …
ianlapham Jul 24, 2020
97ee1a3
Add more styles - fix list UI
callil Jul 24, 2020
3f4bf6a
Merge branch 'lp-pages' of https://github.com/ianlapham/uniswap-info …
ianlapham Jul 24, 2020
5684ce7
fetch main page refactor and stash version with all metrics
ianlapham Jul 24, 2020
25daf69
Density tweaks
callil Jul 24, 2020
69067f8
update dropdown and returns chart for individual positions
ianlapham Jul 24, 2020
49ab25b
add pinned info, fix some widths, links, small stuff
ianlapham Jul 25, 2020
476114e
fix merge
ianlapham Jul 25, 2020
1620579
start tarding view charts
ianlapham Jul 26, 2020
2a33ab9
make responsive on mobile
ianlapham Jul 28, 2020
eef122e
make rows not clickable for pairs and tokens
ianlapham Jul 28, 2020
5650082
add 24h fees, remove logs
ianlapham Jul 28, 2020
1095435
start alt styles on lp pages
ianlapham Jul 28, 2020
e34ede2
styling tweaks and scrolling stuff
callil Jul 28, 2020
bb3e521
dark top bar
callil Jul 28, 2020
db0d61a
Adjust sidenav
callil Jul 28, 2020
1518cd0
update empty state for lp page
ianlapham Jul 29, 2020
5887465
nav refactor, mobile updates, global chart updates
ianlapham Jul 29, 2020
9f958de
update nav styles, add candlestick price charts
ianlapham Jul 30, 2020
4cfe905
fix padding on menu
ianlapham Jul 30, 2020
8006ed9
update default view for tokens
ianlapham Jul 30, 2020
64a4858
fix widths on right nav
ianlapham Jul 30, 2020
5aa7b3f
update mobile styling
ianlapham Jul 30, 2020
cfd05d3
slight style re-work
callil Jul 30, 2020
fd6108e
Merge branch 'alt-styles' of https://github.com/ianlapham/uniswap-inf…
callil Jul 30, 2020
769ca7c
Fix missing logo
callil Jul 30, 2020
9f90883
small tweaks - undo chart change
callil Jul 30, 2020
2248a6f
update header, mobile styles on token page, laucnh button
ianlapham Jul 30, 2020
d11dd32
pull latest
ianlapham Jul 30, 2020
6ce56f8
add pair pricing
ianlapham Jul 31, 2020
acc6c28
fix padding on pages
ianlapham Jul 31, 2020
a49aa87
update price options
ianlapham Jul 31, 2020
7fac804
add line chart, make chart thinner
ianlapham Jul 31, 2020
a10ff4f
switych order
ianlapham Jul 31, 2020
39cbda9
reset sizing on window changes price charts
ianlapham Aug 2, 2020
3aeb35f
update global chart, minor speed improvements on token chart loading
ianlapham Aug 3, 2020
91af66a
remove tooltips
ianlapham Aug 3, 2020
51da7c3
remove unused imports
ianlapham Aug 3, 2020
5c9520c
add resize icon
ianlapham Aug 3, 2020
dc78a18
update prices
ianlapham Aug 3, 2020
809d29a
perf updates, icon switch on charts
ianlapham Aug 4, 2020
04d462b
add account page back
ianlapham Aug 4, 2020
614d00f
update fee calculation
ianlapham Aug 4, 2020
159eb77
update chart for 0 val
ianlapham Aug 4, 2020
63a3274
add more lookups for accounts
ianlapham Aug 4, 2020
0ae2bff
update principal calculaton
ianlapham Aug 4, 2020
7968fb1
catch edge case with $0 token price in fee calculation
ianlapham Aug 4, 2020
2f7b6e6
update copy on lookup page
ianlapham Aug 4, 2020
afc9b07
update with new endpoint
ianlapham Aug 4, 2020
907872d
update historic charts
ianlapham Aug 5, 2020
e6ecbcf
update charts, add other subgraph while new one syncs for token liqui…
ianlapham Aug 5, 2020
12834a8
update global metrics to include looped lookup of liquidity snapshots
ianlapham Aug 5, 2020
da9f8bb
add account type
ianlapham Aug 6, 2020
83f80a2
update token data check merge with latest
ianlapham Aug 6, 2020
5cb69ab
move library to application context, move fetch on type to initial lp…
ianlapham Aug 6, 2020
ba16472
add 2 charts on fee pages
ianlapham Aug 6, 2020
570fa20
remove type
ianlapham Aug 6, 2020
c3a105c
update labels
ianlapham Aug 6, 2020
3862f0e
update labels
ianlapham Aug 6, 2020
8d4bf3e
update comments
ianlapham Aug 6, 2020
d43d784
update chart histories, remove label on global chart
ianlapham Aug 7, 2020
a9b53bd
update chart histories, remove label on global chart (#251)
ianlapham Aug 7, 2020
b94ac04
update charts on account page to be combined
ianlapham Aug 12, 2020
3b19a6f
update styling for long symbols and names
ianlapham Aug 13, 2020
2f10473
Add base of new information architecture
callil Aug 13, 2020
f36b43c
flat sidebar
callil Aug 13, 2020
1227bca
Merge branch 'beta' into alt-styles-2
callil Aug 13, 2020
4c0a1f8
New find account page design and tweaks
callil Aug 14, 2020
9151582
Finish account page - clean unused
callil Aug 14, 2020
7063fc4
adjust routes
callil Aug 14, 2020
300e2a6
fix add/remove buttons on LP page
callil Aug 14, 2020
1793e89
Mobile nav
callil Aug 14, 2020
de57f07
tweak spacing
callil Aug 14, 2020
718d0f8
Merge pull request #2 from ianlapham/alt-styles-2
ianlapham Aug 14, 2020
65e1d3e
data refactor, percent changes, search updates
ianlapham Aug 14, 2020
e708455
Merge branch 'beta' of https://github.com/ianlapham/uniswap-info into…
ianlapham Aug 14, 2020
406197d
update user chart, refresh button, fix untracked data
ianlapham Aug 14, 2020
2e4a949
fix merge
ianlapham Aug 15, 2020
0fdc89b
fix unused vars and duplicate functions
ianlapham Aug 16, 2020
32e2dc1
update queries with skips for global data
ianlapham Aug 17, 2020
bdc3163
update chart axis for tokens
ianlapham Aug 17, 2020
ae4dff4
Mobile fix and style tweaks
callil Aug 17, 2020
6d86b57
start width update
ianlapham Aug 17, 2020
ec85478
Merge branch 'beta' of https://github.com/ianlapham/uniswap-info into…
ianlapham Aug 17, 2020
1d5bf6e
Change chart button
callil Aug 18, 2020
1a5a849
add APY, fix bugs, add weekly chunks to global volume
ianlapham Aug 18, 2020
890fd6d
update styles
ianlapham Aug 18, 2020
4d60270
update icon in cancle charts for fast forward
ianlapham Aug 18, 2020
3537e5e
resolve conflicts with v2 branch
ianlapham Aug 18, 2020
a355c05
update queries for monthly lookups
ianlapham Aug 18, 2020
2a2ca37
fix lookups on token page
ianlapham Aug 18, 2020
d43566b
small chart tweaks
callil Aug 19, 2020
b9aa1d5
update bars and fix bugs
ianlapham Aug 19, 2020
798f331
Merge branch 'beta' of https://github.com/ianlapham/uniswap-info into…
ianlapham Aug 19, 2020
d6ba973
change z index for buttons
ianlapham Aug 19, 2020
d876dbf
updated token blacklist
ianlapham Aug 19, 2020
2bc98ef
updated mobile styles
ianlapham Aug 19, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
update queries for monthly lookups
  • Loading branch information
ianlapham committed Aug 18, 2020
commit a355c058850373b6b26f6f4a4f1fd7f7af3fdbae
12 changes: 0 additions & 12 deletions src/apollo/queries.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,6 @@ export const GET_BLOCK = gql`
}
`

export const GET_BLOCKS_SKIPPED = (timestamps, skip, end) => {
let queryString = 'query blocks {'
queryString += timestamps.slice(skip, end).map(timestamp => {
return `t${timestamp}:blocks(first: 1, orderBy: timestamp, orderDirection: desc, where: { timestamp_gt: ${timestamp}, timestamp_lt: ${timestamp +
600} }) {
number
}`
})
queryString += '}'
return gql(queryString)
}

export const GET_BLOCKS = timestamps => {
let queryString = 'query blocks {'
queryString += timestamps.map(timestamp => {
Expand Down
31 changes: 26 additions & 5 deletions src/components/PairChart/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const CHART_VIEW = {
const PairChart = ({ address, color, base0, base1 }) => {
const [chartFilter, setChartFilter] = useState(CHART_VIEW.LIQUIDITY)

const [timeWindow, setTimeWindow] = useState(timeframeOptions.WEEK)
const [timeWindow, setTimeWindow] = useState(timeframeOptions.MONTH)

// update the width on a window resize
const ref = useRef()
Expand Down Expand Up @@ -121,17 +121,38 @@ const PairChart = ({ address, color, base0, base1 }) => {
<AutoRow gap="6px" style={{ flexWrap: 'nowrap' }}>
<OptionButton
active={chartFilter === CHART_VIEW.LIQUIDITY}
onClick={() => setChartFilter(CHART_VIEW.LIQUIDITY)}
onClick={() => {
setTimeWindow(timeframeOptions.ALL_TIME)
setChartFilter(CHART_VIEW.LIQUIDITY)
}}
>
Liquidity
</OptionButton>
<OptionButton active={chartFilter === CHART_VIEW.VOLUME} onClick={() => setChartFilter(CHART_VIEW.VOLUME)}>
<OptionButton
active={chartFilter === CHART_VIEW.VOLUME}
onClick={() => {
setTimeWindow(timeframeOptions.ALL_TIME)
setChartFilter(CHART_VIEW.VOLUME)
}}
>
Volume
</OptionButton>
<OptionButton active={chartFilter === CHART_VIEW.RATE0} onClick={() => setChartFilter(CHART_VIEW.RATE0)}>
<OptionButton
active={chartFilter === CHART_VIEW.RATE0}
onClick={() => {
setTimeWindow(timeframeOptions.WEEK)
setChartFilter(CHART_VIEW.RATE0)
}}
>
{pairData.token0 ? formattedSymbol0 + '/' + formattedSymbol1 : '-'}
</OptionButton>
<OptionButton active={chartFilter === CHART_VIEW.RATE1} onClick={() => setChartFilter(CHART_VIEW.RATE1)}>
<OptionButton
active={chartFilter === CHART_VIEW.RATE1}
onClick={() => {
setTimeWindow(timeframeOptions.WEEK)
setChartFilter(CHART_VIEW.RATE1)
}}
>
{pairData.token0 ? formattedSymbol1 + '/' + formattedSymbol0 : '-'}
</OptionButton>
</AutoRow>
Expand Down
4 changes: 2 additions & 2 deletions src/components/PairList/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ function PairList({ pairs, color, disbaleLinks, maxItems = 10 }) {
return (
<DashGrid style={{ height: '48px' }} disbaleLinks={disbaleLinks} focus={true}>
<DataText area="name" fontWeight="500">
{!below600 && <div style={{ marginRight: '20px' }}>{index}</div>}
{!below600 && <div style={{ marginRight: '20px', width: '10px' }}>{index}</div>}
<DoubleTokenLogo
size={below600 ? 16 : 20}
a0={pairData.token0.id}
Expand Down Expand Up @@ -272,7 +272,7 @@ function PairList({ pairs, color, disbaleLinks, maxItems = 10 }) {
setSortDirection(sortedColumn !== SORT_FIELD.APY ? true : !sortDirection)
}}
>
APY {sortedColumn === SORT_FIELD.APY ? (!sortDirection ? '↑' : '↓') : ''}
1y Fees / Liquidity {sortedColumn === SORT_FIELD.APY ? (!sortDirection ? '↑' : '↓') : ''}
</ClickableText>
<QuestionHelper text={'Based on 24hr volume anualized'} />
</Flex>
Expand Down
2 changes: 1 addition & 1 deletion src/components/TokenList/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ function TopTokenList({ tokens, history, itemMax = 10 }) {
<DashGrid style={{ height: '48px' }} focus={true}>
<DataText area="name" fontWeight="500">
<Row>
{!below680 && <div style={{ marginRight: '1rem' }}>{index}</div>}
{!below680 && <div style={{ marginRight: '1rem', width: '10px' }}>{index}</div>}
<TokenLogo address={item.id} />
<CustomLink style={{ marginLeft: '16px', whiteSpace: 'nowrap' }} to={'/token/' + item.id}>
<FormattedName text={below680 ? item.symbol : item.name} maxCharacters={20} />
Expand Down
16 changes: 6 additions & 10 deletions src/contexts/PairData.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ import {
get2DayPercentChange,
isAddress,
getBlocksFromTimestamps,
getTimestampsForChanges
getTimestampsForChanges,
splitQuery
} from '../utils'
import { timeframeOptions } from '../constants'

Expand Down Expand Up @@ -402,29 +403,24 @@ const getHourlyRateData = async (pairAddress, startTime) => {
try {
blocks = await getBlocksFromTimestamps(timestamps)
} catch (e) {
console.log(e)
console.log('error fetching blocks')
}
// catch failing case
if (!blocks || blocks?.length === 0) {
return []
}

// pass the blocks to a token query
let result = await client.query({
query: HOURLY_PAIR_RATES(pairAddress, blocks),
fetchPolicy: 'cache-first'
})
const result = await splitQuery(HOURLY_PAIR_RATES, client, [pairAddress], blocks, 500)

// format token ETH price results
let values = []
for (var row in result?.data) {
for (var row in result) {
let timestamp = row.split('t')[1]
if (timestamp) {
values.push({
timestamp,
rate0: parseFloat(result.data[row]?.token0Price),
rate1: parseFloat(result.data[row]?.token1Price)
rate0: parseFloat(result[row]?.token0Price),
rate1: parseFloat(result[row]?.token1Price)
})
}
}
Expand Down
40 changes: 33 additions & 7 deletions src/utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,35 @@ export function getTimestampsForChanges() {
return [t1, t2, tWeek]
}

export async function splitQuery(query, localClient, vars, list, skipCount = 100) {
let fetchedData = {}
let allFound = false
let skip = 0

while (!allFound) {
let end = list.length
if (skip + skipCount < list.length) {
end = skip + skipCount
}
let sliced = list.slice(skip, end)
let result = await localClient.query({
query: query(...vars, sliced),
fetchPolicy: 'cache-first'
})
fetchedData = {
...fetchedData,
...result.data
}
if (Object.keys(result.data).length < skipCount || skip + skipCount > list.length) {
allFound = true
} else {
skip += skipCount
}
}

return fetchedData
}

/**
* @notice Fetches first block after a given timestamp
* @dev Query speed is optimized by limiting to a 600-second period
Expand Down Expand Up @@ -146,17 +175,14 @@ export async function getBlocksFromTimestamps(timestamps) {
return []
}

let result = await blockClient.query({
query: GET_BLOCKS(timestamps),
fetchPolicy: 'cache-first'
})
const fetchedData = await splitQuery(GET_BLOCKS, blockClient, [], timestamps, 500)

let blocks = []
if (result.data) {
for (var t in result.data) {
if (fetchedData) {
for (var t in fetchedData) {
blocks.push({
timestamp: t.split('t')[1],
number: result.data[t][0]['number']
number: fetchedData[t][0]['number']
})
}
}
Expand Down