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 description: string
tags: string[] tags: string[]
url: string url: string
outcomeType: string
mechanism: string
pool: number pool: number
probability?: number probability: number
p?: number
volume: number
volume7Days: number volume7Days: number
volume24Hours: number volume24Hours: number
isResolved: boolean isResolved: boolean
resolution?: string
resolutionTime?: number resolutionTime?: number
resolution?: string
} }
``` ```

View File

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

View File

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