flat trade fee of M$0.1 aka bot tax
This commit is contained in:
parent
4285198f09
commit
9e289146af
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
log('Updated user balance.')
|
? // quick bet
|
||||||
|
newBet.amount + FLAT_TRADE_FEE
|
||||||
|
: // limit order
|
||||||
|
FLAT_TRADE_FEE
|
||||||
|
|
||||||
|
trans.update(userDoc, { balance: FieldValue.increment(-balanceChange) })
|
||||||
|
log('Updated user balance.')
|
||||||
|
|
||||||
|
if (newBet.amount !== 0) {
|
||||||
trans.update(
|
trans.update(
|
||||||
contractDoc,
|
contractDoc,
|
||||||
removeUndefinedProps({
|
removeUndefinedProps({
|
||||||
|
|
Loading…
Reference in New Issue
Block a user