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

duplicated components from lp-contest #39

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
25 changes: 25 additions & 0 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ import { useLatestBlocks, useWhitelistedTokens } from './contexts/Application'
import GoogleAnalyticsReporter from './components/analytics/GoogleAnalyticsReporter'

import dayjs from 'dayjs'
import LpContestLordLookup from './pages/LpContestLordLookup'
import LpContestLordAccountPage from './pages/LpContestLordPage'

const AppWrapper = styled.div`
position: relative;
Expand Down Expand Up @@ -229,6 +231,29 @@ function App() {
</LayoutWrapper>
</Route>

<Route
exacts
strict
path="/lp-contest-lord/:accountAddress"
render={({ match }) => {
if (isStarknetAddress(match.params.accountAddress.toLowerCase())) {
return (
<LayoutWrapper savedOpen={savedOpen} setSavedOpen={setSavedOpen}>
<LpContestLordAccountPage account={match.params.accountAddress.toLowerCase()} />
</LayoutWrapper>
)
} else {
return <Redirect to="/home" />
}
}}
/>

<Route path="/lp-contest-lord/">
<LayoutWrapper savedOpen={savedOpen} setSavedOpen={setSavedOpen}>
<LpContestLordLookup />
</LayoutWrapper>
</Route>

<Redirect to="/home" />
</Switch>
</BrowserRouter>
Expand Down
131 changes: 117 additions & 14 deletions src/apollo/queries.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,7 @@ export const GET_BLOCKS = (timestamps) => {

export const TOP_LPS_PER_PAIRS = gql`
query lps($pair: String!) {
liquidityPositions(
where: { pair: $pair }
orderBy: "liquidity_token_balance"
orderByDirection: "desc"
first: 10
) {
liquidityPositions(where: { pair: $pair }, orderBy: "liquidity_token_balance", orderByDirection: "desc", first: 10) {
user {
id
}
Expand Down Expand Up @@ -203,6 +198,16 @@ export const USER_LP_CONTEST_HISTORY = gql`
}
}
`
export const USER_LP_CONTEST_LORD_HISTORY = gql`
query lpContestSnapshots($user: String!, $skip: Int!) {
lpContestBlocks(first: 1000, skip: $skip, where: { user: $user }, orderBy: "block", orderByDirection: "desc") {
block
contestValue
timestamp
isEligible
}
}
`
export const USER_LP_CONTEST_PERCENTILE = gql`
query lpContestPercentile($user: String!) {
lpContestPercentile(where: { user: $user }) {
Expand All @@ -212,6 +217,15 @@ export const USER_LP_CONTEST_PERCENTILE = gql`
}
`

export const USER_LP_CONTEST_LORD_PERCENTILE = gql`
query lpContestPercentile($user: String!) {
lpContestPercentile(where: { user: $user }) {
percentileRank
rank
}
}
`

export const USER_POSITIONS = gql`
query liquidityPositions($user: String!) {
liquidityPositions(where: { user: $user }) {
Expand Down Expand Up @@ -370,6 +384,71 @@ export const USER_LP_CONTEST_TRANSACTIONS = gql`
}
`

export const USER_LP_CONTEST_LORD_TRANSACTIONS = gql`
query transactions($user: String!) {
mints(orderBy: "block_timestamp", orderByDirection: "desc", where: { to: $user }) {
id
transactionHash
timestamp
pair {
id
token0 {
id
symbol
}
token1 {
id
symbol
}
}
to
liquidity
amount0
amount1
amountUSD
}
burns(orderBy: "timestamp", orderByDirection: "desc", where: { sender: $user }) {
id
transactionHash
timestamp
pair {
id
token0 {
symbol
}
token1 {
symbol
}
}
sender
to
liquidity
amount0
amount1
amountUSD
}
swaps(orderBy: "timestamp", orderByDirection: "desc", where: { to: $user }) {
id
transactionHash
timestamp
pair {
token0 {
symbol
}
token1 {
symbol
}
}
amount0In
amount0Out
amount1In
amount1Out
amountUSD
to
}
}
`

export const PAIR_CHART = gql`
query pairDayDatas($pairAddress: String!, $skip: Int!) {
pairDayDatas(first: 1000, skip: $skip, orderBy: "date", orderByDirection: "asc", where: { pair: $pairAddress }) {
Expand Down Expand Up @@ -409,13 +488,7 @@ export const PAIR_DAY_DATA_BULK = (pairs, startTimestamp) => {

export const GLOBAL_CHART = gql`
query exchangeDayDatas($startTime: Int!, $skip: Int!) {
exchangeDayDatas(
first: 1000
skip: $skip
where: { dateGt: $startTime }
orderBy: "date"
orderByDirection: "asc"
) {
exchangeDayDatas(first: 1000, skip: $skip, where: { dateGt: $startTime }, orderBy: "date", orderByDirection: "asc") {
id
date
totalVolumeUSD
Expand Down Expand Up @@ -663,6 +736,19 @@ export const LP_CONTEST_DATA = gql`
}
`

export const LP_CONTEST_LORD_DATA = gql`
query contest {
lpContests(orderBy: "contest_value", orderByDirection: "desc") {
contestValue
isEligible
user {
id
}
block
}
}
`

export const LP_CONTEST_NFT_RANK = gql`
query lpcontestnftrank {
lpContestNftRank {
Expand All @@ -680,6 +766,23 @@ export const LP_CONTEST_NFT_RANK = gql`
}
`

export const LP_CONTEST_LORD_NFT_RANK = gql`
query lpcontestnftrank {
lpContestNftRank {
L1P1Start
L1P1End
L1P2Start
L1P2End
L1P3Start
L1P3End
L1P4Start
L1P4End
L1P5Start
L1P5End
}
}
`

export const PAIR_DATA = (pairAddress, block) => {
const queryString = `
${PairFields}
Expand Down Expand Up @@ -812,7 +915,7 @@ export const TOKEN_DATA = (tokenAddress, block) => {
}

export const FILTERED_TRANSACTIONS = gql`
query ($allPairs: [String!]) {
query($allPairs: [String!]) {
mints(first: 20, where: { pairIn: $allPairs }, orderBy: "timestamp", orderByDirection: "desc") {
transactionHash
timestamp
Expand Down
Loading