@gearbox-protocol/deploy-tools 5.45.0 → 5.45.2

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 +74 -25
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -141462,7 +141462,7 @@ var require_sonic_boom = __commonJS({
141462
141462
  if (!(this instanceof SonicBoom)) {
141463
141463
  return new SonicBoom(opts);
141464
141464
  }
141465
- let { fd, dest, minLength, maxLength, maxWrite, periodicFlush, sync, append = true, mkdir: mkdir5, retryEAGAIN, fsync, contentMode, mode } = opts || {};
141465
+ let { fd, dest, minLength, maxLength, maxWrite, periodicFlush, sync, append = true, mkdir: mkdir4, retryEAGAIN, fsync, contentMode, mode } = opts || {};
141466
141466
  fd = fd || dest;
141467
141467
  this._len = 0;
141468
141468
  this.fd = -1;
@@ -141487,7 +141487,7 @@ var require_sonic_boom = __commonJS({
141487
141487
  this.append = append || false;
141488
141488
  this.mode = mode;
141489
141489
  this.retryEAGAIN = retryEAGAIN || (() => true);
141490
- this.mkdir = mkdir5 || false;
141490
+ this.mkdir = mkdir4 || false;
141491
141491
  let fsWriteSync;
141492
141492
  let fsWrite;
141493
141493
  if (contentMode === kContentModeBuffer) {
@@ -446187,7 +446187,7 @@ function audit() {
446187
446187
  }
446188
446188
 
446189
446189
  // src/commands/defillama-test/index.ts
446190
- import { mkdir as mkdir2, writeFile as writeFile5 } from "node:fs/promises";
446190
+ import { writeFile as writeFile5 } from "node:fs/promises";
446191
446191
  import path8 from "node:path";
446192
446192
 
446193
446193
  // src/commands/defillama-test/abi.ts
@@ -446354,21 +446354,20 @@ var DefillamaCompressorBytecode = "0x60a060405234801561000f575f80fd5b50604051611
446354
446354
  // src/commands/defillama-test/index.ts
446355
446355
  function defillamaTest() {
446356
446356
  return newCommand().name("defillama-test").description("Test defillama compressor").addOption(
446357
- new Option("--output-json <file>", "json state location").env(
446358
- "OUTPUT_JSON"
446359
- )
446360
- ).action(async (opts) => {
446361
- log_default.info("starting state snapshot script");
446357
+ new Option("--output-dir <file>", "output dir").env("OUTPUT_DIR")
446358
+ ).addOption(new Option("--gas-limit <number>", "gas limit")).action(async (opts) => {
446362
446359
  const {
446363
446360
  addressProvider,
446364
446361
  marketConfigurators,
446365
446362
  anvilUrl = "http://127.0.0.1:8545",
446366
- outputJson = "state.json"
446363
+ outputDir,
446364
+ gasLimit = "550000000"
446367
446365
  } = opts;
446368
446366
  const transportOptions = getSDKTransportOptions({
446369
446367
  ...opts,
446370
446368
  anvilUrl
446371
446369
  });
446370
+ const gas = BigInt(gasLimit);
446372
446371
  const sdk = await GearboxSDK.attach({
446373
446372
  ...transportOptions,
446374
446373
  timeout: 48e4,
@@ -446392,31 +446391,81 @@ function defillamaTest() {
446392
446391
  args: [addressProvider]
446393
446392
  });
446394
446393
  log_default.info(`deployed defillama compressor at ${address}`);
446395
- const pools = await sdk.provider.publicClient.readContract({
446396
- address,
446397
- abi: DefillamaCompressorAbi,
446398
- functionName: "getPools"
446399
- });
446394
+ const result = {};
446395
+ try {
446396
+ result.poolsGas = await sdk.provider.publicClient.estimateContractGas({
446397
+ abi: DefillamaCompressorAbi,
446398
+ address,
446399
+ functionName: "getPools",
446400
+ args: [marketConfigurators]
446401
+ });
446402
+ } catch (e) {
446403
+ log_default.error(`error estimating pools gas: ${e}`);
446404
+ result.poolsGas = { error: `${e}` };
446405
+ }
446406
+ try {
446407
+ result.pools = await sdk.provider.publicClient.readContract({
446408
+ address,
446409
+ abi: DefillamaCompressorAbi,
446410
+ functionName: "getPools",
446411
+ args: [marketConfigurators],
446412
+ // @ts-expect-error
446413
+ gas
446414
+ });
446415
+ log_default.info(`got ${result.pools.length} pools`);
446416
+ } catch (e) {
446417
+ log_default.error(`error getting pools: ${e}`);
446418
+ result.pools = { error: `${e}` };
446419
+ }
446400
446420
  const creditManagers = {};
446421
+ const creditManagersGas = {};
446401
446422
  for (const suite of sdk.marketRegister.creditManagers) {
446423
+ log_default.debug(
446424
+ `getting credit accounts for ${sdk.provider.addressLabels.get(suite.creditManager.address)}`
446425
+ );
446402
446426
  try {
446403
- const creditAccounts = await sdk.provider.publicClient.readContract({
446427
+ const cmGas = await sdk.provider.publicClient.estimateContractGas({
446404
446428
  address,
446405
446429
  abi: DefillamaCompressorAbi,
446406
446430
  functionName: "getCreditAccounts",
446407
446431
  args: [suite.creditManager.address]
446408
446432
  });
446433
+ creditManagersGas[suite.creditManager.address] = cmGas;
446434
+ log_default.debug(
446435
+ `estimated gas for ${sdk.provider.addressLabels.get(suite.creditManager.address)}: ${cmGas}`
446436
+ );
446437
+ } catch (e) {
446438
+ log_default.error(
446439
+ `error estimating gas for ${sdk.provider.addressLabels.get(suite.creditManager.address)}: ${e}`
446440
+ );
446441
+ creditManagersGas[suite.creditManager.address] = { error: `${e}` };
446442
+ }
446443
+ try {
446444
+ const creditAccounts = await sdk.provider.publicClient.readContract({
446445
+ address,
446446
+ abi: DefillamaCompressorAbi,
446447
+ functionName: "getCreditAccounts",
446448
+ args: [suite.creditManager.address],
446449
+ // @ts-expect-error
446450
+ gas
446451
+ });
446409
446452
  creditManagers[suite.creditManager.address] = creditAccounts;
446453
+ log_default.debug(
446454
+ `got ${creditAccounts.length} credit accounts for ${sdk.provider.addressLabels.get(suite.creditManager.address)}`
446455
+ );
446410
446456
  } catch (e) {
446457
+ log_default.error(
446458
+ `error getting credit accounts for ${sdk.provider.addressLabels.get(suite.creditManager.address)}: ${e}`
446459
+ );
446411
446460
  creditManagers[suite.creditManager.address] = { error: `${e}` };
446412
446461
  }
446413
446462
  }
446414
- log_default.debug(`saving state to ${outputJson}`);
446415
- const outputDir = path8.dirname(outputJson);
446416
- await mkdir2(outputDir, { recursive: true });
446463
+ const outDir = outputDir ?? process.cwd();
446464
+ const outputJson = path8.resolve(outDir, "defillama.json");
446465
+ log_default.debug(`saving results to ${outputJson}`);
446417
446466
  await writeFile5(
446418
446467
  outputJson,
446419
- json_stringify({ pools, creditManagers }),
446468
+ json_stringify({ ...result, creditManagers, creditManagersGas }),
446420
446469
  "utf-8"
446421
446470
  );
446422
446471
  log_default.info("done");
@@ -446425,7 +446474,7 @@ function defillamaTest() {
446425
446474
 
446426
446475
  // src/commands/open-accounts.ts
446427
446476
  import { spawnSync as spawnSync3 } from "node:child_process";
446428
- import { mkdir as mkdir3, readFile as readFile8, writeFile as writeFile6 } from "node:fs/promises";
446477
+ import { mkdir as mkdir2, readFile as readFile8, writeFile as writeFile6 } from "node:fs/promises";
446429
446478
  import path9 from "node:path";
446430
446479
  function openAccounts() {
446431
446480
  return newCommand().name("open-accounts").description("Script to open accounts in v3.1").addOption(
@@ -446448,7 +446497,7 @@ function openAccounts() {
446448
446497
  castBin = "cast",
446449
446498
  inputJson
446450
446499
  } = opts;
446451
- await mkdir3(path9.resolve(sharedDir, "deploy-state"), { recursive: true });
446500
+ await mkdir2(path9.resolve(sharedDir, "deploy-state"), { recursive: true });
446452
446501
  const transportOptions = getSDKTransportOptions({
446453
446502
  ...opts,
446454
446503
  anvilUrl
@@ -446534,7 +446583,7 @@ function openAccounts() {
446534
446583
  try {
446535
446584
  const result = await accountOpener.openCreditAccounts(accounts, true);
446536
446585
  const destDir = path9.resolve(sharedDir, "open-accounts");
446537
- await mkdir3(destDir, { recursive: true });
446586
+ await mkdir2(destDir, { recursive: true });
446538
446587
  await writeFile6(
446539
446588
  path9.resolve(destDir, "result.json"),
446540
446589
  json_stringify(result),
@@ -446683,7 +446732,7 @@ function getRenderer(opts) {
446683
446732
  var package_default = {
446684
446733
  name: "@gearbox-protocol/deploy-tools",
446685
446734
  description: "Gearbox deploy tools",
446686
- version: "5.45.0",
446735
+ version: "5.45.2",
446687
446736
  homepage: "https://gearbox.fi",
446688
446737
  keywords: [
446689
446738
  "gearbox"
@@ -446932,7 +446981,7 @@ function printSafeTx() {
446932
446981
  }
446933
446982
 
446934
446983
  // src/commands/state-snapshot.ts
446935
- import { mkdir as mkdir4, writeFile as writeFile8 } from "node:fs/promises";
446984
+ import { mkdir as mkdir3, writeFile as writeFile8 } from "node:fs/promises";
446936
446985
  import path11 from "node:path";
446937
446986
 
446938
446987
  // ../../node_modules/@gearbox-protocol/sdk/dist/esm/plugins/bots/abi/iPartialLiquidationBotV300.js
@@ -447580,7 +447629,7 @@ function stateSnapshot() {
447580
447629
  });
447581
447630
  log_default.debug(`saving state to ${outputJson}`);
447582
447631
  const outputDir = path11.dirname(outputJson);
447583
- await mkdir4(outputDir, { recursive: true });
447632
+ await mkdir3(outputDir, { recursive: true });
447584
447633
  await writeFile8(outputJson, json_stringify(sdk.state), "utf-8");
447585
447634
  log_default.info("done");
447586
447635
  });
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.45.0",
4
+ "version": "5.45.2",
5
5
  "homepage": "https://gearbox.fi",
6
6
  "keywords": [
7
7
  "gearbox"