predikt/oracle/backend/scripts/remove-answer-ante.ts
caelum0x 2b68bde5d5 Predikt: full Polymarket-style prediction market — web + mobile + on-chain + bots
Working tree is now the canonical repo. Off-chain play-money + trustless on-chain
(FPMM AMM + CLOB via UMA settlement), AI market factory, creator/social/distribution,
mobile shell + push, one-command demo + deploy-kit. Secrets excluded (see ENV-AND-KEYS.md).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-06 23:29:50 +03:00

44 lines
1.1 KiB
TypeScript

import * as admin from 'firebase-admin'
import { initAdmin } from 'shared/init-admin'
initAdmin()
import { Bet } from 'common/bet'
import { Contract } from 'common/contract'
import { getValues } from 'shared/utils'
async function removeAnswerAnte() {
const firestore = admin.firestore()
console.log('Removing isAnte from bets on answers')
const contracts = await getValues<Contract>(
firestore
.collection('contracts')
.where('outcomeType', '==', 'FREE_RESPONSE')
)
console.log('Loaded', contracts, 'contracts')
for (const contract of contracts) {
const betsSnapshot = await firestore
.collection('contracts')
.doc(contract.id)
.collection('bets')
.get()
console.log('updating', contract.question)
for (const doc of betsSnapshot.docs) {
const bet = doc.data() as Bet
if (bet.isAnte && bet.outcome !== '0') {
console.log('updating', bet.outcome)
await doc.ref.update('isAnte', false)
}
}
}
}
if (require.main === module) {
removeAnswerAnte().then(() => process.exit())
}