Merge branch 'main' into atlas4
This commit is contained in:
commit
be24c09c62
|
@ -11,11 +11,8 @@ import {
|
|||
import { User } from './user'
|
||||
import { LiquidityProvision } from './liquidity-provision'
|
||||
import { noFees } from './fees'
|
||||
import { ENV_CONFIG } from './envs/constants'
|
||||
import { Answer } from './answer'
|
||||
|
||||
export const FIXED_ANTE = ENV_CONFIG.fixedAnte ?? 100
|
||||
|
||||
export const HOUSE_LIQUIDITY_PROVIDER_ID = 'IPTOzEqrpkWmEzh6hwvAyY9PqFb2' // @ManifoldMarkets' id
|
||||
export const DEV_HOUSE_LIQUIDITY_PROVIDER_ID = '94YYTk1AFWfbWMpfYcvnnwI1veP2' // @ManifoldMarkets' id
|
||||
|
||||
|
|
16
common/economy.ts
Normal file
16
common/economy.ts
Normal file
|
@ -0,0 +1,16 @@
|
|||
import { ENV_CONFIG } from './envs/constants'
|
||||
|
||||
const econ = ENV_CONFIG.economy
|
||||
|
||||
export const FIXED_ANTE = econ?.FIXED_ANTE ?? 100
|
||||
|
||||
export const STARTING_BALANCE = econ?.STARTING_BALANCE ?? 1000
|
||||
// for sus users, i.e. multiple sign ups for same person
|
||||
export const SUS_STARTING_BALANCE = econ?.SUS_STARTING_BALANCE ?? 10
|
||||
export const REFERRAL_AMOUNT = econ?.REFERRAL_AMOUNT ?? 500
|
||||
|
||||
export const UNIQUE_BETTOR_BONUS_AMOUNT = econ?.UNIQUE_BETTOR_BONUS_AMOUNT ?? 10
|
||||
export const BETTING_STREAK_BONUS_AMOUNT =
|
||||
econ?.BETTING_STREAK_BONUS_AMOUNT ?? 5
|
||||
export const BETTING_STREAK_BONUS_MAX = econ?.BETTING_STREAK_BONUS_MAX ?? 100
|
||||
export const BETTING_STREAK_RESET_HOUR = econ?.BETTING_STREAK_RESET_HOUR ?? 0
|
|
@ -19,10 +19,22 @@ export type EnvConfig = {
|
|||
navbarLogoPath?: string
|
||||
newQuestionPlaceholders: string[]
|
||||
|
||||
// Currency controls
|
||||
fixedAnte?: number
|
||||
startingBalance?: number
|
||||
referralBonus?: number
|
||||
economy?: Economy
|
||||
}
|
||||
|
||||
export type Economy = {
|
||||
FIXED_ANTE?: number
|
||||
|
||||
STARTING_BALANCE?: number
|
||||
SUS_STARTING_BALANCE?: number
|
||||
|
||||
REFERRAL_AMOUNT?: number
|
||||
|
||||
UNIQUE_BETTOR_BONUS_AMOUNT?: number
|
||||
|
||||
BETTING_STREAK_BONUS_AMOUNT?: number
|
||||
BETTING_STREAK_BONUS_MAX?: number
|
||||
BETTING_STREAK_RESET_HOUR?: number
|
||||
}
|
||||
|
||||
type FirebaseConfig = {
|
||||
|
|
|
@ -3,7 +3,3 @@ export const NUMERIC_FIXED_VAR = 0.005
|
|||
|
||||
export const NUMERIC_GRAPH_COLOR = '#5fa5f9'
|
||||
export const NUMERIC_TEXT_COLOR = 'text-blue-500'
|
||||
export const UNIQUE_BETTOR_BONUS_AMOUNT = 10
|
||||
export const BETTING_STREAK_BONUS_AMOUNT = 5
|
||||
export const BETTING_STREAK_BONUS_MAX = 100
|
||||
export const BETTING_STREAK_RESET_HOUR = 0
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
import { ENV_CONFIG } from './envs/constants'
|
||||
|
||||
export type User = {
|
||||
id: string
|
||||
createdTime: number
|
||||
|
@ -46,11 +44,6 @@ export type User = {
|
|||
currentBettingStreak?: number
|
||||
}
|
||||
|
||||
export const STARTING_BALANCE = ENV_CONFIG.startingBalance ?? 1000
|
||||
// for sus users, i.e. multiple sign ups for same person
|
||||
export const SUS_STARTING_BALANCE = ENV_CONFIG.startingBalance ?? 10
|
||||
export const REFERRAL_AMOUNT = ENV_CONFIG.referralBonus ?? 500
|
||||
|
||||
export type PrivateUser = {
|
||||
id: string // same as User.id
|
||||
username: string // denormalized from User
|
||||
|
|
|
@ -18,8 +18,8 @@ import { randomString } from '../../common/util/random'
|
|||
import { chargeUser, getContract } from './utils'
|
||||
import { APIError, newEndpoint, validate, zTimestamp } from './api'
|
||||
|
||||
import { FIXED_ANTE } from 'common/economy'
|
||||
import {
|
||||
FIXED_ANTE,
|
||||
getCpmmInitialLiquidity,
|
||||
getFreeAnswerAnte,
|
||||
getMultipleChoiceAntes,
|
||||
|
|
|
@ -6,8 +6,6 @@ import {
|
|||
MANIFOLD_AVATAR_URL,
|
||||
MANIFOLD_USERNAME,
|
||||
PrivateUser,
|
||||
STARTING_BALANCE,
|
||||
SUS_STARTING_BALANCE,
|
||||
User,
|
||||
} from '../../common/user'
|
||||
import { getUser, getUserByUsername, getValues, isProd } from './utils'
|
||||
|
@ -29,6 +27,7 @@ import {
|
|||
DEV_HOUSE_LIQUIDITY_PROVIDER_ID,
|
||||
HOUSE_LIQUIDITY_PROVIDER_ID,
|
||||
} from '../../common/antes'
|
||||
import { SUS_STARTING_BALANCE, STARTING_BALANCE } from 'common/economy'
|
||||
|
||||
const bodySchema = z.object({
|
||||
deviceToken: z.string().optional(),
|
||||
|
|
|
@ -17,7 +17,7 @@ import {
|
|||
BETTING_STREAK_BONUS_MAX,
|
||||
BETTING_STREAK_RESET_HOUR,
|
||||
UNIQUE_BETTOR_BONUS_AMOUNT,
|
||||
} from '../../common/numeric-constants'
|
||||
} from '../../common/economy'
|
||||
import {
|
||||
DEV_HOUSE_LIQUIDITY_PROVIDER_ID,
|
||||
HOUSE_LIQUIDITY_PROVIDER_ID,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import * as functions from 'firebase-functions'
|
||||
import * as admin from 'firebase-admin'
|
||||
import { REFERRAL_AMOUNT, User } from '../../common/user'
|
||||
import { User } from '../../common/user'
|
||||
import { HOUSE_LIQUIDITY_PROVIDER_ID } from '../../common/antes'
|
||||
import { createReferralNotification } from './create-notification'
|
||||
import { ReferralTxn } from '../../common/txn'
|
||||
|
@ -8,6 +8,7 @@ import { Contract } from '../../common/contract'
|
|||
import { LimitBet } from 'common/bet'
|
||||
import { QuerySnapshot } from 'firebase-admin/firestore'
|
||||
import { Group } from 'common/group'
|
||||
import { REFERRAL_AMOUNT } from 'common/economy'
|
||||
const firestore = admin.firestore()
|
||||
|
||||
export const onUpdateUser = functions.firestore
|
||||
|
|
|
@ -4,7 +4,7 @@ import * as functions from 'firebase-functions'
|
|||
import * as admin from 'firebase-admin'
|
||||
import { User } from '../../common/user'
|
||||
import { DAY_MS } from '../../common/util/time'
|
||||
import { BETTING_STREAK_RESET_HOUR } from '../../common/numeric-constants'
|
||||
import { BETTING_STREAK_RESET_HOUR } from '../../common/economy'
|
||||
const firestore = admin.firestore()
|
||||
|
||||
export const resetBettingStreaksForUsers = functions.pubsub
|
||||
|
|
|
@ -3,7 +3,8 @@ import * as admin from 'firebase-admin'
|
|||
import { initAdmin } from './script-init'
|
||||
initAdmin()
|
||||
|
||||
import { PrivateUser, STARTING_BALANCE, User } from '../../../common/user'
|
||||
import { PrivateUser, User } from 'common/user'
|
||||
import { STARTING_BALANCE } from 'common/economy'
|
||||
|
||||
const firestore = admin.firestore()
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ import { AmountInput } from '../amount-input'
|
|||
import { getProbability } from 'common/calculate'
|
||||
import { createMarket } from 'web/lib/firebase/api'
|
||||
import { removeUndefinedProps } from 'common/util/object'
|
||||
import { FIXED_ANTE } from 'common/antes'
|
||||
import { FIXED_ANTE } from 'common/economy'
|
||||
import Textarea from 'react-expanding-textarea'
|
||||
import { useTextEditor } from 'web/components/editor'
|
||||
import { LoadingIndicator } from 'web/components/loading-indicator'
|
||||
|
|
|
@ -14,9 +14,10 @@ import { Button } from '../button'
|
|||
import { copyToClipboard } from 'web/lib/util/copy'
|
||||
import { track } from 'web/lib/service/analytics'
|
||||
import { ENV_CONFIG } from 'common/envs/constants'
|
||||
import { REFERRAL_AMOUNT, User } from 'common/user'
|
||||
import { User } from 'common/user'
|
||||
import { SiteLink } from '../site-link'
|
||||
import { formatMoney } from 'common/util/format'
|
||||
import { REFERRAL_AMOUNT } from 'common/economy'
|
||||
|
||||
export function ShareModal(props: {
|
||||
contract: Contract
|
||||
|
|
|
@ -3,7 +3,7 @@ import { Col } from 'web/components/layout/col'
|
|||
import {
|
||||
BETTING_STREAK_BONUS_AMOUNT,
|
||||
BETTING_STREAK_BONUS_MAX,
|
||||
} from 'common/numeric-constants'
|
||||
} from 'common/economy'
|
||||
import { formatMoney } from 'common/util/format'
|
||||
|
||||
export function BettingStreakModal(props: {
|
||||
|
|
|
@ -29,8 +29,8 @@ import { formatMoney } from 'common/util/format'
|
|||
import { ShareIconButton } from 'web/components/share-icon-button'
|
||||
import { ENV_CONFIG } from 'common/envs/constants'
|
||||
import { BettingStreakModal } from 'web/components/profile/betting-streak-modal'
|
||||
import { REFERRAL_AMOUNT } from 'common/economy'
|
||||
import { LoansModal } from './profile/loans-modal'
|
||||
import { REFERRAL_AMOUNT } from 'common/user'
|
||||
|
||||
export function UserLink(props: {
|
||||
name: string
|
||||
|
|
|
@ -7,7 +7,7 @@ import { Spacer } from 'web/components/layout/spacer'
|
|||
import { getUserAndPrivateUser } from 'web/lib/firebase/users'
|
||||
import { Contract, contractPath } from 'web/lib/firebase/contracts'
|
||||
import { createMarket } from 'web/lib/firebase/api'
|
||||
import { FIXED_ANTE } from 'common/antes'
|
||||
import { FIXED_ANTE } from 'common/economy'
|
||||
import { InfoTooltip } from 'web/components/info-tooltip'
|
||||
import { Page } from 'web/components/page'
|
||||
import { Row } from 'web/components/layout/row'
|
||||
|
|
|
@ -34,7 +34,6 @@ import { Modal } from 'web/components/layout/modal'
|
|||
import { ChoicesToggleGroup } from 'web/components/choices-toggle-group'
|
||||
import { toast } from 'react-hot-toast'
|
||||
import { useCommentsOnGroup } from 'web/hooks/use-comments'
|
||||
import { REFERRAL_AMOUNT } from 'common/user'
|
||||
import { ContractSearch } from 'web/components/contract-search'
|
||||
import { FollowList } from 'web/components/follow-list'
|
||||
import { SearchIcon } from '@heroicons/react/outline'
|
||||
|
@ -48,6 +47,7 @@ import { Button } from 'web/components/button'
|
|||
import { listAllCommentsOnGroup } from 'web/lib/firebase/comments'
|
||||
import { GroupComment } from 'common/comment'
|
||||
import { GroupChat } from 'web/components/groups/group-chat'
|
||||
import { REFERRAL_AMOUNT } from 'common/economy'
|
||||
|
||||
export const getStaticProps = fromPropz(getStaticPropz)
|
||||
export async function getStaticPropz(props: { params: { slugs: string[] } }) {
|
||||
|
|
|
@ -25,8 +25,8 @@ import { redirectIfLoggedOut } from 'web/lib/firebase/server-auth'
|
|||
import { ManalinkCardFromView } from 'web/components/manalink-card'
|
||||
import { Pagination } from 'web/components/pagination'
|
||||
import { Manalink } from 'common/manalink'
|
||||
import { REFERRAL_AMOUNT } from 'common/user'
|
||||
import { SiteLink } from 'web/components/site-link'
|
||||
import { REFERRAL_AMOUNT } from 'common/economy'
|
||||
|
||||
const LINKS_PER_PAGE = 24
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ import { groupPath } from 'web/lib/firebase/groups'
|
|||
import {
|
||||
BETTING_STREAK_BONUS_AMOUNT,
|
||||
UNIQUE_BETTOR_BONUS_AMOUNT,
|
||||
} from 'common/numeric-constants'
|
||||
} from 'common/economy'
|
||||
import { groupBy, sum, uniq } from 'lodash'
|
||||
import { track } from '@amplitude/analytics-browser'
|
||||
import { Pagination } from 'web/components/pagination'
|
||||
|
|
|
@ -5,11 +5,11 @@ import { useUser } from 'web/hooks/use-user'
|
|||
import { Page } from 'web/components/page'
|
||||
import { useTracking } from 'web/hooks/use-tracking'
|
||||
import { redirectIfLoggedOut } from 'web/lib/firebase/server-auth'
|
||||
import { REFERRAL_AMOUNT } from 'common/user'
|
||||
import { CopyLinkButton } from 'web/components/copy-link-button'
|
||||
import { ENV_CONFIG } from 'common/envs/constants'
|
||||
import { InfoBox } from 'web/components/info-box'
|
||||
import { QRCode } from 'web/components/qr-code'
|
||||
import { REFERRAL_AMOUNT } from 'common/economy'
|
||||
|
||||
export const getServerSideProps = redirectIfLoggedOut('/')
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user