Skip to content

Commit

Permalink
update period vesting balance fetch
Browse files Browse the repository at this point in the history
  • Loading branch information
blackpanther1881 committed Oct 13, 2023
1 parent e376c6d commit da0fbe9
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/utils/vestingAmount.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,18 @@ export const getUTOKEN_Balance = (amountList) => {

export const getPeriodicVestingAmount = (account, currentEpochTime) => {
let accountVestingAmount = getUTOKEN_Balance(
account.accountData.baseVestingAccount.originalVesting
account.baseVestingAccount.originalVesting
);
let freeBalance = 0;
const endTime = parseInt(account.accountData.baseVestingAccount.endTime);
const endTime = parseInt(account.baseVestingAccount.endTime);
if (endTime >= currentEpochTime) {
let vestingTimes = parseInt(account.accountData.startTime);
for (let i = 0; i < account.accountData.vestingPeriods.length; i++) {
let length = parseInt(account.accountData.vestingPeriods[i]["length"]);
let vestingTimes = parseInt(account.startTime);
for (let i = 0; i < account.vestingPeriods.length; i++) {
let length = parseInt(account.vestingPeriods[i]["length"]);
vestingTimes = vestingTimes + length;
if (currentEpochTime >= vestingTimes) {
freeBalance =
freeBalance +
getUTOKEN_Balance(account.accountData.vestingPeriods[i].amount);
freeBalance + getUTOKEN_Balance(account.vestingPeriods[i].amount);
}
}
} else {
Expand Down Expand Up @@ -74,7 +73,7 @@ function getAccountVestingAmount(account, currentEpochTime) {
switch (account.typeUrl) {
case periodicVesting:
accountVestingAmount = getPeriodicVestingAmount(
account,
account.accountData,
currentEpochTime
);
break;
Expand Down

0 comments on commit da0fbe9

Please sign in to comment.