Skip to content

Commit

Permalink
SOV-4493: Show ecosystem statistics only in BTC and USD (#1034)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
5 people authored Oct 31, 2024
1 parent d953df3 commit c426bb8
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 14 deletions.
5 changes: 5 additions & 0 deletions .changeset/mighty-swans-remember.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"frontend": patch
---

SOV-4493: Show ecosystem statistics only in BTC and USD
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,33 @@ import { t } from 'i18next';

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

import { RSK_CHAIN_ID } from '../../../../../config/chains';

import { AmountRenderer } from '../../../../2_molecules/AmountRenderer/AmountRenderer';
import { NativeTokenAmount } from '../../../../2_molecules/NativeTokenAmount/NativeTokenAmount';
import { BITCOIN, ETH, USD } from '../../../../../constants/currencies';
import { BITCOIN, USD } from '../../../../../constants/currencies';
import { useCurrentChain } from '../../../../../hooks/useChainStore';
import { translations } from '../../../../../locales/i18n';
import { isBobChain, isRskChain } from '../../../../../utils/chain';
import { isBobChain } from '../../../../../utils/chain';
import { useGetLockedData } from '../../../LandingPage/components/ProtocolData/hooks/useGetLockedData';
import { getCurrencyPrecision } from '../../../PortfolioPage/components/ProtocolSection/ProtocolSection.utils';
import { pageTranslations } from '../../ProtocolDataPage.constants';
import { ContractData } from './EcosystemStatistics.types';

const currencies = [BITCOIN, USD];

export const EcosystemStatistics: FC = () => {
const lockedData = useGetLockedData();

const chainId = useCurrentChain();

const currencies = useMemo(
() => (isRskChain(chainId) ? [BITCOIN, USD] : [ETH, USD]),
[chainId],
);
const [selectedCurrency, setSelectedCurrency] = useState(USD);

useEffect(() => {
if (!currencies.includes(selectedCurrency)) {
setSelectedCurrency(currencies[0]);
}
}, [currencies, selectedCurrency]);
}, [selectedCurrency]);

const totalValue = useMemo(() => {
if (isBobChain(chainId)) {
Expand Down Expand Up @@ -59,13 +60,10 @@ export const EcosystemStatistics: FC = () => {
lockedData.tvlZero?.totalUsd,
]);

const subTotalValue = useMemo(() => {
if (isBobChain(chainId)) {
return totalValue - Number(lockedData.tvlStaking?.totalUsd || 0);
} else {
return totalValue - Number(lockedData.tvlStaking?.totalUsd || 0);
}
}, [chainId, lockedData.tvlStaking?.totalUsd, totalValue]);
const subTotalValue = useMemo(
() => totalValue - Number(lockedData.tvlStaking?.totalUsd || 0),
[lockedData.tvlStaking?.totalUsd, totalValue],
);

const list: ContractData[] = useMemo(() => {
if (isBobChain(chainId)) {
Expand All @@ -83,6 +81,7 @@ export const EcosystemStatistics: FC = () => {
) : (
<NativeTokenAmount
usdValue={lockedData.tvlSdex?.totalUsd}
chainId={RSK_CHAIN_ID}
precision={getCurrencyPrecision(selectedCurrency)}
dataAttribute="ecosystem-statistics-sdex-contract-value"
/>
Expand All @@ -103,6 +102,7 @@ export const EcosystemStatistics: FC = () => {
) : (
<NativeTokenAmount
usdValue={lockedData.tvlStaking?.totalUsd}
chainId={RSK_CHAIN_ID}
precision={getCurrencyPrecision(selectedCurrency)}
dataAttribute="ecosystem-statistics-bitocracy-staking-value"
/>
Expand All @@ -121,6 +121,7 @@ export const EcosystemStatistics: FC = () => {
) : (
<NativeTokenAmount
usdValue={totalValue}
chainId={RSK_CHAIN_ID}
precision={getCurrencyPrecision(selectedCurrency)}
dataAttribute="ecosystem-statistics-total-value"
/>
Expand Down

0 comments on commit c426bb8

Please sign in to comment.