Proposed: refactor all financial logic into generic functions. Then to migrate all the financial infrastructure we simply convert those ~6 function definitions to supabase

Specification

type Transaction = firebase transaction

(for now. after migration it will be supabase)

doTransaction(async (t: Transaction) => any)

this is the parent function for any financial transaction, in which you can do any of the following:

[mqp] I have no opinion on whether we should refactor stuff to be in terms of functions like this, since I didn’t read all the code that does all this stuff, but if we do, they definitely need to be batch functions (e.g. logTxns(t: DBTransaction, ...txns: Txn[])), not one-at-a-time functions, or we will produce disastrous code.

[c] agreed