Skip to content

Commit

Permalink
fix(frontend): tvl is now computed everytime
Browse files Browse the repository at this point in the history
  • Loading branch information
0xtekgrinder committed Sep 3, 2023
1 parent 7995965 commit 770005c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
4 changes: 1 addition & 3 deletions frontend/src/components/blockchain/StatsDisplay/TVL.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ export const TVL: FC<TVLProps> = () => {
staker === undefined
)
return;
console.log(cvxLocked, auraLocked, warBalance.value, staker.totalSupply.value);
const auraPrice = await getTotalPricePerToken(
Number(
((auraLocked as bigint) * warBalance.value) / staker.totalSupply.value / BigInt(1e16)
Expand All @@ -58,14 +57,13 @@ export const TVL: FC<TVLProps> = () => {
100,
cvxAddress
);
console.log(auraPrice, cvxPrice);
const total = auraPrice + cvxPrice;
setTvl(formatNumber(total.toFixed(0).toString()) + '$');
}

useEffect(() => {
if (tvl === undefined) computeTVL();
}, [cvxLocked, auraLocked, warBalance]);
}, [cvxLocked, auraLocked, warBalance, staker]);

const textProps =
useColorMode().colorMode === 'light'
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/panels/WarWithdraw/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ export interface WarWithdrawPanelProps {}
export const WarWithdrawPanel: FC<WarWithdrawPanelProps> = () => {
const war = useOrFetchTokenInfos({ token: 'war' });
const vault = useOrFetchTokenInfos({ token: 'tWAR' });
const {data: stakerBalance} = useBalance({
const { data: stakerBalance } = useBalance({
token: stakerAddress,
address: vaultAddress
})
});
const wstkWARWithdrawInputAmount = useStore((state) => state.getWithdrawInputTokenAmount('tWAR'));
const warWithdrawOutputAmount = useStore((state) => state.getWithdrawOutputTokenAmount('war'));
const setWithdrawOutputAmount = useStore((state) => state.setWithdrawOutputTokenAmount);
Expand Down

0 comments on commit 770005c

Please sign in to comment.