From 827d70dd34fa818603b4c902f8cdcd79bf08365e Mon Sep 17 00:00:00 2001
From: bwvdhelm <34470358+bobthebuidlr@users.noreply.github.com>
Date: Tue, 7 Feb 2023 23:16:16 +0100
Subject: [PATCH] hotfix: apr tooltips

---
 src/components/common/Tooltip/Apr.tsx         |  2 +-
 .../DepositColumns/useDepositColumns.tsx      |  2 +-
 src/hooks/queries/index.ts                    |  1 -
 src/hooks/queries/useMarketDeposits.tsx       | 49 -------------------
 4 files changed, 2 insertions(+), 52 deletions(-)
 delete mode 100644 src/hooks/queries/useMarketDeposits.tsx

diff --git a/src/components/common/Tooltip/Apr.tsx b/src/components/common/Tooltip/Apr.tsx
index 86eec93..2d78ae9 100644
--- a/src/components/common/Tooltip/Apr.tsx
+++ b/src/components/common/Tooltip/Apr.tsx
@@ -27,7 +27,7 @@ export const Apr = ({ data }: Props) => {
         color: asset.color,
         symbol: asset.symbol,
         apr: asset.apy,
-        subtitle: key === 0 ? t('incentives.depositRewards') : t('incentives.incentiveApr'),
+        subtitle: key === 0 ? t('incentives.interestApr') : t('incentives.depositRewards'),
       })
     })
     return items
diff --git a/src/components/redbank/DepositColumns/useDepositColumns.tsx b/src/components/redbank/DepositColumns/useDepositColumns.tsx
index e3280d9..ef32882 100644
--- a/src/components/redbank/DepositColumns/useDepositColumns.tsx
+++ b/src/components/redbank/DepositColumns/useDepositColumns.tsx
@@ -73,7 +73,7 @@ export const useDepositColumns = () => {
       columnHelper.accessor('apy', {
         enableSorting: enableSorting,
         header: () => (
-          <TextTooltip text={t('common.apy')} tooltip={t('redbank.tooltips.deposit.apy')} />
+          <TextTooltip text={t('common.apr')} tooltip={t('redbank.tooltips.deposit.apy')} />
         ),
         cell: (info) => (
           <TextTooltip
diff --git a/src/hooks/queries/index.ts b/src/hooks/queries/index.ts
index 048252a..9b092d0 100644
--- a/src/hooks/queries/index.ts
+++ b/src/hooks/queries/index.ts
@@ -5,7 +5,6 @@ export { useDepositAndDebt } from './useDepositAndDebt'
 export { useEditPosition } from './useEditPosition'
 export { useEstimateFarmFee } from './useEstimateFarmFee'
 export { useEstimateFee } from './useEstimateFee'
-export { useMarketDeposits } from './useMarketDeposits'
 export { useMarsOracle } from './useMarsOracle'
 export { useProvideLiquidity } from './useProvideLiquidity'
 export { useRedBank } from './useRedBank'
diff --git a/src/hooks/queries/useMarketDeposits.tsx b/src/hooks/queries/useMarketDeposits.tsx
deleted file mode 100644
index 4c80cc8..0000000
--- a/src/hooks/queries/useMarketDeposits.tsx
+++ /dev/null
@@ -1,49 +0,0 @@
-import { useQuery } from '@tanstack/react-query'
-import { getMarketDepositsQuery } from 'functions/queries'
-import { gql, request } from 'graphql-request'
-import { useEffect } from 'react'
-import useStore from 'store'
-import { QUERY_KEYS } from 'types/enums/queryKeys'
-
-export interface MarketDepositsData {
-  mdwasmkey: {
-    OSMODeposits: string
-    ATOMDeposits: string
-    JUNODeposits: string
-    axlUSDCDeposits: string
-  }
-}
-
-export const useMarketDeposits = () => {
-  const hiveUrl = useStore((s) => s.networkConfig?.hiveUrl)
-  const whitelistedAssets = useStore((s) => s.whitelistedAssets)
-  const redBankAddress = useStore((s) => s.networkConfig?.contracts.redBank) || ''
-  const marketInfo = useStore((s) => s.marketInfo)
-  const processMarketDepositsQuery = useStore((s) => s.processMarketDepositsQuery)
-
-  const { refetch } = useQuery<MarketDepositsData>(
-    [QUERY_KEYS.MARKET_DEPOSITS],
-    async () => {
-      return await request(
-        hiveUrl!,
-        gql`
-          ${getMarketDepositsQuery(redBankAddress, whitelistedAssets, marketInfo)}
-        `,
-      )
-    },
-    {
-      enabled: !!hiveUrl && !!whitelistedAssets.length && !!redBankAddress && !!marketInfo.length,
-      refetchInterval: 120000,
-      onSuccess: processMarketDepositsQuery,
-    },
-  )
-
-  // ! Workaround:
-  // Invalidating this query in RB action somehow resolves to Zustand with outdated marketInfo data
-  // It does not retrigger, and therefore a useEffect is placed here to manually rerun when the
-  // marketInfo actually updates.
-  useEffect(() => {
-    if (!marketInfo.length) return
-    refetch()
-  }, [marketInfo, refetch])
-}