From 012fb315430234bf0396c0efb8a08134139a724a Mon Sep 17 00:00:00 2001 From: mantikoros Date: Wed, 27 Jul 2022 18:44:24 -0700 Subject: [PATCH] update place bet --- common/new-bet.ts | 3 ++- functions/src/place-bet.ts | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/common/new-bet.ts b/common/new-bet.ts index 1f5c0340..576f35f8 100644 --- a/common/new-bet.ts +++ b/common/new-bet.ts @@ -18,6 +18,7 @@ import { CPMMBinaryContract, DPMBinaryContract, FreeResponseContract, + MultipleChoiceContract, NumericContract, PseudoNumericContract, } from './contract' @@ -322,7 +323,7 @@ export const getNewBinaryDpmBetInfo = ( export const getNewMultiBetInfo = ( outcome: string, amount: number, - contract: FreeResponseContract, + contract: FreeResponseContract | MultipleChoiceContract, loanAmount: number ) => { const { pool, totalShares, totalBets } = contract diff --git a/functions/src/place-bet.ts b/functions/src/place-bet.ts index 97ff9780..7501309a 100644 --- a/functions/src/place-bet.ts +++ b/functions/src/place-bet.ts @@ -96,7 +96,10 @@ export const placebet = newEndpoint({}, async (req, auth) => { limitProb, unfilledBets ) - } else if (outcomeType == 'FREE_RESPONSE' && mechanism == 'dpm-2') { + } else if ( + (outcomeType == 'FREE_RESPONSE' || outcomeType === 'MULTIPLE_CHOICE') && + mechanism == 'dpm-2' + ) { const { outcome } = validate(freeResponseSchema, req.body) const answerDoc = contractDoc.collection('answers').doc(outcome) const answerSnap = await trans.get(answerDoc)