@gearbox-protocol/deploy-tools 5.18.10 → 5.19.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 +126 -43
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -299913,15 +299913,15 @@ var require_crc32 = __commonJS({
299913
299913
  "use strict";
299914
299914
  var utils = require_utils35();
299915
299915
  function makeTable() {
299916
- var c, table2 = [];
299916
+ var c, table3 = [];
299917
299917
  for (var n = 0; n < 256; n++) {
299918
299918
  c = n;
299919
299919
  for (var k = 0; k < 8; k++) {
299920
299920
  c = c & 1 ? 3988292384 ^ c >>> 1 : c >>> 1;
299921
299921
  }
299922
- table2[n] = c;
299922
+ table3[n] = c;
299923
299923
  }
299924
- return table2;
299924
+ return table3;
299925
299925
  }
299926
299926
  var crcTable = makeTable();
299927
299927
  function crc32(crc, buf, len, pos) {
@@ -300919,15 +300919,15 @@ var require_crc322 = __commonJS({
300919
300919
  "../../node_modules/pako/lib/zlib/crc32.js"(exports2, module2) {
300920
300920
  "use strict";
300921
300921
  function makeTable() {
300922
- var c, table2 = [];
300922
+ var c, table3 = [];
300923
300923
  for (var n = 0; n < 256; n++) {
300924
300924
  c = n;
300925
300925
  for (var k = 0; k < 8; k++) {
300926
300926
  c = c & 1 ? 3988292384 ^ c >>> 1 : c >>> 1;
300927
300927
  }
300928
- table2[n] = c;
300928
+ table3[n] = c;
300929
300929
  }
300930
- return table2;
300930
+ return table3;
300931
300931
  }
300932
300932
  var crcTable = makeTable();
300933
300933
  function crc32(crc, buf, len, pos) {
@@ -302721,7 +302721,7 @@ var require_inftrees = __commonJS({
302721
302721
  64,
302722
302722
  64
302723
302723
  ];
302724
- module2.exports = function inflate_table(type, lens, lens_index, codes, table2, table_index, work, opts) {
302724
+ module2.exports = function inflate_table(type, lens, lens_index, codes, table3, table_index, work, opts) {
302725
302725
  var bits = opts.bits;
302726
302726
  var len = 0;
302727
302727
  var sym = 0;
@@ -302761,8 +302761,8 @@ var require_inftrees = __commonJS({
302761
302761
  root2 = max;
302762
302762
  }
302763
302763
  if (max === 0) {
302764
- table2[table_index++] = 1 << 24 | 64 << 16 | 0;
302765
- table2[table_index++] = 1 << 24 | 64 << 16 | 0;
302764
+ table3[table_index++] = 1 << 24 | 64 << 16 | 0;
302765
+ table3[table_index++] = 1 << 24 | 64 << 16 | 0;
302766
302766
  opts.bits = 1;
302767
302767
  return 0;
302768
302768
  }
@@ -302837,7 +302837,7 @@ var require_inftrees = __commonJS({
302837
302837
  min = fill;
302838
302838
  do {
302839
302839
  fill -= incr;
302840
- table2[next + (huff >> drop) + fill] = here_bits << 24 | here_op << 16 | here_val | 0;
302840
+ table3[next + (huff >> drop) + fill] = here_bits << 24 | here_op << 16 | here_val | 0;
302841
302841
  } while (fill !== 0);
302842
302842
  incr = 1 << len - 1;
302843
302843
  while (huff & incr) {
@@ -302876,11 +302876,11 @@ var require_inftrees = __commonJS({
302876
302876
  return 1;
302877
302877
  }
302878
302878
  low = huff & mask;
302879
- table2[low] = root2 << 24 | curr << 16 | next - table_index | 0;
302879
+ table3[low] = root2 << 24 | curr << 16 | next - table_index | 0;
302880
302880
  }
302881
302881
  }
302882
302882
  if (huff !== 0) {
302883
- table2[next + huff] = len - drop << 24 | 64 << 16 | 0;
302883
+ table3[next + huff] = len - drop << 24 | 64 << 16 | 0;
302884
302884
  }
302885
302885
  opts.bits = root2;
302886
302886
  return 0;
@@ -318455,7 +318455,7 @@ var require_table = __commonJS({
318455
318455
  var truncateTableData_1 = require_truncateTableData();
318456
318456
  var utils_1 = require_utils36();
318457
318457
  var validateTableData_1 = require_validateTableData();
318458
- var table2 = (data, userConfig = {}) => {
318458
+ var table3 = (data, userConfig = {}) => {
318459
318459
  (0, validateTableData_1.validateTableData)(data);
318460
318460
  let rows = (0, stringifyTableData_1.stringifyTableData)(data);
318461
318461
  const [injectedRows, injectedSpanningCellConfig] = (0, injectHeaderConfig_1.injectHeaderConfig)(rows, userConfig);
@@ -318470,7 +318470,7 @@ var require_table = __commonJS({
318470
318470
  const outputColumnWidths = (0, calculateOutputColumnWidths_1.calculateOutputColumnWidths)(config);
318471
318471
  return (0, drawTable_1.drawTable)(rows, outputColumnWidths, rowHeights, config);
318472
318472
  };
318473
- exports2.table = table2;
318473
+ exports2.table = table3;
318474
318474
  }
318475
318475
  });
318476
318476
 
@@ -415818,10 +415818,22 @@ var ZeroLT = class extends ProviderBase {
415818
415818
  }
415819
415819
  };
415820
415820
 
415821
- // src/commands/new-command.ts
415822
- function commaSeparatedList(value, dummyPrevious) {
415821
+ // src/commands/option-parsers.ts
415822
+ function parseBigInt(value, _prev) {
415823
+ try {
415824
+ const parsedValue = BigInt(value);
415825
+ return parsedValue;
415826
+ } catch (e) {
415827
+ throw new InvalidArgumentError(
415828
+ e instanceof Error ? e.message : "Not a number."
415829
+ );
415830
+ }
415831
+ }
415832
+ function commaSeparatedList(value, _prev) {
415823
415833
  return value ? value.split(",") : void 0;
415824
415834
  }
415835
+
415836
+ // src/commands/new-command.ts
415825
415837
  function newCommand() {
415826
415838
  return new Command().addOption(
415827
415839
  new Option(
@@ -415869,6 +415881,11 @@ function newCommand() {
415869
415881
  "--address-provider-json <file>",
415870
415882
  "file with address provider address override"
415871
415883
  )
415884
+ ).addOption(
415885
+ new Option(
415886
+ "--address-provider <address>",
415887
+ "new address provider address"
415888
+ ).env("ADDRESS_PROVIDER")
415872
415889
  ).addOption(
415873
415890
  new Option(
415874
415891
  "--market-configurators <comma-separated-addresses>",
@@ -417016,11 +417033,6 @@ async function executeJSON({
417016
417033
  function executeJson() {
417017
417034
  return newCommand().name("execute-json").description("execute json").addArgument(
417018
417035
  new Argument("<json_file_path>", "json file with transactions")
417019
- ).addOption(
417020
- new Option(
417021
- "--address-provider <address>",
417022
- "new address provider address"
417023
- ).env("ADDRESS_PROVIDER")
417024
417036
  ).addOption(
417025
417037
  new Option("--shared-dir <dir>", "dir to put output files").env(
417026
417038
  "SHARED_DIR"
@@ -417700,8 +417712,6 @@ var GearboxZappersPlugin = class extends SDKConstruct {
417700
417712
  // src/commands/open-accounts.ts
417701
417713
  function openAccounts() {
417702
417714
  return newCommand().name("open-accounts").description("Script to open accounts in v3.1").addOption(
417703
- new Option("--address-provider <address>", "new address provider address").env("ADDRESS_PROVIDER").makeOptionMandatory(true)
417704
- ).addOption(
417705
417715
  new Option("--cast-bin <path>", "cast binary path").env("CAST_BIN")
417706
417716
  ).addOption(
417707
417717
  new Option("--shared-dir <dir>", "dir to put output files").env(
@@ -417723,7 +417733,7 @@ function openAccounts() {
417723
417733
  const sdk = await GearboxSDK.attach({
417724
417734
  rpcURLs: [anvilUrl],
417725
417735
  timeout: 48e4,
417726
- addressProvider,
417736
+ addressProvider: addressProvider ?? ADDRESS_PROVIDER_V310,
417727
417737
  marketConfigurators: marketConfigurators ?? [],
417728
417738
  logger: log_default,
417729
417739
  ignoreUpdateablePrices: false,
@@ -417955,7 +417965,7 @@ function getRenderer(opts) {
417955
417965
  var package_default = {
417956
417966
  name: "@gearbox-protocol/deploy-tools",
417957
417967
  description: "Gearbox deploy tools",
417958
- version: "5.18.10",
417968
+ version: "5.19.0",
417959
417969
  homepage: "https://gearbox.fi",
417960
417970
  keywords: [
417961
417971
  "gearbox"
@@ -418038,18 +418048,6 @@ var package_default = {
418038
418048
  // src/version.ts
418039
418049
  var version_default = package_default.version;
418040
418050
 
418041
- // src/commands/option-parsers.ts
418042
- function parseBigInt(value, _dummy) {
418043
- try {
418044
- const parsedValue = BigInt(value);
418045
- return parsedValue;
418046
- } catch (e) {
418047
- throw new InvalidArgumentError(
418048
- e instanceof Error ? e.message : "Not a number."
418049
- );
418050
- }
418051
- }
418052
-
418053
418051
  // src/commands/parse.ts
418054
418052
  function parse() {
418055
418053
  return newCommand().name("parse").description(
@@ -418112,6 +418110,95 @@ function parse() {
418112
418110
  });
418113
418111
  }
418114
418112
 
418113
+ // src/commands/prices.ts
418114
+ var import_table2 = __toESM(require_src10(), 1);
418115
+ function prices() {
418116
+ return newCommand().name("prices").description("Get current prices using Gearbox SDK").addOption(new Option("--rpc-url <url>", "rpc url").env("RPC_URL")).action(async (opts) => {
418117
+ let { addressProvider, marketConfigurators, rpcUrl } = opts;
418118
+ const sdk = await GearboxSDK.attach({
418119
+ rpcURLs: [rpcUrl],
418120
+ timeout: 48e4,
418121
+ addressProvider: addressProvider ?? ADDRESS_PROVIDER_V310,
418122
+ marketConfigurators: marketConfigurators ?? [],
418123
+ logger: log_default.child({}, { level: "error" })
418124
+ });
418125
+ for (const m of sdk.marketRegister.markets) {
418126
+ const data = [
418127
+ [
418128
+ `Pool: ${source_default.bold(m.pool.pool.name)}, oracle: ${source_default.bold(m.priceOracle.address)}`,
418129
+ "",
418130
+ "",
418131
+ "",
418132
+ "",
418133
+ ""
418134
+ ],
418135
+ ...printPrices(m.priceOracle)
418136
+ ];
418137
+ console.log((0, import_table2.table)(data, tableConfig));
418138
+ }
418139
+ log_default.info("done");
418140
+ });
418141
+ }
418142
+ var colTitles = [
418143
+ "Token",
418144
+ "Address",
418145
+ "Main Price",
418146
+ "Staleness Period",
418147
+ "Reserve Price",
418148
+ "Staleness Period"
418149
+ ].map((s) => source_default.red(s));
418150
+ var tableConfig = {
418151
+ spanningCells: [
418152
+ {
418153
+ col: 0,
418154
+ row: 0,
418155
+ colSpan: colTitles.length,
418156
+ alignment: "left"
418157
+ }
418158
+ ]
418159
+ };
418160
+ function printPrices(oracle) {
418161
+ const { mainPriceFeeds, reservePriceFeeds, mainPrices, reservePrices, sdk } = oracle;
418162
+ const tokens = /* @__PURE__ */ new Set([
418163
+ ...mainPriceFeeds.keys(),
418164
+ ...reservePriceFeeds.keys(),
418165
+ ...mainPrices.keys(),
418166
+ ...reservePrices.keys()
418167
+ ]);
418168
+ const data = [colTitles];
418169
+ for (const token of tokens) {
418170
+ const mainFeed = mainPriceFeeds.get(token);
418171
+ const reserveFeed = reservePriceFeeds.get(token);
418172
+ const mainPrice = mainPrices.get(token);
418173
+ const reservePrice = reservePrices.get(token);
418174
+ data.push([
418175
+ sdk.tokensMeta.symbol(token),
418176
+ token,
418177
+ printPrice(mainPrice),
418178
+ printStalenessPeriod(mainFeed?.stalenessPeriod),
418179
+ printPrice(reservePrice),
418180
+ printStalenessPeriod(reserveFeed?.stalenessPeriod)
418181
+ ]);
418182
+ }
418183
+ return data;
418184
+ }
418185
+ function printPrice(price) {
418186
+ if (!price) {
418187
+ return source_default.red("-");
418188
+ }
418189
+ const pretty = formatBN(price, 8);
418190
+ const raw = source_default.grey(`(${price.toString(10)})`);
418191
+ return `${pretty} ${raw}`;
418192
+ }
418193
+ function printStalenessPeriod(stalenessPeriod) {
418194
+ if (stalenessPeriod === void 0) {
418195
+ return source_default.red("-");
418196
+ }
418197
+ const pretty = stalenessPeriod ? formatDuration2(stalenessPeriod, false) : "0 seconds";
418198
+ const raw = source_default.grey(`(${stalenessPeriod.toString(10)})`);
418199
+ return `${pretty} ${raw}`;
418200
+ }
418201
+
418115
418202
  // src/commands/print-safe-tx.ts
418116
418203
  var Printer = class extends ProviderBase {
418117
418204
  };
@@ -418130,11 +418217,6 @@ import { mkdir as mkdir2, writeFile as writeFile6 } from "node:fs/promises";
418130
418217
  import path11 from "node:path";
418131
418218
  function sdkExample() {
418132
418219
  return newCommand().name("sdk-example").description("SDK example for v3.1").addOption(
418133
- new Option(
418134
- "--address-provider <address>",
418135
- "new address provider address"
418136
- ).env("ADDRESS_PROVIDER")
418137
- ).addOption(
418138
418220
  new Option("--shared-dir <dir>", "dir to put output files").env(
418139
418221
  "SHARED_DIR"
418140
418222
  )
@@ -418157,7 +418239,7 @@ function sdkExample() {
418157
418239
  "https://anvil.gearbox.foundation/rpc/PermissionlessMainnet"
418158
418240
  ],
418159
418241
  timeout: 48e4,
418160
- addressProvider,
418242
+ addressProvider: addressProvider ?? ADDRESS_PROVIDER_V310,
418161
418243
  marketConfigurators: marketConfigurators ?? [],
418162
418244
  logger: log_default,
418163
418245
  ignoreUpdateablePrices: false,
@@ -418231,6 +418313,7 @@ program2.addCommand(addressTree());
418231
418313
  program2.addCommand(audit());
418232
418314
  program2.addCommand(openAccounts());
418233
418315
  program2.addCommand(parse());
418316
+ program2.addCommand(prices());
418234
418317
  program2.addCommand(printSafeTx());
418235
418318
  program2.addCommand(sdkExample());
418236
418319
  program2.addCommand(verifyEtherscan());
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.18.10",
4
+ "version": "5.19.0",
5
5
  "homepage": "https://gearbox.fi",
6
6
  "keywords": [
7
7
  "gearbox"