@gearbox-protocol/deploy-tools 5.9.12 → 5.9.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 +1771 -315
  2. package/package.json +2 -2
package/dist/index.mjs CHANGED
@@ -295635,15 +295635,15 @@ var require_crc32 = __commonJS({
295635
295635
  "use strict";
295636
295636
  var utils = require_utils36();
295637
295637
  function makeTable() {
295638
- var c, table2 = [];
295638
+ var c, table3 = [];
295639
295639
  for (var n = 0; n < 256; n++) {
295640
295640
  c = n;
295641
295641
  for (var k = 0; k < 8; k++) {
295642
295642
  c = c & 1 ? 3988292384 ^ c >>> 1 : c >>> 1;
295643
295643
  }
295644
- table2[n] = c;
295644
+ table3[n] = c;
295645
295645
  }
295646
- return table2;
295646
+ return table3;
295647
295647
  }
295648
295648
  var crcTable = makeTable();
295649
295649
  function crc32(crc, buf, len, pos) {
@@ -296641,15 +296641,15 @@ var require_crc322 = __commonJS({
296641
296641
  "../../node_modules/pako/lib/zlib/crc32.js"(exports2, module2) {
296642
296642
  "use strict";
296643
296643
  function makeTable() {
296644
- var c, table2 = [];
296644
+ var c, table3 = [];
296645
296645
  for (var n = 0; n < 256; n++) {
296646
296646
  c = n;
296647
296647
  for (var k = 0; k < 8; k++) {
296648
296648
  c = c & 1 ? 3988292384 ^ c >>> 1 : c >>> 1;
296649
296649
  }
296650
- table2[n] = c;
296650
+ table3[n] = c;
296651
296651
  }
296652
- return table2;
296652
+ return table3;
296653
296653
  }
296654
296654
  var crcTable = makeTable();
296655
296655
  function crc32(crc, buf, len, pos) {
@@ -298443,7 +298443,7 @@ var require_inftrees = __commonJS({
298443
298443
  64,
298444
298444
  64
298445
298445
  ];
298446
- module2.exports = function inflate_table(type, lens, lens_index, codes, table2, table_index, work, opts) {
298446
+ module2.exports = function inflate_table(type, lens, lens_index, codes, table3, table_index, work, opts) {
298447
298447
  var bits = opts.bits;
298448
298448
  var len = 0;
298449
298449
  var sym = 0;
@@ -298483,8 +298483,8 @@ var require_inftrees = __commonJS({
298483
298483
  root2 = max;
298484
298484
  }
298485
298485
  if (max === 0) {
298486
- table2[table_index++] = 1 << 24 | 64 << 16 | 0;
298487
- table2[table_index++] = 1 << 24 | 64 << 16 | 0;
298486
+ table3[table_index++] = 1 << 24 | 64 << 16 | 0;
298487
+ table3[table_index++] = 1 << 24 | 64 << 16 | 0;
298488
298488
  opts.bits = 1;
298489
298489
  return 0;
298490
298490
  }
@@ -298559,7 +298559,7 @@ var require_inftrees = __commonJS({
298559
298559
  min = fill;
298560
298560
  do {
298561
298561
  fill -= incr;
298562
- table2[next + (huff >> drop) + fill] = here_bits << 24 | here_op << 16 | here_val | 0;
298562
+ table3[next + (huff >> drop) + fill] = here_bits << 24 | here_op << 16 | here_val | 0;
298563
298563
  } while (fill !== 0);
298564
298564
  incr = 1 << len - 1;
298565
298565
  while (huff & incr) {
@@ -298598,11 +298598,11 @@ var require_inftrees = __commonJS({
298598
298598
  return 1;
298599
298599
  }
298600
298600
  low = huff & mask;
298601
- table2[low] = root2 << 24 | curr << 16 | next - table_index | 0;
298601
+ table3[low] = root2 << 24 | curr << 16 | next - table_index | 0;
298602
298602
  }
298603
298603
  }
298604
298604
  if (huff !== 0) {
298605
- table2[next + huff] = len - drop << 24 | 64 << 16 | 0;
298605
+ table3[next + huff] = len - drop << 24 | 64 << 16 | 0;
298606
298606
  }
298607
298607
  opts.bits = root2;
298608
298608
  return 0;
@@ -308528,7 +308528,7 @@ var require_table = __commonJS({
308528
308528
  var truncateTableData_1 = require_truncateTableData();
308529
308529
  var utils_1 = require_utils37();
308530
308530
  var validateTableData_1 = require_validateTableData();
308531
- var table2 = (data, userConfig = {}) => {
308531
+ var table3 = (data, userConfig = {}) => {
308532
308532
  (0, validateTableData_1.validateTableData)(data);
308533
308533
  let rows = (0, stringifyTableData_1.stringifyTableData)(data);
308534
308534
  const [injectedRows, injectedSpanningCellConfig] = (0, injectHeaderConfig_1.injectHeaderConfig)(rows, userConfig);
@@ -308543,7 +308543,7 @@ var require_table = __commonJS({
308543
308543
  const outputColumnWidths = (0, calculateOutputColumnWidths_1.calculateOutputColumnWidths)(config);
308544
308544
  return (0, drawTable_1.drawTable)(rows, outputColumnWidths, rowHeights, config);
308545
308545
  };
308546
- exports2.table = table2;
308546
+ exports2.table = table3;
308547
308547
  }
308548
308548
  });
308549
308549
 
@@ -366255,7 +366255,7 @@ var CreditSuite = class extends SDKConstruct {
366255
366255
  var GaugeContract = class extends BaseContract {
366256
366256
  quotaParams;
366257
366257
  epochFrozen;
366258
- currentEpoch;
366258
+ epochLastUpdate;
366259
366259
  rates;
366260
366260
  constructor(sdk, pool, gauge) {
366261
366261
  super(sdk, {
@@ -366263,16 +366263,16 @@ var GaugeContract = class extends BaseContract {
366263
366263
  name: `Gauge(${pool.name})`,
366264
366264
  abi: gaugeV3Abi
366265
366265
  });
366266
- const [_voter, currentEpoch, epochFrozen, gaugeParams] = decodeAbiParameters(
366266
+ const [_voter, epochLastUpdate, epochFrozen, gaugeTokens, gaugeParams] = decodeAbiParameters(
366267
366267
  [
366268
366268
  { name: "voter", type: "address" },
366269
- { name: "currentEpoch", type: "uint16" },
366269
+ { name: "epochLastUpdate", type: "uint16" },
366270
366270
  { name: "epochFrozen", type: "bool" },
366271
+ { name: "tokens", type: "address[]" },
366271
366272
  {
366272
366273
  name: "quotaParams",
366273
366274
  type: "tuple[]",
366274
366275
  components: [
366275
- { name: "token", type: "address" },
366276
366276
  { name: "minRate", type: "uint16" },
366277
366277
  { name: "maxRate", type: "uint16" },
366278
366278
  { name: "totalVotesLpSide", type: "uint96" },
@@ -366283,16 +366283,18 @@ var GaugeContract = class extends BaseContract {
366283
366283
  gauge.baseParams.serializedParams
366284
366284
  );
366285
366285
  this.epochFrozen = epochFrozen;
366286
- this.currentEpoch = currentEpoch;
366286
+ this.epochLastUpdate = epochLastUpdate;
366287
366287
  this.rates = new AddressMap(gauge.rates.map((r) => [r.token, r.rate]));
366288
366288
  this.quotaParams = new AddressMap();
366289
- for (const g of gaugeParams) {
366290
- this.quotaParams.upsert(g.token, {
366291
- minRate: g.minRate,
366292
- maxRate: g.maxRate,
366293
- totalVotesLpSide: g.totalVotesLpSide,
366294
- totalVotesCaSide: g.totalVotesCaSide,
366295
- rate: this.rates.get(g.token) ?? 0
366289
+ for (let i = 0; i < gaugeParams.length; i++) {
366290
+ const token = gaugeTokens[i];
366291
+ const params = gaugeParams[i];
366292
+ this.quotaParams.upsert(token, {
366293
+ minRate: params.minRate,
366294
+ maxRate: params.maxRate,
366295
+ totalVotesLpSide: params.totalVotesLpSide,
366296
+ totalVotesCaSide: params.totalVotesCaSide,
366297
+ rate: this.rates.get(token) ?? 0
366296
366298
  });
366297
366299
  }
366298
366300
  }
@@ -366314,7 +366316,7 @@ var GaugeContract = class extends BaseContract {
366314
366316
  stateHuman(raw) {
366315
366317
  return {
366316
366318
  ...super.stateHuman(raw),
366317
- currentEpoch: Number(this.currentEpoch),
366319
+ epochLastUpdate: Number(this.epochLastUpdate),
366318
366320
  epochFrozen: this.epochFrozen,
366319
366321
  quotaParams: this.quotaParams.entries().reduce(
366320
366322
  (acc, [address, params]) => ({
@@ -375316,7 +375318,7 @@ var MarketRegister = class extends SDKConstruct {
375316
375318
  * Mapping pool.address -> MarketSuite
375317
375319
  */
375318
375320
  #markets = new AddressMap();
375319
- #zappers = [];
375321
+ #zappers = new AddressMap();
375320
375322
  #marketFilter;
375321
375323
  constructor(sdk, markets) {
375322
375324
  super(sdk);
@@ -375352,21 +375354,23 @@ var MarketRegister = class extends SDKConstruct {
375352
375354
  })),
375353
375355
  allowFailure: true
375354
375356
  });
375355
- const zappers = [];
375356
375357
  for (let i = 0; i < resp.length; i++) {
375357
375358
  const { status, result, error } = resp[i];
375358
375359
  const marketConfigurator = this.markets[i].configurator.address;
375359
375360
  const pool = this.markets[i].pool.pool.address;
375360
375361
  if (status === "success") {
375361
- zappers.push(...result);
375362
+ const list = result;
375363
+ this.#zappers.upsert(
375364
+ pool,
375365
+ list.map((z2) => ({ ...z2, pool }))
375366
+ );
375362
375367
  } else {
375363
375368
  this.#logger?.error(
375364
375369
  `failed to load zapper for market configurator ${this.labelAddress(marketConfigurator)} and pool ${this.labelAddress(pool)}: ${error}`
375365
375370
  );
375366
375371
  }
375367
375372
  }
375368
- this.#zappers = zappers;
375369
- const zappersTokens = this.#zappers.flatMap((z2) => [z2.tokenIn, z2.tokenOut]);
375373
+ const zappersTokens = this.#zappers.values().flatMap((l) => l.flatMap((z2) => [z2.tokenIn, z2.tokenOut]));
375370
375374
  for (const t of zappersTokens) {
375371
375375
  this.sdk.tokensMeta.upsert(t.addr, t);
375372
375376
  this.sdk.provider.addressLabels.set(t.addr, t.symbol);
@@ -375496,13 +375500,15 @@ var MarketRegister = class extends SDKConstruct {
375496
375500
  stateHuman(raw = true) {
375497
375501
  return {
375498
375502
  markets: this.markets.map((market) => market.stateHuman(raw)),
375499
- zappers: this.zappers.map((z2) => ({
375500
- address: z2.baseParams.addr,
375501
- contractType: z2.baseParams.contractType,
375502
- version: Number(z2.baseParams.version),
375503
- tokenIn: this.labelAddress(z2.tokenIn.addr),
375504
- tokenOut: this.labelAddress(z2.tokenOut.addr)
375505
- }))
375503
+ zappers: this.zappers.values().flatMap(
375504
+ (l) => l.flatMap((z2) => ({
375505
+ address: z2.baseParams.addr,
375506
+ contractType: z2.baseParams.contractType,
375507
+ version: Number(z2.baseParams.version),
375508
+ tokenIn: this.labelAddress(z2.tokenIn.addr),
375509
+ tokenOut: this.labelAddress(z2.tokenOut.addr)
375510
+ }))
375511
+ )
375506
375512
  };
375507
375513
  }
375508
375514
  get pools() {
@@ -375835,192 +375841,1464 @@ var RouterV3Contract = class extends BaseContract {
375835
375841
  compareBalances
375836
375842
  ]
375837
375843
  }
375838
- };
375839
- }
375840
- /**
375841
- * @dev Finds the best path for opening Credit Account and converting all NORMAL tokens and LP token in the way to TARGET
375842
- * @param creditManager CreditManagerData which represents credit manager you want to use to open Credit Account
375843
- * @param expectedBalances Expected balances which would be on account accounting also debt. For example,
375844
- * if you open an USDC Credit Account, borrow 50_000 USDC and provide 10 WETH and 10_USDC as collateral
375845
- * from your own funds, expectedBalances should be: { "USDC": 60_000 * (10**6), "<address of WETH>": WAD.mul(10) }
375846
- * @param leftoverBalances Balances to keep on account after opening
375847
- * @param target Address of symbol of desired token
375848
- * @param slippage Slippage in PERCENTAGE_FORMAT (100% = 10_000) per operation
375849
- * @returns PathFinderOpenStrategyResult which
375850
- */
375851
- async findOpenStrategyPath({
375852
- creditManager: cm,
375853
- expectedBalances,
375854
- leftoverBalances,
375855
- target,
375856
- slippage
375857
- }) {
375858
- const [expectedMap, leftoverMap] = [
375859
- balancesMap(expectedBalances),
375860
- balancesMap(leftoverBalances)
375861
- ];
375862
- const input = cm.collateralTokens.map((token) => ({
375863
- token,
375864
- balance: expectedMap.get(token) ?? 0n
375865
- }));
375866
- const leftover = cm.collateralTokens.map((token) => ({
375867
- token,
375868
- balance: leftoverMap.get(token) ?? 0n
375869
- }));
375870
- const connectors2 = this.getAvailableConnectors(cm.collateralTokens);
375871
- const {
375872
- result: [outBalances, result]
375873
- } = await this.contract.simulate.findOpenStrategyPath(
375874
- [cm.address, input, leftover, target, connectors2, BigInt(slippage)],
375844
+ };
375845
+ }
375846
+ /**
375847
+ * @dev Finds the best path for opening Credit Account and converting all NORMAL tokens and LP token in the way to TARGET
375848
+ * @param creditManager CreditManagerData which represents credit manager you want to use to open Credit Account
375849
+ * @param expectedBalances Expected balances which would be on account accounting also debt. For example,
375850
+ * if you open an USDC Credit Account, borrow 50_000 USDC and provide 10 WETH and 10_USDC as collateral
375851
+ * from your own funds, expectedBalances should be: { "USDC": 60_000 * (10**6), "<address of WETH>": WAD.mul(10) }
375852
+ * @param leftoverBalances Balances to keep on account after opening
375853
+ * @param target Address of symbol of desired token
375854
+ * @param slippage Slippage in PERCENTAGE_FORMAT (100% = 10_000) per operation
375855
+ * @returns PathFinderOpenStrategyResult which
375856
+ */
375857
+ async findOpenStrategyPath({
375858
+ creditManager: cm,
375859
+ expectedBalances,
375860
+ leftoverBalances,
375861
+ target,
375862
+ slippage
375863
+ }) {
375864
+ const [expectedMap, leftoverMap] = [
375865
+ balancesMap(expectedBalances),
375866
+ balancesMap(leftoverBalances)
375867
+ ];
375868
+ const input = cm.collateralTokens.map((token) => ({
375869
+ token,
375870
+ balance: expectedMap.get(token) ?? 0n
375871
+ }));
375872
+ const leftover = cm.collateralTokens.map((token) => ({
375873
+ token,
375874
+ balance: leftoverMap.get(token) ?? 0n
375875
+ }));
375876
+ const connectors2 = this.getAvailableConnectors(cm.collateralTokens);
375877
+ const {
375878
+ result: [outBalances, result]
375879
+ } = await this.contract.simulate.findOpenStrategyPath(
375880
+ [cm.address, input, leftover, target, connectors2, BigInt(slippage)],
375881
+ {
375882
+ gas: GAS_PER_BLOCK
375883
+ }
375884
+ );
375885
+ const balancesAfter = Object.fromEntries(
375886
+ outBalances.map((b) => [b.token.toLowerCase(), b.balance])
375887
+ );
375888
+ return {
375889
+ balances: {
375890
+ ...balancesAfter,
375891
+ [target.toLowerCase()]: (expectedMap.get(target) ?? 0n) + result.amount
375892
+ },
375893
+ minBalances: {
375894
+ ...balancesAfter,
375895
+ [target.toLowerCase()]: (expectedMap.get(target) ?? 0n) + result.minAmount
375896
+ },
375897
+ amount: result.amount,
375898
+ minAmount: result.minAmount,
375899
+ calls: [...result.calls]
375900
+ };
375901
+ }
375902
+ /**
375903
+ * @dev Finds the path to swap / withdraw all assets from CreditAccount into underlying asset
375904
+ * Can bu used for closing Credit Account and for liquidations as well.
375905
+ * @param creditAccount CreditAccountStruct object used for close path computation
375906
+ * @param creditManager CreditManagerSlice for corresponding credit manager
375907
+ * @param slippage Slippage in PERCENTAGE_FORMAT (100% = 10_000) per operation
375908
+ * @return The best option in PathFinderCloseResult format, which
375909
+ * - underlyingBalance - total balance of underlying token
375910
+ * - calls - list of calls which should be done to swap & unwrap everything to underlying token
375911
+ */
375912
+ async findBestClosePath({
375913
+ creditAccount: ca,
375914
+ creditManager: cm,
375915
+ slippage,
375916
+ balances
375917
+ }) {
375918
+ const { pathOptions, expected, leftover, connectors: connectors2 } = this.getFindClosePathInput(
375919
+ ca,
375920
+ cm,
375921
+ balances ? {
375922
+ expectedBalances: assetsMap(balances.expectedBalances),
375923
+ leftoverBalances: assetsMap(balances.leftoverBalances)
375924
+ } : void 0
375925
+ );
375926
+ await this.#hooks.triggerHooks("foundPathOptions", {
375927
+ creditAccount: ca.creditAccount,
375928
+ pathOptions,
375929
+ expected,
375930
+ leftover,
375931
+ connectors: connectors2
375932
+ });
375933
+ let results = [];
375934
+ for (const po of pathOptions) {
375935
+ const { result: result2 } = await this.contract.simulate.findBestClosePath(
375936
+ [
375937
+ ca.creditAccount,
375938
+ expected,
375939
+ leftover,
375940
+ connectors2,
375941
+ BigInt(slippage),
375942
+ po,
375943
+ BigInt(LOOPS_PER_TX),
375944
+ false
375945
+ ],
375946
+ {
375947
+ gas: GAS_PER_BLOCK
375948
+ }
375949
+ );
375950
+ results.push({
375951
+ ...result2,
375952
+ calls: [...result2.calls]
375953
+ });
375954
+ }
375955
+ const bestResult = results.reduce(compareRouterResults, {
375956
+ amount: 0n,
375957
+ minAmount: 0n,
375958
+ calls: []
375959
+ });
375960
+ const underlyingBalance = ca.tokens.find((t) => t.token === ca.underlying)?.balance ?? 0n;
375961
+ const result = {
375962
+ amount: bestResult.amount,
375963
+ minAmount: bestResult.minAmount,
375964
+ calls: bestResult.calls.map((c) => ({
375965
+ callData: c.callData,
375966
+ target: c.target
375967
+ })),
375968
+ underlyingBalance: underlyingBalance + bestResult.minAmount
375969
+ };
375970
+ return result;
375971
+ }
375972
+ /**
375973
+ * Finds input to be used with findBestClosePath
375974
+ * @param ca
375975
+ * @param cm
375976
+ * @returns
375977
+ */
375978
+ getFindClosePathInput(ca, cm, balances) {
375979
+ const b = balances || this.getDefaultExpectedAndLeftover(ca);
375980
+ const { leftoverBalances, expectedBalances } = b;
375981
+ const pathOptions = PathOptionFactory.generatePathOptions(
375982
+ ca.tokens,
375983
+ this.provider.networkType,
375984
+ LOOPS_PER_TX
375985
+ );
375986
+ const expected = cm.collateralTokens.map((token) => {
375987
+ const actual = expectedBalances.get(token)?.balance || 0n;
375988
+ return {
375989
+ token,
375990
+ balance: actual > 10n ? actual : 0n
375991
+ };
375992
+ });
375993
+ const leftover = cm.collateralTokens.map((token) => ({
375994
+ token,
375995
+ balance: leftoverBalances.get(token)?.balance || 1n
375996
+ }));
375997
+ const connectors2 = this.getAvailableConnectors(cm.collateralTokens);
375998
+ return { expected, leftover, connectors: connectors2, pathOptions };
375999
+ }
376000
+ getDefaultExpectedAndLeftover(ca) {
376001
+ const expectedBalances = new AddressMap();
376002
+ const leftoverBalances = new AddressMap();
376003
+ for (const { token: t, balance, mask } of ca.tokens) {
376004
+ const token = t;
376005
+ const isEnabled = (mask & ca.enabledTokensMask) !== 0n;
376006
+ expectedBalances.upsert(token, { token, balance });
376007
+ const decimals2 = this.sdk.tokensMeta.decimals(token);
376008
+ const minBalance = 10n ** BigInt(Math.max(8, decimals2) - 8);
376009
+ if (balance < minBalance || !isEnabled) {
376010
+ leftoverBalances.upsert(token, { token, balance });
376011
+ }
376012
+ }
376013
+ return { expectedBalances, leftoverBalances };
376014
+ }
376015
+ getAvailableConnectors(collateralTokens) {
376016
+ return collateralTokens.filter(
376017
+ (t) => this.#connectors.includes(t.toLowerCase())
376018
+ );
376019
+ }
376020
+ };
376021
+ function compareRouterResults(a, b) {
376022
+ return a.amount > b.amount ? a : b;
376023
+ }
376024
+ function balancesMap(assets) {
376025
+ return new AddressMap(assets.map(({ token, balance }) => [token, balance]));
376026
+ }
376027
+ function assetsMap(assets) {
376028
+ return new AddressMap(assets.map((a) => [a.token, a]));
376029
+ }
376030
+ var EXTRA_FARM_TOKENS = {
376031
+ STETH: true,
376032
+ rETH: true,
376033
+ osETH: true,
376034
+ cbETH: true,
376035
+ wstETH: true,
376036
+ weETH: true,
376037
+ ezETH: true,
376038
+ sfrxETH: true,
376039
+ USDe: true,
376040
+ rsETH: true,
376041
+ rswETH: true,
376042
+ pufETH: true,
376043
+ pzETH: true,
376044
+ rstETH: true,
376045
+ steakLRT: true,
376046
+ amphrETH: true,
376047
+ LBTC: true,
376048
+ Re7LRT: true,
376049
+ PT_ezETH_26DEC2024: true,
376050
+ PT_eETH_26DEC2024: true,
376051
+ PT_sUSDe_26DEC2024: true,
376052
+ PT_eBTC_26DEC2024: true,
376053
+ PT_LBTC_27MAR2025: true,
376054
+ eBTC: true,
376055
+ PT_cornLBTC_26DEC2024: true,
376056
+ PT_corn_eBTC_27MAR2025: true,
376057
+ PT_corn_pumpBTC_26DEC2024: true,
376058
+ pumpBTC: true,
376059
+ PT_sUSDe_27MAR2025: true,
376060
+ DVstETH: true,
376061
+ beraSTONE: true,
376062
+ PT_sUSDe_29MAY2025: true,
376063
+ tETH: true
376064
+ };
376065
+ var { USDe, ...rest } = EXTRA_FARM_TOKENS;
376066
+ var CREDIT_SESSION_STATUS_BY_ID = {
376067
+ 0: "active",
376068
+ 1: "closed",
376069
+ 2: "repaid",
376070
+ 3: "liquidated",
376071
+ 4: "liquidateExpired",
376072
+ 5: "liquidatePaused"
376073
+ };
376074
+ var CREDIT_SESSION_ID_BY_STATUS = TypedObjectUtils.swapKeyValue(
376075
+ CREDIT_SESSION_STATUS_BY_ID
376076
+ );
376077
+ var TESTNET_CHAINS = {
376078
+ Mainnet: 7878,
376079
+ Optimism: 7879,
376080
+ Arbitrum: 7880,
376081
+ Base: 7881,
376082
+ Sonic: 7882
376083
+ };
376084
+ var CHARTS_BACKEND_ADDRESSES = {
376085
+ [chains.Mainnet.id]: "https://charts-server.fly.dev",
376086
+ [chains.Arbitrum.id]: "https://charts-server.fly.dev",
376087
+ [chains.Optimism.id]: "https://charts-server.fly.dev",
376088
+ [chains.Base.id]: "https://charts-server.fly.dev",
376089
+ [TESTNET_CHAINS.Mainnet]: "https://testnet.gearbox.foundation",
376090
+ [TESTNET_CHAINS.Arbitrum]: "https://arbtest.gearbox.foundation",
376091
+ [TESTNET_CHAINS.Optimism]: "https://opttest.gearbox.foundation"
376092
+ // !& Base
376093
+ };
376094
+ var LEADERBOARD_APIS = {
376095
+ [chains.Mainnet.id]: "https://gpointbot.fly.dev",
376096
+ [chains.Optimism.id]: "https://gpointbot.fly.dev",
376097
+ [chains.Arbitrum.id]: "https://gpointbot.fly.dev",
376098
+ [TESTNET_CHAINS.Mainnet]: "https://testnet.gearbox.foundation/gpointbot",
376099
+ [TESTNET_CHAINS.Optimism]: "https://testnet.gearbox.foundation/gpointbot",
376100
+ [TESTNET_CHAINS.Arbitrum]: "https://testnet.gearbox.foundation/gpointbot"
376101
+ };
376102
+ var iBaseRewardPoolAbi = [
376103
+ {
376104
+ type: "function",
376105
+ inputs: [{ name: "account", internalType: "address", type: "address" }],
376106
+ name: "balanceOf",
376107
+ outputs: [{ name: "", internalType: "uint256", type: "uint256" }],
376108
+ stateMutability: "view"
376109
+ },
376110
+ {
376111
+ type: "function",
376112
+ inputs: [],
376113
+ name: "currentRewards",
376114
+ outputs: [{ name: "", internalType: "uint256", type: "uint256" }],
376115
+ stateMutability: "view"
376116
+ },
376117
+ {
376118
+ type: "function",
376119
+ inputs: [{ name: "_amount", internalType: "uint256", type: "uint256" }],
376120
+ name: "donate",
376121
+ outputs: [{ name: "", internalType: "bool", type: "bool" }],
376122
+ stateMutability: "nonpayable"
376123
+ },
376124
+ {
376125
+ type: "function",
376126
+ inputs: [],
376127
+ name: "duration",
376128
+ outputs: [{ name: "", internalType: "uint256", type: "uint256" }],
376129
+ stateMutability: "view"
376130
+ },
376131
+ {
376132
+ type: "function",
376133
+ inputs: [{ name: "account", internalType: "address", type: "address" }],
376134
+ name: "earned",
376135
+ outputs: [{ name: "", internalType: "uint256", type: "uint256" }],
376136
+ stateMutability: "view"
376137
+ },
376138
+ {
376139
+ type: "function",
376140
+ inputs: [{ name: "i", internalType: "uint256", type: "uint256" }],
376141
+ name: "extraRewards",
376142
+ outputs: [{ name: "", internalType: "address", type: "address" }],
376143
+ stateMutability: "view"
376144
+ },
376145
+ {
376146
+ type: "function",
376147
+ inputs: [],
376148
+ name: "extraRewardsLength",
376149
+ outputs: [{ name: "", internalType: "uint256", type: "uint256" }],
376150
+ stateMutability: "view"
376151
+ },
376152
+ {
376153
+ type: "function",
376154
+ inputs: [],
376155
+ name: "getReward",
376156
+ outputs: [{ name: "", internalType: "bool", type: "bool" }],
376157
+ stateMutability: "nonpayable"
376158
+ },
376159
+ {
376160
+ type: "function",
376161
+ inputs: [
376162
+ { name: "_account", internalType: "address", type: "address" },
376163
+ { name: "_claimExtras", internalType: "bool", type: "bool" }
376164
+ ],
376165
+ name: "getReward",
376166
+ outputs: [{ name: "", internalType: "bool", type: "bool" }],
376167
+ stateMutability: "nonpayable"
376168
+ },
376169
+ {
376170
+ type: "function",
376171
+ inputs: [],
376172
+ name: "historicalRewards",
376173
+ outputs: [{ name: "", internalType: "uint256", type: "uint256" }],
376174
+ stateMutability: "view"
376175
+ },
376176
+ {
376177
+ type: "function",
376178
+ inputs: [],
376179
+ name: "lastTimeRewardApplicable",
376180
+ outputs: [{ name: "", internalType: "uint256", type: "uint256" }],
376181
+ stateMutability: "view"
376182
+ },
376183
+ {
376184
+ type: "function",
376185
+ inputs: [],
376186
+ name: "lastUpdateTime",
376187
+ outputs: [{ name: "", internalType: "uint256", type: "uint256" }],
376188
+ stateMutability: "view"
376189
+ },
376190
+ {
376191
+ type: "function",
376192
+ inputs: [],
376193
+ name: "newRewardRatio",
376194
+ outputs: [{ name: "", internalType: "uint256", type: "uint256" }],
376195
+ stateMutability: "view"
376196
+ },
376197
+ {
376198
+ type: "function",
376199
+ inputs: [],
376200
+ name: "operator",
376201
+ outputs: [{ name: "", internalType: "address", type: "address" }],
376202
+ stateMutability: "view"
376203
+ },
376204
+ {
376205
+ type: "function",
376206
+ inputs: [],
376207
+ name: "periodFinish",
376208
+ outputs: [{ name: "", internalType: "uint256", type: "uint256" }],
376209
+ stateMutability: "view"
376210
+ },
376211
+ {
376212
+ type: "function",
376213
+ inputs: [],
376214
+ name: "pid",
376215
+ outputs: [{ name: "", internalType: "uint256", type: "uint256" }],
376216
+ stateMutability: "view"
376217
+ },
376218
+ {
376219
+ type: "function",
376220
+ inputs: [],
376221
+ name: "queuedRewards",
376222
+ outputs: [{ name: "", internalType: "uint256", type: "uint256" }],
376223
+ stateMutability: "view"
376224
+ },
376225
+ {
376226
+ type: "function",
376227
+ inputs: [],
376228
+ name: "rewardManager",
376229
+ outputs: [{ name: "", internalType: "address", type: "address" }],
376230
+ stateMutability: "view"
376231
+ },
376232
+ {
376233
+ type: "function",
376234
+ inputs: [],
376235
+ name: "rewardPerToken",
376236
+ outputs: [{ name: "", internalType: "uint256", type: "uint256" }],
376237
+ stateMutability: "view"
376238
+ },
376239
+ {
376240
+ type: "function",
376241
+ inputs: [],
376242
+ name: "rewardPerTokenStored",
376243
+ outputs: [{ name: "", internalType: "uint256", type: "uint256" }],
376244
+ stateMutability: "view"
376245
+ },
376246
+ {
376247
+ type: "function",
376248
+ inputs: [],
376249
+ name: "rewardRate",
376250
+ outputs: [{ name: "", internalType: "uint256", type: "uint256" }],
376251
+ stateMutability: "view"
376252
+ },
376253
+ {
376254
+ type: "function",
376255
+ inputs: [],
376256
+ name: "rewardToken",
376257
+ outputs: [{ name: "", internalType: "contract IERC20", type: "address" }],
376258
+ stateMutability: "view"
376259
+ },
376260
+ {
376261
+ type: "function",
376262
+ inputs: [{ name: "account", internalType: "address", type: "address" }],
376263
+ name: "rewards",
376264
+ outputs: [{ name: "", internalType: "uint256", type: "uint256" }],
376265
+ stateMutability: "view"
376266
+ },
376267
+ {
376268
+ type: "function",
376269
+ inputs: [{ name: "_amount", internalType: "uint256", type: "uint256" }],
376270
+ name: "stake",
376271
+ outputs: [{ name: "", internalType: "bool", type: "bool" }],
376272
+ stateMutability: "nonpayable"
376273
+ },
376274
+ {
376275
+ type: "function",
376276
+ inputs: [],
376277
+ name: "stakeAll",
376278
+ outputs: [{ name: "", internalType: "bool", type: "bool" }],
376279
+ stateMutability: "nonpayable"
376280
+ },
376281
+ {
376282
+ type: "function",
376283
+ inputs: [
376284
+ { name: "_for", internalType: "address", type: "address" },
376285
+ { name: "_amount", internalType: "uint256", type: "uint256" }
376286
+ ],
376287
+ name: "stakeFor",
376288
+ outputs: [{ name: "", internalType: "bool", type: "bool" }],
376289
+ stateMutability: "nonpayable"
376290
+ },
376291
+ {
376292
+ type: "function",
376293
+ inputs: [],
376294
+ name: "stakingToken",
376295
+ outputs: [{ name: "", internalType: "contract IERC20", type: "address" }],
376296
+ stateMutability: "view"
376297
+ },
376298
+ {
376299
+ type: "function",
376300
+ inputs: [],
376301
+ name: "totalSupply",
376302
+ outputs: [{ name: "", internalType: "uint256", type: "uint256" }],
376303
+ stateMutability: "view"
376304
+ },
376305
+ {
376306
+ type: "function",
376307
+ inputs: [{ name: "account", internalType: "address", type: "address" }],
376308
+ name: "userRewardPerTokenPaid",
376309
+ outputs: [{ name: "", internalType: "uint256", type: "uint256" }],
376310
+ stateMutability: "view"
376311
+ },
376312
+ {
376313
+ type: "function",
376314
+ inputs: [
376315
+ { name: "amount", internalType: "uint256", type: "uint256" },
376316
+ { name: "claim", internalType: "bool", type: "bool" }
376317
+ ],
376318
+ name: "withdraw",
376319
+ outputs: [{ name: "", internalType: "bool", type: "bool" }],
376320
+ stateMutability: "nonpayable"
376321
+ },
376322
+ {
376323
+ type: "function",
376324
+ inputs: [{ name: "claim", internalType: "bool", type: "bool" }],
376325
+ name: "withdrawAll",
376326
+ outputs: [],
376327
+ stateMutability: "nonpayable"
376328
+ },
376329
+ {
376330
+ type: "function",
376331
+ inputs: [{ name: "claim", internalType: "bool", type: "bool" }],
376332
+ name: "withdrawAllAndUnwrap",
376333
+ outputs: [],
376334
+ stateMutability: "nonpayable"
376335
+ },
376336
+ {
376337
+ type: "function",
376338
+ inputs: [
376339
+ { name: "amount", internalType: "uint256", type: "uint256" },
376340
+ { name: "claim", internalType: "bool", type: "bool" }
376341
+ ],
376342
+ name: "withdrawAndUnwrap",
376343
+ outputs: [{ name: "", internalType: "bool", type: "bool" }],
376344
+ stateMutability: "nonpayable"
376345
+ }
376346
+ ];
376347
+ var iDataCompressorV3Abi = [
376348
+ {
376349
+ type: "function",
376350
+ inputs: [
376351
+ { name: "creditAccount", internalType: "address", type: "address" },
376352
+ {
376353
+ name: "priceUpdates",
376354
+ internalType: "struct PriceOnDemand[]",
376355
+ type: "tuple[]",
376356
+ components: [
376357
+ { name: "token", internalType: "address", type: "address" },
376358
+ { name: "callData", internalType: "bytes", type: "bytes" }
376359
+ ]
376360
+ }
376361
+ ],
376362
+ name: "getCreditAccountData",
376363
+ outputs: [
376364
+ {
376365
+ name: "",
376366
+ internalType: "struct CreditAccountData",
376367
+ type: "tuple",
376368
+ components: [
376369
+ { name: "isSuccessful", internalType: "bool", type: "bool" },
376370
+ {
376371
+ name: "priceFeedsNeeded",
376372
+ internalType: "address[]",
376373
+ type: "address[]"
376374
+ },
376375
+ { name: "addr", internalType: "address", type: "address" },
376376
+ { name: "borrower", internalType: "address", type: "address" },
376377
+ { name: "creditManager", internalType: "address", type: "address" },
376378
+ { name: "cmName", internalType: "string", type: "string" },
376379
+ { name: "creditFacade", internalType: "address", type: "address" },
376380
+ { name: "underlying", internalType: "address", type: "address" },
376381
+ { name: "debt", internalType: "uint256", type: "uint256" },
376382
+ {
376383
+ name: "cumulativeIndexLastUpdate",
376384
+ internalType: "uint256",
376385
+ type: "uint256"
376386
+ },
376387
+ {
376388
+ name: "cumulativeQuotaInterest",
376389
+ internalType: "uint128",
376390
+ type: "uint128"
376391
+ },
376392
+ { name: "accruedInterest", internalType: "uint256", type: "uint256" },
376393
+ { name: "accruedFees", internalType: "uint256", type: "uint256" },
376394
+ { name: "totalDebtUSD", internalType: "uint256", type: "uint256" },
376395
+ { name: "totalValue", internalType: "uint256", type: "uint256" },
376396
+ { name: "totalValueUSD", internalType: "uint256", type: "uint256" },
376397
+ { name: "twvUSD", internalType: "uint256", type: "uint256" },
376398
+ {
376399
+ name: "enabledTokensMask",
376400
+ internalType: "uint256",
376401
+ type: "uint256"
376402
+ },
376403
+ { name: "healthFactor", internalType: "uint256", type: "uint256" },
376404
+ { name: "baseBorrowRate", internalType: "uint256", type: "uint256" },
376405
+ {
376406
+ name: "aggregatedBorrowRate",
376407
+ internalType: "uint256",
376408
+ type: "uint256"
376409
+ },
376410
+ {
376411
+ name: "balances",
376412
+ internalType: "struct TokenBalance[]",
376413
+ type: "tuple[]",
376414
+ components: [
376415
+ { name: "token", internalType: "address", type: "address" },
376416
+ { name: "balance", internalType: "uint256", type: "uint256" },
376417
+ { name: "isForbidden", internalType: "bool", type: "bool" },
376418
+ { name: "isEnabled", internalType: "bool", type: "bool" },
376419
+ { name: "isQuoted", internalType: "bool", type: "bool" },
376420
+ { name: "quota", internalType: "uint256", type: "uint256" },
376421
+ { name: "quotaRate", internalType: "uint16", type: "uint16" },
376422
+ {
376423
+ name: "quotaCumulativeIndexLU",
376424
+ internalType: "uint256",
376425
+ type: "uint256"
376426
+ }
376427
+ ]
376428
+ },
376429
+ { name: "since", internalType: "uint64", type: "uint64" },
376430
+ { name: "cfVersion", internalType: "uint256", type: "uint256" },
376431
+ { name: "expirationDate", internalType: "uint40", type: "uint40" },
376432
+ { name: "activeBots", internalType: "address[]", type: "address[]" }
376433
+ ]
376434
+ }
376435
+ ],
376436
+ stateMutability: "nonpayable"
376437
+ },
376438
+ {
376439
+ type: "function",
376440
+ inputs: [
376441
+ { name: "borrower", internalType: "address", type: "address" },
376442
+ {
376443
+ name: "priceUpdates",
376444
+ internalType: "struct PriceOnDemand[]",
376445
+ type: "tuple[]",
376446
+ components: [
376447
+ { name: "token", internalType: "address", type: "address" },
376448
+ { name: "callData", internalType: "bytes", type: "bytes" }
376449
+ ]
376450
+ }
376451
+ ],
376452
+ name: "getCreditAccountsByBorrower",
376453
+ outputs: [
376454
+ {
376455
+ name: "",
376456
+ internalType: "struct CreditAccountData[]",
376457
+ type: "tuple[]",
376458
+ components: [
376459
+ { name: "isSuccessful", internalType: "bool", type: "bool" },
376460
+ {
376461
+ name: "priceFeedsNeeded",
376462
+ internalType: "address[]",
376463
+ type: "address[]"
376464
+ },
376465
+ { name: "addr", internalType: "address", type: "address" },
376466
+ { name: "borrower", internalType: "address", type: "address" },
376467
+ { name: "creditManager", internalType: "address", type: "address" },
376468
+ { name: "cmName", internalType: "string", type: "string" },
376469
+ { name: "creditFacade", internalType: "address", type: "address" },
376470
+ { name: "underlying", internalType: "address", type: "address" },
376471
+ { name: "debt", internalType: "uint256", type: "uint256" },
376472
+ {
376473
+ name: "cumulativeIndexLastUpdate",
376474
+ internalType: "uint256",
376475
+ type: "uint256"
376476
+ },
376477
+ {
376478
+ name: "cumulativeQuotaInterest",
376479
+ internalType: "uint128",
376480
+ type: "uint128"
376481
+ },
376482
+ { name: "accruedInterest", internalType: "uint256", type: "uint256" },
376483
+ { name: "accruedFees", internalType: "uint256", type: "uint256" },
376484
+ { name: "totalDebtUSD", internalType: "uint256", type: "uint256" },
376485
+ { name: "totalValue", internalType: "uint256", type: "uint256" },
376486
+ { name: "totalValueUSD", internalType: "uint256", type: "uint256" },
376487
+ { name: "twvUSD", internalType: "uint256", type: "uint256" },
376488
+ {
376489
+ name: "enabledTokensMask",
376490
+ internalType: "uint256",
376491
+ type: "uint256"
376492
+ },
376493
+ { name: "healthFactor", internalType: "uint256", type: "uint256" },
376494
+ { name: "baseBorrowRate", internalType: "uint256", type: "uint256" },
376495
+ {
376496
+ name: "aggregatedBorrowRate",
376497
+ internalType: "uint256",
376498
+ type: "uint256"
376499
+ },
376500
+ {
376501
+ name: "balances",
376502
+ internalType: "struct TokenBalance[]",
376503
+ type: "tuple[]",
376504
+ components: [
376505
+ { name: "token", internalType: "address", type: "address" },
376506
+ { name: "balance", internalType: "uint256", type: "uint256" },
376507
+ { name: "isForbidden", internalType: "bool", type: "bool" },
376508
+ { name: "isEnabled", internalType: "bool", type: "bool" },
376509
+ { name: "isQuoted", internalType: "bool", type: "bool" },
376510
+ { name: "quota", internalType: "uint256", type: "uint256" },
376511
+ { name: "quotaRate", internalType: "uint16", type: "uint16" },
376512
+ {
376513
+ name: "quotaCumulativeIndexLU",
376514
+ internalType: "uint256",
376515
+ type: "uint256"
376516
+ }
376517
+ ]
376518
+ },
376519
+ { name: "since", internalType: "uint64", type: "uint64" },
376520
+ { name: "cfVersion", internalType: "uint256", type: "uint256" },
376521
+ { name: "expirationDate", internalType: "uint40", type: "uint40" },
376522
+ { name: "activeBots", internalType: "address[]", type: "address[]" }
376523
+ ]
376524
+ }
376525
+ ],
376526
+ stateMutability: "nonpayable"
376527
+ },
376528
+ {
376529
+ type: "function",
376530
+ inputs: [
376531
+ { name: "creditManager", internalType: "address", type: "address" },
376532
+ {
376533
+ name: "priceUpdates",
376534
+ internalType: "struct PriceOnDemand[]",
376535
+ type: "tuple[]",
376536
+ components: [
376537
+ { name: "token", internalType: "address", type: "address" },
376538
+ { name: "callData", internalType: "bytes", type: "bytes" }
376539
+ ]
376540
+ }
376541
+ ],
376542
+ name: "getCreditAccountsByCreditManager",
376543
+ outputs: [
376544
+ {
376545
+ name: "",
376546
+ internalType: "struct CreditAccountData[]",
376547
+ type: "tuple[]",
376548
+ components: [
376549
+ { name: "isSuccessful", internalType: "bool", type: "bool" },
376550
+ {
376551
+ name: "priceFeedsNeeded",
376552
+ internalType: "address[]",
376553
+ type: "address[]"
376554
+ },
376555
+ { name: "addr", internalType: "address", type: "address" },
376556
+ { name: "borrower", internalType: "address", type: "address" },
376557
+ { name: "creditManager", internalType: "address", type: "address" },
376558
+ { name: "cmName", internalType: "string", type: "string" },
376559
+ { name: "creditFacade", internalType: "address", type: "address" },
376560
+ { name: "underlying", internalType: "address", type: "address" },
376561
+ { name: "debt", internalType: "uint256", type: "uint256" },
376562
+ {
376563
+ name: "cumulativeIndexLastUpdate",
376564
+ internalType: "uint256",
376565
+ type: "uint256"
376566
+ },
376567
+ {
376568
+ name: "cumulativeQuotaInterest",
376569
+ internalType: "uint128",
376570
+ type: "uint128"
376571
+ },
376572
+ { name: "accruedInterest", internalType: "uint256", type: "uint256" },
376573
+ { name: "accruedFees", internalType: "uint256", type: "uint256" },
376574
+ { name: "totalDebtUSD", internalType: "uint256", type: "uint256" },
376575
+ { name: "totalValue", internalType: "uint256", type: "uint256" },
376576
+ { name: "totalValueUSD", internalType: "uint256", type: "uint256" },
376577
+ { name: "twvUSD", internalType: "uint256", type: "uint256" },
376578
+ {
376579
+ name: "enabledTokensMask",
376580
+ internalType: "uint256",
376581
+ type: "uint256"
376582
+ },
376583
+ { name: "healthFactor", internalType: "uint256", type: "uint256" },
376584
+ { name: "baseBorrowRate", internalType: "uint256", type: "uint256" },
376585
+ {
376586
+ name: "aggregatedBorrowRate",
376587
+ internalType: "uint256",
376588
+ type: "uint256"
376589
+ },
376590
+ {
376591
+ name: "balances",
376592
+ internalType: "struct TokenBalance[]",
376593
+ type: "tuple[]",
376594
+ components: [
376595
+ { name: "token", internalType: "address", type: "address" },
376596
+ { name: "balance", internalType: "uint256", type: "uint256" },
376597
+ { name: "isForbidden", internalType: "bool", type: "bool" },
376598
+ { name: "isEnabled", internalType: "bool", type: "bool" },
376599
+ { name: "isQuoted", internalType: "bool", type: "bool" },
376600
+ { name: "quota", internalType: "uint256", type: "uint256" },
376601
+ { name: "quotaRate", internalType: "uint16", type: "uint16" },
376602
+ {
376603
+ name: "quotaCumulativeIndexLU",
376604
+ internalType: "uint256",
376605
+ type: "uint256"
376606
+ }
376607
+ ]
376608
+ },
376609
+ { name: "since", internalType: "uint64", type: "uint64" },
376610
+ { name: "cfVersion", internalType: "uint256", type: "uint256" },
376611
+ { name: "expirationDate", internalType: "uint40", type: "uint40" },
376612
+ { name: "activeBots", internalType: "address[]", type: "address[]" }
376613
+ ]
376614
+ }
376615
+ ],
376616
+ stateMutability: "nonpayable"
376617
+ },
376618
+ {
376619
+ type: "function",
376620
+ inputs: [
376621
+ { name: "creditManager", internalType: "address", type: "address" }
376622
+ ],
376623
+ name: "getCreditManagerData",
376624
+ outputs: [
376625
+ {
376626
+ name: "",
376627
+ internalType: "struct CreditManagerData",
376628
+ type: "tuple",
376629
+ components: [
376630
+ { name: "addr", internalType: "address", type: "address" },
376631
+ { name: "name", internalType: "string", type: "string" },
376632
+ { name: "cfVersion", internalType: "uint256", type: "uint256" },
376633
+ { name: "creditFacade", internalType: "address", type: "address" },
376634
+ {
376635
+ name: "creditConfigurator",
376636
+ internalType: "address",
376637
+ type: "address"
376638
+ },
376639
+ { name: "underlying", internalType: "address", type: "address" },
376640
+ { name: "pool", internalType: "address", type: "address" },
376641
+ { name: "totalDebt", internalType: "uint256", type: "uint256" },
376642
+ { name: "totalDebtLimit", internalType: "uint256", type: "uint256" },
376643
+ { name: "baseBorrowRate", internalType: "uint256", type: "uint256" },
376644
+ { name: "minDebt", internalType: "uint256", type: "uint256" },
376645
+ { name: "maxDebt", internalType: "uint256", type: "uint256" },
376646
+ {
376647
+ name: "availableToBorrow",
376648
+ internalType: "uint256",
376649
+ type: "uint256"
376650
+ },
376651
+ {
376652
+ name: "collateralTokens",
376653
+ internalType: "address[]",
376654
+ type: "address[]"
376655
+ },
376656
+ {
376657
+ name: "adapters",
376658
+ internalType: "struct ContractAdapter[]",
376659
+ type: "tuple[]",
376660
+ components: [
376661
+ {
376662
+ name: "targetContract",
376663
+ internalType: "address",
376664
+ type: "address"
376665
+ },
376666
+ { name: "adapter", internalType: "address", type: "address" }
376667
+ ]
376668
+ },
376669
+ {
376670
+ name: "liquidationThresholds",
376671
+ internalType: "uint256[]",
376672
+ type: "uint256[]"
376673
+ },
376674
+ { name: "isDegenMode", internalType: "bool", type: "bool" },
376675
+ { name: "degenNFT", internalType: "address", type: "address" },
376676
+ {
376677
+ name: "forbiddenTokenMask",
376678
+ internalType: "uint256",
376679
+ type: "uint256"
376680
+ },
376681
+ {
376682
+ name: "maxEnabledTokensLength",
376683
+ internalType: "uint8",
376684
+ type: "uint8"
376685
+ },
376686
+ { name: "feeInterest", internalType: "uint16", type: "uint16" },
376687
+ { name: "feeLiquidation", internalType: "uint16", type: "uint16" },
376688
+ {
376689
+ name: "liquidationDiscount",
376690
+ internalType: "uint16",
376691
+ type: "uint16"
376692
+ },
376693
+ {
376694
+ name: "feeLiquidationExpired",
376695
+ internalType: "uint16",
376696
+ type: "uint16"
376697
+ },
376698
+ {
376699
+ name: "liquidationDiscountExpired",
376700
+ internalType: "uint16",
376701
+ type: "uint16"
376702
+ },
376703
+ {
376704
+ name: "quotas",
376705
+ internalType: "struct QuotaInfo[]",
376706
+ type: "tuple[]",
376707
+ components: [
376708
+ { name: "token", internalType: "address", type: "address" },
376709
+ { name: "rate", internalType: "uint16", type: "uint16" },
376710
+ {
376711
+ name: "quotaIncreaseFee",
376712
+ internalType: "uint16",
376713
+ type: "uint16"
376714
+ },
376715
+ { name: "totalQuoted", internalType: "uint96", type: "uint96" },
376716
+ { name: "limit", internalType: "uint96", type: "uint96" },
376717
+ { name: "isActive", internalType: "bool", type: "bool" }
376718
+ ]
376719
+ },
376720
+ {
376721
+ name: "lirm",
376722
+ internalType: "struct LinearModel",
376723
+ type: "tuple",
376724
+ components: [
376725
+ {
376726
+ name: "interestModel",
376727
+ internalType: "address",
376728
+ type: "address"
376729
+ },
376730
+ { name: "version", internalType: "uint256", type: "uint256" },
376731
+ { name: "U_1", internalType: "uint16", type: "uint16" },
376732
+ { name: "U_2", internalType: "uint16", type: "uint16" },
376733
+ { name: "R_base", internalType: "uint16", type: "uint16" },
376734
+ { name: "R_slope1", internalType: "uint16", type: "uint16" },
376735
+ { name: "R_slope2", internalType: "uint16", type: "uint16" },
376736
+ { name: "R_slope3", internalType: "uint16", type: "uint16" },
376737
+ {
376738
+ name: "isBorrowingMoreU2Forbidden",
376739
+ internalType: "bool",
376740
+ type: "bool"
376741
+ }
376742
+ ]
376743
+ },
376744
+ { name: "isPaused", internalType: "bool", type: "bool" }
376745
+ ]
376746
+ }
376747
+ ],
376748
+ stateMutability: "view"
376749
+ },
376750
+ {
376751
+ type: "function",
376752
+ inputs: [],
376753
+ name: "getCreditManagersV3List",
376754
+ outputs: [
376755
+ {
376756
+ name: "",
376757
+ internalType: "struct CreditManagerData[]",
376758
+ type: "tuple[]",
376759
+ components: [
376760
+ { name: "addr", internalType: "address", type: "address" },
376761
+ { name: "name", internalType: "string", type: "string" },
376762
+ { name: "cfVersion", internalType: "uint256", type: "uint256" },
376763
+ { name: "creditFacade", internalType: "address", type: "address" },
376764
+ {
376765
+ name: "creditConfigurator",
376766
+ internalType: "address",
376767
+ type: "address"
376768
+ },
376769
+ { name: "underlying", internalType: "address", type: "address" },
376770
+ { name: "pool", internalType: "address", type: "address" },
376771
+ { name: "totalDebt", internalType: "uint256", type: "uint256" },
376772
+ { name: "totalDebtLimit", internalType: "uint256", type: "uint256" },
376773
+ { name: "baseBorrowRate", internalType: "uint256", type: "uint256" },
376774
+ { name: "minDebt", internalType: "uint256", type: "uint256" },
376775
+ { name: "maxDebt", internalType: "uint256", type: "uint256" },
376776
+ {
376777
+ name: "availableToBorrow",
376778
+ internalType: "uint256",
376779
+ type: "uint256"
376780
+ },
376781
+ {
376782
+ name: "collateralTokens",
376783
+ internalType: "address[]",
376784
+ type: "address[]"
376785
+ },
376786
+ {
376787
+ name: "adapters",
376788
+ internalType: "struct ContractAdapter[]",
376789
+ type: "tuple[]",
376790
+ components: [
376791
+ {
376792
+ name: "targetContract",
376793
+ internalType: "address",
376794
+ type: "address"
376795
+ },
376796
+ { name: "adapter", internalType: "address", type: "address" }
376797
+ ]
376798
+ },
376799
+ {
376800
+ name: "liquidationThresholds",
376801
+ internalType: "uint256[]",
376802
+ type: "uint256[]"
376803
+ },
376804
+ { name: "isDegenMode", internalType: "bool", type: "bool" },
376805
+ { name: "degenNFT", internalType: "address", type: "address" },
376806
+ {
376807
+ name: "forbiddenTokenMask",
376808
+ internalType: "uint256",
376809
+ type: "uint256"
376810
+ },
376811
+ {
376812
+ name: "maxEnabledTokensLength",
376813
+ internalType: "uint8",
376814
+ type: "uint8"
376815
+ },
376816
+ { name: "feeInterest", internalType: "uint16", type: "uint16" },
376817
+ { name: "feeLiquidation", internalType: "uint16", type: "uint16" },
376818
+ {
376819
+ name: "liquidationDiscount",
376820
+ internalType: "uint16",
376821
+ type: "uint16"
376822
+ },
376823
+ {
376824
+ name: "feeLiquidationExpired",
376825
+ internalType: "uint16",
376826
+ type: "uint16"
376827
+ },
376828
+ {
376829
+ name: "liquidationDiscountExpired",
376830
+ internalType: "uint16",
376831
+ type: "uint16"
376832
+ },
376833
+ {
376834
+ name: "quotas",
376835
+ internalType: "struct QuotaInfo[]",
376836
+ type: "tuple[]",
376837
+ components: [
376838
+ { name: "token", internalType: "address", type: "address" },
376839
+ { name: "rate", internalType: "uint16", type: "uint16" },
376840
+ {
376841
+ name: "quotaIncreaseFee",
376842
+ internalType: "uint16",
376843
+ type: "uint16"
376844
+ },
376845
+ { name: "totalQuoted", internalType: "uint96", type: "uint96" },
376846
+ { name: "limit", internalType: "uint96", type: "uint96" },
376847
+ { name: "isActive", internalType: "bool", type: "bool" }
376848
+ ]
376849
+ },
376850
+ {
376851
+ name: "lirm",
376852
+ internalType: "struct LinearModel",
376853
+ type: "tuple",
376854
+ components: [
376855
+ {
376856
+ name: "interestModel",
376857
+ internalType: "address",
376858
+ type: "address"
376859
+ },
376860
+ { name: "version", internalType: "uint256", type: "uint256" },
376861
+ { name: "U_1", internalType: "uint16", type: "uint16" },
376862
+ { name: "U_2", internalType: "uint16", type: "uint16" },
376863
+ { name: "R_base", internalType: "uint16", type: "uint16" },
376864
+ { name: "R_slope1", internalType: "uint16", type: "uint16" },
376865
+ { name: "R_slope2", internalType: "uint16", type: "uint16" },
376866
+ { name: "R_slope3", internalType: "uint16", type: "uint16" },
376867
+ {
376868
+ name: "isBorrowingMoreU2Forbidden",
376869
+ internalType: "bool",
376870
+ type: "bool"
376871
+ }
376872
+ ]
376873
+ },
376874
+ { name: "isPaused", internalType: "bool", type: "bool" }
376875
+ ]
376876
+ }
376877
+ ],
376878
+ stateMutability: "view"
376879
+ },
376880
+ {
376881
+ type: "function",
376882
+ inputs: [{ name: "staker", internalType: "address", type: "address" }],
376883
+ name: "getGaugesV3Data",
376884
+ outputs: [
376885
+ {
376886
+ name: "result",
376887
+ internalType: "struct GaugeInfo[]",
376888
+ type: "tuple[]",
376889
+ components: [
376890
+ { name: "addr", internalType: "address", type: "address" },
376891
+ { name: "pool", internalType: "address", type: "address" },
376892
+ { name: "symbol", internalType: "string", type: "string" },
376893
+ { name: "name", internalType: "string", type: "string" },
376894
+ { name: "underlying", internalType: "address", type: "address" },
376895
+ { name: "currentEpoch", internalType: "uint16", type: "uint16" },
376896
+ { name: "epochFrozen", internalType: "bool", type: "bool" },
376897
+ {
376898
+ name: "quotaParams",
376899
+ internalType: "struct GaugeQuotaParams[]",
376900
+ type: "tuple[]",
376901
+ components: [
376902
+ { name: "token", internalType: "address", type: "address" },
376903
+ { name: "minRate", internalType: "uint16", type: "uint16" },
376904
+ { name: "maxRate", internalType: "uint16", type: "uint16" },
376905
+ {
376906
+ name: "totalVotesLpSide",
376907
+ internalType: "uint96",
376908
+ type: "uint96"
376909
+ },
376910
+ {
376911
+ name: "totalVotesCaSide",
376912
+ internalType: "uint96",
376913
+ type: "uint96"
376914
+ },
376915
+ { name: "rate", internalType: "uint16", type: "uint16" },
376916
+ {
376917
+ name: "quotaIncreaseFee",
376918
+ internalType: "uint16",
376919
+ type: "uint16"
376920
+ },
376921
+ { name: "totalQuoted", internalType: "uint96", type: "uint96" },
376922
+ { name: "limit", internalType: "uint96", type: "uint96" },
376923
+ { name: "isActive", internalType: "bool", type: "bool" },
376924
+ {
376925
+ name: "stakerVotesLpSide",
376926
+ internalType: "uint96",
376927
+ type: "uint96"
376928
+ },
376929
+ {
376930
+ name: "stakerVotesCaSide",
376931
+ internalType: "uint96",
376932
+ type: "uint96"
376933
+ }
376934
+ ]
376935
+ }
376936
+ ]
376937
+ }
376938
+ ],
376939
+ stateMutability: "view"
376940
+ },
376941
+ {
376942
+ type: "function",
376943
+ inputs: [
376944
+ {
376945
+ name: "priceUpdates",
376946
+ internalType: "struct PriceOnDemand[]",
376947
+ type: "tuple[]",
376948
+ components: [
376949
+ { name: "token", internalType: "address", type: "address" },
376950
+ { name: "callData", internalType: "bytes", type: "bytes" }
376951
+ ]
376952
+ }
376953
+ ],
376954
+ name: "getLiquidatableCreditAccounts",
376955
+ outputs: [
376956
+ {
376957
+ name: "result",
376958
+ internalType: "struct CreditAccountData[]",
376959
+ type: "tuple[]",
376960
+ components: [
376961
+ { name: "isSuccessful", internalType: "bool", type: "bool" },
376962
+ {
376963
+ name: "priceFeedsNeeded",
376964
+ internalType: "address[]",
376965
+ type: "address[]"
376966
+ },
376967
+ { name: "addr", internalType: "address", type: "address" },
376968
+ { name: "borrower", internalType: "address", type: "address" },
376969
+ { name: "creditManager", internalType: "address", type: "address" },
376970
+ { name: "cmName", internalType: "string", type: "string" },
376971
+ { name: "creditFacade", internalType: "address", type: "address" },
376972
+ { name: "underlying", internalType: "address", type: "address" },
376973
+ { name: "debt", internalType: "uint256", type: "uint256" },
376974
+ {
376975
+ name: "cumulativeIndexLastUpdate",
376976
+ internalType: "uint256",
376977
+ type: "uint256"
376978
+ },
376979
+ {
376980
+ name: "cumulativeQuotaInterest",
376981
+ internalType: "uint128",
376982
+ type: "uint128"
376983
+ },
376984
+ { name: "accruedInterest", internalType: "uint256", type: "uint256" },
376985
+ { name: "accruedFees", internalType: "uint256", type: "uint256" },
376986
+ { name: "totalDebtUSD", internalType: "uint256", type: "uint256" },
376987
+ { name: "totalValue", internalType: "uint256", type: "uint256" },
376988
+ { name: "totalValueUSD", internalType: "uint256", type: "uint256" },
376989
+ { name: "twvUSD", internalType: "uint256", type: "uint256" },
376990
+ {
376991
+ name: "enabledTokensMask",
376992
+ internalType: "uint256",
376993
+ type: "uint256"
376994
+ },
376995
+ { name: "healthFactor", internalType: "uint256", type: "uint256" },
376996
+ { name: "baseBorrowRate", internalType: "uint256", type: "uint256" },
376997
+ {
376998
+ name: "aggregatedBorrowRate",
376999
+ internalType: "uint256",
377000
+ type: "uint256"
377001
+ },
377002
+ {
377003
+ name: "balances",
377004
+ internalType: "struct TokenBalance[]",
377005
+ type: "tuple[]",
377006
+ components: [
377007
+ { name: "token", internalType: "address", type: "address" },
377008
+ { name: "balance", internalType: "uint256", type: "uint256" },
377009
+ { name: "isForbidden", internalType: "bool", type: "bool" },
377010
+ { name: "isEnabled", internalType: "bool", type: "bool" },
377011
+ { name: "isQuoted", internalType: "bool", type: "bool" },
377012
+ { name: "quota", internalType: "uint256", type: "uint256" },
377013
+ { name: "quotaRate", internalType: "uint16", type: "uint16" },
377014
+ {
377015
+ name: "quotaCumulativeIndexLU",
377016
+ internalType: "uint256",
377017
+ type: "uint256"
377018
+ }
377019
+ ]
377020
+ },
377021
+ { name: "since", internalType: "uint64", type: "uint64" },
377022
+ { name: "cfVersion", internalType: "uint256", type: "uint256" },
377023
+ { name: "expirationDate", internalType: "uint40", type: "uint40" },
377024
+ { name: "activeBots", internalType: "address[]", type: "address[]" }
377025
+ ]
377026
+ }
377027
+ ],
377028
+ stateMutability: "nonpayable"
377029
+ },
377030
+ {
377031
+ type: "function",
377032
+ inputs: [{ name: "_pool", internalType: "address", type: "address" }],
377033
+ name: "getPoolData",
377034
+ outputs: [
377035
+ {
377036
+ name: "",
377037
+ internalType: "struct PoolData",
377038
+ type: "tuple",
377039
+ components: [
377040
+ { name: "addr", internalType: "address", type: "address" },
377041
+ { name: "underlying", internalType: "address", type: "address" },
377042
+ { name: "dieselToken", internalType: "address", type: "address" },
377043
+ { name: "symbol", internalType: "string", type: "string" },
377044
+ { name: "name", internalType: "string", type: "string" },
377045
+ {
377046
+ name: "baseInterestIndex",
377047
+ internalType: "uint256",
377048
+ type: "uint256"
377049
+ },
377050
+ {
377051
+ name: "availableLiquidity",
377052
+ internalType: "uint256",
377053
+ type: "uint256"
377054
+ },
377055
+ {
377056
+ name: "expectedLiquidity",
377057
+ internalType: "uint256",
377058
+ type: "uint256"
377059
+ },
377060
+ { name: "totalBorrowed", internalType: "uint256", type: "uint256" },
377061
+ { name: "totalDebtLimit", internalType: "uint256", type: "uint256" },
377062
+ {
377063
+ name: "creditManagerDebtParams",
377064
+ internalType: "struct CreditManagerDebtParams[]",
377065
+ type: "tuple[]",
377066
+ components: [
377067
+ {
377068
+ name: "creditManager",
377069
+ internalType: "address",
377070
+ type: "address"
377071
+ },
377072
+ { name: "borrowed", internalType: "uint256", type: "uint256" },
377073
+ { name: "limit", internalType: "uint256", type: "uint256" },
377074
+ {
377075
+ name: "availableToBorrow",
377076
+ internalType: "uint256",
377077
+ type: "uint256"
377078
+ }
377079
+ ]
377080
+ },
377081
+ { name: "totalAssets", internalType: "uint256", type: "uint256" },
377082
+ { name: "totalSupply", internalType: "uint256", type: "uint256" },
377083
+ { name: "supplyRate", internalType: "uint256", type: "uint256" },
377084
+ {
377085
+ name: "baseInterestRate",
377086
+ internalType: "uint256",
377087
+ type: "uint256"
377088
+ },
377089
+ { name: "dieselRate_RAY", internalType: "uint256", type: "uint256" },
377090
+ { name: "withdrawFee", internalType: "uint256", type: "uint256" },
377091
+ {
377092
+ name: "lastBaseInterestUpdate",
377093
+ internalType: "uint256",
377094
+ type: "uint256"
377095
+ },
377096
+ {
377097
+ name: "baseInterestIndexLU",
377098
+ internalType: "uint256",
377099
+ type: "uint256"
377100
+ },
377101
+ { name: "version", internalType: "uint256", type: "uint256" },
377102
+ { name: "poolQuotaKeeper", internalType: "address", type: "address" },
377103
+ { name: "gauge", internalType: "address", type: "address" },
377104
+ {
377105
+ name: "quotas",
377106
+ internalType: "struct QuotaInfo[]",
377107
+ type: "tuple[]",
377108
+ components: [
377109
+ { name: "token", internalType: "address", type: "address" },
377110
+ { name: "rate", internalType: "uint16", type: "uint16" },
377111
+ {
377112
+ name: "quotaIncreaseFee",
377113
+ internalType: "uint16",
377114
+ type: "uint16"
377115
+ },
377116
+ { name: "totalQuoted", internalType: "uint96", type: "uint96" },
377117
+ { name: "limit", internalType: "uint96", type: "uint96" },
377118
+ { name: "isActive", internalType: "bool", type: "bool" }
377119
+ ]
377120
+ },
377121
+ {
377122
+ name: "zappers",
377123
+ internalType: "struct ZapperInfo[]",
377124
+ type: "tuple[]",
377125
+ components: [
377126
+ { name: "zapper", internalType: "address", type: "address" },
377127
+ { name: "tokenIn", internalType: "address", type: "address" },
377128
+ { name: "tokenOut", internalType: "address", type: "address" }
377129
+ ]
377130
+ },
377131
+ {
377132
+ name: "lirm",
377133
+ internalType: "struct LinearModel",
377134
+ type: "tuple",
377135
+ components: [
377136
+ {
377137
+ name: "interestModel",
377138
+ internalType: "address",
377139
+ type: "address"
377140
+ },
377141
+ { name: "version", internalType: "uint256", type: "uint256" },
377142
+ { name: "U_1", internalType: "uint16", type: "uint16" },
377143
+ { name: "U_2", internalType: "uint16", type: "uint16" },
377144
+ { name: "R_base", internalType: "uint16", type: "uint16" },
377145
+ { name: "R_slope1", internalType: "uint16", type: "uint16" },
377146
+ { name: "R_slope2", internalType: "uint16", type: "uint16" },
377147
+ { name: "R_slope3", internalType: "uint16", type: "uint16" },
377148
+ {
377149
+ name: "isBorrowingMoreU2Forbidden",
377150
+ internalType: "bool",
377151
+ type: "bool"
377152
+ }
377153
+ ]
377154
+ },
377155
+ { name: "isPaused", internalType: "bool", type: "bool" }
377156
+ ]
377157
+ }
377158
+ ],
377159
+ stateMutability: "view"
377160
+ },
377161
+ {
377162
+ type: "function",
377163
+ inputs: [],
377164
+ name: "getPoolsV3List",
377165
+ outputs: [
375875
377166
  {
375876
- gas: GAS_PER_BLOCK
375877
- }
375878
- );
375879
- const balancesAfter = Object.fromEntries(
375880
- outBalances.map((b) => [b.token.toLowerCase(), b.balance])
375881
- );
375882
- return {
375883
- balances: {
375884
- ...balancesAfter,
375885
- [target.toLowerCase()]: (expectedMap.get(target) ?? 0n) + result.amount
375886
- },
375887
- minBalances: {
375888
- ...balancesAfter,
375889
- [target.toLowerCase()]: (expectedMap.get(target) ?? 0n) + result.minAmount
375890
- },
375891
- amount: result.amount,
375892
- minAmount: result.minAmount,
375893
- calls: [...result.calls]
375894
- };
375895
- }
375896
- /**
375897
- * @dev Finds the path to swap / withdraw all assets from CreditAccount into underlying asset
375898
- * Can bu used for closing Credit Account and for liquidations as well.
375899
- * @param creditAccount CreditAccountStruct object used for close path computation
375900
- * @param creditManager CreditManagerSlice for corresponding credit manager
375901
- * @param slippage Slippage in PERCENTAGE_FORMAT (100% = 10_000) per operation
375902
- * @return The best option in PathFinderCloseResult format, which
375903
- * - underlyingBalance - total balance of underlying token
375904
- * - calls - list of calls which should be done to swap & unwrap everything to underlying token
375905
- */
375906
- async findBestClosePath({
375907
- creditAccount: ca,
375908
- creditManager: cm,
375909
- slippage,
375910
- balances
375911
- }) {
375912
- const { pathOptions, expected, leftover, connectors: connectors2 } = this.getFindClosePathInput(
375913
- ca,
375914
- cm,
375915
- balances ? {
375916
- expectedBalances: assetsMap(balances.expectedBalances),
375917
- leftoverBalances: assetsMap(balances.leftoverBalances)
375918
- } : void 0
375919
- );
375920
- await this.#hooks.triggerHooks("foundPathOptions", {
375921
- creditAccount: ca.creditAccount,
375922
- pathOptions,
375923
- expected,
375924
- leftover,
375925
- connectors: connectors2
375926
- });
375927
- let results = [];
375928
- for (const po of pathOptions) {
375929
- const { result: result2 } = await this.contract.simulate.findBestClosePath(
375930
- [
375931
- ca.creditAccount,
375932
- expected,
375933
- leftover,
375934
- connectors2,
375935
- BigInt(slippage),
375936
- po,
375937
- BigInt(LOOPS_PER_TX),
375938
- false
375939
- ],
375940
- {
375941
- gas: GAS_PER_BLOCK
375942
- }
375943
- );
375944
- results.push({
375945
- ...result2,
375946
- calls: [...result2.calls]
375947
- });
375948
- }
375949
- const bestResult = results.reduce(compareRouterResults, {
375950
- amount: 0n,
375951
- minAmount: 0n,
375952
- calls: []
375953
- });
375954
- const underlyingBalance = ca.tokens.find((t) => t.token === ca.underlying)?.balance ?? 0n;
375955
- const result = {
375956
- amount: bestResult.amount,
375957
- minAmount: bestResult.minAmount,
375958
- calls: bestResult.calls.map((c) => ({
375959
- callData: c.callData,
375960
- target: c.target
375961
- })),
375962
- underlyingBalance: underlyingBalance + bestResult.minAmount
375963
- };
375964
- return result;
375965
- }
375966
- /**
375967
- * Finds input to be used with findBestClosePath
375968
- * @param ca
375969
- * @param cm
375970
- * @returns
375971
- */
375972
- getFindClosePathInput(ca, cm, balances) {
375973
- const b = balances || this.getDefaultExpectedAndLeftover(ca);
375974
- const { leftoverBalances, expectedBalances } = b;
375975
- const pathOptions = PathOptionFactory.generatePathOptions(
375976
- ca.tokens,
375977
- this.provider.networkType,
375978
- LOOPS_PER_TX
375979
- );
375980
- const expected = cm.collateralTokens.map((token) => {
375981
- const actual = expectedBalances.get(token)?.balance || 0n;
375982
- return {
375983
- token,
375984
- balance: actual > 10n ? actual : 0n
375985
- };
375986
- });
375987
- const leftover = cm.collateralTokens.map((token) => ({
375988
- token,
375989
- balance: leftoverBalances.get(token)?.balance || 1n
375990
- }));
375991
- const connectors2 = this.getAvailableConnectors(cm.collateralTokens);
375992
- return { expected, leftover, connectors: connectors2, pathOptions };
375993
- }
375994
- getDefaultExpectedAndLeftover(ca) {
375995
- const expectedBalances = new AddressMap();
375996
- const leftoverBalances = new AddressMap();
375997
- for (const { token: t, balance, mask } of ca.tokens) {
375998
- const token = t;
375999
- const isEnabled = (mask & ca.enabledTokensMask) !== 0n;
376000
- expectedBalances.upsert(token, { token, balance });
376001
- const decimals2 = this.sdk.tokensMeta.decimals(token);
376002
- const minBalance = 10n ** BigInt(Math.max(8, decimals2) - 8);
376003
- if (balance < minBalance || !isEnabled) {
376004
- leftoverBalances.upsert(token, { token, balance });
377167
+ name: "",
377168
+ internalType: "struct PoolData[]",
377169
+ type: "tuple[]",
377170
+ components: [
377171
+ { name: "addr", internalType: "address", type: "address" },
377172
+ { name: "underlying", internalType: "address", type: "address" },
377173
+ { name: "dieselToken", internalType: "address", type: "address" },
377174
+ { name: "symbol", internalType: "string", type: "string" },
377175
+ { name: "name", internalType: "string", type: "string" },
377176
+ {
377177
+ name: "baseInterestIndex",
377178
+ internalType: "uint256",
377179
+ type: "uint256"
377180
+ },
377181
+ {
377182
+ name: "availableLiquidity",
377183
+ internalType: "uint256",
377184
+ type: "uint256"
377185
+ },
377186
+ {
377187
+ name: "expectedLiquidity",
377188
+ internalType: "uint256",
377189
+ type: "uint256"
377190
+ },
377191
+ { name: "totalBorrowed", internalType: "uint256", type: "uint256" },
377192
+ { name: "totalDebtLimit", internalType: "uint256", type: "uint256" },
377193
+ {
377194
+ name: "creditManagerDebtParams",
377195
+ internalType: "struct CreditManagerDebtParams[]",
377196
+ type: "tuple[]",
377197
+ components: [
377198
+ {
377199
+ name: "creditManager",
377200
+ internalType: "address",
377201
+ type: "address"
377202
+ },
377203
+ { name: "borrowed", internalType: "uint256", type: "uint256" },
377204
+ { name: "limit", internalType: "uint256", type: "uint256" },
377205
+ {
377206
+ name: "availableToBorrow",
377207
+ internalType: "uint256",
377208
+ type: "uint256"
377209
+ }
377210
+ ]
377211
+ },
377212
+ { name: "totalAssets", internalType: "uint256", type: "uint256" },
377213
+ { name: "totalSupply", internalType: "uint256", type: "uint256" },
377214
+ { name: "supplyRate", internalType: "uint256", type: "uint256" },
377215
+ {
377216
+ name: "baseInterestRate",
377217
+ internalType: "uint256",
377218
+ type: "uint256"
377219
+ },
377220
+ { name: "dieselRate_RAY", internalType: "uint256", type: "uint256" },
377221
+ { name: "withdrawFee", internalType: "uint256", type: "uint256" },
377222
+ {
377223
+ name: "lastBaseInterestUpdate",
377224
+ internalType: "uint256",
377225
+ type: "uint256"
377226
+ },
377227
+ {
377228
+ name: "baseInterestIndexLU",
377229
+ internalType: "uint256",
377230
+ type: "uint256"
377231
+ },
377232
+ { name: "version", internalType: "uint256", type: "uint256" },
377233
+ { name: "poolQuotaKeeper", internalType: "address", type: "address" },
377234
+ { name: "gauge", internalType: "address", type: "address" },
377235
+ {
377236
+ name: "quotas",
377237
+ internalType: "struct QuotaInfo[]",
377238
+ type: "tuple[]",
377239
+ components: [
377240
+ { name: "token", internalType: "address", type: "address" },
377241
+ { name: "rate", internalType: "uint16", type: "uint16" },
377242
+ {
377243
+ name: "quotaIncreaseFee",
377244
+ internalType: "uint16",
377245
+ type: "uint16"
377246
+ },
377247
+ { name: "totalQuoted", internalType: "uint96", type: "uint96" },
377248
+ { name: "limit", internalType: "uint96", type: "uint96" },
377249
+ { name: "isActive", internalType: "bool", type: "bool" }
377250
+ ]
377251
+ },
377252
+ {
377253
+ name: "zappers",
377254
+ internalType: "struct ZapperInfo[]",
377255
+ type: "tuple[]",
377256
+ components: [
377257
+ { name: "zapper", internalType: "address", type: "address" },
377258
+ { name: "tokenIn", internalType: "address", type: "address" },
377259
+ { name: "tokenOut", internalType: "address", type: "address" }
377260
+ ]
377261
+ },
377262
+ {
377263
+ name: "lirm",
377264
+ internalType: "struct LinearModel",
377265
+ type: "tuple",
377266
+ components: [
377267
+ {
377268
+ name: "interestModel",
377269
+ internalType: "address",
377270
+ type: "address"
377271
+ },
377272
+ { name: "version", internalType: "uint256", type: "uint256" },
377273
+ { name: "U_1", internalType: "uint16", type: "uint16" },
377274
+ { name: "U_2", internalType: "uint16", type: "uint16" },
377275
+ { name: "R_base", internalType: "uint16", type: "uint16" },
377276
+ { name: "R_slope1", internalType: "uint16", type: "uint16" },
377277
+ { name: "R_slope2", internalType: "uint16", type: "uint16" },
377278
+ { name: "R_slope3", internalType: "uint16", type: "uint16" },
377279
+ {
377280
+ name: "isBorrowingMoreU2Forbidden",
377281
+ internalType: "bool",
377282
+ type: "bool"
377283
+ }
377284
+ ]
377285
+ },
377286
+ { name: "isPaused", internalType: "bool", type: "bool" }
377287
+ ]
376005
377288
  }
376006
- }
376007
- return { expectedBalances, leftoverBalances };
376008
- }
376009
- getAvailableConnectors(collateralTokens) {
376010
- return collateralTokens.filter(
376011
- (t) => this.#connectors.includes(t.toLowerCase())
376012
- );
377289
+ ],
377290
+ stateMutability: "view"
377291
+ },
377292
+ {
377293
+ type: "function",
377294
+ inputs: [],
377295
+ name: "version",
377296
+ outputs: [{ name: "", internalType: "uint256", type: "uint256" }],
377297
+ stateMutability: "view"
376013
377298
  }
376014
- };
376015
- function compareRouterResults(a, b) {
376016
- return a.amount > b.amount ? a : b;
376017
- }
376018
- function balancesMap(assets) {
376019
- return new AddressMap(assets.map(({ token, balance }) => [token, balance]));
376020
- }
376021
- function assetsMap(assets) {
376022
- return new AddressMap(assets.map((a) => [a.token, a]));
376023
- }
377299
+ ];
377300
+ var PERCENTAGE_FACTOR_1KK = PERCENTAGE_DECIMALS * PERCENTAGE_FACTOR;
377301
+ var ONE = PERCENTAGE_FACTOR_1KK * 10n;
376024
377302
  var CreditAccountsService = class extends SDKConstruct {
376025
377303
  #compressor;
376026
377304
  #batchSize;
@@ -376132,23 +377410,60 @@ var CreditAccountsService = class extends SDKConstruct {
376132
377410
  }
376133
377411
  return allCAs.sort((a, b) => Number(a.healthFactor - b.healthFactor));
376134
377412
  }
376135
- async getRewards(account) {
377413
+ async getRewards(creditAccount) {
376136
377414
  const rewards = await this.provider.publicClient.readContract({
376137
377415
  abi: iRewardsCompressorAbi,
376138
377416
  address: this.rewardCompressor,
376139
377417
  functionName: "getRewards",
376140
- args: [account]
376141
- });
376142
- return [...rewards];
377418
+ args: [creditAccount]
377419
+ });
377420
+ const r = rewards.reduce((acc, r2) => {
377421
+ const adapter = r2.adapter.toLowerCase();
377422
+ const stakedPhantomToken = r2.stakedPhantomToken.toLowerCase();
377423
+ const rewardToken = r2.rewardToken.toLowerCase();
377424
+ const key = [adapter, stakedPhantomToken].join("-");
377425
+ if (!acc[key]) {
377426
+ const callData = encodeFunctionData({
377427
+ abi: iBaseRewardPoolAbi,
377428
+ functionName: "getReward",
377429
+ args: []
377430
+ });
377431
+ acc[adapter] = {
377432
+ adapter,
377433
+ stakedPhantomToken,
377434
+ calls: [
377435
+ {
377436
+ target: adapter,
377437
+ callData
377438
+ }
377439
+ ],
377440
+ rewards: []
377441
+ };
377442
+ }
377443
+ acc[adapter].rewards.push({
377444
+ token: rewardToken,
377445
+ balance: r2.amount
377446
+ });
377447
+ return acc;
377448
+ }, {});
377449
+ return Object.values(r);
376143
377450
  }
376144
- async getActiveBots(marketConfigurator, account) {
376145
- const botsData = await this.provider.publicClient.readContract({
376146
- abi: iPeripheryCompressorAbi,
376147
- address: this.peripheryCompressor,
376148
- functionName: "getActiveBots",
376149
- args: [marketConfigurator, account]
377451
+ async getActiveBots(accountsToCheck) {
377452
+ const resp = await this.provider.publicClient.multicall({
377453
+ contracts: accountsToCheck.map((o) => {
377454
+ const pool = this.sdk.marketRegister.findByCreditManager(
377455
+ o.creditManager
377456
+ );
377457
+ return {
377458
+ abi: iPeripheryCompressorAbi,
377459
+ address: this.peripheryCompressor,
377460
+ functionName: "getActiveBots",
377461
+ args: [pool.configurator.address, o.creditAccount]
377462
+ };
377463
+ }),
377464
+ allowFailure: true
376150
377465
  });
376151
- return [...botsData];
377466
+ return resp;
376152
377467
  }
376153
377468
  /**
376154
377469
  * Generates transaction to liquidate credit account
@@ -377087,83 +378402,6 @@ var GearStakingContract = class extends BaseContract {
377087
378402
  });
377088
378403
  }
377089
378404
  };
377090
- var EXTRA_FARM_TOKENS = {
377091
- STETH: true,
377092
- rETH: true,
377093
- osETH: true,
377094
- cbETH: true,
377095
- wstETH: true,
377096
- weETH: true,
377097
- ezETH: true,
377098
- sfrxETH: true,
377099
- USDe: true,
377100
- rsETH: true,
377101
- rswETH: true,
377102
- pufETH: true,
377103
- pzETH: true,
377104
- rstETH: true,
377105
- steakLRT: true,
377106
- amphrETH: true,
377107
- LBTC: true,
377108
- Re7LRT: true,
377109
- PT_ezETH_26DEC2024: true,
377110
- PT_eETH_26DEC2024: true,
377111
- PT_sUSDe_26DEC2024: true,
377112
- PT_eBTC_26DEC2024: true,
377113
- PT_LBTC_27MAR2025: true,
377114
- eBTC: true,
377115
- PT_cornLBTC_26DEC2024: true,
377116
- PT_corn_eBTC_27MAR2025: true,
377117
- PT_corn_pumpBTC_26DEC2024: true,
377118
- pumpBTC: true,
377119
- PT_sUSDe_27MAR2025: true,
377120
- DVstETH: true,
377121
- beraSTONE: true,
377122
- PT_sUSDe_29MAY2025: true,
377123
- tETH: true
377124
- };
377125
- var { USDe, ...rest } = EXTRA_FARM_TOKENS;
377126
- var CREDIT_SESSION_STATUS_BY_ID = {
377127
- 0: "active",
377128
- 1: "closed",
377129
- 2: "repaid",
377130
- 3: "liquidated",
377131
- 4: "liquidateExpired",
377132
- 5: "liquidatePaused"
377133
- };
377134
- var CREDIT_SESSION_ID_BY_STATUS = TypedObjectUtils.swapKeyValue(
377135
- CREDIT_SESSION_STATUS_BY_ID
377136
- );
377137
- var TESTNET_CHAINS = {
377138
- Mainnet: 7878,
377139
- Optimism: 7879,
377140
- Arbitrum: 7880,
377141
- Base: 7881,
377142
- Sonic: 7882
377143
- };
377144
- var CHARTS_BACKEND_ADDRESSES = {
377145
- [chains.Mainnet.id]: "https://charts-server.fly.dev",
377146
- [chains.Arbitrum.id]: "https://charts-server.fly.dev",
377147
- [chains.Optimism.id]: "https://charts-server.fly.dev",
377148
- [chains.Base.id]: "https://charts-server.fly.dev",
377149
- [TESTNET_CHAINS.Mainnet]: "https://testnet.gearbox.foundation",
377150
- [TESTNET_CHAINS.Arbitrum]: "https://arbtest.gearbox.foundation",
377151
- [TESTNET_CHAINS.Optimism]: "https://opttest.gearbox.foundation"
377152
- // !& Base
377153
- };
377154
- var LEADERBOARD_APIS = {
377155
- [chains.Mainnet.id]: "https://gpointbot.fly.dev",
377156
- [chains.Optimism.id]: "https://gpointbot.fly.dev",
377157
- [chains.Arbitrum.id]: "https://gpointbot.fly.dev",
377158
- [TESTNET_CHAINS.Mainnet]: "https://testnet.gearbox.foundation/gpointbot",
377159
- [TESTNET_CHAINS.Optimism]: "https://testnet.gearbox.foundation/gpointbot",
377160
- [TESTNET_CHAINS.Arbitrum]: "https://testnet.gearbox.foundation/gpointbot"
377161
- };
377162
- var INITIAL_SUPPLY = 5n * 10n ** 25n;
377163
- var CVX_MAX_SUPPLY2 = WAD * 100000000n;
377164
- var CVX_TOTAL_CLIFFS2 = WAD * 1000n;
377165
- var PERCENTAGE_FACTOR_1KK = PERCENTAGE_DECIMALS * PERCENTAGE_FACTOR;
377166
- var ONE = PERCENTAGE_FACTOR_1KK * 10n;
377167
378405
  var GAUGE_COMPRESSORS = {
377168
378406
  [chains.Mainnet.id]: "0x104c4e209329524adb0febE8b6481346a6eB75C6",
377169
378407
  [chains.Arbitrum.id]: "0x88aa4FbF86392cBF6f6517790E288314DE03E181",
@@ -384780,7 +386018,7 @@ var iDataCompressorV2_1Abi = [
384780
386018
  stateMutability: "view"
384781
386019
  }
384782
386020
  ];
384783
- var iDataCompressorV3Abi = [
386021
+ var iDataCompressorV3Abi2 = [
384784
386022
  {
384785
386023
  type: "function",
384786
386024
  inputs: [
@@ -408290,7 +409528,7 @@ var ZeroLT = class extends ProviderBase {
408290
409528
  this.logger.debug(`data compressor: ${dc300Addr}`);
408291
409529
  const cms = await this.client.readContract({
408292
409530
  address: dc300Addr,
408293
- abi: iDataCompressorV3Abi,
409531
+ abi: iDataCompressorV3Abi2,
408294
409532
  functionName: "getCreditManagersV3List"
408295
409533
  });
408296
409534
  this.logger.debug(`total managers: ${cms.length}`);
@@ -409398,6 +410636,223 @@ function audit() {
409398
410636
  });
409399
410637
  }
409400
410638
 
410639
+ // src/commands/compare-accounts.ts
410640
+ var import_table2 = __toESM(require_src10(), 1);
410641
+ function compareAccounts() {
410642
+ return newCommand().name("compare-accounts").description("Compare gauges and active bots").addOption(
410643
+ new Option(
410644
+ "--address-provider <address>",
410645
+ "new address provider address"
410646
+ ).env("ADDRESS_PROVIDER")
410647
+ ).addOption(
410648
+ new Option("--shared-dir <dir>", "dir to put output files").env(
410649
+ "SHARED_DIR"
410650
+ )
410651
+ ).addOption(
410652
+ new Option("--anvil-url <url>", "anvil rpc url").env("ANVIL_URL")
410653
+ ).action(async (opts) => {
410654
+ log_default.info("starting sdk v3.1 example");
410655
+ let {
410656
+ addressProvider,
410657
+ marketConfigurators,
410658
+ anvilUrl = "http://127.0.0.1:8545",
410659
+ sharedDir = "."
410660
+ } = opts;
410661
+ const sdk = await GearboxSDK.attach({
410662
+ rpcURLs: [anvilUrl],
410663
+ timeout: 48e4,
410664
+ addressProvider,
410665
+ logger: log_default,
410666
+ ignoreUpdateablePrices: true,
410667
+ marketConfigurators: marketConfigurators ?? []
410668
+ });
410669
+ const v31Accounts = await loadV31Accounts(sdk, true);
410670
+ const v30Accounts = await loadV300Accounts(sdk, true);
410671
+ log_default.info(
410672
+ `loaded ${v30Accounts.size} v3.0 accounts and ${v31Accounts.size} v3.1 accounts`
410673
+ );
410674
+ await examineBots(sdk, v30Accounts, v31Accounts);
410675
+ await examineGauges(sdk, v30Accounts, v31Accounts);
410676
+ log_default.info("done");
410677
+ });
410678
+ }
410679
+ async function examineBots(sdk, v300accounts, v310accounts) {
410680
+ const v310bots = await loadV310Bots(sdk, v310accounts);
410681
+ const v300bots = await loadV300Bots(v300accounts);
410682
+ const rows = [
410683
+ [
410684
+ source_default.white("Credit Account"),
410685
+ source_default.white("v3.0 Active Bots"),
410686
+ source_default.white("v3.1 Active Bots")
410687
+ ]
410688
+ ];
410689
+ for (const account of v310accounts.keys()) {
410690
+ const newBots = v310bots.get(account) ?? [];
410691
+ const oldBots = v300bots.get(account) ?? [];
410692
+ const color = compareBots(newBots, oldBots);
410693
+ rows.push(
410694
+ [
410695
+ account,
410696
+ oldBots.join(", "),
410697
+ newBots.map(
410698
+ (bot) => bot.baseParams.addr + (bot.forbidden ? " (forbidden)" : "")
410699
+ ).join(", ")
410700
+ ].map((c) => color(c))
410701
+ );
410702
+ }
410703
+ const output = (0, import_table2.table)(rows);
410704
+ console.log(output);
410705
+ }
410706
+ async function examineGauges(sdk, v300accounts, v310accounts) {
410707
+ const v310gauges = await loadV310Gauges(sdk, v310accounts);
410708
+ const v300gauges = await loadV300Gauges(sdk, v300accounts);
410709
+ const gaugesRows = [];
410710
+ for (const account of v300accounts.keys()) {
410711
+ const newG = v310gauges.get(account) ?? [];
410712
+ const oldG = v300gauges.get(account) ?? [];
410713
+ const ok = compareGauges(newG, oldG);
410714
+ gaugesRows.push([account, ok ? "OK" : "NOT OK"]);
410715
+ }
410716
+ const gaugesOutput = (0, import_table2.table)(gaugesRows);
410717
+ console.log(gaugesOutput);
410718
+ }
410719
+ async function loadV31Accounts(sdk, skipZeroDebt) {
410720
+ const accountsService = new CreditAccountsService(sdk);
410721
+ const v31Accounts = await accountsService.getCreditAccounts({
410722
+ includeZeroDebt: !skipZeroDebt
410723
+ });
410724
+ log_default.debug(`loaded v3.1 ${v31Accounts.length} accounts`);
410725
+ return new AddressMap(v31Accounts.map((a) => [a.creditAccount, a]));
410726
+ }
410727
+ async function loadV300Accounts(sdk, skipZeroDebt) {
410728
+ const client = sdk.provider.publicClient;
410729
+ const ap3 = ADDRESS_PROVIDER.Mainnet;
410730
+ const compressor = await client.readContract({
410731
+ address: ap3,
410732
+ abi: iAddressProviderV3Abi,
410733
+ functionName: "getAddressOrRevert",
410734
+ args: [stringToHex("DATA_COMPRESSOR", { size: 32 }), 300n]
410735
+ });
410736
+ log_default.debug(`loaded v3.0 compressor ${compressor}`);
410737
+ const cms = await client.readContract({
410738
+ address: compressor,
410739
+ abi: iDataCompressorV3Abi,
410740
+ functionName: "getCreditManagersV3List",
410741
+ args: []
410742
+ });
410743
+ log_default.debug(`loaded ${cms.length} v3.0 credit managers `);
410744
+ let allAccounts = [];
410745
+ for (const cm of cms) {
410746
+ const accounts = await client.simulateContract({
410747
+ address: compressor,
410748
+ abi: iDataCompressorV3Abi,
410749
+ functionName: "getCreditAccountsByCreditManager",
410750
+ args: [cm.addr, []]
410751
+ });
410752
+ allAccounts.push(
410753
+ ...accounts.result
410754
+ );
410755
+ }
410756
+ if (skipZeroDebt) {
410757
+ allAccounts = allAccounts.filter((a) => a.debt > 0n);
410758
+ }
410759
+ log_default.debug(`loaded v3.0 ${allAccounts.length} accounts`);
410760
+ return new AddressMap(allAccounts.map((a) => [a.addr, a]));
410761
+ }
410762
+ async function loadV310Bots(sdk, v31Accounts) {
410763
+ const pcAddr = sdk.addressProvider.getLatestVersion(AP_PERIPHERY_COMPRESSOR);
410764
+ const accounts = v31Accounts.keys();
410765
+ const mc = sdk.marketRegister.marketConfigurators[0].address;
410766
+ const resp = await sdk.provider.publicClient.multicall({
410767
+ contracts: accounts.map((a) => ({
410768
+ address: pcAddr,
410769
+ abi: iPeripheryCompressorAbi,
410770
+ functionName: "getActiveBots",
410771
+ args: [mc, a]
410772
+ })),
410773
+ allowFailure: false
410774
+ });
410775
+ return new AddressMap(resp.map((d, i) => [accounts[i], d]));
410776
+ }
410777
+ async function loadV300Bots(v31Accounts) {
410778
+ return new AddressMap(
410779
+ v31Accounts.values().map((a) => [a.addr, [...a.activeBots]])
410780
+ );
410781
+ }
410782
+ async function loadV300Gauges(sdk, v30Accounts) {
410783
+ const accounts = v30Accounts.keys();
410784
+ const compressor = await sdk.provider.publicClient.readContract({
410785
+ address: ADDRESS_PROVIDER.Mainnet,
410786
+ abi: iAddressProviderV3Abi,
410787
+ functionName: "getAddressOrRevert",
410788
+ args: [stringToHex("DATA_COMPRESSOR", { size: 32 }), 300n]
410789
+ });
410790
+ const resp = await sdk.provider.publicClient.multicall({
410791
+ contracts: accounts.map((a) => ({
410792
+ address: compressor,
410793
+ abi: iDataCompressorV3Abi,
410794
+ functionName: "getGaugesV3Data",
410795
+ args: [a]
410796
+ })),
410797
+ allowFailure: false
410798
+ });
410799
+ return new AddressMap(
410800
+ resp.map((d, i) => [accounts[i], d])
410801
+ );
410802
+ }
410803
+ async function loadV310Gauges(sdk, v31Accounts) {
410804
+ const accounts = v31Accounts.keys();
410805
+ const gcAddr = sdk.addressProvider.getLatestVersion(AP_GAUGE_COMPRESSOR);
410806
+ const configurators = [];
410807
+ const pools = sdk.marketRegister.pools.map((p) => p.pool.address);
410808
+ console.log({ configurators, pools });
410809
+ const resp = await sdk.provider.publicClient.multicall({
410810
+ contracts: accounts.map((a) => ({
410811
+ address: gcAddr,
410812
+ abi: iGaugeCompressorAbi,
410813
+ functionName: "getGauges",
410814
+ args: [
410815
+ {
410816
+ configurators: [],
410817
+ pools,
410818
+ underlying: ADDRESS_0X0
410819
+ },
410820
+ a
410821
+ ]
410822
+ })),
410823
+ allowFailure: false
410824
+ });
410825
+ console.log(resp);
410826
+ return new AddressMap(resp.map((d, i) => [accounts[i], resp[i]]));
410827
+ }
410828
+ function compareBots(v31, v3) {
410829
+ const v31Addresses = v31.map((bot) => bot.baseParams.addr.toLowerCase());
410830
+ const v31Filtered = v31.filter((bot) => !bot.forbidden).map((bot) => bot.baseParams.addr.toLowerCase());
410831
+ const v30 = v3.map((addr) => addr.toLowerCase());
410832
+ const allMatch = v31Addresses.length === v30.length && v31Addresses.every((addr) => v30.includes(addr));
410833
+ const filteredMatch = v31Filtered.length === v30.length && v31Filtered.every((addr) => v3.includes(addr));
410834
+ if (allMatch) {
410835
+ return source_default.green;
410836
+ } else if (filteredMatch) {
410837
+ return source_default.yellow;
410838
+ } else {
410839
+ return source_default.red;
410840
+ }
410841
+ }
410842
+ function compareGauges(a, b) {
410843
+ const aa = a.sort(
410844
+ (a2, b2) => a2.addr.toLowerCase().localeCompare(b2.addr.toLowerCase())
410845
+ );
410846
+ const bb = b.sort(
410847
+ (a2, b2) => a2.addr.toLowerCase().localeCompare(b2.addr.toLowerCase())
410848
+ );
410849
+ return aa.length === bb.length && aa.every((a2, i) => compareGauge(a2, bb[i]));
410850
+ }
410851
+ function compareGauge(a, b) {
410852
+ const ok = b.addr.toLowerCase() === a.addr.toLowerCase() && b.currentEpoch === a.currentEpoch && b.name === a.name && b.pool.toLowerCase() === a.pool.toLowerCase() && b.symbol === a.symbol && b.underlying.toLowerCase() === a.underlying.toLowerCase();
410853
+ return ok;
410854
+ }
410855
+
409401
410856
  // src/commands/discover-market-configurator.ts
409402
410857
  import { readFile as readFile8, writeFile as writeFile5 } from "node:fs/promises";
409403
410858
  import path8 from "node:path";
@@ -409624,7 +411079,7 @@ function getRenderer(opts) {
409624
411079
  var package_default = {
409625
411080
  name: "@gearbox-protocol/deploy-tools",
409626
411081
  description: "Gearbox deploy tools",
409627
- version: "5.9.12",
411082
+ version: "5.9.13",
409628
411083
  homepage: "https://gearbox.fi",
409629
411084
  keywords: [
409630
411085
  "gearbox"
@@ -409667,7 +411122,7 @@ var package_default = {
409667
411122
  "@gearbox-protocol/deploy-tools-node": "0.0.0",
409668
411123
  "@gearbox-protocol/deploy-tools-shared": "0.0.0",
409669
411124
  "@gearbox-protocol/deploy-tools-types": "0.0.0",
409670
- "@gearbox-protocol/sdk": "3.0.0-vfour.215",
411125
+ "@gearbox-protocol/sdk": "3.0.0-vfour.223",
409671
411126
  "@gearbox-protocol/sdk-gov": "^2.34.0",
409672
411127
  "@types/lodash-es": "^4.17.12",
409673
411128
  "@types/node": "^22.12.0",
@@ -409796,7 +411251,7 @@ function sdkExample() {
409796
411251
  await sdkExample2.run({
409797
411252
  addressProvider,
409798
411253
  addressProviderJson,
409799
- marketConfigurators,
411254
+ marketConfigurators: marketConfigurators ?? [],
409800
411255
  anvilUrl,
409801
411256
  outFile: path11.resolve(
409802
411257
  sharedDir,
@@ -409865,6 +411320,7 @@ program2.addCommand(printSafeTx());
409865
411320
  program2.addCommand(sdkExample());
409866
411321
  program2.addCommand(verifyEtherscan());
409867
411322
  program2.addCommand(zeroLT());
411323
+ program2.addCommand(compareAccounts());
409868
411324
  program2.parse();
409869
411325
  /*! Bundled license information:
409870
411326