@curvefi/llamalend-api 1.1.5 → 1.1.6
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.
|
@@ -119,7 +119,7 @@ export class MintMarketTemplate {
|
|
|
119
119
|
const _collateral = parseUnits(collateral, this.collateralDecimals);
|
|
120
120
|
const calls = [];
|
|
121
121
|
for (let N = this.minBands; N <= this.maxBands; N++) {
|
|
122
|
-
calls.push(this.llamalend.contracts[this.controller].multicallContract.max_borrowable(_collateral, N));
|
|
122
|
+
calls.push(this.llamalend.contracts[this.controller].multicallContract.max_borrowable(...(this.isDeleverageSupported ? [_collateral, N, 0] : [_collateral, N])));
|
|
123
123
|
}
|
|
124
124
|
const _amounts = yield this.llamalend.multicallProvider.all(calls);
|
|
125
125
|
const res = {};
|
|
@@ -617,7 +617,7 @@ export class MintMarketTemplate {
|
|
|
617
617
|
return __awaiter(this, void 0, void 0, function* () {
|
|
618
618
|
this._checkRange(range);
|
|
619
619
|
const _collateral = parseUnits(collateral, this.collateralDecimals);
|
|
620
|
-
return formatUnits(yield this.llamalend.contracts[this.controller].contract.max_borrowable(_collateral, range, this.llamalend.constantOptions));
|
|
620
|
+
return formatUnits(yield this.llamalend.contracts[this.controller].contract.max_borrowable(...(this.isDeleverageSupported ? [_collateral, range, 0] : [_collateral, range]), this.llamalend.constantOptions));
|
|
621
621
|
});
|
|
622
622
|
}
|
|
623
623
|
getMaxRange(collateral, debt) {
|
|
@@ -787,7 +787,7 @@ export class MintMarketTemplate {
|
|
|
787
787
|
const N = yield this.userRange();
|
|
788
788
|
const _collateral = _currentCollateral + parseUnits(collateralAmount, this.collateralDecimals);
|
|
789
789
|
const contract = this.llamalend.contracts[this.controller].contract;
|
|
790
|
-
const _debt = yield contract.max_borrowable(_collateral, N, this.llamalend.constantOptions);
|
|
790
|
+
const _debt = yield contract.max_borrowable(...(this.isDeleverageSupported ? [_collateral, N, _currentDebt] : [_collateral, N]), this.llamalend.constantOptions);
|
|
791
791
|
return formatUnits(_debt - _currentDebt);
|
|
792
792
|
});
|
|
793
793
|
}
|
package/package.json
CHANGED
|
@@ -661,7 +661,7 @@ export class MintMarketTemplate {
|
|
|
661
661
|
this._checkRange(range);
|
|
662
662
|
const _collateral = parseUnits(collateral, this.collateralDecimals);
|
|
663
663
|
|
|
664
|
-
return formatUnits(await this.llamalend.contracts[this.controller].contract.max_borrowable(_collateral, range, this.llamalend.constantOptions));
|
|
664
|
+
return formatUnits(await this.llamalend.contracts[this.controller].contract.max_borrowable(...(this.isDeleverageSupported ? [_collateral, range, 0] : [_collateral, range]), this.llamalend.constantOptions));
|
|
665
665
|
}
|
|
666
666
|
|
|
667
667
|
public createLoanMaxRecvAllRanges = memoize(async (collateral: number | string): Promise<{ [index: number]: string }> => {
|
|
@@ -669,7 +669,7 @@ export class MintMarketTemplate {
|
|
|
669
669
|
|
|
670
670
|
const calls = [];
|
|
671
671
|
for (let N = this.minBands; N <= this.maxBands; N++) {
|
|
672
|
-
calls.push(this.llamalend.contracts[this.controller].multicallContract.max_borrowable(_collateral, N));
|
|
672
|
+
calls.push(this.llamalend.contracts[this.controller].multicallContract.max_borrowable(...(this.isDeleverageSupported ? [_collateral, N, 0] : [_collateral, N])));
|
|
673
673
|
}
|
|
674
674
|
const _amounts = await this.llamalend.multicallProvider.all(calls) as bigint[];
|
|
675
675
|
|
|
@@ -842,7 +842,7 @@ export class MintMarketTemplate {
|
|
|
842
842
|
const _collateral = _currentCollateral + parseUnits(collateralAmount, this.collateralDecimals);
|
|
843
843
|
|
|
844
844
|
const contract = this.llamalend.contracts[this.controller].contract;
|
|
845
|
-
const _debt: bigint = await contract.max_borrowable(_collateral, N, this.llamalend.constantOptions);
|
|
845
|
+
const _debt: bigint = await contract.max_borrowable(...(this.isDeleverageSupported ? [_collateral, N, _currentDebt] : [_collateral, N]), this.llamalend.constantOptions);
|
|
846
846
|
|
|
847
847
|
return formatUnits(_debt - _currentDebt);
|
|
848
848
|
}
|