diff --git a/functions/src/create-contract.ts b/functions/src/create-contract.ts
index 2c3c1153..f362157b 100644
--- a/functions/src/create-contract.ts
+++ b/functions/src/create-contract.ts
@@ -33,19 +33,12 @@ export const createContract = functions
const creator = await getUser(userId)
if (!creator) return { status: 'error', message: 'User not found' }
- const {
- question,
- outcomeType,
- description,
- initialProb,
- ante,
- closeTime,
- tags,
- } = data
+ const { question, description, initialProb, ante, closeTime, tags } = data
if (!question)
return { status: 'error', message: 'Missing question field' }
+ let outcomeType = data.outcomeType ?? 'BINARY'
if (outcomeType !== 'BINARY' && outcomeType !== 'MULTI')
return { status: 'error', message: 'Invalid outcomeType' }
diff --git a/web/components/bets-list.tsx b/web/components/bets-list.tsx
index c66a836c..2c973536 100644
--- a/web/components/bets-list.tsx
+++ b/web/components/bets-list.tsx
@@ -18,7 +18,7 @@ import {
Contract,
getContractFromId,
contractPath,
- contractMetrics,
+ getBinaryProbPercent,
} from '../lib/firebase/contracts'
import { Row } from './layout/row'
import { UserLink } from './user-page'
@@ -159,7 +159,7 @@ function MyContractBets(props: { contract: Contract; bets: Bet[] }) {
const { resolution } = contract
const [collapsed, setCollapsed] = useState(true)
- const { probPercent } = contractMetrics(contract)
+ const probPercent = getBinaryProbPercent(contract)
return (
diff --git a/web/components/contract-feed.tsx b/web/components/contract-feed.tsx
index e3e5803e..52cd9412 100644
--- a/web/components/contract-feed.tsx
+++ b/web/components/contract-feed.tsx
@@ -6,7 +6,6 @@ import {
CheckIcon,
DotsVerticalIcon,
LockClosedIcon,
- StarIcon,
UserIcon,
UsersIcon,
XIcon,
@@ -21,6 +20,7 @@ import {
contractPath,
updateContract,
tradingAllowed,
+ getBinaryProbPercent,
} from '../lib/firebase/contracts'
import { useUser } from '../hooks/use-user'
import { Linkify } from './linkify'
@@ -33,8 +33,8 @@ import { SiteLink } from './site-link'
import { Col } from './layout/col'
import { UserLink } from './user-page'
import { DateTimeTooltip } from './datetime-tooltip'
-import { useBets } from '../hooks/use-bets'
-import { Bet, withoutAnteBets } from '../lib/firebase/bets'
+import { useBetsWithoutAntes } from '../hooks/use-bets'
+import { Bet } from '../lib/firebase/bets'
import { Comment, mapCommentsByBetId } from '../lib/firebase/comments'
import { JoinSpans } from './join-spans'
import Textarea from 'react-expanding-textarea'
@@ -302,9 +302,8 @@ function TruncatedComment(props: {
function FeedQuestion(props: { contract: Contract }) {
const { contract } = props
- const { creatorName, creatorUsername, createdTime, question, resolution } =
- contract
- const { probPercent, truePool } = contractMetrics(contract)
+ const { creatorName, creatorUsername, question, resolution } = contract
+ const { truePool } = contractMetrics(contract)
// Currently hidden on mobile; ideally we'd fit this in somewhere.
const closeMessage =
@@ -343,7 +342,7 @@ function FeedQuestion(props: { contract: Contract }) {
))}
- {tradingAllowed(contract) && (
+ {isBinary && tradingAllowed(contract) && (
)}
diff --git a/web/components/contract-overview.tsx b/web/components/contract-overview.tsx
index 6245500a..2b9c56b8 100644
--- a/web/components/contract-overview.tsx
+++ b/web/components/contract-overview.tsx
@@ -1,9 +1,9 @@
import {
- contractMetrics,
Contract,
deleteContract,
contractPath,
tradingAllowed,
+ getBinaryProbPercent,
} from '../lib/firebase/contracts'
import { Col } from './layout/col'
import { Spacer } from './layout/spacer'
@@ -31,62 +31,59 @@ export const ContractOverview = (props: {
className?: string
}) => {
const { contract, bets, comments, folds, className } = props
- const { resolution, creatorId, creatorName } = contract
- const { probPercent, truePool } = contractMetrics(contract)
+ const { question, resolution, creatorId, outcomeType } = contract
const user = useUser()
const isCreator = user?.id === creatorId
+ const isBinary = outcomeType === 'BINARY'
- const tweetQuestion = isCreator
- ? contract.question
- : `${creatorName}: ${contract.question}`
- const tweetDescription = resolution
- ? `Resolved ${resolution}!`
- : `Currently ${probPercent} chance, place your bets here:`
- const url = `https://manifold.markets${contractPath(contract)}`
- const tweetText = `${tweetQuestion}\n\n${tweetDescription}\n\n${url}`
+ const tweetText = getTweetText(contract, isCreator)
return (
-
+
-
-
-
- {tradingAllowed(contract) && (
-
+
- )}
-
+
+ {tradingAllowed(contract) && (
+
+ )}
+
+ )}
-
-
-
+ {isBinary && (
+
+
+
+ )}
-
+ {isBinary && }
{folds.length === 0 ? (
@@ -110,12 +107,9 @@ export const ContractOverview = (props: {
)}
-
-
{/* Show a delete button for contracts without any trading */}
- {isCreator && truePool === 0 && (
+ {isCreator && (isBinary ? bets.length <= 2 : bets.length <= 1) && (
<>
-