@gearbox-protocol/sdk 8.30.0 → 8.30.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.
@@ -50,6 +50,7 @@ class AccountOpener extends import_sdk.SDKConstruct {
50
50
  #poolDepositMultiplier;
51
51
  #minDebtMultiplier;
52
52
  #allowMint;
53
+ #leverageDelta;
53
54
  constructor(service, options_ = {}) {
54
55
  super(service.sdk);
55
56
  const {
@@ -58,6 +59,7 @@ class AccountOpener extends import_sdk.SDKConstruct {
58
59
  faucet,
59
60
  poolDepositMultiplier = 30000n,
60
61
  minDebtMultiplier = 10100n,
62
+ leverageDelta = 500n,
61
63
  allowMint = false
62
64
  } = options_;
63
65
  this.#service = service;
@@ -76,6 +78,7 @@ class AccountOpener extends import_sdk.SDKConstruct {
76
78
  this.depositorKey = depositorKey ?? (0, import_accounts.generatePrivateKey)();
77
79
  this.#poolDepositMultiplier = BigInt(poolDepositMultiplier);
78
80
  this.#minDebtMultiplier = BigInt(minDebtMultiplier);
81
+ this.#leverageDelta = BigInt(leverageDelta);
79
82
  }
80
83
  get borrower() {
81
84
  if (!this.#borrower) {
@@ -829,9 +832,11 @@ class AccountOpener extends import_sdk.SDKConstruct {
829
832
  }
830
833
  const cm = this.sdk.marketRegister.findCreditManager(creditManager);
831
834
  const lt = BigInt(cm.creditManager.liquidationThresholds.mustGet(target));
832
- const d = 50n;
833
- const result = import_sdk.PERCENTAGE_FACTOR * (1n + (lt - d) / (import_sdk.PERCENTAGE_FACTOR - lt));
834
- return result > import_sdk.PERCENTAGE_FACTOR * 10n ? import_sdk.PERCENTAGE_FACTOR * 10n : result;
835
+ const d = this.#leverageDelta;
836
+ let result = import_sdk.PERCENTAGE_FACTOR * (1n + (lt - d) / (import_sdk.PERCENTAGE_FACTOR - lt));
837
+ result = result > import_sdk.PERCENTAGE_FACTOR * 10n ? import_sdk.PERCENTAGE_FACTOR * 10n : result;
838
+ result = BigInt(Math.floor(Number(result) / 1e3) * 1e3);
839
+ return result;
835
840
  }
836
841
  get faucet() {
837
842
  if (!this.#faucet) {
@@ -43,6 +43,7 @@ class AccountOpener extends SDKConstruct {
43
43
  #poolDepositMultiplier;
44
44
  #minDebtMultiplier;
45
45
  #allowMint;
46
+ #leverageDelta;
46
47
  constructor(service, options_ = {}) {
47
48
  super(service.sdk);
48
49
  const {
@@ -51,6 +52,7 @@ class AccountOpener extends SDKConstruct {
51
52
  faucet,
52
53
  poolDepositMultiplier = 30000n,
53
54
  minDebtMultiplier = 10100n,
55
+ leverageDelta = 500n,
54
56
  allowMint = false
55
57
  } = options_;
56
58
  this.#service = service;
@@ -69,6 +71,7 @@ class AccountOpener extends SDKConstruct {
69
71
  this.depositorKey = depositorKey ?? generatePrivateKey();
70
72
  this.#poolDepositMultiplier = BigInt(poolDepositMultiplier);
71
73
  this.#minDebtMultiplier = BigInt(minDebtMultiplier);
74
+ this.#leverageDelta = BigInt(leverageDelta);
72
75
  }
73
76
  get borrower() {
74
77
  if (!this.#borrower) {
@@ -822,9 +825,11 @@ class AccountOpener extends SDKConstruct {
822
825
  }
823
826
  const cm = this.sdk.marketRegister.findCreditManager(creditManager);
824
827
  const lt = BigInt(cm.creditManager.liquidationThresholds.mustGet(target));
825
- const d = 50n;
826
- const result = PERCENTAGE_FACTOR * (1n + (lt - d) / (PERCENTAGE_FACTOR - lt));
827
- return result > PERCENTAGE_FACTOR * 10n ? PERCENTAGE_FACTOR * 10n : result;
828
+ const d = this.#leverageDelta;
829
+ let result = PERCENTAGE_FACTOR * (1n + (lt - d) / (PERCENTAGE_FACTOR - lt));
830
+ result = result > PERCENTAGE_FACTOR * 10n ? PERCENTAGE_FACTOR * 10n : result;
831
+ result = BigInt(Math.floor(Number(result) / 1e3) * 1e3);
832
+ return result;
828
833
  }
829
834
  get faucet() {
830
835
  if (!this.#faucet) {
@@ -12,6 +12,7 @@ export interface AccountOpenerOptions {
12
12
  depositorKey?: Hex;
13
13
  poolDepositMultiplier?: bigint | string | number;
14
14
  minDebtMultiplier?: bigint | string | number;
15
+ leverageDelta?: bigint | string | number;
15
16
  allowMint?: boolean;
16
17
  }
17
18
  export interface TargetAccount {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/sdk",
3
- "version": "8.30.0",
3
+ "version": "8.30.1",
4
4
  "description": "Gearbox SDK",
5
5
  "license": "MIT",
6
6
  "main": "./dist/cjs/sdk/index.js",