From 5cb6ee3bca43a4ad071e1146a00805a75c482a5b Mon Sep 17 00:00:00 2001 From: mantikoros Date: Fri, 29 Apr 2022 15:58:01 -0400 Subject: [PATCH] daily free markets' liquidity provided by @ManifoldMarkets --- common/antes.ts | 6 ++++-- functions/src/create-contract.ts | 5 ++++- functions/src/scripts/migrate-to-cfmm.ts | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/common/antes.ts b/common/antes.ts index a443f508..c77308f4 100644 --- a/common/antes.ts +++ b/common/antes.ts @@ -11,8 +11,10 @@ export const FIXED_ANTE = 100 export const PHANTOM_ANTE = 0.001 export const MINIMUM_ANTE = 50 +export const HOUSE_LIQUIDITY_PROVIDER_ID = 'IPTOzEqrpkWmEzh6hwvAyY9PqFb2' // @ManifoldMarkets' id + export function getCpmmInitialLiquidity( - creator: User, + providerId: string, contract: FullContract, anteId: string, amount: number @@ -21,7 +23,7 @@ export function getCpmmInitialLiquidity( const lp: LiquidityProvision = { id: anteId, - userId: creator.id, + userId: providerId, contractId: contract.id, createdTime, isAnte: true, diff --git a/functions/src/create-contract.ts b/functions/src/create-contract.ts index 781337f7..ae7b0ad8 100644 --- a/functions/src/create-contract.ts +++ b/functions/src/create-contract.ts @@ -22,6 +22,7 @@ import { getAnteBets, getCpmmInitialLiquidity, getFreeAnswerAnte, + HOUSE_LIQUIDITY_PROVIDER_ID, MINIMUM_ANTE, } from '../../common/antes' import { getNoneAnswer } from '../../common/answer' @@ -144,8 +145,10 @@ export const createContract = functions .collection(`contracts/${contract.id}/liquidity`) .doc() + const providerId = isFree ? HOUSE_LIQUIDITY_PROVIDER_ID : creator.id + const lp = getCpmmInitialLiquidity( - creator, + providerId, contract as FullContract, liquidityDoc.id, ante diff --git a/functions/src/scripts/migrate-to-cfmm.ts b/functions/src/scripts/migrate-to-cfmm.ts index cd9177a3..874011ca 100644 --- a/functions/src/scripts/migrate-to-cfmm.ts +++ b/functions/src/scripts/migrate-to-cfmm.ts @@ -106,7 +106,7 @@ async function recalculateContract(contractRef: DocRef, isCommit = false) { const liquidityDocRef = contractRef.collection('liquidity').doc() const lp = getCpmmInitialLiquidity( - { id: 'IPTOzEqrpkWmEzh6hwvAyY9PqFb2' } as User, // use @ManifoldMarkets' id + 'IPTOzEqrpkWmEzh6hwvAyY9PqFb2', // use @ManifoldMarkets' id { ...contract, ...contractUpdate,