flat trade fee of M$0.1 aka bot tax

This commit is contained in:
mantikoros 2022-10-06 23:04:48 -05:00
parent 4285198f09
commit 9e289146af
2 changed files with 13 additions and 3 deletions

View File

@ -1,3 +1,5 @@
export const FLAT_TRADE_FEE = 0.1 // M$0.1
export const PLATFORM_FEE = 0 export const PLATFORM_FEE = 0
export const CREATOR_FEE = 0 export const CREATOR_FEE = 0
export const LIQUIDITY_FEE = 0 export const LIQUIDITY_FEE = 0

View File

@ -11,6 +11,7 @@ import { groupBy, mapValues, sumBy, uniq } from 'lodash'
import { APIError, newEndpoint, validate } from './api' import { APIError, newEndpoint, validate } from './api'
import { Contract, CPMM_MIN_POOL_QTY } from '../../common/contract' import { Contract, CPMM_MIN_POOL_QTY } from '../../common/contract'
import { User } from '../../common/user' import { User } from '../../common/user'
import { FLAT_TRADE_FEE } from '../../common/fees'
import { import {
BetInfo, BetInfo,
getBinaryCpmmBetInfo, getBinaryCpmmBetInfo,
@ -162,10 +163,17 @@ export const placebet = newEndpoint({}, async (req, auth) => {
} }
} }
if (newBet.amount !== 0) { const balanceChange =
trans.update(userDoc, { balance: FieldValue.increment(-newBet.amount) }) newBet.amount !== 0
? // quick bet
newBet.amount + FLAT_TRADE_FEE
: // limit order
FLAT_TRADE_FEE
trans.update(userDoc, { balance: FieldValue.increment(-balanceChange) })
log('Updated user balance.') log('Updated user balance.')
if (newBet.amount !== 0) {
trans.update( trans.update(
contractDoc, contractDoc,
removeUndefinedProps({ removeUndefinedProps({