Fix bug in porting from rust to ts

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
This commit is contained in:
microwavedcola1 2022-12-14 15:43:06 +01:00
parent 2cd8c048f3
commit f781241f90
1 changed files with 2 additions and 2 deletions

View File

@ -553,7 +553,7 @@ export class HealthCache {
target: I80F48,
fun: (amount: I80F48) => I80F48,
): I80F48 {
const maxIterations = 100;
const maxIterations = 20;
let current = start;
// console.log(`scanRightUntilLessThan, start ${start.toLocaleString()}`);
for (const key of Array(maxIterations).fill(0).keys()) {
@ -745,7 +745,7 @@ export class HealthCache {
return ZERO_I80F48();
}
const zeroHealthEstimate = point1Amount.sub(
point1Health.sub(finalHealthSlope),
point1Health.div(finalHealthSlope),
);
const zeroHealthEstimateRatio = healthRatioAfterSwap(zeroHealthEstimate);