Validate that user can pay for market (#487)
This commit is contained in:
parent
a7dca6a163
commit
6ac129a0b8
|
@ -87,6 +87,10 @@ export const createmarket = newEndpoint(['POST'], async (req, auth) => {
|
||||||
|
|
||||||
const ante = FIXED_ANTE
|
const ante = FIXED_ANTE
|
||||||
|
|
||||||
|
// TODO: this is broken because it's not in a transaction
|
||||||
|
if (ante > user.balance && !isFree)
|
||||||
|
throw new APIError(400, `Balance must be at least ${ante}.`)
|
||||||
|
|
||||||
console.log(
|
console.log(
|
||||||
'creating contract for',
|
'creating contract for',
|
||||||
user.username,
|
user.username,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user