account for fixed 1m for msm april

This commit is contained in:
keyan 2024-04-30 14:51:48 -05:00
parent f2f3f71dd5
commit be20500c06
1 changed files with 8 additions and 1 deletions

View File

@ -69,7 +69,14 @@ export async function earn ({ name }) {
const notifications = {}
for (const [i, earner] of earners.entries()) {
const earnings = Math.floor(parseFloat(proportions[i] * sum))
let earnings = 0
if (i === 0) {
// top earner gets 1m sats
earnings = 1_000_000_000
} else {
// everyone else gets a proportion of the total
earnings = Math.floor(parseFloat(proportions[i - 1] * (sum - 1_000_000_000)))
}
total += earnings
if (total > sum) {
console.log(name, 'total exceeds sum', total, '>', sum)