Skip to content

Commit

Permalink
No admin trading on sweeps
Browse files Browse the repository at this point in the history
  • Loading branch information
IanPhilips committed Sep 18, 2024
1 parent f4312ac commit 4c61e25
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions backend/api/src/place-bet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,16 @@ import {
import { removeUndefinedProps } from 'common/util/object'
import { Bet, LimitBet, maker } from 'common/bet'
import { floatingEqual } from 'common/util/math'
import { contractColumnsToSelect, log, metrics } from 'shared/utils'
import { contractColumnsToSelect, isProd, log, metrics } from 'shared/utils'
import { Answer } from 'common/answer'
import { CpmmState, getCpmmProbability } from 'common/calculate-cpmm'
import { ValidatedAPIParams } from 'common/api/schema'
import { onCreateBets } from 'api/on-create-bet'
import { BANNED_TRADING_USER_IDS, TWOMBA_ENABLED } from 'common/envs/constants'
import {
BANNED_TRADING_USER_IDS,
isAdminId,
TWOMBA_ENABLED,
} from 'common/envs/constants'
import * as crypto from 'crypto'
import { formatMoneyWithDecimals } from 'common/util/format'
import {
Expand Down Expand Up @@ -303,6 +307,9 @@ export const fetchContractBetDataAndValidate = async (
'You must be kyc verified to trade on sweepstakes markets.'
)
}
if (isAdminId(user.id) && contract.token === 'CASH' && isProd()) {
throw new APIError(403, 'Admins cannot trade on sweepstakes markets.')
}
if (BANNED_TRADING_USER_IDS.includes(user.id) || user.userDeleted) {
throw new APIError(403, 'You are banned or deleted. And not #blessed.')
}
Expand Down

0 comments on commit 4c61e25

Please sign in to comment.