Skip to content

Commit

Permalink
chore: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
defispartan committed Jan 15, 2025
1 parent 89af7c2 commit c189a04
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/components/HistoricalAPYRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const reserveHistoricalRateTimeRangeOptions = [
ESupportedAPYTimeRanges.OneYear,
];

export type ReserveHistoricalRateTimeRange = typeof reserveHistoricalRateTimeRangeOptions[number];
export type ReserveHistoricalRateTimeRange = (typeof reserveHistoricalRateTimeRangeOptions)[number];

export interface TimeRangeSelectorProps {
disabled?: boolean;
Expand Down
8 changes: 4 additions & 4 deletions src/hooks/useHistoricalAPYData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ interface Rates {
function calculateImpliedAPY(
currentLiquidityIndex: number,
previousLiquidityIndex: number,
daysBetweenIndexes: number,
daysBetweenIndexes: number
): string {
if (previousLiquidityIndex <= 0 || currentLiquidityIndex <= 0) {
throw new Error("Liquidity indexes must be positive values.");
throw new Error('Liquidity indexes must be positive values.');
}

const growthFactor = currentLiquidityIndex / previousLiquidityIndex;
const annualizedGrowthFactor = Math.pow(growthFactor, 365 / daysBetweenIndexes);
const impliedAPY = (annualizedGrowthFactor - 1);
const impliedAPY = annualizedGrowthFactor - 1;

return impliedAPY.toString();
}
Expand Down Expand Up @@ -165,6 +165,6 @@ export const useHistoricalAPYData = (
queryKey: ['historicalAPYData', subgraphUrl, selectedTimeRange, underlyingAssets],
queryFn: () => fetchHistoricalAPYData(subgraphUrl, selectedTimeRange, underlyingAssets),
staleTime: 5 * 60 * 1000, // 5 minutes
refetchInterval: 5 * 60 * 1000, // 5 minutes
refetchInterval: 5 * 60 * 1000, // 5 minutes
});
};
5 changes: 2 additions & 3 deletions src/modules/markets/MarketAssetsListContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,22 @@ import { API_ETH_MOCK_ADDRESS } from '@aave/contract-helpers';
import { Trans } from '@lingui/macro';
import { Box, Switch, Typography, useMediaQuery, useTheme } from '@mui/material';
import { useState } from 'react';
import { ESupportedAPYTimeRanges, HistoricalAPYRow } from 'src/components/HistoricalAPYRow';
import { ListWrapper } from 'src/components/lists/ListWrapper';
import { NoSearchResults } from 'src/components/NoSearchResults';
import { Link } from 'src/components/primitives/Link';
import { Warning } from 'src/components/primitives/Warning';
import { TitleWithSearchBar } from 'src/components/TitleWithSearchBar';
import { useAppDataContext } from 'src/hooks/app-data-provider/useAppDataProvider';
import MarketAssetsList from 'src/modules/markets/MarketAssetsList';
import { useHistoricalAPYData } from 'src/hooks/useHistoricalAPYData';

import MarketAssetsList from 'src/modules/markets/MarketAssetsList';
import { useRootStore } from 'src/store/root';
import { fetchIconSymbolAndName } from 'src/ui-config/reservePatches';
import { getGhoReserve, GHO_MINTING_MARKETS, GHO_SYMBOL } from 'src/utils/ghoUtilities';
import { useShallow } from 'zustand/shallow';

import { GENERAL } from '../../utils/mixPanelEvents';
import { GhoBanner } from './Gho/GhoBanner';
import { ESupportedAPYTimeRanges, HistoricalAPYRow } from 'src/components/HistoricalAPYRow';

function shouldDisplayGhoBanner(marketTitle: string, searchTerm: string): boolean {
// GHO banner is only displayed on markets where new GHO is mintable (i.e. Ethereum)
Expand Down
2 changes: 1 addition & 1 deletion src/modules/markets/MarketAssetsListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { ProtocolAction } from '@aave/contract-helpers';
import { Trans } from '@lingui/macro';
import { Box, Button, Typography } from '@mui/material';
import { useRouter } from 'next/router';
import { ESupportedAPYTimeRanges } from 'src/components/HistoricalAPYRow';
import { OffboardingTooltip } from 'src/components/infoTooltips/OffboardingToolTip';
import { RenFILToolTip } from 'src/components/infoTooltips/RenFILToolTip';
import { SpkAirdropTooltip } from 'src/components/infoTooltips/SpkAirdropTooltip';
Expand All @@ -23,7 +24,6 @@ import { FormattedNumber } from '../../components/primitives/FormattedNumber';
import { Link, ROUTES } from '../../components/primitives/Link';
import { TokenIcon } from '../../components/primitives/TokenIcon';
import { ComputedReserveData } from '../../hooks/app-data-provider/useAppDataProvider';
import { ESupportedAPYTimeRanges } from 'src/components/HistoricalAPYRow';

export const MarketAssetsListItem = ({ ...reserve }: ComputedReserveData) => {
const router = useRouter();
Expand Down
2 changes: 1 addition & 1 deletion src/modules/markets/MarketAssetsListMobileItem.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { ProtocolAction } from '@aave/contract-helpers';
import { Trans } from '@lingui/macro';
import { Box, Button, Divider } from '@mui/material';
import { ESupportedAPYTimeRanges } from 'src/components/HistoricalAPYRow';
import { SpkAirdropTooltip } from 'src/components/infoTooltips/SpkAirdropTooltip';
import { SuperFestTooltip } from 'src/components/infoTooltips/SuperFestTooltip';
import { VariableAPYTooltip } from 'src/components/infoTooltips/VariableAPYTooltip';
Expand All @@ -17,7 +18,6 @@ import { Link, ROUTES } from '../../components/primitives/Link';
import { Row } from '../../components/primitives/Row';
import { ComputedReserveData } from '../../hooks/app-data-provider/useAppDataProvider';
import { ListMobileItemWrapper } from '../dashboard/lists/ListMobileItemWrapper';
import { ESupportedAPYTimeRanges } from 'src/components/HistoricalAPYRow';

export const MarketAssetsListMobileItem = ({ ...reserve }: ComputedReserveData) => {
const [trackEvent, currentMarket, selectedTimeRange] = useRootStore(
Expand Down
4 changes: 2 additions & 2 deletions src/modules/markets/index-current-query.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { generateAliases } from "src/utils/generateSubgraphQueryAlias";
import { generateAliases } from 'src/utils/generateSubgraphQueryAlias';

export const constructIndexCurrentQuery = (underlyingAssets: string[]): string => {
const aliases = generateAliases(underlyingAssets.length);
Expand All @@ -25,7 +25,7 @@ export const constructIndexCurrentQuery = (underlyingAssets: string[]): string =

return `
query IndexCurrent {
${queries.join("\n")}
${queries.join('\n')}
}
`;
};
4 changes: 2 additions & 2 deletions src/modules/markets/index-history-query.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { generateAliases } from "src/utils/generateSubgraphQueryAlias";
import { generateAliases } from 'src/utils/generateSubgraphQueryAlias';

export const constructIndexHistoryQuery = (underlyingAssets: string[]): string => {
const aliases = generateAliases(underlyingAssets.length);
Expand All @@ -25,7 +25,7 @@ export const constructIndexHistoryQuery = (underlyingAssets: string[]): string =

return `
query IndexHistory($timestamp: Int!) {
${queries.join("\n")}
${queries.join('\n')}
}
`;
};
4 changes: 2 additions & 2 deletions src/store/protocolDataSlice.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { providers, utils } from 'ethers';
import { ESupportedAPYTimeRanges } from 'src/components/HistoricalAPYRow';
import { permitByChainAndToken } from 'src/ui-config/permitConfig';
import {
availableMarkets,
Expand All @@ -12,7 +13,6 @@ import { CustomMarket, MarketDataType } from '../ui-config/marketsConfig';
import { NetworkConfig } from '../ui-config/networksConfig';
import { RootStore } from './root';
import { setQueryParameter } from './utils/queryParams';
import { ESupportedAPYTimeRanges } from 'src/components/HistoricalAPYRow';

type TypePermitParams = {
reserveAddress: string;
Expand Down Expand Up @@ -47,7 +47,7 @@ export const createProtocolDataSlice: StateCreator<
selectedTimeRange: ESupportedAPYTimeRanges.Now,
jsonRpcProvider: (chainId) => getProvider(chainId ?? get().currentChainId),
setSelectedTimeRange: (timeRange: ESupportedAPYTimeRanges) => {
set({ selectedTimeRange: timeRange })
set({ selectedTimeRange: timeRange });
},
setCurrentMarket: (market, omitQueryParameterUpdate) => {
if (!availableMarkets.includes(market as CustomMarket)) return;
Expand Down

0 comments on commit c189a04

Please sign in to comment.