1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-12-02 05:57:29 +01:00

output total pool liquidity value

This commit is contained in:
Matthias Kretschmann 2020-10-06 22:50:52 +02:00
parent ba39cfe653
commit 79ccff7905
Signed by: m
GPG Key ID: 606EEEF3C479A91F
3 changed files with 52 additions and 11 deletions

View File

@ -0,0 +1,6 @@
.statistics {
}
.title {
composes: title from './index.module.css';
}

View File

@ -0,0 +1,36 @@
import { useUserPreferences } from '../../../../providers/UserPreferences'
import React, { ReactElement } from 'react'
import { Balance } from '.'
import styles from './PoolStatistics.module.css'
import Token from './Token'
import Conversion from '../../../atoms/Price/Conversion'
export default function PoolStatistics({
price,
dtSymbol,
totalBalance,
totalPoolTokens,
swapFee
}: {
price: string
dtSymbol: string
totalBalance: Balance
totalPoolTokens: string
swapFee: string
}): ReactElement {
const { debug } = useUserPreferences()
const totalLiquidityInOcean =
Number(totalBalance.ocean) + Number(totalBalance.dt) * Number(price)
return (
<div className={styles.statistics}>
<h3 className={styles.title}>Pool Statistics</h3>
<Token symbol="OCEAN" balance={totalBalance.ocean} />
<Token symbol={dtSymbol} balance={totalBalance.dt} />
{debug === true && <Token symbol="BPT" balance={totalPoolTokens} />}
<Token symbol="% swap fee" balance={swapFee} />
<Conversion price={`${totalLiquidityInOcean}`} />
</div>
)
}

View File

@ -3,7 +3,7 @@ import { useOcean, useMetadata } from '@oceanprotocol/react'
import { DDO } from '@oceanprotocol/lib'
import styles from './index.module.css'
import stylesActions from './Actions.module.css'
import Token from './Token'
import { useUserPreferences } from '../../../../providers/UserPreferences'
import PriceUnit from '../../../atoms/Price/PriceUnit'
import Loader from '../../../atoms/Loader'
import Button from '../../../atoms/Button'
@ -12,7 +12,8 @@ import Remove from './Remove'
import Tooltip from '../../../atoms/Tooltip'
import Conversion from '../../../atoms/Price/Conversion'
import EtherscanLink from '../../../atoms/EtherscanLink'
import { useUserPreferences } from '../../../../providers/UserPreferences'
import PoolStatistics from './PoolStatistics'
import Token from './Token'
export interface Balance {
ocean: string
@ -163,15 +164,13 @@ export default function Pool({ ddo }: { ddo: DDO }): ReactElement {
<Token symbol="% of pool" balance={poolShare} />
</div>
<div className={styles.tokens}>
<h3 className={styles.title}>Pool Statistics</h3>
<Token symbol="OCEAN" balance={totalBalance.ocean} />
<Token symbol={dtSymbol} balance={totalBalance.dt} />
{debug === true && (
<Token symbol="BPT" balance={totalPoolTokens} />
)}
<Token symbol="% swap fee" balance={swapFee} />
</div>
<PoolStatistics
price={price.value}
totalPoolTokens={totalPoolTokens}
totalBalance={totalBalance}
swapFee={swapFee}
dtSymbol={dtSymbol}
/>
</div>
<div className={stylesActions.actions}>