@gearbox-protocol/sdk 3.1.3-next.1 → 3.2.0

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.
Files changed (65) hide show
  1. package/dist/cjs/abi/compressors.js +527 -1133
  2. package/dist/cjs/adapters/abi/adapters.js +0 -123
  3. package/dist/cjs/adapters/abi/iBalancerV3RouterAdapter.js +153 -0
  4. package/dist/cjs/adapters/abi/index.js +3 -1
  5. package/dist/cjs/dev/setLTZero.js +0 -7
  6. package/dist/cjs/sdk/accounts/CreditAccountsService.js +30 -45
  7. package/dist/cjs/sdk/chain/chains.js +14 -2
  8. package/dist/cjs/sdk/constants/address-provider.js +18 -11
  9. package/dist/cjs/sdk/constants/addresses.js +8 -4
  10. package/dist/cjs/sdk/constants/networks.js +11 -4
  11. package/dist/cjs/sdk/market/MarketSuite.js +1 -1
  12. package/dist/cjs/sdk/market/credit/CreditFacadeV300Contract.js +5 -1
  13. package/dist/cjs/sdk/market/credit/CreditFacadeV310Contract.js +5 -1
  14. package/dist/cjs/sdk/market/oracle/PriceOracleBaseContract.js +5 -6
  15. package/dist/cjs/sdk/market/pool/PoolSuite.js +1 -1
  16. package/dist/cjs/sdk/market/pricefeeds/PriceFeedsRegister.js +4 -4
  17. package/dist/cjs/sdk/router/RouterV300Contract.js +2 -1
  18. package/dist/cjs/sdk/sdk-gov-legacy/contracts/contracts.js +74 -37
  19. package/dist/cjs/sdk/sdk-gov-legacy/tokens/quoted.js +2 -1
  20. package/dist/cjs/sdk/sdk-gov-legacy/tokens/token.js +4 -2
  21. package/dist/cjs/sdk/sdk-gov-legacy/tokens/tokenData.js +2 -1
  22. package/dist/cjs/sdk/sdk-legacy/core/creditAccount.js +1 -3
  23. package/dist/cjs/sdk/sdk-legacy/core/endpoint.js +2 -1
  24. package/dist/esm/abi/compressors.js +522 -1133
  25. package/dist/esm/adapters/abi/adapters.js +0 -120
  26. package/dist/esm/adapters/abi/iBalancerV3RouterAdapter.js +129 -0
  27. package/dist/esm/adapters/abi/index.js +1 -0
  28. package/dist/esm/dev/setLTZero.js +0 -7
  29. package/dist/esm/sdk/accounts/CreditAccountsService.js +30 -45
  30. package/dist/esm/sdk/chain/chains.js +16 -3
  31. package/dist/esm/sdk/constants/address-provider.js +16 -11
  32. package/dist/esm/sdk/constants/addresses.js +8 -4
  33. package/dist/esm/sdk/constants/networks.js +11 -4
  34. package/dist/esm/sdk/market/MarketSuite.js +1 -1
  35. package/dist/esm/sdk/market/credit/CreditFacadeV300Contract.js +5 -1
  36. package/dist/esm/sdk/market/credit/CreditFacadeV310Contract.js +5 -1
  37. package/dist/esm/sdk/market/oracle/PriceOracleBaseContract.js +5 -6
  38. package/dist/esm/sdk/market/pool/PoolSuite.js +1 -1
  39. package/dist/esm/sdk/market/pricefeeds/PriceFeedsRegister.js +6 -9
  40. package/dist/esm/sdk/router/RouterV300Contract.js +2 -1
  41. package/dist/esm/sdk/sdk-gov-legacy/contracts/contracts.js +74 -37
  42. package/dist/esm/sdk/sdk-gov-legacy/tokens/quoted.js +2 -1
  43. package/dist/esm/sdk/sdk-gov-legacy/tokens/token.js +4 -2
  44. package/dist/esm/sdk/sdk-gov-legacy/tokens/tokenData.js +2 -1
  45. package/dist/esm/sdk/sdk-legacy/core/creditAccount.js +1 -3
  46. package/dist/esm/sdk/sdk-legacy/core/endpoint.js +2 -1
  47. package/dist/types/abi/compressors.d.ts +1106 -1734
  48. package/dist/types/adapters/BalancerV3RouterAdapterContract.d.ts +104 -62
  49. package/dist/types/adapters/abi/adapters.d.ts +0 -213
  50. package/dist/types/adapters/abi/iBalancerV3RouterAdapter.d.ts +230 -0
  51. package/dist/types/adapters/abi/index.d.ts +1 -0
  52. package/dist/types/sdk/accounts/CreditAccountsService.d.ts +3 -3
  53. package/dist/types/sdk/accounts/types.d.ts +2 -15
  54. package/dist/types/sdk/base/types.d.ts +6 -6
  55. package/dist/types/sdk/chain/chains.d.ts +2 -2
  56. package/dist/types/sdk/constants/address-provider.d.ts +12 -10
  57. package/dist/types/sdk/market/oracle/PriceOracleBaseContract.d.ts +85 -425
  58. package/dist/types/sdk/market/pool/PoolQuotaKeeperV300Contract.d.ts +2 -2
  59. package/dist/types/sdk/market/pool/PoolQuotaKeeperV310Contract.d.ts +2 -2
  60. package/dist/types/sdk/market/pool/createPoolQuotaKeeper.d.ts +2 -2
  61. package/dist/types/sdk/types/state-human.d.ts +3 -1
  62. package/package.json +1 -1
  63. package/dist/cjs/sdk/accounts/utils.js +0 -38
  64. package/dist/esm/sdk/accounts/utils.js +0 -14
  65. package/dist/types/sdk/accounts/utils.d.ts +0 -2
@@ -19,9 +19,6 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
19
19
  var adapters_exports = {};
20
20
  __export(adapters_exports, {
21
21
  iBalancerV2VaultAdapterAbi: () => iBalancerV2VaultAdapterAbi,
22
- iBalancerV3RouterAdapterAbi: () => iBalancerV3RouterAdapterAbi,
23
- iBalancerV3RouterAdapterEventsAbi: () => iBalancerV3RouterAdapterEventsAbi,
24
- iBalancerV3RouterAdapterExceptionsAbi: () => iBalancerV3RouterAdapterExceptionsAbi,
25
22
  iCamelotV3AdapterAbi: () => iCamelotV3AdapterAbi,
26
23
  iConvexV1BaseRewardPoolAdapterAbi: () => iConvexV1BaseRewardPoolAdapterAbi,
27
24
  iConvexV1BoosterAdapterAbi: () => iConvexV1BoosterAdapterAbi,
@@ -337,123 +334,6 @@ const iBalancerV2VaultAdapterAbi = [
337
334
  },
338
335
  { type: "error", inputs: [], name: "PoolNotSupportedException" }
339
336
  ];
340
- const iBalancerV3RouterAdapterAbi = [
341
- {
342
- type: "function",
343
- inputs: [],
344
- name: "contractType",
345
- outputs: [{ name: "", internalType: "bytes32", type: "bytes32" }],
346
- stateMutability: "view"
347
- },
348
- {
349
- type: "function",
350
- inputs: [],
351
- name: "creditManager",
352
- outputs: [{ name: "", internalType: "address", type: "address" }],
353
- stateMutability: "view"
354
- },
355
- {
356
- type: "function",
357
- inputs: [],
358
- name: "getAllowedPools",
359
- outputs: [{ name: "pools", internalType: "address[]", type: "address[]" }],
360
- stateMutability: "view"
361
- },
362
- {
363
- type: "function",
364
- inputs: [{ name: "pool", internalType: "address", type: "address" }],
365
- name: "isPoolAllowed",
366
- outputs: [{ name: "", internalType: "bool", type: "bool" }],
367
- stateMutability: "view"
368
- },
369
- {
370
- type: "function",
371
- inputs: [],
372
- name: "serialize",
373
- outputs: [{ name: "serializedData", internalType: "bytes", type: "bytes" }],
374
- stateMutability: "view"
375
- },
376
- {
377
- type: "function",
378
- inputs: [
379
- { name: "pools", internalType: "address[]", type: "address[]" },
380
- { name: "statuses", internalType: "bool[]", type: "bool[]" }
381
- ],
382
- name: "setPoolStatusBatch",
383
- outputs: [],
384
- stateMutability: "nonpayable"
385
- },
386
- {
387
- type: "function",
388
- inputs: [
389
- { name: "pool", internalType: "address", type: "address" },
390
- { name: "tokenIn", internalType: "contract IERC20", type: "address" },
391
- { name: "tokenOut", internalType: "contract IERC20", type: "address" },
392
- { name: "leftoverAmount", internalType: "uint256", type: "uint256" },
393
- { name: "rateMinRAY", internalType: "uint256", type: "uint256" },
394
- { name: "deadline", internalType: "uint256", type: "uint256" }
395
- ],
396
- name: "swapSingleTokenDiffIn",
397
- outputs: [{ name: "", internalType: "bool", type: "bool" }],
398
- stateMutability: "nonpayable"
399
- },
400
- {
401
- type: "function",
402
- inputs: [
403
- { name: "pool", internalType: "address", type: "address" },
404
- { name: "tokenIn", internalType: "contract IERC20", type: "address" },
405
- { name: "tokenOut", internalType: "contract IERC20", type: "address" },
406
- { name: "exactAmountIn", internalType: "uint256", type: "uint256" },
407
- { name: "minAmountOut", internalType: "uint256", type: "uint256" },
408
- { name: "deadline", internalType: "uint256", type: "uint256" },
409
- { name: "wethIsEth", internalType: "bool", type: "bool" },
410
- { name: "userData", internalType: "bytes", type: "bytes" }
411
- ],
412
- name: "swapSingleTokenExactIn",
413
- outputs: [{ name: "", internalType: "bool", type: "bool" }],
414
- stateMutability: "nonpayable"
415
- },
416
- {
417
- type: "function",
418
- inputs: [],
419
- name: "targetContract",
420
- outputs: [{ name: "", internalType: "address", type: "address" }],
421
- stateMutability: "view"
422
- },
423
- {
424
- type: "function",
425
- inputs: [],
426
- name: "version",
427
- outputs: [{ name: "", internalType: "uint256", type: "uint256" }],
428
- stateMutability: "view"
429
- },
430
- {
431
- type: "event",
432
- anonymous: false,
433
- inputs: [
434
- { name: "pool", internalType: "address", type: "address", indexed: true },
435
- { name: "allowed", internalType: "bool", type: "bool", indexed: false }
436
- ],
437
- name: "SetPoolStatus"
438
- },
439
- { type: "error", inputs: [], name: "InvalidLengthException" },
440
- { type: "error", inputs: [], name: "InvalidPoolException" }
441
- ];
442
- const iBalancerV3RouterAdapterEventsAbi = [
443
- {
444
- type: "event",
445
- anonymous: false,
446
- inputs: [
447
- { name: "pool", internalType: "address", type: "address", indexed: true },
448
- { name: "allowed", internalType: "bool", type: "bool", indexed: false }
449
- ],
450
- name: "SetPoolStatus"
451
- }
452
- ];
453
- const iBalancerV3RouterAdapterExceptionsAbi = [
454
- { type: "error", inputs: [], name: "InvalidLengthException" },
455
- { type: "error", inputs: [], name: "InvalidPoolException" }
456
- ];
457
337
  const iCamelotV3AdapterAbi = [
458
338
  {
459
339
  type: "function",
@@ -4366,9 +4246,6 @@ const iwstEthv1AdapterAbi = [
4366
4246
  // Annotate the CommonJS export names for ESM import in node:
4367
4247
  0 && (module.exports = {
4368
4248
  iBalancerV2VaultAdapterAbi,
4369
- iBalancerV3RouterAdapterAbi,
4370
- iBalancerV3RouterAdapterEventsAbi,
4371
- iBalancerV3RouterAdapterExceptionsAbi,
4372
4249
  iCamelotV3AdapterAbi,
4373
4250
  iConvexV1BaseRewardPoolAdapterAbi,
4374
4251
  iConvexV1BoosterAdapterAbi,
@@ -0,0 +1,153 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var iBalancerV3RouterAdapter_exports = {};
20
+ __export(iBalancerV3RouterAdapter_exports, {
21
+ iBalancerV3RouterAdapterAbi: () => iBalancerV3RouterAdapterAbi
22
+ });
23
+ module.exports = __toCommonJS(iBalancerV3RouterAdapter_exports);
24
+ const iBalancerV3RouterAdapterAbi = [
25
+ {
26
+ type: "constructor",
27
+ inputs: [
28
+ { name: "_creditManager", type: "address", internalType: "address" },
29
+ { name: "_router", type: "address", internalType: "address" }
30
+ ],
31
+ stateMutability: "nonpayable"
32
+ },
33
+ {
34
+ type: "function",
35
+ name: "_gearboxAdapterType",
36
+ inputs: [],
37
+ outputs: [{ name: "", type: "uint8", internalType: "enum AdapterType" }],
38
+ stateMutability: "view"
39
+ },
40
+ {
41
+ type: "function",
42
+ name: "_gearboxAdapterVersion",
43
+ inputs: [],
44
+ outputs: [{ name: "", type: "uint16", internalType: "uint16" }],
45
+ stateMutability: "view"
46
+ },
47
+ {
48
+ type: "function",
49
+ name: "acl",
50
+ inputs: [],
51
+ outputs: [{ name: "", type: "address", internalType: "address" }],
52
+ stateMutability: "view"
53
+ },
54
+ {
55
+ type: "function",
56
+ name: "addressProvider",
57
+ inputs: [],
58
+ outputs: [{ name: "", type: "address", internalType: "address" }],
59
+ stateMutability: "view"
60
+ },
61
+ {
62
+ type: "function",
63
+ name: "creditManager",
64
+ inputs: [],
65
+ outputs: [{ name: "", type: "address", internalType: "address" }],
66
+ stateMutability: "view"
67
+ },
68
+ {
69
+ type: "function",
70
+ name: "getAllowedPools",
71
+ inputs: [],
72
+ outputs: [{ name: "pools", type: "address[]", internalType: "address[]" }],
73
+ stateMutability: "view"
74
+ },
75
+ {
76
+ type: "function",
77
+ name: "isPoolAllowed",
78
+ inputs: [{ name: "pool", type: "address", internalType: "address" }],
79
+ outputs: [{ name: "", type: "bool", internalType: "bool" }],
80
+ stateMutability: "view"
81
+ },
82
+ {
83
+ type: "function",
84
+ name: "setPoolStatusBatch",
85
+ inputs: [
86
+ { name: "pools", type: "address[]", internalType: "address[]" },
87
+ { name: "statuses", type: "bool[]", internalType: "bool[]" }
88
+ ],
89
+ outputs: [],
90
+ stateMutability: "nonpayable"
91
+ },
92
+ {
93
+ type: "function",
94
+ name: "swapSingleTokenDiffIn",
95
+ inputs: [
96
+ { name: "pool", type: "address", internalType: "address" },
97
+ { name: "tokenIn", type: "address", internalType: "contract IERC20" },
98
+ { name: "tokenOut", type: "address", internalType: "contract IERC20" },
99
+ { name: "leftoverAmount", type: "uint256", internalType: "uint256" },
100
+ { name: "rateMinRAY", type: "uint256", internalType: "uint256" },
101
+ { name: "deadline", type: "uint256", internalType: "uint256" }
102
+ ],
103
+ outputs: [
104
+ { name: "tokensToEnable", type: "uint256", internalType: "uint256" },
105
+ { name: "tokensToDisable", type: "uint256", internalType: "uint256" }
106
+ ],
107
+ stateMutability: "nonpayable"
108
+ },
109
+ {
110
+ type: "function",
111
+ name: "swapSingleTokenExactIn",
112
+ inputs: [
113
+ { name: "pool", type: "address", internalType: "address" },
114
+ { name: "tokenIn", type: "address", internalType: "contract IERC20" },
115
+ { name: "tokenOut", type: "address", internalType: "contract IERC20" },
116
+ { name: "exactAmountIn", type: "uint256", internalType: "uint256" },
117
+ { name: "minAmountOut", type: "uint256", internalType: "uint256" },
118
+ { name: "deadline", type: "uint256", internalType: "uint256" },
119
+ { name: "", type: "bool", internalType: "bool" },
120
+ { name: "", type: "bytes", internalType: "bytes" }
121
+ ],
122
+ outputs: [
123
+ { name: "tokensToEnable", type: "uint256", internalType: "uint256" },
124
+ { name: "tokensToDisable", type: "uint256", internalType: "uint256" }
125
+ ],
126
+ stateMutability: "nonpayable"
127
+ },
128
+ {
129
+ type: "function",
130
+ name: "targetContract",
131
+ inputs: [],
132
+ outputs: [{ name: "", type: "address", internalType: "address" }],
133
+ stateMutability: "view"
134
+ },
135
+ {
136
+ type: "event",
137
+ name: "SetPoolStatus",
138
+ inputs: [
139
+ { name: "pool", type: "address", indexed: true, internalType: "address" },
140
+ { name: "allowed", type: "bool", indexed: false, internalType: "bool" }
141
+ ],
142
+ anonymous: false
143
+ },
144
+ { type: "error", name: "CallerNotConfiguratorException", inputs: [] },
145
+ { type: "error", name: "CallerNotCreditFacadeException", inputs: [] },
146
+ { type: "error", name: "InvalidLengthException", inputs: [] },
147
+ { type: "error", name: "InvalidPoolException", inputs: [] },
148
+ { type: "error", name: "ZeroAddressException", inputs: [] }
149
+ ];
150
+ // Annotate the CommonJS export names for ESM import in node:
151
+ 0 && (module.exports = {
152
+ iBalancerV3RouterAdapterAbi
153
+ });
@@ -16,7 +16,9 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
16
16
  var abi_exports = {};
17
17
  module.exports = __toCommonJS(abi_exports);
18
18
  __reExport(abi_exports, require("./adapters.js"), module.exports);
19
+ __reExport(abi_exports, require("./iBalancerV3RouterAdapter.js"), module.exports);
19
20
  // Annotate the CommonJS export names for ESM import in node:
20
21
  0 && (module.exports = {
21
- ...require("./adapters.js")
22
+ ...require("./adapters.js"),
23
+ ...require("./iBalancerV3RouterAdapter.js")
22
24
  });
@@ -110,13 +110,6 @@ async function setLTZero(anvil, cm, logger) {
110
110
  address: cm.creditConfigurator
111
111
  });
112
112
  await anvil.stopImpersonatingAccount({ address: configuratorAddr });
113
- const lt = await anvil.readContract({
114
- address: cm.baseParams.addr,
115
- abi: import_v300.iCreditManagerV300Abi,
116
- functionName: "liquidationThresholds",
117
- args: [cm.underlying]
118
- });
119
- logger?.debug(`[${cm.name}] underlying lt: ${lt}`);
120
113
  }
121
114
  // Annotate the CommonJS export names for ESM import in node:
122
115
  0 && (module.exports = {
@@ -32,7 +32,6 @@ var import_router = require("../router/index.js");
32
32
  var import_sdk_gov_legacy = require("../sdk-gov-legacy/index.js");
33
33
  var import_utils = require("../utils/index.js");
34
34
  var import_viem2 = require("../utils/viem/index.js");
35
- var import_utils2 = require("./utils.js");
36
35
  class CreditAccountsService extends import_base.SDKConstruct {
37
36
  #compressor;
38
37
  #batchSize;
@@ -44,9 +43,6 @@ class CreditAccountsService extends import_base.SDKConstruct {
44
43
  );
45
44
  this.#batchSize = options?.batchSize;
46
45
  this.#logger = (0, import_utils.childLogger)("CreditAccountsService", sdk.logger);
47
- this.#logger?.debug(
48
- `credit account compressor address: ${this.#compressor}`
49
- );
50
46
  }
51
47
  /**
52
48
  * Returns single credit account data, or undefined if it's not found
@@ -95,21 +91,21 @@ class CreditAccountsService extends import_base.SDKConstruct {
95
91
  * TODO: do we want to expose pagination?
96
92
  * TODO: do we want to expose "reverting"?
97
93
  * TODO: do we want to expose MarketFilter in any way? If so, we need to check that the MarketFilter is compatibled with attached markets?
98
- * @param options
94
+ * @param args
99
95
  * @param blockNumber
100
96
  * @returns returned credit accounts are sorted by health factor in ascending order
101
97
  */
102
- async getCreditAccounts(options, blockNumber) {
98
+ async getCreditAccounts(args, blockNumber) {
103
99
  const {
104
100
  creditManager,
105
101
  includeZeroDebt = false,
106
- maxHealthFactor = import_constants.MAX_UINT256,
107
- minHealthFactor = 0n,
102
+ maxHealthFactor = 65535,
103
+ // TODO: this will change to bigint
104
+ minHealthFactor = 0,
108
105
  owner = import_constants.ADDRESS_0X0
109
- } = options ?? {};
106
+ } = args ?? {};
110
107
  const arg0 = creditManager ?? {
111
108
  configurators: this.marketConfigurators,
112
- creditManagers: [],
113
109
  pools: [],
114
110
  underlying: import_constants.ADDRESS_0X0
115
111
  };
@@ -117,8 +113,7 @@ class CreditAccountsService extends import_base.SDKConstruct {
117
113
  owner,
118
114
  includeZeroDebt,
119
115
  minHealthFactor,
120
- maxHealthFactor,
121
- reverting: false
116
+ maxHealthFactor
122
117
  };
123
118
  const { txs: priceUpdateTxs } = await this.sdk.priceFeeds.generatePriceFeedsUpdateTxs();
124
119
  const allCAs = [];
@@ -723,41 +718,31 @@ class CreditAccountsService extends import_base.SDKConstruct {
723
718
  * @returns
724
719
  */
725
720
  async #getCreditAccounts(args, priceUpdateTxs, blockNumber) {
726
- this.#logger?.debug(
727
- { args: (0, import_utils2.stringifyGetCreditAccountsArgs)(args) },
728
- "getting credit accounts"
729
- );
730
- let resp;
731
721
  if (priceUpdateTxs?.length) {
732
- [resp] = await (0, import_viem2.simulateWithPriceUpdates)(this.provider.publicClient, {
733
- priceUpdates: priceUpdateTxs,
734
- contracts: [
735
- {
736
- abi: import_compressors.iCreditAccountCompressorAbi,
737
- address: this.#compressor,
738
- functionName: "getCreditAccounts",
739
- args
740
- }
741
- ],
742
- blockNumber
743
- });
744
- } else {
745
- resp = await this.provider.publicClient.readContract({
746
- abi: import_compressors.iCreditAccountCompressorAbi,
747
- address: this.#compressor,
748
- functionName: "getCreditAccounts",
749
- args,
750
- blockNumber
751
- });
722
+ const [resp] = await (0, import_viem2.simulateWithPriceUpdates)(
723
+ this.provider.publicClient,
724
+ {
725
+ priceUpdates: priceUpdateTxs,
726
+ contracts: [
727
+ {
728
+ abi: import_compressors.iCreditAccountCompressorAbi,
729
+ address: this.#compressor,
730
+ functionName: "getCreditAccounts",
731
+ args
732
+ }
733
+ ],
734
+ blockNumber
735
+ }
736
+ );
737
+ return resp;
752
738
  }
753
- this.#logger?.debug(
754
- {
755
- accounts: resp[0]?.length ?? 0,
756
- nextOffset: Number(resp[1])
757
- },
758
- "got credit accounts"
759
- );
760
- return resp;
739
+ return this.provider.publicClient.readContract({
740
+ abi: import_compressors.iCreditAccountCompressorAbi,
741
+ address: this.#compressor,
742
+ functionName: "getCreditAccounts",
743
+ args,
744
+ blockNumber
745
+ });
761
746
  }
762
747
  /**
763
748
  * Returns raw txs that are needed to update all price feeds so that all credit accounts (possibly from different markets) compute
@@ -41,7 +41,8 @@ const SUPPORTED_NETWORKS = [
41
41
  "Monad",
42
42
  "Berachain",
43
43
  "Avalanche",
44
- "BNB"
44
+ "BNB",
45
+ "WorldChain"
45
46
  ];
46
47
  const NetworkType = import_zod.z.enum(SUPPORTED_NETWORKS);
47
48
  function withPublicNode(chain, subdomain) {
@@ -209,7 +210,18 @@ const chains = {
209
210
  }
210
211
  },
211
212
  "bsc-rpc"
212
- )
213
+ ),
214
+ WorldChain: (0, import_viem.defineChain)({
215
+ ...import_chains.worldchain,
216
+ network: "WorldChain",
217
+ defaultMarketConfigurators: {},
218
+ isPublic: false,
219
+ wellKnownToken: {
220
+ address: "0x79a02482a880bce3f13e09da970dc34db4cd24d1",
221
+ symbol: "USDC.e"
222
+ }
223
+ // TODO: has no block explorer API
224
+ })
213
225
  };
214
226
  function getChain(chainIdOrNetworkType) {
215
227
  const network = typeof chainIdOrNetworkType === "string" ? chainIdOrNetworkType : getNetworkType(Number(chainIdOrNetworkType));
@@ -22,6 +22,7 @@ __export(address_provider_exports, {
22
22
  ADDRESS_PROVIDER_V310: () => ADDRESS_PROVIDER_V310,
23
23
  AP_ACCOUNT_FACTORY: () => AP_ACCOUNT_FACTORY,
24
24
  AP_ACL: () => AP_ACL,
25
+ AP_ADAPTER_COMPRESSOR: () => AP_ADAPTER_COMPRESSOR,
25
26
  AP_BOT_LIST: () => AP_BOT_LIST,
26
27
  AP_BYTECODE_REPOSITORY: () => AP_BYTECODE_REPOSITORY,
27
28
  AP_CONTRACTS_REGISTER: () => AP_CONTRACTS_REGISTER,
@@ -41,6 +42,7 @@ __export(address_provider_exports, {
41
42
  AP_MARKET_CONFIGURATOR: () => AP_MARKET_CONFIGURATOR,
42
43
  AP_PARTIAL_LIQUIDATION_BOT: () => AP_PARTIAL_LIQUIDATION_BOT,
43
44
  AP_PERIPHERY_COMPRESSOR: () => AP_PERIPHERY_COMPRESSOR,
45
+ AP_POOL_COMPRESSOR: () => AP_POOL_COMPRESSOR,
44
46
  AP_PRICE_FEED_COMPRESSOR: () => AP_PRICE_FEED_COMPRESSOR,
45
47
  AP_PRICE_ORACLE: () => AP_PRICE_ORACLE,
46
48
  AP_REWARDS_COMPRESSOR: () => AP_REWARDS_COMPRESSOR,
@@ -58,30 +60,32 @@ var import_addresses = require("./addresses.js");
58
60
  const NO_VERSION = 0;
59
61
  const AP_ACCOUNT_FACTORY = "ACCOUNT_FACTORY";
60
62
  const AP_ACL = "ACL";
63
+ const AP_ADAPTER_COMPRESSOR = "ADAPTER_COMPRESSOR";
61
64
  const AP_BOT_LIST = "BOT_LIST";
62
65
  const AP_BYTECODE_REPOSITORY = "BYTECODE_REPOSITORY";
63
66
  const AP_CONTRACTS_REGISTER = "CONTRACTS_REGISTER";
64
67
  const AP_CONTROLLER_TIMELOCK = "CONTROLLER_TIMELOCK";
65
- const AP_CREDIT_ACCOUNT_COMPRESSOR = "GLOBAL::ACCOUNT_COMPRESSOR";
66
- const AP_CREDIT_SUITE_COMPRESSOR = "GLOBAL::CREDIT_SUITE_COMPRESSOR";
68
+ const AP_CREDIT_ACCOUNT_COMPRESSOR = "CREDIT_ACCOUNT_COMPRESSOR";
69
+ const AP_CREDIT_SUITE_COMPRESSOR = "CREDIT_SUITE_COMPRESSOR";
67
70
  const AP_DATA_COMPRESSOR = "DATA_COMPRESSOR";
68
71
  const AP_DELEVERAGE_BOT_HV = "DELEVERAGE_BOT_HV";
69
72
  const AP_DELEVERAGE_BOT_LV = "DELEVERAGE_BOT_LV";
70
73
  const AP_DELEVERAGE_BOT_PEGGED = "DELEVERAGE_BOT_PEGGED";
71
- const AP_GAUGE_COMPRESSOR = "GLOBAL::GAUGE_COMPRESSOR";
74
+ const AP_GAUGE_COMPRESSOR = "GAUGE_COMPRESSOR";
72
75
  const AP_GEAR_STAKING = "GEAR_STAKING";
73
- const AP_GEAR_TOKEN = "GLOBAL::GEAR_TOKEN";
76
+ const AP_GEAR_TOKEN = "GEAR_TOKEN";
74
77
  const AP_INFLATION_ATTACK_BLOCKER = "INFLATION_ATTACK_BLOCKER";
75
78
  const AP_INSOLVENCY_CHECKER = "INSOLVENCY_CHECKER";
76
- const AP_MARKET_COMPRESSOR = "GLOBAL::MARKET_COMPRESSOR";
79
+ const AP_MARKET_COMPRESSOR = "MARKET_COMPRESSOR";
77
80
  const AP_MARKET_CONFIGURATOR = "MARKET_CONFIGURATOR";
78
81
  const AP_PARTIAL_LIQUIDATION_BOT = "PARTIAL_LIQUIDATION_BOT";
79
- const AP_PERIPHERY_COMPRESSOR = "GLOBAL::PERIPHERY_COMPRESSOR";
80
- const AP_PRICE_FEED_COMPRESSOR = "GLOBAL::PRICE_FEED_COMPRESSOR";
82
+ const AP_PERIPHERY_COMPRESSOR = "PERIPHERY_COMPRESSOR";
83
+ const AP_POOL_COMPRESSOR = "POOL_COMPRESSOR";
84
+ const AP_PRICE_FEED_COMPRESSOR = "PRICE_FEED_COMPRESSOR";
81
85
  const AP_PRICE_ORACLE = "PRICE_ORACLE";
82
- const AP_REWARDS_COMPRESSOR = "GLOBAL::REWARDS_COMPRESSOR";
83
- const AP_ROUTER = "GLOBAL::ROUTER";
84
- const AP_TOKEN_COMPRESSOR = "GLOBAL::TOKEN_COMPRESSOR";
86
+ const AP_REWARDS_COMPRESSOR = "REWARDS_COMPRESSOR";
87
+ const AP_ROUTER = "LOCAL::ROUTER";
88
+ const AP_TOKEN_COMPRESSOR = "TOKEN_COMPRESSOR";
85
89
  const AP_TREASURY = "TREASURY";
86
90
  const AP_WETH_GATEWAY = "WETH_GATEWAY";
87
91
  const AP_WETH_TOKEN = "WETH_TOKEN";
@@ -98,7 +102,8 @@ const ADDRESS_PROVIDER = {
98
102
  Monad: import_addresses.NOT_DEPLOYED,
99
103
  Berachain: import_addresses.NOT_DEPLOYED,
100
104
  Avalanche: import_addresses.NOT_DEPLOYED,
101
- BNB: import_addresses.NOT_DEPLOYED
105
+ BNB: import_addresses.NOT_DEPLOYED,
106
+ WorldChain: import_addresses.NOT_DEPLOYED
102
107
  };
103
108
  const ADDRESS_PROVIDER_V310 = "0xBaB2014Dd88223E168bA06911c06df638311a097";
104
109
  // Annotate the CommonJS export names for ESM import in node:
@@ -107,6 +112,7 @@ const ADDRESS_PROVIDER_V310 = "0xBaB2014Dd88223E168bA06911c06df638311a097";
107
112
  ADDRESS_PROVIDER_V310,
108
113
  AP_ACCOUNT_FACTORY,
109
114
  AP_ACL,
115
+ AP_ADAPTER_COMPRESSOR,
110
116
  AP_BOT_LIST,
111
117
  AP_BYTECODE_REPOSITORY,
112
118
  AP_CONTRACTS_REGISTER,
@@ -126,6 +132,7 @@ const ADDRESS_PROVIDER_V310 = "0xBaB2014Dd88223E168bA06911c06df638311a097";
126
132
  AP_MARKET_CONFIGURATOR,
127
133
  AP_PARTIAL_LIQUIDATION_BOT,
128
134
  AP_PERIPHERY_COMPRESSOR,
135
+ AP_POOL_COMPRESSOR,
129
136
  AP_PRICE_FEED_COMPRESSOR,
130
137
  AP_PRICE_ORACLE,
131
138
  AP_REWARDS_COMPRESSOR,
@@ -41,7 +41,8 @@ const TIMELOCK = {
41
41
  Monad: NOT_DEPLOYED,
42
42
  Berachain: NOT_DEPLOYED,
43
43
  Avalanche: NOT_DEPLOYED,
44
- BNB: NOT_DEPLOYED
44
+ BNB: NOT_DEPLOYED,
45
+ WorldChain: NOT_DEPLOYED
45
46
  };
46
47
  const GEARBOX_MULTISIG = {
47
48
  Mainnet: "0xA7D5DDc1b8557914F158076b228AA91eF613f1D5",
@@ -54,7 +55,8 @@ const GEARBOX_MULTISIG = {
54
55
  Monad: NOT_DEPLOYED,
55
56
  Berachain: NOT_DEPLOYED,
56
57
  Avalanche: NOT_DEPLOYED,
57
- BNB: NOT_DEPLOYED
58
+ BNB: NOT_DEPLOYED,
59
+ WorldChain: NOT_DEPLOYED
58
60
  };
59
61
  const GEARBOX_RISK_CURATORS = {
60
62
  Mainnet: [TIMELOCK.Mainnet],
@@ -67,7 +69,8 @@ const GEARBOX_RISK_CURATORS = {
67
69
  Monad: [],
68
70
  Berachain: [],
69
71
  Avalanche: [],
70
- BNB: []
72
+ BNB: [],
73
+ WorldChain: []
71
74
  };
72
75
  const DEPRECIATED_POOLS = {
73
76
  Mainnet: {
@@ -82,7 +85,8 @@ const DEPRECIATED_POOLS = {
82
85
  Monad: {},
83
86
  Berachain: {},
84
87
  Avalanche: {},
85
- BNB: {}
88
+ BNB: {},
89
+ WorldChain: {}
86
90
  };
87
91
  // Annotate the CommonJS export names for ESM import in node:
88
92
  0 && (module.exports = {
@@ -39,7 +39,9 @@ const ADDRESS_PROVIDER_BLOCK = {
39
39
  // arbitrary not deployed yet
40
40
  Avalanche: 31594758n,
41
41
  // arbitrary not deployed yet
42
- BNB: 48553569n
42
+ BNB: 48553569n,
43
+ // arbitrary not deployed yet
44
+ WorldChain: 22372908n
43
45
  // arbitrary not deployed yet
44
46
  };
45
47
  const BLOCK_DURATION_BY_NETWORK = {
@@ -55,7 +57,8 @@ const BLOCK_DURATION_BY_NETWORK = {
55
57
  // on testnet
56
58
  Berachain: 1.9,
57
59
  Avalanche: 1.7,
58
- BNB: 3
60
+ BNB: 3,
61
+ WorldChain: 2
59
62
  };
60
63
  const RAMP_TIME = 30 * 24 * 60 * 60 * 1.2;
61
64
  const RAMP_DURATION_BY_NETWORK = {
@@ -73,7 +76,10 @@ const RAMP_DURATION_BY_NETWORK = {
73
76
  Avalanche: BigInt(
74
77
  Math.floor(RAMP_TIME / BLOCK_DURATION_BY_NETWORK.Avalanche)
75
78
  ),
76
- BNB: BigInt(Math.floor(RAMP_TIME / BLOCK_DURATION_BY_NETWORK.BNB))
79
+ BNB: BigInt(Math.floor(RAMP_TIME / BLOCK_DURATION_BY_NETWORK.BNB)),
80
+ WorldChain: BigInt(
81
+ Math.floor(RAMP_TIME / BLOCK_DURATION_BY_NETWORK.WorldChain)
82
+ )
77
83
  };
78
84
  const WEEK = 7 * 24 * 60 * 60;
79
85
  const BLOCKS_PER_WEEK_BY_NETWORK = {
@@ -87,7 +93,8 @@ const BLOCKS_PER_WEEK_BY_NETWORK = {
87
93
  Monad: BigInt(Math.floor(WEEK / BLOCK_DURATION_BY_NETWORK.Monad)),
88
94
  Berachain: BigInt(Math.floor(WEEK / BLOCK_DURATION_BY_NETWORK.Berachain)),
89
95
  Avalanche: BigInt(Math.floor(WEEK / BLOCK_DURATION_BY_NETWORK.Avalanche)),
90
- BNB: BigInt(Math.floor(WEEK / BLOCK_DURATION_BY_NETWORK.BNB))
96
+ BNB: BigInt(Math.floor(WEEK / BLOCK_DURATION_BY_NETWORK.BNB)),
97
+ WorldChain: BigInt(Math.floor(WEEK / BLOCK_DURATION_BY_NETWORK.WorldChain))
91
98
  };
92
99
  // Annotate the CommonJS export names for ESM import in node:
93
100
  0 && (module.exports = {
@@ -60,7 +60,7 @@ class MarketSuite extends import_base.SDKConstruct {
60
60
  }
61
61
  this.priceOracle = (0, import_oracle.createPriceOracle)(
62
62
  sdk,
63
- marketData.priceOracle,
63
+ marketData.priceOracleData,
64
64
  marketData.pool.underlying
65
65
  );
66
66
  }
@@ -56,7 +56,11 @@ class CreditFacadeV300Contract extends import_base.BaseContract {
56
56
  botList: this.labelAddress(this.botList),
57
57
  minDebt: (0, import_utils.formatBNvalue)(this.minDebt, decimals),
58
58
  maxDebt: (0, import_utils.formatBNvalue)(this.maxDebt, decimals),
59
- forbiddenTokensMask: (0, import_utils.fmtBinaryMask)(this.forbiddenTokensMask),
59
+ currentCumulativeLoss: "0",
60
+ // TODO
61
+ maxCumulativeLoss: "0",
62
+ // TODO
63
+ forbiddenTokenMask: (0, import_utils.fmtBinaryMask)(this.forbiddenTokenMask),
60
64
  isPaused: this.isPaused
61
65
  };
62
66
  }
@@ -56,7 +56,11 @@ class CreditFacadeV310Contract extends import_base.BaseContract {
56
56
  botList: this.labelAddress(this.botList),
57
57
  minDebt: (0, import_utils.formatBNvalue)(this.minDebt, decimals),
58
58
  maxDebt: (0, import_utils.formatBNvalue)(this.maxDebt, decimals),
59
- forbiddenTokensMask: (0, import_utils.fmtBinaryMask)(this.forbiddenTokensMask),
59
+ currentCumulativeLoss: "0",
60
+ // TODO
61
+ maxCumulativeLoss: "0",
62
+ // TODO
63
+ forbiddenTokenMask: (0, import_utils.fmtBinaryMask)(this.forbiddenTokenMask),
60
64
  isPaused: this.isPaused
61
65
  };
62
66
  }