diff --git a/web/components/contract-card.tsx b/web/components/contract-card.tsx index 36bfd26b..33c00ff5 100644 --- a/web/components/contract-card.tsx +++ b/web/components/contract-card.tsx @@ -20,6 +20,7 @@ import { Avatar } from './avatar' import { Spacer } from './layout/spacer' import { useState } from 'react' import { TweetButton } from './tweet-button' +import { getCpmmLiquidity } from '../../common/calculate-cpmm' export function ContractCard(props: { contract: Contract @@ -125,7 +126,7 @@ function AbbrContractDetails(props: { }) { const { contract, showHotVolume, showCloseTime } = props const { volume24Hours, creatorName, creatorUsername, closeTime } = contract - const { truePool } = contractMetrics(contract) + const { liquidityLabel } = contractMetrics(contract) return ( @@ -156,7 +157,7 @@ function AbbrContractDetails(props: { ) : ( {/* */} - {formatMoney(truePool)} pool + {liquidityLabel} )} @@ -170,7 +171,8 @@ export function ContractDetails(props: { }) { const { contract, isCreator } = props const { closeTime, creatorName, creatorUsername } = contract - const { truePool, createdDate, resolvedDate } = contractMetrics(contract) + const { liquidityLabel, createdDate, resolvedDate } = + contractMetrics(contract) const tweetText = getTweetText(contract, !!isCreator) @@ -224,7 +226,7 @@ export function ContractDetails(props: { -
{formatMoney(truePool)} pool
+
{liquidityLabel}
@@ -236,7 +238,8 @@ export function ContractDetails(props: { // String version of the above, to send to the OpenGraph image generator export function contractTextDetails(contract: Contract) { const { closeTime, tags } = contract - const { truePool, createdDate, resolvedDate } = contractMetrics(contract) + const { createdDate, resolvedDate, liquidityLabel } = + contractMetrics(contract) const hashtags = tags.map((tag) => `#${tag}`) @@ -247,7 +250,7 @@ export function contractTextDetails(contract: Contract) { closeTime ).format('MMM D, h:mma')}` : '') + - ` • ${formatMoney(truePool)} pool` + + ` • ${liquidityLabel}` + (hashtags.length > 0 ? ` • ${hashtags.join(' ')}` : '') ) } diff --git a/web/components/contract-feed.tsx b/web/components/contract-feed.tsx index b243a15d..5453439c 100644 --- a/web/components/contract-feed.tsx +++ b/web/components/contract-feed.tsx @@ -43,6 +43,7 @@ import { parseTags } from '../../common/util/parse' import { Avatar } from './avatar' import { useAdmin } from '../hooks/use-admin' import { FreeResponse, FullContract } from '../../common/contract' +import { getCpmmLiquidity } from '../../common/calculate-cpmm' function FeedComment(props: { activityItem: any @@ -312,7 +313,7 @@ function FeedQuestion(props: { const { contract, showDescription } = props const { creatorName, creatorUsername, question, resolution, outcomeType } = contract - const { truePool } = contractMetrics(contract) + const { liquidityLabel } = contractMetrics(contract) const isBinary = outcomeType === 'BINARY' const closeMessage = @@ -340,7 +341,7 @@ function FeedQuestion(props: { asked {/* Currently hidden on mobile; ideally we'd fit this in somewhere. */} - {formatMoney(truePool)} pool + {liquidityLabel} {closeMessage} diff --git a/web/lib/firebase/contracts.ts b/web/lib/firebase/contracts.ts index 7227f4fc..9b84090c 100644 --- a/web/lib/firebase/contracts.ts +++ b/web/lib/firebase/contracts.ts @@ -21,6 +21,8 @@ import { Binary, Contract, FullContract } from '../../../common/contract' import { getDpmProbability } from '../../../common/calculate-dpm' import { createRNG, shuffle } from '../../../common/util/random' import { getCpmmProbability } from '../../../common/calculate-cpmm' +import { formatMoney } from '../../../common/util/format' +import { getCpmmLiquidity } from '../../../common/calculate-cpmm' export type { Contract } export function contractPath(contract: Contract) { @@ -38,7 +40,12 @@ export function contractMetrics(contract: Contract) { ? dayjs(resolutionTime).format('MMM D') : undefined - return { truePool, createdDate, resolvedDate } + const liquidityLabel = + contract.mechanism === 'dpm-2' + ? `${formatMoney(truePool)} pool` + : `${formatMoney(getCpmmLiquidity(contract.pool))} liquidity` + + return { truePool, liquidityLabel, createdDate, resolvedDate } } export function getBinaryProbPercent(contract: FullContract) {