From c923e025bb9e580a81176fd576ccf415083a389f Mon Sep 17 00:00:00 2001 From: Zachary Fogg Date: Tue, 29 Nov 2022 23:36:08 -0500 Subject: [PATCH] fixed build bugs so i can deploy (#87) * fixed build bugs so i can deploy * v1.1.1 --- src/hooks/base/useBlockDiff.ts | 11 ++++++----- src/hooks/baskets/useComposition.ts | 2 +- src/pages/_app.tsx | 2 +- src/pages/farms/components/Modals.tsx | 2 +- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/hooks/base/useBlockDiff.ts b/src/hooks/base/useBlockDiff.ts index 617ebcc4..0b3254df 100644 --- a/src/hooks/base/useBlockDiff.ts +++ b/src/hooks/base/useBlockDiff.ts @@ -2,22 +2,23 @@ import { useWeb3React } from '@web3-react/core' import { providerKey } from '@/utils/index' import { useQuery } from '@tanstack/react-query' import useBlock from './useBlock' +import { BigNumber } from 'ethers' interface BlockDiffOptions { - firstDepositBlock: number - lastWithdrawBlock: number + firstDepositBlock: BigNumber + lastWithdrawBlock: BigNumber } -const useBlockDiff = (options: BlockDiffOptions) => { +const useBlockDiff = (options?: BlockDiffOptions) => { const { library, chainId, account } = useWeb3React() const block = useBlock() - const enabled = !!library && !!block + const enabled = !!library && !!block && !!options const { data: blockDiff } = useQuery( ['@/hooks/base/useBlockDiff', providerKey(library, account, chainId), options, { block }], async () => { const { firstDepositBlock, lastWithdrawBlock } = options - const firstOrLast = firstDepositBlock > lastWithdrawBlock ? firstDepositBlock : lastWithdrawBlock + const firstOrLast = firstDepositBlock.gt(lastWithdrawBlock) ? firstDepositBlock.toNumber() : lastWithdrawBlock.toNumber() const _blockDiff = block - firstOrLast return _blockDiff }, diff --git a/src/hooks/baskets/useComposition.ts b/src/hooks/baskets/useComposition.ts index 9dc54328..df472a6f 100644 --- a/src/hooks/baskets/useComposition.ts +++ b/src/hooks/baskets/useComposition.ts @@ -8,7 +8,7 @@ import { decimate, exponentiate } from '@/utils/numberFormat' import { useWeb3React } from '@web3-react/core' import { BigNumber } from 'ethers' import { ActiveSupportedBasket } from '../../bao/lib/types' -import { fetchSushiApy } from './strategies/useSushiBarApy' +import fetchSushiApy from './strategies/useSushiBarApy' import useGeckoPrices from './useGeckoPrices' import { providerKey } from '@/utils/index' import { useQuery } from '@tanstack/react-query' diff --git a/src/pages/_app.tsx b/src/pages/_app.tsx index 46a29d1d..3a5f455c 100644 --- a/src/pages/_app.tsx +++ b/src/pages/_app.tsx @@ -23,7 +23,7 @@ import TransactionProvider from '@/contexts/Transactions' import TxPopup from '@/components/TxPopup' import '@/components/TxPopup/styles.css' -console.log('v1.1.0') +console.log('v1.1.1') function getLibrary(provider: any): Web3Provider { const library = new Web3Provider(provider) diff --git a/src/pages/farms/components/Modals.tsx b/src/pages/farms/components/Modals.tsx index 457732ca..75dc17b8 100644 --- a/src/pages/farms/components/Modals.tsx +++ b/src/pages/farms/components/Modals.tsx @@ -138,7 +138,7 @@ export const FeeModal: React.FC = ({ pid, show, onHide }) => { { label: 'Last withdraw block:', value: ` - ${userInfo ? userInfo.lastWithdrawBlock === '0' ? 'Never Withdrawn' : userInfo.lastWithdrawBlock : } + ${userInfo ? userInfo.lastWithdrawBlock.eq(0) ? 'Never Withdrawn' : userInfo.lastWithdrawBlock.toNumber() : } `, }, ]}