From 6f34886e87cdd35047d09fc5b68959cd079a6c6a Mon Sep 17 00:00:00 2001 From: Guillermo Bescos Date: Mon, 19 May 2025 18:35:50 +0100 Subject: [PATCH] fix: vesting logic to match rust --- governance/pyth_staking_sdk/src/utils/vesting.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/governance/pyth_staking_sdk/src/utils/vesting.ts b/governance/pyth_staking_sdk/src/utils/vesting.ts index f9d1ffa317..3ccfec7564 100644 --- a/governance/pyth_staking_sdk/src/utils/vesting.ts +++ b/governance/pyth_staking_sdk/src/utils/vesting.ts @@ -57,7 +57,9 @@ export const getPeriodicUnlockSchedule = (options: { if (currentTimeStamp < unlockTimeStamp || includePastPeriods) { unlockSchedule.push({ date: new Date(unlockTimeStamp * 1000), - amount: balance / numPeriods, + amount: + ((numPeriods - BigInt(i)) * balance) / numPeriods - + ((numPeriods - BigInt(i + 1)) * balance) / numPeriods, }); } }