@gearbox-protocol/deploy-tools 5.28.11 → 5.28.13

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 +26 -7
  2. package/package.json +2 -2
package/dist/index.mjs CHANGED
@@ -429090,22 +429090,32 @@ var AccountOpener = class extends SDKConstruct {
429090
429090
  target: symbol
429091
429091
  });
429092
429092
  const leverage = this.#getLeverage(input);
429093
- logger2?.debug(`using leverage ${leverage}`);
429094
429093
  const { minDebt, underlying } = cm.creditFacade;
429094
+ const expectedUnderlyingBalance = minDebt * leverage / PERCENTAGE_FACTOR;
429095
429095
  const expectedBalances = [];
429096
429096
  const leftoverBalances = [];
429097
429097
  for (const t of cm.creditManager.collateralTokens) {
429098
429098
  const token = t;
429099
429099
  expectedBalances.push({
429100
429100
  token,
429101
- balance: token === underlying ? BigInt(leverage) * minDebt / PERCENTAGE_FACTOR : 1n
429101
+ balance: token === underlying ? expectedUnderlyingBalance : 1n
429102
429102
  });
429103
429103
  leftoverBalances.push({
429104
429104
  token,
429105
429105
  balance: 1n
429106
429106
  });
429107
429107
  }
429108
- logger2?.debug("looking for open strategy");
429108
+ logger2?.debug(
429109
+ {
429110
+ minDebt: this.sdk.tokensMeta.formatBN(underlying, minDebt),
429111
+ leverage: leverage.toString(),
429112
+ expectedUnderlyingBalance: this.sdk.tokensMeta.formatBN(
429113
+ underlying,
429114
+ expectedUnderlyingBalance
429115
+ )
429116
+ },
429117
+ "looking for open strategy"
429118
+ );
429109
429119
  const strategy = await this.sdk.routerFor(cm).findOpenStrategyPath({
429110
429120
  creditManager: cm.creditManager,
429111
429121
  expectedBalances,
@@ -429419,7 +429429,7 @@ var AccountOpener = class extends SDKConstruct {
429419
429429
  });
429420
429430
  return acc;
429421
429431
  }
429422
- #getCollateralQuota(cm, collateral, amount, debt, logger2) {
429432
+ #getCollateralQuota(cm, collateral, collateralAmount, debt, logger2) {
429423
429433
  const {
429424
429434
  underlying,
429425
429435
  creditManager: { liquidationThresholds }
@@ -429439,6 +429449,10 @@ var AccountOpener = class extends SDKConstruct {
429439
429449
  `quota exceeded for asset ${this.labelAddress(collateral)} in ${cm.name}`
429440
429450
  );
429441
429451
  }
429452
+ const oracle = this.sdk.marketRegister.findByCreditManager(
429453
+ cm.creditManager.address
429454
+ ).priceOracle;
429455
+ const amount = oracle.convert(collateral, underlying, collateralAmount);
429442
429456
  const desiredQuota = this.#calcQuota(amount, debt, collateralLT);
429443
429457
  logger2?.debug(
429444
429458
  {
@@ -429447,6 +429461,10 @@ var AccountOpener = class extends SDKConstruct {
429447
429461
  underlying,
429448
429462
  availableQuota
429449
429463
  ),
429464
+ collateralAmount: this.sdk.tokensMeta.formatBN(
429465
+ collateral,
429466
+ collateralAmount
429467
+ ),
429450
429468
  amount: this.sdk.tokensMeta.formatBN(underlying, amount),
429451
429469
  debt: this.sdk.tokensMeta.formatBN(underlying, debt),
429452
429470
  lt: Number(collateralLT)
@@ -436659,7 +436677,8 @@ function openAccounts() {
436659
436677
  const accService = new CreditAccountsService(sdk);
436660
436678
  const accountOpener = new AccountOpener(accService, {
436661
436679
  faucet: faucetAddr,
436662
- borrower
436680
+ borrower,
436681
+ poolDepositMultiplier: 30000n
436663
436682
  });
436664
436683
  let accounts = [
436665
436684
  {
@@ -436814,7 +436833,7 @@ function getRenderer(opts) {
436814
436833
  var package_default = {
436815
436834
  name: "@gearbox-protocol/deploy-tools",
436816
436835
  description: "Gearbox deploy tools",
436817
- version: "5.28.11",
436836
+ version: "5.28.13",
436818
436837
  homepage: "https://gearbox.fi",
436819
436838
  keywords: [
436820
436839
  "gearbox"
@@ -436857,7 +436876,7 @@ var package_default = {
436857
436876
  "@gearbox-protocol/deploy-tools-node": "0.0.0",
436858
436877
  "@gearbox-protocol/deploy-tools-shared": "0.0.0",
436859
436878
  "@gearbox-protocol/deploy-tools-types": "0.0.0",
436860
- "@gearbox-protocol/sdk": "^4.1.6",
436879
+ "@gearbox-protocol/sdk": "^4.1.8",
436861
436880
  "@gearbox-protocol/sdk-gov": "^2.37.0",
436862
436881
  "@types/lodash-es": "^4.17.12",
436863
436882
  "@types/node": "^22.14.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.28.11",
4
+ "version": "5.28.13",
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": "^4.1.6",
47
+ "@gearbox-protocol/sdk": "^4.1.8",
48
48
  "@gearbox-protocol/sdk-gov": "^2.37.0",
49
49
  "@types/lodash-es": "^4.17.12",
50
50
  "@types/node": "^22.14.1",