Просмотр исходного кода

fix: vesting logic to match rust (#2706)

guibescos 6 месяцев назад
Родитель
Сommit
a58e20a950
1 измененных файлов с 3 добавлено и 1 удалено
  1. 3 1
      governance/pyth_staking_sdk/src/utils/vesting.ts

+ 3 - 1
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,
       });
     }
   }