diff --git a/common/contract.ts b/common/contract.ts index ac4848ec..e9b768ea 100644 --- a/common/contract.ts +++ b/common/contract.ts @@ -46,7 +46,6 @@ export type Contract = FullContract< export type BinaryContract = FullContract export type FreeResponseContract = FullContract export type NumericContract = FullContract -export type AnyOutcome = Binary | Multi | FreeResponse | Numeric export type DPM = { mechanism: 'dpm-2' diff --git a/common/payouts-dpm.ts b/common/payouts-dpm.ts index a3208ab3..300a906f 100644 --- a/common/payouts-dpm.ts +++ b/common/payouts-dpm.ts @@ -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, + contract: FullContract, bets: Bet[] ) => { const { pool } = contract @@ -31,7 +31,7 @@ export const getDpmCancelPayouts = ( export const getDpmStandardPayouts = ( outcome: string, - contract: FullContract, + contract: FullContract, bets: Bet[] ) => { const winningBets = bets.filter((bet) => bet.outcome === outcome) @@ -78,7 +78,7 @@ export const getDpmStandardPayouts = ( export const getNumericDpmPayouts = ( outcome: string, - contract: FullContract, + contract: FullContract, bets: NumericBet[] ) => { const totalShares = sumBy(bets, (bet) => bet.allOutcomeShares[outcome] ?? 0) @@ -129,7 +129,7 @@ export const getNumericDpmPayouts = ( } export const getDpmMktPayouts = ( - contract: FullContract, + contract: FullContract, bets: Bet[], resolutionProbability?: number ) => { diff --git a/common/payouts.ts b/common/payouts.ts index 54c850f0..68fb8694 100644 --- a/common/payouts.ts +++ b/common/payouts.ts @@ -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, + contract: Contract, bets: Bet[], resolutionProbability?: number ): PayoutInfo => {