diff --git a/common/antes.ts b/common/antes.ts index 287f32d3..15081b45 100644 --- a/common/antes.ts +++ b/common/antes.ts @@ -1,5 +1,5 @@ import { Bet } from './bet' -import { getProbability } from './calculate' +import { getProbability } from './calculate-dpm' import { getCpmmProbability } from './calculate-cpmm' import { Binary, CPMM, DPM, FreeResponse, FullContract } from './contract' import { User } from './user' diff --git a/common/calculate.ts b/common/calculate-dpm.ts similarity index 100% rename from common/calculate.ts rename to common/calculate-dpm.ts diff --git a/common/new-bet.ts b/common/new-bet.ts index 161a44a9..ce8bdc1a 100644 --- a/common/new-bet.ts +++ b/common/new-bet.ts @@ -4,7 +4,7 @@ import { calculateShares, getProbability, getOutcomeProbability, -} from './calculate' +} from './calculate-dpm' import { calculateCpmmShares, getCpmmProbability } from './calculate-cpmm' import { Binary, diff --git a/common/payouts.ts b/common/payouts.ts index ed9e0613..306b6051 100644 --- a/common/payouts.ts +++ b/common/payouts.ts @@ -1,7 +1,7 @@ import * as _ from 'lodash' import { Bet } from './bet' -import { deductFees, getProbability } from './calculate' +import { deductFees, getProbability } from './calculate-dpm' import { Binary, Contract, diff --git a/common/sell-bet.ts b/common/sell-bet.ts index 907391e4..7013c3d9 100644 --- a/common/sell-bet.ts +++ b/common/sell-bet.ts @@ -1,5 +1,9 @@ import { Bet } from './bet' -import { calculateShareValue, deductFees, getProbability } from './calculate' +import { + calculateShareValue, + deductFees, + getProbability, +} from './calculate-dpm' import { calculateCpmmSale, calculateCpmmShareValue, diff --git a/functions/src/emails.ts b/functions/src/emails.ts index 0ded7b7d..0d5d38c7 100644 --- a/functions/src/emails.ts +++ b/functions/src/emails.ts @@ -1,7 +1,7 @@ import _ = require('lodash') import { Answer } from '../../common/answer' import { Bet } from '../../common/bet' -import { getProbability } from '../../common/calculate' +import { getProbability } from '../../common/calculate-dpm' import { Comment } from '../../common/comment' import { Contract } from '../../common/contract' import { CREATOR_FEE } from '../../common/fees' diff --git a/functions/src/markets.ts b/functions/src/markets.ts index f9188987..31bc7d64 100644 --- a/functions/src/markets.ts +++ b/functions/src/markets.ts @@ -4,7 +4,7 @@ import * as _ from 'lodash' import { getValues } from './utils' import { Contract } from '../../common/contract' -import { getProbability } from '../../common/calculate' +import { getProbability } from '../../common/calculate-dpm' const cache = { lastUpdated: 0, data: '' } diff --git a/functions/src/scripts/correct-bet-probability.ts b/functions/src/scripts/correct-bet-probability.ts index 47ffdb58..50678034 100644 --- a/functions/src/scripts/correct-bet-probability.ts +++ b/functions/src/scripts/correct-bet-probability.ts @@ -5,7 +5,7 @@ import { initAdmin } from './script-init' initAdmin('stephen') import { Bet } from '../../../common/bet' -import { getProbability } from '../../../common/calculate' +import { getProbability } from '../../../common/calculate-dpm' import { Contract } from '../../../common/contract' type DocRef = admin.firestore.DocumentReference diff --git a/functions/src/scripts/migrate-to-dpm-2.ts b/functions/src/scripts/migrate-to-dpm-2.ts index 80523a95..e61fa302 100644 --- a/functions/src/scripts/migrate-to-dpm-2.ts +++ b/functions/src/scripts/migrate-to-dpm-2.ts @@ -6,7 +6,7 @@ initAdmin('stephenDev') import { Contract } from '../../../common/contract' import { Bet } from '../../../common/bet' -import { calculateShares, getProbability } from '../../../common/calculate' +import { calculateShares, getProbability } from '../../../common/calculate-dpm' import { getSellBetInfo } from '../../../common/sell-bet' import { User } from '../../../common/user' diff --git a/functions/src/update-user-metrics.ts b/functions/src/update-user-metrics.ts index d1d13727..ec18e2e8 100644 --- a/functions/src/update-user-metrics.ts +++ b/functions/src/update-user-metrics.ts @@ -6,7 +6,7 @@ import { getValues } from './utils' import { Contract } from '../../common/contract' import { Bet } from '../../common/bet' import { User } from '../../common/user' -import { calculatePayout } from '../../common/calculate' +import { calculatePayout } from '../../common/calculate-dpm' const firestore = admin.firestore() diff --git a/web/components/answers/answer-bet-panel.tsx b/web/components/answers/answer-bet-panel.tsx index bddaa609..84e5fb45 100644 --- a/web/components/answers/answer-bet-panel.tsx +++ b/web/components/answers/answer-bet-panel.tsx @@ -22,7 +22,7 @@ import { getOutcomeProbability, calculateShares, calculatePayoutAfterCorrectBet, -} from '../../../common/calculate' +} from '../../../common/calculate-dpm' import { firebaseLogin } from '../../lib/firebase/users' import { Bet } from '../../../common/bet' diff --git a/web/components/answers/answer-item.tsx b/web/components/answers/answer-item.tsx index 7919f84d..883bd86d 100644 --- a/web/components/answers/answer-item.tsx +++ b/web/components/answers/answer-item.tsx @@ -10,7 +10,7 @@ import { Avatar } from '../avatar' import { SiteLink } from '../site-link' import { BuyButton } from '../yes-no-selector' import { formatPercent } from '../../../common/util/format' -import { getOutcomeProbability } from '../../../common/calculate' +import { getOutcomeProbability } from '../../../common/calculate-dpm' import { tradingAllowed } from '../../lib/firebase/contracts' import { AnswerBetPanel } from './answer-bet-panel' import { ContractFeed } from '../contract-feed' diff --git a/web/components/answers/answers-panel.tsx b/web/components/answers/answers-panel.tsx index 3781311a..a5c748c1 100644 --- a/web/components/answers/answers-panel.tsx +++ b/web/components/answers/answers-panel.tsx @@ -6,7 +6,7 @@ import { DPM, FreeResponse, FullContract } from '../../../common/contract' import { Col } from '../layout/col' import { formatPercent } from '../../../common/util/format' import { useUser } from '../../hooks/use-user' -import { getOutcomeProbability } from '../../../common/calculate' +import { getOutcomeProbability } from '../../../common/calculate-dpm' import { useAnswers } from '../../hooks/use-answers' import { tradingAllowed } from '../../lib/firebase/contracts' import { AnswerItem } from './answer-item' diff --git a/web/components/answers/create-answer-panel.tsx b/web/components/answers/create-answer-panel.tsx index dc21dcc7..72b70356 100644 --- a/web/components/answers/create-answer-panel.tsx +++ b/web/components/answers/create-answer-panel.tsx @@ -24,7 +24,7 @@ import { getProbabilityAfterBet, calculateShares, calculatePayoutAfterCorrectBet, -} from '../../../common/calculate' +} from '../../../common/calculate-dpm' import { firebaseLogin } from '../../lib/firebase/users' import { Bet } from '../../../common/bet' diff --git a/web/components/bet-panel.tsx b/web/components/bet-panel.tsx index 67f304c5..c00f6a5a 100644 --- a/web/components/bet-panel.tsx +++ b/web/components/bet-panel.tsx @@ -18,7 +18,7 @@ import { calculateShares, getProbabilityAfterBet, calculatePayoutAfterCorrectBet, -} from '../../common/calculate' +} from '../../common/calculate-dpm' import { firebaseLogin } from '../lib/firebase/users' import { Bet } from '../../common/bet' import { placeBet } from '../lib/firebase/api-call' diff --git a/web/components/bets-list.tsx b/web/components/bets-list.tsx index 7c6e5ffe..88312766 100644 --- a/web/components/bets-list.tsx +++ b/web/components/bets-list.tsx @@ -29,7 +29,7 @@ import { getProbability, getProbabilityAfterSale, resolvedPayout, -} from '../../common/calculate' +} from '../../common/calculate-dpm' import { sellBet } from '../lib/firebase/api-call' import { ConfirmationButton } from './confirmation-button' import { OutcomeLabel, YesLabel, NoLabel } from './outcome-label' diff --git a/web/components/contract-prob-graph.tsx b/web/components/contract-prob-graph.tsx index d764179c..feae5a64 100644 --- a/web/components/contract-prob-graph.tsx +++ b/web/components/contract-prob-graph.tsx @@ -2,7 +2,7 @@ import { DatumValue } from '@nivo/core' import { ResponsiveLine } from '@nivo/line' import dayjs from 'dayjs' import { Bet } from '../../common/bet' -import { getProbability } from '../../common/calculate' +import { getProbability } from '../../common/calculate-dpm' import { useBetsWithoutAntes } from '../hooks/use-bets' import { useWindowSize } from '../hooks/use-window-size' import { Contract } from '../lib/firebase/contracts' diff --git a/web/components/resolution-panel.tsx b/web/components/resolution-panel.tsx index f6cc58e1..45963f64 100644 --- a/web/components/resolution-panel.tsx +++ b/web/components/resolution-panel.tsx @@ -10,7 +10,7 @@ import { Spacer } from './layout/spacer' import { ResolveConfirmationButton } from './confirmation-button' import { resolveMarket } from '../lib/firebase/api-call' import { ProbabilitySelector } from './probability-selector' -import { getProbability } from '../../common/calculate' +import { getProbability } from '../../common/calculate-dpm' import { CREATOR_FEE } from '../../common/fees' export function ResolutionPanel(props: { diff --git a/web/lib/firebase/contracts.ts b/web/lib/firebase/contracts.ts index 362d8139..ad2a4348 100644 --- a/web/lib/firebase/contracts.ts +++ b/web/lib/firebase/contracts.ts @@ -18,7 +18,7 @@ import _ from 'lodash' import { app } from './init' import { getValues, listenForValue, listenForValues } from './utils' import { Binary, Contract, FullContract } from '../../../common/contract' -import { getProbability } from '../../../common/calculate' +import { getProbability } from '../../../common/calculate-dpm' import { createRNG, shuffle } from '../../../common/util/random' import { getCpmmProbability } from '../../../common/calculate-cpmm' export type { Contract } diff --git a/web/pages/api/v0/_types.ts b/web/pages/api/v0/_types.ts index 44a6119e..f793813e 100644 --- a/web/pages/api/v0/_types.ts +++ b/web/pages/api/v0/_types.ts @@ -1,5 +1,5 @@ import { Bet } from '../../../../common/bet' -import { getProbability } from '../../../../common/calculate' +import { getProbability } from '../../../../common/calculate-dpm' import { Comment } from '../../../../common/comment' import { Contract } from '../../../../common/contract' diff --git a/web/pages/make-predictions.tsx b/web/pages/make-predictions.tsx index 37872c39..c4e298fa 100644 --- a/web/pages/make-predictions.tsx +++ b/web/pages/make-predictions.tsx @@ -3,7 +3,7 @@ import dayjs from 'dayjs' import Link from 'next/link' import { useState } from 'react' import Textarea from 'react-expanding-textarea' -import { getProbability } from '../../common/calculate' +import { getProbability } from '../../common/calculate-dpm' import { parseWordsAsTags } from '../../common/util/parse' import { AmountInput } from '../components/amount-input' import { InfoTooltip } from '../components/info-tooltip'