const for binary resolutions
This commit is contained in:
parent
fba083cead
commit
01adc91a67
|
@ -92,6 +92,7 @@ export type Numeric = {
|
|||
|
||||
export type outcomeType = AnyOutcomeType['outcomeType']
|
||||
export type resolution = 'YES' | 'NO' | 'MKT' | 'CANCEL'
|
||||
export const RESOLUTIONS = ['YES', 'NO', 'MKT', 'CANCEL'] as const
|
||||
export const OUTCOME_TYPES = ['BINARY', 'FREE_RESPONSE', 'NUMERIC'] as const
|
||||
export const MAX_QUESTION_LENGTH = 480
|
||||
export const MAX_DESCRIPTION_LENGTH = 10000
|
||||
|
|
|
@ -2,7 +2,7 @@ import * as functions from 'firebase-functions'
|
|||
import * as admin from 'firebase-admin'
|
||||
import { difference, uniq, mapValues, groupBy, sumBy } from 'lodash'
|
||||
|
||||
import { Contract } from '../../common/contract'
|
||||
import { Contract, resolution, RESOLUTIONS } from '../../common/contract'
|
||||
import { User } from '../../common/user'
|
||||
import { Bet } from '../../common/bet'
|
||||
import { getUser, isProd, payUser } from './utils'
|
||||
|
@ -21,7 +21,7 @@ export const resolveMarket = functions
|
|||
.https.onCall(
|
||||
async (
|
||||
data: {
|
||||
outcome: string
|
||||
outcome: resolution
|
||||
value?: number
|
||||
contractId: string
|
||||
probabilityInt?: number
|
||||
|
@ -42,7 +42,7 @@ export const resolveMarket = functions
|
|||
const { creatorId, outcomeType, closeTime } = contract
|
||||
|
||||
if (outcomeType === 'BINARY') {
|
||||
if (!['YES', 'NO', 'MKT', 'CANCEL'].includes(outcome))
|
||||
if (!RESOLUTIONS.includes(outcome))
|
||||
return { status: 'error', message: 'Invalid outcome' }
|
||||
} else if (outcomeType === 'FREE_RESPONSE') {
|
||||
if (
|
||||
|
|
Loading…
Reference in New Issue
Block a user