Skip to content

Commit

Permalink
Merge pull request #122 from Tea-Fi/feat/hlss-297/add-subgraph-info
Browse files Browse the repository at this point in the history
fix error with incorrect amount
  • Loading branch information
ionleahu authored Oct 2, 2024
2 parents c741948 + 8be6b5b commit 2c0369d
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/app/hooks/useSubgraphInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,6 @@ export const useSubgraphInfo = (tokenAddress?: `0x${string}`) => {
refetch: refetchVests,
} = useSubgraphVest(account.address, tokenAddress);

console.log("log => ", {
claimData,
vestData,
});

const totalVestedUnlock = useMemo(() => {
return (
vestData?.vests?.reduce(
Expand Down Expand Up @@ -58,11 +53,18 @@ export const useSubgraphInfo = (tokenAddress?: `0x${string}`) => {
);
}, [vestData]);

const totalAmountBurn = useMemo(() => {
return (
vestData?.vests?.reduce(
(acc, currentValue) => acc + BigInt(currentValue.amountBurn),
0n
) || 0n
);
}, [vestData]);

const totalAmount = useMemo(() => {
return vestData?.vests?.[0]?.amountBurn
? BigInt(vestData?.vests?.[0]?.amountBurn) - totalInitialUnlock
: 0n;
}, [vestData, totalInitialUnlock]);
return totalAmountBurn - totalInitialUnlock;
}, [totalAmountBurn, totalInitialUnlock]);

const totalVested = useMemo(() => {
if (!availableForClaim) return claimed;
Expand Down

0 comments on commit 2c0369d

Please sign in to comment.