@gearbox-protocol/deploy-tools 5.28.9 → 5.28.10

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 +61 -30
  2. package/package.json +3 -3
package/dist/index.mjs CHANGED
@@ -4276,7 +4276,7 @@ var init_size = __esm({
4276
4276
  var version2;
4277
4277
  var init_version2 = __esm({
4278
4278
  "../../node_modules/viem/_esm/errors/version.js"() {
4279
- version2 = "2.28.1";
4279
+ version2 = "2.28.3";
4280
4280
  }
4281
4281
  });
4282
4282
 
@@ -161405,7 +161405,7 @@ var require_version28 = __commonJS({
161405
161405
  "use strict";
161406
161406
  Object.defineProperty(exports2, "__esModule", { value: true });
161407
161407
  exports2.version = void 0;
161408
- exports2.version = "2.28.1";
161408
+ exports2.version = "2.28.3";
161409
161409
  }
161410
161410
  });
161411
161411
 
@@ -173934,7 +173934,7 @@ var require_sendTransaction = __commonJS({
173934
173934
  var sendRawTransaction_js_1 = require_sendRawTransaction();
173935
173935
  var supportsWalletNamespace2 = new lru_js_1.LruMap(128);
173936
173936
  async function sendTransaction2(client, parameters) {
173937
- const { account: account_ = client.account, chain = client.chain, accessList, authorizationList, blobs, data, gas, gasPrice, maxFeePerBlobGas, maxFeePerGas, maxPriorityFeePerGas, nonce, value, ...rest } = parameters;
173937
+ const { account: account_ = client.account, chain = client.chain, accessList, authorizationList, blobs, data, gas, gasPrice, maxFeePerBlobGas, maxFeePerGas, maxPriorityFeePerGas, nonce, type, value, ...rest } = parameters;
173938
173938
  if (typeof account_ === "undefined")
173939
173939
  throw new account_js_1.AccountNotFoundError({
173940
173940
  docsPath: "/docs/actions/wallet/sendTransaction"
@@ -173981,6 +173981,7 @@ var require_sendTransaction = __commonJS({
173981
173981
  maxPriorityFeePerGas,
173982
173982
  nonce,
173983
173983
  to,
173984
+ type,
173984
173985
  value
173985
173986
  });
173986
173987
  const isWalletNamespaceSupported = supportsWalletNamespace2.get(client.uid);
@@ -174029,6 +174030,7 @@ var require_sendTransaction = __commonJS({
174029
174030
  nonce,
174030
174031
  nonceManager: account.nonceManager,
174031
174032
  parameters: [...prepareTransactionRequest_js_1.defaultParameters, "sidecars"],
174033
+ type,
174032
174034
  value,
174033
174035
  ...rest,
174034
174036
  to
@@ -189347,12 +189349,14 @@ var require_getCapabilities = __commonJS({
189347
189349
  Object.defineProperty(exports2, "__esModule", { value: true });
189348
189350
  exports2.getCapabilities = getCapabilities2;
189349
189351
  var parseAccount_js_1 = require_parseAccount();
189352
+ var toHex_js_1 = require_toHex();
189350
189353
  async function getCapabilities2(client, parameters = {}) {
189351
189354
  const { account = client.account, chainId } = parameters;
189352
189355
  const account_ = account ? (0, parseAccount_js_1.parseAccount)(account) : void 0;
189356
+ const params = chainId ? [account_?.address, [(0, toHex_js_1.numberToHex)(chainId)]] : [account_?.address];
189353
189357
  const capabilities_raw = await client.request({
189354
189358
  method: "wallet_getCapabilities",
189355
- params: [account_?.address]
189359
+ params
189356
189360
  });
189357
189361
  const capabilities = {};
189358
189362
  for (const [key, value] of Object.entries(capabilities_raw))
@@ -189744,7 +189748,7 @@ var require_wallet3 = __commonJS({
189744
189748
  deployContract: (args) => (0, deployContract_js_1.deployContract)(client, args),
189745
189749
  getAddresses: () => (0, getAddresses_js_1.getAddresses)(client),
189746
189750
  getCallsStatus: (args) => (0, getCallsStatus_js_1.getCallsStatus)(client, args),
189747
- getCapabilities: () => (0, getCapabilities_js_1.getCapabilities)(client),
189751
+ getCapabilities: (args) => (0, getCapabilities_js_1.getCapabilities)(client, args),
189748
189752
  getChainId: () => (0, getChainId_js_1.getChainId)(client),
189749
189753
  getPermissions: () => (0, getPermissions_js_1.getPermissions)(client),
189750
189754
  prepareAuthorization: (args) => (0, prepareAuthorization_js_1.prepareAuthorization)(client, args),
@@ -219683,7 +219687,7 @@ var require_fraxtal = __commonJS({
219683
219687
  ...chainConfig_js_1.chainConfig,
219684
219688
  id: 252,
219685
219689
  name: "Fraxtal",
219686
- nativeCurrency: { name: "Frax Ether", symbol: "frxETH", decimals: 18 },
219690
+ nativeCurrency: { name: "Frax", symbol: "FRAX", decimals: 18 },
219687
219691
  rpcUrls: {
219688
219692
  default: {
219689
219693
  http: ["https://rpc.frax.com"]
@@ -219737,7 +219741,7 @@ var require_fraxtalTestnet = __commonJS({
219737
219741
  ...chainConfig_js_1.chainConfig,
219738
219742
  id: 2522,
219739
219743
  name: "Fraxtal Testnet",
219740
- nativeCurrency: { name: "Frax Ether", symbol: "frxETH", decimals: 18 },
219744
+ nativeCurrency: { name: "Frax", symbol: "FRAX", decimals: 18 },
219741
219745
  rpcUrls: {
219742
219746
  default: {
219743
219747
  http: ["https://rpc.testnet.frax.com"]
@@ -358006,7 +358010,7 @@ async function sendRawTransaction(client, { serializedTransaction }) {
358006
358010
  // ../../node_modules/viem/_esm/actions/wallet/sendTransaction.js
358007
358011
  var supportsWalletNamespace = new LruMap(128);
358008
358012
  async function sendTransaction(client, parameters) {
358009
- const { account: account_ = client.account, chain = client.chain, accessList, authorizationList, blobs, data, gas, gasPrice, maxFeePerBlobGas, maxFeePerGas, maxPriorityFeePerGas, nonce, value, ...rest } = parameters;
358013
+ const { account: account_ = client.account, chain = client.chain, accessList, authorizationList, blobs, data, gas, gasPrice, maxFeePerBlobGas, maxFeePerGas, maxPriorityFeePerGas, nonce, type, value, ...rest } = parameters;
358010
358014
  if (typeof account_ === "undefined")
358011
358015
  throw new AccountNotFoundError({
358012
358016
  docsPath: "/docs/actions/wallet/sendTransaction"
@@ -358054,6 +358058,7 @@ async function sendTransaction(client, parameters) {
358054
358058
  maxPriorityFeePerGas,
358055
358059
  nonce,
358056
358060
  to,
358061
+ type,
358057
358062
  value
358058
358063
  });
358059
358064
  const isWalletNamespaceSupported = supportsWalletNamespace.get(client.uid);
@@ -358102,6 +358107,7 @@ async function sendTransaction(client, parameters) {
358102
358107
  nonce,
358103
358108
  nonceManager: account.nonceManager,
358104
358109
  parameters: [...defaultParameters, "sidecars"],
358110
+ type,
358105
358111
  value,
358106
358112
  ...rest,
358107
358113
  to
@@ -364022,12 +364028,14 @@ async function getAddresses(client) {
364022
364028
 
364023
364029
  // ../../node_modules/viem/_esm/actions/wallet/getCapabilities.js
364024
364030
  init_parseAccount();
364031
+ init_toHex();
364025
364032
  async function getCapabilities(client, parameters = {}) {
364026
364033
  const { account = client.account, chainId } = parameters;
364027
364034
  const account_ = account ? parseAccount(account) : void 0;
364035
+ const params = chainId ? [account_?.address, [numberToHex(chainId)]] : [account_?.address];
364028
364036
  const capabilities_raw = await client.request({
364029
364037
  method: "wallet_getCapabilities",
364030
- params: [account_?.address]
364038
+ params
364031
364039
  });
364032
364040
  const capabilities = {};
364033
364041
  for (const [key, value] of Object.entries(capabilities_raw))
@@ -364290,7 +364298,7 @@ function walletActions(client) {
364290
364298
  deployContract: (args) => deployContract(client, args),
364291
364299
  getAddresses: () => getAddresses(client),
364292
364300
  getCallsStatus: (args) => getCallsStatus(client, args),
364293
- getCapabilities: () => getCapabilities(client),
364301
+ getCapabilities: (args) => getCapabilities(client, args),
364294
364302
  getChainId: () => getChainId(client),
364295
364303
  getPermissions: () => getPermissions(client),
364296
364304
  prepareAuthorization: (args) => prepareAuthorization(client, args),
@@ -381600,9 +381608,6 @@ var chains = {
381600
381608
  defaultMarketConfigurators: {
381601
381609
  "0x5BCF14d8470e1a6110916371aacC8E1C947A7D9d": "Chaos Labs"
381602
381610
  },
381603
- testMarketConfigurators: {
381604
- "0x537F5F2032e75Fa586E48ad635DF6f79c06205b9": "Chaos Labs"
381605
- },
381606
381611
  isPublic: false,
381607
381612
  wellKnownToken: {
381608
381613
  address: "0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d",
@@ -428937,7 +428942,6 @@ async function evmMineDetailed(client, timestamp) {
428937
428942
  }
428938
428943
 
428939
428944
  // ../../node_modules/@gearbox-protocol/sdk/dist/esm/dev/AccountOpener.js
428940
- var DEFAULT_LEVERAGE = 4;
428941
428945
  var AccountOpener = class extends SDKConstruct {
428942
428946
  #service;
428943
428947
  #anvil;
@@ -429074,12 +429078,7 @@ var AccountOpener = class extends SDKConstruct {
429074
429078
  };
429075
429079
  }
429076
429080
  async prepareOpen(input) {
429077
- const {
429078
- creditManager,
429079
- target,
429080
- leverage = DEFAULT_LEVERAGE,
429081
- slippage = 50
429082
- } = input;
429081
+ const { creditManager, target, slippage = 50 } = input;
429083
429082
  const borrower = await this.#getBorrower();
429084
429083
  const cm = this.sdk.marketRegister.findCreditManager(creditManager);
429085
429084
  const symbol = this.sdk.tokensMeta.symbol(target);
@@ -429087,6 +429086,8 @@ var AccountOpener = class extends SDKConstruct {
429087
429086
  creditManager: cm.name,
429088
429087
  target: symbol
429089
429088
  });
429089
+ const leverage = this.#getLeverage(input);
429090
+ logger2?.debug(`using leverage ${leverage}`);
429090
429091
  const { minDebt, underlying } = cm.creditFacade;
429091
429092
  const expectedBalances = [];
429092
429093
  const leftoverBalances = [];
@@ -429110,18 +429111,20 @@ var AccountOpener = class extends SDKConstruct {
429110
429111
  target
429111
429112
  });
429112
429113
  logger2?.debug(strategy, "found open strategy");
429113
- const debt = minDebt * BigInt(leverage - 1);
429114
+ const debt = minDebt * (leverage - PERCENTAGE_FACTOR) / PERCENTAGE_FACTOR;
429114
429115
  const averageQuota = this.#getCollateralQuota(
429115
429116
  cm,
429116
429117
  target,
429117
429118
  strategy.amount,
429118
- debt
429119
+ debt,
429120
+ logger2
429119
429121
  );
429120
429122
  const minQuota = this.#getCollateralQuota(
429121
429123
  cm,
429122
429124
  target,
429123
429125
  strategy.minAmount,
429124
- debt
429126
+ debt,
429127
+ logger2
429125
429128
  );
429126
429129
  logger2?.debug({ averageQuota, minQuota }, "calculated quotas");
429127
429130
  const { tx, calls } = await this.#service.openCA({
@@ -429153,10 +429156,11 @@ var AccountOpener = class extends SDKConstruct {
429153
429156
  async #depositIntoPools(targets) {
429154
429157
  this.#logger?.debug("checking and topping up pools if necessary");
429155
429158
  const minAvailableByPool = {};
429156
- for (const { leverage = DEFAULT_LEVERAGE, creditManager } of targets) {
429157
- const cm = this.sdk.marketRegister.findCreditManager(creditManager);
429159
+ for (const t of targets) {
429160
+ const leverage = this.#getLeverage(t);
429161
+ const cm = this.sdk.marketRegister.findCreditManager(t.creditManager);
429158
429162
  const { minDebt } = cm.creditFacade;
429159
- minAvailableByPool[cm.pool] = (minAvailableByPool[cm.pool] ?? 0n) + minDebt * BigInt(leverage - 1) * this.#poolDepositMultiplier / PERCENTAGE_FACTOR;
429163
+ minAvailableByPool[cm.pool] = (minAvailableByPool[cm.pool] ?? 0n) + minDebt * (leverage - PERCENTAGE_FACTOR) / PERCENTAGE_FACTOR * this.#poolDepositMultiplier / PERCENTAGE_FACTOR;
429160
429164
  }
429161
429165
  let totalUSD = 0n;
429162
429166
  let deposits = [];
@@ -429412,7 +429416,7 @@ var AccountOpener = class extends SDKConstruct {
429412
429416
  });
429413
429417
  return acc;
429414
429418
  }
429415
- #getCollateralQuota(cm, collateral, amount, debt) {
429419
+ #getCollateralQuota(cm, collateral, amount, debt, logger2) {
429416
429420
  const {
429417
429421
  underlying,
429418
429422
  creditManager: { liquidationThresholds }
@@ -429433,6 +429437,19 @@ var AccountOpener = class extends SDKConstruct {
429433
429437
  );
429434
429438
  }
429435
429439
  const desiredQuota = this.#calcQuota(amount, debt, collateralLT);
429440
+ logger2?.debug(
429441
+ {
429442
+ desiredQuota: this.sdk.tokensMeta.formatBN(underlying, desiredQuota),
429443
+ availableQuota: this.sdk.tokensMeta.formatBN(
429444
+ underlying,
429445
+ availableQuota
429446
+ ),
429447
+ amount: this.sdk.tokensMeta.formatBN(underlying, amount),
429448
+ debt: this.sdk.tokensMeta.formatBN(underlying, debt),
429449
+ lt: Number(collateralLT)
429450
+ },
429451
+ "calculated quota"
429452
+ );
429436
429453
  return [
429437
429454
  {
429438
429455
  token: collateral,
@@ -429446,6 +429463,20 @@ var AccountOpener = class extends SDKConstruct {
429446
429463
  quota = quota * (PERCENTAGE_FACTOR + 500n) / PERCENTAGE_FACTOR;
429447
429464
  return quota / PERCENTAGE_FACTOR * PERCENTAGE_FACTOR;
429448
429465
  }
429466
+ /**
429467
+ * Returns leverage in percentage factor format
429468
+ * @param param0
429469
+ * @returns
429470
+ */
429471
+ #getLeverage({ creditManager, target, leverage }) {
429472
+ if (leverage) {
429473
+ return BigInt(leverage) * PERCENTAGE_FACTOR;
429474
+ }
429475
+ const cm = this.sdk.marketRegister.findCreditManager(creditManager);
429476
+ const lt = BigInt(cm.creditManager.liquidationThresholds.mustGet(target));
429477
+ const d = 50n;
429478
+ return PERCENTAGE_FACTOR * (1n + (lt - d) / (PERCENTAGE_FACTOR - lt));
429479
+ }
429449
429480
  get faucet() {
429450
429481
  if (!this.#faucet) {
429451
429482
  throw new Error("faucet not found");
@@ -436780,7 +436811,7 @@ function getRenderer(opts) {
436780
436811
  var package_default = {
436781
436812
  name: "@gearbox-protocol/deploy-tools",
436782
436813
  description: "Gearbox deploy tools",
436783
- version: "5.28.9",
436814
+ version: "5.28.10",
436784
436815
  homepage: "https://gearbox.fi",
436785
436816
  keywords: [
436786
436817
  "gearbox"
@@ -436823,7 +436854,7 @@ var package_default = {
436823
436854
  "@gearbox-protocol/deploy-tools-node": "0.0.0",
436824
436855
  "@gearbox-protocol/deploy-tools-shared": "0.0.0",
436825
436856
  "@gearbox-protocol/deploy-tools-types": "0.0.0",
436826
- "@gearbox-protocol/sdk": "^4.1.3",
436857
+ "@gearbox-protocol/sdk": "^4.1.5",
436827
436858
  "@gearbox-protocol/sdk-gov": "^2.37.0",
436828
436859
  "@types/lodash-es": "^4.17.12",
436829
436860
  "@types/node": "^22.14.1",
@@ -436845,7 +436876,7 @@ var package_default = {
436845
436876
  "react-dom": "^19.1.0",
436846
436877
  table: "^6.9.0",
436847
436878
  tsx: "^4.19.4",
436848
- viem: "^2.28.1",
436879
+ viem: "^2.28.3",
436849
436880
  yaml: "^2.7.1",
436850
436881
  zod: "^3.24.3"
436851
436882
  },
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.9",
4
+ "version": "5.28.10",
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.3",
47
+ "@gearbox-protocol/sdk": "^4.1.5",
48
48
  "@gearbox-protocol/sdk-gov": "^2.37.0",
49
49
  "@types/lodash-es": "^4.17.12",
50
50
  "@types/node": "^22.14.1",
@@ -66,7 +66,7 @@
66
66
  "react-dom": "^19.1.0",
67
67
  "table": "^6.9.0",
68
68
  "tsx": "^4.19.4",
69
- "viem": "^2.28.1",
69
+ "viem": "^2.28.3",
70
70
  "yaml": "^2.7.1",
71
71
  "zod": "^3.24.3"
72
72
  },