Skip to content

Commit c426bb8

Browse files
tiltompietro-maximoffcreed-victorgithub-actions[bot]
authoredOct 31, 2024
SOV-4493: Show ecosystem statistics only in BTC and USD (#1034)
* SOV-4445: Runes page Updates (#1028) * chore: update rune symbols * Create neat-humans-develop.md * chore: update styles for dog * SOV-4496: add LST pools (#1029) * chore: SOV-4496 add new pools * chore: add background to asset * Version Packages (#1030) Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> * Fix asset icon styles (#1032) * chore: fix asset icon styles * Create gentle-schools-fetch.md * Show ecosystem statistics only in BTC and USD * Create mighty-swans-remember.md * Force rebuild --------- Co-authored-by: Pietro <[email protected]> Co-authored-by: Victor Creed <[email protected]> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent d953df3 commit c426bb8

File tree

2 files changed

+20
-14
lines changed

2 files changed

+20
-14
lines changed
 

‎.changeset/mighty-swans-remember.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"frontend": patch
3+
---
4+
5+
SOV-4493: Show ecosystem statistics only in BTC and USD

‎apps/frontend/src/app/5_pages/ProtocolDataPage/components/EcosystemStatistics/EcosystemStatistics.tsx

+15-14
Original file line numberDiff line numberDiff line change
@@ -5,32 +5,33 @@ import { t } from 'i18next';
55

66
import { Button, ButtonStyle, Paragraph } from '@sovryn/ui';
77

8+
import { RSK_CHAIN_ID } from '../../../../../config/chains';
9+
810
import { AmountRenderer } from '../../../../2_molecules/AmountRenderer/AmountRenderer';
911
import { NativeTokenAmount } from '../../../../2_molecules/NativeTokenAmount/NativeTokenAmount';
10-
import { BITCOIN, ETH, USD } from '../../../../../constants/currencies';
12+
import { BITCOIN, USD } from '../../../../../constants/currencies';
1113
import { useCurrentChain } from '../../../../../hooks/useChainStore';
1214
import { translations } from '../../../../../locales/i18n';
13-
import { isBobChain, isRskChain } from '../../../../../utils/chain';
15+
import { isBobChain } from '../../../../../utils/chain';
1416
import { useGetLockedData } from '../../../LandingPage/components/ProtocolData/hooks/useGetLockedData';
1517
import { getCurrencyPrecision } from '../../../PortfolioPage/components/ProtocolSection/ProtocolSection.utils';
1618
import { pageTranslations } from '../../ProtocolDataPage.constants';
1719
import { ContractData } from './EcosystemStatistics.types';
1820

21+
const currencies = [BITCOIN, USD];
22+
1923
export const EcosystemStatistics: FC = () => {
2024
const lockedData = useGetLockedData();
25+
2126
const chainId = useCurrentChain();
2227

23-
const currencies = useMemo(
24-
() => (isRskChain(chainId) ? [BITCOIN, USD] : [ETH, USD]),
25-
[chainId],
26-
);
2728
const [selectedCurrency, setSelectedCurrency] = useState(USD);
2829

2930
useEffect(() => {
3031
if (!currencies.includes(selectedCurrency)) {
3132
setSelectedCurrency(currencies[0]);
3233
}
33-
}, [currencies, selectedCurrency]);
34+
}, [selectedCurrency]);
3435

3536
const totalValue = useMemo(() => {
3637
if (isBobChain(chainId)) {
@@ -59,13 +60,10 @@ export const EcosystemStatistics: FC = () => {
5960
lockedData.tvlZero?.totalUsd,
6061
]);
6162

62-
const subTotalValue = useMemo(() => {
63-
if (isBobChain(chainId)) {
64-
return totalValue - Number(lockedData.tvlStaking?.totalUsd || 0);
65-
} else {
66-
return totalValue - Number(lockedData.tvlStaking?.totalUsd || 0);
67-
}
68-
}, [chainId, lockedData.tvlStaking?.totalUsd, totalValue]);
63+
const subTotalValue = useMemo(
64+
() => totalValue - Number(lockedData.tvlStaking?.totalUsd || 0),
65+
[lockedData.tvlStaking?.totalUsd, totalValue],
66+
);
6967

7068
const list: ContractData[] = useMemo(() => {
7169
if (isBobChain(chainId)) {
@@ -83,6 +81,7 @@ export const EcosystemStatistics: FC = () => {
8381
) : (
8482
<NativeTokenAmount
8583
usdValue={lockedData.tvlSdex?.totalUsd}
84+
chainId={RSK_CHAIN_ID}
8685
precision={getCurrencyPrecision(selectedCurrency)}
8786
dataAttribute="ecosystem-statistics-sdex-contract-value"
8887
/>
@@ -103,6 +102,7 @@ export const EcosystemStatistics: FC = () => {
103102
) : (
104103
<NativeTokenAmount
105104
usdValue={lockedData.tvlStaking?.totalUsd}
105+
chainId={RSK_CHAIN_ID}
106106
precision={getCurrencyPrecision(selectedCurrency)}
107107
dataAttribute="ecosystem-statistics-bitocracy-staking-value"
108108
/>
@@ -121,6 +121,7 @@ export const EcosystemStatistics: FC = () => {
121121
) : (
122122
<NativeTokenAmount
123123
usdValue={totalValue}
124+
chainId={RSK_CHAIN_ID}
124125
precision={getCurrencyPrecision(selectedCurrency)}
125126
dataAttribute="ecosystem-statistics-total-value"
126127
/>

0 commit comments

Comments
 (0)