use all bets for getFixedCancelPayouts
This commit is contained in:
parent
b05c4da0f2
commit
4a0db10b20
|
@ -22,10 +22,12 @@ export const getPayouts = (
|
|||
[outcome: string]: number
|
||||
},
|
||||
contract: Contract,
|
||||
bets: Bet[],
|
||||
allBets: Bet[],
|
||||
liquidities: LiquidityProvision[],
|
||||
resolutionProbability?: number
|
||||
) => {
|
||||
const bets = allBets.filter((b) => !b.isSold && !b.sale)
|
||||
|
||||
if (contract.mechanism === 'cpmm-1' && contract.outcomeType === 'BINARY') {
|
||||
switch (outcome) {
|
||||
case 'YES':
|
||||
|
@ -39,7 +41,7 @@ export const getPayouts = (
|
|||
resolutionProbability
|
||||
)
|
||||
case 'CANCEL':
|
||||
return getFixedCancelPayouts(contract, bets, liquidities)
|
||||
return getFixedCancelPayouts(contract, allBets, liquidities)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -93,7 +93,6 @@ export const resolveMarket = functions
|
|||
.get()
|
||||
|
||||
const bets = betsSnap.docs.map((doc) => doc.data() as Bet)
|
||||
const openBets = bets.filter((b) => !b.isSold && !b.sale)
|
||||
|
||||
const liquiditiesSnap = await firestore
|
||||
.collection(`contracts/${contractId}/liquidity`)
|
||||
|
@ -106,11 +105,12 @@ export const resolveMarket = functions
|
|||
const payouts = getPayouts(
|
||||
resolutions ?? outcome,
|
||||
contract,
|
||||
openBets,
|
||||
bets,
|
||||
liquidities,
|
||||
resolutionProbability
|
||||
)
|
||||
|
||||
const openBets = bets.filter((b) => !b.isSold && !b.sale)
|
||||
const loanPayouts = getLoanPayouts(openBets)
|
||||
|
||||
console.log('payouts:', payouts)
|
||||
|
|
Loading…
Reference in New Issue
Block a user