@gearbox-protocol/sdk 3.1.3-next.2 → 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 (67) 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/GearboxSDK.js +6 -1
  7. package/dist/cjs/sdk/accounts/CreditAccountsService.js +30 -45
  8. package/dist/cjs/sdk/chain/chains.js +14 -2
  9. package/dist/cjs/sdk/constants/address-provider.js +19 -12
  10. package/dist/cjs/sdk/constants/addresses.js +8 -4
  11. package/dist/cjs/sdk/constants/networks.js +11 -4
  12. package/dist/cjs/sdk/market/MarketSuite.js +1 -1
  13. package/dist/cjs/sdk/market/credit/CreditFacadeV300Contract.js +5 -1
  14. package/dist/cjs/sdk/market/credit/CreditFacadeV310Contract.js +5 -1
  15. package/dist/cjs/sdk/market/oracle/PriceOracleBaseContract.js +5 -6
  16. package/dist/cjs/sdk/market/pool/PoolSuite.js +1 -1
  17. package/dist/cjs/sdk/market/pricefeeds/PriceFeedsRegister.js +4 -4
  18. package/dist/cjs/sdk/router/RouterV300Contract.js +2 -1
  19. package/dist/cjs/sdk/sdk-gov-legacy/contracts/contracts.js +74 -37
  20. package/dist/cjs/sdk/sdk-gov-legacy/tokens/quoted.js +2 -1
  21. package/dist/cjs/sdk/sdk-gov-legacy/tokens/token.js +4 -2
  22. package/dist/cjs/sdk/sdk-gov-legacy/tokens/tokenData.js +2 -1
  23. package/dist/cjs/sdk/sdk-legacy/core/creditAccount.js +1 -3
  24. package/dist/cjs/sdk/sdk-legacy/core/endpoint.js +2 -1
  25. package/dist/esm/abi/compressors.js +522 -1133
  26. package/dist/esm/adapters/abi/adapters.js +0 -120
  27. package/dist/esm/adapters/abi/iBalancerV3RouterAdapter.js +129 -0
  28. package/dist/esm/adapters/abi/index.js +1 -0
  29. package/dist/esm/dev/setLTZero.js +0 -7
  30. package/dist/esm/sdk/GearboxSDK.js +6 -1
  31. package/dist/esm/sdk/accounts/CreditAccountsService.js +30 -45
  32. package/dist/esm/sdk/chain/chains.js +16 -3
  33. package/dist/esm/sdk/constants/address-provider.js +17 -12
  34. package/dist/esm/sdk/constants/addresses.js +8 -4
  35. package/dist/esm/sdk/constants/networks.js +11 -4
  36. package/dist/esm/sdk/market/MarketSuite.js +1 -1
  37. package/dist/esm/sdk/market/credit/CreditFacadeV300Contract.js +5 -1
  38. package/dist/esm/sdk/market/credit/CreditFacadeV310Contract.js +5 -1
  39. package/dist/esm/sdk/market/oracle/PriceOracleBaseContract.js +5 -6
  40. package/dist/esm/sdk/market/pool/PoolSuite.js +1 -1
  41. package/dist/esm/sdk/market/pricefeeds/PriceFeedsRegister.js +6 -9
  42. package/dist/esm/sdk/router/RouterV300Contract.js +2 -1
  43. package/dist/esm/sdk/sdk-gov-legacy/contracts/contracts.js +74 -37
  44. package/dist/esm/sdk/sdk-gov-legacy/tokens/quoted.js +2 -1
  45. package/dist/esm/sdk/sdk-gov-legacy/tokens/token.js +4 -2
  46. package/dist/esm/sdk/sdk-gov-legacy/tokens/tokenData.js +2 -1
  47. package/dist/esm/sdk/sdk-legacy/core/creditAccount.js +1 -3
  48. package/dist/esm/sdk/sdk-legacy/core/endpoint.js +2 -1
  49. package/dist/types/abi/compressors.d.ts +1106 -1734
  50. package/dist/types/adapters/BalancerV3RouterAdapterContract.d.ts +104 -62
  51. package/dist/types/adapters/abi/adapters.d.ts +0 -213
  52. package/dist/types/adapters/abi/iBalancerV3RouterAdapter.d.ts +230 -0
  53. package/dist/types/adapters/abi/index.d.ts +1 -0
  54. package/dist/types/sdk/accounts/CreditAccountsService.d.ts +3 -3
  55. package/dist/types/sdk/accounts/types.d.ts +2 -15
  56. package/dist/types/sdk/base/types.d.ts +6 -6
  57. package/dist/types/sdk/chain/chains.d.ts +2 -2
  58. package/dist/types/sdk/constants/address-provider.d.ts +13 -11
  59. package/dist/types/sdk/market/oracle/PriceOracleBaseContract.d.ts +85 -425
  60. package/dist/types/sdk/market/pool/PoolQuotaKeeperV300Contract.d.ts +2 -2
  61. package/dist/types/sdk/market/pool/PoolQuotaKeeperV310Contract.d.ts +2 -2
  62. package/dist/types/sdk/market/pool/createPoolQuotaKeeper.d.ts +2 -2
  63. package/dist/types/sdk/types/state-human.d.ts +3 -1
  64. package/package.json +1 -1
  65. package/dist/cjs/sdk/accounts/utils.js +0 -38
  66. package/dist/esm/sdk/accounts/utils.js +0 -14
  67. package/dist/types/sdk/accounts/utils.d.ts +0 -2
@@ -287,123 +287,6 @@ const iBalancerV2VaultAdapterAbi = [
287
287
  },
288
288
  { type: "error", inputs: [], name: "PoolNotSupportedException" }
289
289
  ];
290
- const iBalancerV3RouterAdapterAbi = [
291
- {
292
- type: "function",
293
- inputs: [],
294
- name: "contractType",
295
- outputs: [{ name: "", internalType: "bytes32", type: "bytes32" }],
296
- stateMutability: "view"
297
- },
298
- {
299
- type: "function",
300
- inputs: [],
301
- name: "creditManager",
302
- outputs: [{ name: "", internalType: "address", type: "address" }],
303
- stateMutability: "view"
304
- },
305
- {
306
- type: "function",
307
- inputs: [],
308
- name: "getAllowedPools",
309
- outputs: [{ name: "pools", internalType: "address[]", type: "address[]" }],
310
- stateMutability: "view"
311
- },
312
- {
313
- type: "function",
314
- inputs: [{ name: "pool", internalType: "address", type: "address" }],
315
- name: "isPoolAllowed",
316
- outputs: [{ name: "", internalType: "bool", type: "bool" }],
317
- stateMutability: "view"
318
- },
319
- {
320
- type: "function",
321
- inputs: [],
322
- name: "serialize",
323
- outputs: [{ name: "serializedData", internalType: "bytes", type: "bytes" }],
324
- stateMutability: "view"
325
- },
326
- {
327
- type: "function",
328
- inputs: [
329
- { name: "pools", internalType: "address[]", type: "address[]" },
330
- { name: "statuses", internalType: "bool[]", type: "bool[]" }
331
- ],
332
- name: "setPoolStatusBatch",
333
- outputs: [],
334
- stateMutability: "nonpayable"
335
- },
336
- {
337
- type: "function",
338
- inputs: [
339
- { name: "pool", internalType: "address", type: "address" },
340
- { name: "tokenIn", internalType: "contract IERC20", type: "address" },
341
- { name: "tokenOut", internalType: "contract IERC20", type: "address" },
342
- { name: "leftoverAmount", internalType: "uint256", type: "uint256" },
343
- { name: "rateMinRAY", internalType: "uint256", type: "uint256" },
344
- { name: "deadline", internalType: "uint256", type: "uint256" }
345
- ],
346
- name: "swapSingleTokenDiffIn",
347
- outputs: [{ name: "", internalType: "bool", type: "bool" }],
348
- stateMutability: "nonpayable"
349
- },
350
- {
351
- type: "function",
352
- inputs: [
353
- { name: "pool", internalType: "address", type: "address" },
354
- { name: "tokenIn", internalType: "contract IERC20", type: "address" },
355
- { name: "tokenOut", internalType: "contract IERC20", type: "address" },
356
- { name: "exactAmountIn", internalType: "uint256", type: "uint256" },
357
- { name: "minAmountOut", internalType: "uint256", type: "uint256" },
358
- { name: "deadline", internalType: "uint256", type: "uint256" },
359
- { name: "wethIsEth", internalType: "bool", type: "bool" },
360
- { name: "userData", internalType: "bytes", type: "bytes" }
361
- ],
362
- name: "swapSingleTokenExactIn",
363
- outputs: [{ name: "", internalType: "bool", type: "bool" }],
364
- stateMutability: "nonpayable"
365
- },
366
- {
367
- type: "function",
368
- inputs: [],
369
- name: "targetContract",
370
- outputs: [{ name: "", internalType: "address", type: "address" }],
371
- stateMutability: "view"
372
- },
373
- {
374
- type: "function",
375
- inputs: [],
376
- name: "version",
377
- outputs: [{ name: "", internalType: "uint256", type: "uint256" }],
378
- stateMutability: "view"
379
- },
380
- {
381
- type: "event",
382
- anonymous: false,
383
- inputs: [
384
- { name: "pool", internalType: "address", type: "address", indexed: true },
385
- { name: "allowed", internalType: "bool", type: "bool", indexed: false }
386
- ],
387
- name: "SetPoolStatus"
388
- },
389
- { type: "error", inputs: [], name: "InvalidLengthException" },
390
- { type: "error", inputs: [], name: "InvalidPoolException" }
391
- ];
392
- const iBalancerV3RouterAdapterEventsAbi = [
393
- {
394
- type: "event",
395
- anonymous: false,
396
- inputs: [
397
- { name: "pool", internalType: "address", type: "address", indexed: true },
398
- { name: "allowed", internalType: "bool", type: "bool", indexed: false }
399
- ],
400
- name: "SetPoolStatus"
401
- }
402
- ];
403
- const iBalancerV3RouterAdapterExceptionsAbi = [
404
- { type: "error", inputs: [], name: "InvalidLengthException" },
405
- { type: "error", inputs: [], name: "InvalidPoolException" }
406
- ];
407
290
  const iCamelotV3AdapterAbi = [
408
291
  {
409
292
  type: "function",
@@ -4315,9 +4198,6 @@ const iwstEthv1AdapterAbi = [
4315
4198
  ];
4316
4199
  export {
4317
4200
  iBalancerV2VaultAdapterAbi,
4318
- iBalancerV3RouterAdapterAbi,
4319
- iBalancerV3RouterAdapterEventsAbi,
4320
- iBalancerV3RouterAdapterExceptionsAbi,
4321
4201
  iCamelotV3AdapterAbi,
4322
4202
  iConvexV1BaseRewardPoolAdapterAbi,
4323
4203
  iConvexV1BoosterAdapterAbi,
@@ -0,0 +1,129 @@
1
+ const iBalancerV3RouterAdapterAbi = [
2
+ {
3
+ type: "constructor",
4
+ inputs: [
5
+ { name: "_creditManager", type: "address", internalType: "address" },
6
+ { name: "_router", type: "address", internalType: "address" }
7
+ ],
8
+ stateMutability: "nonpayable"
9
+ },
10
+ {
11
+ type: "function",
12
+ name: "_gearboxAdapterType",
13
+ inputs: [],
14
+ outputs: [{ name: "", type: "uint8", internalType: "enum AdapterType" }],
15
+ stateMutability: "view"
16
+ },
17
+ {
18
+ type: "function",
19
+ name: "_gearboxAdapterVersion",
20
+ inputs: [],
21
+ outputs: [{ name: "", type: "uint16", internalType: "uint16" }],
22
+ stateMutability: "view"
23
+ },
24
+ {
25
+ type: "function",
26
+ name: "acl",
27
+ inputs: [],
28
+ outputs: [{ name: "", type: "address", internalType: "address" }],
29
+ stateMutability: "view"
30
+ },
31
+ {
32
+ type: "function",
33
+ name: "addressProvider",
34
+ inputs: [],
35
+ outputs: [{ name: "", type: "address", internalType: "address" }],
36
+ stateMutability: "view"
37
+ },
38
+ {
39
+ type: "function",
40
+ name: "creditManager",
41
+ inputs: [],
42
+ outputs: [{ name: "", type: "address", internalType: "address" }],
43
+ stateMutability: "view"
44
+ },
45
+ {
46
+ type: "function",
47
+ name: "getAllowedPools",
48
+ inputs: [],
49
+ outputs: [{ name: "pools", type: "address[]", internalType: "address[]" }],
50
+ stateMutability: "view"
51
+ },
52
+ {
53
+ type: "function",
54
+ name: "isPoolAllowed",
55
+ inputs: [{ name: "pool", type: "address", internalType: "address" }],
56
+ outputs: [{ name: "", type: "bool", internalType: "bool" }],
57
+ stateMutability: "view"
58
+ },
59
+ {
60
+ type: "function",
61
+ name: "setPoolStatusBatch",
62
+ inputs: [
63
+ { name: "pools", type: "address[]", internalType: "address[]" },
64
+ { name: "statuses", type: "bool[]", internalType: "bool[]" }
65
+ ],
66
+ outputs: [],
67
+ stateMutability: "nonpayable"
68
+ },
69
+ {
70
+ type: "function",
71
+ name: "swapSingleTokenDiffIn",
72
+ inputs: [
73
+ { name: "pool", type: "address", internalType: "address" },
74
+ { name: "tokenIn", type: "address", internalType: "contract IERC20" },
75
+ { name: "tokenOut", type: "address", internalType: "contract IERC20" },
76
+ { name: "leftoverAmount", type: "uint256", internalType: "uint256" },
77
+ { name: "rateMinRAY", type: "uint256", internalType: "uint256" },
78
+ { name: "deadline", type: "uint256", internalType: "uint256" }
79
+ ],
80
+ outputs: [
81
+ { name: "tokensToEnable", type: "uint256", internalType: "uint256" },
82
+ { name: "tokensToDisable", type: "uint256", internalType: "uint256" }
83
+ ],
84
+ stateMutability: "nonpayable"
85
+ },
86
+ {
87
+ type: "function",
88
+ name: "swapSingleTokenExactIn",
89
+ inputs: [
90
+ { name: "pool", type: "address", internalType: "address" },
91
+ { name: "tokenIn", type: "address", internalType: "contract IERC20" },
92
+ { name: "tokenOut", type: "address", internalType: "contract IERC20" },
93
+ { name: "exactAmountIn", type: "uint256", internalType: "uint256" },
94
+ { name: "minAmountOut", type: "uint256", internalType: "uint256" },
95
+ { name: "deadline", type: "uint256", internalType: "uint256" },
96
+ { name: "", type: "bool", internalType: "bool" },
97
+ { name: "", type: "bytes", internalType: "bytes" }
98
+ ],
99
+ outputs: [
100
+ { name: "tokensToEnable", type: "uint256", internalType: "uint256" },
101
+ { name: "tokensToDisable", type: "uint256", internalType: "uint256" }
102
+ ],
103
+ stateMutability: "nonpayable"
104
+ },
105
+ {
106
+ type: "function",
107
+ name: "targetContract",
108
+ inputs: [],
109
+ outputs: [{ name: "", type: "address", internalType: "address" }],
110
+ stateMutability: "view"
111
+ },
112
+ {
113
+ type: "event",
114
+ name: "SetPoolStatus",
115
+ inputs: [
116
+ { name: "pool", type: "address", indexed: true, internalType: "address" },
117
+ { name: "allowed", type: "bool", indexed: false, internalType: "bool" }
118
+ ],
119
+ anonymous: false
120
+ },
121
+ { type: "error", name: "CallerNotConfiguratorException", inputs: [] },
122
+ { type: "error", name: "CallerNotCreditFacadeException", inputs: [] },
123
+ { type: "error", name: "InvalidLengthException", inputs: [] },
124
+ { type: "error", name: "InvalidPoolException", inputs: [] },
125
+ { type: "error", name: "ZeroAddressException", inputs: [] }
126
+ ];
127
+ export {
128
+ iBalancerV3RouterAdapterAbi
129
+ };
@@ -1 +1,2 @@
1
1
  export * from "./adapters.js";
2
+ export * from "./iBalancerV3RouterAdapter.js";
@@ -90,13 +90,6 @@ async function setLTZero(anvil, cm, logger) {
90
90
  address: cm.creditConfigurator
91
91
  });
92
92
  await anvil.stopImpersonatingAccount({ address: configuratorAddr });
93
- const lt = await anvil.readContract({
94
- address: cm.baseParams.addr,
95
- abi: iCreditManagerV300Abi,
96
- functionName: "liquidationThresholds",
97
- args: [cm.underlying]
98
- });
99
- logger?.debug(`[${cm.name}] underlying lt: ${lt}`);
100
93
  }
101
94
  export {
102
95
  setLTZero
@@ -37,6 +37,7 @@ class GearboxSDK {
37
37
  #currentBlock;
38
38
  #timestamp;
39
39
  #syncing = false;
40
+ #gear;
40
41
  // Collection of core singleton contracts
41
42
  #addressProvider;
42
43
  #botListContract;
@@ -184,6 +185,7 @@ class GearboxSDK {
184
185
  } catch (e) {
185
186
  this.logger?.error(e);
186
187
  }
188
+ this.#gear = this.#addressProvider.getAddress(AP_GEAR_TOKEN, NO_VERSION);
187
189
  const gearStakingAddress = this.#addressProvider.getAddress(
188
190
  AP_GEAR_STAKING,
189
191
  NO_VERSION
@@ -403,7 +405,10 @@ class GearboxSDK {
403
405
  return this.#timestamp;
404
406
  }
405
407
  get gear() {
406
- return this.addressProvider.getAddress(AP_GEAR_TOKEN, NO_VERSION);
408
+ if (this.#gear === void 0) {
409
+ throw ERR_NOT_ATTACHED;
410
+ }
411
+ return this.#gear;
407
412
  }
408
413
  get addressProvider() {
409
414
  if (this.#addressProvider === void 0) {
@@ -36,7 +36,6 @@ import {
36
36
  } from "../sdk-gov-legacy/index.js";
37
37
  import { childLogger } from "../utils/index.js";
38
38
  import { simulateWithPriceUpdates } from "../utils/viem/index.js";
39
- import { stringifyGetCreditAccountsArgs } from "./utils.js";
40
39
  class CreditAccountsService extends SDKConstruct {
41
40
  #compressor;
42
41
  #batchSize;
@@ -48,9 +47,6 @@ class CreditAccountsService extends SDKConstruct {
48
47
  );
49
48
  this.#batchSize = options?.batchSize;
50
49
  this.#logger = childLogger("CreditAccountsService", sdk.logger);
51
- this.#logger?.debug(
52
- `credit account compressor address: ${this.#compressor}`
53
- );
54
50
  }
55
51
  /**
56
52
  * Returns single credit account data, or undefined if it's not found
@@ -99,21 +95,21 @@ class CreditAccountsService extends SDKConstruct {
99
95
  * TODO: do we want to expose pagination?
100
96
  * TODO: do we want to expose "reverting"?
101
97
  * TODO: do we want to expose MarketFilter in any way? If so, we need to check that the MarketFilter is compatibled with attached markets?
102
- * @param options
98
+ * @param args
103
99
  * @param blockNumber
104
100
  * @returns returned credit accounts are sorted by health factor in ascending order
105
101
  */
106
- async getCreditAccounts(options, blockNumber) {
102
+ async getCreditAccounts(args, blockNumber) {
107
103
  const {
108
104
  creditManager,
109
105
  includeZeroDebt = false,
110
- maxHealthFactor = MAX_UINT256,
111
- minHealthFactor = 0n,
106
+ maxHealthFactor = 65535,
107
+ // TODO: this will change to bigint
108
+ minHealthFactor = 0,
112
109
  owner = ADDRESS_0X0
113
- } = options ?? {};
110
+ } = args ?? {};
114
111
  const arg0 = creditManager ?? {
115
112
  configurators: this.marketConfigurators,
116
- creditManagers: [],
117
113
  pools: [],
118
114
  underlying: ADDRESS_0X0
119
115
  };
@@ -121,8 +117,7 @@ class CreditAccountsService extends SDKConstruct {
121
117
  owner,
122
118
  includeZeroDebt,
123
119
  minHealthFactor,
124
- maxHealthFactor,
125
- reverting: false
120
+ maxHealthFactor
126
121
  };
127
122
  const { txs: priceUpdateTxs } = await this.sdk.priceFeeds.generatePriceFeedsUpdateTxs();
128
123
  const allCAs = [];
@@ -727,41 +722,31 @@ class CreditAccountsService extends SDKConstruct {
727
722
  * @returns
728
723
  */
729
724
  async #getCreditAccounts(args, priceUpdateTxs, blockNumber) {
730
- this.#logger?.debug(
731
- { args: stringifyGetCreditAccountsArgs(args) },
732
- "getting credit accounts"
733
- );
734
- let resp;
735
725
  if (priceUpdateTxs?.length) {
736
- [resp] = await simulateWithPriceUpdates(this.provider.publicClient, {
737
- priceUpdates: priceUpdateTxs,
738
- contracts: [
739
- {
740
- abi: iCreditAccountCompressorAbi,
741
- address: this.#compressor,
742
- functionName: "getCreditAccounts",
743
- args
744
- }
745
- ],
746
- blockNumber
747
- });
748
- } else {
749
- resp = await this.provider.publicClient.readContract({
750
- abi: iCreditAccountCompressorAbi,
751
- address: this.#compressor,
752
- functionName: "getCreditAccounts",
753
- args,
754
- blockNumber
755
- });
726
+ const [resp] = await simulateWithPriceUpdates(
727
+ this.provider.publicClient,
728
+ {
729
+ priceUpdates: priceUpdateTxs,
730
+ contracts: [
731
+ {
732
+ abi: iCreditAccountCompressorAbi,
733
+ address: this.#compressor,
734
+ functionName: "getCreditAccounts",
735
+ args
736
+ }
737
+ ],
738
+ blockNumber
739
+ }
740
+ );
741
+ return resp;
756
742
  }
757
- this.#logger?.debug(
758
- {
759
- accounts: resp[0]?.length ?? 0,
760
- nextOffset: Number(resp[1])
761
- },
762
- "got credit accounts"
763
- );
764
- return resp;
743
+ return this.provider.publicClient.readContract({
744
+ abi: iCreditAccountCompressorAbi,
745
+ address: this.#compressor,
746
+ functionName: "getCreditAccounts",
747
+ args,
748
+ blockNumber
749
+ });
765
750
  }
766
751
  /**
767
752
  * Returns raw txs that are needed to update all price feeds so that all credit accounts (possibly from different markets) compute
@@ -9,7 +9,8 @@ import {
9
9
  megaethTestnet,
10
10
  monadTestnet,
11
11
  optimism,
12
- sonic
12
+ sonic,
13
+ worldchain
13
14
  } from "viem/chains";
14
15
  import { z } from "zod";
15
16
  import { TypedObjectUtils } from "../utils/index.js";
@@ -23,7 +24,8 @@ const SUPPORTED_NETWORKS = [
23
24
  "Monad",
24
25
  "Berachain",
25
26
  "Avalanche",
26
- "BNB"
27
+ "BNB",
28
+ "WorldChain"
27
29
  ];
28
30
  const NetworkType = z.enum(SUPPORTED_NETWORKS);
29
31
  function withPublicNode(chain, subdomain) {
@@ -191,7 +193,18 @@ const chains = {
191
193
  }
192
194
  },
193
195
  "bsc-rpc"
194
- )
196
+ ),
197
+ WorldChain: defineChain({
198
+ ...worldchain,
199
+ network: "WorldChain",
200
+ defaultMarketConfigurators: {},
201
+ isPublic: false,
202
+ wellKnownToken: {
203
+ address: "0x79a02482a880bce3f13e09da970dc34db4cd24d1",
204
+ symbol: "USDC.e"
205
+ }
206
+ // TODO: has no block explorer API
207
+ })
195
208
  };
196
209
  function getChain(chainIdOrNetworkType) {
197
210
  const network = typeof chainIdOrNetworkType === "string" ? chainIdOrNetworkType : getNetworkType(Number(chainIdOrNetworkType));
@@ -2,30 +2,32 @@ import { NOT_DEPLOYED } from "./addresses.js";
2
2
  const NO_VERSION = 0;
3
3
  const AP_ACCOUNT_FACTORY = "ACCOUNT_FACTORY";
4
4
  const AP_ACL = "ACL";
5
+ const AP_ADAPTER_COMPRESSOR = "ADAPTER_COMPRESSOR";
5
6
  const AP_BOT_LIST = "BOT_LIST";
6
7
  const AP_BYTECODE_REPOSITORY = "BYTECODE_REPOSITORY";
7
8
  const AP_CONTRACTS_REGISTER = "CONTRACTS_REGISTER";
8
9
  const AP_CONTROLLER_TIMELOCK = "CONTROLLER_TIMELOCK";
9
- const AP_CREDIT_ACCOUNT_COMPRESSOR = "GLOBAL::ACCOUNT_COMPRESSOR";
10
- const AP_CREDIT_SUITE_COMPRESSOR = "GLOBAL::CREDIT_SUITE_COMPRESSOR";
10
+ const AP_CREDIT_ACCOUNT_COMPRESSOR = "CREDIT_ACCOUNT_COMPRESSOR";
11
+ const AP_CREDIT_SUITE_COMPRESSOR = "CREDIT_SUITE_COMPRESSOR";
11
12
  const AP_DATA_COMPRESSOR = "DATA_COMPRESSOR";
12
13
  const AP_DELEVERAGE_BOT_HV = "DELEVERAGE_BOT_HV";
13
14
  const AP_DELEVERAGE_BOT_LV = "DELEVERAGE_BOT_LV";
14
15
  const AP_DELEVERAGE_BOT_PEGGED = "DELEVERAGE_BOT_PEGGED";
15
- const AP_GAUGE_COMPRESSOR = "GLOBAL::GAUGE_COMPRESSOR";
16
+ const AP_GAUGE_COMPRESSOR = "GAUGE_COMPRESSOR";
16
17
  const AP_GEAR_STAKING = "GEAR_STAKING";
17
- const AP_GEAR_TOKEN = "GLOBAL::GEAR_TOKEN";
18
+ const AP_GEAR_TOKEN = "GEAR_TOKEN";
18
19
  const AP_INFLATION_ATTACK_BLOCKER = "INFLATION_ATTACK_BLOCKER";
19
20
  const AP_INSOLVENCY_CHECKER = "INSOLVENCY_CHECKER";
20
- const AP_MARKET_COMPRESSOR = "GLOBAL::MARKET_COMPRESSOR";
21
+ const AP_MARKET_COMPRESSOR = "MARKET_COMPRESSOR";
21
22
  const AP_MARKET_CONFIGURATOR = "MARKET_CONFIGURATOR";
22
23
  const AP_PARTIAL_LIQUIDATION_BOT = "PARTIAL_LIQUIDATION_BOT";
23
- const AP_PERIPHERY_COMPRESSOR = "GLOBAL::PERIPHERY_COMPRESSOR";
24
- const AP_PRICE_FEED_COMPRESSOR = "GLOBAL::PRICE_FEED_COMPRESSOR";
24
+ const AP_PERIPHERY_COMPRESSOR = "PERIPHERY_COMPRESSOR";
25
+ const AP_POOL_COMPRESSOR = "POOL_COMPRESSOR";
26
+ const AP_PRICE_FEED_COMPRESSOR = "PRICE_FEED_COMPRESSOR";
25
27
  const AP_PRICE_ORACLE = "PRICE_ORACLE";
26
- const AP_REWARDS_COMPRESSOR = "GLOBAL::REWARDS_COMPRESSOR";
27
- const AP_ROUTER = "GLOBAL::ROUTER";
28
- const AP_TOKEN_COMPRESSOR = "GLOBAL::TOKEN_COMPRESSOR";
28
+ const AP_REWARDS_COMPRESSOR = "REWARDS_COMPRESSOR";
29
+ const AP_ROUTER = "LOCAL::ROUTER";
30
+ const AP_TOKEN_COMPRESSOR = "TOKEN_COMPRESSOR";
29
31
  const AP_TREASURY = "TREASURY";
30
32
  const AP_WETH_GATEWAY = "WETH_GATEWAY";
31
33
  const AP_WETH_TOKEN = "WETH_TOKEN";
@@ -42,14 +44,16 @@ const ADDRESS_PROVIDER = {
42
44
  Monad: NOT_DEPLOYED,
43
45
  Berachain: NOT_DEPLOYED,
44
46
  Avalanche: NOT_DEPLOYED,
45
- BNB: NOT_DEPLOYED
47
+ BNB: NOT_DEPLOYED,
48
+ WorldChain: NOT_DEPLOYED
46
49
  };
47
- const ADDRESS_PROVIDER_V310 = "0xF7f0a609BfAb9a0A98786951ef10e5FE26cC1E38";
50
+ const ADDRESS_PROVIDER_V310 = "0xBaB2014Dd88223E168bA06911c06df638311a097";
48
51
  export {
49
52
  ADDRESS_PROVIDER,
50
53
  ADDRESS_PROVIDER_V310,
51
54
  AP_ACCOUNT_FACTORY,
52
55
  AP_ACL,
56
+ AP_ADAPTER_COMPRESSOR,
53
57
  AP_BOT_LIST,
54
58
  AP_BYTECODE_REPOSITORY,
55
59
  AP_CONTRACTS_REGISTER,
@@ -69,6 +73,7 @@ export {
69
73
  AP_MARKET_CONFIGURATOR,
70
74
  AP_PARTIAL_LIQUIDATION_BOT,
71
75
  AP_PERIPHERY_COMPRESSOR,
76
+ AP_POOL_COMPRESSOR,
72
77
  AP_PRICE_FEED_COMPRESSOR,
73
78
  AP_PRICE_ORACLE,
74
79
  AP_REWARDS_COMPRESSOR,
@@ -12,7 +12,8 @@ const TIMELOCK = {
12
12
  Monad: NOT_DEPLOYED,
13
13
  Berachain: NOT_DEPLOYED,
14
14
  Avalanche: NOT_DEPLOYED,
15
- BNB: NOT_DEPLOYED
15
+ BNB: NOT_DEPLOYED,
16
+ WorldChain: NOT_DEPLOYED
16
17
  };
17
18
  const GEARBOX_MULTISIG = {
18
19
  Mainnet: "0xA7D5DDc1b8557914F158076b228AA91eF613f1D5",
@@ -25,7 +26,8 @@ const GEARBOX_MULTISIG = {
25
26
  Monad: NOT_DEPLOYED,
26
27
  Berachain: NOT_DEPLOYED,
27
28
  Avalanche: NOT_DEPLOYED,
28
- BNB: NOT_DEPLOYED
29
+ BNB: NOT_DEPLOYED,
30
+ WorldChain: NOT_DEPLOYED
29
31
  };
30
32
  const GEARBOX_RISK_CURATORS = {
31
33
  Mainnet: [TIMELOCK.Mainnet],
@@ -38,7 +40,8 @@ const GEARBOX_RISK_CURATORS = {
38
40
  Monad: [],
39
41
  Berachain: [],
40
42
  Avalanche: [],
41
- BNB: []
43
+ BNB: [],
44
+ WorldChain: []
42
45
  };
43
46
  const DEPRECIATED_POOLS = {
44
47
  Mainnet: {
@@ -53,7 +56,8 @@ const DEPRECIATED_POOLS = {
53
56
  Monad: {},
54
57
  Berachain: {},
55
58
  Avalanche: {},
56
- BNB: {}
59
+ BNB: {},
60
+ WorldChain: {}
57
61
  };
58
62
  export {
59
63
  ADDRESS_0X0,
@@ -14,7 +14,9 @@ const ADDRESS_PROVIDER_BLOCK = {
14
14
  // arbitrary not deployed yet
15
15
  Avalanche: 31594758n,
16
16
  // arbitrary not deployed yet
17
- BNB: 48553569n
17
+ BNB: 48553569n,
18
+ // arbitrary not deployed yet
19
+ WorldChain: 22372908n
18
20
  // arbitrary not deployed yet
19
21
  };
20
22
  const BLOCK_DURATION_BY_NETWORK = {
@@ -30,7 +32,8 @@ const BLOCK_DURATION_BY_NETWORK = {
30
32
  // on testnet
31
33
  Berachain: 1.9,
32
34
  Avalanche: 1.7,
33
- BNB: 3
35
+ BNB: 3,
36
+ WorldChain: 2
34
37
  };
35
38
  const RAMP_TIME = 30 * 24 * 60 * 60 * 1.2;
36
39
  const RAMP_DURATION_BY_NETWORK = {
@@ -48,7 +51,10 @@ const RAMP_DURATION_BY_NETWORK = {
48
51
  Avalanche: BigInt(
49
52
  Math.floor(RAMP_TIME / BLOCK_DURATION_BY_NETWORK.Avalanche)
50
53
  ),
51
- BNB: BigInt(Math.floor(RAMP_TIME / BLOCK_DURATION_BY_NETWORK.BNB))
54
+ BNB: BigInt(Math.floor(RAMP_TIME / BLOCK_DURATION_BY_NETWORK.BNB)),
55
+ WorldChain: BigInt(
56
+ Math.floor(RAMP_TIME / BLOCK_DURATION_BY_NETWORK.WorldChain)
57
+ )
52
58
  };
53
59
  const WEEK = 7 * 24 * 60 * 60;
54
60
  const BLOCKS_PER_WEEK_BY_NETWORK = {
@@ -62,7 +68,8 @@ const BLOCKS_PER_WEEK_BY_NETWORK = {
62
68
  Monad: BigInt(Math.floor(WEEK / BLOCK_DURATION_BY_NETWORK.Monad)),
63
69
  Berachain: BigInt(Math.floor(WEEK / BLOCK_DURATION_BY_NETWORK.Berachain)),
64
70
  Avalanche: BigInt(Math.floor(WEEK / BLOCK_DURATION_BY_NETWORK.Avalanche)),
65
- BNB: BigInt(Math.floor(WEEK / BLOCK_DURATION_BY_NETWORK.BNB))
71
+ BNB: BigInt(Math.floor(WEEK / BLOCK_DURATION_BY_NETWORK.BNB)),
72
+ WorldChain: BigInt(Math.floor(WEEK / BLOCK_DURATION_BY_NETWORK.WorldChain))
66
73
  };
67
74
  export {
68
75
  ADDRESS_PROVIDER_BLOCK,
@@ -37,7 +37,7 @@ class MarketSuite extends SDKConstruct {
37
37
  }
38
38
  this.priceOracle = createPriceOracle(
39
39
  sdk,
40
- marketData.priceOracle,
40
+ marketData.priceOracleData,
41
41
  marketData.pool.underlying
42
42
  );
43
43
  }
@@ -36,7 +36,11 @@ class CreditFacadeV300Contract extends BaseContract {
36
36
  botList: this.labelAddress(this.botList),
37
37
  minDebt: formatBNvalue(this.minDebt, decimals),
38
38
  maxDebt: formatBNvalue(this.maxDebt, decimals),
39
- forbiddenTokensMask: fmtBinaryMask(this.forbiddenTokensMask),
39
+ currentCumulativeLoss: "0",
40
+ // TODO
41
+ maxCumulativeLoss: "0",
42
+ // TODO
43
+ forbiddenTokenMask: fmtBinaryMask(this.forbiddenTokenMask),
40
44
  isPaused: this.isPaused
41
45
  };
42
46
  }
@@ -36,7 +36,11 @@ class CreditFacadeV310Contract extends BaseContract {
36
36
  botList: this.labelAddress(this.botList),
37
37
  minDebt: formatBNvalue(this.minDebt, decimals),
38
38
  maxDebt: formatBNvalue(this.maxDebt, decimals),
39
- forbiddenTokensMask: fmtBinaryMask(this.forbiddenTokensMask),
39
+ currentCumulativeLoss: "0",
40
+ // TODO
41
+ maxCumulativeLoss: "0",
42
+ // TODO
43
+ forbiddenTokenMask: fmtBinaryMask(this.forbiddenTokenMask),
40
44
  isPaused: this.isPaused
41
45
  };
42
46
  }