diff --git a/common/answer.ts b/common/answer.ts index 9dcc3828..9616eed6 100644 --- a/common/answer.ts +++ b/common/answer.ts @@ -1,3 +1,4 @@ +import { JSONContent } from '@tiptap/core' import { User } from './user' export type Answer = { @@ -12,6 +13,7 @@ export type Answer = { avatarUrl?: string text: string + description?: string | JSONContent } export const getNoneAnswer = (contractId: string, creator: User) => { diff --git a/common/contract.ts b/common/contract.ts index c414a332..8e3723b7 100644 --- a/common/contract.ts +++ b/common/contract.ts @@ -10,6 +10,7 @@ export type AnyOutcomeType = | PseudoNumeric | FreeResponse | Numeric + | Bounty export type AnyContractType = | (CPMM & Binary) | (CPMM & PseudoNumeric) @@ -68,6 +69,7 @@ export type DPMContract = Contract & DPM export type CPMMContract = Contract & CPMM export type DPMBinaryContract = BinaryContract & DPM export type CPMMBinaryContract = BinaryContract & CPMM +export type BountyContract = Contract & Bounty export type DPM = { mechanism: 'dpm-2' @@ -127,6 +129,18 @@ export type Numeric = { resolutionValue?: number } +export type Bounty = { + outcomeType: 'BOUNTY' + // One answer for each submission + answers: Answer[] + prizes: { + [giverId: string]: number + } + prizeTotal: number + // Resolution = which ID the bounty went to + resolution?: string | 'MKT' | 'CANCEL' +} + export type outcomeType = AnyOutcomeType['outcomeType'] export type resolution = 'YES' | 'NO' | 'MKT' | 'CANCEL' export const RESOLUTIONS = ['YES', 'NO', 'MKT', 'CANCEL'] as const @@ -136,6 +150,7 @@ export const OUTCOME_TYPES = [ 'FREE_RESPONSE', 'PSEUDO_NUMERIC', 'NUMERIC', + 'BOUNTY', ] as const export const MAX_QUESTION_LENGTH = 480 diff --git a/web/pages/create.tsx b/web/pages/create.tsx index 92a5964f..fa68eaaa 100644 --- a/web/pages/create.tsx +++ b/web/pages/create.tsx @@ -108,6 +108,19 @@ function NewContract(props: { creator: User; params?: NewQuestionParams }) { setQuestion(params?.q ?? '') }, [params?.q]) + const questionLabel = outcomeType === 'BOUNTY' ? 'Bounty' : 'Question' + const placeholders = { + BINARY: 'e.g. Will the Democrats win the 2024 US presidential election?', + MULTIPLE_CHOICE: + 'e.g. Which basketball team will be the March Madness champion?', + FREE_RESPONSE: 'e.g. What programming language should I learn next?', + NUMERIC: '', // Numeric type is deprecated + PSEUDO_NUMERIC: + 'e.g. How many people will show up to Taco Tuesday this week?', + BOUNTY: 'e.g. Add Dark Mode to Manifold Markets', + } + const placeholder = placeholders[outcomeType] ?? placeholders['BINARY'] + const [ante, _setAnte] = useState(FIXED_ANTE) // If params.closeTime is set, extract out the specified date and time @@ -231,28 +244,8 @@ function NewContract(props: { creator: User; params?: NewQuestionParams }) { return (