@gearbox-protocol/deploy-tools 5.24.27 → 5.24.28

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 (2) hide show
  1. package/dist/index.mjs +77 -15
  2. package/package.json +2 -2
package/dist/index.mjs CHANGED
@@ -377105,6 +377105,12 @@ var SDKConstruct = class {
377105
377105
  labelAddress(address) {
377106
377106
  return this.provider.addressLabels.get(address);
377107
377107
  }
377108
+ /**
377109
+ * Returns list of addresses that should be watched for events to sync state
377110
+ */
377111
+ get watchAddresses() {
377112
+ return /* @__PURE__ */ new Set();
377113
+ }
377108
377114
  };
377109
377115
 
377110
377116
  // ../../node_modules/@gearbox-protocol/sdk/dist/esm/sdk/base/BaseContract.js
@@ -387520,6 +387526,13 @@ var CreditSuite = class extends SDKConstruct {
387520
387526
  get dirty() {
387521
387527
  return this.creditFacade.dirty || this.creditManager.dirty || this.creditConfigurator.dirty;
387522
387528
  }
387529
+ get watchAddresses() {
387530
+ return /* @__PURE__ */ new Set([
387531
+ this.creditConfigurator.address,
387532
+ this.creditManager.address,
387533
+ this.creditFacade.address
387534
+ ]);
387535
+ }
387523
387536
  stateHuman(raw = true) {
387524
387537
  return {
387525
387538
  creditFacade: this.creditFacade.stateHuman(raw),
@@ -393410,6 +393423,9 @@ var PriceOracleBaseContract = class extends BaseContract {
393410
393423
  }
393411
393424
  return [void 0, false];
393412
393425
  }
393426
+ get watchAddresses() {
393427
+ return /* @__PURE__ */ new Set([this.address]);
393428
+ }
393413
393429
  stateHuman(raw = true) {
393414
393430
  return {
393415
393431
  ...super.stateHuman(raw),
@@ -394167,6 +394183,14 @@ var PoolSuite = class extends SDKConstruct {
394167
394183
  get dirty() {
394168
394184
  return this.pool.dirty || this.gauge.dirty || this.pqk.dirty || this.interestRateModel.dirty;
394169
394185
  }
394186
+ get watchAddresses() {
394187
+ return /* @__PURE__ */ new Set([
394188
+ this.pool.address,
394189
+ this.pqk.address,
394190
+ this.rateKeeper.address,
394191
+ this.interestRateModel.address
394192
+ ]);
394193
+ }
394170
394194
  stateHuman(raw = true) {
394171
394195
  return {
394172
394196
  pool: this.pool.stateHuman(raw),
@@ -394219,6 +394243,15 @@ var MarketSuite = class extends SDKConstruct {
394219
394243
  get dirty() {
394220
394244
  return this.configurator.dirty || this.pool.dirty || this.priceOracle.dirty || this.creditManagers.some((cm) => cm.dirty);
394221
394245
  }
394246
+ get watchAddresses() {
394247
+ return /* @__PURE__ */ new Set([
394248
+ this.configurator.address,
394249
+ this.state.lossPolicy.baseParams.addr,
394250
+ ...this.creditManagers.flatMap((cm) => Array.from(cm.watchAddresses)),
394251
+ ...Array.from(this.priceOracle.watchAddresses),
394252
+ ...Array.from(this.pool.watchAddresses)
394253
+ ]);
394254
+ }
394222
394255
  stateHuman(raw = true) {
394223
394256
  return {
394224
394257
  configurator: this.labelAddress(this.configurator.address),
@@ -394366,6 +394399,9 @@ var MarketRegister = class extends SDKConstruct {
394366
394399
  handler(result);
394367
394400
  }
394368
394401
  }
394402
+ get watchAddresses() {
394403
+ return new Set(this.markets.flatMap((m) => Array.from(m.watchAddresses)));
394404
+ }
394369
394405
  get state() {
394370
394406
  return this.markets.map((market) => market.state);
394371
394407
  }
@@ -394525,6 +394561,7 @@ var GearboxSDK = class _GearboxSDK {
394525
394561
  #addressProvider;
394526
394562
  #botListContract;
394527
394563
  #gearStakingContract;
394564
+ #attachConfig;
394528
394565
  // Collection of markets
394529
394566
  #marketRegister;
394530
394567
  // Router contract
@@ -394584,10 +394621,6 @@ var GearboxSDK = class _GearboxSDK {
394584
394621
  chainId,
394585
394622
  networkType
394586
394623
  });
394587
- logger2?.info(
394588
- { networkType, chainId, addressProvider, marketConfigurators },
394589
- "attaching gearbox sdk"
394590
- );
394591
394624
  return new _GearboxSDK({
394592
394625
  provider,
394593
394626
  logger: logger2,
@@ -394624,6 +394657,17 @@ var GearboxSDK = class _GearboxSDK {
394624
394657
  ignoreUpdateablePrices,
394625
394658
  marketConfigurators
394626
394659
  } = opts;
394660
+ const re = this.#attachConfig ? "re" : "";
394661
+ this.logger?.info(
394662
+ {
394663
+ networkType: this.provider.networkType,
394664
+ chainId: this.provider.chainId,
394665
+ addressProvider,
394666
+ marketConfigurators
394667
+ },
394668
+ `${re}attaching gearbox sdk`
394669
+ );
394670
+ this.#attachConfig = opts;
394627
394671
  const time = Date.now();
394628
394672
  const block = await this.provider.publicClient.getBlock(
394629
394673
  blockNumber ? { blockNumber: BigInt(blockNumber) } : {
@@ -394643,7 +394687,7 @@ var GearboxSDK = class _GearboxSDK {
394643
394687
  number: block.number,
394644
394688
  timestamp: block.timestamp
394645
394689
  },
394646
- "attach block"
394690
+ `${re}attach block`
394647
394691
  );
394648
394692
  this.#addressProvider = await createAddressProvider(this, addressProvider);
394649
394693
  this.logger?.debug(
@@ -394676,13 +394720,13 @@ var GearboxSDK = class _GearboxSDK {
394676
394720
  try {
394677
394721
  this.#router = createRouter(this);
394678
394722
  } catch (e) {
394679
- this.logger?.warn("Router not found", e);
394723
+ this.logger?.warn("router not found", e);
394680
394724
  }
394681
394725
  const pluginsList = TypedObjectUtils.entries(this.plugins);
394682
394726
  const pluginResponse = await Promise.allSettled(
394683
394727
  pluginsList.map(([name, plugin]) => {
394684
394728
  if (plugin.attach) {
394685
- this.logger?.debug(`attaching plugin ${name}`);
394729
+ this.logger?.debug(`${re}attaching plugin ${name}`);
394686
394730
  return plugin.attach();
394687
394731
  }
394688
394732
  return void 0;
@@ -394691,14 +394735,24 @@ var GearboxSDK = class _GearboxSDK {
394691
394735
  pluginResponse.forEach((r, i) => {
394692
394736
  const [name, plugin] = pluginsList[i];
394693
394737
  if (plugin.attach && r.status === "fulfilled") {
394694
- this.logger?.debug(`attached plugin ${name}`);
394738
+ this.logger?.debug(`${re}attached plugin ${name}`);
394695
394739
  } else if (plugin.attach && r.status === "rejected") {
394696
- this.logger?.error(r.reason, `failed to attach plugin ${name}`);
394740
+ this.logger?.error(r.reason, `failed to ${re}attach plugin ${name}`);
394697
394741
  }
394698
394742
  });
394699
- this.logger?.info(`attach time: ${Date.now() - time} ms`);
394743
+ this.logger?.info(`${re}attach time: ${Date.now() - time} ms`);
394700
394744
  return this;
394701
394745
  }
394746
+ /**
394747
+ * Reattach SDK with the same config as before, without re-creating instance. Will load all state from scratch
394748
+ * Be mindful of block number, for example
394749
+ */
394750
+ async reattach() {
394751
+ if (!this.#attachConfig) {
394752
+ throw new Error("SDK not attached");
394753
+ }
394754
+ await this.#attach(this.#attachConfig);
394755
+ }
394702
394756
  /**
394703
394757
  * Converts contract call into some human-friendly string
394704
394758
  * This method is safe and should not throw
@@ -394801,9 +394855,17 @@ var GearboxSDK = class _GearboxSDK {
394801
394855
  }
394802
394856
  this.#syncing = true;
394803
394857
  this.logger?.debug(`syncing state to block ${blockNumber}...`);
394858
+ const watchAddresses = [
394859
+ ...Array.from(this.marketRegister.watchAddresses),
394860
+ this.addressProvider.address
394861
+ ];
394862
+ this.logger?.debug(
394863
+ `getting logs from ${watchAddresses.length} addresses in [${this.currentBlock}:${blockNumber}]`
394864
+ );
394804
394865
  const logs = await this.provider.publicClient.getLogs({
394805
394866
  fromBlock: this.currentBlock,
394806
- toBlock: blockNumber
394867
+ toBlock: blockNumber,
394868
+ address: watchAddresses
394807
394869
  });
394808
394870
  for (const log2 of logs) {
394809
394871
  const contract = this.contracts.get(log2.address);
@@ -423957,9 +424019,9 @@ function openAccounts() {
423957
424019
  );
423958
424020
  }
423959
424021
  } else if (mode === "stkcvxRLUSDUSDC") {
423960
- const t = sdk.tokensMeta.findBySymbol("stkcvxRLUSDUSDC");
424022
+ const t = sdk.tokensMeta.findBySymbol("stkRLUSD/USDC");
423961
424023
  if (!t) {
423962
- log_default.error(`cannot find stkcvxRLUSDUSDC in tokens meta`);
424024
+ log_default.error(`cannot find stkRLUSD/USDC in tokens meta`);
423963
424025
  return;
423964
424026
  }
423965
424027
  const cms = sdk.marketRegister.creditManagers.filter(
@@ -424088,7 +424150,7 @@ function getRenderer(opts) {
424088
424150
  var package_default = {
424089
424151
  name: "@gearbox-protocol/deploy-tools",
424090
424152
  description: "Gearbox deploy tools",
424091
- version: "5.24.27",
424153
+ version: "5.24.28",
424092
424154
  homepage: "https://gearbox.fi",
424093
424155
  keywords: [
424094
424156
  "gearbox"
@@ -424131,7 +424193,7 @@ var package_default = {
424131
424193
  "@gearbox-protocol/deploy-tools-node": "0.0.0",
424132
424194
  "@gearbox-protocol/deploy-tools-shared": "0.0.0",
424133
424195
  "@gearbox-protocol/deploy-tools-types": "0.0.0",
424134
- "@gearbox-protocol/sdk": "3.0.0-vfour.358",
424196
+ "@gearbox-protocol/sdk": "3.0.0-vfour.359",
424135
424197
  "@gearbox-protocol/sdk-gov": "^2.37.0",
424136
424198
  "@types/lodash-es": "^4.17.12",
424137
424199
  "@types/node": "^22.13.14",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/deploy-tools",
3
3
  "description": "Gearbox deploy tools",
4
- "version": "5.24.27",
4
+ "version": "5.24.28",
5
5
  "homepage": "https://gearbox.fi",
6
6
  "keywords": [
7
7
  "gearbox"
@@ -44,7 +44,7 @@
44
44
  "@gearbox-protocol/deploy-tools-node": "0.0.0",
45
45
  "@gearbox-protocol/deploy-tools-shared": "0.0.0",
46
46
  "@gearbox-protocol/deploy-tools-types": "0.0.0",
47
- "@gearbox-protocol/sdk": "3.0.0-vfour.358",
47
+ "@gearbox-protocol/sdk": "3.0.0-vfour.359",
48
48
  "@gearbox-protocol/sdk-gov": "^2.37.0",
49
49
  "@types/lodash-es": "^4.17.12",
50
50
  "@types/node": "^22.13.14",