@0dotxyz/p0-ts-sdk 2.7.1-alpha.1 → 2.7.1-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +21 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +21 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -77868,17 +77868,28 @@ function computeMaxBorrowForBank(params) {
|
|
|
77868
77868
|
bank,
|
|
77869
77869
|
assetShareValueMultiplier
|
|
77870
77870
|
).div(originationFeeFactor);
|
|
77871
|
-
const rateLimitRemaining = computeOutflowRateLimitRemaining(
|
|
77871
|
+
const rateLimitRemaining = computeOutflowRateLimitRemaining(
|
|
77872
|
+
bank,
|
|
77873
|
+
oraclePrice,
|
|
77874
|
+
groupRateLimiter,
|
|
77875
|
+
assetShareValueMultiplier
|
|
77876
|
+
);
|
|
77872
77877
|
return BigNumber3__default.default.max(
|
|
77873
77878
|
0,
|
|
77874
77879
|
BigNumber3__default.default.min(healthMaxBorrow, borrowCapRemaining, availableLiquidity, rateLimitRemaining)
|
|
77875
77880
|
);
|
|
77876
77881
|
}
|
|
77877
|
-
function computeOutflowRateLimitRemaining(bank, oraclePrice, groupRateLimiter) {
|
|
77882
|
+
function computeOutflowRateLimitRemaining(bank, oraclePrice, groupRateLimiter, assetShareValueMultiplier) {
|
|
77878
77883
|
const nowSeconds = Date.now() / 1e3;
|
|
77879
77884
|
let remaining = new BigNumber3__default.default(Infinity);
|
|
77880
|
-
|
|
77881
|
-
if (bankRemaining !== null)
|
|
77885
|
+
let bankRemaining = computeBankRateLimitRemaining(bank, nowSeconds);
|
|
77886
|
+
if (bankRemaining !== null) {
|
|
77887
|
+
const limiterInBankMintUnits = bank.config.assetTag === 3 /* KAMINO */ || bank.config.assetTag === 2 /* STAKED */;
|
|
77888
|
+
if (limiterInBankMintUnits && assetShareValueMultiplier?.gt(0)) {
|
|
77889
|
+
bankRemaining = bankRemaining.times(assetShareValueMultiplier);
|
|
77890
|
+
}
|
|
77891
|
+
remaining = BigNumber3__default.default.min(remaining, bankRemaining);
|
|
77892
|
+
}
|
|
77882
77893
|
const groupRemainingUsd = computeGroupRateLimitRemainingUsd(groupRateLimiter, nowSeconds);
|
|
77883
77894
|
if (groupRemainingUsd !== null) {
|
|
77884
77895
|
const price = getPrice(oraclePrice, 1 /* None */, false);
|
|
@@ -77907,7 +77918,12 @@ function computeMaxWithdrawForBank(params) {
|
|
|
77907
77918
|
bank,
|
|
77908
77919
|
assetShareValueMultiplier
|
|
77909
77920
|
);
|
|
77910
|
-
const rateLimitRemaining = computeOutflowRateLimitRemaining(
|
|
77921
|
+
const rateLimitRemaining = computeOutflowRateLimitRemaining(
|
|
77922
|
+
bank,
|
|
77923
|
+
oraclePrice,
|
|
77924
|
+
groupRateLimiter,
|
|
77925
|
+
assetShareValueMultiplier
|
|
77926
|
+
);
|
|
77911
77927
|
const clamps = [healthMaxWithdraw, availableLiquidity, rateLimitRemaining];
|
|
77912
77928
|
const venueLiquidity = computeVenueAvailableLiquidity(bank, venueStates);
|
|
77913
77929
|
if (venueLiquidity !== void 0) clamps.push(venueLiquidity);
|