Commit Graph

56 Commits

Author SHA1 Message Date
mantikoros
c45da8c334
Tracking (#511)
* tracking helper functions

* track everything

* remove extraneous code
2022-06-15 16:34:34 -05:00
mantikoros
38c63fb3ee
Amplitude (#505)
* basic amplitude setup

* delete heap

* track referrers

* basic tracking

* delete unused import

* prettier
2022-06-14 22:00:36 -05:00
James Grugett
f3d4827115
Listen for contract updates when navigating from home to contract page. (#494) 2022-06-13 11:04:56 -05:00
Marshall Polaris
816fc5d64c Revert "Revert "Turn on no unused variables linting, kill dead code (#484)""
This reverts commit 5beda1ded7.
2022-06-12 21:42:41 -07:00
Austin Chen
5beda1ded7 Revert "Turn on no unused variables linting, kill dead code (#484)"
This reverts commit 515928a69a.
2022-06-12 20:55:48 -07:00
Marshall Polaris
515928a69a
Turn on no unused variables linting, kill dead code (#484)
* Slightly fix up ChoicesToggleGroup

* Kill a bunch of dead code and unused variables

* Turn on no-unused-vars lint

* Un-kill some dead code that James likes
2022-06-12 19:04:55 -07:00
James Grugett
457db07da4 Show all answers in answer panel 2022-06-10 23:28:09 -05:00
James Grugett
a68e943d0b Refactor to load bets once on market page 2022-06-10 12:23:35 -05:00
Marshall Polaris
7c4ec2a8e3
Refactor contract typing to be more concise and more correct (#355)
* Refactor contract types slightly

* Refactor contract types greatly

* Kill dead binary DPM contract creation code

* Use BinaryContract, DPMContract, etc. type aliases
2022-05-31 19:42:35 -07:00
Marshall Polaris
47f10301c8
Change lodash stuff so that it can be tree-shaken out of build (#233)
* 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
2022-05-22 01:36:05 -07:00
Marshall Polaris
20f4b97d8b
Rewrite client for new public APIs to use fetch instead of callables (#241)
* Rename `lib/firebase/api-call` -> `lib/firebase/fn-call`

This relieves ambiguity now that we will be using our actual
public API in the client.

* Rewrite client API calls to createContract, placeBet

* Tiny fixup for client market creation code
2022-05-19 15:04:34 -07:00
Boa
8337cb251f
Enable url linking to comments and a copy to clipboard function [wip] (#239)
* Link to comments & highlight comment

* Copy link, show toast and fade bg

* Remove unused imports

* Standardize link copied toast

* Add linking to answer comment threads

* Refactor open answers component, use indigo highlight

* Distinguish chosen answer a bit more
2022-05-17 09:55:26 -06:00
Marshall Polaris
07ded756d9
Remove unused imports from random files (#224) 2022-05-13 18:30:52 -07:00
Marshall Polaris
6c9df223d8
Feed container markup cleanup (#173)
* Move FeedContainer stuff into ActivityFeed

* Greatly clean up ActivityFeed container markup
2022-05-10 13:59:19 -07:00
Boa
a5b0372a6e
Free response markets with investment cap (#157)
* Show error message for FR bet

* Allow M$ limit for markets

* Allow M$ limit for markets

* Apply M$ limit to FR answer bets

* Improve error message

* Improve error message

* Only check stats if mana limit set

* Consolidate logic

* Remove unused variable

* absolute import

* absolute imports
2022-05-09 14:09:07 -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
cea9422802 Update site copy 2022-05-07 10:10:25 -04:00
Boa
9480f9f34c
Improve free response answer ux (#131)
* 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
2022-05-04 16:03:06 -06:00
James Grugett
6232284e92 Larger font on amount input 2022-05-02 12:15:00 -04:00
Boa
d6c7230d6a
Moved answers (#102)
* Moved answers

* Remove unnecessary code
2022-04-26 09:53:12 -06:00
Ian Philips
7ccdc6d683 Hide bet panel on FR after successful submit 2022-04-19 09:01:40 -06:00
James Grugett
9c74f88b4a
Improve Free response UI (#78)
* 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
2022-04-18 18:02:40 -05:00
James Grugett
75b39cbf6f Remove loans: no new loans 2022-04-13 12:52:12 -05:00
James Grugett
e53cde5b34 Quick back navigation into feed 2022-04-11 16:13:26 -05:00
mantikoros
b624ec045e "buy" => "bet" 2022-04-09 16:13:36 -05:00
James Grugett
849248376b Memo-ize graph components for better performance 2022-04-06 13:56:08 -05:00
James Grugett
a524b952ee FR: Hide contract activity on mobile when betting 2022-04-06 00:22:43 -05:00
James Grugett
708773e9a6 Fix FR not having correct loan info 2022-04-04 11:30:49 -05:00
James Grugett
1ec8fc5b45 Deemphasize sign in button on sidebar. Change bet panel to use 'sign up' wording. 2022-04-04 00:58:56 -05:00
Austin Chen
94b7ebe5e8 Minor fixes: typo, React keys 2022-03-31 01:38:57 -07: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
Sinclair Chen
6e387ef938
Keep FR answer panel open after betting (#68) 2022-03-25 13:33:57 -07:00
Sinclair Chen
50eb9bd4bd
Remove resize handles from input fields (#67) 2022-03-25 09:27:28 -07:00
James Grugett
7d8a87615a Embed market: dynamically adjust graph height 2022-03-24 12:03:17 -05:00
James Grugett
cc0beb4ca4 DPM: label payout 'Estimated' in bet panel 2022-03-22 00:18:08 -05:00
James Grugett
a37ab956db Hide answers in graph if M$ 0 is bet on it 2022-03-21 19:48:48 -05:00
Austin Chen
d6a751d9a2 Show decimals on 98%+ 2022-03-18 20:02:04 -07:00
Austin Chen
e4c9508340 Show "Buy" and % directly in FR feed 2022-03-16 21:42:24 -07:00
James Grugett
727911816c Fix graph bug for sold bets. 6 lines. Clean up. 2022-03-16 18:47:12 -05:00
Austin Chen
958dc2b431 Use a stacked line graph for FR answers 2022-03-15 17:26:59 -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
bd62d8fbcd FR graph: Truncate answer labels further 2022-03-15 15:32:39 -05:00
James Grugett
1bb5d3b8cd
Answers graph (#65)
* In progress

* Calculate correct graph probabilites
2022-03-15 14:42:04 -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
ef77779cec Format Tailwind classes with Prettier
Not sure why Husky hooks aren't enforcing this 🤷
2022-03-03 01:09:32 -08:00
James Grugett
fa817c34a9 Fix more places where insufficient balance error was not accounting for loans 2022-03-02 14:28:23 -08:00
James Grugett
6abf235505 Show correct remaning balance for ante input when creating market 2022-03-02 13:50:19 -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
77b4ca4f22 FR: Don't show bet panel if resolving, or past close date. 2022-02-26 10:56:49 -06:00
James Grugett
2775bf44a2 Put back answer number on answer item 2022-02-26 10:51:36 -06:00