predikt/oracle/backend/scripts/redo-resolution-payouts.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

37 lines
999 B
TypeScript

import { Contract } from 'common/contract'
import * as admin from 'firebase-admin'
import { initAdmin } from 'shared/init-admin'
initAdmin()
import {
getDataAndPayoutInfo,
payUsersTransactions,
} from 'shared/resolve-market-helpers'
const firestore = admin.firestore()
const CONTRACT_ID = 'tWQ6DLrSaFQ8ifC1GIOj'
const OUTCOME = 'YES'
const redoResolutionPayouts = async (
contractId: string,
outcome: 'YES' | 'NO'
) => {
const contract = (
await firestore.doc(`contracts/${contractId}`).get()
).data() as Contract
if (!contract) {
throw new Error(`Contract not found: ${contractId}`)
}
if (contract.outcomeType !== 'BINARY') {
throw new Error(`Contract is not binary: ${contractId}`)
}
const { payouts } = await getDataAndPayoutInfo(
outcome,
contract,
undefined,
undefined,
undefined
)
await payUsersTransactions(payouts, contract.id)
}
if (require.main === module)
redoResolutionPayouts(CONTRACT_ID, OUTCOME).then(() => process.exit())