@gearbox-protocol/sdk 13.6.0-kyc.7 → 13.6.1
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/dev/AccountOpener.js +5 -45
- package/dist/cjs/dev/logSplitterTransport.js +10 -1
- package/dist/cjs/plugins/adapters/abi/actionAbi.js +1 -1
- package/dist/cjs/plugins/adapters/abi/conctructorAbi.js +1 -1
- package/dist/cjs/plugins/adapters/createAdapter.js +1 -1
- package/dist/cjs/plugins/adapters/types.js +1 -1
- package/dist/cjs/plugins/apy/ApyPlugin.js +266 -0
- package/dist/cjs/plugins/apy/apy-cache.js +120 -0
- package/dist/cjs/plugins/apy/apy-parser.js +169 -0
- package/dist/cjs/{sdk/market/kyc/securitize → plugins/apy}/constants.js +6 -3
- package/dist/cjs/{sdk/market/kyc/securitize → plugins/apy}/index.js +14 -6
- package/dist/cjs/{sdk/market/kyc/securitize/types.js → plugins/apy/pool-apy-types.js} +2 -2
- package/dist/cjs/plugins/apy/pool-apy-utils.js +141 -0
- package/dist/cjs/rewards/rewards/extra-apy.js +10 -8
- package/dist/cjs/sdk/GearboxSDK.js +5 -52
- package/dist/cjs/sdk/accounts/AbstractCreditAccountsService.js +16 -324
- package/dist/cjs/sdk/accounts/CreditAccountsServiceV310.js +1 -7
- package/dist/cjs/sdk/base/TokensMeta.js +43 -32
- package/dist/cjs/sdk/base/token-types.js +0 -9
- package/dist/cjs/sdk/chain/chains.js +32 -17
- package/dist/cjs/sdk/constants/address-provider.js +0 -3
- package/dist/cjs/sdk/market/MarketRegister.js +116 -70
- package/dist/cjs/sdk/market/MarketSuite.js +0 -3
- package/dist/cjs/sdk/market/index.js +0 -2
- package/dist/cjs/sdk/market/pool/PoolSuite.js +0 -3
- package/dist/cjs/sdk/market/pool/PoolV310Contract.js +2 -11
- package/dist/cjs/sdk/market/pool/index.js +0 -2
- package/dist/cjs/sdk/market/pricefeeds/PriceFeedsRegister.js +3 -3
- package/dist/cjs/sdk/options.js +1 -7
- package/dist/cjs/sdk/pools/PoolService.js +12 -104
- package/dist/cjs/sdk/utils/viem/index.js +0 -2
- package/dist/cjs/sdk/utils/viem/simulateWithPriceUpdates.js +39 -2
- package/dist/esm/dev/AccountOpener.js +6 -47
- package/dist/esm/dev/logSplitterTransport.js +10 -1
- package/dist/esm/plugins/adapters/abi/actionAbi.js +1 -1
- package/dist/esm/plugins/adapters/abi/conctructorAbi.js +1 -1
- package/dist/esm/plugins/adapters/createAdapter.js +1 -1
- package/dist/esm/plugins/adapters/types.js +1 -1
- package/dist/esm/plugins/apy/ApyPlugin.js +255 -0
- package/dist/esm/plugins/apy/apy-cache.js +86 -0
- package/dist/esm/plugins/apy/apy-parser.js +143 -0
- package/dist/esm/plugins/apy/constants.js +6 -0
- package/dist/esm/plugins/apy/index.js +7 -0
- package/dist/esm/plugins/apy/pool-apy-utils.js +113 -0
- package/dist/esm/rewards/rewards/extra-apy.js +10 -8
- package/dist/esm/sdk/GearboxSDK.js +6 -56
- package/dist/esm/sdk/accounts/AbstractCreditAccountsService.js +17 -328
- package/dist/esm/sdk/accounts/CreditAccountsServiceV310.js +1 -7
- package/dist/esm/sdk/base/TokensMeta.js +45 -32
- package/dist/esm/sdk/base/token-types.js +0 -6
- package/dist/esm/sdk/chain/chains.js +32 -17
- package/dist/esm/sdk/constants/address-provider.js +0 -2
- package/dist/esm/sdk/market/MarketRegister.js +118 -74
- package/dist/esm/sdk/market/MarketSuite.js +0 -3
- package/dist/esm/sdk/market/index.js +0 -1
- package/dist/esm/sdk/market/pool/PoolSuite.js +0 -3
- package/dist/esm/sdk/market/pool/PoolV310Contract.js +2 -11
- package/dist/esm/sdk/market/pool/index.js +0 -1
- package/dist/esm/sdk/market/pricefeeds/PriceFeedsRegister.js +3 -3
- package/dist/esm/sdk/options.js +1 -7
- package/dist/esm/sdk/pools/PoolService.js +13 -109
- package/dist/esm/sdk/utils/viem/index.js +0 -1
- package/dist/esm/sdk/utils/viem/simulateWithPriceUpdates.js +41 -2
- package/dist/types/dev/logSplitterTransport.d.ts +3 -1
- package/dist/types/plugins/adapters/types.d.ts +2 -2
- package/dist/types/plugins/apy/ApyPlugin.d.ts +46 -0
- package/dist/types/plugins/apy/apy-cache.d.ts +28 -0
- package/dist/types/plugins/apy/apy-parser.d.ts +5 -0
- package/dist/types/plugins/apy/constants.d.ts +2 -0
- package/dist/types/plugins/apy/index.d.ts +7 -0
- package/dist/types/plugins/apy/pool-apy-types.d.ts +41 -0
- package/dist/types/plugins/apy/pool-apy-utils.d.ts +73 -0
- package/dist/types/plugins/apy/types.d.ts +37 -0
- package/dist/types/rewards/rewards/api.d.ts +10 -1
- package/dist/types/rewards/rewards/common.d.ts +0 -10
- package/dist/types/rewards/rewards/extra-apy.d.ts +4 -6
- package/dist/types/sdk/GearboxSDK.d.ts +0 -7
- package/dist/types/sdk/accounts/AbstractCreditAccountsService.d.ts +2 -52
- package/dist/types/sdk/accounts/CreditAccountsServiceV310.d.ts +1 -1
- package/dist/types/sdk/accounts/types.d.ts +13 -93
- package/dist/types/sdk/base/TokensMeta.d.ts +3 -14
- package/dist/types/sdk/base/token-types.d.ts +4 -44
- package/dist/types/sdk/base/types.d.ts +11 -116
- package/dist/types/sdk/chain/chains.d.ts +5 -5
- package/dist/types/sdk/constants/address-provider.d.ts +0 -1
- package/dist/types/sdk/market/MarketRegister.d.ts +9 -6
- package/dist/types/sdk/market/MarketSuite.d.ts +0 -2
- package/dist/types/sdk/market/index.d.ts +0 -1
- package/dist/types/sdk/market/oracle/PriceOracleBaseContract.d.ts +2 -3
- package/dist/types/sdk/market/oracle/types.d.ts +10 -3
- package/dist/types/sdk/market/pool/PoolSuite.d.ts +0 -2
- package/dist/types/sdk/market/pool/PoolV310Contract.d.ts +2 -6
- package/dist/types/sdk/market/pool/index.d.ts +0 -1
- package/dist/types/sdk/market/pricefeeds/PriceFeedsRegister.d.ts +1 -1
- package/dist/types/sdk/market/types.d.ts +1 -1
- package/dist/types/sdk/options.d.ts +0 -1
- package/dist/types/sdk/pools/PoolService.d.ts +8 -8
- package/dist/types/sdk/pools/types.d.ts +1 -1
- package/dist/types/sdk/types/state-human.d.ts +0 -2
- package/dist/types/sdk/types/state.d.ts +0 -5
- package/dist/types/sdk/utils/viem/index.d.ts +0 -1
- package/package.json +2 -3
- package/dist/cjs/abi/kyc/iDSRegistryService.js +0 -70
- package/dist/cjs/abi/kyc/iDSToken.js +0 -71
- package/dist/cjs/abi/kyc/iKYCCompressor.js +0 -196
- package/dist/cjs/abi/kyc/iKYCFactory.js +0 -122
- package/dist/cjs/abi/kyc/iKYCUnderlying.js +0 -401
- package/dist/cjs/abi/kyc/iSecuritizeDegenNFT.js +0 -326
- package/dist/cjs/abi/kyc/iSecuritizeKYCFactory.js +0 -319
- package/dist/cjs/plugins/pools-history/Pools7DAgoPlugin.js +0 -108
- package/dist/cjs/plugins/pools-history/index.js +0 -24
- package/dist/cjs/sdk/market/kyc/KYCRegistry.js +0 -269
- package/dist/cjs/sdk/market/kyc/index.js +0 -26
- package/dist/cjs/sdk/market/kyc/securitize/SecuritizeKYCFactory.js +0 -244
- package/dist/cjs/sdk/market/kyc/types.js +0 -34
- package/dist/cjs/sdk/utils/viem/executeDelegatedMulticalls.js +0 -38
- package/dist/esm/abi/kyc/iDSRegistryService.js +0 -46
- package/dist/esm/abi/kyc/iDSToken.js +0 -47
- package/dist/esm/abi/kyc/iKYCCompressor.js +0 -172
- package/dist/esm/abi/kyc/iKYCFactory.js +0 -98
- package/dist/esm/abi/kyc/iKYCUnderlying.js +0 -377
- package/dist/esm/abi/kyc/iSecuritizeDegenNFT.js +0 -302
- package/dist/esm/abi/kyc/iSecuritizeKYCFactory.js +0 -295
- package/dist/esm/plugins/pools-history/Pools7DAgoPlugin.js +0 -90
- package/dist/esm/plugins/pools-history/index.js +0 -2
- package/dist/esm/sdk/market/kyc/KYCRegistry.js +0 -253
- package/dist/esm/sdk/market/kyc/index.js +0 -3
- package/dist/esm/sdk/market/kyc/securitize/SecuritizeKYCFactory.js +0 -220
- package/dist/esm/sdk/market/kyc/securitize/constants.js +0 -4
- package/dist/esm/sdk/market/kyc/securitize/index.js +0 -3
- package/dist/esm/sdk/market/kyc/types.js +0 -9
- package/dist/esm/sdk/utils/viem/executeDelegatedMulticalls.js +0 -14
- package/dist/types/abi/kyc/iDSRegistryService.d.ts +0 -71
- package/dist/types/abi/kyc/iDSToken.d.ts +0 -67
- package/dist/types/abi/kyc/iKYCCompressor.d.ts +0 -228
- package/dist/types/abi/kyc/iKYCFactory.d.ts +0 -139
- package/dist/types/abi/kyc/iKYCUnderlying.d.ts +0 -548
- package/dist/types/abi/kyc/iSecuritizeDegenNFT.d.ts +0 -404
- package/dist/types/abi/kyc/iSecuritizeKYCFactory.d.ts +0 -376
- package/dist/types/plugins/pools-history/Pools7DAgoPlugin.d.ts +0 -20
- package/dist/types/plugins/pools-history/index.d.ts +0 -2
- package/dist/types/plugins/pools-history/types.d.ts +0 -9
- package/dist/types/sdk/market/kyc/KYCRegistry.d.ts +0 -52
- package/dist/types/sdk/market/kyc/index.d.ts +0 -3
- package/dist/types/sdk/market/kyc/securitize/SecuritizeKYCFactory.d.ts +0 -428
- package/dist/types/sdk/market/kyc/securitize/constants.d.ts +0 -1
- package/dist/types/sdk/market/kyc/securitize/index.d.ts +0 -3
- package/dist/types/sdk/market/kyc/securitize/types.d.ts +0 -127
- package/dist/types/sdk/market/kyc/types.d.ts +0 -170
- package/dist/types/sdk/utils/viem/executeDelegatedMulticalls.d.ts +0 -28
- /package/dist/cjs/plugins/{pools-history → apy}/package.json +0 -0
- /package/dist/cjs/plugins/{pools-history → apy}/types.js +0 -0
- /package/dist/esm/plugins/{pools-history → apy}/package.json +0 -0
- /package/dist/esm/plugins/{pools-history/types.js → apy/pool-apy-types.js} +0 -0
- /package/dist/esm/{sdk/market/kyc/securitize → plugins/apy}/types.js +0 -0
|
@@ -16,7 +16,6 @@ import {
|
|
|
16
16
|
VERSION_RANGE_310
|
|
17
17
|
} from "./constants/index.js";
|
|
18
18
|
import { createAddressProvider, hydrateAddressProvider } from "./core/index.js";
|
|
19
|
-
import { KYCRegistry } from "./market/kyc/index.js";
|
|
20
19
|
import { MarketRegister } from "./market/MarketRegister.js";
|
|
21
20
|
import { PriceFeedRegister } from "./market/pricefeeds/index.js";
|
|
22
21
|
import {
|
|
@@ -25,10 +24,7 @@ import {
|
|
|
25
24
|
import { createRouter } from "./router/index.js";
|
|
26
25
|
import { formatTimestamp, TypedObjectUtils, toAddress } from "./utils/index.js";
|
|
27
26
|
import { Hooks } from "./utils/internal/index.js";
|
|
28
|
-
import {
|
|
29
|
-
executeDelegatedMulticalls,
|
|
30
|
-
getLogsSafe
|
|
31
|
-
} from "./utils/viem/index.js";
|
|
27
|
+
import { getLogsSafe } from "./utils/viem/index.js";
|
|
32
28
|
const ERR_NOT_ATTACHED = new Error("Gearbox SDK not attached");
|
|
33
29
|
const STATE_VERSION = 1;
|
|
34
30
|
function createClient(opts, network) {
|
|
@@ -81,7 +77,6 @@ class GearboxSDK extends ChainContractsRegister {
|
|
|
81
77
|
#addressProvider;
|
|
82
78
|
#attachConfig;
|
|
83
79
|
#marketRegister;
|
|
84
|
-
#kyc;
|
|
85
80
|
#priceFeeds;
|
|
86
81
|
/**
|
|
87
82
|
* Gas limit applied to read-only `eth_call` requests.
|
|
@@ -126,7 +121,6 @@ class GearboxSDK extends ChainContractsRegister {
|
|
|
126
121
|
ignoreUpdateablePrices,
|
|
127
122
|
ignoreMarkets,
|
|
128
123
|
marketConfigurators: mcs,
|
|
129
|
-
kycFactories: kfs,
|
|
130
124
|
strictContractTypes,
|
|
131
125
|
gasLimit
|
|
132
126
|
} = options;
|
|
@@ -136,7 +130,6 @@ class GearboxSDK extends ChainContractsRegister {
|
|
|
136
130
|
addressProvider = ADDRESS_PROVIDER_V310;
|
|
137
131
|
}
|
|
138
132
|
const marketConfigurators = mcs ?? TypedObjectUtils.keys(client.chain.defaultMarketConfigurators);
|
|
139
|
-
const kycFactories = kfs ?? client.chain.kycFactories;
|
|
140
133
|
return new GearboxSDK({
|
|
141
134
|
client,
|
|
142
135
|
logger,
|
|
@@ -149,7 +142,6 @@ class GearboxSDK extends ChainContractsRegister {
|
|
|
149
142
|
ignoreUpdateablePrices,
|
|
150
143
|
ignoreMarkets,
|
|
151
144
|
marketConfigurators,
|
|
152
|
-
kycFactories,
|
|
153
145
|
redstone,
|
|
154
146
|
pyth
|
|
155
147
|
});
|
|
@@ -189,7 +181,7 @@ class GearboxSDK extends ChainContractsRegister {
|
|
|
189
181
|
plugin.sdk = this;
|
|
190
182
|
}
|
|
191
183
|
if (options.gasLimit !== null) {
|
|
192
|
-
this.gasLimit = options.gasLimit ||
|
|
184
|
+
this.gasLimit = options.gasLimit || getChain(this.networkType).gasLimit;
|
|
193
185
|
}
|
|
194
186
|
}
|
|
195
187
|
async #attach(opts) {
|
|
@@ -199,7 +191,6 @@ class GearboxSDK extends ChainContractsRegister {
|
|
|
199
191
|
ignoreUpdateablePrices,
|
|
200
192
|
ignoreMarkets,
|
|
201
193
|
marketConfigurators,
|
|
202
|
-
kycFactories,
|
|
203
194
|
redstone,
|
|
204
195
|
pyth
|
|
205
196
|
} = opts;
|
|
@@ -210,7 +201,6 @@ class GearboxSDK extends ChainContractsRegister {
|
|
|
210
201
|
chainId: this.chainId,
|
|
211
202
|
addressProvider,
|
|
212
203
|
marketConfigurators,
|
|
213
|
-
kycFactories,
|
|
214
204
|
blockNumber,
|
|
215
205
|
ignoreMarkets
|
|
216
206
|
},
|
|
@@ -245,34 +235,10 @@ class GearboxSDK extends ChainContractsRegister {
|
|
|
245
235
|
);
|
|
246
236
|
await this.#addressProvider.syncState(this.currentBlock);
|
|
247
237
|
this.#marketRegister = new MarketRegister(this, ignoreMarkets);
|
|
248
|
-
this.#
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
);
|
|
253
|
-
} else {
|
|
254
|
-
const delegated = [
|
|
255
|
-
...this.#marketRegister.getLoadMulticalls(marketConfigurators),
|
|
256
|
-
...this.#kyc.getLoadMulticalls(marketConfigurators, kycFactories)
|
|
257
|
-
];
|
|
258
|
-
let txs = [];
|
|
259
|
-
if (!ignoreUpdateablePrices) {
|
|
260
|
-
const updatables = await this.#priceFeeds.getPartialUpdatablePriceFeeds(
|
|
261
|
-
marketConfigurators
|
|
262
|
-
);
|
|
263
|
-
const updates = await this.#priceFeeds.generatePriceFeedsUpdateTxs(updatables);
|
|
264
|
-
txs = updates.txs;
|
|
265
|
-
}
|
|
266
|
-
this.logger?.debug(
|
|
267
|
-
{ configurators: marketConfigurators },
|
|
268
|
-
`calling getMarkets with ${txs.length} price updates in block ${this.currentBlock}`
|
|
269
|
-
);
|
|
270
|
-
await executeDelegatedMulticalls(this.client, delegated, {
|
|
271
|
-
priceUpdates: txs,
|
|
272
|
-
blockNumber: this.currentBlock,
|
|
273
|
-
gas: this.gasLimit
|
|
274
|
-
});
|
|
275
|
-
}
|
|
238
|
+
await this.#marketRegister.loadMarkets(
|
|
239
|
+
marketConfigurators,
|
|
240
|
+
ignoreUpdateablePrices
|
|
241
|
+
);
|
|
276
242
|
const pluginsList = TypedObjectUtils.entries(this.plugins);
|
|
277
243
|
const pluginResponse = await Promise.allSettled(
|
|
278
244
|
pluginsList.map(([name, plugin]) => {
|
|
@@ -318,15 +284,12 @@ class GearboxSDK extends ChainContractsRegister {
|
|
|
318
284
|
);
|
|
319
285
|
this.#marketRegister = new MarketRegister(this, ignoreMarkets);
|
|
320
286
|
this.#marketRegister.hydrate(state.markets);
|
|
321
|
-
this.#kyc = new KYCRegistry(this);
|
|
322
|
-
this.#kyc.setState(state.kyc);
|
|
323
287
|
this.#attachConfig = {
|
|
324
288
|
...opts,
|
|
325
289
|
addressProvider: this.addressProvider.address,
|
|
326
290
|
marketConfigurators: this.marketRegister.marketConfigurators.map(
|
|
327
291
|
(m) => m.address
|
|
328
292
|
),
|
|
329
|
-
kycFactories: this.kyc.factories.map((f) => f.address),
|
|
330
293
|
blockNumber: this.currentBlock
|
|
331
294
|
};
|
|
332
295
|
for (const [name, plugin] of TypedObjectUtils.entries(this.plugins)) {
|
|
@@ -410,7 +373,6 @@ class GearboxSDK extends ChainContractsRegister {
|
|
|
410
373
|
addressProviderV3: this.addressProvider.stateHuman(raw)
|
|
411
374
|
},
|
|
412
375
|
tokens: this.tokensMeta.values(),
|
|
413
|
-
kyc: this.kyc.stateHuman(raw),
|
|
414
376
|
plugins: Object.fromEntries(
|
|
415
377
|
TypedObjectUtils.entries(this.plugins).map(([name, plugin]) => [
|
|
416
378
|
name,
|
|
@@ -436,7 +398,6 @@ class GearboxSDK extends ChainContractsRegister {
|
|
|
436
398
|
timestamp: this.timestamp,
|
|
437
399
|
addressProvider: this.addressProvider.state,
|
|
438
400
|
markets: this.marketRegister.state,
|
|
439
|
-
kyc: this.kyc.state,
|
|
440
401
|
plugins: Object.fromEntries(
|
|
441
402
|
TypedObjectUtils.entries(this.plugins).map(([name, plugin]) => [
|
|
442
403
|
name,
|
|
@@ -633,17 +594,6 @@ class GearboxSDK extends ChainContractsRegister {
|
|
|
633
594
|
}
|
|
634
595
|
return this.#marketRegister;
|
|
635
596
|
}
|
|
636
|
-
/**
|
|
637
|
-
* KYC register for KYC-wrapped underlying tokens and factories.
|
|
638
|
-
*
|
|
639
|
-
* @throws If the SDK has not been attached or hydrated yet.
|
|
640
|
-
**/
|
|
641
|
-
get kyc() {
|
|
642
|
-
if (this.#kyc === void 0) {
|
|
643
|
-
throw ERR_NOT_ATTACHED;
|
|
644
|
-
}
|
|
645
|
-
return this.#kyc;
|
|
646
|
-
}
|
|
647
597
|
/**
|
|
648
598
|
* Resolves the appropriate router contract for a given credit manager,
|
|
649
599
|
* credit facade, or explicit version range.
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { ierc4626AdapterAbi } from "@gearbox-protocol/integrations-v3";
|
|
2
1
|
import { encodeFunctionData, getContract } from "viem";
|
|
3
2
|
import {
|
|
4
3
|
iBotListV310Abi,
|
|
@@ -9,7 +8,6 @@ import { peripheryCompressorAbi } from "../../abi/compressors/peripheryCompresso
|
|
|
9
8
|
import { rewardsCompressorAbi } from "../../abi/compressors/rewardsCompressor.js";
|
|
10
9
|
import { iWithdrawalCompressorV310Abi } from "../../abi/IWithdrawalCompressorV310.js";
|
|
11
10
|
import { iBaseRewardPoolAbi } from "../../abi/iBaseRewardPool.js";
|
|
12
|
-
import { iKYCFactoryAbi } from "../../abi/kyc/iKYCFactory.js";
|
|
13
11
|
import { SDKConstruct } from "../base/index.js";
|
|
14
12
|
import { chains } from "../chain/chains.js";
|
|
15
13
|
import {
|
|
@@ -26,12 +24,8 @@ import {
|
|
|
26
24
|
import {
|
|
27
25
|
getRawPriceUpdates
|
|
28
26
|
} from "../market/index.js";
|
|
29
|
-
import {
|
|
30
|
-
isKYCFactory,
|
|
31
|
-
KYC_FACTORY_SECURITIZE
|
|
32
|
-
} from "../market/kyc/index.js";
|
|
33
27
|
import { assetsMap } from "../router/index.js";
|
|
34
|
-
import { AddressMap, AddressSet
|
|
28
|
+
import { AddressMap, AddressSet } from "../utils/index.js";
|
|
35
29
|
import { simulateWithPriceUpdates } from "../utils/viem/index.js";
|
|
36
30
|
import {
|
|
37
31
|
extractPriceUpdates,
|
|
@@ -77,40 +71,24 @@ class AbstractCreditAccountService extends SDKConstruct {
|
|
|
77
71
|
} catch (_e) {
|
|
78
72
|
return void 0;
|
|
79
73
|
}
|
|
80
|
-
const marketSuite = this.sdk.marketRegister.findByCreditManager(
|
|
81
|
-
raw.creditManager
|
|
82
|
-
);
|
|
83
|
-
const factory = marketSuite.kycFactory;
|
|
84
|
-
let ca;
|
|
85
|
-
let investor;
|
|
86
74
|
if (raw.success) {
|
|
87
|
-
|
|
88
|
-
investor = await factory?.getInvestor(raw.creditAccount, false);
|
|
89
|
-
} else {
|
|
90
|
-
const { txs: priceUpdateTxs } = await this.getUpdateForAccount(raw);
|
|
91
|
-
[ca, investor] = await simulateWithPriceUpdates(this.client, {
|
|
92
|
-
priceUpdates: priceUpdateTxs,
|
|
93
|
-
contracts: [
|
|
94
|
-
{
|
|
95
|
-
abi: creditAccountCompressorAbi,
|
|
96
|
-
address: this.#compressor,
|
|
97
|
-
functionName: "getCreditAccountData",
|
|
98
|
-
args: [account]
|
|
99
|
-
},
|
|
100
|
-
...factory ? [
|
|
101
|
-
{
|
|
102
|
-
abi: iKYCFactoryAbi,
|
|
103
|
-
address: factory.address,
|
|
104
|
-
functionName: "getInvestor",
|
|
105
|
-
args: [raw.creditAccount]
|
|
106
|
-
}
|
|
107
|
-
] : []
|
|
108
|
-
],
|
|
109
|
-
blockNumber,
|
|
110
|
-
gas: this.sdk.gasLimit
|
|
111
|
-
});
|
|
75
|
+
return raw;
|
|
112
76
|
}
|
|
113
|
-
|
|
77
|
+
const { txs: priceUpdateTxs } = await this.getUpdateForAccount(raw);
|
|
78
|
+
const [cad] = await simulateWithPriceUpdates(this.client, {
|
|
79
|
+
priceUpdates: priceUpdateTxs,
|
|
80
|
+
contracts: [
|
|
81
|
+
{
|
|
82
|
+
abi: creditAccountCompressorAbi,
|
|
83
|
+
address: this.#compressor,
|
|
84
|
+
functionName: "getCreditAccountData",
|
|
85
|
+
args: [account]
|
|
86
|
+
}
|
|
87
|
+
],
|
|
88
|
+
blockNumber,
|
|
89
|
+
gas: this.sdk.gasLimit
|
|
90
|
+
});
|
|
91
|
+
return cad;
|
|
114
92
|
}
|
|
115
93
|
/**
|
|
116
94
|
* {@inheritDoc ICreditAccountsService.getCreditAccounts}
|
|
@@ -166,99 +144,6 @@ class AbstractCreditAccountService extends SDKConstruct {
|
|
|
166
144
|
);
|
|
167
145
|
return allCAs.sort((a, b) => Number(a.healthFactor - b.healthFactor));
|
|
168
146
|
}
|
|
169
|
-
/**
|
|
170
|
-
* {@inheritDoc ICreditAccountsService.getBorrowerCreditAccounts}
|
|
171
|
-
**/
|
|
172
|
-
async getBorrowerCreditAccounts(borrower, options, blockNumber) {
|
|
173
|
-
const {
|
|
174
|
-
creditManager,
|
|
175
|
-
includeZeroDebt = false,
|
|
176
|
-
maxHealthFactor = MAX_UINT256,
|
|
177
|
-
minHealthFactor = 0n,
|
|
178
|
-
ignoreReservePrices = false
|
|
179
|
-
} = options ?? {};
|
|
180
|
-
const { txs: priceUpdateTxs } = await this.sdk.priceFeeds.generatePriceFeedsUpdateTxs(
|
|
181
|
-
ignoreReservePrices ? { main: true } : void 0
|
|
182
|
-
);
|
|
183
|
-
const investorDataList = await this.sdk.kyc.getInvestorData(borrower);
|
|
184
|
-
const kycAccountAddresses = investorDataList.flatMap(
|
|
185
|
-
(d) => d.creditAccounts.map((ca) => ca.creditAccount)
|
|
186
|
-
);
|
|
187
|
-
const cmFilter = creditManager ? {
|
|
188
|
-
configurators: [],
|
|
189
|
-
creditManagers: [creditManager],
|
|
190
|
-
pools: [],
|
|
191
|
-
underlying: ADDRESS_0X0
|
|
192
|
-
} : {
|
|
193
|
-
configurators: this.marketConfigurators,
|
|
194
|
-
creditManagers: [],
|
|
195
|
-
pools: [],
|
|
196
|
-
underlying: ADDRESS_0X0
|
|
197
|
-
};
|
|
198
|
-
const permissiveFilter = {
|
|
199
|
-
owner: borrower,
|
|
200
|
-
includeZeroDebt: true,
|
|
201
|
-
minHealthFactor: 0n,
|
|
202
|
-
maxHealthFactor: MAX_UINT256,
|
|
203
|
-
reverting: false
|
|
204
|
-
};
|
|
205
|
-
const kycContracts = kycAccountAddresses.map(
|
|
206
|
-
(account) => ({
|
|
207
|
-
abi: creditAccountCompressorAbi,
|
|
208
|
-
address: this.#compressor,
|
|
209
|
-
functionName: "getCreditAccountData",
|
|
210
|
-
args: [account]
|
|
211
|
-
})
|
|
212
|
-
);
|
|
213
|
-
const getCreditAccountsContracts = [false, true].map(
|
|
214
|
-
(reverting) => ({
|
|
215
|
-
abi: creditAccountCompressorAbi,
|
|
216
|
-
address: this.#compressor,
|
|
217
|
-
functionName: "getCreditAccounts",
|
|
218
|
-
args: [cmFilter, { ...permissiveFilter, reverting }, 0n]
|
|
219
|
-
})
|
|
220
|
-
);
|
|
221
|
-
const allContracts = [...kycContracts, ...getCreditAccountsContracts];
|
|
222
|
-
const results = await simulateWithPriceUpdates(this.client, {
|
|
223
|
-
priceUpdates: priceUpdateTxs,
|
|
224
|
-
contracts: allContracts,
|
|
225
|
-
blockNumber,
|
|
226
|
-
gas: this.sdk.gasLimit
|
|
227
|
-
});
|
|
228
|
-
const kycResults = results.slice(
|
|
229
|
-
0,
|
|
230
|
-
kycAccountAddresses.length
|
|
231
|
-
);
|
|
232
|
-
const normalResults = results.slice(kycAccountAddresses.length);
|
|
233
|
-
const seen = new AddressSet();
|
|
234
|
-
const allCAs = [];
|
|
235
|
-
for (const ca of kycResults) {
|
|
236
|
-
if (!seen.has(ca.creditAccount)) {
|
|
237
|
-
seen.add(ca.creditAccount);
|
|
238
|
-
allCAs.push({ ...ca, investor: borrower });
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
for (const [accounts] of normalResults) {
|
|
242
|
-
for (const ca of accounts) {
|
|
243
|
-
if (!seen.has(ca.creditAccount)) {
|
|
244
|
-
seen.add(ca.creditAccount);
|
|
245
|
-
allCAs.push({ ...ca, investor: void 0 });
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
const filtered = allCAs.filter((ca) => {
|
|
250
|
-
if (!includeZeroDebt && ca.debt === 0n) return false;
|
|
251
|
-
if (ca.healthFactor < minHealthFactor) return false;
|
|
252
|
-
if (ca.healthFactor > maxHealthFactor) return false;
|
|
253
|
-
if (creditManager && !hexEq(ca.creditManager, creditManager))
|
|
254
|
-
return false;
|
|
255
|
-
return true;
|
|
256
|
-
});
|
|
257
|
-
this.logger?.debug(
|
|
258
|
-
`loaded ${allCAs.length} borrower credit accounts (${kycResults.length} KYC, ${filtered.length} after filter)`
|
|
259
|
-
);
|
|
260
|
-
return filtered.sort((a, b) => Number(a.healthFactor - b.healthFactor));
|
|
261
|
-
}
|
|
262
147
|
/**
|
|
263
148
|
* {@inheritDoc ICreditAccountsService.getRewards}
|
|
264
149
|
**/
|
|
@@ -468,13 +353,6 @@ class AbstractCreditAccountService extends SDKConstruct {
|
|
|
468
353
|
closePath
|
|
469
354
|
}) {
|
|
470
355
|
const cm = this.sdk.marketRegister.findCreditManager(ca.creditManager);
|
|
471
|
-
await this.sdk.tokensMeta.loadTokenData(cm.underlying);
|
|
472
|
-
const underlying = this.sdk.tokensMeta.mustGet(cm.underlying);
|
|
473
|
-
if (this.sdk.tokensMeta.isKYCUnderlying(underlying)) {
|
|
474
|
-
throw new Error(
|
|
475
|
-
"closeCreditAccount is not supported for KYC underlying credit accounts"
|
|
476
|
-
);
|
|
477
|
-
}
|
|
478
356
|
const routerCloseResult = closePath || await this.sdk.routerFor(ca).findBestClosePath({
|
|
479
357
|
creditAccount: ca,
|
|
480
358
|
creditManager: cm.creditManager,
|
|
@@ -580,18 +458,8 @@ class AbstractCreditAccountService extends SDKConstruct {
|
|
|
580
458
|
],
|
|
581
459
|
{}
|
|
582
460
|
) : [];
|
|
583
|
-
const unwrapCalls = collateral && isDecrease ? await this.getKYCUnwrapCalls(
|
|
584
|
-
collateral[0].balance,
|
|
585
|
-
creditAccount.creditManager
|
|
586
|
-
) || [] : [];
|
|
587
|
-
if (addCollateralCalls.length > 0 && unwrapCalls.length === 0 && collateral && collateral?.[0].token !== creditAccount.underlying) {
|
|
588
|
-
throw new Error(
|
|
589
|
-
"Can't use collateral other than underlying for non KYC market"
|
|
590
|
-
);
|
|
591
|
-
}
|
|
592
461
|
const operationCalls = [
|
|
593
462
|
...addCollateralCalls,
|
|
594
|
-
...unwrapCalls,
|
|
595
463
|
this.#prepareChangeDebt(creditAccount.creditFacade, change, isDecrease)
|
|
596
464
|
];
|
|
597
465
|
const calls = await this.prependPriceUpdates(
|
|
@@ -799,30 +667,6 @@ class AbstractCreditAccountService extends SDKConstruct {
|
|
|
799
667
|
const tx = await this.multicallTx(cm, creditAccount.creditAccount, calls);
|
|
800
668
|
return { tx, calls, creditFacade: cm.creditFacade };
|
|
801
669
|
}
|
|
802
|
-
/**
|
|
803
|
-
* {@inheritDoc ICreditAccountsService.getApprovalAddress}
|
|
804
|
-
**/
|
|
805
|
-
async getApprovalAddress(options) {
|
|
806
|
-
const { creditManager } = options;
|
|
807
|
-
const suite = this.sdk.marketRegister.findCreditManager(creditManager);
|
|
808
|
-
const marketSuite = this.sdk.marketRegister.findByPool(suite.pool);
|
|
809
|
-
const factory = marketSuite.kycFactory;
|
|
810
|
-
if (factory) {
|
|
811
|
-
return factory.getApprovalAddress(options);
|
|
812
|
-
}
|
|
813
|
-
return suite.creditManager.address;
|
|
814
|
-
}
|
|
815
|
-
/**
|
|
816
|
-
* {@inheritDoc ICreditAccountsService.getOpenAccountRequirements}
|
|
817
|
-
*/
|
|
818
|
-
async getOpenAccountRequirements(borrower, props) {
|
|
819
|
-
const { creditManager } = props;
|
|
820
|
-
const { kycFactory } = this.sdk.marketRegister.findByCreditManager(creditManager);
|
|
821
|
-
if (!kycFactory) {
|
|
822
|
-
return void 0;
|
|
823
|
-
}
|
|
824
|
-
return kycFactory.getOpenAccountRequirements(borrower);
|
|
825
|
-
}
|
|
826
670
|
/**
|
|
827
671
|
* {@inheritDoc ICreditAccountsService.openCA}
|
|
828
672
|
**/
|
|
@@ -957,131 +801,6 @@ class AbstractCreditAccountService extends SDKConstruct {
|
|
|
957
801
|
return resp;
|
|
958
802
|
}
|
|
959
803
|
/**
|
|
960
|
-
* Returns multicall entries to redeem (unwrap) KYC ERC-4626 vault shares into underlying for the given credit manager.
|
|
961
|
-
* Used when withdrawing debt from a KYC market: redeems adapter vault shares so the underlying can be withdrawn.
|
|
962
|
-
* Only applies when the credit manager's underlying is KYC-gated and has an ERC-4626 adapter configured.
|
|
963
|
-
* @param amount - Number of vault shares (adapter tokens) to redeem
|
|
964
|
-
* @param creditManager - Credit manager address
|
|
965
|
-
* @returns Array of MultiCall to pass to credit facade multicall, or undefined if underlying is not KYC or no adapter is configured
|
|
966
|
-
*/
|
|
967
|
-
async getKYCUnwrapCalls(amount, creditManager) {
|
|
968
|
-
const suite = this.sdk.marketRegister.findCreditManager(creditManager);
|
|
969
|
-
const meta = this.sdk.tokensMeta.mustGet(suite.underlying);
|
|
970
|
-
if (!this.sdk.tokensMeta.isKYCUnderlying(meta)) {
|
|
971
|
-
return void 0;
|
|
972
|
-
}
|
|
973
|
-
const adapter = suite.creditManager.adapters.get(meta.addr);
|
|
974
|
-
const adapterAddress = adapter?.address;
|
|
975
|
-
if (!adapterAddress) {
|
|
976
|
-
return void 0;
|
|
977
|
-
}
|
|
978
|
-
const mc = [
|
|
979
|
-
{
|
|
980
|
-
target: adapterAddress,
|
|
981
|
-
callData: encodeFunctionData({
|
|
982
|
-
abi: ierc4626AdapterAbi,
|
|
983
|
-
functionName: "redeem",
|
|
984
|
-
args: [amount, ADDRESS_0X0, ADDRESS_0X0]
|
|
985
|
-
})
|
|
986
|
-
}
|
|
987
|
-
];
|
|
988
|
-
return mc;
|
|
989
|
-
}
|
|
990
|
-
/**
|
|
991
|
-
* Returns multicall entries to deposit (wrap) underlying into KYC ERC-4626 vault shares for the given credit manager.
|
|
992
|
-
* Used when adding debt on a KYC market: deposits underlying into the adapter vault so shares are minted on the account.
|
|
993
|
-
* Only applies when the credit manager's underlying is KYC-gated and has an ERC-4626 adapter configured.
|
|
994
|
-
* @param amount - Amount of underlying assets to deposit into the vault (in underlying decimals)
|
|
995
|
-
* @param creditManager - Credit manager address
|
|
996
|
-
* @returns Array of MultiCall to pass to credit facade multicall, or undefined if underlying is not KYC or no adapter is configured
|
|
997
|
-
*/
|
|
998
|
-
async getKYCWrapCalls(amount, creditManager) {
|
|
999
|
-
const suite = this.sdk.marketRegister.findCreditManager(creditManager);
|
|
1000
|
-
const meta = this.sdk.tokensMeta.mustGet(suite.underlying);
|
|
1001
|
-
if (!this.sdk.tokensMeta.isKYCUnderlying(meta)) {
|
|
1002
|
-
return void 0;
|
|
1003
|
-
}
|
|
1004
|
-
const adapter = suite.creditManager.adapters.get(meta.addr);
|
|
1005
|
-
const adapterAddress = adapter?.address;
|
|
1006
|
-
if (!adapterAddress) {
|
|
1007
|
-
return void 0;
|
|
1008
|
-
}
|
|
1009
|
-
const mc = [
|
|
1010
|
-
{
|
|
1011
|
-
target: adapterAddress,
|
|
1012
|
-
callData: encodeFunctionData({
|
|
1013
|
-
abi: ierc4626AdapterAbi,
|
|
1014
|
-
functionName: "deposit",
|
|
1015
|
-
args: [amount, ADDRESS_0X0]
|
|
1016
|
-
})
|
|
1017
|
-
}
|
|
1018
|
-
];
|
|
1019
|
-
return mc;
|
|
1020
|
-
}
|
|
1021
|
-
/**
|
|
1022
|
-
* Returns multicall entries to call redeemDiff on the KYC ERC-4626 adapter for the given credit manager.
|
|
1023
|
-
* Redeems the leftover vault shares (e.g. after repaying debt) so the account does not hold excess KYC vault tokens.
|
|
1024
|
-
* Only applies when the credit manager's underlying is KYC-gated and has an ERC-4626 adapter configured.
|
|
1025
|
-
* @param amount - Leftover vault share amount to redeem (in adapter/vault decimals)
|
|
1026
|
-
* @param creditManager - Credit manager address
|
|
1027
|
-
* @returns Array of MultiCall to pass to credit facade multicall, or undefined if underlying is not KYC or no adapter is configured
|
|
1028
|
-
*/
|
|
1029
|
-
async getRedeemDiffCalls(amount, creditManager) {
|
|
1030
|
-
const suite = this.sdk.marketRegister.findCreditManager(creditManager);
|
|
1031
|
-
const meta = this.sdk.tokensMeta.mustGet(suite.underlying);
|
|
1032
|
-
if (!this.sdk.tokensMeta.isKYCUnderlying(meta)) {
|
|
1033
|
-
return void 0;
|
|
1034
|
-
}
|
|
1035
|
-
const adapter = suite.creditManager.adapters.get(meta.addr);
|
|
1036
|
-
const adapterAddress = adapter?.address;
|
|
1037
|
-
if (!adapterAddress) {
|
|
1038
|
-
return void 0;
|
|
1039
|
-
}
|
|
1040
|
-
const mc = [
|
|
1041
|
-
{
|
|
1042
|
-
target: adapterAddress,
|
|
1043
|
-
callData: encodeFunctionData({
|
|
1044
|
-
abi: ierc4626AdapterAbi,
|
|
1045
|
-
functionName: "redeemDiff",
|
|
1046
|
-
args: [amount]
|
|
1047
|
-
})
|
|
1048
|
-
}
|
|
1049
|
-
];
|
|
1050
|
-
return mc;
|
|
1051
|
-
}
|
|
1052
|
-
/**
|
|
1053
|
-
* Returns multicall entries to call depositDiff on the KYC ERC-4626 adapter for the given credit manager.
|
|
1054
|
-
* Deposits the leftover underlying (e.g. after decreasing debt) into the vault so the account does not hold excess underlying.
|
|
1055
|
-
* Only applies when the credit manager's underlying is KYC-gated and has an ERC-4626 adapter configured.
|
|
1056
|
-
* @param amount - Leftover underlying amount to deposit into the vault (in underlying decimals)
|
|
1057
|
-
* @param creditManager - Credit manager address
|
|
1058
|
-
* @returns Array of MultiCall to pass to credit facade multicall, or undefined if underlying is not KYC or no adapter is configured
|
|
1059
|
-
*/
|
|
1060
|
-
async getDepositDiffCalls(amount, creditManager) {
|
|
1061
|
-
const suite = this.sdk.marketRegister.findCreditManager(creditManager);
|
|
1062
|
-
const meta = this.sdk.tokensMeta.mustGet(suite.underlying);
|
|
1063
|
-
if (!this.sdk.tokensMeta.isKYCUnderlying(meta)) {
|
|
1064
|
-
return void 0;
|
|
1065
|
-
}
|
|
1066
|
-
const adapter = suite.creditManager.adapters.get(meta.addr);
|
|
1067
|
-
const adapterAddress = adapter?.address;
|
|
1068
|
-
if (!adapterAddress) {
|
|
1069
|
-
return void 0;
|
|
1070
|
-
}
|
|
1071
|
-
const mc = [
|
|
1072
|
-
{
|
|
1073
|
-
target: adapterAddress,
|
|
1074
|
-
callData: encodeFunctionData({
|
|
1075
|
-
abi: ierc4626AdapterAbi,
|
|
1076
|
-
functionName: "depositDiff",
|
|
1077
|
-
args: [amount]
|
|
1078
|
-
})
|
|
1079
|
-
}
|
|
1080
|
-
];
|
|
1081
|
-
return mc;
|
|
1082
|
-
}
|
|
1083
|
-
/**
|
|
1084
|
-
* Returns raw txs that are needed to update all price feeds so that all credit accounts (possibly from different markets) compute
|
|
1085
804
|
* {@inheritDoc ICreditAccountsService.getOnDemandPriceUpdates}
|
|
1086
805
|
**/
|
|
1087
806
|
async getOnDemandPriceUpdates(account, ignoreReservePrices) {
|
|
@@ -1339,17 +1058,6 @@ class AbstractCreditAccountService extends SDKConstruct {
|
|
|
1339
1058
|
* @returns
|
|
1340
1059
|
*/
|
|
1341
1060
|
async openCreditAccountTx(suite, to, calls, referralCode) {
|
|
1342
|
-
const marketSuite = this.sdk.marketRegister.findByPool(suite.pool);
|
|
1343
|
-
const factory = marketSuite.kycFactory;
|
|
1344
|
-
if (factory && isKYCFactory(factory, KYC_FACTORY_SECURITIZE)) {
|
|
1345
|
-
const tokensToRegister = factory.dsTokens.map(
|
|
1346
|
-
(t) => t.address
|
|
1347
|
-
);
|
|
1348
|
-
return factory.openCreditAccount(suite.creditManager.address, calls, {
|
|
1349
|
-
tokensToRegister,
|
|
1350
|
-
signaturesToCache: []
|
|
1351
|
-
});
|
|
1352
|
-
}
|
|
1353
1061
|
return suite.creditFacade.openCreditAccount(to, calls, referralCode ?? 0n);
|
|
1354
1062
|
}
|
|
1355
1063
|
/**
|
|
@@ -1360,13 +1068,6 @@ class AbstractCreditAccountService extends SDKConstruct {
|
|
|
1360
1068
|
* @returns
|
|
1361
1069
|
*/
|
|
1362
1070
|
async multicallTx(suite, creditAccount, calls) {
|
|
1363
|
-
const marketSuite = this.sdk.marketRegister.findByCreditManager(
|
|
1364
|
-
suite.creditManager.address
|
|
1365
|
-
);
|
|
1366
|
-
const factory = marketSuite.kycFactory;
|
|
1367
|
-
if (factory) {
|
|
1368
|
-
return factory.multicall(creditAccount, calls);
|
|
1369
|
-
}
|
|
1370
1071
|
return suite.creditFacade.multicall(creditAccount, calls);
|
|
1371
1072
|
}
|
|
1372
1073
|
/**
|
|
@@ -1378,21 +1079,9 @@ class AbstractCreditAccountService extends SDKConstruct {
|
|
|
1378
1079
|
* @returns
|
|
1379
1080
|
*/
|
|
1380
1081
|
async closeCreditAccountTx(suite, creditAccount, calls, operation) {
|
|
1381
|
-
const marketSuite = this.sdk.marketRegister.findByCreditManager(
|
|
1382
|
-
suite.creditManager.address
|
|
1383
|
-
);
|
|
1384
|
-
const factory = marketSuite.kycFactory;
|
|
1385
1082
|
if (operation === "close") {
|
|
1386
|
-
if (factory) {
|
|
1387
|
-
throw new Error(
|
|
1388
|
-
"CloseOptions=close is not supported for KYC underlying credit accounts"
|
|
1389
|
-
);
|
|
1390
|
-
}
|
|
1391
1083
|
return suite.creditFacade.closeCreditAccount(creditAccount, calls);
|
|
1392
1084
|
}
|
|
1393
|
-
if (factory) {
|
|
1394
|
-
return factory.multicall(creditAccount, calls);
|
|
1395
|
-
}
|
|
1396
1085
|
return suite.creditFacade.multicall(creditAccount, calls);
|
|
1397
1086
|
}
|
|
1398
1087
|
}
|
|
@@ -90,23 +90,19 @@ class CreditAccountServiceV310 extends AbstractCreditAccountService {
|
|
|
90
90
|
creditAccount: ca,
|
|
91
91
|
permits,
|
|
92
92
|
to,
|
|
93
|
-
tokensToClaim
|
|
94
|
-
calls: wrapCalls = []
|
|
93
|
+
tokensToClaim
|
|
95
94
|
}) {
|
|
96
95
|
const cm = this.sdk.marketRegister.findCreditManager(ca.creditManager);
|
|
97
96
|
const addCollateral = collateralAssets.filter((a) => a.balance > 0);
|
|
98
97
|
const router = this.sdk.routerFor(ca);
|
|
99
|
-
const unwrapCalls = await this.getRedeemDiffCalls(1n, ca.creditManager) ?? [];
|
|
100
98
|
const claimPath = await router.findClaimAllRewards({
|
|
101
99
|
tokensToClaim,
|
|
102
100
|
creditAccount: ca
|
|
103
101
|
});
|
|
104
102
|
const operationCalls = [
|
|
105
103
|
...this.prepareAddCollateral(ca.creditFacade, addCollateral, permits),
|
|
106
|
-
...wrapCalls,
|
|
107
104
|
...this.prepareDisableQuotas(ca),
|
|
108
105
|
...this.prepareDecreaseDebt(ca),
|
|
109
|
-
...unwrapCalls,
|
|
110
106
|
...claimPath.calls,
|
|
111
107
|
...assetsToWithdraw.map(
|
|
112
108
|
(t) => this.prepareWithdrawToken(ca.creditFacade, t.token, MAX_UINT256, to)
|
|
@@ -138,12 +134,10 @@ class CreditAccountServiceV310 extends AbstractCreditAccountService {
|
|
|
138
134
|
tokensToClaim,
|
|
139
135
|
creditAccount: ca
|
|
140
136
|
});
|
|
141
|
-
const wrapCalls = await this.getDepositDiffCalls(1n, ca.creditManager) ?? [];
|
|
142
137
|
const addCollateral = collateralAssets.filter((a) => a.balance > 0);
|
|
143
138
|
const operationCalls = [
|
|
144
139
|
...this.prepareAddCollateral(ca.creditFacade, addCollateral, permits),
|
|
145
140
|
...claimPath.calls,
|
|
146
|
-
...wrapCalls,
|
|
147
141
|
...assetsToWithdraw.map(
|
|
148
142
|
(t) => this.prepareWithdrawToken(ca.creditFacade, t.token, MAX_UINT256, to)
|
|
149
143
|
)
|