Subtract loans from leaderboard calculations
This commit is contained in:
parent
1dd078562a
commit
9e9535ce56
|
@ -45,8 +45,9 @@ export function scoreUsersByContract(contract: Contract, bets: Bet[]) {
|
||||||
const investments = bets
|
const investments = bets
|
||||||
.filter((bet) => !bet.sale)
|
.filter((bet) => !bet.sale)
|
||||||
.map((bet) => {
|
.map((bet) => {
|
||||||
const { userId, amount } = bet
|
const { userId, amount, loanAmount } = bet
|
||||||
return { userId, payout: -amount }
|
const payout = -amount - (loanAmount ?? 0)
|
||||||
|
return { userId, payout }
|
||||||
})
|
})
|
||||||
|
|
||||||
const netPayouts = [...resolvePayouts, ...salePayouts, ...investments]
|
const netPayouts = [...resolvePayouts, ...salePayouts, ...investments]
|
||||||
|
|
|
@ -52,7 +52,8 @@ const computeInvestmentValue = async (
|
||||||
if (!contract || contract.isResolved) return 0
|
if (!contract || contract.isResolved) return 0
|
||||||
if (bet.sale || bet.isSold) return 0
|
if (bet.sale || bet.isSold) return 0
|
||||||
|
|
||||||
return calculatePayout(contract, bet, 'MKT')
|
const payout = calculatePayout(contract, bet, 'MKT')
|
||||||
|
return payout - (bet.loanAmount ?? 0)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user