another sell shares rounding bug

This commit is contained in:
mantikoros 2022-05-04 11:47:45 -04:00
parent 5c18820d96
commit 95b67c05e2
2 changed files with 10 additions and 3 deletions

View File

@ -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,

View File

@ -432,7 +432,13 @@ export function SellPanel(props: {
<SellAmountInput
inputClassName="w-full"
contract={contract}
amount={amount ? Math.floor(amount) : undefined}
amount={
amount
? Math.round(amount) === 0
? 0
: Math.floor(amount)
: undefined
}
onChange={setAmount}
userBets={userBets}
error={error}