Browse Source

fix: vesting logic to match rust (#2706)

guibescos 6 tháng trước cách đây
mục cha
commit
a58e20a950
1 tập tin đã thay đổi với 3 bổ sung1 xóa
  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,
       });
     }
   }