lower fees on sales
This commit is contained in:
parent
0e640bf53b
commit
800d9c6723
|
@ -104,7 +104,9 @@ export function calculateShareValue(contract: Contract, bet: Bet) {
|
|||
}
|
||||
|
||||
export function calculateSaleAmount(contract: Contract, bet: Bet) {
|
||||
return (1 - FEES) * calculateShareValue(contract, bet)
|
||||
const { amount } = bet
|
||||
const winnings = calculateShareValue(contract, bet)
|
||||
return deductFees(amount, winnings)
|
||||
}
|
||||
|
||||
export function calculatePayout(
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { Bet } from './bet'
|
||||
import { calculateShareValue, getProbability } from './calculate'
|
||||
import { calculateShareValue, deductFees, getProbability } from './calculate'
|
||||
import { Contract } from './contract'
|
||||
import { CREATOR_FEE, FEES } from './fees'
|
||||
import { User } from './user'
|
||||
|
@ -36,8 +36,9 @@ export const getSellBetInfo = (
|
|||
const probBefore = getProbability(contract.totalShares)
|
||||
const probAfter = getProbability(newTotalShares)
|
||||
|
||||
const creatorFee = CREATOR_FEE * adjShareValue
|
||||
const saleAmount = (1 - FEES) * adjShareValue
|
||||
const profit = adjShareValue - amount
|
||||
const creatorFee = CREATOR_FEE * Math.max(0, profit)
|
||||
const saleAmount = deductFees(amount, adjShareValue)
|
||||
|
||||
console.log(
|
||||
'SELL M$',
|
||||
|
|
Loading…
Reference in New Issue
Block a user