@gearbox-protocol/deploy-tools 5.28.10 → 5.28.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 +27 -6
  2. package/package.json +2 -2
package/dist/index.mjs CHANGED
@@ -381608,6 +381608,9 @@ var chains = {
381608
381608
  defaultMarketConfigurators: {
381609
381609
  "0x5BCF14d8470e1a6110916371aacC8E1C947A7D9d": "Chaos Labs"
381610
381610
  },
381611
+ testMarketConfigurators: {
381612
+ "0x19037a281025b83fa37e3264b77af523ff87a3a4": "Chaos Labs"
381613
+ },
381611
381614
  isPublic: false,
381612
381615
  wellKnownToken: {
381613
381616
  address: "0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d",
@@ -429087,22 +429090,32 @@ var AccountOpener = class extends SDKConstruct {
429087
429090
  target: symbol
429088
429091
  });
429089
429092
  const leverage = this.#getLeverage(input);
429090
- logger2?.debug(`using leverage ${leverage}`);
429091
429093
  const { minDebt, underlying } = cm.creditFacade;
429094
+ const expectedUnderlyingBalance = minDebt * leverage / PERCENTAGE_FACTOR;
429092
429095
  const expectedBalances = [];
429093
429096
  const leftoverBalances = [];
429094
429097
  for (const t of cm.creditManager.collateralTokens) {
429095
429098
  const token = t;
429096
429099
  expectedBalances.push({
429097
429100
  token,
429098
- balance: token === underlying ? BigInt(leverage) * minDebt : 1n
429101
+ balance: token === underlying ? expectedUnderlyingBalance : 1n
429099
429102
  });
429100
429103
  leftoverBalances.push({
429101
429104
  token,
429102
429105
  balance: 1n
429103
429106
  });
429104
429107
  }
429105
- 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
+ );
429106
429119
  const strategy = await this.sdk.routerFor(cm).findOpenStrategyPath({
429107
429120
  creditManager: cm.creditManager,
429108
429121
  expectedBalances,
@@ -429416,7 +429429,7 @@ var AccountOpener = class extends SDKConstruct {
429416
429429
  });
429417
429430
  return acc;
429418
429431
  }
429419
- #getCollateralQuota(cm, collateral, amount, debt, logger2) {
429432
+ #getCollateralQuota(cm, collateral, collateralAmount, debt, logger2) {
429420
429433
  const {
429421
429434
  underlying,
429422
429435
  creditManager: { liquidationThresholds }
@@ -429436,6 +429449,10 @@ var AccountOpener = class extends SDKConstruct {
429436
429449
  `quota exceeded for asset ${this.labelAddress(collateral)} in ${cm.name}`
429437
429450
  );
429438
429451
  }
429452
+ const oracle = this.sdk.marketRegister.findByCreditManager(
429453
+ cm.creditManager.address
429454
+ ).priceOracle;
429455
+ const amount = oracle.convert(collateral, underlying, collateralAmount);
429439
429456
  const desiredQuota = this.#calcQuota(amount, debt, collateralLT);
429440
429457
  logger2?.debug(
429441
429458
  {
@@ -429444,6 +429461,10 @@ var AccountOpener = class extends SDKConstruct {
429444
429461
  underlying,
429445
429462
  availableQuota
429446
429463
  ),
429464
+ collateralAmount: this.sdk.tokensMeta.formatBN(
429465
+ collateral,
429466
+ collateralAmount
429467
+ ),
429447
429468
  amount: this.sdk.tokensMeta.formatBN(underlying, amount),
429448
429469
  debt: this.sdk.tokensMeta.formatBN(underlying, debt),
429449
429470
  lt: Number(collateralLT)
@@ -436811,7 +436832,7 @@ function getRenderer(opts) {
436811
436832
  var package_default = {
436812
436833
  name: "@gearbox-protocol/deploy-tools",
436813
436834
  description: "Gearbox deploy tools",
436814
- version: "5.28.10",
436835
+ version: "5.28.12",
436815
436836
  homepage: "https://gearbox.fi",
436816
436837
  keywords: [
436817
436838
  "gearbox"
@@ -436854,7 +436875,7 @@ var package_default = {
436854
436875
  "@gearbox-protocol/deploy-tools-node": "0.0.0",
436855
436876
  "@gearbox-protocol/deploy-tools-shared": "0.0.0",
436856
436877
  "@gearbox-protocol/deploy-tools-types": "0.0.0",
436857
- "@gearbox-protocol/sdk": "^4.1.5",
436878
+ "@gearbox-protocol/sdk": "^4.1.8",
436858
436879
  "@gearbox-protocol/sdk-gov": "^2.37.0",
436859
436880
  "@types/lodash-es": "^4.17.12",
436860
436881
  "@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.10",
4
+ "version": "5.28.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": "^4.1.5",
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",