@gearbox-protocol/deploy-tools 5.3.8 → 5.3.9

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 +32 -6
  2. package/package.json +2 -2
package/dist/index.mjs CHANGED
@@ -385307,6 +385307,7 @@ var logLevelArg = process.argv.indexOf("--log-level") > 0 ? process.argv[process
385307
385307
  var logger = (0, import_pino.pino)({
385308
385308
  level: logLevelArg ?? process.env.LOG_LEVEL ?? "debug",
385309
385309
  formatters: {
385310
+ bindings: () => ({}),
385310
385311
  level: (label) => {
385311
385312
  return {
385312
385313
  level: label
@@ -409187,13 +409188,32 @@ var AccountOpener = class {
409187
409188
  slippage,
409188
409189
  target: collateral
409189
409190
  });
409190
- logger2?.debug("found open strategy");
409191
+ logger2?.debug(strategy, "found open strategy");
409192
+ const debt = minDebt * BigInt(leverage - 1);
409191
409193
  const { tx, calls } = await this.#service.openCA({
409192
409194
  creditManager: cm.creditManager.address,
409193
- averageQuota: [],
409194
- minQuota: [],
409195
+ averageQuota: [
409196
+ {
409197
+ token: collateral,
409198
+ balance: this.#calcQuota(
409199
+ strategy.amount,
409200
+ debt,
409201
+ BigInt(cm.collateralTokens[collateral])
409202
+ )
409203
+ }
409204
+ ],
409205
+ minQuota: [
409206
+ {
409207
+ token: collateral,
409208
+ balance: this.#calcQuota(
409209
+ strategy.minAmount,
409210
+ debt,
409211
+ BigInt(cm.collateralTokens[collateral])
409212
+ )
409213
+ }
409214
+ ],
409195
409215
  collateral: [{ token: underlying, balance: minDebt }],
409196
- debt: minDebt * BigInt(leverage - 1),
409216
+ debt,
409197
409217
  calls: strategy.calls,
409198
409218
  ethAmount: 0n,
409199
409219
  permits: {},
@@ -409392,6 +409412,12 @@ var AccountOpener = class {
409392
409412
  }
409393
409413
  return this.#borrower;
409394
409414
  }
409415
+ #calcQuota(amount, debt, lt) {
409416
+ let quota = amount * lt / PERCENTAGE_FACTOR;
409417
+ quota = debt < quota ? debt : quota;
409418
+ quota = quota * (PERCENTAGE_FACTOR + 500n) / PERCENTAGE_FACTOR;
409419
+ return quota / PERCENTAGE_FACTOR * PERCENTAGE_FACTOR;
409420
+ }
409395
409421
  get sdk() {
409396
409422
  return this.#service.sdk;
409397
409423
  }
@@ -417869,7 +417895,7 @@ function getRenderer(opts) {
417869
417895
  var package_default = {
417870
417896
  name: "@gearbox-protocol/deploy-tools",
417871
417897
  description: "Gearbox deploy tools",
417872
- version: "5.3.8",
417898
+ version: "5.3.9",
417873
417899
  homepage: "https://gearbox.fi",
417874
417900
  keywords: [
417875
417901
  "gearbox"
@@ -417912,7 +417938,7 @@ var package_default = {
417912
417938
  "@gearbox-protocol/deploy-tools-node": "0.0.0",
417913
417939
  "@gearbox-protocol/deploy-tools-shared": "0.0.0",
417914
417940
  "@gearbox-protocol/deploy-tools-types": "0.0.0",
417915
- "@gearbox-protocol/sdk": "^3.0.0-vfour.158",
417941
+ "@gearbox-protocol/sdk": "^3.0.0-vfour.160",
417916
417942
  "@gearbox-protocol/sdk-gov": "^2.33.2",
417917
417943
  "@types/lodash-es": "^4.17.12",
417918
417944
  "@types/node": "^22.10.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.3.8",
4
+ "version": "5.3.9",
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.158",
47
+ "@gearbox-protocol/sdk": "^3.0.0-vfour.160",
48
48
  "@gearbox-protocol/sdk-gov": "^2.33.2",
49
49
  "@types/lodash-es": "^4.17.12",
50
50
  "@types/node": "^22.10.5",