Skip to content

Commit

Permalink
chore: split AMM pages into seperate folders (#1436)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielsimao authored Jul 10, 2023
1 parent 9b64c30 commit 0c457e9
Show file tree
Hide file tree
Showing 58 changed files with 16 additions and 24 deletions.
4 changes: 2 additions & 2 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ const Vaults = React.lazy(() => import(/* webpackChunkName: 'vaults' */ '@/pages
// TODO: last task will be to delete legacy dashboard and rename vault dashboard
const Vault = React.lazy(() => import(/* webpackChunkName: 'vault' */ '@/pages/Vaults/Vault'));
const Loans = React.lazy(() => import(/* webpackChunkName: 'loans' */ '@/pages/Loans'));
const Swap = React.lazy(() => import(/* webpackChunkName: 'amm' */ '@/pages/AMM'));
const Pools = React.lazy(() => import(/* webpackChunkName: 'amm/pools' */ '@/pages/AMM/Pools'));
const Swap = React.lazy(() => import(/* webpackChunkName: 'amm' */ '@/pages/Swap'));
const Pools = React.lazy(() => import(/* webpackChunkName: 'amm/pools' */ '@/pages/Pools'));
const Wallet = React.lazy(() => import(/* webpackChunkName: 'wallet' */ '@/pages/Wallet'));
const Onboarding = React.lazy(() => import(/* webpackChunkName: 'onboarding' */ '@/pages/Onboarding'));
const Actions = React.lazy(() => import(/* webpackChunkName: 'actions' */ '@/pages/Actions'));
Expand Down
2 changes: 1 addition & 1 deletion src/components/PoolsTable/PoolsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { ReactNode, useMemo } from 'react';
import { useTranslation } from 'react-i18next';

import { formatPercentage, formatUSD } from '@/common/utils/utils';
import { calculateAccountLiquidityUSD, calculateTotalLiquidityUSD } from '@/pages/AMM/shared/utils';
import { getCoinIconProps } from '@/utils/helpers/coin-icon';
import { calculateAccountLiquidityUSD, calculateTotalLiquidityUSD } from '@/utils/helpers/pool';
import { getFarmingApr } from '@/utils/helpers/pools';
import { DateRangeVolume, useGetDexVolumes } from '@/utils/hooks/api/use-get-dex-volume';
import { useGetPoolsTradingApr } from '@/utils/hooks/api/use-get-pools-trading-apr';
Expand Down
File renamed without changes.
2 changes: 2 additions & 0 deletions src/components/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ export { PlusDivider } from './PlusDivider';
export type { PoolsTableProps } from './PoolsTable';
export { PoolsTable } from './PoolsTable';
export { ReceivableAssets } from './ReceivableAssets';
export type { SlippageManagerProps } from './SlippageManager';
export { SlippageManager } from './SlippageManager';
export type { ToastContainerProps } from './ToastContainer';
export { ToastContainer } from './ToastContainer';
export * from './TransactionDetails';
Expand Down
3 changes: 0 additions & 3 deletions src/pages/AMM/index.tsx

This file was deleted.

2 changes: 0 additions & 2 deletions src/pages/AMM/shared/components/index.tsx

This file was deleted.

File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,14 @@ import { useTranslation } from 'react-i18next';

import { newSafeMonetaryAmount } from '@/common/utils/utils';
import { Alert, Flex } from '@/component-library';
import { AuthCTA, TransactionFeeDetails } from '@/components';
import { AuthCTA, SlippageManager, TransactionFeeDetails } from '@/components';
import {
DepositLiquidityPoolFormData,
depositLiquidityPoolSchema,
DepositLiquidityPoolValidationParams,
POOL_DEPOSIT_FEE_TOKEN_FIELD,
useForm
} from '@/lib/form';
import { SlippageManager } from '@/pages/AMM/shared/components';
import { AMM_DEADLINE_INTERVAL } from '@/utils/constants/api';
import { getTokenPrice } from '@/utils/helpers/prices';
import { useGetBalances } from '@/utils/hooks/api/tokens/use-get-balances';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
POOL_CLAIM_REWARDS_FEE_TOKEN_FIELD,
useForm
} from '@/lib/form';
import { calculateAccountLiquidityUSD, calculateTotalLiquidityUSD } from '@/pages/AMM/shared/utils';
import { calculateAccountLiquidityUSD, calculateTotalLiquidityUSD } from '@/utils/helpers/pool';
import { AccountPoolsData } from '@/utils/hooks/api/amm/use-get-account-pools';
import { useGetPrices } from '@/utils/hooks/api/use-get-prices';
import { Transaction, useTransaction } from '@/utils/hooks/transaction';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { CurrencyExt, LpCurrency } from '@interlay/interbtc-api';
import { MonetaryAmount } from '@interlay/monetary-js';

import { calculateTotalLiquidityUSD } from '@/pages/AMM/shared/utils';
import { calculateTotalLiquidityUSD } from '@/utils/helpers/pool';
import { Prices } from '@/utils/hooks/api/use-get-prices';

const calculateClaimableFarmingRewardUSD = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { CurrencyExt, LpCurrency } from '@interlay/interbtc-api';
import { MonetaryAmount } from '@interlay/monetary-js';
import Big from 'big.js';

import { calculateTotalLiquidityUSD } from '@/pages/AMM/shared/utils';
import { calculateTotalLiquidityUSD } from '@/utils/helpers/pool';
import { Prices } from '@/utils/hooks/api/use-get-prices';

const getFarmingApr = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@ import { useTranslation } from 'react-i18next';

import { convertMonetaryAmountToValueInUSD, newSafeMonetaryAmount } from '@/common/utils/utils';
import { Flex, TokenInput } from '@/component-library';
import { AuthCTA, ReceivableAssets, TransactionFeeDetails } from '@/components';
import { AuthCTA, ReceivableAssets, SlippageManager, TransactionFeeDetails } from '@/components';
import { GOVERNANCE_TOKEN, TRANSACTION_FEE_AMOUNT } from '@/config/relay-chains';
import { POOL_WITHDRAW_AMOUNT_FIELD, POOL_WITHDRAW_FEE_TOKEN_FIELD, useForm } from '@/lib/form';
import { WithdrawLiquidityPoolFormData, withdrawLiquidityPoolSchema } from '@/lib/form/schemas';
import { SlippageManager } from '@/pages/AMM/shared/components';
import { AMM_DEADLINE_INTERVAL } from '@/utils/constants/api';
import { getTokenPrice } from '@/utils/helpers/prices';
import { useGetBalances } from '@/utils/hooks/api/tokens/use-get-balances';
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { useDebounce, useInterval } from 'react-use';
import { StoreType } from '@/common/types/util.types';
import { convertMonetaryAmountToValueInUSD, newSafeMonetaryAmount } from '@/common/utils/utils';
import { Card, CardProps, Divider, Flex, H1, TokenInput } from '@/component-library';
import { TransactionFeeDetails } from '@/components';
import { SlippageManager, TransactionFeeDetails } from '@/components';
import { GOVERNANCE_TOKEN, TRANSACTION_FEE_AMOUNT } from '@/config/relay-chains';
import {
SWAP_FEE_TOKEN_FIELD,
Expand All @@ -20,7 +20,6 @@ import {
swapSchema,
useForm
} from '@/lib/form';
import { SlippageManager } from '@/pages/AMM/shared/components';
import { SwapPair } from '@/types/swap';
import { REFETCH_INTERVAL } from '@/utils/constants/api';
import { SWAP_PRICE_IMPACT_LIMIT } from '@/utils/constants/swap';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@ import { CurrencyExt, LiquidityPool } from '@interlay/interbtc-api';

import { formatUSD } from '@/common/utils/utils';
import { Card, CardProps, CoinPair, Dd, Dl, DlGroup, Dt, Flex, H2 } from '@/component-library';
import { calculateTotalLiquidityUSD } from '@/utils/helpers/pool';
import { DateRangeVolume, useGetDexVolumes } from '@/utils/hooks/api/use-get-dex-volume';
import { useGetPrices } from '@/utils/hooks/api/use-get-prices';

import { calculateTotalLiquidityUSD } from '../../../shared/utils';

type Props = {
input: CurrencyExt;
output: CurrencyExt;
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { CurrencyExt, LpCurrency } from '@interlay/interbtc-api';
import { MonetaryAmount } from '@interlay/monetary-js';

import { calculateTotalLiquidityUSD } from '@/pages/AMM/shared/utils';
import { calculateTotalLiquidityUSD } from '@/utils/helpers/pool';
import { Prices } from '@/utils/hooks/api/use-get-prices';

const calculateClaimableFarmingRewardUSD = (
Expand Down
File renamed without changes.
3 changes: 1 addition & 2 deletions src/utils/helpers/pools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ import { CurrencyExt, LiquidityPool, LpCurrency } from '@interlay/interbtc-api';
import { MonetaryAmount } from '@interlay/monetary-js';
import Big from 'big.js';

import { calculateTotalLiquidityUSD } from '@/pages/AMM/shared/utils';

import { Prices } from '../hooks/api/use-get-prices';
import { calculateTotalLiquidityUSD } from './pool';

const getPooledTickers = (liquidityPools: LiquidityPool[]): Set<string> =>
liquidityPools.reduce((acc, pool) => {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/hooks/api/amm/use-get-account-pools.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import Big from 'big.js';
import { useErrorHandler } from 'react-error-boundary';
import { useQuery } from 'react-query';

import { calculateAccountLiquidityUSD, calculateTotalLiquidityUSD } from '@/pages/AMM/shared/utils';
import { BLOCKTIME_REFETCH_INTERVAL } from '@/utils/constants/api';
import { calculateAccountLiquidityUSD, calculateTotalLiquidityUSD } from '@/utils/helpers/pool';
import { Prices, useGetPrices } from '@/utils/hooks/api/use-get-prices';

import useAccountId from '../../use-account-id';
Expand Down
2 changes: 1 addition & 1 deletion src/utils/hooks/api/use-get-pools-trading-apr.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ import { useQuery } from 'react-query';

import { convertMonetaryAmountToBigUSD } from '@/common/utils/utils';
import { SQUID_URL } from '@/constants';
import { calculateTotalLiquidityUSD } from '@/pages/AMM/shared/utils';
import { CurrencySquidFormat } from '@/types/currency';
import { MILLISECONDS_PER_DAY } from '@/utils/constants/date-time';
import { calculateTotalLiquidityUSD } from '@/utils/helpers/pool';
import { getTokenPrice } from '@/utils/helpers/prices';

import { useGetLiquidityPools } from './amm/use-get-liquidity-pools';
Expand Down

1 comment on commit 0c457e9

@vercel
Copy link

@vercel vercel bot commented on 0c457e9 Jul 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.