@gearbox-protocol/deploy-tools 4.1.1 → 4.2.0-next.1

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 +42 -30
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -317756,8 +317756,8 @@ function compareAudited(a, b3) {
317756
317756
  }
317757
317757
 
317758
317758
  // ../../packages/node/dist/helpers/batches.js
317759
- function normalizeTransactions(tx) {
317760
- return tx.transactions.map((t) => {
317759
+ function normalizeTransactions(batch) {
317760
+ return batch.transactions.map((t) => {
317761
317761
  if (
317762
317762
  // t.to === GOVERNOR_V3_ADDRESS &&
317763
317763
  t.contractMethod.name === "startBatch"
@@ -317765,9 +317765,9 @@ function normalizeTransactions(tx) {
317765
317765
  return {
317766
317766
  target: t.to,
317767
317767
  value: t.value,
317768
- signature: "startBatch()",
317768
+ signature: "startBatch(uint80)",
317769
317769
  parameters: [],
317770
- data: id2("startBatch()").substring(0, 10),
317770
+ data: id2("startBatch(uint80)").substring(0, 10) + toQuantity2(t.contractInputsValues.eta).replace("0x", "").padStart(64, "0"),
317771
317771
  eta: t.contractInputsValues.eta
317772
317772
  };
317773
317773
  }
@@ -317818,6 +317818,30 @@ function normalizeTimelockTx(t) {
317818
317818
  eta: t.contractInputsValues.eta
317819
317819
  };
317820
317820
  }
317821
+ function normalizeSafeApiBatch(tx) {
317822
+ const transactions = tx.dataDecoded.parameters[0].valueDecoded.map((t) => ({
317823
+ to: t.to,
317824
+ value: t.value,
317825
+ contractMethod: {
317826
+ name: t.dataDecoded.method,
317827
+ inputs: t.dataDecoded.parameters.map((p) => ({
317828
+ name: p.name,
317829
+ type: p.type
317830
+ })),
317831
+ payable: false
317832
+ },
317833
+ contractInputsValues: Object.fromEntries(t.dataDecoded.parameters.map((p) => [p.name, p.value]))
317834
+ }));
317835
+ return {
317836
+ id: tx.safeTxHash,
317837
+ safeTxHash: tx.safeTxHash,
317838
+ description: "",
317839
+ // TODO
317840
+ transactions: normalizeTransactions({ transactions }),
317841
+ type: "governor"
317842
+ // TODO: determine, or wait till they are made the same in deploy-v3
317843
+ };
317844
+ }
317821
317845
 
317822
317846
  // ../../packages/node/dist/helpers/fs.js
317823
317847
  import { readdir } from "node:fs/promises";
@@ -323121,7 +323145,7 @@ var GearboxAddressTree = class _GearboxAddressTree extends ProviderBase {
323121
323145
 
323122
323146
  // ../../packages/node/dist/UpdateParser.js
323123
323147
  import { mkdirSync as mkdirSync5 } from "node:fs";
323124
- import { readdir as readdir2, rm as rm2, stat } from "node:fs/promises";
323148
+ import { readdir as readdir2, stat } from "node:fs/promises";
323125
323149
  import path7 from "node:path";
323126
323150
 
323127
323151
  // ../../packages/node/dist/DeployResult.js
@@ -325192,7 +325216,7 @@ var GearStakingV3Parser = class extends AbstractParser {
325192
325216
  var GovernorV3Parser = class extends AbstractParser {
325193
325217
  constructor(contractType) {
325194
325218
  super(contractType, "constructor(address _timeLock, address _queueAdmin, address _vetoAdmin)");
325195
- this._iFace = augmentInterface(IGovernor__factory.createInterface(), "function startBatch() external");
325219
+ this._iFace = augmentInterface(IGovernor__factory.createInterface(), "function startBatch(uint80) external");
325196
325220
  }
325197
325221
  };
325198
325222
 
@@ -325577,10 +325601,8 @@ var UpdateParser = class extends ProviderBase {
325577
325601
  }
325578
325602
  async parse(opts) {
325579
325603
  await this.init();
325580
- const { batchRepo, batchCommittish, batchDir, safeTxHashes } = opts;
325581
- if (!!batchRepo && !!batchCommittish && !!batchDir) {
325582
- await this.#parseBatchRepoDir(batchRepo, batchCommittish, batchDir);
325583
- } else if (batchDir) {
325604
+ const { batchDir, safeTxHashes } = opts;
325605
+ if (batchDir) {
325584
325606
  await this.#parseBatchDir(batchDir);
325585
325607
  } else {
325586
325608
  await this.#parseSafeTxHashes(safeTxHashes);
@@ -325589,19 +325611,16 @@ var UpdateParser = class extends ProviderBase {
325589
325611
  return this.#output;
325590
325612
  }
325591
325613
  async #parseSafeTxHashes(hashes) {
325592
- const txs = this.getSafeTransactions(hashes);
325593
- }
325594
- async #parseBatchRepoDir(repo, committish, dir) {
325595
- await cloneRepo({
325596
- repo,
325597
- sandboxDir: this.#sandboxDir,
325598
- commit: committish,
325599
- destDir: path7.join(repo, committish)
325600
- });
325601
- const batchDir = path7.resolve(this.#sandboxDir, repo, committish, dir);
325602
- this.logger.debug(`will parse batches from ${batchDir}`);
325603
- await this.#parseBatchDir(batchDir);
325604
- await rm2(this.#sandboxDir, { force: true, recursive: true });
325614
+ const txs = await this.getSafeTransactions(hashes);
325615
+ const total = txs.length;
325616
+ if (!total) {
325617
+ this.logger.warn("no safe transactions to parse");
325618
+ return;
325619
+ }
325620
+ for (let i = 0; i < txs.length; i++) {
325621
+ const parsed = await this.#parseNormalizedBatch(normalizeSafeApiBatch(txs[i]), i, total);
325622
+ this.#output.batches.push(parsed);
325623
+ }
325605
325624
  }
325606
325625
  async #parseBatchDir(dir) {
325607
325626
  const batchStat = await stat(dir);
@@ -326877,13 +326896,6 @@ function parse() {
326877
326896
  return new Command().name("parse").description(
326878
326897
  "displays protocol updates from safe multisig or from batch json files"
326879
326898
  ).addOption(RpcURL()).addOption(
326880
- new Option(
326881
- "--batch-repo [repo]",
326882
- "Github repository with batch json files"
326883
- )
326884
- ).addOption(
326885
- new Option("--batch-committish [repo]", "Github repository committish")
326886
- ).addOption(
326887
326899
  new Option(
326888
326900
  "--batch-dir [dir]",
326889
326901
  "Directory (can be recursive) with batch and meta jsons"
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": "4.1.1",
4
+ "version": "4.2.0-next.1",
5
5
  "homepage": "https://gearbox.fi",
6
6
  "keywords": [
7
7
  "gearbox"