show correct commission in market close emails

This commit is contained in:
mantikoros 2022-05-10 11:23:32 -04:00
parent bbfdc923fb
commit 8313930c70
2 changed files with 13 additions and 10 deletions

View File

@ -419,8 +419,8 @@
"
/>
A market you created has closed. It's attracted
<span style="font-weight: bold">{{pool}}</span> in
bets — congrats!
<span style="font-weight: bold">{{volume}}</span>
in bets — congrats!
<br
style="
font-family: 'Helvetica Neue', Helvetica,
@ -439,8 +439,8 @@
margin: 0;
"
/>
Resolve your market to earn {{creatorFee}}% of the
profits as the creator commission.
Resolve your market to earn {{creatorFee}} as the
creator commission.
<br
style="
font-family: 'Helvetica Neue', Helvetica,

View File

@ -6,7 +6,7 @@ import { Bet } from '../../common/bet'
import { getProbability } from '../../common/calculate'
import { Comment } from '../../common/comment'
import { Contract, FreeResponseContract } from '../../common/contract'
import { CREATOR_FEE } from '../../common/fees'
import { DPM_CREATOR_FEE } from '../../common/fees'
import { PrivateUser, User } from '../../common/user'
import { formatMoney, formatPercent } from '../../common/util/format'
import { sendTemplateEmail, sendTextEmail } from './send-email'
@ -149,8 +149,8 @@ export const sendMarketCloseEmail = async (
const { username, name, id: userId } = user
const firstName = name.split(' ')[0]
const { question, pool: pools, slug } = contract
const pool = formatMoney(_.sum(_.values(pools)))
const { question, slug, volume, mechanism, collectedFees } = contract
const url = `https://${DOMAIN}/${username}/${slug}`
await sendTemplateEmail(
@ -158,12 +158,15 @@ export const sendMarketCloseEmail = async (
'Your market has closed',
'market-close',
{
name: firstName,
question,
pool,
url,
userId,
creatorFee: (CREATOR_FEE * 100).toString(),
name: firstName,
volume: formatMoney(volume),
creatorFee:
mechanism === 'dpm-2'
? `${DPM_CREATOR_FEE * 100}% of the profits`
: formatMoney(collectedFees.creatorFee),
}
)
}