@gearbox-protocol/sdk 13.0.0-next.2 → 13.0.0-next.20
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/cjs/abi/310/iSecuritizeKYCFactory.js +356 -0
- package/dist/cjs/dev/AccountOpener.js +45 -5
- package/dist/cjs/sdk/accounts/AbstractCreditAccountsService.js +138 -118
- package/dist/cjs/sdk/accounts/CreditAccountsServiceV300.js +9 -4
- package/dist/cjs/sdk/accounts/CreditAccountsServiceV310.js +9 -4
- package/dist/cjs/sdk/base/ChainContractsRegister.js +1 -1
- package/dist/cjs/sdk/base/TokensMeta.js +158 -19
- package/dist/cjs/sdk/market/MarketRegister.js +2 -2
- package/dist/cjs/sdk/{pools/extraZappers.js → market/ZapperRegister.js} +110 -6
- package/dist/cjs/sdk/market/index.js +5 -1
- package/dist/cjs/sdk/market/kyc/SecuritizeKYCFactory.js +64 -0
- package/dist/cjs/sdk/market/kyc/index.js +22 -0
- package/dist/cjs/sdk/market/types.js +16 -0
- package/dist/cjs/sdk/pools/PoolService.js +180 -99
- package/dist/cjs/sdk/utils/AddressMap.js +1 -1
- package/dist/cjs/sdk/utils/viem/sendRawTx.js +16 -0
- package/dist/esm/abi/310/iSecuritizeKYCFactory.js +332 -0
- package/dist/esm/dev/AccountOpener.js +47 -6
- package/dist/esm/sdk/accounts/AbstractCreditAccountsService.js +140 -118
- package/dist/esm/sdk/accounts/CreditAccountsServiceV300.js +9 -4
- package/dist/esm/sdk/accounts/CreditAccountsServiceV310.js +9 -4
- package/dist/esm/sdk/base/ChainContractsRegister.js +1 -1
- package/dist/esm/sdk/base/TokensMeta.js +162 -18
- package/dist/esm/sdk/market/MarketRegister.js +2 -2
- package/dist/esm/sdk/{pools/extraZappers.js → market/ZapperRegister.js} +109 -2
- package/dist/esm/sdk/market/index.js +2 -0
- package/dist/esm/sdk/market/kyc/SecuritizeKYCFactory.js +40 -0
- package/dist/esm/sdk/market/kyc/index.js +1 -0
- package/dist/esm/sdk/market/types.js +0 -0
- package/dist/esm/sdk/pools/PoolService.js +181 -106
- package/dist/esm/sdk/utils/AddressMap.js +1 -1
- package/dist/esm/sdk/utils/viem/sendRawTx.js +19 -1
- package/dist/types/abi/310/iSecuritizeKYCFactory.d.ts +431 -0
- package/dist/types/sdk/accounts/AbstractCreditAccountsService.d.ts +45 -25
- package/dist/types/sdk/accounts/types.d.ts +28 -1
- package/dist/types/sdk/base/TokensMeta.d.ts +30 -5
- package/dist/types/sdk/base/token-types.d.ts +9 -2
- package/dist/types/sdk/market/MarketRegister.d.ts +2 -2
- package/dist/types/sdk/market/ZapperRegister.d.ts +17 -0
- package/dist/types/sdk/market/index.d.ts +2 -0
- package/dist/types/sdk/market/kyc/SecuritizeKYCFactory.d.ts +445 -0
- package/dist/types/sdk/market/kyc/index.d.ts +1 -0
- package/dist/types/sdk/market/types.d.ts +10 -0
- package/dist/types/sdk/pools/PoolService.d.ts +4 -4
- package/dist/types/sdk/pools/types.d.ts +25 -16
- package/dist/types/sdk/utils/AddressMap.d.ts +1 -1
- package/dist/types/sdk/utils/viem/sendRawTx.d.ts +5 -1
- package/package.json +1 -1
- package/dist/types/sdk/pools/extraZappers.d.ts +0 -9
|
@@ -23,6 +23,9 @@ import {
|
|
|
23
23
|
RAY,
|
|
24
24
|
VERSION_RANGE_310
|
|
25
25
|
} from "../constants/index.js";
|
|
26
|
+
import {
|
|
27
|
+
SecuritizeKYCFactory
|
|
28
|
+
} from "../market/index.js";
|
|
26
29
|
import { assetsMap } from "../router/index.js";
|
|
27
30
|
import { BigIntMath } from "../sdk-legacy/index.js";
|
|
28
31
|
import { AddressMap } from "../utils/index.js";
|
|
@@ -402,7 +405,12 @@ class AbstractCreditAccountService extends SDKConstruct {
|
|
|
402
405
|
(t) => this.prepareWithdrawToken(ca.creditFacade, t, MAX_UINT256, to)
|
|
403
406
|
)
|
|
404
407
|
];
|
|
405
|
-
const tx =
|
|
408
|
+
const tx = await this.closeCreditAccountTx(
|
|
409
|
+
cm,
|
|
410
|
+
ca.creditAccount,
|
|
411
|
+
calls,
|
|
412
|
+
operation
|
|
413
|
+
);
|
|
406
414
|
return { tx, calls, routerCloseResult, creditFacade: cm.creditFacade };
|
|
407
415
|
}
|
|
408
416
|
/**
|
|
@@ -432,7 +440,7 @@ class AbstractCreditAccountService extends SDKConstruct {
|
|
|
432
440
|
averageQuota
|
|
433
441
|
})
|
|
434
442
|
];
|
|
435
|
-
const tx =
|
|
443
|
+
const tx = await this.multicallTx(cm, creditAccount.creditAccount, calls);
|
|
436
444
|
return { tx, calls, creditFacade: cm.creditFacade };
|
|
437
445
|
}
|
|
438
446
|
/**
|
|
@@ -474,7 +482,7 @@ class AbstractCreditAccountService extends SDKConstruct {
|
|
|
474
482
|
averageQuota
|
|
475
483
|
})
|
|
476
484
|
];
|
|
477
|
-
const tx =
|
|
485
|
+
const tx = await this.multicallTx(cm, creditAccount.creditAccount, calls);
|
|
478
486
|
tx.value = ethAmount.toString(10);
|
|
479
487
|
return { tx, calls, creditFacade: cm.creditFacade };
|
|
480
488
|
}
|
|
@@ -525,7 +533,7 @@ class AbstractCreditAccountService extends SDKConstruct {
|
|
|
525
533
|
]) : [],
|
|
526
534
|
this.#prepareChangeDebt(creditAccount.creditFacade, change, isDecrease)
|
|
527
535
|
];
|
|
528
|
-
const tx =
|
|
536
|
+
const tx = await this.multicallTx(cm, creditAccount.creditAccount, calls);
|
|
529
537
|
return { tx, calls, creditFacade: cm.creditFacade };
|
|
530
538
|
}
|
|
531
539
|
/**
|
|
@@ -560,7 +568,7 @@ class AbstractCreditAccountService extends SDKConstruct {
|
|
|
560
568
|
averageQuota
|
|
561
569
|
})
|
|
562
570
|
];
|
|
563
|
-
const tx =
|
|
571
|
+
const tx = await this.multicallTx(cm, creditAccount.creditAccount, calls);
|
|
564
572
|
return { tx, calls, creditFacade: cm.creditFacade };
|
|
565
573
|
}
|
|
566
574
|
/**
|
|
@@ -676,7 +684,7 @@ class AbstractCreditAccountService extends SDKConstruct {
|
|
|
676
684
|
averageQuota
|
|
677
685
|
})
|
|
678
686
|
];
|
|
679
|
-
const tx =
|
|
687
|
+
const tx = await this.multicallTx(cm, creditAccount.creditAccount, calls);
|
|
680
688
|
return { tx, calls, creditFacade: cm.creditFacade };
|
|
681
689
|
}
|
|
682
690
|
/**
|
|
@@ -741,7 +749,7 @@ class AbstractCreditAccountService extends SDKConstruct {
|
|
|
741
749
|
compareBalances,
|
|
742
750
|
...quotaCalls
|
|
743
751
|
];
|
|
744
|
-
const tx =
|
|
752
|
+
const tx = await this.multicallTx(cm, creditAccount.creditAccount, calls);
|
|
745
753
|
return { tx, calls, creditFacade: cm.creditFacade };
|
|
746
754
|
}
|
|
747
755
|
/**
|
|
@@ -768,48 +776,64 @@ class AbstractCreditAccountService extends SDKConstruct {
|
|
|
768
776
|
),
|
|
769
777
|
...this.#prepareEnableTokens(ca.creditFacade, enabledTokens)
|
|
770
778
|
];
|
|
771
|
-
const tx =
|
|
779
|
+
const tx = await this.multicallTx(cm, ca.creditAccount, calls);
|
|
772
780
|
return { tx, calls, creditFacade: cm.creditFacade };
|
|
773
781
|
}
|
|
782
|
+
/**
|
|
783
|
+
* Returns address to which approval should be given on collateral token
|
|
784
|
+
* It's credit manager for classical markets and special wallet for KYC markets
|
|
785
|
+
* @param options - {@link GetApprovalAddressProps}
|
|
786
|
+
* @returns
|
|
787
|
+
**/
|
|
788
|
+
async getApprovalAddress(options) {
|
|
789
|
+
const { creditManager } = options;
|
|
790
|
+
const suite = this.sdk.marketRegister.findCreditManager(creditManager);
|
|
791
|
+
await this.sdk.tokensMeta.loadTokenData(suite.underlying);
|
|
792
|
+
const underlying = this.sdk.tokensMeta.mustGet(suite.underlying);
|
|
793
|
+
if (this.sdk.tokensMeta.isKYCUnderlying(underlying)) {
|
|
794
|
+
const factory = new SecuritizeKYCFactory(this.sdk, underlying.kycFactory);
|
|
795
|
+
if ("creditAccount" in options) {
|
|
796
|
+
return factory.getWallet(options.creditAccount);
|
|
797
|
+
}
|
|
798
|
+
return factory.precomputeWalletAddress(creditManager, options.borrower);
|
|
799
|
+
}
|
|
800
|
+
return suite.creditManager.address;
|
|
801
|
+
}
|
|
774
802
|
/**
|
|
775
803
|
* Executes swap specified by given calls, update quotas of affected tokens
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
* @param {bigint} ethAmount - native token amount to attach to tx
|
|
784
|
-
* @param {Address} creditManager - address of credit manager to open credit account on
|
|
785
|
-
* @param {Array<Asset>} collateral - array of collateral which can be just directly added or swapped using the path {@link Asset}
|
|
786
|
-
* @param {Record<Address, PermitResult>} permits - permits of collateral tokens (in any permittable token is present) {@link PermitResult}
|
|
787
|
-
* @param {bigint} debt - debt to open credit account with
|
|
788
|
-
* @param {boolean} withdrawDebt - flag to withdraw debt to wallet after opening credit account;
|
|
789
|
-
used for borrowing functionality
|
|
790
|
-
* @param {bigint} referralCode - referral code to open credit account with
|
|
791
|
-
* @param {Address} to - wallet address to transfer credit account to\
|
|
792
|
-
* @param {Array<MultiCall>} calls - array of MultiCall from router methods findOpenStrategyPath {@link MultiCall}.
|
|
793
|
-
Used for trading and strategy functionality
|
|
794
|
-
* @param {Array<Asset>} averageQuota - average quota for tokens after open {@link Asset}
|
|
795
|
-
* @param {Array<Asset>} minQuota - minimum quota for tokens after open {@link Asset}
|
|
804
|
+
* - Open credit account is executed in the following order: price update -> increase debt -> add collateral ->
|
|
805
|
+
* -> update quotas -> (optionally: execute swap path for trading/strategy) ->
|
|
806
|
+
* -> (optionally: withdraw debt for lending)
|
|
807
|
+
*- Basic open credit account: price update -> increase debt -> add collateral -> update quotas
|
|
808
|
+
*- Lending: price update -> increase debt -> add collateral -> update quotas -> withdraw debt
|
|
809
|
+
*- Strategy/trading: price update -> increase debt -> add collateral -> update quotas -> execute swap path
|
|
810
|
+
*- In strategy is possible situation when collateral is added, but not swapped; the only swapped value in this case will be debt
|
|
796
811
|
* @returns All necessary data to execute the transaction (call, credit facade)
|
|
797
|
-
|
|
798
|
-
async openCA({
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
812
|
+
**/
|
|
813
|
+
async openCA(props) {
|
|
814
|
+
const {
|
|
815
|
+
ethAmount,
|
|
816
|
+
creditManager,
|
|
817
|
+
reopenCreditAccount,
|
|
818
|
+
collateral,
|
|
819
|
+
permits,
|
|
820
|
+
debt,
|
|
821
|
+
withdrawToken,
|
|
822
|
+
referralCode,
|
|
823
|
+
to,
|
|
824
|
+
calls: openPathCalls,
|
|
825
|
+
callsAfter,
|
|
826
|
+
minQuota,
|
|
827
|
+
averageQuota
|
|
828
|
+
} = props;
|
|
811
829
|
const cmSuite = this.sdk.marketRegister.findCreditManager(creditManager);
|
|
812
830
|
const cm = cmSuite.creditManager;
|
|
831
|
+
let tokenToWithdraw;
|
|
832
|
+
if (withdrawToken === true) {
|
|
833
|
+
tokenToWithdraw = cm.underlying;
|
|
834
|
+
} else if (typeof withdrawToken === "string") {
|
|
835
|
+
tokenToWithdraw = withdrawToken;
|
|
836
|
+
}
|
|
813
837
|
const priceUpdatesCalls = await this.getPriceUpdatesForFacade({
|
|
814
838
|
creditManager: cm.address,
|
|
815
839
|
desiredQuotas: averageQuota
|
|
@@ -819,13 +843,27 @@ class AbstractCreditAccountService extends SDKConstruct {
|
|
|
819
843
|
this.#prepareIncreaseDebt(cm.creditFacade, debt),
|
|
820
844
|
...this.prepareAddCollateral(cm.creditFacade, collateral, permits),
|
|
821
845
|
...openPathCalls,
|
|
822
|
-
|
|
846
|
+
// путь из underlying в withdrawal token
|
|
847
|
+
...tokenToWithdraw ? [
|
|
848
|
+
this.prepareWithdrawToken(
|
|
849
|
+
cm.creditFacade,
|
|
850
|
+
tokenToWithdraw,
|
|
851
|
+
MAX_UINT256,
|
|
852
|
+
to
|
|
853
|
+
)
|
|
854
|
+
] : [],
|
|
823
855
|
...this.prepareUpdateQuotas(cm.creditFacade, {
|
|
824
856
|
minQuota,
|
|
825
857
|
averageQuota
|
|
826
|
-
})
|
|
858
|
+
}),
|
|
859
|
+
...callsAfter ?? []
|
|
827
860
|
];
|
|
828
|
-
|
|
861
|
+
let tx;
|
|
862
|
+
if (reopenCreditAccount) {
|
|
863
|
+
tx = await this.multicallTx(cmSuite, reopenCreditAccount, calls);
|
|
864
|
+
} else {
|
|
865
|
+
tx = await this.openCreditAccountTx(cmSuite, to, calls, referralCode);
|
|
866
|
+
}
|
|
829
867
|
tx.value = ethAmount.toString(10);
|
|
830
868
|
return { calls, tx, creditFacade: cmSuite.creditFacade };
|
|
831
869
|
}
|
|
@@ -1166,80 +1204,64 @@ class AbstractCreditAccountService extends SDKConstruct {
|
|
|
1166
1204
|
VERSION_RANGE_310
|
|
1167
1205
|
)[0];
|
|
1168
1206
|
}
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
{
|
|
1226
|
-
type: "function",
|
|
1227
|
-
name: "multiAcceptAndClaim",
|
|
1228
|
-
inputs: [
|
|
1229
|
-
{ name: "multiVault", type: "address", internalType: "address" },
|
|
1230
|
-
{
|
|
1231
|
-
name: "subvaultIndices",
|
|
1232
|
-
type: "uint256[]",
|
|
1233
|
-
internalType: "uint256[]"
|
|
1234
|
-
},
|
|
1235
|
-
{ name: "indices", type: "uint256[][]", internalType: "uint256[][]" },
|
|
1236
|
-
{ name: "", type: "address", internalType: "address" },
|
|
1237
|
-
{ name: "maxAssets", type: "uint256", internalType: "uint256" }
|
|
1238
|
-
],
|
|
1239
|
-
outputs: [{ name: "", type: "bool", internalType: "bool" }],
|
|
1240
|
-
stateMutability: "nonpayable"
|
|
1207
|
+
/**
|
|
1208
|
+
* Wrapper that selects between credit facade and KYC factory
|
|
1209
|
+
* @param suite
|
|
1210
|
+
* @param to
|
|
1211
|
+
* @param calls
|
|
1212
|
+
* @param referralCode
|
|
1213
|
+
* @returns
|
|
1214
|
+
*/
|
|
1215
|
+
async openCreditAccountTx(suite, to, calls, referralCode) {
|
|
1216
|
+
await this.sdk.tokensMeta.loadTokenData(suite.underlying);
|
|
1217
|
+
const underlying = this.sdk.tokensMeta.mustGet(suite.underlying);
|
|
1218
|
+
if (this.sdk.tokensMeta.isKYCUnderlying(underlying)) {
|
|
1219
|
+
const factory = new SecuritizeKYCFactory(this.sdk, underlying.kycFactory);
|
|
1220
|
+
const tokensToRegister = await factory.getDSTokens();
|
|
1221
|
+
return factory.openCreditAccount(
|
|
1222
|
+
suite.creditManager.address,
|
|
1223
|
+
calls,
|
|
1224
|
+
tokensToRegister
|
|
1225
|
+
);
|
|
1226
|
+
}
|
|
1227
|
+
return suite.creditFacade.openCreditAccount(to, calls, referralCode ?? 0n);
|
|
1228
|
+
}
|
|
1229
|
+
/**
|
|
1230
|
+
* Wrapper that selects between credit facade and KYC factory
|
|
1231
|
+
* @param suite
|
|
1232
|
+
* @param creditAccount
|
|
1233
|
+
* @param calls
|
|
1234
|
+
* @returns
|
|
1235
|
+
*/
|
|
1236
|
+
async multicallTx(suite, creditAccount, calls) {
|
|
1237
|
+
await this.sdk.tokensMeta.loadTokenData(suite.underlying);
|
|
1238
|
+
const underlying = this.sdk.tokensMeta.mustGet(suite.underlying);
|
|
1239
|
+
if (this.sdk.tokensMeta.isKYCUnderlying(underlying)) {
|
|
1240
|
+
const tokensToRegister = [];
|
|
1241
|
+
const factory = new SecuritizeKYCFactory(this.sdk, underlying.kycFactory);
|
|
1242
|
+
return factory.multicall(creditAccount, calls, tokensToRegister);
|
|
1243
|
+
}
|
|
1244
|
+
return suite.creditFacade.multicall(creditAccount, calls);
|
|
1245
|
+
}
|
|
1246
|
+
/**
|
|
1247
|
+
* Wrapper that selects between credit facade and KYC factory
|
|
1248
|
+
* @param suite
|
|
1249
|
+
* @param creditAccount
|
|
1250
|
+
* @param calls
|
|
1251
|
+
* @param operation
|
|
1252
|
+
* @returns
|
|
1253
|
+
*/
|
|
1254
|
+
async closeCreditAccountTx(suite, creditAccount, calls, operation) {
|
|
1255
|
+
await this.sdk.tokensMeta.loadTokenData(suite.underlying);
|
|
1256
|
+
const underlying = this.sdk.tokensMeta.mustGet(suite.underlying);
|
|
1257
|
+
if (this.sdk.tokensMeta.isKYCUnderlying(underlying)) {
|
|
1258
|
+
throw new Error(
|
|
1259
|
+
"KYC underlying is not supported for close credit account"
|
|
1260
|
+
);
|
|
1261
|
+
}
|
|
1262
|
+
return operation === "close" ? suite.creditFacade.closeCreditAccount(creditAccount, calls) : suite.creditFacade.multicall(creditAccount, calls);
|
|
1241
1263
|
}
|
|
1242
|
-
|
|
1264
|
+
}
|
|
1243
1265
|
export {
|
|
1244
1266
|
AbstractCreditAccountService,
|
|
1245
1267
|
getWithdrawalCompressorAddress
|
|
@@ -65,7 +65,7 @@ class CreditAccountServiceV300 extends AbstractCreditAccountService {
|
|
|
65
65
|
averageQuota
|
|
66
66
|
})
|
|
67
67
|
];
|
|
68
|
-
const tx =
|
|
68
|
+
const tx = await this.multicallTx(cm, creditAccount.creditAccount, calls);
|
|
69
69
|
return { tx, calls, creditFacade: cm.creditFacade };
|
|
70
70
|
}
|
|
71
71
|
/**
|
|
@@ -102,7 +102,12 @@ class CreditAccountServiceV300 extends AbstractCreditAccountService {
|
|
|
102
102
|
(t) => this.prepareWithdrawToken(ca.creditFacade, t.token, MAX_UINT256, to)
|
|
103
103
|
)
|
|
104
104
|
];
|
|
105
|
-
const tx =
|
|
105
|
+
const tx = await this.closeCreditAccountTx(
|
|
106
|
+
cm,
|
|
107
|
+
ca.creditAccount,
|
|
108
|
+
calls,
|
|
109
|
+
operation
|
|
110
|
+
);
|
|
106
111
|
return { tx, calls, creditFacade: cm.creditFacade };
|
|
107
112
|
}
|
|
108
113
|
/**
|
|
@@ -166,7 +171,7 @@ class CreditAccountServiceV300 extends AbstractCreditAccountService {
|
|
|
166
171
|
),
|
|
167
172
|
...this.prepareUpdateQuotas(ca.creditFacade, { minQuota, averageQuota })
|
|
168
173
|
];
|
|
169
|
-
const tx =
|
|
174
|
+
const tx = await this.multicallTx(cm, ca.creditAccount, calls);
|
|
170
175
|
return { tx, calls, creditFacade: cm.creditFacade };
|
|
171
176
|
}
|
|
172
177
|
async previewWithdrawLlamathenaProportionally({
|
|
@@ -258,7 +263,7 @@ class CreditAccountServiceV300 extends AbstractCreditAccountService {
|
|
|
258
263
|
averageQuota
|
|
259
264
|
})
|
|
260
265
|
];
|
|
261
|
-
const tx =
|
|
266
|
+
const tx = await this.multicallTx(cm, ca.creditAccount, calls);
|
|
262
267
|
return { tx, calls, creditFacade: cm.creditFacade };
|
|
263
268
|
}
|
|
264
269
|
/**
|
|
@@ -42,7 +42,7 @@ class CreditAccountServiceV310 extends AbstractCreditAccountService {
|
|
|
42
42
|
})
|
|
43
43
|
};
|
|
44
44
|
const calls = [...priceUpdatesCalls, addBotCall];
|
|
45
|
-
const tx = targetContract.type === "creditAccount" ?
|
|
45
|
+
const tx = targetContract.type === "creditAccount" ? await this.multicallTx(cm, targetContract.creditAccount, calls) : void 0;
|
|
46
46
|
return { tx, calls, creditFacade: cm.creditFacade };
|
|
47
47
|
}
|
|
48
48
|
/**
|
|
@@ -77,7 +77,7 @@ class CreditAccountServiceV310 extends AbstractCreditAccountService {
|
|
|
77
77
|
averageQuota
|
|
78
78
|
})
|
|
79
79
|
];
|
|
80
|
-
const tx =
|
|
80
|
+
const tx = await this.multicallTx(cm, creditAccount.creditAccount, calls);
|
|
81
81
|
return { tx, calls, creditFacade: cm.creditFacade };
|
|
82
82
|
}
|
|
83
83
|
/**
|
|
@@ -115,7 +115,12 @@ class CreditAccountServiceV310 extends AbstractCreditAccountService {
|
|
|
115
115
|
(t) => this.prepareWithdrawToken(ca.creditFacade, t.token, MAX_UINT256, to)
|
|
116
116
|
)
|
|
117
117
|
];
|
|
118
|
-
const tx =
|
|
118
|
+
const tx = await this.closeCreditAccountTx(
|
|
119
|
+
cm,
|
|
120
|
+
ca.creditAccount,
|
|
121
|
+
calls,
|
|
122
|
+
operation
|
|
123
|
+
);
|
|
119
124
|
return { tx, calls, creditFacade: cm.creditFacade };
|
|
120
125
|
}
|
|
121
126
|
/**
|
|
@@ -186,7 +191,7 @@ class CreditAccountServiceV310 extends AbstractCreditAccountService {
|
|
|
186
191
|
...claimPath.calls,
|
|
187
192
|
...this.prepareUpdateQuotas(ca.creditFacade, { minQuota, averageQuota })
|
|
188
193
|
];
|
|
189
|
-
const tx =
|
|
194
|
+
const tx = await this.multicallTx(cm, ca.creditAccount, calls);
|
|
190
195
|
return { tx, calls, creditFacade: cm.creditFacade };
|
|
191
196
|
}
|
|
192
197
|
async previewWithdrawLlamathenaProportionally(_) {
|