@gearbox-protocol/deploy-tools 5.11.0 → 5.11.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 +49 -15
  2. package/package.json +2 -2
package/dist/index.mjs CHANGED
@@ -405799,24 +405799,58 @@ var AccountOpener = class extends SDKConstruct {
405799
405799
  this.#logger?.debug(`created depositor ${depositor.address}`);
405800
405800
  await this.#claimFromFaucet(depositor, totalUSD);
405801
405801
  for (const [pool, amount] of deposits) {
405802
- const poolName = this.sdk.provider.addressLabels.get(pool.address);
405803
- const amnt = this.sdk.tokensMeta.formatBN(pool.underlying, amount) + " " + this.sdk.tokensMeta.symbol(pool.underlying);
405804
- this.#logger?.debug(`depositing ${amnt} into pool ${poolName}`);
405805
405802
  try {
405806
- await this.#anvil.writeContract({
405807
- account: depositor,
405808
- chain: this.#anvil.chain,
405809
- address: pool.address,
405810
- abi: iPoolV300Abi,
405811
- functionName: "deposit",
405812
- args: [amount, depositor.address]
405813
- });
405814
- this.#logger?.debug(`deposited ${amnt} into ${poolName}`);
405803
+ await this.#depositToPool(pool, depositor, amount);
405815
405804
  } catch (e) {
405816
- this.#logger?.warn(`failed to deposit ${amnt} into ${poolName}: ${e}`);
405805
+ this.#logger?.warn(`failed to deposit into ${pool.name}: ${e}`);
405817
405806
  }
405818
405807
  }
405819
405808
  }
405809
+ async #depositToPool(pool, depositor, amount) {
405810
+ const { underlying, address } = pool;
405811
+ const poolName = this.sdk.provider.addressLabels.get(address);
405812
+ const amnt = this.sdk.tokensMeta.formatBN(pool.underlying, amount) + " " + this.sdk.tokensMeta.symbol(pool.underlying);
405813
+ this.#logger?.debug(`depositing ${amnt} into pool ${poolName}`);
405814
+ const allowance = await this.#anvil.readContract({
405815
+ address: underlying,
405816
+ abi: ierc20Abi,
405817
+ functionName: "balanceOf",
405818
+ args: [depositor.address]
405819
+ });
405820
+ this.#logger?.debug(
405821
+ `depositor balance in underlying: ${this.sdk.tokensMeta.formatBN(pool.underlying, allowance)}`
405822
+ );
405823
+ let hash2 = await this.#anvil.writeContract({
405824
+ account: depositor,
405825
+ address: underlying,
405826
+ abi: ierc20Abi,
405827
+ functionName: "approve",
405828
+ args: [address, allowance],
405829
+ chain: this.#anvil.chain
405830
+ });
405831
+ let receipt = await this.#anvil.waitForTransactionReceipt({ hash: hash2 });
405832
+ if (receipt.status === "reverted") {
405833
+ throw new Error(
405834
+ `tx ${hash2} that approves underlying from depositor for pool ${poolName} reverted`
405835
+ );
405836
+ }
405837
+ this.#logger?.debug(
405838
+ `depositor approved underlying for pool ${poolName}: ${hash2}`
405839
+ );
405840
+ hash2 = await this.#anvil.writeContract({
405841
+ account: depositor,
405842
+ address,
405843
+ abi: iPoolV300Abi,
405844
+ functionName: "deposit",
405845
+ args: [amount, depositor.address],
405846
+ chain: this.#anvil.chain
405847
+ });
405848
+ receipt = await this.#anvil.waitForTransactionReceipt({ hash: hash2 });
405849
+ if (receipt.status === "reverted") {
405850
+ throw new Error(`tx ${hash2} that deposits to pool ${poolName} reverted`);
405851
+ }
405852
+ this.#logger?.debug(`deposited ${amnt} into ${poolName}`);
405853
+ }
405820
405854
  /**
405821
405855
  * Creates borrower wallet,
405822
405856
  * Sets ETH balance,
@@ -414207,7 +414241,7 @@ function getRenderer(opts) {
414207
414241
  var package_default = {
414208
414242
  name: "@gearbox-protocol/deploy-tools",
414209
414243
  description: "Gearbox deploy tools",
414210
- version: "5.11.0",
414244
+ version: "5.11.1",
414211
414245
  homepage: "https://gearbox.fi",
414212
414246
  keywords: [
414213
414247
  "gearbox"
@@ -414250,7 +414284,7 @@ var package_default = {
414250
414284
  "@gearbox-protocol/deploy-tools-node": "0.0.0",
414251
414285
  "@gearbox-protocol/deploy-tools-shared": "0.0.0",
414252
414286
  "@gearbox-protocol/deploy-tools-types": "0.0.0",
414253
- "@gearbox-protocol/sdk": "3.0.0-vfour.243",
414287
+ "@gearbox-protocol/sdk": "3.0.0-vfour.244",
414254
414288
  "@gearbox-protocol/sdk-gov": "^2.34.1",
414255
414289
  "@types/lodash-es": "^4.17.12",
414256
414290
  "@types/node": "^22.13.1",
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.11.0",
4
+ "version": "5.11.1",
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.243",
47
+ "@gearbox-protocol/sdk": "3.0.0-vfour.244",
48
48
  "@gearbox-protocol/sdk-gov": "^2.34.1",
49
49
  "@types/lodash-es": "^4.17.12",
50
50
  "@types/node": "^22.13.1",