From d7e09fe2d61614f3132d930c2887641184390cb7 Mon Sep 17 00:00:00 2001 From: Andrey Kopylov Date: Thu, 12 Sep 2024 18:31:55 +0500 Subject: [PATCH] [for-new-stake] change exit queue --- .../subgraph/exitQueue/exitQueueQuery.graphql | 1 + .../getExitQueuePositions/parseExitRequests.ts | 18 +++++++++--------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/graphql/subgraph/exitQueue/exitQueueQuery.graphql b/src/graphql/subgraph/exitQueue/exitQueueQuery.graphql index 7ab0f527..2a5d6909 100644 --- a/src/graphql/subgraph/exitQueue/exitQueueQuery.graphql +++ b/src/graphql/subgraph/exitQueue/exitQueueQuery.graphql @@ -5,6 +5,7 @@ query exitQueue($receiver: Bytes, $vault: String!) { }) { withdrawalTimestamp positionTicket + isV2Position totalShares totalAssets timestamp diff --git a/src/methods/vault/requests/getExitQueuePositions/parseExitRequests.ts b/src/methods/vault/requests/getExitQueuePositions/parseExitRequests.ts index 9b34bfdc..e746672d 100644 --- a/src/methods/vault/requests/getExitQueuePositions/parseExitRequests.ts +++ b/src/methods/vault/requests/getExitQueuePositions/parseExitRequests.ts @@ -4,6 +4,7 @@ import vaultMulticall from '../../../../contracts/multicall/vaultMulticall' type ExitRequest = { withdrawalTimestamp: string | null positionTicket: string + isV2Position: boolean totalShares: string totalAssets: string timestamp: string @@ -21,7 +22,7 @@ export type ParseExitRequestsInput = { type Position = { exitQueueIndex: bigint positionTicket: string - isV1Position: boolean + isV2Position: boolean timestamp: string } @@ -115,7 +116,7 @@ const parseExitRequests = async (values: ParseExitRequestsInput): Promise 0 - const item = { exitQueueIndex, positionTicket, timestamp, isV1Position } + const item = { exitQueueIndex, positionTicket, timestamp, isV2Position } claims.push(item) } @@ -180,14 +180,14 @@ const parseExitRequests = async (values: ParseExitRequestsInput): Promise { - const { isV1Position } = claims[i] + const { isV2Position } = claims[i] - if (isV1Position) { - // in V1 exit queue exit tickets are shares - queuedShares -= BigInt(exitedTickets || 0) + if (isV2Position) { + // in V2 vaults exit queue exit tickets are assets, for v1 and v3+ will be shares + queuedAssets -= BigInt(exitedAssets || 0) } else { - queuedAssets -= BigInt(exitedAssets || 0) + queuedShares -= BigInt(exitedTickets || 0) } withdrawableAssets += BigInt(exitedAssets || 0)