no ante selling

This commit is contained in:
mantikoros 2022-01-19 16:36:55 -06:00
parent 4c0a994174
commit 1b5e33ca54
3 changed files with 21 additions and 12 deletions

View File

@ -43,6 +43,7 @@ export function getAnteBets(
probBefore: p,
probAfter: p,
createdTime,
isAnte: true,
}
const noBet: Bet = {
@ -55,6 +56,7 @@ export function getAnteBets(
probBefore: p,
probAfter: p,
createdTime,
isAnte: true,
}
return { yesBet, noBet }

View File

@ -17,6 +17,7 @@ export type Bet = {
}
isSold?: boolean // true if this BUY bet has been sold
isAnte?: boolean
createdTime: number
}

View File

@ -312,10 +312,26 @@ function BetRow(props: { bet: Bet; contract: Contract; saleBet?: Bet }) {
probAfter,
shares,
isSold,
isAnte,
} = bet
const { isResolved, closeTime } = contract
const isClosed = closeTime && Date.now() > closeTime
const saleAmount = saleBet?.sale?.amount
const saleDisplay = bet.isAnte ? (
'ANTE'
) : saleAmount !== undefined ? (
<>{formatMoney(saleAmount)} (sold)</>
) : (
formatMoney(
isResolved
? resolvedPayout(contract, bet)
: calculateSaleAmount(contract, bet)
)
)
return (
<tr>
<td>{dayjs(createdTime).format('MMM D, h:mma')}</td>
@ -327,19 +343,9 @@ function BetRow(props: { bet: Bet; contract: Contract; saleBet?: Bet }) {
{formatPercent(probBefore)} {formatPercent(probAfter)}
</td>
<td>{formatWithCommas(shares)}</td>
<td>
{saleBet?.sale ? (
<>{formatMoney(Math.abs(saleBet.sale.amount))} (sold)</>
) : (
formatMoney(
isResolved
? resolvedPayout(contract, bet)
: calculateSaleAmount(contract, bet)
)
)}
</td>
<td>{saleDisplay}</td>
{!isResolved && !isClosed && !isSold && (
{!isResolved && !isClosed && !isSold && !isAnte && (
<td className="text-neutral">
<SellButton contract={contract} bet={bet} />
</td>