diff --git a/functions/src/email-templates/market-resolved.html b/functions/src/email-templates/market-resolved.html
index 2a92d60f..42d4e2d8 100644
--- a/functions/src/email-templates/market-resolved.html
+++ b/functions/src/email-templates/market-resolved.html
@@ -437,6 +437,28 @@
margin: 0;
"
/>
+ Your investment was
+ M$ {{investment}}.
+
+
Your payout is
M$ {{payout}} userId)),
Object.keys(userPayouts)
)
+ const investedByUser = _.mapValues(
+ _.groupBy(openBets, (bet) => bet.userId),
+ (bets) => _.sumBy(bets, (bet) => bet.amount)
+ )
const emailPayouts = [
...Object.entries(userPayouts),
...nonWinners.map((userId) => [userId, 0] as const),
- ]
+ ].map(([userId, payout]) => ({
+ userId,
+ investment: investedByUser[userId],
+ payout,
+ }))
+
await Promise.all(
- emailPayouts.map(([userId, payout]) =>
+ emailPayouts.map(({ userId, investment, payout }) =>
sendMarketResolutionEmail(
userId,
+ investment,
payout,
creator,
contract,