From 770005cb3b3e2383c19dcd334a2956582fbc876e Mon Sep 17 00:00:00 2001 From: 0xtekgrinder <0xtekgrinder@protonmail.com> Date: Sun, 3 Sep 2023 06:10:56 +0200 Subject: [PATCH] fix(frontend): tvl is now computed everytime --- frontend/src/components/blockchain/StatsDisplay/TVL.tsx | 4 +--- frontend/src/components/panels/WarWithdraw/index.tsx | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/frontend/src/components/blockchain/StatsDisplay/TVL.tsx b/frontend/src/components/blockchain/StatsDisplay/TVL.tsx index 03f3fb8..19c7e2d 100644 --- a/frontend/src/components/blockchain/StatsDisplay/TVL.tsx +++ b/frontend/src/components/blockchain/StatsDisplay/TVL.tsx @@ -46,7 +46,6 @@ export const TVL: FC = () => { 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) @@ -58,14 +57,13 @@ export const TVL: FC = () => { 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' diff --git a/frontend/src/components/panels/WarWithdraw/index.tsx b/frontend/src/components/panels/WarWithdraw/index.tsx index f9fbc52..f4cef53 100644 --- a/frontend/src/components/panels/WarWithdraw/index.tsx +++ b/frontend/src/components/panels/WarWithdraw/index.tsx @@ -12,10 +12,10 @@ export interface WarWithdrawPanelProps {} export const WarWithdrawPanel: FC = () => { 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);