Fix getBinaryProb when resolutionProbability is 0.

This commit is contained in:
James Grugett 2022-04-14 23:17:55 -05:00
parent 72a56b46fd
commit 87b54ff92e

View File

@ -49,9 +49,12 @@ export function contractMetrics(contract: Contract) {
export function getBinaryProb(contract: FullContract<any, Binary>) { export function getBinaryProb(contract: FullContract<any, Binary>) {
const { totalShares, pool, p, resolutionProbability, mechanism } = contract const { totalShares, pool, p, resolutionProbability, mechanism } = contract
return resolutionProbability ?? mechanism === 'cpmm-1' return (
? getCpmmProbability(pool, p) resolutionProbability ??
: getDpmProbability(totalShares) (mechanism === 'cpmm-1'
? getCpmmProbability(pool, p)
: getDpmProbability(totalShares))
)
} }
export function getBinaryProbPercent(contract: FullContract<any, Binary>) { export function getBinaryProbPercent(contract: FullContract<any, Binary>) {