moved calculate ts for access in firebase

This commit is contained in:
Milli 2022-06-05 18:23:21 +02:00
parent e0bdc70843
commit 8380bf4f72
4 changed files with 12 additions and 8 deletions

View File

@ -1,12 +1,12 @@
import { maxBy } from 'lodash' import { maxBy } from 'lodash'
import { Bet } from './bet' import { Bet } from '../../common/bet'
import { import {
calculateCpmmSale, calculateCpmmSale,
getCpmmProbability, getCpmmProbability,
getCpmmOutcomeProbabilityAfterBet, getCpmmOutcomeProbabilityAfterBet,
getCpmmProbabilityAfterSale, getCpmmProbabilityAfterSale,
calculateCpmmSharesAfterFee, calculateCpmmSharesAfterFee,
} from './calculate-cpmm' } from '../../common/calculate-cpmm'
import { import {
calculateDpmPayout, calculateDpmPayout,
calculateDpmPayoutAfterCorrectBet, calculateDpmPayoutAfterCorrectBet,
@ -16,9 +16,13 @@ import {
getDpmProbability, getDpmProbability,
getDpmOutcomeProbabilityAfterBet, getDpmOutcomeProbabilityAfterBet,
getDpmProbabilityAfterSale, getDpmProbabilityAfterSale,
} from './calculate-dpm' } from '../../common/calculate-dpm'
import { calculateFixedPayout } from './calculate-fixed-payouts' import { calculateFixedPayout } from '../../common/calculate-fixed-payouts'
import { Contract, BinaryContract, FreeResponseContract } from './contract' import {
Contract,
BinaryContract,
FreeResponseContract,
} from '../../common/contract'
export function getProbability(contract: BinaryContract) { export function getProbability(contract: BinaryContract) {
return contract.mechanism === 'cpmm-1' return contract.mechanism === 'cpmm-1'

View File

@ -17,7 +17,7 @@ import { removeUndefinedProps } from '../../common/util/object'
import { LiquidityProvision } from '../../common/liquidity-provision' import { LiquidityProvision } from '../../common/liquidity-provision'
import { getValues } from './utils' import { getValues } from './utils'
import { batchedWaitAll } from '../../common/util/promise' import { batchedWaitAll } from '../../common/util/promise'
import { getProbability } from 'common/calculate' import { getProbability } from '../shared/calculate'
export const resolveMarket = functions export const resolveMarket = functions
.runWith({ minInstances: 1 }) .runWith({ minInstances: 1 })

View File

@ -44,7 +44,7 @@ import {
getContractBetMetrics, getContractBetMetrics,
resolvedPayout, resolvedPayout,
getContractBetNullMetrics, getContractBetNullMetrics,
} from 'common/calculate' } from 'functions/shared/calculate'
import { useTimeSinceFirstRender } from 'web/hooks/use-time-since-first-render' import { useTimeSinceFirstRender } from 'web/hooks/use-time-since-first-render'
import { trackLatency } from 'web/lib/firebase/tracking' import { trackLatency } from 'web/lib/firebase/tracking'
import { NumericContract } from 'common/contract' import { NumericContract } from 'common/contract'

View File

@ -9,7 +9,7 @@ import { ResolveConfirmationButton } from './confirmation-button'
import { resolveMarket } from 'web/lib/firebase/fn-call' import { resolveMarket } from 'web/lib/firebase/fn-call'
import { ProbabilitySelector } from './probability-selector' import { ProbabilitySelector } from './probability-selector'
import { DPM_CREATOR_FEE } from 'common/fees' import { DPM_CREATOR_FEE } from 'common/fees'
import { getProbability } from 'common/calculate' import { getProbability } from 'functions/shared/calculate'
import { BinaryContract, resolution } from 'common/contract' import { BinaryContract, resolution } from 'common/contract'
import { formatMoney } from 'common/util/format' import { formatMoney } from 'common/util/format'