restricted automatic resolution to binary markets
This commit is contained in:
		
							parent
							
								
									45d7bdd0cd
								
							
						
					
					
						commit
						831591b080
					
				|  | @ -97,6 +97,7 @@ export function NewContract(props: { question: string; tag?: string }) { | ||||||
|   const [isSubmitting, setIsSubmitting] = useState(false) |   const [isSubmitting, setIsSubmitting] = useState(false) | ||||||
| 
 | 
 | ||||||
|   const closeTime = closeDate ? dayjs(closeDate).valueOf() : undefined |   const closeTime = closeDate ? dayjs(closeDate).valueOf() : undefined | ||||||
|  |   const resolutionTime = resolutionDate ? dayjs(resolutionDate).valueOf() : undefined | ||||||
| 
 | 
 | ||||||
|   const balance = creator?.balance || 0 |   const balance = creator?.balance || 0 | ||||||
| 
 | 
 | ||||||
|  | @ -152,6 +153,8 @@ export function NewContract(props: { question: string; tag?: string }) { | ||||||
|           tags: category ? [category] : undefined, |           tags: category ? [category] : undefined, | ||||||
|           min, |           min, | ||||||
|           max, |           max, | ||||||
|  |           automaticResolution, | ||||||
|  |           resolutionTime | ||||||
|         }) |         }) | ||||||
|       ) |       ) | ||||||
|       await router.push(contractPath(result as Contract)) |       await router.push(contractPath(result as Contract)) | ||||||
|  | @ -372,72 +375,76 @@ export function NewContract(props: { question: string; tag?: string }) { | ||||||
|         )} |         )} | ||||||
|       </div> |       </div> | ||||||
| 
 | 
 | ||||||
|       <Spacer h={4} /> |       {outcomeType === 'BINARY' && ( | ||||||
|       <div className="form-control mb-1 items-start"> |         <div> | ||||||
|         <label className="label mt-1 gap-2"> |           <Spacer h={4} /> | ||||||
|           <span>Resolution type</span> |  | ||||||
|           <InfoTooltip text="Combined markets can be resolved manually but will be resolved automatically under given conditions." /> |  | ||||||
|         </label> |  | ||||||
|         <Row className="form-control gap-2"> |  | ||||||
|           <label className="label cursor-pointer gap-2"> |  | ||||||
|             <input |  | ||||||
|               className="radio" |  | ||||||
|               type="radio" |  | ||||||
|               name="res" |  | ||||||
|               checked={resolutionType === 'MANUAL'} |  | ||||||
|               value="MANUAL" |  | ||||||
|               onChange={() => setResolutionType('MANUAL')} |  | ||||||
|               disabled={isSubmitting} |  | ||||||
|             /> |  | ||||||
|             <span className="label-text">Manual</span> |  | ||||||
|           </label> |  | ||||||
| 
 |  | ||||||
|           <label className="label cursor-pointer gap-2"> |  | ||||||
|             <input |  | ||||||
|               className="radio" |  | ||||||
|               type="radio" |  | ||||||
|               name="res" |  | ||||||
|               checked={resolutionType === 'COMBINED'} |  | ||||||
|               value="COMBINED" |  | ||||||
|               onChange={() => setResolutionType('COMBINED')} |  | ||||||
|               disabled={isSubmitting} |  | ||||||
|             /> |  | ||||||
|             <span className="label-text">Combined (experimental)</span> |  | ||||||
|           </label> |  | ||||||
|         </Row> |  | ||||||
| 
 |  | ||||||
|         {resolutionType === 'COMBINED' && ( |  | ||||||
|           <div className="form-control mb-1 items-start"> |           <div className="form-control mb-1 items-start"> | ||||||
|             <label className="label mb-1 gap-2"> |             <label className="label mt-1 gap-2"> | ||||||
|               <span>Question resolves automatically as:</span> |               <span>Resolution type</span> | ||||||
|               <InfoTooltip text="The market will be resolved as ... on this date (local timezone)." /> |               <InfoTooltip text="Combined markets can be resolved manually but will be resolved automatically under given conditions." /> | ||||||
|             </label> |             </label> | ||||||
|             <Row className={'w-full items-center gap-2'}> |             <Row className="form-control gap-2"> | ||||||
|               <ChoicesToggleGroup |               <label className="label cursor-pointer gap-2"> | ||||||
|                 currentChoice={automaticResolution} |                 <input | ||||||
|                 setChoice={setAutomaticResolution} |                   className="radio" | ||||||
|                 choices={['YES', 'NO', 'MKT', 'CANCEL']} |                   type="radio" | ||||||
|                 titles={['YES', 'NO', 'PROB', 'N/A']} |                   name="res" | ||||||
|                 isSubmitting={isSubmitting} |                   checked={resolutionType === 'MANUAL'} | ||||||
|               /> |                   value="MANUAL" | ||||||
|             </Row> |                   onChange={() => setResolutionType('MANUAL')} | ||||||
|             <input |                   disabled={isSubmitting} | ||||||
|               type={'date'} |                 /> | ||||||
|               className="input input-bordered mt-4" |                 <span className="label-text">Manual</span> | ||||||
|               onClick={(e) => e.stopPropagation()} |               </label> | ||||||
|               onChange={(e) => | 
 | ||||||
|                 setResolutionDate( |               <label className="label cursor-pointer gap-2"> | ||||||
|                   dayjs(e.target.value).format('YYYY-MM-DDT23:59') || '' |                 <input | ||||||
|                 ) |                   className="radio" | ||||||
|               } |                   type="radio" | ||||||
|               min={Date.parse(closeDate??"")} // TODO: Fix: Market can be created with dates in the past
 |                   name="res" | ||||||
|               disabled={isSubmitting} |                   checked={resolutionType === 'COMBINED'} | ||||||
|               value={dayjs(resolutionDate).format('YYYY-MM-DD')} |                   value="COMBINED" | ||||||
|             /> |                   onChange={() => setResolutionType('COMBINED')} | ||||||
|         </div> |                   disabled={isSubmitting} | ||||||
|         )} |                 /> | ||||||
|  |                 <span className="label-text">Combined (experimental)</span> | ||||||
|  |               </label> | ||||||
|  |             </Row> | ||||||
|  |           </div> | ||||||
|  | 
 | ||||||
|  |           {resolutionType === 'COMBINED' && ( | ||||||
|  |             <div className="form-control mb-1 items-start"> | ||||||
|  |               <label className="label mb-1 gap-2"> | ||||||
|  |                 <span>Question resolves automatically as:</span> | ||||||
|  |                 <InfoTooltip text="The market will be resolved automatically on this date (local timezone)." /> | ||||||
|  |               </label> | ||||||
|  |               <Row className={'w-full items-center gap-2'}> | ||||||
|  |                 <ChoicesToggleGroup | ||||||
|  |                   currentChoice={automaticResolution} | ||||||
|  |                   setChoice={setAutomaticResolution} | ||||||
|  |                   choices={['YES', 'NO', 'MKT', 'CANCEL']} | ||||||
|  |                   titles={['YES', 'NO', 'PROB', 'N/A']} | ||||||
|  |                   isSubmitting={isSubmitting} | ||||||
|  |                 /> | ||||||
|  |               </Row> | ||||||
|  |               <input | ||||||
|  |                 type={'date'} | ||||||
|  |                 className="input input-bordered mt-4" | ||||||
|  |                 onClick={(e) => e.stopPropagation()} | ||||||
|  |                 onChange={(e) => | ||||||
|  |                   setResolutionDate( | ||||||
|  |                     dayjs(e.target.value).format('YYYY-MM-DDT23:59') || '' | ||||||
|  |                   ) | ||||||
|  |                 } | ||||||
|  |                 min={Date.parse(closeDate??"")} // TODO: Fix: Market can be created with dates in the past
 | ||||||
|  |                 disabled={isSubmitting} | ||||||
|  |                 value={dayjs(resolutionDate).format('YYYY-MM-DD')} | ||||||
|  |               /> | ||||||
|  |             </div> | ||||||
|  |           )} | ||||||
|  |         </div> | ||||||
|  |       )} | ||||||
| 
 | 
 | ||||||
|       </div> |  | ||||||
|       <Spacer h={4} /> |       <Spacer h={4} /> | ||||||
| 
 | 
 | ||||||
|       <div className="form-control mb-1 items-start"> |       <div className="form-control mb-1 items-start"> | ||||||
|  | @ -508,6 +515,6 @@ export function NewContract(props: { question: string; tag?: string }) { | ||||||
|           {isSubmitting ? 'Creating...' : 'Create market'} |           {isSubmitting ? 'Creating...' : 'Create market'} | ||||||
|         </button> |         </button> | ||||||
|       </div> |       </div> | ||||||
|     </div> |     </div>  | ||||||
|   ) |   ) | ||||||
| } | } | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user