liquidity label
This commit is contained in:
parent
5fe40786ca
commit
87747d8fcb
|
@ -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 (
|
||||
<Col className={clsx('gap-2 text-sm text-gray-500')}>
|
||||
|
@ -156,7 +157,7 @@ function AbbrContractDetails(props: {
|
|||
) : (
|
||||
<Row className="gap-1">
|
||||
{/* <DatabaseIcon className="h-5 w-5" /> */}
|
||||
{formatMoney(truePool)} pool
|
||||
{liquidityLabel}
|
||||
</Row>
|
||||
)}
|
||||
</Row>
|
||||
|
@ -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: {
|
|||
<Row className="items-center gap-1">
|
||||
<DatabaseIcon className="h-5 w-5" />
|
||||
|
||||
<div className="whitespace-nowrap">{formatMoney(truePool)} pool</div>
|
||||
<div className="whitespace-nowrap">{liquidityLabel}</div>
|
||||
</Row>
|
||||
|
||||
<TweetButton className={'self-end'} tweetText={tweetText} />
|
||||
|
@ -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(' ')}` : '')
|
||||
)
|
||||
}
|
||||
|
|
|
@ -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. */}
|
||||
<span className="float-right hidden text-gray-400 sm:inline">
|
||||
{formatMoney(truePool)} pool
|
||||
{liquidityLabel}
|
||||
{closeMessage}
|
||||
</span>
|
||||
</div>
|
||||
|
|
|
@ -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<any, Binary>) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user