update metrics: fix divide by zero, elasticity NaN bug
This commit is contained in:
parent
d00ea65279
commit
e1636d0f13
|
@ -97,7 +97,11 @@ export const computeBinaryCpmmElasticity = (
|
|||
)
|
||||
const resultNo = getCpmmProbability(poolN, pN)
|
||||
|
||||
return resultYes - resultNo
|
||||
// handle AMM overflow
|
||||
const safeYes = Number.isFinite(resultYes) ? resultYes : 1
|
||||
const safeNo = Number.isFinite(resultNo) ? resultNo : 0
|
||||
|
||||
return safeYes - safeNo
|
||||
}
|
||||
|
||||
export const computeDpmElasticity = (
|
||||
|
|
|
@ -169,7 +169,7 @@ export async function updateMetricsCore() {
|
|||
return 0
|
||||
}
|
||||
const contractRatio =
|
||||
contract.flaggedByUsernames.length / (contract.uniqueBettorCount ?? 1)
|
||||
contract.flaggedByUsernames.length / (contract.uniqueBettorCount || 1)
|
||||
|
||||
return contractRatio
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue
Block a user