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

removed unused data query and corrected health query #1

Open
wants to merge 2 commits into
base: v2
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 0 additions & 3 deletions .vscode/settings.json

This file was deleted.

8 changes: 0 additions & 8 deletions src/apollo/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,6 @@ export const healthClient = new ApolloClient({
shouldBatch: true
})

export const v1Client = new ApolloClient({
link: new HttpLink({
uri: 'https://api.thegraph.com/subgraphs/name/ianlapham/uniswap'
}),
cache: new InMemoryCache(),
shouldBatch: true
})

export const blockClient = new ApolloClient({
link: new HttpLink({
uri: 'https://api.thegraph.com/subgraphs/name/blocklytics/ethereum-blocks'
Expand Down
48 changes: 10 additions & 38 deletions src/apollo/queries.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { FACTORY_ADDRESS, BUNDLE_ID } from '../constants'

export const SUBGRAPH_HEALTH = gql`
query health {
indexingStatusForCurrentVersion(subgraphName: "ianlapham/uniswapv2") {
indexingStatusForCurrentVersion(subgraphName: "zippoxer/sushiswap-subgraph-fork") {
synced
health
chains {
Expand All @@ -18,34 +18,6 @@ export const SUBGRAPH_HEALTH = gql`
}
`

export const V1_DATA_QUERY = gql`

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is V1_DATA_QUERY used in other places? I'm assuming not since V1 is largely deprecated. If this is the case we can remove it and the this PR can note its removal for posterity

query uniswap($date: Int!, $date2: Int!) {
current: uniswap(id: "1") {
totalVolumeUSD
totalLiquidityUSD
txCount
}
oneDay: uniswapHistoricalDatas(where: { timestamp_lt: $date }, first: 1, orderBy: timestamp, orderDirection: desc) {
totalVolumeUSD
totalLiquidityUSD
txCount
}
twoDay: uniswapHistoricalDatas(
where: { timestamp_lt: $date2 }
first: 1
orderBy: timestamp
orderDirection: desc
) {
totalVolumeUSD
totalLiquidityUSD
txCount
}
exchanges(first: 200, orderBy: ethBalance, orderDirection: desc) {
ethBalance
}
}
`

export const GET_BLOCK = gql`
query blocks($timestampFrom: Int!, $timestampTo: Int!) {
blocks(
Expand Down Expand Up @@ -77,7 +49,7 @@ export const POSITIONS_BY_BLOCK = (account, blocks) => {
let queryString = 'query blocks {'
queryString += blocks.map(
block => `
t${block.timestamp}:liquidityPositions(where: {user: "${account}"}, block: { number: ${block.number} }) {
t${block.timestamp}:liquidityPositions(where: {user: "${account}"}, block: { number: ${block.number} }) {
liquidityTokenBalance
pair {
id
Expand All @@ -95,15 +67,15 @@ export const PRICES_BY_BLOCK = (tokenAddress, blocks) => {
let queryString = 'query blocks {'
queryString += blocks.map(
block => `
t${block.timestamp}:token(id:"${tokenAddress}", block: { number: ${block.number} }) {
t${block.timestamp}:token(id:"${tokenAddress}", block: { number: ${block.number} }) {
derivedETH
}
`
)
queryString += ','
queryString += blocks.map(
block => `
b${block.timestamp}: bundle(id:"1", block: { number: ${block.number} }) {
b${block.timestamp}: bundle(id:"1", block: { number: ${block.number} }) {
ethPrice
}
`
Expand Down Expand Up @@ -131,7 +103,7 @@ export const HOURLY_PAIR_RATES = (pairAddress, blocks) => {
let queryString = 'query blocks {'
queryString += blocks.map(
block => `
t${block.timestamp}: pair(id:"${pairAddress}", block: { number: ${block.number} }) {
t${block.timestamp}: pair(id:"${pairAddress}", block: { number: ${block.number} }) {
token0Price
token1Price
}
Expand All @@ -146,11 +118,11 @@ export const SHARE_VALUE = (pairAddress, blocks) => {
let queryString = 'query blocks {'
queryString += blocks.map(
block => `
t${block.timestamp}:pair(id:"${pairAddress}", block: { number: ${block.number} }) {
t${block.timestamp}:pair(id:"${pairAddress}", block: { number: ${block.number} }) {
reserve0
reserve1
reserveUSD
totalSupply
totalSupply
token0{
derivedETH
}
Expand All @@ -163,7 +135,7 @@ export const SHARE_VALUE = (pairAddress, blocks) => {
queryString += ','
queryString += blocks.map(
block => `
b${block.timestamp}: bundle(id:"1", block: { number: ${block.number} }) {
b${block.timestamp}: bundle(id:"1", block: { number: ${block.number} }) {
ethPrice
}
`
Expand Down Expand Up @@ -413,7 +385,7 @@ export const PAIR_DAY_DATA_BULK = (pairs, startTimestamp) => {
totalSupply
reserveUSD
}
}
}
`
return gql(queryString)
}
Expand All @@ -435,7 +407,7 @@ export const GLOBAL_CHART = gql`
export const GLOBAL_DATA = block => {
const queryString = ` query uniswapFactories {
uniswapFactories(
${block ? `block: { number: ${block}}` : ``}
${block ? `block: { number: ${block}}` : ``}
where: { id: "${FACTORY_ADDRESS}" }) {
id
totalVolumeUSD
Expand Down
58 changes: 0 additions & 58 deletions src/contexts/V1Data.js

This file was deleted.