Resolve emails include full payout not subtracting loan

This commit is contained in:
James Grugett 2022-03-01 16:34:08 -08:00
parent 42533c296a
commit d5ae4a2377

View File

@ -115,6 +115,11 @@ export const resolveMarket = functions
_.sumBy(group, (g) => g.payout)
)
const groupsWithoutLoans = _.groupBy(payouts, (payout) => payout.userId)
const userPayoutsWithoutLoans = _.mapValues(groupsWithoutLoans, (group) =>
_.sumBy(group, (g) => g.payout)
)
const payoutPromises = Object.entries(userPayouts).map(
([userId, payout]) => payUser(userId, payout)
)
@ -125,7 +130,7 @@ export const resolveMarket = functions
await sendResolutionEmails(
openBets,
userPayouts,
userPayoutsWithoutLoans,
creator,
contract,
outcome,