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, probBefore: p,
probAfter: p, probAfter: p,
createdTime, createdTime,
isAnte: true,
} }
const noBet: Bet = { const noBet: Bet = {
@ -55,6 +56,7 @@ export function getAnteBets(
probBefore: p, probBefore: p,
probAfter: p, probAfter: p,
createdTime, createdTime,
isAnte: true,
} }
return { yesBet, noBet } return { yesBet, noBet }

View File

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

View File

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