From a90e9b7083870d6f9f475641b5a34fcb41df0859 Mon Sep 17 00:00:00 2001
From: James Grugett
Date: Thu, 3 Feb 2022 00:19:59 -0600
Subject: [PATCH 01/10] Reorder fold page queries to be more in parallel
---
web/pages/fold/[...slugs]/index.tsx | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/web/pages/fold/[...slugs]/index.tsx b/web/pages/fold/[...slugs]/index.tsx
index 6841cf27..e93bdbbb 100644
--- a/web/pages/fold/[...slugs]/index.tsx
+++ b/web/pages/fold/[...slugs]/index.tsx
@@ -48,6 +48,10 @@ export async function getStaticProps(props: { params: { slugs: string[] } }) {
const contracts = fold ? await getFoldContracts(fold).catch((_) => []) : []
+ const betsPromise = Promise.all(
+ contracts.map((contract) => listAllBets(contract.id))
+ )
+
const [contractComments, contractRecentBets] = await Promise.all([
Promise.all(
contracts.map((contract) => listAllComments(contract.id).catch((_) => []))
@@ -79,17 +83,16 @@ export async function getStaticProps(props: { params: { slugs: string[] } }) {
contractComments[contracts.findIndex((c) => c.id === contract.id)]
)
- const curator = await curatorPromise
-
- const bets = await Promise.all(
- contracts.map((contract) => listAllBets(contract.id))
- )
+ const bets = await betsPromise
const creatorScores = scoreCreators(contracts, bets)
- const topCreators = await toTopUsers(creatorScores)
-
const traderScores = scoreTraders(contracts, bets)
- const topTraders = await toTopUsers(traderScores)
+ const [topCreators, topTraders] = await Promise.all([
+ toTopUsers(creatorScores),
+ toTopUsers(traderScores),
+ ])
+
+ const curator = await curatorPromise
return {
props: {
From d0766fa7c3560e25c47e816c69b79ad2a06fb6e7 Mon Sep 17 00:00:00 2001
From: Austin Chen
Date: Thu, 3 Feb 2022 00:56:49 -0800
Subject: [PATCH 02/10] Use the latest bet time for a feed group
---
web/components/contract-feed.tsx | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/web/components/contract-feed.tsx b/web/components/contract-feed.tsx
index fe1cbaaa..8455744d 100644
--- a/web/components/contract-feed.tsx
+++ b/web/components/contract-feed.tsx
@@ -540,7 +540,8 @@ function FeedBetGroup(props: { activityItem: any }) {
const [yesBets, noBets] = _.partition(bets, (bet) => bet.outcome === 'YES')
- const createdTime = bets[0].createdTime
+ // Use the time of the last bet for the entire group
+ const createdTime = bets[bets.length - 1].createdTime
return (
<>
From e7433c2eec57c12d74917ce5ce5956f4d5cb3c4a Mon Sep 17 00:00:00 2001
From: Austin Chen
Date: Thu, 3 Feb 2022 01:12:37 -0800
Subject: [PATCH 03/10] Save comment and description on ctrl+enter
---
web/components/contract-feed.tsx | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/web/components/contract-feed.tsx b/web/components/contract-feed.tsx
index 8455744d..2279e2fb 100644
--- a/web/components/contract-feed.tsx
+++ b/web/components/contract-feed.tsx
@@ -130,6 +130,11 @@ function FeedBet(props: { activityItem: any }) {
className="textarea textarea-bordered w-full"
placeholder="Add a comment..."
rows={3}
+ onKeyDown={(e) => {
+ if (e.key === 'Enter' && e.ctrlKey) {
+ submitComment()
+ }
+ }}
/>
How are markets resolved?
- The creator of the prediction market decides the outcome and earns 1% of
- the betting pool for their effort.
+ The creator of the prediction market decides the outcome and earns{' '}
+ {CREATOR_FEE * 100}% of the winnings as a commission for creating and
+ resolving the market.
This simple resolution mechanism has surprising benefits in allowing a
diff --git a/web/pages/create.tsx b/web/pages/create.tsx
index 0dddd6f1..bc747fc7 100644
--- a/web/pages/create.tsx
+++ b/web/pages/create.tsx
@@ -177,7 +177,7 @@ export function NewContract(props: { question: string; tag?: string }) {
Market ante
Date: Thu, 3 Feb 2022 17:07:30 -0600
Subject: [PATCH 10/10] resolution panel creator fee
---
web/components/resolution-panel.tsx | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/web/components/resolution-panel.tsx b/web/components/resolution-panel.tsx
index 1a409f7e..a31072c4 100644
--- a/web/components/resolution-panel.tsx
+++ b/web/components/resolution-panel.tsx
@@ -11,6 +11,7 @@ import { ConfirmationButton as ConfirmationButton } from './confirmation-button'
import { resolveMarket } from '../lib/firebase/api-call'
import { ProbabilitySelector } from './probability-selector'
import { getProbability } from '../../common/calculate'
+import { CREATOR_FEE } from '../../common/fees'
export function ResolutionPanel(props: {
creator: User
@@ -79,16 +80,20 @@ export function ResolutionPanel(props: {
{outcome === 'YES' ? (
<>
- Winnings will be paid out to YES bettors. You earn 1% of the pool.
+ Winnings will be paid out to YES bettors. You earn{' '}
+ {CREATOR_FEE * 100}%.
>
) : outcome === 'NO' ? (
- <>Winnings will be paid out to NO bettors. You earn 1% of the pool.>
+ <>
+ Winnings will be paid out to NO bettors. You earn{' '}
+ {CREATOR_FEE * 100}%.
+ >
) : outcome === 'CANCEL' ? (
<>The pool will be returned to traders with no fees.>
) : outcome === 'MKT' ? (
<>
- Traders will be paid out at the probability you specify. You earn 1%
- of the pool.
+ Traders will be paid out at the probability you specify. You earn{' '}
+ {CREATOR_FEE * 100}%.
>
) : (
<>Resolving this market will immediately pay out traders.>