@@ -5,32 +5,33 @@ import { t } from 'i18next';
5
5
6
6
import { Button , ButtonStyle , Paragraph } from '@sovryn/ui' ;
7
7
8
+ import { RSK_CHAIN_ID } from '../../../../../config/chains' ;
9
+
8
10
import { AmountRenderer } from '../../../../2_molecules/AmountRenderer/AmountRenderer' ;
9
11
import { NativeTokenAmount } from '../../../../2_molecules/NativeTokenAmount/NativeTokenAmount' ;
10
- import { BITCOIN , ETH , USD } from '../../../../../constants/currencies' ;
12
+ import { BITCOIN , USD } from '../../../../../constants/currencies' ;
11
13
import { useCurrentChain } from '../../../../../hooks/useChainStore' ;
12
14
import { translations } from '../../../../../locales/i18n' ;
13
- import { isBobChain , isRskChain } from '../../../../../utils/chain' ;
15
+ import { isBobChain } from '../../../../../utils/chain' ;
14
16
import { useGetLockedData } from '../../../LandingPage/components/ProtocolData/hooks/useGetLockedData' ;
15
17
import { getCurrencyPrecision } from '../../../PortfolioPage/components/ProtocolSection/ProtocolSection.utils' ;
16
18
import { pageTranslations } from '../../ProtocolDataPage.constants' ;
17
19
import { ContractData } from './EcosystemStatistics.types' ;
18
20
21
+ const currencies = [ BITCOIN , USD ] ;
22
+
19
23
export const EcosystemStatistics : FC = ( ) => {
20
24
const lockedData = useGetLockedData ( ) ;
25
+
21
26
const chainId = useCurrentChain ( ) ;
22
27
23
- const currencies = useMemo (
24
- ( ) => ( isRskChain ( chainId ) ? [ BITCOIN , USD ] : [ ETH , USD ] ) ,
25
- [ chainId ] ,
26
- ) ;
27
28
const [ selectedCurrency , setSelectedCurrency ] = useState ( USD ) ;
28
29
29
30
useEffect ( ( ) => {
30
31
if ( ! currencies . includes ( selectedCurrency ) ) {
31
32
setSelectedCurrency ( currencies [ 0 ] ) ;
32
33
}
33
- } , [ currencies , selectedCurrency ] ) ;
34
+ } , [ selectedCurrency ] ) ;
34
35
35
36
const totalValue = useMemo ( ( ) => {
36
37
if ( isBobChain ( chainId ) ) {
@@ -59,13 +60,10 @@ export const EcosystemStatistics: FC = () => {
59
60
lockedData . tvlZero ?. totalUsd ,
60
61
] ) ;
61
62
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
+ ) ;
69
67
70
68
const list : ContractData [ ] = useMemo ( ( ) => {
71
69
if ( isBobChain ( chainId ) ) {
@@ -83,6 +81,7 @@ export const EcosystemStatistics: FC = () => {
83
81
) : (
84
82
< NativeTokenAmount
85
83
usdValue = { lockedData . tvlSdex ?. totalUsd }
84
+ chainId = { RSK_CHAIN_ID }
86
85
precision = { getCurrencyPrecision ( selectedCurrency ) }
87
86
dataAttribute = "ecosystem-statistics-sdex-contract-value"
88
87
/>
@@ -103,6 +102,7 @@ export const EcosystemStatistics: FC = () => {
103
102
) : (
104
103
< NativeTokenAmount
105
104
usdValue = { lockedData . tvlStaking ?. totalUsd }
105
+ chainId = { RSK_CHAIN_ID }
106
106
precision = { getCurrencyPrecision ( selectedCurrency ) }
107
107
dataAttribute = "ecosystem-statistics-bitocracy-staking-value"
108
108
/>
@@ -121,6 +121,7 @@ export const EcosystemStatistics: FC = () => {
121
121
) : (
122
122
< NativeTokenAmount
123
123
usdValue = { totalValue }
124
+ chainId = { RSK_CHAIN_ID }
124
125
precision = { getCurrencyPrecision ( selectedCurrency ) }
125
126
dataAttribute = "ecosystem-statistics-total-value"
126
127
/>
0 commit comments