Add to totalPrizes (not prizeTotal)
This commit is contained in:
parent
97c0a5cfa8
commit
e3e08f449c
|
@ -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']
|
||||||
|
|
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
|
@ -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' }
|
||||||
|
|
Loading…
Reference in New Issue
Block a user