Add to totalPrizes (not prizeTotal)

This commit is contained in:
Austin Chen 2022-08-16 10:52:07 -07:00
parent 97c0a5cfa8
commit e3e08f449c
3 changed files with 4 additions and 2 deletions

View File

@ -146,7 +146,7 @@ export type Bounty = {
prizes: { prizes: {
[giverId: string]: number [giverId: string]: number
} }
prizeTotal: number totalPrizes: number
} }
export type outcomeType = AnyOutcomeType['outcomeType'] export type outcomeType = AnyOutcomeType['outcomeType']

View File

@ -171,7 +171,7 @@ function getBountyProps(ante: number, creator: User) {
prizes: { prizes: {
[creator.id]: ante, [creator.id]: ante,
}, },
prizeTotal: ante, totalPrizes: ante,
} }
return system return system
} }

View File

@ -34,6 +34,7 @@ export const addbounty = newEndpoint({}, async (req, auth) => {
if (user.balance < amount) throw new APIError(400, 'Insufficient balance') if (user.balance < amount) throw new APIError(400, 'Insufficient balance')
// TODO: Capture with txns?
transaction.update(userDoc, { transaction.update(userDoc, {
balance: user.balance - amount, balance: user.balance - amount,
totalDeposits: user.totalDeposits - amount, totalDeposits: user.totalDeposits - amount,
@ -46,6 +47,7 @@ export const addbounty = newEndpoint({}, async (req, auth) => {
...contract.prizes, ...contract.prizes,
[user.id]: existingPrize + amount, [user.id]: existingPrize + amount,
}, },
totalPrizes: contract.totalPrizes + amount,
}) })
return { status: 'success' } return { status: 'success' }