Skip to content

Commit

Permalink
Hide BLV for Users that do not have active positions (#3000)
Browse files Browse the repository at this point in the history
* hide BLV for users that dont have positions. remove vaults list

* revert

* remove console logs
  • Loading branch information
brightiron authored Nov 1, 2023
1 parent ae230e6 commit 74fe1f0
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 263 deletions.
3 changes: 0 additions & 3 deletions src/views/Lending/Cooler/positions/Positions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import { useGetCoolerLoans } from "src/views/Lending/Cooler/hooks/useGetCoolerLo
import { CreateOrRepayLoan } from "src/views/Lending/Cooler/positions/CreateOrRepayLoan";
import { DelegateVoting } from "src/views/Lending/Cooler/positions/DelegateVoting";
import { ExtendLoan } from "src/views/Lending/Cooler/positions/ExtendLoan";
import { LiquidityCTA } from "src/views/Liquidity/LiquidityCTA";
import { useAccount } from "wagmi";

export const CoolerPositions = () => {
Expand Down Expand Up @@ -293,8 +292,6 @@ export const CoolerPositions = () => {
/>
</>
)}

<LiquidityCTA />
</div>
);
};
3 changes: 0 additions & 3 deletions src/views/Lending/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { formatCurrency } from "src/helpers";
import { useGetLendAndBorrowStats } from "src/hooks/useGetLendBorrowStats";
import { useOhmPrice } from "src/hooks/usePrices";
import { useCoolerSnapshotLatest } from "src/views/Lending/Cooler/hooks/useSnapshot";
import { LiquidityCTA } from "src/views/Liquidity/LiquidityCTA";

export const Lending = () => {
const theme = useTheme();
Expand Down Expand Up @@ -114,8 +113,6 @@ export const Lending = () => {
</Box>
</Box>
</Box>

<LiquidityCTA />
</Box>
</div>
);
Expand Down
24 changes: 0 additions & 24 deletions src/views/Liquidity/LiquidityCTA.tsx

This file was deleted.

155 changes: 0 additions & 155 deletions src/views/Liquidity/SingleSidedFarms.tsx

This file was deleted.

23 changes: 4 additions & 19 deletions src/views/Liquidity/Vault.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ import { ConfirmationModal } from "src/views/Liquidity/ConfirmationModal";
import { DepositSteps } from "src/views/Liquidity/DepositStepsModal";
import { useGetExpectedPairTokenAmount } from "src/views/Liquidity/hooks/useGetExpectedPairTokenAmount";
import { useGetLastDeposit } from "src/views/Liquidity/hooks/useGetLastDeposit";
import { useGetSingleSidedLiquidityVaults } from "src/views/Liquidity/hooks/useGetSingleSidedLiquidityVaults";
import { useGetUserVault } from "src/views/Liquidity/hooks/useGetUserVault";
import { useGetVault } from "src/views/Liquidity/hooks/useGetVault";
import { useWithdrawLiquidity } from "src/views/Liquidity/hooks/useWithdrawLiquidity";
import { LiquidityCTA } from "src/views/Liquidity/LiquidityCTA";
import { WithdrawModal } from "src/views/Liquidity/WithdrawModal";
import TokenModal, {
ModalHandleSelectProps,
Expand Down Expand Up @@ -86,6 +86,9 @@ export const Vault = () => {
const isWithdrawal = searchParams.get("withdraw") ? true : false;
const theme = useTheme();
const mobile = useMediaQuery(theme.breakpoints.down("sm"));

const { data: vaults, isLoading: vaultsLoading } = useGetSingleSidedLiquidityVaults();
const vaultsWithDeposits = vaults && vaults.filter(vault => vault.lpTokenBalance !== "0");
useEffect(() => {
if (vault) {
setSwapAssetType({ name: vault?.pairTokenName });
Expand Down Expand Up @@ -308,9 +311,6 @@ export const Vault = () => {
<SwapCollection
UpperSwapCard={isWithdrawal ? lpToken() : pairToken()}
LowerSwapCard={isWithdrawal ? pairToken() : lpToken()}
arrowOnClick={() => {
isWithdrawal ? setSearchParams(undefined) : setSearchParams({ withdraw: "true" });
}}
/>
{noAllowance && !isWithdrawal && (
<Box display="flex" flexDirection="row" width="100%" justifyContent="center">
Expand All @@ -331,20 +331,6 @@ export const Vault = () => {
<Box display="flex" flexDirection="row" width="100%" justifyContent="center">
<Box display="flex" flexDirection="column" width="100%" maxWidth="476px">
<Box mt="12px">
{isWithdrawal && !vault.canWithdraw && (
<InfoNotification dismissible>
<Typography>
There is a 24 hour withdraw period from time of last deposit {date}. Learn more{" "}
<Link
href="https://docs.olympusdao.finance/main/overview/boosted-liq-vaults#for-users-1"
target="_blank"
>
here
</Link>
.
</Typography>
</InfoNotification>
)}
<DataRow
title="Slippage Tolerance"
balance={
Expand Down Expand Up @@ -414,7 +400,6 @@ export const Vault = () => {
vaultPairTokenName={vault.pairTokenName}
/>
)}
<LiquidityCTA />
<ConfirmationModal
isOpen={isDepositModalOpen}
setIsOpen={setIsDepositModalOpen}
Expand Down
32 changes: 2 additions & 30 deletions src/views/Liquidity/Vaults.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { ArrowBack } from "@mui/icons-material";
import { Box, Link, Skeleton, Typography, useMediaQuery, useTheme } from "@mui/material";
import { Metric, TextButton } from "@olympusdao/component-library";
import { Box, Link, Typography, useMediaQuery, useTheme } from "@mui/material";
import { Metric } from "@olympusdao/component-library";
import { Link as RouterLink } from "react-router-dom";
import PageTitle from "src/components/PageTitle";
import { formatCurrency } from "src/helpers";
import { useGetSingleSidedLiquidityVaults } from "src/views/Liquidity/hooks/useGetSingleSidedLiquidityVaults";
import { SingleSidedFarms } from "src/views/Liquidity/SingleSidedFarms";
import { VaultFAQ } from "src/views/Liquidity/VaultFAQ";
import { YourAmoDeposits } from "src/views/Liquidity/YourAMODeposits";

Expand Down Expand Up @@ -43,33 +42,6 @@ export const Vaults = () => {
<Metric label="TVL in Vaults" metric={totalTVL ? formatCurrency(totalTVL) : "$0"} isLoading={isLoading} />
</Box>
</Box>
<Box display="flex" justifyContent="space-between" alignItems="center" flexWrap="wrap">
<Box>
<Typography variant="h1">Boosted Liquidity Vaults</Typography>
<Box mb="18px" mt="9px">
<Typography>Single-asset deposits with double the rewards compared to traditional LP.</Typography>
</Box>
</Box>
<TextButton href="https://docs.olympusdao.finance/main/overview/boosted-liq-vaults" target="_blank">
What is Boosted Liquidity?
</TextButton>
</Box>
{isLoading ? (
<Skeleton height="64px" />
) : (
<>
{vaults && vaults.length > 0 ? (
<>
<SingleSidedFarms vaults={vaults} />
<Box mb="33px" />
</>
) : (
<Box display="flex" justifyContent="center" mt="100px">
<Typography variant="h1">No Active Vaults</Typography>
</Box>
)}
</>
)}
{vaultsWithDeposits && vaultsWithDeposits.length > 0 && (
<>
<YourAmoDeposits vaults={vaultsWithDeposits} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ export interface VaultInfo {
totalApy: string;
usdPricePerToken: string;
apyBreakdown: {
baseApy: string;
rewardApy: string;
baseApy: number;
rewardApy: number;
};
}

Expand Down
Loading

0 comments on commit 74fe1f0

Please sign in to comment.