From 535a64237f1b6741f449df4d477f8c4dc3d58084 Mon Sep 17 00:00:00 2001 From: chefjackson <116779127+chefjackson@users.noreply.github.com> Date: Sat, 19 Oct 2024 08:34:24 +0800 Subject: [PATCH] fix: Invalid volume (#10839) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ## 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}` --- apps/web/src/state/farmsV4/state/farmPools/fetcher.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/web/src/state/farmsV4/state/farmPools/fetcher.ts b/apps/web/src/state/farmsV4/state/farmPools/fetcher.ts index f14ddd84d2b1a..7a7a5ed2a3a48 100644 --- a/apps/web/src/state/farmsV4/state/farmPools/fetcher.ts +++ b/apps/web/src/state/farmsV4/state/farmPools/fetcher.ts @@ -68,8 +68,8 @@ function fetchV3PoolsTvlVolumeFromSubgraph(pools: PoolIdentifier[]): Promise( 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 { @@ -81,6 +81,7 @@ function fetchV3PoolsTvlVolumeFromSubgraph(pools: PoolIdentifier[]): Promise p.id), startAt: dayjs().utc().startOf('day').subtract(1, 'days').unix(), + endAt: dayjs().utc().startOf('day').unix(), }, ) return result.poolDayDatas.map((data) => ({