Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pools: support quote_token fdv and market_cap values #2555

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions mocks/pools/pool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ export const base: Pool = {
quote_token_address: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
quote_token_symbol: 'WETH',
quote_token_icon_url: 'https://localhost:3000/secondary_utia.jpg',
fully_diluted_valuation_usd: '75486579078',
market_cap_usd: '139312819076.195',
base_token_fully_diluted_valuation_usd: '75486579078',
base_token_market_cap_usd: '139312819076.195',
quote_token_fully_diluted_valuation_usd: '486579078',
quote_token_market_cap_usd: '312819076.195',
liquidity: '2099941.2238',
dex: { id: 'sushiswap', name: 'SushiSwap' },
fee: '0.03',
Expand Down
6 changes: 4 additions & 2 deletions stubs/pools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ export const POOL = {
quote_token_address: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
quote_token_symbol: 'WETH',
quote_token_icon_url: 'https://coin-images.coingecko.com/coins/images/2518/small/weth.png?1696503332',
fully_diluted_valuation_usd: '15211385',
market_cap_usd: '15211385',
base_token_fully_diluted_valuation_usd: '15211385',
base_token_market_cap_usd: '15211385',
quote_token_fully_diluted_valuation_usd: '15211385',
quote_token_market_cap_usd: '15211385',
liquidity: '394101.2428',
dex: { id: 'uniswap_v2', name: 'Uniswap V2' },
coin_gecko_terminal_url: 'https://www.geckoterminal.com/eth/pools/0x6a1041865b76d1dc33da0257582591227c57832c',
Expand Down
6 changes: 4 additions & 2 deletions types/api/pools.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ export type Pool = {
quote_token_address: string;
quote_token_symbol: string;
quote_token_icon_url: string | null;
fully_diluted_valuation_usd: string;
market_cap_usd: string;
base_token_fully_diluted_valuation_usd: string;
base_token_market_cap_usd: string;
quote_token_fully_diluted_valuation_usd: string;
quote_token_market_cap_usd: string;
liquidity: string;
dex: {
id: string;
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
36 changes: 30 additions & 6 deletions ui/pool/PoolInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const PoolInfo = ({ data, isPlaceholderData }: Props) => {
<Grid
columnGap={ 8 }
rowGap={{ base: 1, lg: 3 }}
templateColumns={{ base: 'minmax(0, 1fr)', lg: 'minmax(min-content, 200px) minmax(0, 1fr)' }}
templateColumns={{ base: 'minmax(0, 1fr)', lg: 'minmax(min-content, 220px) minmax(0, 1fr)' }}
overflow="hidden"
>
<DetailsInfoItem.Label
Expand Down Expand Up @@ -63,23 +63,47 @@ const PoolInfo = ({ data, isPlaceholderData }: Props) => {
isLoading={ isPlaceholderData }
hint="Fully Diluted Valuation: theoretical market cap if all tokens were in circulation"
>
FDV
Base token FDV
</DetailsInfoItem.Label>
<DetailsInfoItem.Value>
<Skeleton isLoaded={ !isPlaceholderData }>
${ Number(data.fully_diluted_valuation_usd).toLocaleString(undefined, { maximumFractionDigits: 2, notation: 'compact' }) }
${ Number(data.base_token_fully_diluted_valuation_usd).toLocaleString(undefined, { maximumFractionDigits: 2, notation: 'compact' }) }
</Skeleton>
</DetailsInfoItem.Value>

<DetailsInfoItem.Label
isLoading={ isPlaceholderData }
hint="Current market capitalization of the pool"
hint="Current market capitalization of the base token"
>
Market cap
Base token market cap
</DetailsInfoItem.Label>
<DetailsInfoItem.Value>
<Skeleton isLoaded={ !isPlaceholderData }>
${ Number(data.market_cap_usd).toLocaleString(undefined, { maximumFractionDigits: 2, notation: 'compact' }) }
${ Number(data.base_token_market_cap_usd).toLocaleString(undefined, { maximumFractionDigits: 2, notation: 'compact' }) }
</Skeleton>
</DetailsInfoItem.Value>

<DetailsInfoItem.Label
isLoading={ isPlaceholderData }
hint="Fully Diluted Valuation: theoretical market cap if all tokens were in circulation"
>
Quote token FDV
</DetailsInfoItem.Label>
<DetailsInfoItem.Value>
<Skeleton isLoaded={ !isPlaceholderData }>
${ Number(data.quote_token_fully_diluted_valuation_usd).toLocaleString(undefined, { maximumFractionDigits: 2, notation: 'compact' }) }
</Skeleton>
</DetailsInfoItem.Value>

<DetailsInfoItem.Label
isLoading={ isPlaceholderData }
hint="Current market capitalization of the base token"
>
Quote token market cap
</DetailsInfoItem.Label>
<DetailsInfoItem.Value>
<Skeleton isLoaded={ !isPlaceholderData }>
${ Number(data.quote_token_market_cap_usd).toLocaleString(undefined, { maximumFractionDigits: 2, notation: 'compact' }) }
</Skeleton>
</DetailsInfoItem.Value>

Expand Down
14 changes: 0 additions & 14 deletions ui/pools/PoolsListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,6 @@ const UserOpsListItem = ({ item, isLoading }: Props) => {
<AddressEntity address={{ hash: item.contract_address }} noIcon isLoading={ isLoading }/>
</ListItemMobileGrid.Value>

<ListItemMobileGrid.Label isLoading={ isLoading }>FDV</ListItemMobileGrid.Label>
<ListItemMobileGrid.Value>
<Skeleton isLoaded={ !isLoading }>
${ Number(item.fully_diluted_valuation_usd).toLocaleString(undefined, { maximumFractionDigits: 2, notation: 'compact' }) }
</Skeleton>
</ListItemMobileGrid.Value>

<ListItemMobileGrid.Label isLoading={ isLoading }>Market cap</ListItemMobileGrid.Label>
<ListItemMobileGrid.Value>
<Skeleton isLoaded={ !isLoading }>
${ Number(item.market_cap_usd).toLocaleString(undefined, { maximumFractionDigits: 2, notation: 'compact' }) }
</Skeleton>
</ListItemMobileGrid.Value>

<ListItemMobileGrid.Label isLoading={ isLoading }>Liquidity</ListItemMobileGrid.Label>
<ListItemMobileGrid.Value>
<Skeleton isLoaded={ !isLoading }>
Expand Down
14 changes: 1 addition & 13 deletions ui/pools/PoolsTable.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { Table, Tbody, Th, Tr, Flex } from '@chakra-ui/react';
import { Table, Tbody, Th, Tr } from '@chakra-ui/react';
import React from 'react';

import type { Pool } from 'types/api/pools';

import { ACTION_BAR_HEIGHT_DESKTOP } from 'ui/shared/ActionBar';
import Hint from 'ui/shared/Hint';
import { default as Thead } from 'ui/shared/TheadSticky';

import PoolsTableItem from './PoolsTableItem';
Expand All @@ -23,17 +22,6 @@ const PoolsTable = ({ items, page, isLoading, top }: Props) => {
<Tr>
<Th width="70%">Pool</Th>
<Th width="30%">DEX </Th>
<Th width="130px" isNumeric>
<Flex alignItems="center" justifyContent="end">
FDV
<Hint
label="Fully Diluted Valuation: theoretical market cap if all tokens were in circulation"
boxSize={ 5 }
ml={ 1 }
/>
</Flex>
</Th>
<Th width="130px" isNumeric>Market cap</Th>
<Th width="130px" isNumeric>Liquidity</Th>
<Th width="75px" isNumeric>View in</Th>
</Tr>
Expand Down
10 changes: 0 additions & 10 deletions ui/pools/PoolsTableItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,6 @@ const PoolsTableItem = ({
<Td>
<Skeleton isLoaded={ !isLoading }>{ item.dex.name }</Skeleton>
</Td>
<Td isNumeric>
<Skeleton isLoaded={ !isLoading }>
${ Number(item.fully_diluted_valuation_usd).toLocaleString(undefined, { maximumFractionDigits: 2, notation: 'compact' }) }
</Skeleton>
</Td>
<Td isNumeric>
<Skeleton isLoaded={ !isLoading }>
${ Number(item.market_cap_usd).toLocaleString(undefined, { maximumFractionDigits: 2, notation: 'compact' }) }
</Skeleton>
</Td>
<Td isNumeric>
<Skeleton isLoaded={ !isLoading }>
${ Number(item.liquidity).toLocaleString(undefined, { maximumFractionDigits: 2, notation: 'compact' }) }
Expand Down
Loading