Display liquidity "pool" instead of "bet" volume
This commit is contained in:
parent
8715ff2740
commit
d5a362502a
|
@ -14,6 +14,7 @@ import { UserLink } from '../user-page'
|
|||
import {
|
||||
Contract,
|
||||
contractMetrics,
|
||||
contractPool,
|
||||
updateContract,
|
||||
} from 'web/lib/firebase/contracts'
|
||||
import { Col } from '../layout/col'
|
||||
|
@ -43,10 +44,6 @@ export function MiscDetails(props: {
|
|||
|
||||
return (
|
||||
<Row className="items-center gap-3 text-sm text-gray-400">
|
||||
{categories.length > 0 && (
|
||||
<TagsList className="text-gray-400" tags={categories} noLabel />
|
||||
)}
|
||||
|
||||
{showHotVolume ? (
|
||||
<Row className="gap-0.5">
|
||||
<TrendingUpIcon className="h-5 w-5" /> {formatMoney(volume24Hours)}
|
||||
|
@ -58,10 +55,14 @@ export function MiscDetails(props: {
|
|||
{fromNow(closeTime || 0)}
|
||||
</Row>
|
||||
) : volume > 0 ? (
|
||||
<Row>{volumeLabel}</Row>
|
||||
<Row>{contractPool(contract)} pool</Row>
|
||||
) : (
|
||||
<NewContractBadge />
|
||||
)}
|
||||
|
||||
{categories.length > 0 && (
|
||||
<TagsList className="text-gray-400" tags={categories} noLabel />
|
||||
)}
|
||||
</Row>
|
||||
)
|
||||
}
|
||||
|
|
|
@ -7,7 +7,12 @@ import { Bet } from 'common/bet'
|
|||
|
||||
import { Contract } from 'common/contract'
|
||||
import { formatMoney } from 'common/util/format'
|
||||
import { contractPath, getBinaryProbPercent } from 'web/lib/firebase/contracts'
|
||||
import {
|
||||
contractMetrics,
|
||||
contractPath,
|
||||
contractPool,
|
||||
getBinaryProbPercent,
|
||||
} from 'web/lib/firebase/contracts'
|
||||
import { AddLiquidityPanel } from '../add-liquidity-panel'
|
||||
import { CopyLinkButton } from '../copy-link-button'
|
||||
import { Col } from '../layout/col'
|
||||
|
@ -98,19 +103,10 @@ export function ContractInfoDialog(props: { contract: Contract; bets: Bet[] }) {
|
|||
<td>{tradersCount}</td>
|
||||
</tr>
|
||||
|
||||
{contract.mechanism === 'cpmm-1' && (
|
||||
<tr>
|
||||
<td>Liquidity</td>
|
||||
<td>{formatMoney(contract.totalLiquidity)}</td>
|
||||
</tr>
|
||||
)}
|
||||
|
||||
{contract.mechanism === 'dpm-2' && (
|
||||
<tr>
|
||||
<td>Pool</td>
|
||||
<td>{formatMoney(sum(Object.values(contract.pool)))}</td>
|
||||
<td>{contractPool(contract)}</td>
|
||||
</tr>
|
||||
)}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ import {
|
|||
updateDoc,
|
||||
limit,
|
||||
} from 'firebase/firestore'
|
||||
import { range, sortBy } from 'lodash'
|
||||
import { range, sortBy, sum } from 'lodash'
|
||||
|
||||
import { app } from './init'
|
||||
import { getValues, listenForValue, listenForValues } from './utils'
|
||||
|
@ -55,6 +55,14 @@ export function contractMetrics(contract: Contract) {
|
|||
return { volumeLabel, createdDate, resolvedDate }
|
||||
}
|
||||
|
||||
export function contractPool(contract: Contract) {
|
||||
return contract.mechanism === 'cpmm-1'
|
||||
? formatMoney(contract.totalLiquidity)
|
||||
: contract.mechanism === 'dpm-2'
|
||||
? formatMoney(sum(Object.values(contract.pool)))
|
||||
: 'Empty pool'
|
||||
}
|
||||
|
||||
export function getBinaryProb(contract: FullContract<any, Binary>) {
|
||||
const { totalShares, pool, p, resolutionProbability, mechanism } = contract
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user