@gearbox-protocol/deploy-tools 5.24.31 → 5.24.32

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 +63 -30
  2. package/package.json +2 -2
package/dist/index.mjs CHANGED
@@ -377125,7 +377125,7 @@ var BaseContract = class extends SDKConstruct {
377125
377125
  constructor(sdk, args) {
377126
377126
  super(sdk);
377127
377127
  this.abi = args.abi;
377128
- this.#address = args.addr;
377128
+ this.#address = getAddress(args.addr);
377129
377129
  this.contract = getContract({
377130
377130
  address: this.address,
377131
377131
  // add exceptions for better error decoding
@@ -377150,11 +377150,7 @@ var BaseContract = class extends SDKConstruct {
377150
377150
  if (this.#address !== ADDRESS_0X0) {
377151
377151
  throw new Error(`Address can't be changed, currently: ${this.#address}`);
377152
377152
  }
377153
- this.#address = address;
377154
- this.addressLabels.set(address, this.#name);
377155
- }
377156
- test_setAddress(address) {
377157
- this.#address = address;
377153
+ this.#address = getAddress(address);
377158
377154
  this.addressLabels.set(address, this.#name);
377159
377155
  }
377160
377156
  get name() {
@@ -385944,6 +385940,34 @@ var CreditAccountsService = class extends SDKConstruct {
385944
385940
  const tx = cm.creditFacade.multicall(ca.creditAccount, calls);
385945
385941
  return { tx, calls, creditFacade: cm.creditFacade };
385946
385942
  }
385943
+ /**
385944
+ * Executes enable/disable tokens specified by given tokens lists and token prices
385945
+ * @param {RouterCASlice} creditAccount - minimal credit account data {@link RouterCASlice} on which operation is performed
385946
+ * @param {Array<Asset>} enabledTokens - list of tokens to enable {@link Asset};
385947
+ * @param {Array<Asset>} disabledTokens - list of tokens to disable {@link Asset};
385948
+ * @returns All necessary data to execute the transaction (call, credit facade)
385949
+ */
385950
+ async enableTokens({
385951
+ enabledTokens,
385952
+ disabledTokens,
385953
+ creditAccount: ca
385954
+ }) {
385955
+ const cm = this.sdk.marketRegister.findCreditManager(ca.creditManager);
385956
+ const priceUpdatesCalls = await this.getPriceUpdatesForFacade(
385957
+ ca.creditManager,
385958
+ ca,
385959
+ void 0
385960
+ );
385961
+ const calls = [
385962
+ ...priceUpdatesCalls,
385963
+ ...disabledTokens.map(
385964
+ (token) => this.#prepareDisableToken(ca.creditFacade, token)
385965
+ ),
385966
+ ...this.#prepareEnableTokens(ca.creditFacade, enabledTokens)
385967
+ ];
385968
+ const tx = cm.creditFacade.multicall(ca.creditAccount, calls);
385969
+ return { tx, calls, creditFacade: cm.creditFacade };
385970
+ }
385947
385971
  /**
385948
385972
  * Executes swap specified by given calls, update quotas of affected tokens
385949
385973
  - Open credit account is executed in the following order: price update -> increase debt -> add collateral ->
@@ -392773,7 +392797,9 @@ var RedstoneUpdater = class extends SDKConstruct {
392773
392797
  groupedFeeds[key] = /* @__PURE__ */ new Set();
392774
392798
  }
392775
392799
  groupedFeeds[key].add(feed.dataId);
392776
- priceFeeds.set(feed.dataId, feed);
392800
+ const pfsForDataId = priceFeeds.get(feed.dataId) ?? new AddressMap();
392801
+ pfsForDataId.upsert(feed.address, feed);
392802
+ priceFeeds.set(feed.dataId, pfsForDataId);
392777
392803
  }
392778
392804
  const results = [];
392779
392805
  for (const [key, group] of Object.entries(groupedFeeds)) {
@@ -392785,26 +392811,28 @@ var RedstoneUpdater = class extends SDKConstruct {
392785
392811
  uniqueSignersCount
392786
392812
  );
392787
392813
  for (const { dataFeedId, data, timestamp, cached } of payloads) {
392788
- const priceFeed = priceFeeds.get(dataFeedId);
392789
- if (!priceFeed) {
392790
- throw new Error(`cannot get price feed address for ${dataFeedId}`);
392791
- }
392792
- results.push(
392793
- new RedstoneUpdateTx(
392794
- priceFeed.createRawTx({
392795
- functionName: "updatePrice",
392796
- args: [data],
392797
- description: `updating price for ${dataFeedId} [${this.sdk.provider.addressLabels.get(priceFeed.address)}]`
392798
- }),
392799
- {
392800
- dataFeedId,
392801
- dataServiceId,
392802
- priceFeed: priceFeed.address.toLowerCase(),
392803
- timestamp,
392804
- cached
392805
- }
392806
- )
392807
- );
392814
+ const pfsForDataId = priceFeeds.get(dataFeedId);
392815
+ if (!pfsForDataId) {
392816
+ throw new Error(`cannot get price feed addresses for ${dataFeedId}`);
392817
+ }
392818
+ for (const priceFeed of pfsForDataId.values()) {
392819
+ results.push(
392820
+ new RedstoneUpdateTx(
392821
+ priceFeed.createRawTx({
392822
+ functionName: "updatePrice",
392823
+ args: [data],
392824
+ description: `updating price for ${dataFeedId} [${this.labelAddress(priceFeed.address)}]`
392825
+ }),
392826
+ {
392827
+ dataFeedId,
392828
+ dataServiceId,
392829
+ priceFeed: priceFeed.address,
392830
+ timestamp,
392831
+ cached
392832
+ }
392833
+ )
392834
+ );
392835
+ }
392808
392836
  }
392809
392837
  }
392810
392838
  this.#logger?.debug(
@@ -413631,7 +413659,12 @@ var ForkTemplate = z.object({
413631
413659
  * @-7200 = previous Monday 12:00 UTC -7200 blocks
413632
413660
  */
413633
413661
  blockNumber: z.string().nullish().transform((v) => v || void 0),
413634
- scripts: z.array(ScriptTemplate).nullish(),
413662
+ scripts: z.array(ScriptTemplate).nullish().refine((scripts) => {
413663
+ const ids = scripts?.map((s) => s.id) ?? [];
413664
+ return ids.length === new Set(ids).size;
413665
+ }, {
413666
+ message: "scripts must have unique ids"
413667
+ }),
413635
413668
  /**
413636
413669
  * Will append deploy-report generation to scripts
413637
413670
  */
@@ -424269,7 +424302,7 @@ function getRenderer(opts) {
424269
424302
  var package_default = {
424270
424303
  name: "@gearbox-protocol/deploy-tools",
424271
424304
  description: "Gearbox deploy tools",
424272
- version: "5.24.31",
424305
+ version: "5.24.32",
424273
424306
  homepage: "https://gearbox.fi",
424274
424307
  keywords: [
424275
424308
  "gearbox"
@@ -424312,7 +424345,7 @@ var package_default = {
424312
424345
  "@gearbox-protocol/deploy-tools-node": "0.0.0",
424313
424346
  "@gearbox-protocol/deploy-tools-shared": "0.0.0",
424314
424347
  "@gearbox-protocol/deploy-tools-types": "0.0.0",
424315
- "@gearbox-protocol/sdk": "3.0.0-vfour.388",
424348
+ "@gearbox-protocol/sdk": "3.0.0-vfour.392",
424316
424349
  "@gearbox-protocol/sdk-gov": "^2.37.0",
424317
424350
  "@types/lodash-es": "^4.17.12",
424318
424351
  "@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.31",
4
+ "version": "5.24.32",
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.388",
47
+ "@gearbox-protocol/sdk": "3.0.0-vfour.392",
48
48
  "@gearbox-protocol/sdk-gov": "^2.37.0",
49
49
  "@types/lodash-es": "^4.17.12",
50
50
  "@types/node": "^22.13.14",