From 9404b692d4f1449e052a0d8111d84aa78f9ebead Mon Sep 17 00:00:00 2001 From: MartinGbz Date: Wed, 23 Oct 2024 11:04:07 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Implement=20new=20cbBTC/USDC=20Meri?= =?UTF-8?q?t=20Action=20aprs=20(#2222)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../incentives/IncentivesButton.tsx | 49 ++--------- .../incentives/IncentivesTooltipContent.tsx | 5 ++ .../MeritIncentivesTooltipContent.tsx | 24 ++++-- .../StakeCooldownModalContent.tsx | 11 ++- src/hooks/useMeritIncentives.ts | 84 ++++++++++++++----- .../BorrowAssetsList/BorrowAssetsListItem.tsx | 7 +- .../BorrowAssetsListMobileItem.tsx | 25 ++++-- .../BorrowedPositionsListItem.tsx | 36 +++++--- src/modules/dashboard/lists/ListAPRColumn.tsx | 10 ++- .../SuppliedPositionsListItem.tsx | 7 +- .../SuppliedPositionsListMobileItem.tsx | 25 ++++-- .../SupplyAssetsList/SupplyAssetsListItem.tsx | 35 +++++--- .../SupplyAssetsListMobileItem.tsx | 21 +++-- src/modules/markets/MarketAssetsListItem.tsx | 18 +++- .../markets/MarketAssetsListMobileItem.tsx | 46 ++++++---- src/modules/staking/StakingPanel.tsx | 12 +-- src/modules/staking/StakingPanelNoWallet.tsx | 3 +- src/utils/utils.ts | 13 +-- 18 files changed, 273 insertions(+), 158 deletions(-) diff --git a/src/components/incentives/IncentivesButton.tsx b/src/components/incentives/IncentivesButton.tsx index bc4905eeb1..1a4056735f 100644 --- a/src/components/incentives/IncentivesButton.tsx +++ b/src/components/incentives/IncentivesButton.tsx @@ -1,9 +1,10 @@ +import { ProtocolAction } from '@aave/contract-helpers'; import { valueToBigNumber } from '@aave/math-utils'; import { ReserveIncentiveResponse } from '@aave/math-utils/dist/esm/formatters/incentive/calculate-reserve-incentives'; import { DotsHorizontalIcon } from '@heroicons/react/solid'; import { Box, SvgIcon, Typography } from '@mui/material'; import { useState } from 'react'; -import { useMeritIncentives, useUserMeritIncentives } from 'src/hooks/useMeritIncentives'; +import { useMeritIncentives } from 'src/hooks/useMeritIncentives'; import { useRootStore } from 'src/store/root'; import { DASHBOARD } from 'src/utils/mixPanelEvents'; @@ -36,40 +37,13 @@ const BlankIncentives = () => { ); }; -export const UserMeritIncentivesButton = ({ symbol }: { symbol: 'gho' | 'stkgho' }) => { - const [open, setOpen] = useState(false); - const { data: meritIncentives } = useUserMeritIncentives(); - - if (!meritIncentives) { - return null; - } - - const incentives = { - incentiveAPR: (meritIncentives.actionsAPR[symbol] / 100).toString(), - rewardTokenSymbol: 'GHO', // rewards alwasy in gho, for now - rewardTokenAddress: '0x', // not used for merit program - }; - - return ( - - } - withoutHover - setOpen={setOpen} - open={open} - > - - - ); -}; - -export const MeritIncentivesButton = ({ symbol }: { symbol: 'gho' | 'stkgho' }) => { +export const MeritIncentivesButton = (params: { + symbol: string; + market: string; + protocolAction?: ProtocolAction; +}) => { const [open, setOpen] = useState(false); - const { data: meritIncentives } = useMeritIncentives(symbol); + const { data: meritIncentives } = useMeritIncentives(params); if (!meritIncentives) { return null; @@ -77,12 +51,7 @@ export const MeritIncentivesButton = ({ symbol }: { symbol: 'gho' | 'stkgho' }) return ( - } + tooltipContent={} withoutHover setOpen={setOpen} open={open} diff --git a/src/components/incentives/IncentivesTooltipContent.tsx b/src/components/incentives/IncentivesTooltipContent.tsx index 28fc40c7c9..9b1251245a 100644 --- a/src/components/incentives/IncentivesTooltipContent.tsx +++ b/src/components/incentives/IncentivesTooltipContent.tsx @@ -33,6 +33,11 @@ const IncentivesSymbolMap: { symbol: 'awstETH', aToken: true, }, + aEthUSDC: { + tokenIconSymbol: 'USDC', + symbol: 'aUSDC', + aToken: true, + }, }; interface IncentivesTooltipContentProps { diff --git a/src/components/incentives/MeritIncentivesTooltipContent.tsx b/src/components/incentives/MeritIncentivesTooltipContent.tsx index 079ca3efc5..180dbfb40c 100644 --- a/src/components/incentives/MeritIncentivesTooltipContent.tsx +++ b/src/components/incentives/MeritIncentivesTooltipContent.tsx @@ -6,13 +6,17 @@ import { FormattedNumber } from '../primitives/FormattedNumber'; import { Link } from '../primitives/Link'; import { Row } from '../primitives/Row'; import { TokenIcon } from '../primitives/TokenIcon'; +import { getSymbolMap } from './IncentivesTooltipContent'; export const MeritIncentivesTooltipContent = ({ - incentiveAPR, - rewardTokenSymbol, -}: Omit) => { + meritIncentives, +}: { + meritIncentives: ReserveIncentiveResponse; +}) => { const typographyVariant = 'secondary12'; + const meritIncentivesFormatted = getSymbolMap(meritIncentives); + return ( - - {rewardTokenSymbol} + + {meritIncentivesFormatted.symbol} } width="100%" > - + APR diff --git a/src/components/transactions/StakeCooldown/StakeCooldownModalContent.tsx b/src/components/transactions/StakeCooldown/StakeCooldownModalContent.tsx index e4c4158d81..e5d6e0502b 100644 --- a/src/components/transactions/StakeCooldown/StakeCooldownModalContent.tsx +++ b/src/components/transactions/StakeCooldown/StakeCooldownModalContent.tsx @@ -12,12 +12,12 @@ import { TokenIcon } from 'src/components/primitives/TokenIcon'; import { Warning } from 'src/components/primitives/Warning'; import { useGeneralStakeUiData } from 'src/hooks/stake/useGeneralStakeUiData'; import { useUserStakeUiData } from 'src/hooks/stake/useUserStakeUiData'; -import { useUserMeritIncentives } from 'src/hooks/useMeritIncentives'; +import { useMeritIncentives } from 'src/hooks/useMeritIncentives'; import { useModalContext } from 'src/hooks/useModal'; import { useWeb3Context } from 'src/libs/hooks/useWeb3Context'; import { useRootStore } from 'src/store/root'; import { stakeConfig } from 'src/ui-config/stakeConfig'; -import { getNetworkConfig } from 'src/utils/marketsAndNetworksConfig'; +import { CustomMarket, getNetworkConfig } from 'src/utils/marketsAndNetworksConfig'; import { GENERAL } from 'src/utils/mixPanelEvents'; import { formattedTime, timeText } from '../../../helpers/timeHelper'; @@ -58,8 +58,11 @@ export const StakeCooldownModalContent = ({ stakeAssetName, icon }: StakeCooldow const { data: stakeUserResult } = useUserStakeUiData(currentMarketData, stakeAssetName); const { data: stakeGeneralResult } = useGeneralStakeUiData(currentMarketData, stakeAssetName); - const { data: meritIncentives } = useUserMeritIncentives(); - const usersStkGhoIncentives = meritIncentives?.actionsAPR.stkgho || 0; + const { data: meritIncentives } = useMeritIncentives({ + symbol: 'GHO', + market: CustomMarket.proto_mainnet_v3, + }); + const usersStkGhoIncentives = meritIncentives?.incentiveAPR || 0; // states const [cooldownCheck, setCooldownCheck] = useState(false); diff --git a/src/hooks/useMeritIncentives.ts b/src/hooks/useMeritIncentives.ts index 4c7f1547fb..c0d1cbfc06 100644 --- a/src/hooks/useMeritIncentives.ts +++ b/src/hooks/useMeritIncentives.ts @@ -1,47 +1,87 @@ +import { ProtocolAction } from '@aave/contract-helpers'; import { ReserveIncentiveResponse } from '@aave/math-utils/dist/esm/formatters/incentive/calculate-reserve-incentives'; import { AaveV3Ethereum } from '@bgd-labs/aave-address-book'; import { useQuery } from '@tanstack/react-query'; -import { useRootStore } from 'src/store/root'; +import { CustomMarket } from 'src/ui-config/marketsConfig'; + +export enum MeritAction { + ETHEREUM_STKGHO = 'ethereum-stkgho', + SUPPLY_CBBTC_BORROW_USDC = 'ethereum-supply-cbbtc-borrow-usdc', +} type MeritIncentives = { totalAPR: number; actionsAPR: { - stkgho: number; - gho: number; + [key in MeritAction]: number; }; }; const url = 'https://apps.aavechan.com/api/merit/aprs'; -export const useMeritIncentives = (asset: 'gho' | 'stkgho') => { +export type MeritReserveIncentiveData = Omit & { + action: MeritAction; + protocolAction?: ProtocolAction; +}; + +const getMeritData = (market: string, symbol: string): MeritReserveIncentiveData | undefined => + MERIT_DATA_MAP[market]?.[symbol]; + +const MERIT_DATA_MAP: Record> = { + [CustomMarket.proto_mainnet_v3]: { + GHO: { + action: MeritAction.ETHEREUM_STKGHO, + rewardTokenAddress: AaveV3Ethereum.ASSETS.GHO.UNDERLYING, + rewardTokenSymbol: 'GHO', + }, + cbBTC: { + action: MeritAction.SUPPLY_CBBTC_BORROW_USDC, + rewardTokenAddress: AaveV3Ethereum.ASSETS.USDC.A_TOKEN, + rewardTokenSymbol: 'aEthUSDC', + protocolAction: ProtocolAction.supply, + }, + USDC: { + action: MeritAction.SUPPLY_CBBTC_BORROW_USDC, + rewardTokenAddress: AaveV3Ethereum.ASSETS.USDC.A_TOKEN, + rewardTokenSymbol: 'aEthUSDC', + protocolAction: ProtocolAction.borrow, + }, + }, +}; + +export const useMeritIncentives = ({ + symbol, + market, + protocolAction, +}: { + symbol: string; + market: string; + protocolAction?: ProtocolAction; +}) => { return useQuery({ queryFn: async () => { const response = await fetch(url); const data = await response.json(); - return data.currentAPR as MeritIncentives; + const meritIncentives = data.currentAPR as MeritIncentives; + + return meritIncentives; }, queryKey: ['meritIncentives'], staleTime: 1000 * 60 * 5, select: (data) => { - // rewards are always in GHO, for now + const meritReserveIncentiveData = getMeritData(market, symbol); + if (!meritReserveIncentiveData) { + return null; + } + if (meritReserveIncentiveData.protocolAction !== protocolAction) { + return null; + } + + const APR = data.actionsAPR[meritReserveIncentiveData.action]; return { - incentiveAPR: (data.actionsAPR[asset] / 100).toString(), - rewardTokenAddress: AaveV3Ethereum.ASSETS.GHO.UNDERLYING, - rewardTokenSymbol: 'GHO', + incentiveAPR: (APR / 100).toString(), + rewardTokenAddress: meritReserveIncentiveData.rewardTokenAddress, + rewardTokenSymbol: meritReserveIncentiveData.rewardTokenSymbol, } as ReserveIncentiveResponse; }, }); }; - -export const useUserMeritIncentives = () => { - const user = useRootStore((store) => store.account); - return useQuery({ - queryFn: async () => { - const response = await fetch(`${url}?user=${user}`); - const data = await response.json(); - return data.currentAPR as MeritIncentives; - }, - queryKey: ['meritIncentives', user], - staleTime: 1000 * 60 * 5, - }); -}; diff --git a/src/modules/dashboard/lists/BorrowAssetsList/BorrowAssetsListItem.tsx b/src/modules/dashboard/lists/BorrowAssetsList/BorrowAssetsListItem.tsx index d7082cd39f..020219ba87 100644 --- a/src/modules/dashboard/lists/BorrowAssetsList/BorrowAssetsListItem.tsx +++ b/src/modules/dashboard/lists/BorrowAssetsList/BorrowAssetsListItem.tsx @@ -1,3 +1,4 @@ +import { ProtocolAction } from '@aave/contract-helpers'; import { Trans } from '@lingui/macro'; import { Button } from '@mui/material'; import { useModalContext } from 'src/hooks/useModal'; @@ -5,7 +6,7 @@ import { useProtocolDataContext } from 'src/hooks/useProtocolDataContext'; import { useRootStore } from 'src/store/root'; import { DashboardReserve } from 'src/utils/dashboardSortUtils'; import { DASHBOARD } from 'src/utils/mixPanelEvents'; -import { showExternalIncentivesTooltip, Side } from 'src/utils/utils'; +import { showExternalIncentivesTooltip } from 'src/utils/utils'; import { CapsHint } from '../../../../components/caps/CapsHint'; import { CapType } from '../../../../components/caps/helper'; @@ -46,7 +47,7 @@ export const BorrowAssetsListItem = ({ showExternalIncentivesTooltips={showExternalIncentivesTooltip( symbol, currentMarket, - Side.BORROW + ProtocolAction.borrow )} > diff --git a/src/modules/dashboard/lists/BorrowAssetsList/BorrowAssetsListMobileItem.tsx b/src/modules/dashboard/lists/BorrowAssetsList/BorrowAssetsListMobileItem.tsx index ebb2ee5e2f..e8e80e5094 100644 --- a/src/modules/dashboard/lists/BorrowAssetsList/BorrowAssetsListMobileItem.tsx +++ b/src/modules/dashboard/lists/BorrowAssetsList/BorrowAssetsListMobileItem.tsx @@ -1,9 +1,11 @@ +import { ProtocolAction } from '@aave/contract-helpers'; import { Trans } from '@lingui/macro'; import { Box, Button } from '@mui/material'; +import { MeritIncentivesButton } from 'src/components/incentives/IncentivesButton'; import { VariableAPYTooltip } from 'src/components/infoTooltips/VariableAPYTooltip'; import { useProtocolDataContext } from 'src/hooks/useProtocolDataContext'; import { DashboardReserve } from 'src/utils/dashboardSortUtils'; -import { showExternalIncentivesTooltip, Side } from 'src/utils/utils'; +import { showExternalIncentivesTooltip } from 'src/utils/utils'; import { CapsHint } from '../../../../components/caps/CapsHint'; import { CapType } from '../../../../components/caps/helper'; @@ -42,7 +44,7 @@ export const BorrowAssetsListMobileItem = ({ showExternalIncentivesTooltips={showExternalIncentivesTooltip( symbol, currentMarket, - Side.BORROW + ProtocolAction.borrow )} > - + + + + {/* - + APY} align="flex-start" captionVariant="description" mb={2}> - + + + + { return ( - + + {tooltip} {children} diff --git a/src/modules/dashboard/lists/SuppliedPositionsList/SuppliedPositionsListItem.tsx b/src/modules/dashboard/lists/SuppliedPositionsList/SuppliedPositionsListItem.tsx index 658e24349d..68439b7749 100644 --- a/src/modules/dashboard/lists/SuppliedPositionsList/SuppliedPositionsListItem.tsx +++ b/src/modules/dashboard/lists/SuppliedPositionsList/SuppliedPositionsListItem.tsx @@ -1,3 +1,4 @@ +import { ProtocolAction } from '@aave/contract-helpers'; import { Trans } from '@lingui/macro'; import { Button } from '@mui/material'; import { useAppDataContext } from 'src/hooks/app-data-provider/useAppDataProvider'; @@ -6,7 +7,7 @@ import { useModalContext } from 'src/hooks/useModal'; import { useRootStore } from 'src/store/root'; import { DashboardReserve } from 'src/utils/dashboardSortUtils'; import { GENERAL } from 'src/utils/mixPanelEvents'; -import { showExternalIncentivesTooltip, Side } from 'src/utils/utils'; +import { showExternalIncentivesTooltip } from 'src/utils/utils'; import { ListColumn } from '../../../../components/lists/ListColumn'; import { useProtocolDataContext } from '../../../../hooks/useProtocolDataContext'; @@ -62,7 +63,7 @@ export const SuppliedPositionsListItem = ({ showExternalIncentivesTooltips={showExternalIncentivesTooltip( reserve.symbol, currentMarket, - Side.SUPPLY + ProtocolAction.supply )} > diff --git a/src/modules/dashboard/lists/SuppliedPositionsList/SuppliedPositionsListMobileItem.tsx b/src/modules/dashboard/lists/SuppliedPositionsList/SuppliedPositionsListMobileItem.tsx index fc676fef75..7353b900a2 100644 --- a/src/modules/dashboard/lists/SuppliedPositionsList/SuppliedPositionsListMobileItem.tsx +++ b/src/modules/dashboard/lists/SuppliedPositionsList/SuppliedPositionsListMobileItem.tsx @@ -1,9 +1,11 @@ +import { ProtocolAction } from '@aave/contract-helpers'; import { Trans } from '@lingui/macro'; import { Box, Button } from '@mui/material'; +import { MeritIncentivesButton } from 'src/components/incentives/IncentivesButton'; import { useAppDataContext } from 'src/hooks/app-data-provider/useAppDataProvider'; import { useAssetCaps } from 'src/hooks/useAssetCaps'; import { DashboardReserve } from 'src/utils/dashboardSortUtils'; -import { showExternalIncentivesTooltip, Side } from 'src/utils/utils'; +import { showExternalIncentivesTooltip } from 'src/utils/utils'; import { IncentivesCard } from '../../../../components/incentives/IncentivesCard'; import { Row } from '../../../../components/primitives/Row'; @@ -63,7 +65,7 @@ export const SuppliedPositionsListMobileItem = ({ showExternalIncentivesTooltips={showExternalIncentivesTooltip( reserve.symbol, currentMarket, - Side.SUPPLY + ProtocolAction.supply )} > - + + + + {canSupplyAsWrappedToken && wrappedToken && walletBalance === '0' ? ( @@ -217,7 +219,13 @@ export const SupplyAssetsListItemDesktop = ({ /> )} - + {debtCeiling.isMaxed ? ( @@ -341,7 +349,7 @@ export const SupplyAssetsListItemMobile = ({ showExternalIncentivesTooltips={showExternalIncentivesTooltip( symbol, currentMarket, - Side.SUPPLY + ProtocolAction.supply )} > {canSupplyAsWrappedToken && wrappedToken && walletBalance === '0' ? ( @@ -412,12 +420,19 @@ export const SupplyAssetsListItemMobile = ({ captionVariant="description" mb={2} > - + + + + - + + + + { const externalIncentivesTooltipsSupplySide = showExternalIncentivesTooltip( reserve.symbol, currentMarket, - Side.SUPPLY + ProtocolAction.supply ); const externalIncentivesTooltipsBorrowSide = showExternalIncentivesTooltip( reserve.symbol, currentMarket, - Side.BORROW + ProtocolAction.borrow ); return ( @@ -103,6 +105,11 @@ export const MarketAssetsListItem = ({ ...reserve }: ComputedReserveData) => { } /> + @@ -130,6 +137,11 @@ export const MarketAssetsListItem = ({ ...reserve }: ComputedReserveData) => { } /> + {!reserve.borrowingEnabled && Number(reserve.totalVariableDebt) > 0 && !reserve.isFrozen && } diff --git a/src/modules/markets/MarketAssetsListMobileItem.tsx b/src/modules/markets/MarketAssetsListMobileItem.tsx index b84b79f15f..6eeaa35754 100644 --- a/src/modules/markets/MarketAssetsListMobileItem.tsx +++ b/src/modules/markets/MarketAssetsListMobileItem.tsx @@ -1,5 +1,7 @@ +import { ProtocolAction } from '@aave/contract-helpers'; import { Trans } from '@lingui/macro'; import { Box, Button, Divider } from '@mui/material'; +import { MeritIncentivesButton } from 'src/components/incentives/IncentivesButton'; import { SpkAirdropTooltip } from 'src/components/infoTooltips/SpkAirdropTooltip'; import { SuperFestTooltip } from 'src/components/infoTooltips/SuperFestTooltip'; import { VariableAPYTooltip } from 'src/components/infoTooltips/VariableAPYTooltip'; @@ -8,7 +10,7 @@ import { ReserveSubheader } from 'src/components/ReserveSubheader'; import { useProtocolDataContext } from 'src/hooks/useProtocolDataContext'; import { useRootStore } from 'src/store/root'; import { MARKETS } from 'src/utils/mixPanelEvents'; -import { showExternalIncentivesTooltip, Side } from 'src/utils/utils'; +import { showExternalIncentivesTooltip } from 'src/utils/utils'; import { IncentivesCard } from '../../components/incentives/IncentivesCard'; import { FormattedNumber } from '../../components/primitives/FormattedNumber'; @@ -24,12 +26,12 @@ export const MarketAssetsListMobileItem = ({ ...reserve }: ComputedReserveData) const externalIncentivesTooltipsSupplySide = showExternalIncentivesTooltip( reserve.symbol, currentMarket, - Side.SUPPLY + ProtocolAction.supply ); const externalIncentivesTooltipsBorrowSide = showExternalIncentivesTooltip( reserve.symbol, currentMarket, - Side.BORROW + ProtocolAction.borrow ); return ( @@ -61,19 +63,26 @@ export const MarketAssetsListMobileItem = ({ ...reserve }: ComputedReserveData) mb={3} align="flex-start" > - - {externalIncentivesTooltipsSupplySide.superFestRewards && } - {externalIncentivesTooltipsSupplySide.spkAirdrop && } - - } - /> + + + {externalIncentivesTooltipsSupplySide.superFestRewards && } + {externalIncentivesTooltipsSupplySide.spkAirdrop && } + + } + /> + + @@ -124,6 +133,11 @@ export const MarketAssetsListMobileItem = ({ ...reserve }: ComputedReserveData) } /> + {!reserve.borrowingEnabled && Number(reserve.totalVariableDebt) > 0 && !reserve.isFrozen && } diff --git a/src/modules/staking/StakingPanel.tsx b/src/modules/staking/StakingPanel.tsx index d5f968f012..a5f0b47b45 100644 --- a/src/modules/staking/StakingPanel.tsx +++ b/src/modules/staking/StakingPanel.tsx @@ -17,10 +17,7 @@ import { import { BigNumber } from 'ethers'; import { formatEther, formatUnits } from 'ethers/lib/utils'; import React from 'react'; -import { - MeritIncentivesButton, - UserMeritIncentivesButton, -} from 'src/components/incentives/IncentivesButton'; +import { MeritIncentivesButton } from 'src/components/incentives/IncentivesButton'; import { DarkTooltip } from 'src/components/infoTooltips/DarkTooltip'; import { FormattedNumber } from 'src/components/primitives/FormattedNumber'; import { Link } from 'src/components/primitives/Link'; @@ -29,6 +26,7 @@ import { TextWithTooltip } from 'src/components/TextWithTooltip'; import { StakeTokenFormatted } from 'src/hooks/stake/useGeneralStakeUiData'; import { useCurrentTimestamp } from 'src/hooks/useCurrentTimestamp'; import { useModalContext } from 'src/hooks/useModal'; +import { CustomMarket } from 'src/ui-config/marketsConfig'; import { GENERAL } from 'src/utils/mixPanelEvents'; import { StakeActionBox } from './StakeActionBox'; @@ -332,11 +330,7 @@ export const StakingPanel: React.FC = ({ variant="secondary14" /> {stakedToken === 'GHO' ? ( - stakeUserData.stakeTokenUserBalance !== '0' ? ( - - ) : ( - - ) + ) : null} diff --git a/src/modules/staking/StakingPanelNoWallet.tsx b/src/modules/staking/StakingPanelNoWallet.tsx index 3b12df57b2..69d8b683d9 100644 --- a/src/modules/staking/StakingPanelNoWallet.tsx +++ b/src/modules/staking/StakingPanelNoWallet.tsx @@ -8,6 +8,7 @@ import { TokenIcon } from 'src/components/primitives/TokenIcon'; import { TextWithTooltip } from 'src/components/TextWithTooltip'; import { StakeTokenFormatted, useGeneralStakeUiData } from 'src/hooks/stake/useGeneralStakeUiData'; import { useRootStore } from 'src/store/root'; +import { CustomMarket } from 'src/ui-config/marketsConfig'; export interface StakingPanelNoWalletProps { description?: React.ReactNode; @@ -80,7 +81,7 @@ export const StakingPanelNoWallet: React.FC = ({ {stakedToken === 'GHO' && ( - + )} diff --git a/src/utils/utils.ts b/src/utils/utils.ts index 54ca626207..c3af50beda 100644 --- a/src/utils/utils.ts +++ b/src/utils/utils.ts @@ -1,4 +1,4 @@ -import { ChainId } from '@aave/contract-helpers'; +import { ChainId, ProtocolAction } from '@aave/contract-helpers'; import { BigNumberValue, USD_DECIMALS, valueToBigNumber } from '@aave/math-utils'; import { CustomMarket } from './marketsAndNetworksConfig'; @@ -75,11 +75,6 @@ export const roundToTokenDecimals = (inputValue: string, tokenDecimals: number) return whole + '.' + adjustedDecimals; }; -export enum Side { - SUPPLY = 'supply', - BORROW = 'borrow', -} - export type ExternalIncentivesTooltipsConfig = { superFestRewards: boolean; spkAirdrop: boolean; @@ -88,7 +83,7 @@ export type ExternalIncentivesTooltipsConfig = { export const showExternalIncentivesTooltip = ( symbol: string, currentMarket: string, - side?: Side + protocolAction?: ProtocolAction ) => { const superFestRewardsEnabled = false; const spkRewardsEnabled = true; @@ -101,7 +96,7 @@ export const showExternalIncentivesTooltip = ( if ( superFestRewardsEnabled && currentMarket === CustomMarket.proto_base_v3 && - side === Side.SUPPLY && + protocolAction === ProtocolAction.supply && (symbol == 'ETH' || symbol == 'WETH' || symbol == 'wstETH') ) { tooltipsConfig.superFestRewards = true; @@ -110,7 +105,7 @@ export const showExternalIncentivesTooltip = ( if ( spkRewardsEnabled && currentMarket === CustomMarket.proto_mainnet_v3 && - side === Side.SUPPLY && + protocolAction === ProtocolAction.supply && symbol == 'USDS' ) { tooltipsConfig.spkAirdrop = true;