Don't accidentally make meaningless zero bets (#619)
This commit is contained in:
parent
4d1c50a6cc
commit
5eca9def9d
|
@ -21,6 +21,9 @@ export const redeemShares = async (userId: string, contractId: string) => {
|
|||
const betsSnap = await trans.get(betsColl.where('userId', '==', userId))
|
||||
const bets = betsSnap.docs.map((doc) => doc.data() as Bet)
|
||||
const { shares, loanPayment, netAmount } = getRedeemableAmount(bets)
|
||||
if (netAmount === 0) {
|
||||
return { status: 'success' }
|
||||
}
|
||||
const [yesBet, noBet] = getRedemptionBets(shares, loanPayment, contract)
|
||||
|
||||
const userDoc = firestore.doc(`users/${userId}`)
|
||||
|
|
Loading…
Reference in New Issue
Block a user