@curvefi/llamalend-api 2.0.9 → 2.0.10
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.
|
@@ -47,7 +47,7 @@ export class LeverageZapV2BaseModule {
|
|
|
47
47
|
const j = N - this.market.minBands;
|
|
48
48
|
calls.push(contract.max_borrowable(this.market.addresses.controller, _userEffectiveCollateral, _maxLeverageCollateral[j], N, fromBN(pBN)));
|
|
49
49
|
}
|
|
50
|
-
_maxBorrowable = (yield this.llamalend.multicallProvider.all(calls)).map((_mb) => _mb * BigInt(
|
|
50
|
+
_maxBorrowable = (yield this.llamalend.multicallProvider.all(calls)).map((_mb) => _mb * BigInt(970) / BigInt(1000));
|
|
51
51
|
maxBorrowableBN = _maxBorrowable.map((_mb) => toBN(_mb, this.market.borrowed_token.decimals));
|
|
52
52
|
const deltaBN = maxBorrowableBN.map((mb, l) => mb.minus(maxBorrowablePrevBN[l]).abs().div(mb));
|
|
53
53
|
if (BigNumber.max(...deltaBN).lt(0.0005)) {
|
|
@@ -239,7 +239,7 @@ export class LeverageZapV2BaseModule {
|
|
|
239
239
|
maxBorrowablePrevBN = maxBorrowableBN;
|
|
240
240
|
_userEffectiveCollateral = _userCollateral + fromBN(BN(userBorrowed).div(pAvgBN), this.market.collateral_token.decimals);
|
|
241
241
|
let _maxBorrowable = yield contract.max_borrowable(this.market.addresses.controller, _userEffectiveCollateral, _maxLeverageCollateral, range, fromBN(pAvgBN));
|
|
242
|
-
_maxBorrowable = _maxBorrowable * BigInt(
|
|
242
|
+
_maxBorrowable = _maxBorrowable * BigInt(970) / BigInt(1000);
|
|
243
243
|
if (_maxBorrowable === BigInt(0))
|
|
244
244
|
break;
|
|
245
245
|
maxBorrowableBN = toBN(_maxBorrowable, this.market.borrowed_token.decimals);
|
|
@@ -468,7 +468,7 @@ export class LeverageZapV2BaseModule {
|
|
|
468
468
|
maxBorrowablePrevBN = maxBorrowableBN;
|
|
469
469
|
_userEffectiveCollateral = _userCollateral + fromBN(BN(userBorrowed).div(pAvgBN), this.market.collateral_token.decimals);
|
|
470
470
|
let _maxBorrowable = yield contract.max_borrowable(this.market.addresses.controller, _userEffectiveCollateral, _maxLeverageCollateral, _N, fromBN(pAvgBN));
|
|
471
|
-
_maxBorrowable = _maxBorrowable * BigInt(
|
|
471
|
+
_maxBorrowable = _maxBorrowable * BigInt(970) / BigInt(1000);
|
|
472
472
|
if (_maxBorrowable === BigInt(0))
|
|
473
473
|
break;
|
|
474
474
|
maxBorrowableBN = toBN(_maxBorrowable, this.market.borrowed_token.decimals);
|
|
@@ -485,7 +485,7 @@ export class LeverageZapV2BaseModule {
|
|
|
485
485
|
_userEffectiveCollateral = BigInt(0);
|
|
486
486
|
const _maxTotalCollateral = _userEffectiveCollateral + _maxLeverageCollateral;
|
|
487
487
|
let _maxBorrowable = (yield controllerContract.max_borrowable(_stateCollateral + _maxTotalCollateral, _N, _stateDebt, this.llamalend.constantOptions)) - _stateDebt;
|
|
488
|
-
_maxBorrowable = _maxBorrowable * BigInt(
|
|
488
|
+
_maxBorrowable = _maxBorrowable * BigInt(970) / BigInt(1000);
|
|
489
489
|
return {
|
|
490
490
|
maxDebt: formatUnits(_maxBorrowable, this.market.borrowed_token.decimals),
|
|
491
491
|
maxTotalCollateral: formatUnits(_maxTotalCollateral, this.market.collateral_token.decimals),
|
package/package.json
CHANGED
|
@@ -111,7 +111,7 @@ export class LeverageZapV2BaseModule {
|
|
|
111
111
|
maxBorrowablePrevBN = maxBorrowableBN;
|
|
112
112
|
_userEffectiveCollateral = _userCollateral + fromBN(BN(userBorrowed).div(pAvgBN), this.market.collateral_token.decimals);
|
|
113
113
|
let _maxBorrowable = await contract.max_borrowable(this.market.addresses.controller, _userEffectiveCollateral, _maxLeverageCollateral, range, fromBN(pAvgBN));
|
|
114
|
-
_maxBorrowable = _maxBorrowable * BigInt(
|
|
114
|
+
_maxBorrowable = _maxBorrowable * BigInt(970) / BigInt(1000)
|
|
115
115
|
if (_maxBorrowable === BigInt(0)) break;
|
|
116
116
|
maxBorrowableBN = toBN(_maxBorrowable, this.market.borrowed_token.decimals);
|
|
117
117
|
|
|
@@ -182,7 +182,7 @@ export class LeverageZapV2BaseModule {
|
|
|
182
182
|
const j = N - this.market.minBands;
|
|
183
183
|
calls.push(contract.max_borrowable(this.market.addresses.controller, _userEffectiveCollateral, _maxLeverageCollateral[j], N, fromBN(pBN)));
|
|
184
184
|
}
|
|
185
|
-
_maxBorrowable = (await this.llamalend.multicallProvider.all(calls) as bigint[]).map((_mb) => _mb * BigInt(
|
|
185
|
+
_maxBorrowable = (await this.llamalend.multicallProvider.all(calls) as bigint[]).map((_mb) => _mb * BigInt(970) / BigInt(1000));
|
|
186
186
|
maxBorrowableBN = _maxBorrowable.map((_mb) => toBN(_mb, this.market.borrowed_token.decimals));
|
|
187
187
|
|
|
188
188
|
const deltaBN = maxBorrowableBN.map((mb, l) => mb.minus(maxBorrowablePrevBN[l]).abs().div(mb));
|
|
@@ -599,7 +599,7 @@ export class LeverageZapV2BaseModule {
|
|
|
599
599
|
maxBorrowablePrevBN = maxBorrowableBN;
|
|
600
600
|
_userEffectiveCollateral = _userCollateral + fromBN(BN(userBorrowed).div(pAvgBN), this.market.collateral_token.decimals);
|
|
601
601
|
let _maxBorrowable = await contract.max_borrowable(this.market.addresses.controller, _userEffectiveCollateral, _maxLeverageCollateral, _N, fromBN(pAvgBN));
|
|
602
|
-
_maxBorrowable = _maxBorrowable * BigInt(
|
|
602
|
+
_maxBorrowable = _maxBorrowable * BigInt(970) / BigInt(1000);
|
|
603
603
|
if (_maxBorrowable === BigInt(0)) break;
|
|
604
604
|
maxBorrowableBN = toBN(_maxBorrowable, this.market.borrowed_token.decimals);
|
|
605
605
|
|
|
@@ -618,7 +618,7 @@ export class LeverageZapV2BaseModule {
|
|
|
618
618
|
if (maxBorrowableBN.eq(0)) _userEffectiveCollateral = BigInt(0);
|
|
619
619
|
const _maxTotalCollateral = _userEffectiveCollateral + _maxLeverageCollateral
|
|
620
620
|
let _maxBorrowable = await controllerContract.max_borrowable(_stateCollateral + _maxTotalCollateral, _N, _stateDebt, this.llamalend.constantOptions) - _stateDebt;
|
|
621
|
-
_maxBorrowable = _maxBorrowable * BigInt(
|
|
621
|
+
_maxBorrowable = _maxBorrowable * BigInt(970) / BigInt(1000);
|
|
622
622
|
|
|
623
623
|
return {
|
|
624
624
|
maxDebt: formatUnits(_maxBorrowable, this.market.borrowed_token.decimals),
|