From 93ceaa52c4bc3cd62475858fd370b0d6a88912a8 Mon Sep 17 00:00:00 2001 From: mantikoros Date: Wed, 12 Oct 2022 14:24:47 -0500 Subject: [PATCH] payouts: fix subsidyPool undefined bug --- common/payouts-fixed.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/common/payouts-fixed.ts b/common/payouts-fixed.ts index 74e9fe16..a08a5acf 100644 --- a/common/payouts-fixed.ts +++ b/common/payouts-fixed.ts @@ -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)