* Migrate sellBet to v2
* Kill sellBet warmup requests
* Point client at new v2 sellbet function
* Clean up `getSellBetInfo`
* Fix up functions index.ts
* Revert "Revert "Notifications ux fixes - wip (#383)""
This reverts commit 699b03eb42.
* Group & provide more control over notification display
* UI/UX improvements
* Remove unused text key
* Refactor
* Refactor
* Show answer resolution in notification
* Disable eslint on single linefor exhaustive deps
* Handle arbritrary notifications
* Refactor
* Remove unused vars
* Add follow user
* Various UX improvements, add follow notif
* Various small ui changes
* Show notification settings breakdown
* Improve notification status lines
* refactoring
(cherry picked from commit 4de86d5b08)
* removed unused imports and variables
* added type for binary resolution
* Prettier
* const for binary resolutions
* using the type "resolution"
* Prettier
* Update functions/src/create-contract.ts
* launch config for debugging with vs code
* "Launch Chrome" does not work since login via google is not possible in debugger-chrome
* Breakpoints are unbound when attached to chrome
* Add the great Zod as a dependency to help us
* Tweak eslint
* Rewrite a ton of stuff in createContract and placeBet
* Clean up error reporting in API
* Make sure the UI is enforcing validated limits on lengths
* Remove unnecessary Math.abs
* Better type on `BetInfo`
* Kill `manaLimitPerUser`
* Clean up hacky parameters on bet info functions
* Validate `closeTime` as a valid timestamp in the future
* Add tsconfig.json for common
* Prefer `const` over `let` over `var`
* Kill dead code
* Fix some trivial Typescript issues
* Turn on Typescript linting in common except for no-explicit-any
* Correctly specify tsconfig dir name in functions eslintrc
* Play with using 3 icons for 1-click usage
* Align bet icons with the percentages
* Hide liquidity injection star, for now
* Fix Free Response card layouts
* Use triangles instead of planes
* Set correct hover states the arrows
* Fix down triangle & padding
* Default large nums to 2 sigfigs
* Clean up hover areas
* Fix bet width, remove "chance/expected"
* Show "M$20" on hover, hide arrows when closed
* Improve click targets
* FR: "MULTI" => "MANY", single => "TOP"
* Install react-hot-toaster
* Implement quick betting on binary questions
* Handle different kinds of markets
* Extract out QuickBet into its own component
* Minor tweaks
* Visually separate out quick bet pane
* Hide quick bet for FR markets with no answers
* Fill in which bets the user has already placed
* Animate movements, fix binary direction
* Hover arrows are now always gray
* Pull out code into quick-bet.tsx
* Minor comments
* Fix import
ts-ignore is scary
* Fixes from James's feedback
* Hide text only on quickbet
* Improve typing of client CORS helper
* Take node-fetch as a dependency
* Add explicit Firebase region into config
* Add new Vercel proxy API routes that talk to backend
* Call Vercel proxy routes from `api-call` module
* Tweak import to try to get Vercel happy
* Tidy up a tiny bit
* Set common package.json sideEffects: false
* Configure SWC to modularize lodash imports
* Import specific lodash functions instead of _
* Add an eslint rule to avoid full lodash import
* Fix ultra embarrassing bug not restricting CORS origins
* Put CORS origin regexps in common
* Static types so I don't muck it up again
* Fixup CORS regex to be more strict
* Fix sloppy imports to actually work
* Numeric contract type
* Create market numeric type
* Add numeric graph (coded without testing)
* Outline of numeric bet panel
* Update bet panel logic
* create numeric contracts
* remove batching for antes for numeric markets
* Remove focus
* numeric market range [1, 100]
* Zoom graph
* Hide bet panels
* getNumericBets
* Add numeric resolution panel
* Use getNumericBets in bet panel calc
* Switch bucket count to 100
* Parallelize ante creation
* placeBet for numeric markets
* halve std of numeric bets
* Update resolveMarket with numeric type
* Set min and max for contract
* lower std for numeric bets
* calculateNumericDpmShares: use sorted order
* Use min and max to map the input
* Fix probability calc
* normpdf variance mislabeled
* range input
* merge
* change numeric graph color
* fix getNewContract params
* bet panel labels
* validation
* number input
* fix bucketing
* bucket input, numeric resolution panel
* outcome label
* merge
* numeric bet panel on mobile
* Make text underneath filled green answer bar selectable
* Default to 'all' feed category when loading page.
* fix numeric resolution panel
* fix numeric bet panel calculations
* display numeric resolution
* don't render NumericBetPanel for non numeric markets
* numeric bets: store shares, bet amounts across buckets in each bet object
* restore your bets for numeric markets
* numeric pnl calculations
* remove hasUserHitManaLimit
* contrain contract type
* handle undefined allOutcomeShares
* numeric ante bet amount
* use correct amount for numeric dpm payouts
* change numeric graph/outcome color
* numeric constants
* hack to show correct numeric payout in calculateDpmPayoutAfterCorrectBet
* remove comment
* fix ante display in bet list
* halve bucket count
* cast to NumericContract
* fix merge imports
* OUTCOME_TYPES
* typo
* lower bucket count to 200
* store raw numeric value with bet
* store raw numeric resolution value
* number input max length
* create page: min, max to undefined if not numeric market
* numeric resolution formatting
* expected value for numeric markets
* expected value for numeric markets
* rearrange lines for readability
* move normalpdf to util/math
* show bets tab
* check if outcomeMode is undefined
* remove extraneous auto-merge cruft
* hide comment status for numeric markets
* import
Co-authored-by: mantikoros <sgrugett@gmail.com>
Pros:
- Better emphasizes "mana"
- Visually pleasing
- Visually distinct (acts as an icon)
- Single character
Cons
- Harder to correctly type (but users can just do m1234 for shorthand)
* 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.
* randomString: generate a securely random string.
Also, support lengths > 12 in case that's ever needed.
This is used in at least one case (creating device tokens for users)
where it seems important that the output is unpredictable.
* Try harder to create unique usernames.
The previous version added 16 bits of entropy to the username, which
isn't all that much. Due to the birthday paradox, it would be enough to
create ~256 users with the same prefix to get a collision.
Trying that would probably fail later on, and not create security
issues... but it just seems better to be on the safe side here.
* 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>
* deduct market ante from profits
* display creator fees in stats
* show creator earnings in stats
* separate out creator, liquidity fees in payouts and deduct from profits
* include creator payout in resolution emails
* deduct liquidity from profits
* hide cost tooltip if daily free market
* deduct market ante from profits
* display creator fees in stats
* show creator earnings in stats
* separate out creator, liquidity fees in payouts and deduct from profits
* 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
* 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>
* 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
* Add legend to free response graph
* Hide answers panel unless resolving. Correctly order answers
* No gray background for add answer & resolve panel. Tweak spacing
* Max answer length 240 chars
* Show answer text in resolution for market page, card instead of number.
* Remove remaining answer #'s. Refactor outcome/resolution labels.
* Move answer panel back up
* Tweak spacing
* Update placement of bet button on mobile for FR answer feed item
* Fix reversed feed for binary markets
* Show multi resolve options
* Clean up unused parts of answer item
* Lighten resolve buttons
* Show answer text in market resolve email
* cfmm migration script
* save dpm shares, pool
* formatMoney: use floor instead of round
* migrate cfmm: use sale amount as shares for sold bets
* migration: make up fake share qty for sold shares
* migration: also convert resolved markets
* migration: don't migrate resolved markets after all
* migration: error checking
* 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.
* 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>
* 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>
* 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
* 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>
* 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 🤦♂️
* 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
* 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>
* script init for stephen dev
* market close emails
* order of operations
* template email
* sendMarketCloseEmail: handle unsubscribe
* remove debugging
* marketCloseEmails: every hour
* 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>
* 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
* 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
* 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