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 { Spacer } from './layout/spacer'
|
||||||
import { useState } from 'react'
|
import { useState } from 'react'
|
||||||
import { TweetButton } from './tweet-button'
|
import { TweetButton } from './tweet-button'
|
||||||
|
import { getCpmmLiquidity } from '../../common/calculate-cpmm'
|
||||||
|
|
||||||
export function ContractCard(props: {
|
export function ContractCard(props: {
|
||||||
contract: Contract
|
contract: Contract
|
||||||
|
@ -125,7 +126,7 @@ function AbbrContractDetails(props: {
|
||||||
}) {
|
}) {
|
||||||
const { contract, showHotVolume, showCloseTime } = props
|
const { contract, showHotVolume, showCloseTime } = props
|
||||||
const { volume24Hours, creatorName, creatorUsername, closeTime } = contract
|
const { volume24Hours, creatorName, creatorUsername, closeTime } = contract
|
||||||
const { truePool } = contractMetrics(contract)
|
const { liquidityLabel } = contractMetrics(contract)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Col className={clsx('gap-2 text-sm text-gray-500')}>
|
<Col className={clsx('gap-2 text-sm text-gray-500')}>
|
||||||
|
@ -156,7 +157,7 @@ function AbbrContractDetails(props: {
|
||||||
) : (
|
) : (
|
||||||
<Row className="gap-1">
|
<Row className="gap-1">
|
||||||
{/* <DatabaseIcon className="h-5 w-5" /> */}
|
{/* <DatabaseIcon className="h-5 w-5" /> */}
|
||||||
{formatMoney(truePool)} pool
|
{liquidityLabel}
|
||||||
</Row>
|
</Row>
|
||||||
)}
|
)}
|
||||||
</Row>
|
</Row>
|
||||||
|
@ -170,7 +171,8 @@ export function ContractDetails(props: {
|
||||||
}) {
|
}) {
|
||||||
const { contract, isCreator } = props
|
const { contract, isCreator } = props
|
||||||
const { closeTime, creatorName, creatorUsername } = contract
|
const { closeTime, creatorName, creatorUsername } = contract
|
||||||
const { truePool, createdDate, resolvedDate } = contractMetrics(contract)
|
const { liquidityLabel, createdDate, resolvedDate } =
|
||||||
|
contractMetrics(contract)
|
||||||
|
|
||||||
const tweetText = getTweetText(contract, !!isCreator)
|
const tweetText = getTweetText(contract, !!isCreator)
|
||||||
|
|
||||||
|
@ -224,7 +226,7 @@ export function ContractDetails(props: {
|
||||||
<Row className="items-center gap-1">
|
<Row className="items-center gap-1">
|
||||||
<DatabaseIcon className="h-5 w-5" />
|
<DatabaseIcon className="h-5 w-5" />
|
||||||
|
|
||||||
<div className="whitespace-nowrap">{formatMoney(truePool)} pool</div>
|
<div className="whitespace-nowrap">{liquidityLabel}</div>
|
||||||
</Row>
|
</Row>
|
||||||
|
|
||||||
<TweetButton className={'self-end'} tweetText={tweetText} />
|
<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
|
// String version of the above, to send to the OpenGraph image generator
|
||||||
export function contractTextDetails(contract: Contract) {
|
export function contractTextDetails(contract: Contract) {
|
||||||
const { closeTime, tags } = contract
|
const { closeTime, tags } = contract
|
||||||
const { truePool, createdDate, resolvedDate } = contractMetrics(contract)
|
const { createdDate, resolvedDate, liquidityLabel } =
|
||||||
|
contractMetrics(contract)
|
||||||
|
|
||||||
const hashtags = tags.map((tag) => `#${tag}`)
|
const hashtags = tags.map((tag) => `#${tag}`)
|
||||||
|
|
||||||
|
@ -247,7 +250,7 @@ export function contractTextDetails(contract: Contract) {
|
||||||
closeTime
|
closeTime
|
||||||
).format('MMM D, h:mma')}`
|
).format('MMM D, h:mma')}`
|
||||||
: '') +
|
: '') +
|
||||||
` • ${formatMoney(truePool)} pool` +
|
` • ${liquidityLabel}` +
|
||||||
(hashtags.length > 0 ? ` • ${hashtags.join(' ')}` : '')
|
(hashtags.length > 0 ? ` • ${hashtags.join(' ')}` : '')
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,6 +43,7 @@ import { parseTags } from '../../common/util/parse'
|
||||||
import { Avatar } from './avatar'
|
import { Avatar } from './avatar'
|
||||||
import { useAdmin } from '../hooks/use-admin'
|
import { useAdmin } from '../hooks/use-admin'
|
||||||
import { FreeResponse, FullContract } from '../../common/contract'
|
import { FreeResponse, FullContract } from '../../common/contract'
|
||||||
|
import { getCpmmLiquidity } from '../../common/calculate-cpmm'
|
||||||
|
|
||||||
function FeedComment(props: {
|
function FeedComment(props: {
|
||||||
activityItem: any
|
activityItem: any
|
||||||
|
@ -312,7 +313,7 @@ function FeedQuestion(props: {
|
||||||
const { contract, showDescription } = props
|
const { contract, showDescription } = props
|
||||||
const { creatorName, creatorUsername, question, resolution, outcomeType } =
|
const { creatorName, creatorUsername, question, resolution, outcomeType } =
|
||||||
contract
|
contract
|
||||||
const { truePool } = contractMetrics(contract)
|
const { liquidityLabel } = contractMetrics(contract)
|
||||||
const isBinary = outcomeType === 'BINARY'
|
const isBinary = outcomeType === 'BINARY'
|
||||||
|
|
||||||
const closeMessage =
|
const closeMessage =
|
||||||
|
@ -340,7 +341,7 @@ function FeedQuestion(props: {
|
||||||
asked
|
asked
|
||||||
{/* Currently hidden on mobile; ideally we'd fit this in somewhere. */}
|
{/* Currently hidden on mobile; ideally we'd fit this in somewhere. */}
|
||||||
<span className="float-right hidden text-gray-400 sm:inline">
|
<span className="float-right hidden text-gray-400 sm:inline">
|
||||||
{formatMoney(truePool)} pool
|
{liquidityLabel}
|
||||||
{closeMessage}
|
{closeMessage}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -21,6 +21,8 @@ import { Binary, Contract, FullContract } from '../../../common/contract'
|
||||||
import { getDpmProbability } from '../../../common/calculate-dpm'
|
import { getDpmProbability } from '../../../common/calculate-dpm'
|
||||||
import { createRNG, shuffle } from '../../../common/util/random'
|
import { createRNG, shuffle } from '../../../common/util/random'
|
||||||
import { getCpmmProbability } from '../../../common/calculate-cpmm'
|
import { getCpmmProbability } from '../../../common/calculate-cpmm'
|
||||||
|
import { formatMoney } from '../../../common/util/format'
|
||||||
|
import { getCpmmLiquidity } from '../../../common/calculate-cpmm'
|
||||||
export type { Contract }
|
export type { Contract }
|
||||||
|
|
||||||
export function contractPath(contract: Contract) {
|
export function contractPath(contract: Contract) {
|
||||||
|
@ -38,7 +40,12 @@ export function contractMetrics(contract: Contract) {
|
||||||
? dayjs(resolutionTime).format('MMM D')
|
? dayjs(resolutionTime).format('MMM D')
|
||||||
: undefined
|
: 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>) {
|
export function getBinaryProbPercent(contract: FullContract<any, Binary>) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user