Revert "Refinement of LiteMarket (#479)"

This reverts commit 9945738811.
This commit is contained in:
mantikoros 2022-06-14 12:06:22 -05:00
parent be777ba122
commit b08cdd495f
3 changed files with 11 additions and 23 deletions

View File

@ -95,20 +95,14 @@ Requires no authorization.
description: string
tags: string[]
url: string
outcomeType: string
mechanism: string
pool: number
probability?: number
p?: number
volume: number
probability: number
volume7Days: number
volume24Hours: number
isResolved: boolean
resolution?: string
resolutionTime?: number
resolution?: string
}
```

View File

@ -57,17 +57,11 @@ export function contractMetrics(contract: Contract) {
}
export function contractPool(contract: Contract) {
return getPoolValue(contract) === 0
? 'Empty Pool'
: formatMoney(getPoolValue(contract))
}
export function getPoolValue(contract: Contract) {
return contract.mechanism === 'cpmm-1'
? contract.totalLiquidity
? formatMoney(contract.totalLiquidity)
: contract.mechanism === 'dpm-2'
? sum(Object.values(contract.pool))
: 0
? formatMoney(sum(Object.values(contract.pool)))
: 'Empty pool'
}
export function getBinaryProb(contract: BinaryContract) {

View File

@ -1,10 +1,8 @@
import { Bet } from 'common/bet'
import { getProbability } from 'common/calculate'
import { Comment } from 'common/comment'
import { Contract, DPM } from 'common/contract'
import { Contract } from 'common/contract'
import { removeUndefinedProps } from 'common/util/object'
import { sum } from 'lodash'
import { getPoolValue } from 'web/lib/firebase/contracts'
export type LiteMarket = {
// Unique identifer for this market
@ -28,7 +26,7 @@ export type LiteMarket = {
pool: number
probability?: number
p?: number
totalShares?: number
totalLiquidity?: number
volume: number
volume7Days: number
@ -60,6 +58,7 @@ export function toLiteMarket(contract: Contract): LiteMarket {
description,
tags,
slug,
pool,
outcomeType,
mechanism,
volume,
@ -70,7 +69,7 @@ export function toLiteMarket(contract: Contract): LiteMarket {
resolutionTime,
} = contract
const { p } = contract as any
const { p, totalLiquidity } = contract as any
const probability =
contract.outcomeType === 'BINARY' ? getProbability(contract) : undefined
@ -89,9 +88,10 @@ export function toLiteMarket(contract: Contract): LiteMarket {
description,
tags,
url: `https://manifold.markets/${creatorUsername}/${slug}`,
pool: getPoolValue(contract),
pool: pool.YES + pool.NO,
probability,
p,
totalLiquidity,
outcomeType,
mechanism,
volume,