Working tree is now the canonical repo. Off-chain play-money + trustless on-chain (FPMM AMM + CLOB via UMA settlement), AI market factory, creator/social/distribution, mobile shell + push, one-command demo + deploy-kit. Secrets excluded (see ENV-AND-KEYS.md). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
61 lines
1.7 KiB
TypeScript
61 lines
1.7 KiB
TypeScript
import {
|
|
DEV_HOUSE_LIQUIDITY_PROVIDER_ID,
|
|
HOUSE_LIQUIDITY_PROVIDER_ID,
|
|
} from 'common/antes'
|
|
import { LiquidityProvision } from 'common/liquidity-provision'
|
|
import { removeUndefinedProps } from 'common/util/object'
|
|
import { runScript } from 'run-script'
|
|
|
|
if (require.main === module) {
|
|
runScript(async ({ db, pg, firestore }) => {
|
|
// get all liquidity documents
|
|
const liquiditySnap = await firestore.collectionGroup('liquidity').get()
|
|
const liquidityDocs = liquiditySnap.docs.map(
|
|
(doc) => doc.data() as LiquidityProvision
|
|
)
|
|
|
|
const liquidityTxns = liquidityDocs
|
|
.filter((l) => !l.isAnte)
|
|
.map((l) => {
|
|
const isBank =
|
|
l.userId === HOUSE_LIQUIDITY_PROVIDER_ID ||
|
|
l.userId === DEV_HOUSE_LIQUIDITY_PROVIDER_ID
|
|
|
|
if (l.isAnte) {
|
|
return {
|
|
fromType: isBank ? 'BANK' : 'USER',
|
|
fromId: l.userId,
|
|
amount: l.amount,
|
|
toType: 'CONTRACT',
|
|
toId: l.contractId,
|
|
category: 'ANTE',
|
|
token: 'ANTE',
|
|
createdTime: l.createdTime,
|
|
data: removeUndefinedProps({
|
|
answerId: l.answerId,
|
|
isAnte: l.isAnte,
|
|
// pool: doc.pool,
|
|
}),
|
|
}
|
|
}
|
|
|
|
return {
|
|
fromType: isBank ? 'BANK' : 'USER',
|
|
fromId: l.userId,
|
|
amount: l.amount,
|
|
toType: 'CONTRACT',
|
|
toId: l.contractId,
|
|
category: 'ADD_SUBSIDY',
|
|
token: 'M$',
|
|
createdTime: l.createdTime,
|
|
data: removeUndefinedProps({
|
|
answerId: l.answerId,
|
|
isAnte: l.isAnte,
|
|
// pool: doc.pool,
|
|
}),
|
|
}
|
|
})
|
|
})
|
|
//
|
|
}
|