@gearbox-protocol/deploy-tools 5.16.11 → 5.16.12

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 +39 -10
  2. package/package.json +2 -2
package/dist/index.mjs CHANGED
@@ -345871,6 +345871,7 @@ init_toHex();
345871
345871
  init_fromBytes();
345872
345872
  init_concat();
345873
345873
  init_getChainContractAddress();
345874
+ init_formatEther();
345874
345875
  init_fromHex();
345875
345876
  init_getAddress();
345876
345877
  init_toFunctionSelector();
@@ -354823,10 +354824,22 @@ var BaseContract = class extends SDKConstruct {
354823
354824
  }
354824
354825
  /**
354825
354826
  * Converts contract calldata to some human-friendly string
354827
+ * This is safe function which should not throw
354826
354828
  * @param calldata
354827
354829
  * @returns
354828
354830
  */
354829
354831
  parseFunctionData(calldata) {
354832
+ try {
354833
+ return this.mustParseFunctionData(calldata);
354834
+ } catch (e) {
354835
+ const selector = calldata.slice(0, 10);
354836
+ this.logger?.warn(
354837
+ `error parsing function with selector ${selector} in ${this.name} v${this.version} at ${this.address}: ${e}`
354838
+ );
354839
+ return `unknown: ${this.labelAddress(this.address)}.${selector}`;
354840
+ }
354841
+ }
354842
+ mustParseFunctionData(calldata) {
354830
354843
  const decoded = decodeFunctionData({
354831
354844
  abi: this.abi,
354832
354845
  data: calldata
@@ -400383,7 +400396,7 @@ var AccountOpener = class extends SDKConstruct {
400383
400396
  );
400384
400397
  const depositor = await this.#createAccount();
400385
400398
  this.#logger?.debug(`created depositor ${depositor.address}`);
400386
- await this.#claimFromFaucet(depositor, totalUSD);
400399
+ await this.#claimFromFaucet(depositor, "depositor", totalUSD);
400387
400400
  for (const [pool, amount] of deposits) {
400388
400401
  try {
400389
400402
  await this.#depositToPool(pool, depositor, amount);
@@ -400462,16 +400475,20 @@ var AccountOpener = class extends SDKConstruct {
400462
400475
  }
400463
400476
  }
400464
400477
  claimUSD = claimUSD * 11n / 10n;
400465
- await this.#claimFromFaucet(borrower, claimUSD);
400478
+ await this.#claimFromFaucet(borrower, "borrower", claimUSD);
400466
400479
  for (const [degenNFT, amount] of Object.entries(degenNFTS)) {
400467
400480
  await this.#mintDegenNft(degenNFT, borrower.address, amount);
400468
400481
  }
400469
400482
  this.#logger?.debug("prepared borrower");
400470
400483
  return borrower;
400471
400484
  }
400472
- async #claimFromFaucet(claimer, amountUSD) {
400485
+ async #claimFromFaucet(claimer, role, amountUSD) {
400473
400486
  const [usr, amnt] = [claimer.address, formatBN(amountUSD, 8)];
400474
- this.#logger?.debug(`account ${usr} claiming ${amnt} USD from faucet`);
400487
+ this.#logger?.debug(`${role} ${usr} claiming ${amnt} USD from faucet`);
400488
+ if (amountUSD === 0n) {
400489
+ this.#logger?.debug("amount is 0, skipping claim");
400490
+ return;
400491
+ }
400475
400492
  const hash2 = await this.#anvil.writeContract({
400476
400493
  account: claimer,
400477
400494
  address: this.#faucet,
@@ -400495,11 +400512,11 @@ var AccountOpener = class extends SDKConstruct {
400495
400512
  });
400496
400513
  if (receipt.status === "reverted") {
400497
400514
  throw new Error(
400498
- `account ${usr} failed to claimed equivalent of ${amnt} USD from faucet, tx: ${hash2}`
400515
+ `${role} ${usr} failed to claimed equivalent of ${amnt} USD from faucet, tx: ${hash2}`
400499
400516
  );
400500
400517
  }
400501
400518
  this.#logger?.debug(
400502
- `account ${usr} claimed equivalent of ${amnt} USD from faucet, tx: ${hash2}`
400519
+ `${role} ${usr} claimed equivalent of ${amnt} USD from faucet, tx: ${hash2}`
400503
400520
  );
400504
400521
  }
400505
400522
  async #approve(token, cm) {
@@ -400755,15 +400772,27 @@ var SDKExample = class {
400755
400772
  await anvil.impersonateAccount({ address: owner });
400756
400773
  await anvil.setBalance({
400757
400774
  address: owner,
400758
- value: parseEther("100")
400775
+ value: parseEther("1000")
400776
+ });
400777
+ const balance = await anvil.getBalance({ address: owner });
400778
+ this.#logger?.debug(`owner balance: ${formatEther(balance)} ETH`);
400779
+ const { request } = await anvil.simulateContract({
400780
+ chain: anvil.chain,
400781
+ account: owner,
400782
+ address: addressProvider,
400783
+ abi: iAddressProviderV310Abi,
400784
+ functionName: "setAddress",
400785
+ args: [stringToHex("FAUCET", { size: 32 }), faucetAddr, false]
400759
400786
  });
400787
+ this.#logger?.debug("estimated setAddress call");
400760
400788
  const hash2 = await anvil.writeContract({
400761
400789
  chain: anvil.chain,
400762
400790
  account: owner,
400763
400791
  address: addressProvider,
400764
400792
  abi: iAddressProviderV310Abi,
400765
400793
  functionName: "setAddress",
400766
- args: [stringToHex("FAUCET", { size: 32 }), faucetAddr, true]
400794
+ args: [stringToHex("FAUCET", { size: 32 }), faucetAddr, false],
400795
+ gas: request.gas ? request.gas * 11n / 10n : void 0
400767
400796
  });
400768
400797
  const receipt = await anvil.waitForTransactionReceipt({ hash: hash2 });
400769
400798
  await anvil.stopImpersonatingAccount({ address: owner });
@@ -407566,7 +407595,7 @@ function getRenderer(opts) {
407566
407595
  var package_default = {
407567
407596
  name: "@gearbox-protocol/deploy-tools",
407568
407597
  description: "Gearbox deploy tools",
407569
- version: "5.16.11",
407598
+ version: "5.16.12",
407570
407599
  homepage: "https://gearbox.fi",
407571
407600
  keywords: [
407572
407601
  "gearbox"
@@ -407609,7 +407638,7 @@ var package_default = {
407609
407638
  "@gearbox-protocol/deploy-tools-node": "0.0.0",
407610
407639
  "@gearbox-protocol/deploy-tools-shared": "0.0.0",
407611
407640
  "@gearbox-protocol/deploy-tools-types": "0.0.0",
407612
- "@gearbox-protocol/sdk": "3.0.0-vfour.276",
407641
+ "@gearbox-protocol/sdk": "3.0.0-vfour.277",
407613
407642
  "@gearbox-protocol/sdk-gov": "^2.36.5",
407614
407643
  "@types/lodash-es": "^4.17.12",
407615
407644
  "@types/node": "^22.13.5",
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.16.11",
4
+ "version": "5.16.12",
5
5
  "homepage": "https://gearbox.fi",
6
6
  "keywords": [
7
7
  "gearbox"
@@ -44,7 +44,7 @@
44
44
  "@gearbox-protocol/deploy-tools-node": "0.0.0",
45
45
  "@gearbox-protocol/deploy-tools-shared": "0.0.0",
46
46
  "@gearbox-protocol/deploy-tools-types": "0.0.0",
47
- "@gearbox-protocol/sdk": "3.0.0-vfour.276",
47
+ "@gearbox-protocol/sdk": "3.0.0-vfour.277",
48
48
  "@gearbox-protocol/sdk-gov": "^2.36.5",
49
49
  "@types/lodash-es": "^4.17.12",
50
50
  "@types/node": "^22.13.5",