From 95b67c05e2f306ddd05f1b2c35ecef913149e249 Mon Sep 17 00:00:00 2001 From: mantikoros Date: Wed, 4 May 2022 11:47:45 -0400 Subject: [PATCH] another sell shares rounding bug --- web/components/amount-input.tsx | 5 +++-- web/components/bet-panel.tsx | 8 +++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/web/components/amount-input.tsx b/web/components/amount-input.tsx index d4724c2a..76111b6f 100644 --- a/web/components/amount-input.tsx +++ b/web/components/amount-input.tsx @@ -178,9 +178,10 @@ export function SellAmountInput(props: { ] const sellOutcome = yesShares ? 'YES' : noShares ? 'NO' : undefined - const shares = yesShares || noShares + const shares = Math.round(yesShares) || Math.round(noShares) + + const sharesSold = Math.min(amount ?? 0, shares) - const sharesSold = Math.min(amount ?? 0, yesShares || noShares) const { saleValue } = calculateCpmmSale( contract, sharesSold, diff --git a/web/components/bet-panel.tsx b/web/components/bet-panel.tsx index 677e0197..cff37929 100644 --- a/web/components/bet-panel.tsx +++ b/web/components/bet-panel.tsx @@ -432,7 +432,13 @@ export function SellPanel(props: {