Revert fishy change regarding payouts
This commit is contained in:
parent
86625798cd
commit
80d5607984
|
@ -46,7 +46,6 @@ export type Contract = FullContract<
|
|||
export type BinaryContract = FullContract<DPM | CPMM, Binary>
|
||||
export type FreeResponseContract = FullContract<DPM | CPMM, FreeResponse>
|
||||
export type NumericContract = FullContract<DPM, Numeric>
|
||||
export type AnyOutcome = Binary | Multi | FreeResponse | Numeric
|
||||
|
||||
export type DPM = {
|
||||
mechanism: 'dpm-2'
|
||||
|
|
|
@ -2,12 +2,12 @@ import { sum, groupBy, sumBy, mapValues } from 'lodash'
|
|||
|
||||
import { Bet, NumericBet } from './bet'
|
||||
import { deductDpmFees, getDpmProbability } from './calculate-dpm'
|
||||
import { DPM, FreeResponse, FullContract, Multi, AnyOutcome } from './contract'
|
||||
import { DPM, FreeResponse, FullContract, Multi } from './contract'
|
||||
import { DPM_CREATOR_FEE, DPM_FEES, DPM_PLATFORM_FEE } from './fees'
|
||||
import { addObjects } from './util/object'
|
||||
|
||||
export const getDpmCancelPayouts = (
|
||||
contract: FullContract<DPM, AnyOutcome>,
|
||||
contract: FullContract<DPM, any>,
|
||||
bets: Bet[]
|
||||
) => {
|
||||
const { pool } = contract
|
||||
|
@ -31,7 +31,7 @@ export const getDpmCancelPayouts = (
|
|||
|
||||
export const getDpmStandardPayouts = (
|
||||
outcome: string,
|
||||
contract: FullContract<DPM, AnyOutcome>,
|
||||
contract: FullContract<DPM, any>,
|
||||
bets: Bet[]
|
||||
) => {
|
||||
const winningBets = bets.filter((bet) => bet.outcome === outcome)
|
||||
|
@ -78,7 +78,7 @@ export const getDpmStandardPayouts = (
|
|||
|
||||
export const getNumericDpmPayouts = (
|
||||
outcome: string,
|
||||
contract: FullContract<DPM, AnyOutcome>,
|
||||
contract: FullContract<DPM, any>,
|
||||
bets: NumericBet[]
|
||||
) => {
|
||||
const totalShares = sumBy(bets, (bet) => bet.allOutcomeShares[outcome] ?? 0)
|
||||
|
@ -129,7 +129,7 @@ export const getNumericDpmPayouts = (
|
|||
}
|
||||
|
||||
export const getDpmMktPayouts = (
|
||||
contract: FullContract<DPM, AnyOutcome>,
|
||||
contract: FullContract<DPM, any>,
|
||||
bets: Bet[],
|
||||
resolutionProbability?: number
|
||||
) => {
|
||||
|
|
|
@ -9,7 +9,6 @@ import {
|
|||
FreeResponse,
|
||||
FullContract,
|
||||
Multi,
|
||||
AnyOutcome,
|
||||
} from './contract'
|
||||
import { Fees } from './fees'
|
||||
import { LiquidityProvision } from './liquidity-provision'
|
||||
|
@ -73,17 +72,15 @@ export const getPayouts = (
|
|||
liquidities,
|
||||
resolutionProbability
|
||||
)
|
||||
} else if (contract.mechanism === 'dpm-2') {
|
||||
return getDpmPayouts(
|
||||
outcome,
|
||||
resolutions,
|
||||
contract,
|
||||
bets,
|
||||
resolutionProbability
|
||||
)
|
||||
} else {
|
||||
throw new Error('Unknown contract mechanism.')
|
||||
}
|
||||
|
||||
return getDpmPayouts(
|
||||
outcome,
|
||||
resolutions,
|
||||
contract,
|
||||
bets,
|
||||
resolutionProbability
|
||||
)
|
||||
}
|
||||
|
||||
export const getFixedPayouts = (
|
||||
|
@ -115,7 +112,7 @@ export const getDpmPayouts = (
|
|||
resolutions: {
|
||||
[outcome: string]: number
|
||||
},
|
||||
contract: FullContract<DPM, AnyOutcome>,
|
||||
contract: Contract,
|
||||
bets: Bet[],
|
||||
resolutionProbability?: number
|
||||
): PayoutInfo => {
|
||||
|
|
Loading…
Reference in New Issue
Block a user