@gearbox-protocol/deploy-tools 5.45.0 → 5.45.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 +62 -11
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -446357,18 +446357,19 @@ function defillamaTest() {
446357
446357
  new Option("--output-json <file>", "json state location").env(
446358
446358
  "OUTPUT_JSON"
446359
446359
  )
446360
- ).action(async (opts) => {
446361
- log_default.info("starting state snapshot script");
446360
+ ).addOption(new Option("--gas-limit <number>", "gas limit")).action(async (opts) => {
446362
446361
  const {
446363
446362
  addressProvider,
446364
446363
  marketConfigurators,
446365
446364
  anvilUrl = "http://127.0.0.1:8545",
446366
- outputJson = "state.json"
446365
+ outputJson = "state.json",
446366
+ gasLimit = "550000000"
446367
446367
  } = opts;
446368
446368
  const transportOptions = getSDKTransportOptions({
446369
446369
  ...opts,
446370
446370
  anvilUrl
446371
446371
  });
446372
+ const gas = BigInt(gasLimit);
446372
446373
  const sdk = await GearboxSDK.attach({
446373
446374
  ...transportOptions,
446374
446375
  timeout: 48e4,
@@ -446392,22 +446393,72 @@ function defillamaTest() {
446392
446393
  args: [addressProvider]
446393
446394
  });
446394
446395
  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
- });
446396
+ const result = {};
446397
+ try {
446398
+ result.poolsGas = await sdk.provider.publicClient.estimateContractGas({
446399
+ abi: DefillamaCompressorAbi,
446400
+ address,
446401
+ functionName: "getPools",
446402
+ args: [marketConfigurators]
446403
+ });
446404
+ } catch (e) {
446405
+ log_default.error(`error estimating pools gas: ${e}`);
446406
+ result.poolsGas = { error: `${e}` };
446407
+ }
446408
+ try {
446409
+ result.pools = await sdk.provider.publicClient.readContract({
446410
+ address,
446411
+ abi: DefillamaCompressorAbi,
446412
+ functionName: "getPools",
446413
+ args: [marketConfigurators],
446414
+ // @ts-expect-error
446415
+ gas
446416
+ });
446417
+ log_default.info(`got ${result.pools.length} pools`);
446418
+ } catch (e) {
446419
+ log_default.error(`error getting pools: ${e}`);
446420
+ result.pools = { error: `${e}` };
446421
+ }
446400
446422
  const creditManagers = {};
446423
+ const creditManagersGas = {};
446401
446424
  for (const suite of sdk.marketRegister.creditManagers) {
446425
+ log_default.debug(
446426
+ `getting credit accounts for ${sdk.provider.addressLabels.get(suite.creditManager.address)}`
446427
+ );
446402
446428
  try {
446403
- const creditAccounts = await sdk.provider.publicClient.readContract({
446429
+ const cmGas = await sdk.provider.publicClient.estimateContractGas({
446404
446430
  address,
446405
446431
  abi: DefillamaCompressorAbi,
446406
446432
  functionName: "getCreditAccounts",
446407
446433
  args: [suite.creditManager.address]
446408
446434
  });
446435
+ creditManagersGas[suite.creditManager.address] = cmGas;
446436
+ log_default.debug(
446437
+ `estimated gas for ${sdk.provider.addressLabels.get(suite.creditManager.address)}: ${cmGas}`
446438
+ );
446439
+ } catch (e) {
446440
+ log_default.error(
446441
+ `error estimating gas for ${sdk.provider.addressLabels.get(suite.creditManager.address)}: ${e}`
446442
+ );
446443
+ creditManagersGas[suite.creditManager.address] = { error: `${e}` };
446444
+ }
446445
+ try {
446446
+ const creditAccounts = await sdk.provider.publicClient.readContract({
446447
+ address,
446448
+ abi: DefillamaCompressorAbi,
446449
+ functionName: "getCreditAccounts",
446450
+ args: [suite.creditManager.address],
446451
+ // @ts-expect-error
446452
+ gas
446453
+ });
446409
446454
  creditManagers[suite.creditManager.address] = creditAccounts;
446455
+ log_default.debug(
446456
+ `got ${creditAccounts.length} credit accounts for ${sdk.provider.addressLabels.get(suite.creditManager.address)}`
446457
+ );
446410
446458
  } catch (e) {
446459
+ log_default.error(
446460
+ `error getting credit accounts for ${sdk.provider.addressLabels.get(suite.creditManager.address)}: ${e}`
446461
+ );
446411
446462
  creditManagers[suite.creditManager.address] = { error: `${e}` };
446412
446463
  }
446413
446464
  }
@@ -446416,7 +446467,7 @@ function defillamaTest() {
446416
446467
  await mkdir2(outputDir, { recursive: true });
446417
446468
  await writeFile5(
446418
446469
  outputJson,
446419
- json_stringify({ pools, creditManagers }),
446470
+ json_stringify({ ...result, creditManagers, creditManagersGas }),
446420
446471
  "utf-8"
446421
446472
  );
446422
446473
  log_default.info("done");
@@ -446683,7 +446734,7 @@ function getRenderer(opts) {
446683
446734
  var package_default = {
446684
446735
  name: "@gearbox-protocol/deploy-tools",
446685
446736
  description: "Gearbox deploy tools",
446686
- version: "5.45.0",
446737
+ version: "5.45.1",
446687
446738
  homepage: "https://gearbox.fi",
446688
446739
  keywords: [
446689
446740
  "gearbox"
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.1",
5
5
  "homepage": "https://gearbox.fi",
6
6
  "keywords": [
7
7
  "gearbox"