From 3f6ca6c8ed8fb649b55975c647b5b2d724f3650a Mon Sep 17 00:00:00 2001 From: James Grugett Date: Thu, 11 Aug 2022 00:38:15 -0500 Subject: [PATCH] Make Manifold account able to resolve markets --- common/envs/constants.ts | 4 ++++ functions/src/resolve-market.ts | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/common/envs/constants.ts b/common/envs/constants.ts index 7092d711..48f9bf63 100644 --- a/common/envs/constants.ts +++ b/common/envs/constants.ts @@ -25,6 +25,10 @@ export function isAdmin(email: string) { return ENV_CONFIG.adminEmails.includes(email) } +export function isManifoldId(userId: string) { + return userId === 'IPTOzEqrpkWmEzh6hwvAyY9PqFb2' +} + export const DOMAIN = ENV_CONFIG.domain export const FIREBASE_CONFIG = ENV_CONFIG.firebaseConfig export const PROJECT_ID = ENV_CONFIG.firebaseConfig.projectId diff --git a/functions/src/resolve-market.ts b/functions/src/resolve-market.ts index cc07d4be..7277f40b 100644 --- a/functions/src/resolve-market.ts +++ b/functions/src/resolve-market.ts @@ -18,7 +18,7 @@ import { groupPayoutsByUser, Payout, } from '../../common/payouts' -import { isAdmin } from '../../common/envs/constants' +import { isManifoldId } from '../../common/envs/constants' import { removeUndefinedProps } from '../../common/util/object' import { LiquidityProvision } from '../../common/liquidity-provision' import { APIError, newEndpoint, validate } from './api' @@ -82,7 +82,7 @@ export const resolvemarket = newEndpoint(opts, async (req, auth) => { req.body ) - if (creatorId !== auth.uid && !isAdmin(auth.uid)) + if (creatorId !== auth.uid && !isManifoldId(auth.uid)) throw new APIError(403, 'User is not creator of contract') if (contract.resolution) throw new APIError(400, 'Contract already resolved')