enable fees
This commit is contained in:
parent
f7c6688d4f
commit
941d66b34c
|
@ -62,8 +62,7 @@ export function getCpmmLiquidityFee(
|
||||||
bet: number,
|
bet: number,
|
||||||
outcome: string
|
outcome: string
|
||||||
) {
|
) {
|
||||||
const prob = getCpmmProbability(contract.pool, contract.p)
|
const prob = getCpmmProbabilityAfterBetBeforeFees(contract, outcome, bet)
|
||||||
// const prob = getCpmmProbabilityAfterBetBeforeFees(contract, outcome, bet)
|
|
||||||
const betP = outcome === 'YES' ? 1 - prob : prob
|
const betP = outcome === 'YES' ? 1 - prob : prob
|
||||||
|
|
||||||
const liquidityFee = LIQUIDITY_FEE * betP * bet
|
const liquidityFee = LIQUIDITY_FEE * betP * bet
|
||||||
|
@ -83,9 +82,9 @@ export function calculateCpmmSharesAfterFee(
|
||||||
outcome: string
|
outcome: string
|
||||||
) {
|
) {
|
||||||
const { pool, p } = contract
|
const { pool, p } = contract
|
||||||
// const { remainingBet } = getCpmmLiquidityFee(contract, bet, outcome)
|
const { remainingBet } = getCpmmLiquidityFee(contract, bet, outcome)
|
||||||
|
|
||||||
return calculateCpmmShares(pool, p, bet, outcome)
|
return calculateCpmmShares(pool, p, remainingBet, outcome)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function calculateCpmmPurchase(
|
export function calculateCpmmPurchase(
|
||||||
|
@ -94,9 +93,9 @@ export function calculateCpmmPurchase(
|
||||||
outcome: string
|
outcome: string
|
||||||
) {
|
) {
|
||||||
const { pool, p } = contract
|
const { pool, p } = contract
|
||||||
// const { remainingBet, fees } = getCpmmLiquidityFee(contract, bet, outcome)
|
const { remainingBet, fees } = getCpmmLiquidityFee(contract, bet, outcome)
|
||||||
const remainingBet = bet
|
// const remainingBet = bet
|
||||||
const fees = noFees
|
// const fees = noFees
|
||||||
|
|
||||||
const shares = calculateCpmmShares(pool, p, remainingBet, outcome)
|
const shares = calculateCpmmShares(pool, p, remainingBet, outcome)
|
||||||
const { YES: y, NO: n } = pool
|
const { YES: y, NO: n } = pool
|
||||||
|
@ -110,14 +109,8 @@ export function calculateCpmmPurchase(
|
||||||
|
|
||||||
const postBetPool = { YES: newY, NO: newN }
|
const postBetPool = { YES: newY, NO: newN }
|
||||||
|
|
||||||
const { newPool, liquidity, newP } = addCpmmLiquidity(postBetPool, p, fee)
|
const { newPool, newP } = addCpmmLiquidity(postBetPool, p, fee)
|
||||||
// const prob = getCpmmProbability(postBetPool, p)
|
// console.log(fee, getCpmmLiquidity(pool, p), getCpmmLiquidity(newPool, newP))
|
||||||
// const newProb = getCpmmProbability(newPool, newP)
|
|
||||||
// console.log(prob, newProb)
|
|
||||||
// console.log(fee, liquidity, newP, newPool)
|
|
||||||
console.log(getCpmmLiquidity(pool, p), getCpmmLiquidity(newPool, newP))
|
|
||||||
console.log(pool, postBetPool, newPool)
|
|
||||||
// console.log(pool, postBetPool, shares)
|
|
||||||
|
|
||||||
return { shares, newPool, newP, fees }
|
return { shares, newPool, newP, fees }
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
export const PLATFORM_FEE = 0.005
|
export const PLATFORM_FEE = 0.01
|
||||||
export const CREATOR_FEE = 0.02
|
export const CREATOR_FEE = 0.04
|
||||||
export const LIQUIDITY_FEE = 0.02
|
export const LIQUIDITY_FEE = 0.04
|
||||||
|
|
||||||
export const DPM_PLATFORM_FEE = 2 * PLATFORM_FEE
|
export const DPM_PLATFORM_FEE = 0.01
|
||||||
export const DPM_CREATOR_FEE = 2 * CREATOR_FEE
|
export const DPM_CREATOR_FEE = 0.04
|
||||||
export const DPM_FEES = DPM_PLATFORM_FEE + DPM_CREATOR_FEE
|
export const DPM_FEES = DPM_PLATFORM_FEE + DPM_CREATOR_FEE
|
||||||
|
|
||||||
export type Fees = {
|
export type Fees = {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user