Validate that user can pay for market (#487)

This commit is contained in:
Marshall Polaris 2022-06-12 14:23:23 -07:00 committed by GitHub
parent a7dca6a163
commit 6ac129a0b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -87,6 +87,10 @@ export const createmarket = newEndpoint(['POST'], async (req, auth) => {
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(
'creating contract for',
user.username,