@blockworks-foundation/mango-v4
Advanced tools
Comparing version 0.16.8 to 0.16.9
@@ -763,6 +763,4 @@ "use strict"; | ||
function healthAfterPriceChange(newPrice) { | ||
const gClone = (0, cloneDeep_1.default)(group); | ||
gClone.getPerpMarketByMarketIndex(perpMarket.perpMarketIndex)._price = | ||
newPrice; | ||
const hc = HealthCache.fromMangoAccount(gClone, mangoAccount); | ||
const pi = hc.perpInfos[hc.findPerpInfoIndex(perpPosition.marketIndex)]; | ||
pi.prices.oracle = newPrice; | ||
return hc.health(mangoAccount_1.HealthType.maint); | ||
@@ -776,6 +774,6 @@ } | ||
} | ||
return HealthCache.binaryApproximationSearch(zero, healthAtPriceZero, perpMarket.price, (0, I80F48_1.ZERO_I80F48)(), perpMarket.priceLotsToNative(new anchor_1.BN(1)), healthAfterPriceChange, { maxIterations: 20 }); | ||
return HealthCache.binaryApproximationSearch(zero, healthAtPriceZero, perpMarket.price, (0, I80F48_1.ZERO_I80F48)(), perpMarket.priceLotsToNative(new anchor_1.BN(1)), healthAfterPriceChange); | ||
} | ||
const price1000x = perpMarket.price.mul(I80F48_1.I80F48.fromNumber(1000)); | ||
return HealthCache.binaryApproximationSearch(perpMarket.price, hc.health(mangoAccount_1.HealthType.maint), price1000x, (0, I80F48_1.ZERO_I80F48)(), perpMarket.priceLotsToNative(new anchor_1.BN(1)), healthAfterPriceChange, { maxIterations: 20 }); | ||
return HealthCache.binaryApproximationSearch(perpMarket.price, hc.health(mangoAccount_1.HealthType.maint), price1000x, (0, I80F48_1.ZERO_I80F48)(), perpMarket.priceLotsToNative(new anchor_1.BN(1)), healthAfterPriceChange); | ||
} | ||
@@ -782,0 +780,0 @@ } |
@@ -757,6 +757,4 @@ import { BN } from '@coral-xyz/anchor'; | ||
function healthAfterPriceChange(newPrice) { | ||
const gClone = cloneDeep(group); | ||
gClone.getPerpMarketByMarketIndex(perpMarket.perpMarketIndex)._price = | ||
newPrice; | ||
const hc = HealthCache.fromMangoAccount(gClone, mangoAccount); | ||
const pi = hc.perpInfos[hc.findPerpInfoIndex(perpPosition.marketIndex)]; | ||
pi.prices.oracle = newPrice; | ||
return hc.health(HealthType.maint); | ||
@@ -770,6 +768,6 @@ } | ||
} | ||
return HealthCache.binaryApproximationSearch(zero, healthAtPriceZero, perpMarket.price, ZERO_I80F48(), perpMarket.priceLotsToNative(new BN(1)), healthAfterPriceChange, { maxIterations: 20 }); | ||
return HealthCache.binaryApproximationSearch(zero, healthAtPriceZero, perpMarket.price, ZERO_I80F48(), perpMarket.priceLotsToNative(new BN(1)), healthAfterPriceChange); | ||
} | ||
const price1000x = perpMarket.price.mul(I80F48.fromNumber(1000)); | ||
return HealthCache.binaryApproximationSearch(perpMarket.price, hc.health(HealthType.maint), price1000x, ZERO_I80F48(), perpMarket.priceLotsToNative(new BN(1)), healthAfterPriceChange, { maxIterations: 20 }); | ||
return HealthCache.binaryApproximationSearch(perpMarket.price, hc.health(HealthType.maint), price1000x, ZERO_I80F48(), perpMarket.priceLotsToNative(new BN(1)), healthAfterPriceChange); | ||
} | ||
@@ -776,0 +774,0 @@ } |
{ | ||
"name": "@blockworks-foundation/mango-v4", | ||
"version": "0.16.8", | ||
"version": "0.16.9", | ||
"description": "Typescript Client for mango-v4 program.", | ||
@@ -5,0 +5,0 @@ "repository": "https://github.com/blockworks-foundation/mango-v4", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3108972
64408