From dd79491411e8bf4818738c4cfa45d900840886bb Mon Sep 17 00:00:00 2001 From: James Grugett Date: Fri, 6 May 2022 11:54:04 -0400 Subject: [PATCH] Numeric contract type --- common/contract.ts | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/common/contract.ts b/common/contract.ts index ee3034de..5ed263b7 100644 --- a/common/contract.ts +++ b/common/contract.ts @@ -1,9 +1,10 @@ +import _ from 'lodash' import { Answer } from './answer' import { Fees } from './fees' export type FullContract< M extends DPM | CPMM, - T extends Binary | Multi | FreeResponse + T extends Binary | Multi | FreeResponse | Numeric > = { id: string slug: string // auto-generated; must be unique @@ -42,6 +43,7 @@ export type FullContract< export type Contract = FullContract export type BinaryContract = FullContract export type FreeResponseContract = FullContract +export type NumericContract = FullContract export type DPM = { mechanism: 'dpm-2' @@ -81,7 +83,16 @@ export type FreeResponse = { 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_DESCRIPTION_LENGTH = 10000