Removed comments, default resolution MKT
This commit is contained in:
parent
f7bc69d76e
commit
32859a3dab
|
@ -37,7 +37,7 @@ const bodySchema = z.object({
|
||||||
'Close time must be in the future.'
|
'Close time must be in the future.'
|
||||||
),
|
),
|
||||||
outcomeType: z.enum(OUTCOME_TYPES),
|
outcomeType: z.enum(OUTCOME_TYPES),
|
||||||
})
|
})
|
||||||
|
|
||||||
const binarySchema = z.object({
|
const binarySchema = z.object({
|
||||||
initialProb: z.number().min(1).max(99),
|
initialProb: z.number().min(1).max(99),
|
||||||
|
@ -56,14 +56,14 @@ export const createContract = newEndpoint(['POST'], async (req, [user, _]) => {
|
||||||
|
|
||||||
let min, max, initialProb
|
let min, max, initialProb
|
||||||
if (outcomeType === 'NUMERIC') {
|
if (outcomeType === 'NUMERIC') {
|
||||||
;({ min, max } = validate(numericSchema, req.body)) // leading ; intentional: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment#assignment_separate_from_declaration_2
|
;({ min, max } = validate(numericSchema, req.body))
|
||||||
if (max - min <= 0.01) throw new APIError(400, 'Invalid range.')
|
if (max - min <= 0.01) throw new APIError(400, 'Invalid range.')
|
||||||
}
|
}
|
||||||
if (outcomeType === 'BINARY') {
|
if (outcomeType === 'BINARY') {
|
||||||
;({ initialProb } = validate(binarySchema, req.body)) // leading ; intentional: see above
|
;({ initialProb } = validate(binarySchema, req.body))
|
||||||
}
|
}
|
||||||
|
|
||||||
const autoResolution = outcomeType == 'BINARY' ? 'MKT' : 'CANCEL'
|
const autoResolution = 'MKT'
|
||||||
const autoResolutionTime = closeTime.setDate(closeTime.getDate() + 7)
|
const autoResolutionTime = closeTime.setDate(closeTime.getDate() + 7)
|
||||||
|
|
||||||
// Uses utc time on server:
|
// Uses utc time on server:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user