clawchain/dex-app/modules/reward/hooks/useTotalRewardValueInUst.ts
2026-05-15 19:18:10 +03:00

33 lines
976 B
TypeScript

import { useMemo } from "react";
import {
useBreakdownRewardsTotalInUst,
usePhase1Rewards,
usePhase2Rewards,
} from "modules/reward";
import { useContracts } from "modules/common";
import num from "libs/num";
import { useTokenPriceInUstWithSimulate } from "modules/swap";
export const useTotalRewardValueInUst = () => {
const { clawToken } = useContracts();
const clawPrice = useTokenPriceInUstWithSimulate(clawToken);
const phase1Rewards = usePhase1Rewards();
const phase2Rewards = usePhase2Rewards();
const breakdownRewardsTotalInUst = useBreakdownRewardsTotalInUst();
return useMemo(() => {
const lockdropRewardsInUst = num(
phase1Rewards +
phase2Rewards.oneTimeRewards +
phase2Rewards.ongoingEmissions
)
.times(clawPrice)
.toNumber();
return lockdropRewardsInUst + breakdownRewardsTotalInUst;
}, [phase1Rewards, phase2Rewards, breakdownRewardsTotalInUst]);
};
export default useTotalRewardValueInUst;