@gearbox-protocol/deploy-tools 5.24.7 → 5.24.8

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 +49 -53
  2. package/package.json +2 -2
package/dist/index.mjs CHANGED
@@ -385119,19 +385119,22 @@ var RedstoneUpdater = class extends SDKConstruct {
385119
385119
  group,
385120
385120
  uniqueSignersCount
385121
385121
  );
385122
- for (const { dataFeedId, data, timestamp } of payloads) {
385122
+ for (const { dataFeedId, data, timestamp, cached } of payloads) {
385123
385123
  const priceFeed = priceFeeds.get(dataFeedId);
385124
385124
  if (!priceFeed) {
385125
385125
  throw new Error(`cannot get price feed address for ${dataFeedId}`);
385126
385126
  }
385127
385127
  results.push({
385128
+ dataFeedId,
385129
+ dataServiceId,
385128
385130
  priceFeed: priceFeed.address.toLowerCase(),
385129
385131
  tx: priceFeed.createRawTx({
385130
385132
  functionName: "updatePrice",
385131
385133
  args: [data],
385132
385134
  description: `updating price for ${dataFeedId} [${this.sdk.provider.addressLabels.get(priceFeed.address)}]`
385133
385135
  }),
385134
- timestamp
385136
+ timestamp,
385137
+ cached
385135
385138
  });
385136
385139
  }
385137
385140
  }
@@ -385164,7 +385167,7 @@ var RedstoneUpdater = class extends SDKConstruct {
385164
385167
  );
385165
385168
  const cached = this.#cache.get(key);
385166
385169
  if (this.#historicalTimestampMs && !!cached) {
385167
- fromCache.push(cached);
385170
+ fromCache.push({ ...cached, cached: true });
385168
385171
  } else {
385169
385172
  uncached.push(dataFeedId);
385170
385173
  }
@@ -385281,7 +385284,8 @@ function getCalldataWithTimestamp(dataFeedId, packages, unsignedMetadata) {
385281
385284
  [{ type: "uint256" }, { type: "bytes" }],
385282
385285
  [BigInt(timestamp), `0x${payload}`]
385283
385286
  ),
385284
- timestamp
385287
+ timestamp,
385288
+ cached: false
385285
385289
  };
385286
385290
  }
385287
385291
 
@@ -385338,6 +385342,7 @@ var PriceFeedRegister = class extends SDKConstruct {
385338
385342
  logger;
385339
385343
  #hooks = new Hooks();
385340
385344
  #feeds = new AddressMap(void 0, "priceFeeds");
385345
+ #latestUpdate;
385341
385346
  redstoneUpdater;
385342
385347
  constructor(sdk) {
385343
385348
  super(sdk);
@@ -385403,42 +385408,13 @@ var PriceFeedRegister = class extends SDKConstruct {
385403
385408
  this.logger?.debug(`loaded ${result.length} partial updatable price feeds`);
385404
385409
  return result.map((baseParams) => this.#createUpdatableProxy({ baseParams }));
385405
385410
  }
385406
- /**
385407
- * Generates price update transaction via multicall3 without any market data knowledge
385408
- *
385409
- * @deprecated TODO: seems that it's not used anywhere
385410
- *
385411
- * @param marketConfigurators
385412
- * @param pools
385413
- * @returns
385414
- */
385415
- async getUpdatePriceFeedsTx(marketConfigurators, pools) {
385416
- const feeds = await this.getPartialUpdatablePriceFeeds(
385417
- marketConfigurators,
385418
- pools
385419
- );
385420
- const updates = await this.#generatePriceFeedsUpdateTxs(feeds);
385421
- return createRawTx(
385422
- getChainContractAddress({
385423
- chain: this.sdk.provider.chain,
385424
- contract: "multicall3"
385425
- }),
385426
- {
385427
- abi: multicall3Abi,
385428
- functionName: "aggregate3",
385429
- args: [
385430
- updates.txs.map((tx) => ({
385431
- target: tx.to,
385432
- allowFailure: false,
385433
- callData: tx.callData
385434
- }))
385435
- ]
385436
- }
385437
- );
385438
- }
385439
385411
  async #generatePriceFeedsUpdateTxs(updateables, logContext = {}) {
385440
385412
  const txs = [];
385441
385413
  const redstonePFs = [];
385414
+ const latestUpdate = {
385415
+ redstone: [],
385416
+ timestamp: Date.now()
385417
+ };
385442
385418
  for (const pf of updateables) {
385443
385419
  if (isRedstone(pf)) {
385444
385420
  redstonePFs.push(pf);
@@ -385450,11 +385426,12 @@ var PriceFeedRegister = class extends SDKConstruct {
385450
385426
  redstonePFs,
385451
385427
  logContext
385452
385428
  );
385453
- for (const { tx, timestamp } of redstoneUpdates) {
385429
+ for (const { tx, timestamp, ...rest } of redstoneUpdates) {
385454
385430
  if (timestamp > maxTimestamp) {
385455
385431
  maxTimestamp = timestamp;
385456
385432
  }
385457
385433
  txs.push(tx);
385434
+ latestUpdate.redstone.push({ ...rest, timestamp });
385458
385435
  }
385459
385436
  }
385460
385437
  const result = { txs, timestamp: maxTimestamp };
@@ -385465,6 +385442,7 @@ var PriceFeedRegister = class extends SDKConstruct {
385465
385442
  if (txs.length) {
385466
385443
  await this.#hooks.triggerHooks("updatesGenerated", result);
385467
385444
  }
385445
+ this.#latestUpdate = latestUpdate;
385468
385446
  return result;
385469
385447
  }
385470
385448
  create(data) {
@@ -385526,6 +385504,12 @@ var PriceFeedRegister = class extends SDKConstruct {
385526
385504
  }
385527
385505
  });
385528
385506
  }
385507
+ /**
385508
+ * Information update latest update of updatable price feeds, for diagnostic purposes
385509
+ */
385510
+ get latestUpdate() {
385511
+ return this.#latestUpdate;
385512
+ }
385529
385513
  };
385530
385514
 
385531
385515
  // ../../node_modules/@gearbox-protocol/sdk/dist/esm/sdk/market/pricefeeds/utils.js
@@ -386629,11 +386613,24 @@ var MarketRegister = class extends SDKConstruct {
386629
386613
  get marketFilter() {
386630
386614
  return this.#marketFilter;
386631
386615
  }
386632
- async syncState() {
386633
- const pools = this.markets.filter((m) => m.dirty).map((m) => m.pool.pool.address);
386634
- if (pools.length) {
386635
- this.#logger?.debug(`need to reload ${pools.length} markets`);
386636
- await this.#loadMarkets([], pools);
386616
+ async syncState(skipPriceUpdate) {
386617
+ const dirtyPools = [];
386618
+ const nonDirtyOracles = [];
386619
+ for (const m of this.markets) {
386620
+ if (m.dirty) {
386621
+ dirtyPools.push(m.pool.pool.address);
386622
+ } else {
386623
+ nonDirtyOracles.push(m.priceOracle.address);
386624
+ }
386625
+ }
386626
+ if (dirtyPools.length) {
386627
+ this.#logger?.debug(`need to reload ${dirtyPools.length} markets`);
386628
+ await this.#loadMarkets([], dirtyPools);
386629
+ } else if (!skipPriceUpdate && nonDirtyOracles.length) {
386630
+ this.#logger?.debug(
386631
+ `syncing prices on ${nonDirtyOracles.length} oracles`
386632
+ );
386633
+ await this.updatePrices(nonDirtyOracles);
386637
386634
  }
386638
386635
  }
386639
386636
  async #loadMarkets(configurators, pools, ignoreUpdateablePrices) {
@@ -389577,6 +389574,9 @@ var GearStakingContract = class extends BaseContract {
389577
389574
  }
389578
389575
  };
389579
389576
 
389577
+ // ../../node_modules/@gearbox-protocol/sdk/dist/esm/sdk/plugins/defaultPlugins.js
389578
+ var defaultPlugins = {};
389579
+
389580
389580
  // ../../node_modules/@gearbox-protocol/sdk/dist/esm/sdk/plugins/V300StalenessPeriodPlugin.js
389581
389581
  var V300StalenessPeriodPlugin = class extends SDKConstruct {
389582
389582
  #syncedTo;
@@ -389635,11 +389635,6 @@ var V300StalenessPeriodPlugin = class extends SDKConstruct {
389635
389635
  }
389636
389636
  };
389637
389637
 
389638
- // ../../node_modules/@gearbox-protocol/sdk/dist/esm/sdk/plugins/defaultPlugins.js
389639
- var defaultPlugins = {
389640
- stalenessV300: V300StalenessPeriodPlugin
389641
- };
389642
-
389643
389638
  // ../../node_modules/@gearbox-protocol/sdk/dist/esm/sdk/GearboxSDK.js
389644
389639
  var ERR_NOT_ATTACHED = new Error("Gearbox SDK not attached");
389645
389640
  var GearboxSDK = class _GearboxSDK {
@@ -389913,7 +389908,7 @@ var GearboxSDK = class _GearboxSDK {
389913
389908
  * @returns
389914
389909
  */
389915
389910
  async syncState(opts) {
389916
- let { blockNumber, timestamp } = opts ?? {};
389911
+ let { blockNumber, timestamp, skipPriceUpdate } = opts ?? {};
389917
389912
  if (!blockNumber || !timestamp) {
389918
389913
  const block = await this.provider.publicClient.getBlock({
389919
389914
  blockTag: "latest"
@@ -389944,7 +389939,7 @@ var GearboxSDK = class _GearboxSDK {
389944
389939
  contract.processLog(event);
389945
389940
  }
389946
389941
  }
389947
- await this.marketRegister.syncState();
389942
+ await this.marketRegister.syncState(skipPriceUpdate);
389948
389943
  this.#currentBlock = blockNumber;
389949
389944
  this.#timestamp = timestamp;
389950
389945
  await this.#hooks.triggerHooks("syncState", { blockNumber, timestamp });
@@ -419100,7 +419095,7 @@ function getRenderer(opts) {
419100
419095
  var package_default = {
419101
419096
  name: "@gearbox-protocol/deploy-tools",
419102
419097
  description: "Gearbox deploy tools",
419103
- version: "5.24.7",
419098
+ version: "5.24.8",
419104
419099
  homepage: "https://gearbox.fi",
419105
419100
  keywords: [
419106
419101
  "gearbox"
@@ -419143,7 +419138,7 @@ var package_default = {
419143
419138
  "@gearbox-protocol/deploy-tools-node": "0.0.0",
419144
419139
  "@gearbox-protocol/deploy-tools-shared": "0.0.0",
419145
419140
  "@gearbox-protocol/deploy-tools-types": "0.0.0",
419146
- "@gearbox-protocol/sdk": "3.0.0-vfour.318",
419141
+ "@gearbox-protocol/sdk": "3.0.0-vfour.324",
419147
419142
  "@gearbox-protocol/sdk-gov": "^2.36.6",
419148
419143
  "@types/lodash-es": "^4.17.12",
419149
419144
  "@types/node": "^22.13.10",
@@ -419804,7 +419799,8 @@ function sdkExample() {
419804
419799
  plugins: {
419805
419800
  adapters: AdaptersPlugin,
419806
419801
  zappers: ZappersPlugin,
419807
- bots: BotsPlugin
419802
+ bots: BotsPlugin,
419803
+ stalenessV300: V300StalenessPeriodPlugin
419808
419804
  }
419809
419805
  });
419810
419806
  await writeFile7(
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.7",
4
+ "version": "5.24.8",
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.318",
47
+ "@gearbox-protocol/sdk": "3.0.0-vfour.324",
48
48
  "@gearbox-protocol/sdk-gov": "^2.36.6",
49
49
  "@types/lodash-es": "^4.17.12",
50
50
  "@types/node": "^22.13.10",