@gearbox-protocol/deploy-tools 4.19.2 → 4.20.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 (2) hide show
  1. package/dist/index.mjs +125 -89
  2. package/package.json +2 -1
package/dist/index.mjs CHANGED
@@ -47,9 +47,9 @@ var __toESM = (mod2, isNodeMode, target) => (target = mod2 != null ? __create(__
47
47
  ));
48
48
  var __toCommonJS = (mod2) => __copyProps(__defProp({}, "__esModule", { value: true }), mod2);
49
49
 
50
- // node_modules/commander/lib/error.js
50
+ // ../../node_modules/commander/lib/error.js
51
51
  var require_error = __commonJS({
52
- "node_modules/commander/lib/error.js"(exports2) {
52
+ "../../node_modules/commander/lib/error.js"(exports2) {
53
53
  var CommanderError2 = class extends Error {
54
54
  /**
55
55
  * Constructs the CommanderError class
@@ -84,9 +84,9 @@ var require_error = __commonJS({
84
84
  }
85
85
  });
86
86
 
87
- // node_modules/commander/lib/argument.js
87
+ // ../../node_modules/commander/lib/argument.js
88
88
  var require_argument = __commonJS({
89
- "node_modules/commander/lib/argument.js"(exports2) {
89
+ "../../node_modules/commander/lib/argument.js"(exports2) {
90
90
  var { InvalidArgumentError: InvalidArgumentError2 } = require_error();
91
91
  var Argument2 = class {
92
92
  /**
@@ -205,9 +205,9 @@ var require_argument = __commonJS({
205
205
  }
206
206
  });
207
207
 
208
- // node_modules/commander/lib/help.js
208
+ // ../../node_modules/commander/lib/help.js
209
209
  var require_help = __commonJS({
210
- "node_modules/commander/lib/help.js"(exports2) {
210
+ "../../node_modules/commander/lib/help.js"(exports2) {
211
211
  var { humanReadableArgName } = require_argument();
212
212
  var Help2 = class {
213
213
  constructor() {
@@ -587,9 +587,9 @@ var require_help = __commonJS({
587
587
  }
588
588
  });
589
589
 
590
- // node_modules/commander/lib/option.js
590
+ // ../../node_modules/commander/lib/option.js
591
591
  var require_option = __commonJS({
592
- "node_modules/commander/lib/option.js"(exports2) {
592
+ "../../node_modules/commander/lib/option.js"(exports2) {
593
593
  var { InvalidArgumentError: InvalidArgumentError2 } = require_error();
594
594
  var Option2 = class {
595
595
  /**
@@ -858,9 +858,9 @@ var require_option = __commonJS({
858
858
  }
859
859
  });
860
860
 
861
- // node_modules/commander/lib/suggestSimilar.js
861
+ // ../../node_modules/commander/lib/suggestSimilar.js
862
862
  var require_suggestSimilar = __commonJS({
863
- "node_modules/commander/lib/suggestSimilar.js"(exports2) {
863
+ "../../node_modules/commander/lib/suggestSimilar.js"(exports2) {
864
864
  var maxDistance = 3;
865
865
  function editDistance(a, b3) {
866
866
  if (Math.abs(a.length - b3.length) > maxDistance)
@@ -940,9 +940,9 @@ var require_suggestSimilar = __commonJS({
940
940
  }
941
941
  });
942
942
 
943
- // node_modules/commander/lib/command.js
943
+ // ../../node_modules/commander/lib/command.js
944
944
  var require_command = __commonJS({
945
- "node_modules/commander/lib/command.js"(exports2) {
945
+ "../../node_modules/commander/lib/command.js"(exports2) {
946
946
  var EventEmitter = __require("events").EventEmitter;
947
947
  var childProcess = __require("child_process");
948
948
  var path8 = __require("path");
@@ -2905,9 +2905,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
2905
2905
  }
2906
2906
  });
2907
2907
 
2908
- // node_modules/commander/index.js
2908
+ // ../../node_modules/commander/index.js
2909
2909
  var require_commander = __commonJS({
2910
- "node_modules/commander/index.js"(exports2) {
2910
+ "../../node_modules/commander/index.js"(exports2) {
2911
2911
  var { Argument: Argument2 } = require_argument();
2912
2912
  var { Command: Command2 } = require_command();
2913
2913
  var { CommanderError: CommanderError2, InvalidArgumentError: InvalidArgumentError2 } = require_error();
@@ -2927,6 +2927,25 @@ var require_commander = __commonJS({
2927
2927
  }
2928
2928
  });
2929
2929
 
2930
+ // ../../node_modules/@commander-js/extra-typings/index.js
2931
+ var require_extra_typings = __commonJS({
2932
+ "../../node_modules/@commander-js/extra-typings/index.js"(exports2, module2) {
2933
+ var commander = require_commander();
2934
+ exports2 = module2.exports = {};
2935
+ exports2.program = new commander.Command();
2936
+ exports2.Argument = commander.Argument;
2937
+ exports2.Command = commander.Command;
2938
+ exports2.CommanderError = commander.CommanderError;
2939
+ exports2.Help = commander.Help;
2940
+ exports2.InvalidArgumentError = commander.InvalidArgumentError;
2941
+ exports2.InvalidOptionArgumentError = commander.InvalidArgumentError;
2942
+ exports2.Option = commander.Option;
2943
+ exports2.createCommand = (name) => new commander.Command(name);
2944
+ exports2.createOption = (flags, description) => new commander.Option(flags, description);
2945
+ exports2.createArgument = (name, description) => new commander.Argument(name, description);
2946
+ }
2947
+ });
2948
+
2930
2949
  // ../../node_modules/ws/lib/stream.js
2931
2950
  var require_stream = __commonJS({
2932
2951
  "../../node_modules/ws/lib/stream.js"(exports2, module2) {
@@ -296252,8 +296271,8 @@ var require_server_node = __commonJS({
296252
296271
  }
296253
296272
  });
296254
296273
 
296255
- // node_modules/commander/esm.mjs
296256
- var import_index = __toESM(require_commander(), 1);
296274
+ // ../../node_modules/@commander-js/extra-typings/esm.mjs
296275
+ var import_index = __toESM(require_extra_typings(), 1);
296257
296276
  var {
296258
296277
  program,
296259
296278
  createCommand,
@@ -352478,9 +352497,52 @@ var ZeroLT = class extends ProviderBase {
352478
352497
  }
352479
352498
  };
352480
352499
 
352500
+ // src/commands/new-command.ts
352501
+ function newCommand() {
352502
+ return new Command().addOption(
352503
+ new Option(
352504
+ "--cache-policy <policy>",
352505
+ "never use cache or use cache only"
352506
+ ).choices(["never", "only"])
352507
+ ).addOption(
352508
+ new Option(
352509
+ "--sandbox-dir <dir>",
352510
+ "directory for intermediate results and cache"
352511
+ ).default("./sandbox")
352512
+ ).addOption(new Option("--log-level <info>", "log level")).addOption(
352513
+ new Option("--out-file <json>", "save output as json").env("OUT_FILE")
352514
+ ).addOption(
352515
+ new Option("--pretty", "pretty-print output event when saving to json")
352516
+ ).addOption(
352517
+ new Option("--etherscan-api-key <key>", "etherscan api key").env(
352518
+ "ETHERSCAN_API_KEY"
352519
+ )
352520
+ ).addOption(
352521
+ new Option(
352522
+ "--etherscan-optimism <key>",
352523
+ "etherscan api key for Optimism"
352524
+ ).env("ETHERSCAN_OPTIMISM")
352525
+ ).addOption(
352526
+ new Option(
352527
+ "--etherscan-arbitrum <key>",
352528
+ "etherscan api key for Arbitrum"
352529
+ ).env("ETHERSCAN_ARBITRUM")
352530
+ ).addOption(
352531
+ new Option(
352532
+ "--governance-json <file>",
352533
+ "file with addresses for governance contract overrides"
352534
+ )
352535
+ ).addOption(
352536
+ new Option(
352537
+ "--address-provider-json <file>",
352538
+ "file with address provider address override"
352539
+ )
352540
+ );
352541
+ }
352542
+
352481
352543
  // src/commands/address-tree.ts
352482
352544
  function addressTree() {
352483
- return new Command().name("address-tree").description("builds gearbox addresses tree").addOption(
352545
+ return newCommand().name("address-tree").description("builds gearbox addresses tree").addOption(
352484
352546
  new Option("--rpc-url <url>", "rpc provider url").default("https://rpc.ankr.com/eth").env("RPC_URL")
352485
352547
  ).action(async (opts) => {
352486
352548
  await new GearboxAddressTree(opts).build();
@@ -353484,7 +353546,7 @@ function getTldr({ transactions }) {
353484
353546
 
353485
353547
  // src/commands/audit.ts
353486
353548
  function audit() {
353487
- return new Command().name("audit").description("prints verification + audit info for gearbox address").addArgument(new Argument("<address>", "address to check")).addOption(
353549
+ return newCommand().name("audit").description("prints verification + audit info for gearbox address").addArgument(new Argument("<address>", "address to check")).addOption(
353488
353550
  new Option("--rpc-url <url>", "rpc provider url").default("https://rpc.ankr.com/eth").env("RPC_URL")
353489
353551
  ).action(async (address, opts) => {
353490
353552
  const verifier = new EtherscanVerifier(opts);
@@ -353512,19 +353574,24 @@ function audit() {
353512
353574
  import { readFile as readFile7 } from "node:fs/promises";
353513
353575
  import { request } from "node:https";
353514
353576
  function launchForks() {
353515
- return new Command().name("launch-forks").description("launches anvil-manager test forks from template json file").addOption(
353577
+ return newCommand().name("launch-forks").description("launches anvil-manager test forks from template json file").addOption(
353516
353578
  new Option(
353517
353579
  "--endpoint <url>",
353518
353580
  "Endpoint to call for fork creation"
353519
353581
  ).default("https://anvil.gearbox.foundation/api/forks")
353520
- ).addOption(new Option("--no-wait", "Ignore response")).addOption(new Option("--api-key <key>", "anvil-manager api key")).addOption(
353582
+ ).addOption(new Option("--no-wait", "Ignore response")).addOption(
353583
+ new Option(
353584
+ "--api-key <key>",
353585
+ "anvil-manager api key"
353586
+ ).makeOptionMandatory()
353587
+ ).addOption(
353521
353588
  new Option(
353522
353589
  "--template <json_file>",
353523
353590
  "Json file with POST requests payloads"
353524
- )
353591
+ ).makeOptionMandatory()
353525
353592
  ).addOption(
353526
353593
  new Option(
353527
- "--release [version]",
353594
+ "--release <version>",
353528
353595
  "release name to interpolate inside json files"
353529
353596
  ).default("")
353530
353597
  ).action(async (opts) => {
@@ -353619,20 +353686,20 @@ function getRenderer(opts) {
353619
353686
  }
353620
353687
 
353621
353688
  // package.json
353622
- var version3 = "4.19.2";
353689
+ var version3 = "4.20.0";
353623
353690
 
353624
353691
  // src/version.ts
353625
353692
  var version_default = version3;
353626
353693
 
353627
353694
  // src/commands/parse.ts
353628
353695
  function parse() {
353629
- return new Command().name("parse").description(
353696
+ return newCommand().name("parse").description(
353630
353697
  "displays protocol updates from safe multisig or from batch json files"
353631
353698
  ).addOption(
353632
353699
  new Option("--rpc-url <url>", "rpc provider url").default("https://rpc.ankr.com/eth").env("RPC_URL")
353633
353700
  ).addOption(
353634
353701
  new Option(
353635
- "--batch-dir [dir]",
353702
+ "--batch-dir <dir>",
353636
353703
  "Directory (can be recursive) with batch and meta jsons"
353637
353704
  )
353638
353705
  ).addOption(
@@ -353646,33 +353713,43 @@ function parse() {
353646
353713
  // TODO: remove me when we fix audits in meta
353647
353714
  "Load meta from repo even when parsing batches from json"
353648
353715
  )
353649
- ).addOption(new Option("--renderer [cli|html]", "cli or html")).addOption(
353716
+ ).addOption(
353717
+ new Option("--renderer <renderer>", "cli or html").choices([
353718
+ "cli",
353719
+ "html"
353720
+ ])
353721
+ ).addOption(
353650
353722
  new Option(
353651
353723
  "-i, --interactive",
353652
353724
  "Interactive navigation for pretty-print"
353653
353725
  )
353654
- ).addOption(new Option("--html-file [file]", "output html file")).action(
353655
- async (opts) => {
353656
- container.auditor = new Auditor(opts);
353657
- await container.auditor.setup();
353658
- container.addressTree = new GearboxAddressTree(opts);
353659
- await container.addressTree.build();
353660
- const parser = new UpdateParser(opts, version_default);
353661
- const result = await parser.parse(opts);
353662
- if (opts.outFile) {
353663
- await writeFile4(opts.outFile, json_stringify(result), "utf-8");
353664
- }
353665
- const renderer = getRenderer(opts);
353666
- return renderer?.render(result);
353667
- }
353668
- );
353726
+ ).addOption(
353727
+ new Option(
353728
+ "--html-file <file>",
353729
+ "output html file"
353730
+ ).makeOptionMandatory()
353731
+ ).action(async (opts) => {
353732
+ container.auditor = new Auditor(opts);
353733
+ await container.auditor.setup();
353734
+ container.addressTree = new GearboxAddressTree(opts);
353735
+ await container.addressTree.build();
353736
+ const parser = new UpdateParser(opts, version_default);
353737
+ const result = await parser.parse(opts);
353738
+ if (opts.outFile) {
353739
+ await writeFile4(opts.outFile, json_stringify(result), "utf-8");
353740
+ }
353741
+ const renderer = getRenderer(opts);
353742
+ return renderer?.render(result);
353743
+ });
353669
353744
  }
353670
353745
 
353671
353746
  // src/commands/print-safe-tx.ts
353672
353747
  var Printer = class extends ProviderBase {
353673
353748
  };
353674
353749
  function printSafeTx() {
353675
- return new Command().name("print-safe-tx").description("Gets transaction from Safe API and prints json").addArgument(new Argument("<safeTxHash>", "Safe tx hash")).action(async (safeTxHash, options) => {
353750
+ return newCommand().name("print-safe-tx").description("Gets transaction from Safe API and prints json").addArgument(new Argument("<safeTxHash>", "Safe tx hash")).addOption(
353751
+ new Option("--rpc-url <url>", "rpc provider url").default("https://rpc.ankr.com/eth").env("RPC_URL")
353752
+ ).action(async (safeTxHash, options) => {
353676
353753
  const printer = new Printer(options);
353677
353754
  const txs = await printer.getSafeTransactions([safeTxHash]);
353678
353755
  console.log(json_stringify(txs[0]));
@@ -353682,16 +353759,16 @@ function printSafeTx() {
353682
353759
  // src/commands/verify-etherscan.ts
353683
353760
  import { readFile as readFile8 } from "node:fs/promises";
353684
353761
  function verifyEtherscan() {
353685
- return new Command().name("verify-etherscan").description(
353762
+ return newCommand().name("verify-etherscan").description(
353686
353763
  "performs bulk verification of gearbox contracts using etherscan"
353687
353764
  ).addOption(
353688
353765
  new Option("--rpc-url <url>", "rpc provider url").default("https://rpc.ankr.com/eth").env("RPC_URL")
353689
353766
  ).addOption(
353690
353767
  new Option(
353691
- "--addresses-file [json]",
353768
+ "--addresses-file <json>",
353692
353769
  "json file where keys are addresses to verify, e.g. gearbox contracts tree"
353693
353770
  )
353694
- ).addOption(new Option("--addresses [addr...]", "addresses to verify")).action(async (opts) => {
353771
+ ).addOption(new Option("--addresses <addr...>", "addresses to verify")).action(async (opts) => {
353695
353772
  if (!opts.addresses?.length && !opts.addressesFile) {
353696
353773
  throw new Error("please specify addresses or addresses file");
353697
353774
  }
@@ -353711,10 +353788,10 @@ function verifyEtherscan() {
353711
353788
 
353712
353789
  // src/commands/zero-lt.ts
353713
353790
  function zeroLT() {
353714
- return new Command().name("zero-lt").description("sets LTs to zero on credit managers").addOption(
353791
+ return newCommand().name("zero-lt").description("sets LTs to zero on credit managers").addOption(
353715
353792
  new Option("--anvil-url <url>", "anvil rpc url").default("http://127.0.0.1:8545").env("ANVIL_URL")
353716
- ).addOption(new Option("--cm [address]", "Single credit manager option")).action(async (opts) => {
353717
- const zlt = new ZeroLT(opts);
353793
+ ).addOption(new Option("--cm <address>", "Single credit manager option")).action(async ({ anvilUrl, ...opts }) => {
353794
+ const zlt = new ZeroLT({ ...opts, rpcUrl: anvilUrl });
353718
353795
  await zlt.setLtZero(opts);
353719
353796
  });
353720
353797
  }
@@ -353729,47 +353806,6 @@ program2.addCommand(parse());
353729
353806
  program2.addCommand(printSafeTx());
353730
353807
  program2.addCommand(verifyEtherscan());
353731
353808
  program2.addCommand(zeroLT());
353732
- program2.commands.forEach((cmd) => {
353733
- cmd.addOption(
353734
- new Option(
353735
- "--cache-policy [never|only]",
353736
- "never use cache or use cache only"
353737
- )
353738
- ).addOption(
353739
- new Option(
353740
- "--sandbox-dir <dir>",
353741
- "directory for intermediate results and cache"
353742
- ).default("./sandbox")
353743
- ).addOption(new Option("--log-level [info]", "log level")).addOption(
353744
- new Option("--out-file [json]", "save output as json").env("OUT_FILE")
353745
- ).addOption(
353746
- new Option("--pretty", "pretty-print output event when saving to json")
353747
- ).addOption(
353748
- new Option("--etherscan-api-key [key]", "etherscan api key").env(
353749
- "ETHERSCAN_API_KEY"
353750
- )
353751
- ).addOption(
353752
- new Option(
353753
- "--etherscan-optimism [key]",
353754
- "etherscan api key for Optimism"
353755
- ).env("ETHERSCAN_OPTIMISM")
353756
- ).addOption(
353757
- new Option(
353758
- "--etherscan-arbitrum [key]",
353759
- "etherscan api key for Arbitrum"
353760
- ).env("ETHERSCAN_ARBITRUM")
353761
- ).addOption(
353762
- new Option(
353763
- "--governance-json [file]",
353764
- "file with addresses for governance contract overrides"
353765
- )
353766
- ).addOption(
353767
- new Option(
353768
- "--address-provider-json [file]",
353769
- "file with address provider address override"
353770
- )
353771
- );
353772
- });
353773
353809
  program2.parse();
353774
353810
  /*! Bundled license information:
353775
353811
 
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.19.2",
4
+ "version": "4.20.0",
5
5
  "homepage": "https://gearbox.fi",
6
6
  "keywords": [
7
7
  "gearbox"
@@ -37,6 +37,7 @@
37
37
  "devDependencies": {
38
38
  "@actions/core": "^1.10.1",
39
39
  "@chialab/esbuild-plugin-commonjs": "^0.18.0",
40
+ "@commander-js/extra-typings": "^12.0.1",
40
41
  "@ethereum-sourcify/bytecode-utils": "^1.2.1",
41
42
  "@ethereum-sourcify/lib-sourcify": "^1.4.1",
42
43
  "@gearbox-protocol/deploy-tools-node": "0.0.0",