Skip to content

Commit

Permalink
fix: Invalid volume (#10839)
Browse files Browse the repository at this point in the history
<!--
Before opening a pull request, please read the [contributing
guidelines](https://github.com/pancakeswap/pancake-frontend/blob/develop/CONTRIBUTING.md)
first
-->


<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on modifying the GraphQL query for fetching pool data to
include an `endAt` parameter, allowing for more precise date filtering.

### Detailed summary
- Added `endAt: Int!` parameter to the `pools` query.
- Changed the filter from `date_gt` to `date_gte` for `startAt`.
- Added `date_lt: $endAt` filter to the query.
- Updated the `fetchV3PoolsTvlVolumeFromSubgraph` function to include
`endAt` in its parameters.

> ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your
question}`

<!-- end pr-codex -->
  • Loading branch information
chefjackson authored Oct 19, 2024
1 parent e8744cf commit 535a642
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions apps/web/src/state/farmsV4/state/farmPools/fetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ function fetchV3PoolsTvlVolumeFromSubgraph(pools: PoolIdentifier[]): Promise<Poo
}
const result = await client.request<V3PoolResult>(
gql`
query pools($addresses: [String!]!, $startAt: Int!) {
poolDayDatas(first: 1000, where: { date_gt: $startAt, pool_in: $addresses }) {
query pools($addresses: [String!]!, $startAt: Int!, $endAt: Int!) {
poolDayDatas(first: 1000, where: { date_gte: $startAt, date_lt: $endAt, pool_in: $addresses }) {
volumeUSD
tvlUSD
pool {
Expand All @@ -81,6 +81,7 @@ function fetchV3PoolsTvlVolumeFromSubgraph(pools: PoolIdentifier[]): Promise<Poo
{
addresses: poolsOnChain.map((p) => p.id),
startAt: dayjs().utc().startOf('day').subtract(1, 'days').unix(),
endAt: dayjs().utc().startOf('day').unix(),
},
)
return result.poolDayDatas.map((data) => ({
Expand Down

0 comments on commit 535a642

Please sign in to comment.