diff --git a/functions/src/on-create-bet.ts b/functions/src/on-create-bet.ts index af3a6e84..3e615e42 100644 --- a/functions/src/on-create-bet.ts +++ b/functions/src/on-create-bet.ts @@ -1,7 +1,6 @@ import * as functions from 'firebase-functions' import * as admin from 'firebase-admin' -import { getContract } from './utils' import { Bet } from '../../common/bet' const firestore = admin.firestore() @@ -12,16 +11,11 @@ export const onCreateBet = functions.firestore const { contractId } = context.params as { contractId: string } - - const contract = await getContract(contractId) - if (!contract) - throw new Error('Could not find contract corresponding with bet') - const bet = change.data() as Bet const lastBetTime = bet.createdTime await firestore .collection('contracts') - .doc(contract.id) + .doc(contractId) .update({ lastBetTime, lastUpdatedTime: Date.now() }) })