Allow people to sell all their shares (#599)
This commit is contained in:
parent
f0fbdf1b42
commit
7f2bbdcb87
|
@ -46,7 +46,7 @@ export const sellshares = newEndpoint({}, async (req, auth) => {
|
||||||
const outcomeBets = userBets.filter((bet) => bet.outcome == outcome)
|
const outcomeBets = userBets.filter((bet) => bet.outcome == outcome)
|
||||||
const maxShares = sumBy(outcomeBets, (bet) => bet.shares)
|
const maxShares = sumBy(outcomeBets, (bet) => bet.shares)
|
||||||
|
|
||||||
if (shares > maxShares + 0.000000000001)
|
if (shares > maxShares)
|
||||||
throw new APIError(400, `You can only sell up to ${maxShares} shares.`)
|
throw new APIError(400, `You can only sell up to ${maxShares} shares.`)
|
||||||
|
|
||||||
const { newBet, newPool, newP, fees } = getCpmmSellBetInfo(
|
const { newBet, newPool, newP, fees } = getCpmmSellBetInfo(
|
||||||
|
|
Loading…
Reference in New Issue
Block a user