payouts: fix subsidyPool undefined bug

This commit is contained in:
mantikoros 2022-10-12 14:24:47 -05:00
parent de76557326
commit 93ceaa52c4

View File

@ -56,7 +56,8 @@ export const getLiquidityPoolPayouts = (
liquidities: LiquidityProvision[]
) => {
const { pool, subsidyPool } = contract
const finalPool = pool[outcome] + subsidyPool
const finalPool = pool[outcome] + (subsidyPool ?? 0)
if (finalPool < 1e-3) return []
const weights = getCpmmLiquidityPoolWeights(liquidities)
@ -95,7 +96,8 @@ export const getLiquidityPoolProbPayouts = (
liquidities: LiquidityProvision[]
) => {
const { pool, subsidyPool } = contract
const finalPool = p * pool.YES + (1 - p) * pool.NO + subsidyPool
const finalPool = p * pool.YES + (1 - p) * pool.NO + (subsidyPool ?? 0)
if (finalPool < 1e-3) return []
const weights = getCpmmLiquidityPoolWeights(liquidities)