@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
|
@@ -33,6 +33,7 @@ var import_v300 = require("../../abi/v300.js");
|
|
|
33
33
|
var import_base = require("../base/index.js");
|
|
34
34
|
var import_chains = require("../chain/chains.js");
|
|
35
35
|
var import_constants = require("../constants/index.js");
|
|
36
|
+
var import_market = require("../market/index.js");
|
|
36
37
|
var import_router = require("../router/index.js");
|
|
37
38
|
var import_sdk_legacy = require("../sdk-legacy/index.js");
|
|
38
39
|
var import_utils = require("../utils/index.js");
|
|
@@ -412,7 +413,12 @@ class AbstractCreditAccountService extends import_base.SDKConstruct {
|
|
|
412
413
|
(t) => this.prepareWithdrawToken(ca.creditFacade, t, import_constants.MAX_UINT256, to)
|
|
413
414
|
)
|
|
414
415
|
];
|
|
415
|
-
const tx =
|
|
416
|
+
const tx = await this.closeCreditAccountTx(
|
|
417
|
+
cm,
|
|
418
|
+
ca.creditAccount,
|
|
419
|
+
calls,
|
|
420
|
+
operation
|
|
421
|
+
);
|
|
416
422
|
return { tx, calls, routerCloseResult, creditFacade: cm.creditFacade };
|
|
417
423
|
}
|
|
418
424
|
/**
|
|
@@ -442,7 +448,7 @@ class AbstractCreditAccountService extends import_base.SDKConstruct {
|
|
|
442
448
|
averageQuota
|
|
443
449
|
})
|
|
444
450
|
];
|
|
445
|
-
const tx =
|
|
451
|
+
const tx = await this.multicallTx(cm, creditAccount.creditAccount, calls);
|
|
446
452
|
return { tx, calls, creditFacade: cm.creditFacade };
|
|
447
453
|
}
|
|
448
454
|
/**
|
|
@@ -484,7 +490,7 @@ class AbstractCreditAccountService extends import_base.SDKConstruct {
|
|
|
484
490
|
averageQuota
|
|
485
491
|
})
|
|
486
492
|
];
|
|
487
|
-
const tx =
|
|
493
|
+
const tx = await this.multicallTx(cm, creditAccount.creditAccount, calls);
|
|
488
494
|
tx.value = ethAmount.toString(10);
|
|
489
495
|
return { tx, calls, creditFacade: cm.creditFacade };
|
|
490
496
|
}
|
|
@@ -535,7 +541,7 @@ class AbstractCreditAccountService extends import_base.SDKConstruct {
|
|
|
535
541
|
]) : [],
|
|
536
542
|
this.#prepareChangeDebt(creditAccount.creditFacade, change, isDecrease)
|
|
537
543
|
];
|
|
538
|
-
const tx =
|
|
544
|
+
const tx = await this.multicallTx(cm, creditAccount.creditAccount, calls);
|
|
539
545
|
return { tx, calls, creditFacade: cm.creditFacade };
|
|
540
546
|
}
|
|
541
547
|
/**
|
|
@@ -570,7 +576,7 @@ class AbstractCreditAccountService extends import_base.SDKConstruct {
|
|
|
570
576
|
averageQuota
|
|
571
577
|
})
|
|
572
578
|
];
|
|
573
|
-
const tx =
|
|
579
|
+
const tx = await this.multicallTx(cm, creditAccount.creditAccount, calls);
|
|
574
580
|
return { tx, calls, creditFacade: cm.creditFacade };
|
|
575
581
|
}
|
|
576
582
|
/**
|
|
@@ -686,7 +692,7 @@ class AbstractCreditAccountService extends import_base.SDKConstruct {
|
|
|
686
692
|
averageQuota
|
|
687
693
|
})
|
|
688
694
|
];
|
|
689
|
-
const tx =
|
|
695
|
+
const tx = await this.multicallTx(cm, creditAccount.creditAccount, calls);
|
|
690
696
|
return { tx, calls, creditFacade: cm.creditFacade };
|
|
691
697
|
}
|
|
692
698
|
/**
|
|
@@ -751,7 +757,7 @@ class AbstractCreditAccountService extends import_base.SDKConstruct {
|
|
|
751
757
|
compareBalances,
|
|
752
758
|
...quotaCalls
|
|
753
759
|
];
|
|
754
|
-
const tx =
|
|
760
|
+
const tx = await this.multicallTx(cm, creditAccount.creditAccount, calls);
|
|
755
761
|
return { tx, calls, creditFacade: cm.creditFacade };
|
|
756
762
|
}
|
|
757
763
|
/**
|
|
@@ -778,48 +784,64 @@ class AbstractCreditAccountService extends import_base.SDKConstruct {
|
|
|
778
784
|
),
|
|
779
785
|
...this.#prepareEnableTokens(ca.creditFacade, enabledTokens)
|
|
780
786
|
];
|
|
781
|
-
const tx =
|
|
787
|
+
const tx = await this.multicallTx(cm, ca.creditAccount, calls);
|
|
782
788
|
return { tx, calls, creditFacade: cm.creditFacade };
|
|
783
789
|
}
|
|
790
|
+
/**
|
|
791
|
+
* Returns address to which approval should be given on collateral token
|
|
792
|
+
* It's credit manager for classical markets and special wallet for KYC markets
|
|
793
|
+
* @param options - {@link GetApprovalAddressProps}
|
|
794
|
+
* @returns
|
|
795
|
+
**/
|
|
796
|
+
async getApprovalAddress(options) {
|
|
797
|
+
const { creditManager } = options;
|
|
798
|
+
const suite = this.sdk.marketRegister.findCreditManager(creditManager);
|
|
799
|
+
await this.sdk.tokensMeta.loadTokenData(suite.underlying);
|
|
800
|
+
const underlying = this.sdk.tokensMeta.mustGet(suite.underlying);
|
|
801
|
+
if (this.sdk.tokensMeta.isKYCUnderlying(underlying)) {
|
|
802
|
+
const factory = new import_market.SecuritizeKYCFactory(this.sdk, underlying.kycFactory);
|
|
803
|
+
if ("creditAccount" in options) {
|
|
804
|
+
return factory.getWallet(options.creditAccount);
|
|
805
|
+
}
|
|
806
|
+
return factory.precomputeWalletAddress(creditManager, options.borrower);
|
|
807
|
+
}
|
|
808
|
+
return suite.creditManager.address;
|
|
809
|
+
}
|
|
784
810
|
/**
|
|
785
811
|
* Executes swap specified by given calls, update quotas of affected tokens
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
* @param {bigint} ethAmount - native token amount to attach to tx
|
|
794
|
-
* @param {Address} creditManager - address of credit manager to open credit account on
|
|
795
|
-
* @param {Array<Asset>} collateral - array of collateral which can be just directly added or swapped using the path {@link Asset}
|
|
796
|
-
* @param {Record<Address, PermitResult>} permits - permits of collateral tokens (in any permittable token is present) {@link PermitResult}
|
|
797
|
-
* @param {bigint} debt - debt to open credit account with
|
|
798
|
-
* @param {boolean} withdrawDebt - flag to withdraw debt to wallet after opening credit account;
|
|
799
|
-
used for borrowing functionality
|
|
800
|
-
* @param {bigint} referralCode - referral code to open credit account with
|
|
801
|
-
* @param {Address} to - wallet address to transfer credit account to\
|
|
802
|
-
* @param {Array<MultiCall>} calls - array of MultiCall from router methods findOpenStrategyPath {@link MultiCall}.
|
|
803
|
-
Used for trading and strategy functionality
|
|
804
|
-
* @param {Array<Asset>} averageQuota - average quota for tokens after open {@link Asset}
|
|
805
|
-
* @param {Array<Asset>} minQuota - minimum quota for tokens after open {@link Asset}
|
|
812
|
+
* - Open credit account is executed in the following order: price update -> increase debt -> add collateral ->
|
|
813
|
+
* -> update quotas -> (optionally: execute swap path for trading/strategy) ->
|
|
814
|
+
* -> (optionally: withdraw debt for lending)
|
|
815
|
+
*- Basic open credit account: price update -> increase debt -> add collateral -> update quotas
|
|
816
|
+
*- Lending: price update -> increase debt -> add collateral -> update quotas -> withdraw debt
|
|
817
|
+
*- Strategy/trading: price update -> increase debt -> add collateral -> update quotas -> execute swap path
|
|
818
|
+
*- In strategy is possible situation when collateral is added, but not swapped; the only swapped value in this case will be debt
|
|
806
819
|
* @returns All necessary data to execute the transaction (call, credit facade)
|
|
807
|
-
|
|
808
|
-
async openCA({
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
820
|
+
**/
|
|
821
|
+
async openCA(props) {
|
|
822
|
+
const {
|
|
823
|
+
ethAmount,
|
|
824
|
+
creditManager,
|
|
825
|
+
reopenCreditAccount,
|
|
826
|
+
collateral,
|
|
827
|
+
permits,
|
|
828
|
+
debt,
|
|
829
|
+
withdrawToken,
|
|
830
|
+
referralCode,
|
|
831
|
+
to,
|
|
832
|
+
calls: openPathCalls,
|
|
833
|
+
callsAfter,
|
|
834
|
+
minQuota,
|
|
835
|
+
averageQuota
|
|
836
|
+
} = props;
|
|
821
837
|
const cmSuite = this.sdk.marketRegister.findCreditManager(creditManager);
|
|
822
838
|
const cm = cmSuite.creditManager;
|
|
839
|
+
let tokenToWithdraw;
|
|
840
|
+
if (withdrawToken === true) {
|
|
841
|
+
tokenToWithdraw = cm.underlying;
|
|
842
|
+
} else if (typeof withdrawToken === "string") {
|
|
843
|
+
tokenToWithdraw = withdrawToken;
|
|
844
|
+
}
|
|
823
845
|
const priceUpdatesCalls = await this.getPriceUpdatesForFacade({
|
|
824
846
|
creditManager: cm.address,
|
|
825
847
|
desiredQuotas: averageQuota
|
|
@@ -829,13 +851,27 @@ class AbstractCreditAccountService extends import_base.SDKConstruct {
|
|
|
829
851
|
this.#prepareIncreaseDebt(cm.creditFacade, debt),
|
|
830
852
|
...this.prepareAddCollateral(cm.creditFacade, collateral, permits),
|
|
831
853
|
...openPathCalls,
|
|
832
|
-
|
|
854
|
+
// путь из underlying в withdrawal token
|
|
855
|
+
...tokenToWithdraw ? [
|
|
856
|
+
this.prepareWithdrawToken(
|
|
857
|
+
cm.creditFacade,
|
|
858
|
+
tokenToWithdraw,
|
|
859
|
+
import_constants.MAX_UINT256,
|
|
860
|
+
to
|
|
861
|
+
)
|
|
862
|
+
] : [],
|
|
833
863
|
...this.prepareUpdateQuotas(cm.creditFacade, {
|
|
834
864
|
minQuota,
|
|
835
865
|
averageQuota
|
|
836
|
-
})
|
|
866
|
+
}),
|
|
867
|
+
...callsAfter ?? []
|
|
837
868
|
];
|
|
838
|
-
|
|
869
|
+
let tx;
|
|
870
|
+
if (reopenCreditAccount) {
|
|
871
|
+
tx = await this.multicallTx(cmSuite, reopenCreditAccount, calls);
|
|
872
|
+
} else {
|
|
873
|
+
tx = await this.openCreditAccountTx(cmSuite, to, calls, referralCode);
|
|
874
|
+
}
|
|
839
875
|
tx.value = ethAmount.toString(10);
|
|
840
876
|
return { calls, tx, creditFacade: cmSuite.creditFacade };
|
|
841
877
|
}
|
|
@@ -1176,80 +1212,64 @@ class AbstractCreditAccountService extends import_base.SDKConstruct {
|
|
|
1176
1212
|
import_constants.VERSION_RANGE_310
|
|
1177
1213
|
)[0];
|
|
1178
1214
|
}
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
type: "function",
|
|
1201
|
-
name: "getUserSubvaultIndices",
|
|
1202
|
-
inputs: [
|
|
1203
|
-
{ name: "multiVault", type: "address", internalType: "address" },
|
|
1204
|
-
{ name: "user", type: "address", internalType: "address" }
|
|
1205
|
-
],
|
|
1206
|
-
outputs: [
|
|
1207
|
-
{
|
|
1208
|
-
name: "subvaultIndices",
|
|
1209
|
-
type: "uint256[]",
|
|
1210
|
-
internalType: "uint256[]"
|
|
1211
|
-
},
|
|
1212
|
-
{
|
|
1213
|
-
name: "withdrawalIndices",
|
|
1214
|
-
type: "uint256[][]",
|
|
1215
|
-
internalType: "uint256[][]"
|
|
1216
|
-
}
|
|
1217
|
-
],
|
|
1218
|
-
stateMutability: "view"
|
|
1219
|
-
},
|
|
1220
|
-
{
|
|
1221
|
-
type: "function",
|
|
1222
|
-
name: "multiAccept",
|
|
1223
|
-
inputs: [
|
|
1224
|
-
{ name: "multiVault", type: "address", internalType: "address" },
|
|
1225
|
-
{
|
|
1226
|
-
name: "subvaultIndices",
|
|
1227
|
-
type: "uint256[]",
|
|
1228
|
-
internalType: "uint256[]"
|
|
1229
|
-
},
|
|
1230
|
-
{ name: "indices", type: "uint256[][]", internalType: "uint256[][]" }
|
|
1231
|
-
],
|
|
1232
|
-
outputs: [{ name: "", type: "bool", internalType: "bool" }],
|
|
1233
|
-
stateMutability: "nonpayable"
|
|
1234
|
-
},
|
|
1235
|
-
{
|
|
1236
|
-
type: "function",
|
|
1237
|
-
name: "multiAcceptAndClaim",
|
|
1238
|
-
inputs: [
|
|
1239
|
-
{ name: "multiVault", type: "address", internalType: "address" },
|
|
1240
|
-
{
|
|
1241
|
-
name: "subvaultIndices",
|
|
1242
|
-
type: "uint256[]",
|
|
1243
|
-
internalType: "uint256[]"
|
|
1244
|
-
},
|
|
1245
|
-
{ name: "indices", type: "uint256[][]", internalType: "uint256[][]" },
|
|
1246
|
-
{ name: "", type: "address", internalType: "address" },
|
|
1247
|
-
{ name: "maxAssets", type: "uint256", internalType: "uint256" }
|
|
1248
|
-
],
|
|
1249
|
-
outputs: [{ name: "", type: "bool", internalType: "bool" }],
|
|
1250
|
-
stateMutability: "nonpayable"
|
|
1215
|
+
/**
|
|
1216
|
+
* Wrapper that selects between credit facade and KYC factory
|
|
1217
|
+
* @param suite
|
|
1218
|
+
* @param to
|
|
1219
|
+
* @param calls
|
|
1220
|
+
* @param referralCode
|
|
1221
|
+
* @returns
|
|
1222
|
+
*/
|
|
1223
|
+
async openCreditAccountTx(suite, to, calls, referralCode) {
|
|
1224
|
+
await this.sdk.tokensMeta.loadTokenData(suite.underlying);
|
|
1225
|
+
const underlying = this.sdk.tokensMeta.mustGet(suite.underlying);
|
|
1226
|
+
if (this.sdk.tokensMeta.isKYCUnderlying(underlying)) {
|
|
1227
|
+
const factory = new import_market.SecuritizeKYCFactory(this.sdk, underlying.kycFactory);
|
|
1228
|
+
const tokensToRegister = await factory.getDSTokens();
|
|
1229
|
+
return factory.openCreditAccount(
|
|
1230
|
+
suite.creditManager.address,
|
|
1231
|
+
calls,
|
|
1232
|
+
tokensToRegister
|
|
1233
|
+
);
|
|
1234
|
+
}
|
|
1235
|
+
return suite.creditFacade.openCreditAccount(to, calls, referralCode ?? 0n);
|
|
1251
1236
|
}
|
|
1252
|
-
|
|
1237
|
+
/**
|
|
1238
|
+
* Wrapper that selects between credit facade and KYC factory
|
|
1239
|
+
* @param suite
|
|
1240
|
+
* @param creditAccount
|
|
1241
|
+
* @param calls
|
|
1242
|
+
* @returns
|
|
1243
|
+
*/
|
|
1244
|
+
async multicallTx(suite, creditAccount, calls) {
|
|
1245
|
+
await this.sdk.tokensMeta.loadTokenData(suite.underlying);
|
|
1246
|
+
const underlying = this.sdk.tokensMeta.mustGet(suite.underlying);
|
|
1247
|
+
if (this.sdk.tokensMeta.isKYCUnderlying(underlying)) {
|
|
1248
|
+
const tokensToRegister = [];
|
|
1249
|
+
const factory = new import_market.SecuritizeKYCFactory(this.sdk, underlying.kycFactory);
|
|
1250
|
+
return factory.multicall(creditAccount, calls, tokensToRegister);
|
|
1251
|
+
}
|
|
1252
|
+
return suite.creditFacade.multicall(creditAccount, calls);
|
|
1253
|
+
}
|
|
1254
|
+
/**
|
|
1255
|
+
* Wrapper that selects between credit facade and KYC factory
|
|
1256
|
+
* @param suite
|
|
1257
|
+
* @param creditAccount
|
|
1258
|
+
* @param calls
|
|
1259
|
+
* @param operation
|
|
1260
|
+
* @returns
|
|
1261
|
+
*/
|
|
1262
|
+
async closeCreditAccountTx(suite, creditAccount, calls, operation) {
|
|
1263
|
+
await this.sdk.tokensMeta.loadTokenData(suite.underlying);
|
|
1264
|
+
const underlying = this.sdk.tokensMeta.mustGet(suite.underlying);
|
|
1265
|
+
if (this.sdk.tokensMeta.isKYCUnderlying(underlying)) {
|
|
1266
|
+
throw new Error(
|
|
1267
|
+
"KYC underlying is not supported for close credit account"
|
|
1268
|
+
);
|
|
1269
|
+
}
|
|
1270
|
+
return operation === "close" ? suite.creditFacade.closeCreditAccount(creditAccount, calls) : suite.creditFacade.multicall(creditAccount, calls);
|
|
1271
|
+
}
|
|
1272
|
+
}
|
|
1253
1273
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1254
1274
|
0 && (module.exports = {
|
|
1255
1275
|
AbstractCreditAccountService,
|
|
@@ -76,7 +76,7 @@ class CreditAccountServiceV300 extends import_AbstractCreditAccountsService.Abst
|
|
|
76
76
|
averageQuota
|
|
77
77
|
})
|
|
78
78
|
];
|
|
79
|
-
const tx =
|
|
79
|
+
const tx = await this.multicallTx(cm, creditAccount.creditAccount, calls);
|
|
80
80
|
return { tx, calls, creditFacade: cm.creditFacade };
|
|
81
81
|
}
|
|
82
82
|
/**
|
|
@@ -113,7 +113,12 @@ class CreditAccountServiceV300 extends import_AbstractCreditAccountsService.Abst
|
|
|
113
113
|
(t) => this.prepareWithdrawToken(ca.creditFacade, t.token, import_math.MAX_UINT256, to)
|
|
114
114
|
)
|
|
115
115
|
];
|
|
116
|
-
const tx =
|
|
116
|
+
const tx = await this.closeCreditAccountTx(
|
|
117
|
+
cm,
|
|
118
|
+
ca.creditAccount,
|
|
119
|
+
calls,
|
|
120
|
+
operation
|
|
121
|
+
);
|
|
117
122
|
return { tx, calls, creditFacade: cm.creditFacade };
|
|
118
123
|
}
|
|
119
124
|
/**
|
|
@@ -177,7 +182,7 @@ class CreditAccountServiceV300 extends import_AbstractCreditAccountsService.Abst
|
|
|
177
182
|
),
|
|
178
183
|
...this.prepareUpdateQuotas(ca.creditFacade, { minQuota, averageQuota })
|
|
179
184
|
];
|
|
180
|
-
const tx =
|
|
185
|
+
const tx = await this.multicallTx(cm, ca.creditAccount, calls);
|
|
181
186
|
return { tx, calls, creditFacade: cm.creditFacade };
|
|
182
187
|
}
|
|
183
188
|
async previewWithdrawLlamathenaProportionally({
|
|
@@ -269,7 +274,7 @@ class CreditAccountServiceV300 extends import_AbstractCreditAccountsService.Abst
|
|
|
269
274
|
averageQuota
|
|
270
275
|
})
|
|
271
276
|
];
|
|
272
|
-
const tx =
|
|
277
|
+
const tx = await this.multicallTx(cm, ca.creditAccount, calls);
|
|
273
278
|
return { tx, calls, creditFacade: cm.creditFacade };
|
|
274
279
|
}
|
|
275
280
|
/**
|
|
@@ -65,7 +65,7 @@ class CreditAccountServiceV310 extends import_AbstractCreditAccountsService.Abst
|
|
|
65
65
|
})
|
|
66
66
|
};
|
|
67
67
|
const calls = [...priceUpdatesCalls, addBotCall];
|
|
68
|
-
const tx = targetContract.type === "creditAccount" ?
|
|
68
|
+
const tx = targetContract.type === "creditAccount" ? await this.multicallTx(cm, targetContract.creditAccount, calls) : void 0;
|
|
69
69
|
return { tx, calls, creditFacade: cm.creditFacade };
|
|
70
70
|
}
|
|
71
71
|
/**
|
|
@@ -100,7 +100,7 @@ class CreditAccountServiceV310 extends import_AbstractCreditAccountsService.Abst
|
|
|
100
100
|
averageQuota
|
|
101
101
|
})
|
|
102
102
|
];
|
|
103
|
-
const tx =
|
|
103
|
+
const tx = await this.multicallTx(cm, creditAccount.creditAccount, calls);
|
|
104
104
|
return { tx, calls, creditFacade: cm.creditFacade };
|
|
105
105
|
}
|
|
106
106
|
/**
|
|
@@ -138,7 +138,12 @@ class CreditAccountServiceV310 extends import_AbstractCreditAccountsService.Abst
|
|
|
138
138
|
(t) => this.prepareWithdrawToken(ca.creditFacade, t.token, import_math.MAX_UINT256, to)
|
|
139
139
|
)
|
|
140
140
|
];
|
|
141
|
-
const tx =
|
|
141
|
+
const tx = await this.closeCreditAccountTx(
|
|
142
|
+
cm,
|
|
143
|
+
ca.creditAccount,
|
|
144
|
+
calls,
|
|
145
|
+
operation
|
|
146
|
+
);
|
|
142
147
|
return { tx, calls, creditFacade: cm.creditFacade };
|
|
143
148
|
}
|
|
144
149
|
/**
|
|
@@ -209,7 +214,7 @@ class CreditAccountServiceV310 extends import_AbstractCreditAccountsService.Abst
|
|
|
209
214
|
...claimPath.calls,
|
|
210
215
|
...this.prepareUpdateQuotas(ca.creditFacade, { minQuota, averageQuota })
|
|
211
216
|
];
|
|
212
|
-
const tx =
|
|
217
|
+
const tx = await this.multicallTx(cm, ca.creditAccount, calls);
|
|
213
218
|
return { tx, calls, creditFacade: cm.creditFacade };
|
|
214
219
|
}
|
|
215
220
|
async previewWithdrawLlamathenaProportionally(_) {
|
|
@@ -48,7 +48,7 @@ class ChainContractsRegister {
|
|
|
48
48
|
logger;
|
|
49
49
|
constructor(client, logger) {
|
|
50
50
|
this.client = client;
|
|
51
|
-
this.tokensMeta = new import_TokensMeta.TokensMeta(client);
|
|
51
|
+
this.tokensMeta = new import_TokensMeta.TokensMeta(client, logger);
|
|
52
52
|
this.logger = logger;
|
|
53
53
|
}
|
|
54
54
|
resetContracts() {
|