Numeric contract type

This commit is contained in:
James Grugett 2022-05-06 11:54:04 -04:00
parent 87b43e6bdb
commit dd79491411

View File

@ -1,9 +1,10 @@
import _ from 'lodash'
import { Answer } from './answer' import { Answer } from './answer'
import { Fees } from './fees' import { Fees } from './fees'
export type FullContract< export type FullContract<
M extends DPM | CPMM, M extends DPM | CPMM,
T extends Binary | Multi | FreeResponse T extends Binary | Multi | FreeResponse | Numeric
> = { > = {
id: string id: string
slug: string // auto-generated; must be unique slug: string // auto-generated; must be unique
@ -42,6 +43,7 @@ export type FullContract<
export type Contract = FullContract<DPM | CPMM, Binary | Multi | FreeResponse> export type Contract = FullContract<DPM | CPMM, Binary | Multi | FreeResponse>
export type BinaryContract = FullContract<DPM | CPMM, Binary> export type BinaryContract = FullContract<DPM | CPMM, Binary>
export type FreeResponseContract = FullContract<DPM | CPMM, FreeResponse> export type FreeResponseContract = FullContract<DPM | CPMM, FreeResponse>
export type NumericContract = FullContract<DPM, Numeric>
export type DPM = { export type DPM = {
mechanism: 'dpm-2' mechanism: 'dpm-2'
@ -81,7 +83,16 @@ export type FreeResponse = {
resolutions?: { [outcome: string]: number } // Used for MKT resolution. resolutions?: { [outcome: string]: number } // Used for MKT resolution.
} }
export type outcomeType = 'BINARY' | 'MULTI' | 'FREE_RESPONSE' export type Numeric = {
outcomeType: 'NUMERIC'
bucketCount: number
min: number
max: number
}
export type outcomeType = 'BINARY' | 'MULTI' | 'FREE_RESPONSE' | 'NUMERIC'
export const numericOutcomes = _.range(0, 1000)
export const MAX_QUESTION_LENGTH = 480 export const MAX_QUESTION_LENGTH = 480
export const MAX_DESCRIPTION_LENGTH = 10000 export const MAX_DESCRIPTION_LENGTH = 10000