Skip to content

Commit

Permalink
Fix ∞ mana glitch: set n/a returns full invest
Browse files Browse the repository at this point in the history
  • Loading branch information
sipec committed Dec 13, 2024
1 parent 7bca77e commit 81c4d0b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
14 changes: 2 additions & 12 deletions backend/api/src/resolve-market.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,22 +46,12 @@ export const resolveMarketMain: APIHandler<
if (outcomeType === 'STONK') {
throw new APIError(403, 'STONK contracts cannot be resolved')
}
if (
props.outcome === 'CANCEL' &&
outcomeType === 'MULTIPLE_CHOICE' &&
contract.mechanism === 'cpmm-multi-1' &&
!contract.shouldAnswersSumToOne
) {
throw new APIError(
403,
'Independent multiple choice markets cannot currently be resolved n/a'
)
}

const caller = await getUser(auth.uid)
if (!caller) throw new APIError(400, 'Caller not found')
if (caller.isBannedFromPosting || caller.userDeleted)
throw new APIError(403, 'Deleted or banned user cannot resolve markets')
if (creatorId !== auth.uid) await throwErrorIfNotMod(auth.uid)
if (creatorId !== auth.uid) throwErrorIfNotMod(auth.uid)

if (
isProd() &&
Expand Down
5 changes: 4 additions & 1 deletion common/src/payouts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,9 @@ export const getIndependentMultiFixedPayouts = (
)
default:
case 'CANCEL':
return getFixedCancelPayouts(contractMetrics, filteredLiquidities)
return getFixedCancelPayouts(
contractMetrics.filter((metric) => metric.answerId === answer.id),
filteredLiquidities
)
}
}

0 comments on commit 81c4d0b

Please sign in to comment.