Skip to content

Commit

Permalink
Disallow adding answers to sweepstakes question
Browse files Browse the repository at this point in the history
  • Loading branch information
sipec committed Nov 27, 2024
1 parent d8fa304 commit 87dc923
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
5 changes: 1 addition & 4 deletions backend/api/src/create-answer-cpmm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,7 @@ const verifyContract = async (contractId: string, creatorId: string) => {
const contract = await getContractSupabase(contractId)
if (!contract) throw new APIError(404, 'Contract not found')
if (contract.token !== 'MANA') {
throw new APIError(
403,
'Must add answer to the mana version of the contract'
)
throw new APIError(403, 'Cannot add answers to sweepstakes question')
}
if (contract.mechanism !== 'cpmm-multi-1')
throw new APIError(403, 'Requires a cpmm multiple choice contract')
Expand Down
4 changes: 2 additions & 2 deletions backend/shared/src/create-cash-contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ export async function createCashContractMain(

let answers: Answer[] = []
if (manaContract.outcomeType === 'MULTIPLE_CHOICE') {
if (manaContract.addAnswersMode === 'ANYONE')
if (manaContract.addAnswersMode !== 'DISABLED')
throw new APIError(
400,
`Cannot make sweepstakes question for free response contract`
`Cannot add answers to multi sweepstakes question`
)

answers = await getAnswersForContract(tx, manaContractId)
Expand Down

0 comments on commit 87dc923

Please sign in to comment.