Commit Graph

389 Commits

Author SHA1 Message Date
Austin Chen
d50cc39c27
Show every user's bets on their profile (#170)
* Show user bets on their profile

* Add an alert for current users

* Replace `/portfolio` with `/Austin?tab=Bets`

* Replace `/Austin?tab=Bets` with `/Austin/bets`

* Use replaceState for better browser history

* Remove two console.logs

* Note a bug

* Fix path

* Write in description of why we're doing this
2022-05-18 10:36:17 -04:00
Marshall Polaris
72b21925e5
Allow users to generate an API key in their profile (#182)
* Add /private-users/apiKey to DB

* Add field to edit API key on profile

* Move API key to bottom of profile page

Austin thinks this is better since most people don't care about it.
2022-05-15 20:41:07 -07:00
Marshall Polaris
07ded756d9
Remove unused imports from random files (#224) 2022-05-13 18:30:52 -07:00
mantikoros
9a4e5763f5
Categories (#132)
* basic market categories

* use tags to store market category

* display category in market

* display full category

* category selector component on feed

* Move feed data fetching to new file

* Decrease batch size for updating feed to prevent out-of-memory error

* Compute and update category feeds!

* Show feeds based on category tabs

* Add react-query package!

* Use react query to cache contracts

* Remove 'other' category

* Add back personal / friends to feed categories

* Show scrollbar temporarily for categories

* Remove 5 categories, change geopolitics to world

* finance => economics

* Show categories on two lines on larger screens

Co-authored-by: James Grugett <jahooma@gmail.com>
2022-05-12 10:07:10 -05:00
Boa
02ed9bf7e1
Single threaded comments (#175)
* Remove unused hideOutcome in comments

* Remove unused hideOutcome in comments

* Add replyToComment fields to Comment

* Add 1 threaded replies to comments & answers

* Allow smooth scrolling within pages via #

* remove yarn-error log

* correct spelling

* Remove smooth-scroll-to-hashtag component

* Cleanup & show user position/bets in replies
2022-05-11 15:11:46 -06:00
Marshall Polaris
acc9c84e2e
More absolute imports (#156)
* Configure functions module to allow absolute imports

* Convert common imports in functions to be absolute

* Convert common imports in web to be absolute

* Convert lib imports in web to be absolute

* Convert hooks imports in web to be absolute

* Convert components imports in web to be absolute
2022-05-09 09:04:36 -04:00
Austin Chen
2eed1c432a Hardcode in 8 frontpage markets 2022-05-07 19:44:01 -04:00
Austin Chen
cea9422802 Update site copy 2022-05-07 10:10:25 -04:00
Boa
bbf419953e
Show comments on profile (#137)
* WIP - got comments on the user page

* Remove number from chosen FR answer

* Distinguish wining and losing FR answers

* Show no answers text

* Simplify get answer items logic

* Show answer number

* Show answer # when resolving

* Fix import path

* Add user's collated comments onto profile

* Allow linking to comments/markets in profile

* Allow preload of users contracts in profile

* Remove unused check

* Small code improvements
2022-05-05 16:30:30 -06:00
Marshall Polaris
2e214cab7a
Kill warmup spam (#133)
* Only warm up sell bet function once

* Only warm up create user function once
2022-05-05 09:51:09 -07:00
Boa
3a33efa8db
Threaded free response comments & general comments sections (#121)
* Allow comments to reference answers

* Add comment inputs for free response answers

* condense comment logic in one component

* Add General Comments section to FR answers

* Prompt signin even if no comment

* Remove unused & refactor

* Simplify general comments logic, toggle comment boxes

* Clarify rendering logic
2022-05-03 14:38:40 -06:00
Sinclair Chen
abf23a1462
Pre-load charity order to prevent "jump" (#122) 2022-05-03 10:25:14 -07:00
Sinclair Chen
db695875c4
CPM: sort charities by amount raised (#117)
* Sort charities by amount raised (after Featured)

* Sort donations chronologically

* refactor charities query to remove parens
2022-05-02 10:55:40 -07:00
James Grugett
bec8cdb3e8 Add share market widget shown if you are the creator 2022-05-02 11:23:54 -04:00
James Grugett
06b7e49e98
[In progress] Server-side feed computation (#106)
* Store view counts & last viewed time

* Schedule updating user recommendations. Compute using tf-idf.

* Update contract's lastBetTime and lastCommentTime on new bets and comments.

* Remove contract's lastUpdatedTime

* Remove folds activity feed

* Implement getFeed cloud function

* Hook up client to use getFeed

* Script to cache viewCounts and lastViewTime

* Batched wait all userRecommendations

* Cache view script runs on all users

* Update user feed each hour and get feed from cache doc.

* Delete view cache script

* Update feed script

* Tweak feed algorithm

* Compute recommendation scores from updateUserFeed

* Disable lastViewedScore factor

* Update lastCommentTime script

* Comment out console.log

* Fix timeout issue by calling new cloud functions with part of the work.

* Listen for contract updates to feed.

* Handle new user: use default feed of top markets this week

* Track lastUpdatedTime

* Tweak logic of calling cloud functions in batches

* Tweak cloud function batching
2022-05-01 11:36:54 -05:00
Marshall Polaris
731e5d5b7c
Apply permissive CORS headers to API (#115)
* Take cors package as dependency

* Apply permissive CORS headers to all API routes
2022-04-30 13:30:49 -07:00
Sinclair Chen
73fc67955d
Send M$ to Charity & txns (#81)
* Add components for CPM landing and charity pages

* Remove misc.ts to fix build

* Set up cloud function for writing txns

* More plumbing for txns

* Fix up API call

* Use Date.now() to keep timestamps simple

* Some styles for charity list page

* Hard code charities data

* Pass charity data to charity page

* Update txn type

* Listen for charity txns

* Handle txn to non-user by burning it

* Read txns for charity card and charity page.

* Set images to object contain

* Clean up txn types

* Move pic to top of card. Other misc styling.

* Update charity short & long descriptions

* Add `token` and `category` to Txn

* Fix breakages

* Show Charity link in the sidebar

* Fix typing issues

* Fix not reading from the right type

* Switch out icon

* Also show Charity icon on mobile

* Update copy

Co-authored-by: Austin Chen <akrolsmir@gmail.com>
Co-authored-by: James Grugett <jahooma@gmail.com>
2022-04-29 19:35:56 -04:00
Marshall Polaris
2ddd95e904
Make tags page filter on server side (#108) 2022-04-28 22:39:39 -07:00
Boa
1e2f9fc099
Support local firestore emulation (#91)
* Support local firestore emulation

* Update readme

* Update readme
2022-04-25 09:46:35 -06:00
mantikoros
004969aa66
user-added liquidity provision panel (#90)
* user-added liquidity provision panel

* AddLiquidityPanel: handle loading, errors

* ContractInfoDialog: don't show add liquidity when market is closed

* ContractInfoDialog: hide add liquidity for FR
2022-04-21 12:58:12 -05:00
Boa
7b70b9b3bd
Free comments (#88)
* Allow free comments with optional bets

* Send emails for comments without bets

* Refactor to share logic

* No free comments on free response questions

* Minor fixes

* Condense line
2022-04-21 11:09:06 -06:00
James Grugett
7847a9e781 Track latency of feed and portfolio page. 2022-04-21 01:00:08 -05:00
James Grugett
e1b5b595e7 Also get new contracts for feed with 0 volume. 2022-04-20 16:59:34 -05:00
James Grugett
3c6369726e Add weekly activiation rate 2022-04-19 01:47:58 -05:00
James Grugett
280ae97070 Track clicks from feed 2022-04-19 00:16:08 -05:00
James Grugett
87b54ff92e Fix getBinaryProb when resolutionProbability is 0. 2022-04-14 23:17:55 -05:00
James Grugett
e53cde5b34 Quick back navigation into feed 2022-04-11 16:13:26 -05:00
James Grugett
ec49a73c74
Algo feed (#77)
* Implement algo feed

* Remove 'See more...' from feed items

* Fix problem with useUpdatedContracts.

* Tweak some params
2022-04-09 18:10:58 -05:00
James Grugett
dfa61be382 Optimize use fold hooks to trigger fewer re-renders 2022-04-06 13:56:08 -05:00
James Grugett
f749eb1df8 Log views of contracts in feed 2022-04-04 22:28:38 -05:00
James Grugett
ed5f69db7a
Sell shares panel (#69)
* Split BuyAmountInput out of AmountInput

* Buy and sell tabs. Compute some sell info

* In progress

* BuyPanel & SellPanel with banner above that shows current shares and toggle button

* Remove "Remaining balance"

* Bring back 'Place a trade'. Tweaks

* Sell shares cloud function.

* Sell all shares by default. Switch back to buy if sell all your shares.

* Cache your shares in local storage so sell banner doesn't flicker.

* Compute sale value of shares with binary search to keep k constant.

* Update bets table to show BUY or SELL

* Fixes from Stephen's review

* Don't allow selling more than max shares in cloud function

* Use modal for sell shares on desktop.

* Handle floating point precision in max shares you can sell.
2022-03-29 14:56:56 -05:00
James Grugett
a967f7459d Sort most traded by volume instead of pool size 2022-03-23 00:27:22 -05:00
James Grugett
364c6ad8e5 Show volume label for DPM contracts too 2022-03-23 00:23:40 -05:00
James Grugett
510e4400d3 Rename liquidity label to volume label 2022-03-23 00:02:47 -05:00
James Grugett
6b61d7209d Compute volume for contracts. Show volume instead of liquidity for cpmm. 2022-03-22 23:49:15 -05:00
James Grugett
033ff3e150 Implement copy for non-standard browsers. Fix flaky embed copy 2022-03-21 16:44:11 -05:00
Austin Chen
37b8cc9687
Show a top 5 leaderboard on resolved markets (#66)
* Show a top5 leaderboard on resolved markets

* Only show profitable traders

* Include sales in profits

* Copy Leaderboard styling

* Also show the top comment and trade

* Fix padding for solo bets

* Only show both comment & bet if they differ
2022-03-20 18:07:45 -07:00
Austin Chen
434c7b6b97 Add most likely, least likely sort options 2022-03-18 19:22:59 -07:00
Austin Chen
7d5d945a20 Show 1 decimal point on probability tails 2022-03-18 19:12:50 -07:00
Austin Chen
94f6f08784 Disable submissions without eating the comment after 1h 2022-03-16 19:55:03 -07:00
mantikoros
c183e00d47
Cfmm (#64)
* cpmm initial commit: common logic, cloud functions

* remove unnecessary property

* contract type

* rename 'calculate.ts' => 'calculate-dpm.ts'

* rename dpm calculations

* use focus hook

* mechanism-agnostic calculations

* bet panel: use new calculations

* use new calculations

* delete markets cloud function

* use correct contract type in scripts / functions

* calculate fixed payouts; bets list calculations

* new bet: use calculateCpmmPurchase

* getOutcomeProbabilityAfterBet

* use deductFixedFees

* fix auto-refactor

* fix antes

* separate logic to payouts-dpm, payouts-fixed

* liquidity provision tracking

* remove comment

* liquidity label

* create liquidity provision even if no ante bet

* liquidity fee

* use all bets for getFixedCancelPayouts

* updateUserBalance: allow negative balances

* store initialProbability in contracts

* turn on liquidity fee; turn off creator fee

* Include time param in tweet url, so image preview is re-fetched

* share redemption

* cpmm ContractBetsTable display

* formatMoney: handle minus zero

* filter out redemption bets

* track fees on contract and bets; change fee schedule for cpmm markets; only pay out creator fees at resolution

* small fixes

* small fixes

* Redeem shares pays back loans first

* Fix initial point on graph

* calculateCpmmPurchase: deduct creator fee

* Filter out redemption bets from feed

* set env to dev for user-testing purposes

* creator fees messaging

* new cfmm: k = y^(1-p) * n^p

* addCpmmLiquidity

* correct price function

* enable fees

* handle overflow

* liquidity provision tracking

* raise fees

* Fix merge error

* fix dpm free response payout for single outcome

* Fix DPM payout calculation

* Remove hardcoding as dev

Co-authored-by: James Grugett <jahooma@gmail.com>
2022-03-15 17:27:51 -05:00
James Grugett
93287f8dc1
Answers in feed (#63)
* Compute answer group feed items

* Refactor feed code into 5 files under feed directory.

* Convert to typed ActivityItems

* Use feed "mode". Clean up cases.

* Implement feed answer groups!

* FR: Use nested comments/bets under answers for contract page. filter more items out of FR feed.

* Linkify answer text on activity feed

* Default feed excluded tags are case insensitive

* Show followed folds first

* Allow filtering your trades

* Store users's last sort in localstorage

* Use avatar of user that submitted answer and name instead of pencil icon. Spacing. Show up to 3 comments in asnwer group.

* Don't reveal market creator's bets

* Fix communites feed to be abbreviated

* Remove complicated answer group logic

Co-authored-by: Austin Chen <akrolsmir@gmail.com>
2022-03-14 15:29:32 -05:00
Austin Chen
da4ce99755
Merge Manifold for Teams infra into main codebase (#61)
* Add dev target for TheoremOne

* Restrict signups to theoremone.co emails

* Add new indices

* Forbid reads from unauthenticated users

* Client-side render pages that need auth

These pages are now client-side rendered:
- /home
- /leaderboards
- /market/...
- /fold/...

* Hide 404 for private Manifolds

* Brand instance for TheoremOne

* Hide "Add Funds" and "Personalize your feed"

* "M$" =>  "T$"

* Hide Discord & About Page too

* Update placeholders for teams

* Update firestore.indexes.json

* Switch /analytics to propz

* Migrate per-env code into common/

* More migrations to PROJECT_ID

* Conditionally use SSG depending on public vs private instance

* Fix props to be empty object

* Move more logic into access

* Spin out config files for each environment

* Generify most of the customizable brand stuff

* Move IS_PRIVATE_MANIFOLD to access.ts

* Rename access.ts to envs/constants.ts

* Add "dev:dev" alias

* Rever firestore rules to existing settings

* Fixes according to James's review
2022-03-08 18:43:30 -08:00
James Grugett
cb9fa0ceb2 Daily active users & comments 2022-03-03 12:59:12 -08:00
James Grugett
c30962bf80 Create bet count and market count charts in our analytics 2022-03-02 17:52:41 -08:00
James Grugett
cd8b336635 Enforce a max comment length 2022-03-02 14:09:53 -08:00
James Grugett
985cdd2537
🏦 Per-market loans! (#57)
* Loan backend: Add loanAmount field to Bet, manage loans up to max loan amount per market -- buy, sell, and resolve.

* Loan frontend: show your loan amount in bet panel, answer bet panel

* Resolve emails include full payout not subtracting loan

* Exclude sold bets from current loan amount

* Handle bets table for loans. Sell dialog explains how you will repay your loan.

* Floor remaining balance

* Fix layout of create answer bet info

* Clean up Sell popup UI

* Fix bug where listen query was not updating data.

* Reword loan copy

* Adjust bet panel width

* Fix loan calc on front end

* Add comment for includeMetadataChanges.

Co-authored-by: Austin Chen <akrolsmir@gmail.com>
2022-03-01 21:31:48 -06:00
James Grugett
0ccba20d5c Add explore tab on home feed that shows random inactive markets. 2022-02-27 13:37:11 -08:00
Austin Chen
8987a02975
Reapply Manifold for Teams config changes (#54)
* Reapply Manifold for Teams config changes

* Add Firebase config for TheoremOne

* Fix build

* Check in Firebase indexes

* Whitelist admins and new users by email

* Fix typo 🤦‍♂️
2022-02-26 23:29:33 -08:00
Austin Chen
492f777d0b Revert "Manifold for Teams: Support different Firestore dbs (#53)"
This reverts commit ebed7c15c0.
2022-02-26 22:19:16 -08:00
Austin Chen
ebed7c15c0
Manifold for Teams: Support different Firestore dbs (#53)
* Add Firebase config for TheoremOne

* Fix build

* Check in Firebase indexes

* Whitelist admins and new users by email
2022-02-26 22:08:50 -08:00
James Grugett
ab5ea0181d Feed: Send only contracts with bets in last 24 hours. Instead of all contracts: 2.2MB => 0.8MB 2022-02-25 02:11:10 -06:00
James Grugett
702755c797 Prevent client error with > 10 tags on contract 2022-02-22 22:21:00 -06:00
mantikoros
a6657a28fd add @SG back to leaderboard 2022-02-22 19:41:57 -06:00
James Grugett
207a12df55 Listen to followed folds. Follow button retreives from local storage. 2022-02-20 23:12:35 -06:00
James Grugett
7c18f4b96b Make feed auto-update again. 2022-02-20 21:06:10 -06:00
James Grugett
fd846254a0 Implement resolving to multiple answers, weighted by probability 2022-02-20 01:26:33 -06:00
mantikoros
13727bb19f
Fast fold following (#51)
* fast follow folds

* FastFoldFollowing component on homepage
2022-02-19 17:17:36 -06:00
Austin Chen
a17342e55c
New, pretty user page (#48)
* Show bio, banner, and social links on user page

* Minor tweaks

* Allow edits to their user page

* Fix build; add a white ring around users

* From userpage, link to /profile (which is always editable now)

* Update userpage SEO

* Clean up Profile menu

* Fixes according to Stephen's code review
2022-02-17 17:16:58 -08:00
James Grugett
b2501d8145
Free response (#47)
* Answer datatype and MULTI outcome type for Contract

* Create free answer contract

* Automatically sort Tailwind classes with Prettier (#45)

* Add Prettier Tailwind plugin

* Autoformat Tailwind classes with Prettier

* Allow for non-binary contracts in contract page and related components

* logo with white inside, transparent bg

* Create answer

* Some UI for showing answers

* Answer bet panel

* Convert rest of calcuate file to generic multi contracts

* Working betting with ante'd NONE answer

* Numbered answers. Layout & calculation tweaks

* Can bet. More layout tweaks!

* Resolve answer UI

* Resolve multi market

* Resolved market UI

* Fix feed and cards for multi contracts

* Sell bets. Various fixes

* Tweaks for trades page

* Always dev mode

* Create answer bet has isAnte: true

* Fix  card showing 0% for multi contracts

* Fix grouped bets feed for multi outcomes

* None option converted to none of the above label at bottom of list. Button to resolve none.

* Tweaks to no answers yet, resolve button layout

* Show ante bets on new answers in the feed

* Update placeholder text for description

* Consolidate firestore rules for subcollections

* Remove Contract and Bet type params. Use string type for outcomes.

* Increase char limit to 10k for answers. Preserve line breaks.

* Don't show resolve options after answer chosen

* Fix type error in script

* Remove NONE resolution option

* Change outcomeType to include 'MULTI' and 'FREE_RESPONSE'

* Show bet probability change and payout when creating answer

* User info change: also change answers

* Append answers to contract field 'answers'

* sort trades by resolved

* Don't include trailing !:,.; in links

* Stop flooring inputs into formatMoney

* Revert "Stop flooring inputs into formatMoney"

This reverts commit 2f7ab18429.

* Consistently floor user.balance

* Expand create panel on focus

From Richard Hanania's feedback

* welcome email: include link to manifold

* Fix home page in dev on branches that are not free-response

* Close emails (#50)

* script init for stephen dev

* market close emails

* order of operations

* template email

* sendMarketCloseEmail: handle unsubscribe

* remove debugging

* marketCloseEmails: every hour

* sendMarketCloseEmails: check undefined

* marketCloseEmails: "every hour" => "every 1 hours"

* Set up a read API using Vercel serverless functions (#49)

* Set up read API using Vercel serverless functions

Featuring:
/api/v0/markets
/api/v0/market/[contractId]
/api/v0/slug/[contractSlug]

* Include tags in API

* Tweaks. Remove filter for only binary contract

* Fix bet probability change for NO bets

* Put back isProd calculation

Co-authored-by: Austin Chen <akrolsmir@gmail.com>
Co-authored-by: mantikoros <sgrugett@gmail.com>
Co-authored-by: mantikoros <95266179+mantikoros@users.noreply.github.com>
2022-02-17 17:00:19 -06:00
James Grugett
63b7f64683 Listen for folds in contract page 2022-02-06 16:55:14 -06:00
James Grugett
6914e5d706 Fix merge error 2022-02-03 21:11:59 -06:00
mantikoros
03f36cf954
User profile (#44)
* add id, userId to comment

* change user info cloud function and script; move cleanUsername to common

* change user info script

* fix rules

* add fund button: useLocation hook

* profile page

* merge

* profile stuff

* avatar uploading to storage bucket

* changeUserInfo: use transaction

* Styles for profile page

* Edit mode for profile, and more styles

Co-authored-by: James Grugett <jahooma@gmail.com>
2022-02-03 21:04:56 -06:00
James Grugett
552e6e6c3a
Custom feed (#43)
* Show custom feed of contracts from folds your follow or have bet on.

* Add tw-elements UI library

* Add loading spinner while feed loads

* Switch from onSnapshot to our listenForValues, which doesn't set with partial cached values

* Change home tags to communities

* Remove tw-elements for now
2022-02-03 18:13:04 -06:00
James Grugett
fdbaa5270b Show hot markets in fold feed 2022-02-02 23:58:27 -06:00
James Grugett
f80ef1cd34 Add hot markets to home feed 2022-02-02 00:40:46 -06:00
mantikoros
375ce69b7d yarn devdev 2022-02-01 21:23:06 -06:00
James Grugett
b95f258763 Add package.json to common directory, and lodash dependency 2022-02-01 12:59:51 -06:00
James Grugett
7e15c2870b Sort folds by followers in fold tag list 2022-02-01 12:47:31 -06:00
James Grugett
7c50b55331 Match lowercase tags for folds 2022-02-01 12:29:14 -06:00
James Grugett
565ded1063 Add folds links in market, hide tags behind Show tags toggle. 2022-02-01 12:06:42 -06:00
James Grugett
ff4bb3330a Change back to isProd = true 2022-01-30 22:29:16 -06:00
James Grugett
00b7f3505f Listen for contract updates in folds feed 2022-01-30 22:12:12 -06:00
mantikoros
f06ca8305c
Resolve prob (#41)
* rename MKT to PROB; show resolved probability; move format utilities to common

* ProbabilitySelector

* resolve to PROB

* prob and mkt labels
2022-01-30 15:51:30 -06:00
jahooma
ac9af1acd6 Don't load onSnapshot from cache in hook listen for contract (could help 404 errors?) 2022-01-29 23:05:32 -06:00
mantikoros
d9c67e8d49 new signed-out homepage 2022-01-26 18:21:25 -06:00
jahooma
2e7a8210bb No symbols in fold primary tag. Limit Name to 140 chars 2022-01-26 17:45:07 -06:00
jahooma
348c8d565a Fold delete 2022-01-26 14:56:15 -06:00
Austin Chen
e4377ee3a3
Allow betting directly from the activity feed (#36)
* Show a popup for betting on the Activity feed

* Replace the popup with a YES/NO selector

* Autofocus the bet amount

* Hide BetRow when not appropriate

* Make bet modal larger on desktop

* Default to YES if no bet choice has been made yet
2022-01-26 14:08:03 -06:00
jahooma
76841e53b1 Follow and unfollow folds 2022-01-26 14:03:32 -06:00
jahooma
2ea05f8913 Folds query on lowercase tags. Adding to description updates tags & lowercaseTags fields. 2022-01-25 17:52:21 -06:00
jahooma
8b0091f30d Split out create fold button. Show about description on /folds 2022-01-25 17:02:02 -06:00
James Grugett
8b9d0e5dba
New fold page UI with tabs (#37)
* Tabbed fold page

* Implement market, leaderboard tab views for fold. And edit dialog

* Add about field to Fold
2022-01-25 14:47:25 -06:00
Austin Chen
793a2c6d6c Closing soon: hide already closed, show close time 2022-01-24 01:38:29 -06:00
Austin Chen
13590bf5d1 Surface user emails in /admin 2022-01-24 00:48:10 -06:00
jahooma
bc3e43802b Listen for new folds on /folds 2022-01-23 23:48:10 -06:00
jahooma
b059a44acc Use fold hook 2022-01-23 00:51:19 -06:00
jahooma
aa1022546d Implement leaderboards for folds! 2022-01-22 17:59:50 -06:00
jahooma
bc1decdbfc Initialize folds with one primary tag 2022-01-22 15:47:24 -06:00
jahooma
0617fedb17 Add /markets for fold 2022-01-22 11:39:35 -06:00
mantikoros
4698d119b4 activity, withoutAnteBets: check for undefined 2022-01-22 11:15:14 -06:00
jahooma
d357f51883 Reorg homepage. No feed when not signed in, add back hot & closing soon for signed 2022-01-21 18:28:12 -06:00
James Grugett
60f68b178d
Folds (#34)
* Fold type, fold page, query for fold contracts

* Tsconfig: target esnext, nounused locals: false

* Store tags in field on contract. Script to update contract tags

* Show tags on fold page

* Load all fold comments server-side to serve better feed

* Fix the annoying firebase already initialized error!

* Add links to /edit and /leaderboards for fold

* Page with list of folds

* UI for creating a fold

* Create a fold

* Edit fold page
2022-01-21 17:21:46 -06:00
mantikoros
4528615863
Private user (#32)
* PrivateUser

* createUser: create private user; detect multiple signups

* include user properties in private user

* script: create private users

* unsubscribing from market resolution emails

* track total deposits
2022-01-18 21:36:46 -06:00
jahooma
142feaffff Don't show unlisted contracts in closing soon 2022-01-18 13:17:56 -06:00
mantikoros
908c8c03e6
Create user cloud function (#31)
* createUser cloud function; change User object

* initial commit

* listenForLogin: avoid race condition

* createUser: allow capital letters in username

* remove debugging

* leaderboard: empty url for undefined avatar image
2022-01-18 01:18:38 -06:00
James Grugett
6625983bb7
Leaderboards 🏅 (#30)
* Simple leaderboards

* Filter out SG from traders. Center leaderboard. Use Nextjs Image.

* Add leaderboards menu option

* Put leaderboards side-by-side on large screens

* Add medal emoji
2022-01-17 21:20:25 -06:00
jahooma
4d975ff512 Add closing soon section to home 2022-01-17 16:54:00 -06:00
jahooma
56c7e2597d Schedule cloud function to update user metrics: totalPnL, creatorVolume 2022-01-17 15:39:34 -06:00
Austin Chen
7d7286b1c1
Denormalize the avatar URL on contract creation (#29) 2022-01-16 01:03:59 -05:00
Austin Chen
279437ba08
List users on admin page (#28)
* Admin page using gridjs

* Move hook into separate file

* Link to each user's Manifold and Firestore /user entry

* Gate admin access to Austin/James/Stephen

* Don't leak the existence of /admin

* Add a custom 404 page that directs to Discord.

* Fix broken window.location.href on NextJS server
2022-01-15 22:09:15 -05:00
jahooma
f6079e68d0 Choose random hot contracts from top 16 every 5 minutes. 2022-01-15 00:44:33 -06:00
jahooma
e12e399679 Fix feed order moving around on load 2022-01-14 19:12:38 -06:00
jahooma
895eba4553 Get static props of just data for feed: active contracts, their bets & comments. 2022-01-14 18:16:32 -06:00
jahooma
dfcac2fb97 Hide ante bets in graph and feed 2022-01-13 11:01:23 -06:00
jahooma
de043de589 Add visibility field to contracts. Hot contracts & activity feed show only visibility 'public'. 2022-01-12 19:53:50 -06:00
jahooma
cc5312f52e Change is prod to true 2022-01-12 15:23:29 -06:00
mantikoros
9d5490cf9a
Switch to new dpm mechanism (#26)
* initial commit

* antes

* rename path, compute to contractPath, contractMetrics

* merge

* Include antes as bets; more calculations

* fees on estimated winnings

* mkt payout calculation

* contract: remove startPool, add phantomShares

* Merge branch 'main' into new-dpm

* dpm migration script

* my service account
2022-01-12 13:01:04 -06:00
Austin Chen
5b431226d4
Show all recent activity on a central feed (#24)
* Tracks all market activity on a single page

* Support both global and per-contract feeds

* UI tweaks

* Include contract description in activity feed

* Show activity feed on Create page
2022-01-11 11:56:26 -05:00
mantikoros
b97a65cf2c refactor data structures, calculations to common directory 2022-01-10 15:07:57 -06:00
jahooma
16ab0e0c37 Query hot contracts from volume24Hours field. 2022-01-09 14:26:51 -06:00
jahooma
6b4417d8b8 Every 15 minutes, compute contract volume in last 24 hours and 7 days 2022-01-09 13:34:42 -06:00
jahooma
6d4554e9ef Don't show resolved markets in hot markets 2022-01-09 12:14:20 -06:00
jahooma
44fa4f263b Encode referrer url param for stripe checkout 2022-01-07 18:51:16 -06:00
James Grugett
af6387bbf3
Stripe (#22)
* basic working payments

* Select funds amount and prettier funds button / dialog

* Add funds page and nav menu option

* Format funds amount. Use ghost button for back.

* Add mantic dollars description

* Improve styles of add funds page

* about styling

* change faq => about

* change default font to Courier

* header sign out menu item; remove user  card

* keep logo font

* fix header issue

* stripe webhook: handle repeat events

* Make add funds button a gradient

* add funds referer url

* Fix add funds page after merge

* Slight VisD tweaks

* Update add funds button position. Mantic => Manifold

* Remove Add funds menu option for now.

* Set up product ids and endpoint for stripe prod

* Swap back order in profile menu

Co-authored-by: mantikoros <sgrugett@gmail.com>
Co-authored-by: Austin Chen <akrolsmir@gmail.com>
2022-01-07 16:56:14 -06:00
mantikoros
1b69a34270 allow updating contract description 2022-01-07 13:29:23 -06:00
jahooma
75e9d419ee Fix payout calculation for correct bet in bet panel. 2022-01-05 17:03:30 -06:00
mantikoros
0b8ad76b0f global warming: warm up all cloud functions on client 2022-01-05 12:30:16 -06:00
jahooma
e20537bf49 Remove tags and date from card. 2022-01-05 01:06:30 -06:00
jahooma
1bc323d575 Hot markets! 🔥 2022-01-05 00:33:01 -06:00
mantikoros
7c875f80da subsidized markets; create contract cloud function 2022-01-04 23:51:34 -06:00
Austin Chen
07ce27f20b
Show activity feed on each market & allow comments on your bets (#18)
* Copy feed template from TailwindUI

* Show all bets in a feed-like manner

* Tweak design of individual trades

* Allow traders to comment on their bets

* Code cleanups

* Incorporate contract description into the feed

* Support description editing from contract feed

* Group together bets placed within 24h

* Fix build error

* Add a feed item for market resolution

* Add a feed item for markets that have closed

* Comment on a separate subcollection
2022-01-03 23:21:14 -08:00
Austin Chen
fb0e16d619
Add a closing date to Create Market (#10)
* Preview a slimmed-down version of /Create

* Rework dropdown to be on bottom

* Parse the close time as just before midnight

* Prevent invalid contracts from being created

* Prevent trading after contract has closed
2022-01-02 21:21:25 -08:00
jahooma
3ba96028f4 Parse tags to get unique ignoring case 2022-01-02 16:53:20 -06:00
mantikoros
907acec601
Mkt resolution 2: Enable MKT resolution (#16)
* new standard resolution; contract.totalBets; MKT resolution

* recalculate script

* enable resolve MKT

* different approach to resolve MKT

* comment out init

* Count payouts for bets with exluded sales

Co-authored-by: jahooma <jahooma@gmail.com>
2022-01-02 00:27:58 -06:00
mantikoros
5890b74225
Mkt resolution: new standard resolution (pay back bets first) (#15)
* new standard resolution; contract.totalBets; MKT resolution

* recalculate script

* Fix one bug and change script name

Co-authored-by: jahooma <jahooma@gmail.com>
2022-01-01 19:03:18 -06:00
jahooma
4db7e03b92 Switch to old current value calculation 2021-12-31 17:22:15 -06:00
jahooma
96d5ea0437 Add sort by tag 2021-12-31 13:41:41 -06:00
jahooma
a5e4411075 Load all contracts, and filter to 99 client-side. 2021-12-30 13:35:29 -05:00
Austin Chen
a9e1cbc0be
Point local server to prod Firebase for now (#13) 2021-12-29 23:31:26 -08:00
mantikoros
f48ae0170b
Sell bets (#12)
* sell bet

* dev mode

* single-pot no-refund payoff; bet selling

* Increase default fetch size 25 -> 99

* Fix about page numbering

* Don't flash no markets when loading on tag page.

* Change Title to use body font

* Make a bunch of predictions at once (#9)

* Set up a page to make bulk predictions

* Integrate preview into the same card

* List created predictions

* Make changes per James's comments

* Increase the starting balance (#11)

* Remove references to paying for our Mantic Dollars

* Update simulator to use new calculations

* Change simulator random to be evenly random again

* Sell bet UI

* Migrate contracts and bets script

* Add comment to script

* bets => trades; exclude sold bets

* change sale formula

* Change current value to uncapped sell value.

* Disable sell button while selling

* Update some 'bet' to 'trade'

Co-authored-by: Austin Chen <akrolsmir@gmail.com>
Co-authored-by: jahooma <jahooma@gmail.com>
2021-12-24 15:06:01 -06:00
James Grugett
ff4550fe51
Increase the starting balance (#11) 2021-12-21 13:52:27 -06:00
Austin Chen
9d438dc356
Make a bunch of predictions at once (#9)
* Set up a page to make bulk predictions

* Integrate preview into the same card

* List created predictions

* Make changes per James's comments
2021-12-20 22:29:32 -08:00
Austin Chen
f79d69cd69 Increase default fetch size 25 -> 99 2021-12-20 09:56:27 -08:00
Austin Chen
77e15e3aa8 Denormalize username to each contract 2021-12-17 23:27:29 -08:00
mantikoros
b5761baeaf raise start pool capital to M$200 2021-12-17 17:40:32 -06:00
mantikoros
03a3df261c contract slugs 2021-12-17 17:16:42 -06:00
mantikoros
756f31b1b7 rename contract properties 2021-12-17 16:15:09 -06:00
Austin Chen
022caa4407 Revert to URLs without @ 2021-12-17 10:55:18 -08:00
jahooma
9bf257ef64 Embed markets below landing page. Listen for market changes 2021-12-16 22:44:48 -06:00
jahooma
2c9f8e00bf Fix nextjs console error by not loading from localstorage immedately. Use layout effect instead. 2021-12-16 22:09:38 -06:00
jahooma
96791e11a5 Stop flash of landing page when signed in and loading '/' 2021-12-16 21:37:38 -06:00
mantikoros
99637d913d add meta tags to contract 2021-12-16 12:21:16 -06:00
jahooma
8abbc34652 Improve graph for resolved bets 2021-12-16 00:44:04 -06:00
mantikoros
9bd0ad7211 test 2021-12-15 22:20:39 -06:00
jahooma
83b4cc38b3 Show just payout column for resolved markets, tweak calculation and resolved labels. 2021-12-15 20:28:40 -06:00
Austin Chen
743616449f Prefix username URLs with @ 2021-12-15 18:26:38 -08:00
Austin Chen
9df78a4963 Support user profiles on /[username]
Currently all bets are also shown
2021-12-15 17:34:36 -08:00
Austin Chen
8e119a6338 Replace /contract/[id] with /[username]/[id] 2021-12-15 16:52:19 -08:00
jahooma
f32933f668 Bet calculation / UI updates 2021-12-15 17:27:02 -06:00
jahooma
e8f94f48e2 Update bet UI with market summary and computed columns 2021-12-15 16:58:38 -06:00
mantikoros
e281233924 contract now has dpmWeights 2021-12-15 16:44:22 -06:00
mantikoros
4b123d47ee change starting balance to 100 2021-12-15 16:27:57 -06:00
jahooma
fda5013bf8 Simple bets list 2021-12-15 01:41:56 -06:00
jahooma
344b06124f useUser: Listen for changes to logged in user 2021-12-14 18:45:13 -06:00
jahooma
6e61b38a9b Remove resolved panel, move info into contract overview. 2021-12-14 12:51:30 -06:00
mantikoros
b85d9035b0 lower new user starting balance to M$1000 2021-12-14 11:36:23 -06:00
Austin Chen
dc90c4fa74 Extract shared logic into ContractDetails 2021-12-14 02:23:32 -08:00
Austin Chen
d4bb419478 Prettier everything
(Hopefully for the last time)
2021-12-13 23:30:09 -08:00
jahooma
1562565f9a Try to fix build maximum fraction digits out of range error 2021-12-14 01:09:46 -06:00
jahooma
5c7a8e52c9 Fix type errors 2021-12-14 01:05:33 -06:00
jahooma
43941cd212 Simple market resolved panel 2021-12-14 00:12:25 -06:00
jahooma
15691c0a38 Query for user bets. Template page to show them. 2021-12-13 23:40:38 -06:00
Austin Chen
bae969058a Add a page which lists all markets
TODO: Add in functionality
2021-12-13 17:09:58 -08:00
mantikoros
5ffe266cf7 contract creation: use slug, calculate seed amounts from given probability 2021-12-13 19:07:36 -06:00
Austin Chen
e9c183a493 Allow users to sign in from /account
SQ
2021-12-13 10:37:16 -08:00
mantikoros
53907d2d52 user.balanceUsd => user.balance 2021-12-13 11:58:47 -06:00
mantikoros
cfd2f22254 simulator: quadratic price function, random bets, change table cols 2021-12-12 17:06:46 -06:00
jahooma
b216236503 Graph bets by afterProb. 2021-12-12 16:14:52 -06:00
jahooma
29e13497bf Add volume calculation. Remove new bet button that was unnecessary. 2021-12-10 22:09:32 -06:00
jahooma
e253b3beca Make bet panel calculate bet info and display it. 2021-12-10 21:51:35 -06:00
Austin Chen
fb9a690707 Run prettier 2021-12-10 17:20:52 -08:00
mantikoros
d95bef8ab3 placeBet 2021-12-10 18:06:17 -06:00
jahooma
77ce27f45f Submit bets to firestore 2021-12-10 11:14:05 -06:00
Austin Chen
d945dc894b Merge branch 'contract-page' into create-contract 2021-12-10 00:21:55 -08:00
Austin Chen
70e86155be Sort contracts by creation time 2021-12-09 23:08:28 -08:00
jahooma
7309096854 Merge branch 'main' into contract-page 2021-12-10 00:33:11 -06:00
jahooma
443b742c4a Implement skeleton ContractPage 2021-12-10 00:21:12 -06:00
Austin Chen
4f2c8bcdce Add back listenForContract 2021-12-09 21:01:44 -08:00
Austin Chen
09b4639198 Allow users to create new contracts 2021-12-09 20:54:40 -08:00
Austin Chen
89a7bd65d2 Standardize on useUser hook 2021-12-09 16:09:16 -08:00
Austin Chen
7ec3da5504
Allow logging in with Firebase (#2)
* Pin package.json to exact version

* Fix according to reviewer feedback
2021-12-09 15:33:01 -08:00
jahooma
1cd3e2f1be Add contract page 2021-12-09 16:44:04 -06:00
jahooma
c8b86a43b9 Add template contract page 2021-12-09 16:05:55 -06:00
Austin Chen
e41250a89b Upload basic Firebase Auth code 2021-12-09 15:31:20 -06:00
Austin Chen
2a3d9e6272 Add Firestore package and config 2021-12-09 15:31:20 -06:00
Austin Chen
021341331f Upload basic Firebase Auth code 2021-12-08 16:43:42 -08:00
Austin Chen
55ddb2a7d4 Add Firestore package and config 2021-12-08 16:43:42 -08:00
Austin Chen
634c0af85b
Finish porting simulator into React (#1)
* Preview bid results; toggle bid type

* Code cleanup: move hooks to where they're used

* Extract header to separate component

* Fix & reactify according to James's review

* Remove unnecessary useMemo

* Hack Chartjs type

* Add some notes on DX Todos

* Move non-page elements to lib/
2021-12-08 08:30:29 -08:00