@gearbox-protocol/deploy-tools 5.28.14 → 5.29.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.mjs +960 -1767
  2. package/package.json +9 -9
package/dist/index.mjs CHANGED
@@ -4168,15 +4168,15 @@ var init_structs = __esm({
4168
4168
  // ../../node_modules/abitype/dist/esm/human-readable/parseAbi.js
4169
4169
  function parseAbi(signatures) {
4170
4170
  const structs = parseStructs(signatures);
4171
- const abi49 = [];
4171
+ const abi50 = [];
4172
4172
  const length = signatures.length;
4173
4173
  for (let i = 0; i < length; i++) {
4174
4174
  const signature = signatures[i];
4175
4175
  if (isStructSignature(signature))
4176
4176
  continue;
4177
- abi49.push(parseSignature(signature, structs));
4177
+ abi50.push(parseSignature(signature, structs));
4178
4178
  }
4179
- return abi49;
4179
+ return abi50;
4180
4180
  }
4181
4181
  var init_parseAbi = __esm({
4182
4182
  "../../node_modules/abitype/dist/esm/human-readable/parseAbi.js"() {
@@ -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.3";
4279
+ version2 = "2.29.0";
4280
4280
  }
4281
4281
  });
4282
4282
 
@@ -5919,9 +5919,9 @@ var init_toFunctionSelector = __esm({
5919
5919
 
5920
5920
  // ../../node_modules/viem/_esm/utils/abi/getAbiItem.js
5921
5921
  function getAbiItem(parameters) {
5922
- const { abi: abi49, args = [], name } = parameters;
5922
+ const { abi: abi50, args = [], name } = parameters;
5923
5923
  const isSelector = isHex(name, { strict: false });
5924
- const abiItems = abi49.filter((abiItem) => {
5924
+ const abiItems = abi50.filter((abiItem) => {
5925
5925
  if (isSelector) {
5926
5926
  if (abiItem.type === "function")
5927
5927
  return toFunctionSelector(abiItem) === name;
@@ -6051,11 +6051,11 @@ var init_parseAccount = __esm({
6051
6051
 
6052
6052
  // ../../node_modules/viem/_esm/utils/abi/prepareEncodeFunctionData.js
6053
6053
  function prepareEncodeFunctionData(parameters) {
6054
- const { abi: abi49, args, functionName } = parameters;
6055
- let abiItem = abi49[0];
6054
+ const { abi: abi50, args, functionName } = parameters;
6055
+ let abiItem = abi50[0];
6056
6056
  if (functionName) {
6057
6057
  const item = getAbiItem({
6058
- abi: abi49,
6058
+ abi: abi50,
6059
6059
  args,
6060
6060
  name: functionName
6061
6061
  });
@@ -6084,12 +6084,12 @@ var init_prepareEncodeFunctionData = __esm({
6084
6084
  // ../../node_modules/viem/_esm/utils/abi/encodeFunctionData.js
6085
6085
  function encodeFunctionData(parameters) {
6086
6086
  const { args } = parameters;
6087
- const { abi: abi49, functionName } = (() => {
6087
+ const { abi: abi50, functionName } = (() => {
6088
6088
  if (parameters.abi.length === 1 && parameters.functionName?.startsWith("0x"))
6089
6089
  return parameters;
6090
6090
  return prepareEncodeFunctionData(parameters);
6091
6091
  })();
6092
- const abiItem = abi49[0];
6092
+ const abiItem = abi50[0];
6093
6093
  const signature = functionName;
6094
6094
  const data = "inputs" in abiItem && abiItem.inputs ? encodeAbiParameters(abiItem.inputs, args ?? []) : void 0;
6095
6095
  return concatHex([signature, data ?? "0x"]);
@@ -6584,11 +6584,11 @@ var init_decodeAbiParameters = __esm({
6584
6584
 
6585
6585
  // ../../node_modules/viem/_esm/utils/abi/decodeErrorResult.js
6586
6586
  function decodeErrorResult(parameters) {
6587
- const { abi: abi49, data } = parameters;
6587
+ const { abi: abi50, data } = parameters;
6588
6588
  const signature = slice(data, 0, 4);
6589
6589
  if (signature === "0x")
6590
6590
  throw new AbiDecodingZeroDataError();
6591
- const abi_ = [...abi49 || [], solidityError, solidityPanic];
6591
+ const abi_ = [...abi50 || [], solidityError, solidityPanic];
6592
6592
  const abiItem = abi_.find((x) => x.type === "error" && signature === toFunctionSelector(formatAbiItem2(x)));
6593
6593
  if (!abiItem)
6594
6594
  throw new AbiErrorSignatureNotFoundError(signature, {
@@ -6931,8 +6931,8 @@ ${prettyStateOverride(stateOverride)}`;
6931
6931
  }
6932
6932
  };
6933
6933
  ContractFunctionExecutionError = class extends BaseError2 {
6934
- constructor(cause, { abi: abi49, args, contractAddress, docsPath: docsPath8, functionName, sender }) {
6935
- const abiItem = getAbiItem({ abi: abi49, args, name: functionName });
6934
+ constructor(cause, { abi: abi50, args, contractAddress, docsPath: docsPath8, functionName, sender }) {
6935
+ const abiItem = getAbiItem({ abi: abi50, args, name: functionName });
6936
6936
  const formattedArgs = abiItem ? formatAbiItemWithArgs({
6937
6937
  abiItem,
6938
6938
  args,
@@ -6998,7 +6998,7 @@ ${prettyStateOverride(stateOverride)}`;
6998
6998
  writable: true,
6999
6999
  value: void 0
7000
7000
  });
7001
- this.abi = abi49;
7001
+ this.abi = abi50;
7002
7002
  this.args = args;
7003
7003
  this.cause = cause;
7004
7004
  this.contractAddress = contractAddress;
@@ -7007,14 +7007,14 @@ ${prettyStateOverride(stateOverride)}`;
7007
7007
  }
7008
7008
  };
7009
7009
  ContractFunctionRevertedError = class extends BaseError2 {
7010
- constructor({ abi: abi49, data, functionName, message: message2 }) {
7010
+ constructor({ abi: abi50, data, functionName, message: message2 }) {
7011
7011
  let cause;
7012
7012
  let decodedData = void 0;
7013
7013
  let metaMessages;
7014
7014
  let reason;
7015
7015
  if (data && data !== "0x") {
7016
7016
  try {
7017
- decodedData = decodeErrorResult({ abi: abi49, data });
7017
+ decodedData = decodeErrorResult({ abi: abi50, data });
7018
7018
  const { abiItem, errorName, args: errorArgs } = decodedData;
7019
7019
  if (errorName === "Error") {
7020
7020
  reason = errorArgs[0];
@@ -10688,10 +10688,10 @@ var init_isAddressEqual = __esm({
10688
10688
 
10689
10689
  // ../../node_modules/viem/_esm/utils/abi/decodeFunctionResult.js
10690
10690
  function decodeFunctionResult(parameters) {
10691
- const { abi: abi49, args, functionName, data } = parameters;
10692
- let abiItem = abi49[0];
10691
+ const { abi: abi50, args, functionName, data } = parameters;
10692
+ let abiItem = abi50[0];
10693
10693
  if (functionName) {
10694
- const item = getAbiItem({ abi: abi49, args, name: functionName });
10694
+ const item = getAbiItem({ abi: abi50, args, name: functionName });
10695
10695
  if (!item)
10696
10696
  throw new AbiFunctionNotFoundError(functionName, { docsPath: docsPath4 });
10697
10697
  abiItem = item;
@@ -11578,10 +11578,10 @@ var init_chain = __esm({
11578
11578
 
11579
11579
  // ../../node_modules/viem/_esm/utils/abi/encodeDeployData.js
11580
11580
  function encodeDeployData(parameters) {
11581
- const { abi: abi49, args, bytecode } = parameters;
11581
+ const { abi: abi50, args, bytecode } = parameters;
11582
11582
  if (!args || args.length === 0)
11583
11583
  return bytecode;
11584
- const description = abi49.find((x) => "type" in x && x.type === "constructor");
11584
+ const description = abi50.find((x) => "type" in x && x.type === "constructor");
11585
11585
  if (!description)
11586
11586
  throw new AbiConstructorNotFoundError({ docsPath: docsPath5 });
11587
11587
  if (!("inputs" in description))
@@ -11769,9 +11769,9 @@ var init_ccip = __esm({
11769
11769
 
11770
11770
  // ../../node_modules/viem/_esm/utils/abi/decodeFunctionData.js
11771
11771
  function decodeFunctionData(parameters) {
11772
- const { abi: abi49, data } = parameters;
11772
+ const { abi: abi50, data } = parameters;
11773
11773
  const signature = slice(data, 0, 4);
11774
- const description = abi49.find((x) => x.type === "function" && signature === toFunctionSelector(formatAbiItem2(x)));
11774
+ const description = abi50.find((x) => x.type === "function" && signature === toFunctionSelector(formatAbiItem2(x)));
11775
11775
  if (!description)
11776
11776
  throw new AbiFunctionSignatureNotFoundError(signature, {
11777
11777
  docsPath: "/docs/contract/decodeFunctionData"
@@ -11793,10 +11793,10 @@ var init_decodeFunctionData = __esm({
11793
11793
 
11794
11794
  // ../../node_modules/viem/_esm/utils/abi/encodeErrorResult.js
11795
11795
  function encodeErrorResult(parameters) {
11796
- const { abi: abi49, errorName, args } = parameters;
11797
- let abiItem = abi49[0];
11796
+ const { abi: abi50, errorName, args } = parameters;
11797
+ let abiItem = abi50[0];
11798
11798
  if (errorName) {
11799
- const item = getAbiItem({ abi: abi49, args, name: errorName });
11799
+ const item = getAbiItem({ abi: abi50, args, name: errorName });
11800
11800
  if (!item)
11801
11801
  throw new AbiErrorNotFoundError(errorName, { docsPath: docsPath6 });
11802
11802
  abiItem = item;
@@ -11828,10 +11828,10 @@ var init_encodeErrorResult = __esm({
11828
11828
 
11829
11829
  // ../../node_modules/viem/_esm/utils/abi/encodeFunctionResult.js
11830
11830
  function encodeFunctionResult(parameters) {
11831
- const { abi: abi49, functionName, result } = parameters;
11832
- let abiItem = abi49[0];
11831
+ const { abi: abi50, functionName, result } = parameters;
11832
+ let abiItem = abi50[0];
11833
11833
  if (functionName) {
11834
- const item = getAbiItem({ abi: abi49, name: functionName });
11834
+ const item = getAbiItem({ abi: abi50, name: functionName });
11835
11835
  if (!item)
11836
11836
  throw new AbiFunctionNotFoundError(functionName, { docsPath: docsPath7 });
11837
11837
  abiItem = item;
@@ -34184,13 +34184,13 @@ var require_interface = __commonJS({
34184
34184
  function Interface2(fragments) {
34185
34185
  var _newTarget = this.constructor;
34186
34186
  var _this = this;
34187
- var abi49 = [];
34187
+ var abi50 = [];
34188
34188
  if (typeof fragments === "string") {
34189
- abi49 = JSON.parse(fragments);
34189
+ abi50 = JSON.parse(fragments);
34190
34190
  } else {
34191
- abi49 = fragments;
34191
+ abi50 = fragments;
34192
34192
  }
34193
- (0, properties_1.defineReadOnly)(this, "fragments", abi49.map(function(fragment) {
34193
+ (0, properties_1.defineReadOnly)(this, "fragments", abi50.map(function(fragment) {
34194
34194
  return fragments_1.Fragment.from(fragment);
34195
34195
  }).filter(function(fragment) {
34196
34196
  return fragment != null;
@@ -34244,15 +34244,15 @@ var require_interface = __commonJS({
34244
34244
  if (format2 === fragments_1.FormatTypes.sighash) {
34245
34245
  logger2.throwArgumentError("interface does not support formatting sighash", "format", format2);
34246
34246
  }
34247
- var abi49 = this.fragments.map(function(fragment) {
34247
+ var abi50 = this.fragments.map(function(fragment) {
34248
34248
  return fragment.format(format2);
34249
34249
  });
34250
34250
  if (format2 === fragments_1.FormatTypes.json) {
34251
- return JSON.stringify(abi49.map(function(j) {
34251
+ return JSON.stringify(abi50.map(function(j) {
34252
34252
  return JSON.parse(j);
34253
34253
  }));
34254
34254
  }
34255
- return abi49;
34255
+ return abi50;
34256
34256
  };
34257
34257
  Interface2.getAbiCoder = function() {
34258
34258
  return abi_coder_1.defaultAbiCoder;
@@ -49995,14 +49995,14 @@ var require_lib29 = __commonJS({
49995
49995
  if (typeof compilerOutput === "string") {
49996
49996
  compilerOutput = JSON.parse(compilerOutput);
49997
49997
  }
49998
- var abi49 = compilerOutput.abi;
49998
+ var abi50 = compilerOutput.abi;
49999
49999
  var bytecode = null;
50000
50000
  if (compilerOutput.bytecode) {
50001
50001
  bytecode = compilerOutput.bytecode;
50002
50002
  } else if (compilerOutput.evm && compilerOutput.evm.bytecode) {
50003
50003
  bytecode = compilerOutput.evm.bytecode;
50004
50004
  }
50005
- return new this(abi49, bytecode, signer);
50005
+ return new this(abi50, bytecode, signer);
50006
50006
  };
50007
50007
  ContractFactory2.getInterface = function(contractInterface) {
50008
50008
  return Contract.getInterface(contractInterface);
@@ -64060,7 +64060,7 @@ var require_node_gyp_build = __commonJS({
64060
64060
  var runtimeRequire = typeof __webpack_require__ === "function" ? __non_webpack_require__ : __require;
64061
64061
  var vars = process.config && process.config.variables || {};
64062
64062
  var prebuildsOnly = !!process.env.PREBUILDS_ONLY;
64063
- var abi49 = process.versions.modules;
64063
+ var abi50 = process.versions.modules;
64064
64064
  var runtime = isElectron() ? "electron" : isNwjs() ? "node-webkit" : "node";
64065
64065
  var arch = process.env.npm_config_arch || os2.arch();
64066
64066
  var platform = process.env.npm_config_platform || os2.platform();
@@ -64092,7 +64092,7 @@ var require_node_gyp_build = __commonJS({
64092
64092
  "platform=" + platform,
64093
64093
  "arch=" + arch,
64094
64094
  "runtime=" + runtime,
64095
- "abi=" + abi49,
64095
+ "abi=" + abi50,
64096
64096
  "uv=" + uv,
64097
64097
  armv ? "armv=" + armv : "",
64098
64098
  "libc=" + libc,
@@ -64108,7 +64108,7 @@ var require_node_gyp_build = __commonJS({
64108
64108
  if (!tuple) return;
64109
64109
  var prebuilds = path12.join(dir2, "prebuilds", tuple.name);
64110
64110
  var parsed = readdirSync(prebuilds).map(parseTags);
64111
- var candidates = parsed.filter(matchTags(runtime, abi49));
64111
+ var candidates = parsed.filter(matchTags(runtime, abi50));
64112
64112
  var winner = candidates.sort(compareTags(runtime))[0];
64113
64113
  if (winner) return path12.join(prebuilds, winner.file);
64114
64114
  }
@@ -64173,11 +64173,11 @@ var require_node_gyp_build = __commonJS({
64173
64173
  }
64174
64174
  return tags;
64175
64175
  }
64176
- function matchTags(runtime2, abi50) {
64176
+ function matchTags(runtime2, abi51) {
64177
64177
  return function(tags) {
64178
64178
  if (tags == null) return false;
64179
64179
  if (tags.runtime && tags.runtime !== runtime2 && !runtimeAgnostic(tags)) return false;
64180
- if (tags.abi && tags.abi !== abi50 && !tags.napi) return false;
64180
+ if (tags.abi && tags.abi !== abi51 && !tags.napi) return false;
64181
64181
  if (tags.uv && tags.uv !== uv) return false;
64182
64182
  if (tags.armv && tags.armv !== armv) return false;
64183
64183
  if (tags.libc && tags.libc !== libc) return false;
@@ -70977,13 +70977,14 @@ var require_types3 = __commonJS({
70977
70977
  var dateRegexSource2 = `((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))`;
70978
70978
  var dateRegex2 = new RegExp(`^${dateRegexSource2}$`);
70979
70979
  function timeRegexSource2(args) {
70980
- let regex = `([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d`;
70980
+ let secondsRegexSource = `[0-5]\\d`;
70981
70981
  if (args.precision) {
70982
- regex = `${regex}\\.\\d{${args.precision}}`;
70982
+ secondsRegexSource = `${secondsRegexSource}\\.\\d{${args.precision}}`;
70983
70983
  } else if (args.precision == null) {
70984
- regex = `${regex}(\\.\\d+)?`;
70984
+ secondsRegexSource = `${secondsRegexSource}(\\.\\d+)?`;
70985
70985
  }
70986
- return regex;
70986
+ const secondsQuantifier = args.precision ? "+" : "?";
70987
+ return `([01]\\d|2[0-3]):[0-5]\\d(:${secondsRegexSource})${secondsQuantifier}`;
70987
70988
  }
70988
70989
  function timeRegex2(args) {
70989
70990
  return new RegExp(`^${timeRegexSource2(args)}$`);
@@ -112572,17 +112573,17 @@ var require_interface2 = __commonJS({
112572
112573
  * Create a new Interface for the %%fragments%%.
112573
112574
  */
112574
112575
  constructor(fragments) {
112575
- let abi49 = [];
112576
+ let abi50 = [];
112576
112577
  if (typeof fragments === "string") {
112577
- abi49 = JSON.parse(fragments);
112578
+ abi50 = JSON.parse(fragments);
112578
112579
  } else {
112579
- abi49 = fragments;
112580
+ abi50 = fragments;
112580
112581
  }
112581
112582
  this.#functions = /* @__PURE__ */ new Map();
112582
112583
  this.#errors = /* @__PURE__ */ new Map();
112583
112584
  this.#events = /* @__PURE__ */ new Map();
112584
112585
  const frags = [];
112585
- for (const a of abi49) {
112586
+ for (const a of abi50) {
112586
112587
  try {
112587
112588
  frags.push(fragments_js_1.Fragment.from(a));
112588
112589
  } catch (error) {
@@ -112646,16 +112647,16 @@ var require_interface2 = __commonJS({
112646
112647
  */
112647
112648
  format(minimal) {
112648
112649
  const format2 = minimal ? "minimal" : "full";
112649
- const abi49 = this.fragments.map((f) => f.format(format2));
112650
- return abi49;
112650
+ const abi50 = this.fragments.map((f) => f.format(format2));
112651
+ return abi50;
112651
112652
  }
112652
112653
  /**
112653
112654
  * Return the JSON-encoded ABI. This is the format Solidiy
112654
112655
  * returns.
112655
112656
  */
112656
112657
  formatJson() {
112657
- const abi49 = this.fragments.map((f) => f.format("json"));
112658
- return JSON.stringify(abi49.map((j) => JSON.parse(j)));
112658
+ const abi50 = this.fragments.map((f) => f.format("json"));
112659
+ return JSON.stringify(abi50.map((j) => JSON.parse(j)));
112659
112660
  }
112660
112661
  /**
112661
112662
  * The ABI coder that will be used to encode and decode binary
@@ -115423,12 +115424,12 @@ var require_contract = __commonJS({
115423
115424
  * optionally connected to a %%runner%% to perform operations on behalf
115424
115425
  * of.
115425
115426
  */
115426
- constructor(target, abi49, runner, _deployTx) {
115427
+ constructor(target, abi50, runner, _deployTx) {
115427
115428
  (0, index_js_3.assertArgument)(typeof target === "string" || (0, index_js_2.isAddressable)(target), "invalid value for Contract target", "target", target);
115428
115429
  if (runner == null) {
115429
115430
  runner = null;
115430
115431
  }
115431
- const iface = index_js_1.Interface.from(abi49);
115432
+ const iface = index_js_1.Interface.from(abi50);
115432
115433
  (0, index_js_3.defineProperties)(this, { target, runner, interface: iface });
115433
115434
  Object.defineProperty(this, internal, { value: {} });
115434
115435
  let addrPromise;
@@ -115791,10 +115792,10 @@ var require_contract = __commonJS({
115791
115792
  /**
115792
115793
  * Create a new Class for the %%abi%%.
115793
115794
  */
115794
- static buildClass(abi49) {
115795
+ static buildClass(abi50) {
115795
115796
  class CustomContract extends _BaseContract {
115796
115797
  constructor(address, runner = null) {
115797
- super(address, abi49, runner);
115798
+ super(address, abi50, runner);
115798
115799
  }
115799
115800
  }
115800
115801
  return CustomContract;
@@ -115802,11 +115803,11 @@ var require_contract = __commonJS({
115802
115803
  /**
115803
115804
  * Create a new BaseContract with a specified Interface.
115804
115805
  */
115805
- static from(target, abi49, runner) {
115806
+ static from(target, abi50, runner) {
115806
115807
  if (runner == null) {
115807
115808
  runner = null;
115808
115809
  }
115809
- const contract = new this(target, abi49, runner);
115810
+ const contract = new this(target, abi50, runner);
115810
115811
  return contract;
115811
115812
  }
115812
115813
  };
@@ -115850,8 +115851,8 @@ var require_factory = __commonJS({
115850
115851
  * The %%bytecode%% may be the ``bytecode`` property within the
115851
115852
  * standard Solidity JSON output.
115852
115853
  */
115853
- constructor(abi49, bytecode, runner) {
115854
- const iface = index_js_1.Interface.from(abi49);
115854
+ constructor(abi50, bytecode, runner) {
115855
+ const iface = index_js_1.Interface.from(abi50);
115855
115856
  if (bytecode instanceof Uint8Array) {
115856
115857
  bytecode = (0, index_js_3.hexlify)((0, index_js_3.getBytes)(bytecode));
115857
115858
  } else {
@@ -115921,14 +115922,14 @@ var require_factory = __commonJS({
115921
115922
  if (typeof output === "string") {
115922
115923
  output = JSON.parse(output);
115923
115924
  }
115924
- const abi49 = output.abi;
115925
+ const abi50 = output.abi;
115925
115926
  let bytecode = "";
115926
115927
  if (output.bytecode) {
115927
115928
  bytecode = output.bytecode;
115928
115929
  } else if (output.evm && output.evm.bytecode) {
115929
115930
  bytecode = output.evm.bytecode;
115930
115931
  }
115931
- return new this(abi49, bytecode, runner);
115932
+ return new this(abi50, bytecode, runner);
115932
115933
  }
115933
115934
  };
115934
115935
  exports2.ContractFactory = ContractFactory;
@@ -120856,8 +120857,8 @@ var require_provider_etherscan = __commonJS({
120856
120857
  action: "getabi",
120857
120858
  address
120858
120859
  });
120859
- const abi49 = JSON.parse(resp);
120860
- return new index_js_2.Contract(address, abi49, this);
120860
+ const abi50 = JSON.parse(resp);
120861
+ return new index_js_2.Contract(address, abi50, this);
120861
120862
  } catch (error) {
120862
120863
  return null;
120863
120864
  }
@@ -146454,9 +146455,9 @@ var require_node_gyp_build_optional_packages = __commonJS({
146454
146455
  var vars = process.config && process.config.variables || {};
146455
146456
  var prebuildsOnly = !!process.env.PREBUILDS_ONLY;
146456
146457
  var versions = process.versions;
146457
- var abi49 = versions.modules;
146458
+ var abi50 = versions.modules;
146458
146459
  if (versions.deno || process.isBun) {
146459
- abi49 = "unsupported";
146460
+ abi50 = "unsupported";
146460
146461
  }
146461
146462
  var runtime = isElectron() ? "electron" : "node";
146462
146463
  var arch = process.arch;
@@ -146503,7 +146504,7 @@ var require_node_gyp_build_optional_packages = __commonJS({
146503
146504
  "platform=" + platform,
146504
146505
  "arch=" + arch,
146505
146506
  "runtime=" + runtime,
146506
- "abi=" + abi49,
146507
+ "abi=" + abi50,
146507
146508
  "uv=" + uv,
146508
146509
  armv ? "armv=" + armv : "",
146509
146510
  "libc=" + libc,
@@ -146521,7 +146522,7 @@ var require_node_gyp_build_optional_packages = __commonJS({
146521
146522
  }
146522
146523
  function resolveFile(prebuilds) {
146523
146524
  var parsed = readdirSync(prebuilds).map(parseTags);
146524
- var candidates = parsed.filter(matchTags(runtime, abi49));
146525
+ var candidates = parsed.filter(matchTags(runtime, abi50));
146525
146526
  var winner = candidates.sort(compareTags(runtime))[0];
146526
146527
  if (winner) return path12.join(prebuilds, winner.file);
146527
146528
  }
@@ -146586,11 +146587,11 @@ var require_node_gyp_build_optional_packages = __commonJS({
146586
146587
  }
146587
146588
  return tags;
146588
146589
  }
146589
- function matchTags(runtime2, abi50) {
146590
+ function matchTags(runtime2, abi51) {
146590
146591
  return function(tags) {
146591
146592
  if (tags == null) return false;
146592
146593
  if (tags.runtime !== runtime2 && !runtimeAgnostic(tags)) return false;
146593
- if (tags.abi !== abi50 && !tags.napi) return false;
146594
+ if (tags.abi !== abi51 && !tags.napi) return false;
146594
146595
  if (tags.uv && tags.uv !== uv) return false;
146595
146596
  if (tags.armv && tags.armv !== armv) return false;
146596
146597
  if (tags.libc && tags.libc !== libc) return false;
@@ -152843,11 +152844,11 @@ var require_formatAbi = __commonJS({
152843
152844
  Object.defineProperty(exports2, "__esModule", { value: true });
152844
152845
  exports2.formatAbi = formatAbi;
152845
152846
  var formatAbiItem_js_1 = require_formatAbiItem();
152846
- function formatAbi(abi49) {
152847
+ function formatAbi(abi50) {
152847
152848
  const signatures = [];
152848
- const length = abi49.length;
152849
+ const length = abi50.length;
152849
152850
  for (let i = 0; i < length; i++) {
152850
- const abiItem = abi49[i];
152851
+ const abiItem = abi50[i];
152851
152852
  const signature = (0, formatAbiItem_js_1.formatAbiItem)(abiItem);
152852
152853
  signatures.push(signature);
152853
152854
  }
@@ -153610,15 +153611,15 @@ var require_parseAbi = __commonJS({
153610
153611
  var utils_js_1 = require_utils13();
153611
153612
  function parseAbi2(signatures) {
153612
153613
  const structs = (0, structs_js_1.parseStructs)(signatures);
153613
- const abi49 = [];
153614
+ const abi50 = [];
153614
153615
  const length = signatures.length;
153615
153616
  for (let i = 0; i < length; i++) {
153616
153617
  const signature = signatures[i];
153617
153618
  if ((0, signatures_js_1.isStructSignature)(signature))
153618
153619
  continue;
153619
- abi49.push((0, utils_js_1.parseSignature)(signature, structs));
153620
+ abi50.push((0, utils_js_1.parseSignature)(signature, structs));
153620
153621
  }
153621
- return abi49;
153622
+ return abi50;
153622
153623
  }
153623
153624
  }
153624
153625
  });
@@ -161405,7 +161406,7 @@ var require_version28 = __commonJS({
161405
161406
  "use strict";
161406
161407
  Object.defineProperty(exports2, "__esModule", { value: true });
161407
161408
  exports2.version = void 0;
161408
- exports2.version = "2.28.3";
161409
+ exports2.version = "2.29.0";
161409
161410
  }
161410
161411
  });
161411
161412
 
@@ -163419,9 +163420,9 @@ var require_getAbiItem = __commonJS({
163419
163420
  var toEventSelector_js_1 = require_toEventSelector();
163420
163421
  var toFunctionSelector_js_1 = require_toFunctionSelector();
163421
163422
  function getAbiItem2(parameters) {
163422
- const { abi: abi49, args = [], name } = parameters;
163423
+ const { abi: abi50, args = [], name } = parameters;
163423
163424
  const isSelector = (0, isHex_js_1.isHex)(name, { strict: false });
163424
- const abiItems = abi49.filter((abiItem) => {
163425
+ const abiItems = abi50.filter((abiItem) => {
163425
163426
  if (isSelector) {
163426
163427
  if (abiItem.type === "function")
163427
163428
  return (0, toFunctionSelector_js_1.toFunctionSelector)(abiItem) === name;
@@ -163546,10 +163547,10 @@ var require_encodeEventTopics = __commonJS({
163546
163547
  var getAbiItem_js_1 = require_getAbiItem();
163547
163548
  var docsPath8 = "/docs/contract/encodeEventTopics";
163548
163549
  function encodeEventTopics2(parameters) {
163549
- const { abi: abi49, eventName, args } = parameters;
163550
- let abiItem = abi49[0];
163550
+ const { abi: abi50, eventName, args } = parameters;
163551
+ let abiItem = abi50[0];
163551
163552
  if (eventName) {
163552
- const item = (0, getAbiItem_js_1.getAbiItem)({ abi: abi49, name: eventName });
163553
+ const item = (0, getAbiItem_js_1.getAbiItem)({ abi: abi50, name: eventName });
163553
163554
  if (!item)
163554
163555
  throw new abi_js_1.AbiEventNotFoundError(eventName, { docsPath: docsPath8 });
163555
163556
  abiItem = item;
@@ -163610,12 +163611,12 @@ var require_createContractEventFilter = __commonJS({
163610
163611
  var toHex_js_1 = require_toHex();
163611
163612
  var createFilterRequestScope_js_1 = require_createFilterRequestScope();
163612
163613
  async function createContractEventFilter2(client, parameters) {
163613
- const { address, abi: abi49, args, eventName, fromBlock, strict, toBlock } = parameters;
163614
+ const { address, abi: abi50, args, eventName, fromBlock, strict, toBlock } = parameters;
163614
163615
  const getRequest = (0, createFilterRequestScope_js_1.createFilterRequestScope)(client, {
163615
163616
  method: "eth_newFilter"
163616
163617
  });
163617
163618
  const topics = eventName ? (0, encodeEventTopics_js_1.encodeEventTopics)({
163618
- abi: abi49,
163619
+ abi: abi50,
163619
163620
  args,
163620
163621
  eventName
163621
163622
  }) : void 0;
@@ -163631,7 +163632,7 @@ var require_createContractEventFilter = __commonJS({
163631
163632
  ]
163632
163633
  });
163633
163634
  return {
163634
- abi: abi49,
163635
+ abi: abi50,
163635
163636
  args,
163636
163637
  eventName,
163637
163638
  id,
@@ -163669,11 +163670,11 @@ var require_prepareEncodeFunctionData = __commonJS({
163669
163670
  var getAbiItem_js_1 = require_getAbiItem();
163670
163671
  var docsPath8 = "/docs/contract/encodeFunctionData";
163671
163672
  function prepareEncodeFunctionData2(parameters) {
163672
- const { abi: abi49, args, functionName } = parameters;
163673
- let abiItem = abi49[0];
163673
+ const { abi: abi50, args, functionName } = parameters;
163674
+ let abiItem = abi50[0];
163674
163675
  if (functionName) {
163675
163676
  const item = (0, getAbiItem_js_1.getAbiItem)({
163676
- abi: abi49,
163677
+ abi: abi50,
163677
163678
  args,
163678
163679
  name: functionName
163679
163680
  });
@@ -163702,12 +163703,12 @@ var require_encodeFunctionData = __commonJS({
163702
163703
  var prepareEncodeFunctionData_js_1 = require_prepareEncodeFunctionData();
163703
163704
  function encodeFunctionData2(parameters) {
163704
163705
  const { args } = parameters;
163705
- const { abi: abi49, functionName } = (() => {
163706
+ const { abi: abi50, functionName } = (() => {
163706
163707
  if (parameters.abi.length === 1 && parameters.functionName?.startsWith("0x"))
163707
163708
  return parameters;
163708
163709
  return (0, prepareEncodeFunctionData_js_1.prepareEncodeFunctionData)(parameters);
163709
163710
  })();
163710
- const abiItem = abi49[0];
163711
+ const abiItem = abi50[0];
163711
163712
  const signature = functionName;
163712
163713
  const data = "inputs" in abiItem && abiItem.inputs ? (0, encodeAbiParameters_js_1.encodeAbiParameters)(abiItem.inputs, args ?? []) : void 0;
163713
163714
  return (0, concat_js_1.concatHex)([signature, data ?? "0x"]);
@@ -164239,11 +164240,11 @@ var require_decodeErrorResult = __commonJS({
164239
164240
  var decodeAbiParameters_js_1 = require_decodeAbiParameters();
164240
164241
  var formatAbiItem_js_1 = require_formatAbiItem2();
164241
164242
  function decodeErrorResult2(parameters) {
164242
- const { abi: abi49, data } = parameters;
164243
+ const { abi: abi50, data } = parameters;
164243
164244
  const signature = (0, slice_js_1.slice)(data, 0, 4);
164244
164245
  if (signature === "0x")
164245
164246
  throw new abi_js_1.AbiDecodingZeroDataError();
164246
- const abi_ = [...abi49 || [], solidity_js_1.solidityError, solidity_js_1.solidityPanic];
164247
+ const abi_ = [...abi50 || [], solidity_js_1.solidityError, solidity_js_1.solidityPanic];
164247
164248
  const abiItem = abi_.find((x) => x.type === "error" && signature === (0, toFunctionSelector_js_1.toFunctionSelector)((0, formatAbiItem_js_1.formatAbiItem)(x)));
164248
164249
  if (!abiItem)
164249
164250
  throw new abi_js_1.AbiErrorSignatureNotFoundError(signature, {
@@ -164665,8 +164666,8 @@ ${(0, stateOverride_js_1.prettyStateOverride)(stateOverride)}`;
164665
164666
  };
164666
164667
  exports2.CallExecutionError = CallExecutionError2;
164667
164668
  var ContractFunctionExecutionError2 = class extends base_js_1.BaseError {
164668
- constructor(cause, { abi: abi49, args, contractAddress, docsPath: docsPath8, functionName, sender }) {
164669
- const abiItem = (0, getAbiItem_js_1.getAbiItem)({ abi: abi49, args, name: functionName });
164669
+ constructor(cause, { abi: abi50, args, contractAddress, docsPath: docsPath8, functionName, sender }) {
164670
+ const abiItem = (0, getAbiItem_js_1.getAbiItem)({ abi: abi50, args, name: functionName });
164670
164671
  const formattedArgs = abiItem ? (0, formatAbiItemWithArgs_js_1.formatAbiItemWithArgs)({
164671
164672
  abiItem,
164672
164673
  args,
@@ -164732,7 +164733,7 @@ ${(0, stateOverride_js_1.prettyStateOverride)(stateOverride)}`;
164732
164733
  writable: true,
164733
164734
  value: void 0
164734
164735
  });
164735
- this.abi = abi49;
164736
+ this.abi = abi50;
164736
164737
  this.args = args;
164737
164738
  this.cause = cause;
164738
164739
  this.contractAddress = contractAddress;
@@ -164742,14 +164743,14 @@ ${(0, stateOverride_js_1.prettyStateOverride)(stateOverride)}`;
164742
164743
  };
164743
164744
  exports2.ContractFunctionExecutionError = ContractFunctionExecutionError2;
164744
164745
  var ContractFunctionRevertedError2 = class extends base_js_1.BaseError {
164745
- constructor({ abi: abi49, data, functionName, message: message2 }) {
164746
+ constructor({ abi: abi50, data, functionName, message: message2 }) {
164746
164747
  let cause;
164747
164748
  let decodedData = void 0;
164748
164749
  let metaMessages;
164749
164750
  let reason;
164750
164751
  if (data && data !== "0x") {
164751
164752
  try {
164752
- decodedData = (0, decodeErrorResult_js_1.decodeErrorResult)({ abi: abi49, data });
164753
+ decodedData = (0, decodeErrorResult_js_1.decodeErrorResult)({ abi: abi50, data });
164753
164754
  const { abiItem, errorName, args: errorArgs } = decodedData;
164754
164755
  if (errorName === "Error") {
164755
164756
  reason = errorArgs[0];
@@ -165461,7 +165462,7 @@ var require_getContractError = __commonJS({
165461
165462
  var request_js_1 = require_request();
165462
165463
  var rpc_js_1 = require_rpc();
165463
165464
  var EXECUTION_REVERTED_ERROR_CODE2 = 3;
165464
- function getContractError2(err, { abi: abi49, address, args, docsPath: docsPath8, functionName, sender }) {
165465
+ function getContractError2(err, { abi: abi50, address, args, docsPath: docsPath8, functionName, sender }) {
165465
165466
  const error = err instanceof contract_js_1.RawContractError ? err : err instanceof base_js_1.BaseError ? err.walk((err2) => "data" in err2) || err.walk() : {};
165466
165467
  const { code, data, details, message: message2, shortMessage } = error;
165467
165468
  const cause = (() => {
@@ -165469,7 +165470,7 @@ var require_getContractError = __commonJS({
165469
165470
  return new contract_js_1.ContractFunctionZeroDataError({ functionName });
165470
165471
  if ([EXECUTION_REVERTED_ERROR_CODE2, rpc_js_1.InternalRpcError.code].includes(code) && (data || details || message2 || shortMessage)) {
165471
165472
  return new contract_js_1.ContractFunctionRevertedError({
165472
- abi: abi49,
165473
+ abi: abi50,
165473
165474
  data: typeof data === "object" ? data.data : data,
165474
165475
  functionName,
165475
165476
  message: error instanceof request_js_1.RpcRequestError ? details : shortMessage ?? message2
@@ -165478,7 +165479,7 @@ var require_getContractError = __commonJS({
165478
165479
  return err;
165479
165480
  })();
165480
165481
  return new contract_js_1.ContractFunctionExecutionError(cause, {
165481
- abi: abi49,
165482
+ abi: abi50,
165482
165483
  args,
165483
165484
  contractAddress: address,
165484
165485
  docsPath: docsPath8,
@@ -170262,9 +170263,9 @@ var require_estimateContractGas = __commonJS({
170262
170263
  var getAction_js_1 = require_getAction();
170263
170264
  var estimateGas_js_1 = require_estimateGas2();
170264
170265
  async function estimateContractGas2(client, parameters) {
170265
- const { abi: abi49, address, args, functionName, dataSuffix, ...request } = parameters;
170266
+ const { abi: abi50, address, args, functionName, dataSuffix, ...request } = parameters;
170266
170267
  const data = (0, encodeFunctionData_js_1.encodeFunctionData)({
170267
- abi: abi49,
170268
+ abi: abi50,
170268
170269
  args,
170269
170270
  functionName
170270
170271
  });
@@ -170278,7 +170279,7 @@ var require_estimateContractGas = __commonJS({
170278
170279
  } catch (error) {
170279
170280
  const account = request.account ? (0, parseAccount_js_1.parseAccount)(request.account) : void 0;
170280
170281
  throw (0, getContractError_js_1.getContractError)(error, {
170281
- abi: abi49,
170282
+ abi: abi50,
170282
170283
  address,
170283
170284
  args,
170284
170285
  docsPath: "/docs/contract/estimateContractGas",
@@ -170322,15 +170323,15 @@ var require_decodeEventLog = __commonJS({
170322
170323
  var formatAbiItem_js_1 = require_formatAbiItem2();
170323
170324
  var docsPath8 = "/docs/contract/decodeEventLog";
170324
170325
  function decodeEventLog2(parameters) {
170325
- const { abi: abi49, data, strict: strict_, topics } = parameters;
170326
+ const { abi: abi50, data, strict: strict_, topics } = parameters;
170326
170327
  const strict = strict_ ?? true;
170327
170328
  const [signature, ...argTopics] = topics;
170328
170329
  if (!signature)
170329
170330
  throw new abi_js_1.AbiEventSignatureEmptyTopicsError({ docsPath: docsPath8 });
170330
170331
  const abiItem = (() => {
170331
- if (abi49.length === 1)
170332
- return abi49[0];
170333
- return abi49.find((x) => x.type === "event" && signature === (0, toEventSelector_js_1.toEventSelector)((0, formatAbiItem_js_1.formatAbiItem)(x)));
170332
+ if (abi50.length === 1)
170333
+ return abi50[0];
170334
+ return abi50.find((x) => x.type === "event" && signature === (0, toEventSelector_js_1.toEventSelector)((0, formatAbiItem_js_1.formatAbiItem)(x)));
170334
170335
  })();
170335
170336
  if (!(abiItem && "name" in abiItem) || abiItem.type !== "event")
170336
170337
  throw new abi_js_1.AbiEventSignatureNotFoundError(signature, { docsPath: docsPath8 });
@@ -170410,7 +170411,7 @@ var require_parseEventLogs = __commonJS({
170410
170411
  var toEventSelector_js_1 = require_toEventSelector();
170411
170412
  var decodeEventLog_js_1 = require_decodeEventLog();
170412
170413
  function parseEventLogs2(parameters) {
170413
- const { abi: abi49, args, logs, strict = true } = parameters;
170414
+ const { abi: abi50, args, logs, strict = true } = parameters;
170414
170415
  const eventName = (() => {
170415
170416
  if (!parameters.eventName)
170416
170417
  return void 0;
@@ -170420,7 +170421,7 @@ var require_parseEventLogs = __commonJS({
170420
170421
  })();
170421
170422
  return logs.map((log2) => {
170422
170423
  try {
170423
- const abiItem = abi49.find((abiItem2) => abiItem2.type === "event" && log2.topics[0] === (0, toEventSelector_js_1.toEventSelector)(abiItem2));
170424
+ const abiItem = abi50.find((abiItem2) => abiItem2.type === "event" && log2.topics[0] === (0, toEventSelector_js_1.toEventSelector)(abiItem2));
170424
170425
  if (!abiItem)
170425
170426
  return null;
170426
170427
  const event = (0, decodeEventLog_js_1.decodeEventLog)({
@@ -170581,9 +170582,9 @@ var require_getContractEvents = __commonJS({
170581
170582
  var getAction_js_1 = require_getAction();
170582
170583
  var getLogs_js_1 = require_getLogs();
170583
170584
  async function getContractEvents2(client, parameters) {
170584
- const { abi: abi49, address, args, blockHash, eventName, fromBlock, toBlock, strict } = parameters;
170585
- const event = eventName ? (0, getAbiItem_js_1.getAbiItem)({ abi: abi49, name: eventName }) : void 0;
170586
- const events = !event ? abi49.filter((x) => x.type === "event") : void 0;
170585
+ const { abi: abi50, address, args, blockHash, eventName, fromBlock, toBlock, strict } = parameters;
170586
+ const event = eventName ? (0, getAbiItem_js_1.getAbiItem)({ abi: abi50, name: eventName }) : void 0;
170587
+ const events = !event ? abi50.filter((x) => x.type === "event") : void 0;
170587
170588
  return (0, getAction_js_1.getAction)(client, getLogs_js_1.getLogs, "getLogs")({
170588
170589
  address,
170589
170590
  args,
@@ -170609,10 +170610,10 @@ var require_decodeFunctionResult = __commonJS({
170609
170610
  var getAbiItem_js_1 = require_getAbiItem();
170610
170611
  var docsPath8 = "/docs/contract/decodeFunctionResult";
170611
170612
  function decodeFunctionResult2(parameters) {
170612
- const { abi: abi49, args, functionName, data } = parameters;
170613
- let abiItem = abi49[0];
170613
+ const { abi: abi50, args, functionName, data } = parameters;
170614
+ let abiItem = abi50[0];
170614
170615
  if (functionName) {
170615
- const item = (0, getAbiItem_js_1.getAbiItem)({ abi: abi49, args, name: functionName });
170616
+ const item = (0, getAbiItem_js_1.getAbiItem)({ abi: abi50, args, name: functionName });
170616
170617
  if (!item)
170617
170618
  throw new abi_js_1.AbiFunctionNotFoundError(functionName, { docsPath: docsPath8 });
170618
170619
  abiItem = item;
@@ -172634,10 +172635,10 @@ var require_encodeDeployData = __commonJS({
172634
172635
  var encodeAbiParameters_js_1 = require_encodeAbiParameters();
172635
172636
  var docsPath8 = "/docs/contract/encodeDeployData";
172636
172637
  function encodeDeployData2(parameters) {
172637
- const { abi: abi49, args, bytecode } = parameters;
172638
+ const { abi: abi50, args, bytecode } = parameters;
172638
172639
  if (!args || args.length === 0)
172639
172640
  return bytecode;
172640
- const description = abi49.find((x) => "type" in x && x.type === "constructor");
172641
+ const description = abi50.find((x) => "type" in x && x.type === "constructor");
172641
172642
  if (!description)
172642
172643
  throw new abi_js_1.AbiConstructorNotFoundError({ docsPath: docsPath8 });
172643
172644
  if (!("inputs" in description))
@@ -172844,9 +172845,9 @@ var require_decodeFunctionData = __commonJS({
172844
172845
  var decodeAbiParameters_js_1 = require_decodeAbiParameters();
172845
172846
  var formatAbiItem_js_1 = require_formatAbiItem2();
172846
172847
  function decodeFunctionData2(parameters) {
172847
- const { abi: abi49, data } = parameters;
172848
+ const { abi: abi50, data } = parameters;
172848
172849
  const signature = (0, slice_js_1.slice)(data, 0, 4);
172849
- const description = abi49.find((x) => x.type === "function" && signature === (0, toFunctionSelector_js_1.toFunctionSelector)((0, formatAbiItem_js_1.formatAbiItem)(x)));
172850
+ const description = abi50.find((x) => x.type === "function" && signature === (0, toFunctionSelector_js_1.toFunctionSelector)((0, formatAbiItem_js_1.formatAbiItem)(x)));
172850
172851
  if (!description)
172851
172852
  throw new abi_js_1.AbiFunctionSignatureNotFoundError(signature, {
172852
172853
  docsPath: "/docs/contract/decodeFunctionData"
@@ -172873,10 +172874,10 @@ var require_encodeErrorResult = __commonJS({
172873
172874
  var getAbiItem_js_1 = require_getAbiItem();
172874
172875
  var docsPath8 = "/docs/contract/encodeErrorResult";
172875
172876
  function encodeErrorResult2(parameters) {
172876
- const { abi: abi49, errorName, args } = parameters;
172877
- let abiItem = abi49[0];
172877
+ const { abi: abi50, errorName, args } = parameters;
172878
+ let abiItem = abi50[0];
172878
172879
  if (errorName) {
172879
- const item = (0, getAbiItem_js_1.getAbiItem)({ abi: abi49, args, name: errorName });
172880
+ const item = (0, getAbiItem_js_1.getAbiItem)({ abi: abi50, args, name: errorName });
172880
172881
  if (!item)
172881
172882
  throw new abi_js_1.AbiErrorNotFoundError(errorName, { docsPath: docsPath8 });
172882
172883
  abiItem = item;
@@ -172907,10 +172908,10 @@ var require_encodeFunctionResult = __commonJS({
172907
172908
  var getAbiItem_js_1 = require_getAbiItem();
172908
172909
  var docsPath8 = "/docs/contract/encodeFunctionResult";
172909
172910
  function encodeFunctionResult2(parameters) {
172910
- const { abi: abi49, functionName, result } = parameters;
172911
- let abiItem = abi49[0];
172911
+ const { abi: abi50, functionName, result } = parameters;
172912
+ let abiItem = abi50[0];
172912
172913
  if (functionName) {
172913
- const item = (0, getAbiItem_js_1.getAbiItem)({ abi: abi49, name: functionName });
172914
+ const item = (0, getAbiItem_js_1.getAbiItem)({ abi: abi50, name: functionName });
172914
172915
  if (!item)
172915
172916
  throw new abi_js_1.AbiFunctionNotFoundError(functionName, { docsPath: docsPath8 });
172916
172917
  abiItem = item;
@@ -173330,9 +173331,9 @@ var require_readContract = __commonJS({
173330
173331
  var getAction_js_1 = require_getAction();
173331
173332
  var call_js_1 = require_call();
173332
173333
  async function readContract2(client, parameters) {
173333
- const { abi: abi49, address, args, functionName, ...rest } = parameters;
173334
+ const { abi: abi50, address, args, functionName, ...rest } = parameters;
173334
173335
  const calldata = (0, encodeFunctionData_js_1.encodeFunctionData)({
173335
- abi: abi49,
173336
+ abi: abi50,
173336
173337
  args,
173337
173338
  functionName
173338
173339
  });
@@ -173343,14 +173344,14 @@ var require_readContract = __commonJS({
173343
173344
  to: address
173344
173345
  });
173345
173346
  return (0, decodeFunctionResult_js_1.decodeFunctionResult)({
173346
- abi: abi49,
173347
+ abi: abi50,
173347
173348
  args,
173348
173349
  functionName,
173349
173350
  data: data || "0x"
173350
173351
  });
173351
173352
  } catch (error) {
173352
173353
  throw (0, getContractError_js_1.getContractError)(error, {
173353
- abi: abi49,
173354
+ abi: abi50,
173354
173355
  address,
173355
173356
  args,
173356
173357
  docsPath: "/docs/contract/readContract",
@@ -173374,9 +173375,9 @@ var require_simulateContract = __commonJS({
173374
173375
  var getAction_js_1 = require_getAction();
173375
173376
  var call_js_1 = require_call();
173376
173377
  async function simulateContract2(client, parameters) {
173377
- const { abi: abi49, address, args, dataSuffix, functionName, ...callRequest } = parameters;
173378
+ const { abi: abi50, address, args, dataSuffix, functionName, ...callRequest } = parameters;
173378
173379
  const account = callRequest.account ? (0, parseAccount_js_1.parseAccount)(callRequest.account) : client.account;
173379
- const calldata = (0, encodeFunctionData_js_1.encodeFunctionData)({ abi: abi49, args, functionName });
173380
+ const calldata = (0, encodeFunctionData_js_1.encodeFunctionData)({ abi: abi50, args, functionName });
173380
173381
  try {
173381
173382
  const { data } = await (0, getAction_js_1.getAction)(client, call_js_1.call, "call")({
173382
173383
  batch: false,
@@ -173386,12 +173387,12 @@ var require_simulateContract = __commonJS({
173386
173387
  account
173387
173388
  });
173388
173389
  const result = (0, decodeFunctionResult_js_1.decodeFunctionResult)({
173389
- abi: abi49,
173390
+ abi: abi50,
173390
173391
  args,
173391
173392
  functionName,
173392
173393
  data: data || "0x"
173393
173394
  });
173394
- const minimizedAbi = abi49.filter((abiItem) => "name" in abiItem && abiItem.name === parameters.functionName);
173395
+ const minimizedAbi = abi50.filter((abiItem) => "name" in abiItem && abiItem.name === parameters.functionName);
173395
173396
  return {
173396
173397
  result,
173397
173398
  request: {
@@ -173406,7 +173407,7 @@ var require_simulateContract = __commonJS({
173406
173407
  };
173407
173408
  } catch (error) {
173408
173409
  throw (0, getContractError_js_1.getContractError)(error, {
173409
- abi: abi49,
173410
+ abi: abi50,
173410
173411
  address,
173411
173412
  args,
173412
173413
  docsPath: "/docs/contract/simulateContract",
@@ -173648,7 +173649,7 @@ var require_watchContractEvent = __commonJS({
173648
173649
  var getFilterChanges_js_1 = require_getFilterChanges();
173649
173650
  var uninstallFilter_js_1 = require_uninstallFilter();
173650
173651
  function watchContractEvent2(client, parameters) {
173651
- const { abi: abi49, address, args, batch = true, eventName, fromBlock, onError, onLogs, poll: poll_, pollingInterval = client.pollingInterval, strict: strict_ } = parameters;
173652
+ const { abi: abi50, address, args, batch = true, eventName, fromBlock, onError, onLogs, poll: poll_, pollingInterval = client.pollingInterval, strict: strict_ } = parameters;
173652
173653
  const enablePolling = (() => {
173653
173654
  if (typeof poll_ !== "undefined")
173654
173655
  return poll_;
@@ -173683,7 +173684,7 @@ var require_watchContractEvent = __commonJS({
173683
173684
  if (!initialized) {
173684
173685
  try {
173685
173686
  filter = await (0, getAction_js_1.getAction)(client, createContractEventFilter_js_1.createContractEventFilter, "createContractEventFilter")({
173686
- abi: abi49,
173687
+ abi: abi50,
173687
173688
  address,
173688
173689
  args,
173689
173690
  eventName,
@@ -173703,7 +173704,7 @@ var require_watchContractEvent = __commonJS({
173703
173704
  const blockNumber = await (0, getAction_js_1.getAction)(client, getBlockNumber_js_1.getBlockNumber, "getBlockNumber")({});
173704
173705
  if (previousBlockNumber && previousBlockNumber < blockNumber) {
173705
173706
  logs = await (0, getAction_js_1.getAction)(client, getContractEvents_js_1.getContractEvents, "getContractEvents")({
173706
- abi: abi49,
173707
+ abi: abi50,
173707
173708
  address,
173708
173709
  args,
173709
173710
  eventName,
@@ -173767,7 +173768,7 @@ var require_watchContractEvent = __commonJS({
173767
173768
  return client.transport;
173768
173769
  })();
173769
173770
  const topics = eventName ? (0, encodeEventTopics_js_1.encodeEventTopics)({
173770
- abi: abi49,
173771
+ abi: abi50,
173771
173772
  eventName,
173772
173773
  args
173773
173774
  }) : [];
@@ -173779,7 +173780,7 @@ var require_watchContractEvent = __commonJS({
173779
173780
  const log2 = data.result;
173780
173781
  try {
173781
173782
  const { eventName: eventName2, args: args2 } = (0, decodeEventLog_js_1.decodeEventLog)({
173782
- abi: abi49,
173783
+ abi: abi50,
173783
173784
  data: log2.data,
173784
173785
  topics: log2.topics,
173785
173786
  strict: strict_
@@ -174081,14 +174082,14 @@ var require_writeContract = __commonJS({
174081
174082
  var getAction_js_1 = require_getAction();
174082
174083
  var sendTransaction_js_1 = require_sendTransaction();
174083
174084
  async function writeContract2(client, parameters) {
174084
- const { abi: abi49, account: account_ = client.account, address, args, dataSuffix, functionName, ...request } = parameters;
174085
+ const { abi: abi50, account: account_ = client.account, address, args, dataSuffix, functionName, ...request } = parameters;
174085
174086
  if (typeof account_ === "undefined")
174086
174087
  throw new account_js_1.AccountNotFoundError({
174087
174088
  docsPath: "/docs/contract/writeContract"
174088
174089
  });
174089
174090
  const account = account_ ? (0, parseAccount_js_1.parseAccount)(account_) : null;
174090
174091
  const data = (0, encodeFunctionData_js_1.encodeFunctionData)({
174091
- abi: abi49,
174092
+ abi: abi50,
174092
174093
  args,
174093
174094
  functionName
174094
174095
  });
@@ -174101,7 +174102,7 @@ var require_writeContract = __commonJS({
174101
174102
  });
174102
174103
  } catch (error) {
174103
174104
  throw (0, getContractError_js_1.getContractError)(error, {
174104
- abi: abi49,
174105
+ abi: abi50,
174105
174106
  address,
174106
174107
  args,
174107
174108
  docsPath: "/docs/contract/writeContract",
@@ -174129,7 +174130,7 @@ var require_getContract = __commonJS({
174129
174130
  var simulateContract_js_1 = require_simulateContract();
174130
174131
  var watchContractEvent_js_1 = require_watchContractEvent();
174131
174132
  var writeContract_js_1 = require_writeContract();
174132
- function getContract2({ abi: abi49, address, client: client_ }) {
174133
+ function getContract2({ abi: abi50, address, client: client_ }) {
174133
174134
  const client = client_;
174134
174135
  const [publicClient, walletClient] = (() => {
174135
174136
  if (!client)
@@ -174148,7 +174149,7 @@ var require_getContract = __commonJS({
174148
174149
  let hasReadFunction = false;
174149
174150
  let hasWriteFunction = false;
174150
174151
  let hasEvent = false;
174151
- for (const item of abi49) {
174152
+ for (const item of abi50) {
174152
174153
  if (item.type === "function")
174153
174154
  if (item.stateMutability === "view" || item.stateMutability === "pure")
174154
174155
  hasReadFunction = true;
@@ -174166,7 +174167,7 @@ var require_getContract = __commonJS({
174166
174167
  return (...parameters) => {
174167
174168
  const { args, options } = getFunctionParameters2(parameters);
174168
174169
  return (0, getAction_js_1.getAction)(publicClient, readContract_js_1.readContract, "readContract")({
174169
- abi: abi49,
174170
+ abi: abi50,
174170
174171
  address,
174171
174172
  functionName,
174172
174173
  args,
@@ -174181,7 +174182,7 @@ var require_getContract = __commonJS({
174181
174182
  return (...parameters) => {
174182
174183
  const { args, options } = getFunctionParameters2(parameters);
174183
174184
  return (0, getAction_js_1.getAction)(publicClient, simulateContract_js_1.simulateContract, "simulateContract")({
174184
- abi: abi49,
174185
+ abi: abi50,
174185
174186
  address,
174186
174187
  functionName,
174187
174188
  args,
@@ -174194,10 +174195,10 @@ var require_getContract = __commonJS({
174194
174195
  contract.createEventFilter = new Proxy({}, {
174195
174196
  get(_, eventName) {
174196
174197
  return (...parameters) => {
174197
- const abiEvent = abi49.find((x) => x.type === "event" && x.name === eventName);
174198
+ const abiEvent = abi50.find((x) => x.type === "event" && x.name === eventName);
174198
174199
  const { args, options } = getEventParameters2(parameters, abiEvent);
174199
174200
  return (0, getAction_js_1.getAction)(publicClient, createContractEventFilter_js_1.createContractEventFilter, "createContractEventFilter")({
174200
- abi: abi49,
174201
+ abi: abi50,
174201
174202
  address,
174202
174203
  eventName,
174203
174204
  args,
@@ -174209,10 +174210,10 @@ var require_getContract = __commonJS({
174209
174210
  contract.getEvents = new Proxy({}, {
174210
174211
  get(_, eventName) {
174211
174212
  return (...parameters) => {
174212
- const abiEvent = abi49.find((x) => x.type === "event" && x.name === eventName);
174213
+ const abiEvent = abi50.find((x) => x.type === "event" && x.name === eventName);
174213
174214
  const { args, options } = getEventParameters2(parameters, abiEvent);
174214
174215
  return (0, getAction_js_1.getAction)(publicClient, getContractEvents_js_1.getContractEvents, "getContractEvents")({
174215
- abi: abi49,
174216
+ abi: abi50,
174216
174217
  address,
174217
174218
  eventName,
174218
174219
  args,
@@ -174224,10 +174225,10 @@ var require_getContract = __commonJS({
174224
174225
  contract.watchEvent = new Proxy({}, {
174225
174226
  get(_, eventName) {
174226
174227
  return (...parameters) => {
174227
- const abiEvent = abi49.find((x) => x.type === "event" && x.name === eventName);
174228
+ const abiEvent = abi50.find((x) => x.type === "event" && x.name === eventName);
174228
174229
  const { args, options } = getEventParameters2(parameters, abiEvent);
174229
174230
  return (0, getAction_js_1.getAction)(publicClient, watchContractEvent_js_1.watchContractEvent, "watchContractEvent")({
174230
- abi: abi49,
174231
+ abi: abi50,
174231
174232
  address,
174232
174233
  eventName,
174233
174234
  args,
@@ -174245,7 +174246,7 @@ var require_getContract = __commonJS({
174245
174246
  return (...parameters) => {
174246
174247
  const { args, options } = getFunctionParameters2(parameters);
174247
174248
  return (0, getAction_js_1.getAction)(walletClient, writeContract_js_1.writeContract, "writeContract")({
174248
- abi: abi49,
174249
+ abi: abi50,
174249
174250
  address,
174250
174251
  functionName,
174251
174252
  args,
@@ -174263,7 +174264,7 @@ var require_getContract = __commonJS({
174263
174264
  const { args, options } = getFunctionParameters2(parameters);
174264
174265
  const client2 = publicClient ?? walletClient;
174265
174266
  return (0, getAction_js_1.getAction)(client2, estimateContractGas_js_1.estimateContractGas, "estimateContractGas")({
174266
- abi: abi49,
174267
+ abi: abi50,
174267
174268
  address,
174268
174269
  functionName,
174269
174270
  args,
@@ -174275,7 +174276,7 @@ var require_getContract = __commonJS({
174275
174276
  });
174276
174277
  }
174277
174278
  contract.address = address;
174278
- contract.abi = abi49;
174279
+ contract.abi = abi50;
174279
174280
  return contract;
174280
174281
  }
174281
174282
  function getFunctionParameters2(values) {
@@ -176074,7 +176075,7 @@ var require_getEip712Domain = __commonJS({
176074
176075
  const { address, factory, factoryData } = parameters;
176075
176076
  try {
176076
176077
  const [fields, name, version4, chainId, verifyingContract, salt, extensions] = await (0, getAction_js_1.getAction)(client, readContract_js_1.readContract, "readContract")({
176077
- abi: abi49,
176078
+ abi: abi50,
176078
176079
  address,
176079
176080
  functionName: "eip712Domain",
176080
176081
  factory,
@@ -176099,7 +176100,7 @@ var require_getEip712Domain = __commonJS({
176099
176100
  throw error;
176100
176101
  }
176101
176102
  }
176102
- var abi49 = [
176103
+ var abi50 = [
176103
176104
  {
176104
176105
  inputs: [],
176105
176106
  name: "eip712Domain",
@@ -182686,9 +182687,9 @@ var require_multicall2 = __commonJS({
182686
182687
  let currentChunk = 0;
182687
182688
  let currentChunkSize = 0;
182688
182689
  for (let i = 0; i < contracts2.length; i++) {
182689
- const { abi: abi49, address, args, functionName } = contracts2[i];
182690
+ const { abi: abi50, address, args, functionName } = contracts2[i];
182690
182691
  try {
182691
- const callData = (0, encodeFunctionData_js_1.encodeFunctionData)({ abi: abi49, args, functionName });
182692
+ const callData = (0, encodeFunctionData_js_1.encodeFunctionData)({ abi: abi50, args, functionName });
182692
182693
  currentChunkSize += (callData.length - 2) / 2;
182693
182694
  if (batchSize > 0 && currentChunkSize > batchSize && chunkedCalls[currentChunk].length > 0) {
182694
182695
  currentChunk++;
@@ -182705,7 +182706,7 @@ var require_multicall2 = __commonJS({
182705
182706
  ];
182706
182707
  } catch (err) {
182707
182708
  const error = (0, getContractError_js_1.getContractError)(err, {
182708
- abi: abi49,
182709
+ abi: abi50,
182709
182710
  address,
182710
182711
  args,
182711
182712
  docsPath: "/docs/contract/multicall",
@@ -182751,14 +182752,14 @@ var require_multicall2 = __commonJS({
182751
182752
  for (let j = 0; j < aggregate3Result.length; j++) {
182752
182753
  const { returnData, success } = aggregate3Result[j];
182753
182754
  const { callData } = chunkedCalls[i][j];
182754
- const { abi: abi49, address, functionName, args } = contracts2[results.length];
182755
+ const { abi: abi50, address, functionName, args } = contracts2[results.length];
182755
182756
  try {
182756
182757
  if (callData === "0x")
182757
182758
  throw new abi_js_1.AbiDecodingZeroDataError();
182758
182759
  if (!success)
182759
182760
  throw new contract_js_1.RawContractError({ data: returnData });
182760
182761
  const result2 = (0, decodeFunctionResult_js_1.decodeFunctionResult)({
182761
- abi: abi49,
182762
+ abi: abi50,
182762
182763
  args,
182763
182764
  data: returnData,
182764
182765
  functionName
@@ -182766,7 +182767,7 @@ var require_multicall2 = __commonJS({
182766
182767
  results.push(allowFailure ? { result: result2, status: "success" } : result2);
182767
182768
  } catch (err) {
182768
182769
  const error = (0, getContractError_js_1.getContractError)(err, {
182769
- abi: abi49,
182770
+ abi: abi50,
182770
182771
  address,
182771
182772
  args,
182772
182773
  docsPath: "/docs/contract/multicall",
@@ -184097,13 +184098,13 @@ var require_simulateBlocks = __commonJS({
184097
184098
  return result.map((block2, i) => ({
184098
184099
  ...(0, block_js_1.formatBlock)(block2),
184099
184100
  calls: block2.calls.map((call2, j) => {
184100
- const { abi: abi49, args, functionName, to } = blocks[i].calls[j];
184101
+ const { abi: abi50, args, functionName, to } = blocks[i].calls[j];
184101
184102
  const data = call2.error?.data ?? call2.returnData;
184102
184103
  const gasUsed = BigInt(call2.gasUsed);
184103
184104
  const logs = call2.logs?.map((log2) => (0, log_js_1.formatLog)(log2));
184104
184105
  const status = call2.status === "0x1" ? "success" : "failure";
184105
- const result2 = abi49 && status === "success" && data !== "0x" ? (0, decodeFunctionResult_js_1.decodeFunctionResult)({
184106
- abi: abi49,
184106
+ const result2 = abi50 && status === "success" && data !== "0x" ? (0, decodeFunctionResult_js_1.decodeFunctionResult)({
184107
+ abi: abi50,
184107
184108
  data,
184108
184109
  functionName
184109
184110
  }) : null;
@@ -184118,7 +184119,7 @@ var require_simulateBlocks = __commonJS({
184118
184119
  if (!error2)
184119
184120
  return void 0;
184120
184121
  return (0, getContractError_js_1.getContractError)(error2, {
184121
- abi: abi49 ?? [],
184122
+ abi: abi50 ?? [],
184122
184123
  address: to,
184123
184124
  args,
184124
184125
  functionName: functionName ?? "<unknown>"
@@ -186191,10 +186192,10 @@ var require_AbiItem = __commonJS({
186191
186192
  ...prepare ? { hash: getSignatureHash2(item) } : {}
186192
186193
  };
186193
186194
  }
186194
- function fromAbi3(abi49, name, options) {
186195
+ function fromAbi3(abi50, name, options) {
186195
186196
  const { args = [], prepare = true } = options ?? {};
186196
186197
  const isSelector = Hex.validate(name, { strict: false });
186197
- const abiItems = abi49.filter((abiItem2) => {
186198
+ const abiItems = abi50.filter((abiItem2) => {
186198
186199
  if (isSelector) {
186199
186200
  if (abiItem2.type === "function" || abiItem2.type === "error")
186200
186201
  return getSelector3(abiItem2) === Hex.slice(name, 0, 4);
@@ -187337,8 +187338,8 @@ var require_AbiConstructor = __commonJS({
187337
187338
  function from5(abiConstructor) {
187338
187339
  return AbiItem.from(abiConstructor);
187339
187340
  }
187340
- function fromAbi3(abi49) {
187341
- const item = abi49.find((item2) => item2.type === "constructor");
187341
+ function fromAbi3(abi50) {
187342
+ const item = abi50.find((item2) => item2.type === "constructor");
187342
187343
  if (!item)
187343
187344
  throw new AbiItem.NotFoundError({ name: "constructor" });
187344
187345
  return item;
@@ -187413,8 +187414,8 @@ var require_AbiFunction = __commonJS({
187413
187414
  function from5(abiFunction, options = {}) {
187414
187415
  return AbiItem.from(abiFunction, options);
187415
187416
  }
187416
- function fromAbi3(abi49, name, options) {
187417
- const item = AbiItem.fromAbi(abi49, name, options);
187417
+ function fromAbi3(abi50, name, options) {
187418
+ const item = AbiItem.fromAbi(abi50, name, options);
187418
187419
  if (item.type !== "function")
187419
187420
  throw new AbiItem.NotFoundError({ name, type: "function" });
187420
187421
  return item;
@@ -188065,7 +188066,7 @@ var require_watchBlocks = __commonJS({
188065
188066
  blockTag,
188066
188067
  includeTransactions
188067
188068
  });
188068
- if (block.number && prevBlock?.number) {
188069
+ if (block.number !== null && prevBlock?.number != null) {
188069
188070
  if (block.number === prevBlock.number)
188070
188071
  return;
188071
188072
  if (block.number - prevBlock.number > 1 && emitMissed) {
@@ -188079,7 +188080,7 @@ var require_watchBlocks = __commonJS({
188079
188080
  }
188080
188081
  }
188081
188082
  }
188082
- if (!prevBlock?.number || blockTag === "pending" && !block?.number || block.number && block.number > prevBlock.number) {
188083
+ if (prevBlock?.number == null || blockTag === "pending" && block?.number == null || block.number !== null && block.number > prevBlock.number) {
188083
188084
  emit.onBlock(block, prevBlock);
188084
188085
  prevBlock = block;
188085
188086
  }
@@ -189315,8 +189316,8 @@ var require_deployContract = __commonJS({
189315
189316
  var encodeDeployData_js_1 = require_encodeDeployData();
189316
189317
  var sendTransaction_js_1 = require_sendTransaction();
189317
189318
  function deployContract2(walletClient, parameters) {
189318
- const { abi: abi49, args, bytecode, ...request } = parameters;
189319
- const calldata = (0, encodeDeployData_js_1.encodeDeployData)({ abi: abi49, args, bytecode });
189319
+ const { abi: abi50, args, bytecode, ...request } = parameters;
189320
+ const calldata = (0, encodeDeployData_js_1.encodeDeployData)({ abi: abi50, args, bytecode });
189320
189321
  return (0, sendTransaction_js_1.sendTransaction)(walletClient, {
189321
189322
  ...request,
189322
189323
  ...request.authorizationList ? { to: null } : {},
@@ -189359,8 +189360,14 @@ var require_getCapabilities = __commonJS({
189359
189360
  params
189360
189361
  });
189361
189362
  const capabilities = {};
189362
- for (const [key, value] of Object.entries(capabilities_raw))
189363
- capabilities[Number(key)] = value;
189363
+ for (const [chainId2, capabilities_] of Object.entries(capabilities_raw)) {
189364
+ capabilities[Number(chainId2)] = {};
189365
+ for (let [key, value] of Object.entries(capabilities_)) {
189366
+ if (key === "addSubAccount")
189367
+ key = "unstable_addSubAccount";
189368
+ capabilities[Number(chainId2)][key] = value;
189369
+ }
189370
+ }
189364
189371
  return typeof chainId === "number" ? capabilities[chainId] : capabilities;
189365
189372
  }
189366
189373
  }
@@ -189466,7 +189473,7 @@ var require_sendCalls = __commonJS({
189466
189473
  var toHex_js_1 = require_toHex();
189467
189474
  var getTransactionError_js_1 = require_getTransactionError();
189468
189475
  async function sendCalls2(client, parameters) {
189469
- const { account: account_ = client.account, capabilities, chain = client.chain, forceAtomic = false, id, version: version4 = "2.0.0" } = parameters;
189476
+ const { account: account_ = client.account, chain = client.chain, forceAtomic = false, id, version: version4 = "2.0.0" } = parameters;
189470
189477
  if (typeof account_ === "undefined")
189471
189478
  throw new account_js_1.AccountNotFoundError({
189472
189479
  docsPath: "/docs/actions/wallet/sendCalls"
@@ -189492,7 +189499,7 @@ var require_sendCalls = __commonJS({
189492
189499
  {
189493
189500
  atomicRequired: forceAtomic,
189494
189501
  calls,
189495
- capabilities,
189502
+ capabilities: formatRequestCapabilities2(parameters.capabilities),
189496
189503
  chainId: (0, toHex_js_1.numberToHex)(chain.id),
189497
189504
  from: account?.address,
189498
189505
  id,
@@ -189511,6 +189518,18 @@ var require_sendCalls = __commonJS({
189511
189518
  });
189512
189519
  }
189513
189520
  }
189521
+ function formatRequestCapabilities2(capabilities) {
189522
+ const paymasterService = capabilities?.paymasterService ? Object.entries(capabilities.paymasterService).reduce((paymasterService2, [chainId, value]) => ({
189523
+ ...paymasterService2 ?? {},
189524
+ [(0, toHex_js_1.numberToHex)(Number(chainId))]: value
189525
+ }), {}) : void 0;
189526
+ return {
189527
+ ...capabilities,
189528
+ ...paymasterService ? {
189529
+ paymasterService
189530
+ } : {}
189531
+ };
189532
+ }
189514
189533
  }
189515
189534
  });
189516
189535
 
@@ -189929,10 +189948,10 @@ var require_decodeDeployData = __commonJS({
189929
189948
  var decodeAbiParameters_js_1 = require_decodeAbiParameters();
189930
189949
  var docsPath8 = "/docs/contract/decodeDeployData";
189931
189950
  function decodeDeployData(parameters) {
189932
- const { abi: abi49, bytecode, data } = parameters;
189951
+ const { abi: abi50, bytecode, data } = parameters;
189933
189952
  if (data === bytecode)
189934
189953
  return { bytecode };
189935
- const description = abi49.find((x) => "type" in x && x.type === "constructor");
189954
+ const description = abi50.find((x) => "type" in x && x.type === "constructor");
189936
189955
  if (!description)
189937
189956
  throw new abi_js_1.AbiConstructorNotFoundError({ docsPath: docsPath8 });
189938
189957
  if (!("inputs" in description))
@@ -226621,15 +226640,15 @@ var require_plumeMainnet = __commonJS({
226621
226640
  },
226622
226641
  rpcUrls: {
226623
226642
  default: {
226624
- http: ["https://phoenix-rpc.plumenetwork.xyz"],
226625
- webSocket: ["wss://phoenix-rpc.plumenetwork.xyz"]
226643
+ http: ["https://rpc.plume.org"],
226644
+ webSocket: ["wss://rpc.plume.org"]
226626
226645
  }
226627
226646
  },
226628
226647
  blockExplorers: {
226629
226648
  default: {
226630
226649
  name: "Blockscout",
226631
- url: "https://phoenix-explorer.plumenetwork.xyz",
226632
- apiUrl: "https://phoenix-explorer.plumenetwork.xyz/api"
226650
+ url: "https://explorer.plume.org",
226651
+ apiUrl: "https://explorer.plume.org/api"
226633
226652
  }
226634
226653
  },
226635
226654
  contracts: {
@@ -226661,15 +226680,15 @@ var require_plumeSepolia = __commonJS({
226661
226680
  },
226662
226681
  rpcUrls: {
226663
226682
  default: {
226664
- http: ["https://testnet-rpc.plumenetwork.xyz"],
226665
- webSocket: ["wss://testnet-rpc.plumenetwork.xyz"]
226683
+ http: ["https://testnet-rpc.plume.org"],
226684
+ webSocket: ["wss://testnet-rpc.plume.org"]
226666
226685
  }
226667
226686
  },
226668
226687
  blockExplorers: {
226669
226688
  default: {
226670
226689
  name: "Blockscout",
226671
- url: "https://testnet-explorer.plumenetwork.xyz",
226672
- apiUrl: "https://testnet-explorer.plumenetwork.xyz/api"
226690
+ url: "https://testnet-explorer.plume.org",
226691
+ apiUrl: "https://testnet-explorer.plume.org/api"
226673
226692
  }
226674
226693
  },
226675
226694
  contracts: {
@@ -236718,21 +236737,21 @@ var require_BaseContract2 = __commonJS({
236718
236737
  return this.contractAddress;
236719
236738
  };
236720
236739
  this.encode = (functionToEncode, args) => {
236721
- const abi49 = this.contractAbi;
236740
+ const abi50 = this.contractAbi;
236722
236741
  const functionName = functionToEncode;
236723
236742
  const params = args;
236724
236743
  return (0, viem_1.encodeFunctionData)({
236725
- abi: abi49,
236744
+ abi: abi50,
236726
236745
  functionName,
236727
236746
  args: params
236728
236747
  });
236729
236748
  };
236730
236749
  this.estimateGas = async (functionToEstimate, args, options = {}) => {
236731
236750
  const contractOptions = this.convertOptions(options);
236732
- const abi49 = this.contractAbi;
236751
+ const abi50 = this.contractAbi;
236733
236752
  const params = args;
236734
236753
  return (0, actions_1.estimateContractGas)(this.runner, {
236735
- abi: abi49,
236754
+ abi: abi50,
236736
236755
  functionName: functionToEstimate,
236737
236756
  address: this.getAddress(),
236738
236757
  args: params,
@@ -291209,17 +291228,17 @@ var require_interface3 = __commonJS({
291209
291228
  * Create a new Interface for the %%fragments%%.
291210
291229
  */
291211
291230
  constructor(fragments) {
291212
- let abi49 = [];
291231
+ let abi50 = [];
291213
291232
  if (typeof fragments === "string") {
291214
- abi49 = JSON.parse(fragments);
291233
+ abi50 = JSON.parse(fragments);
291215
291234
  } else {
291216
- abi49 = fragments;
291235
+ abi50 = fragments;
291217
291236
  }
291218
291237
  this.#functions = /* @__PURE__ */ new Map();
291219
291238
  this.#errors = /* @__PURE__ */ new Map();
291220
291239
  this.#events = /* @__PURE__ */ new Map();
291221
291240
  const frags = [];
291222
- for (const a of abi49) {
291241
+ for (const a of abi50) {
291223
291242
  try {
291224
291243
  frags.push(fragments_js_1.Fragment.from(a));
291225
291244
  } catch (error) {
@@ -291283,16 +291302,16 @@ var require_interface3 = __commonJS({
291283
291302
  */
291284
291303
  format(minimal) {
291285
291304
  const format2 = minimal ? "minimal" : "full";
291286
- const abi49 = this.fragments.map((f) => f.format(format2));
291287
- return abi49;
291305
+ const abi50 = this.fragments.map((f) => f.format(format2));
291306
+ return abi50;
291288
291307
  }
291289
291308
  /**
291290
291309
  * Return the JSON-encoded ABI. This is the format Solidiy
291291
291310
  * returns.
291292
291311
  */
291293
291312
  formatJson() {
291294
- const abi49 = this.fragments.map((f) => f.format("json"));
291295
- return JSON.stringify(abi49.map((j) => JSON.parse(j)));
291313
+ const abi50 = this.fragments.map((f) => f.format("json"));
291314
+ return JSON.stringify(abi50.map((j) => JSON.parse(j)));
291296
291315
  }
291297
291316
  /**
291298
291317
  * The ABI coder that will be used to encode and decode binary
@@ -294060,12 +294079,12 @@ var require_contract5 = __commonJS({
294060
294079
  * optionally connected to a %%runner%% to perform operations on behalf
294061
294080
  * of.
294062
294081
  */
294063
- constructor(target, abi49, runner, _deployTx) {
294082
+ constructor(target, abi50, runner, _deployTx) {
294064
294083
  (0, index_js_3.assertArgument)(typeof target === "string" || (0, index_js_2.isAddressable)(target), "invalid value for Contract target", "target", target);
294065
294084
  if (runner == null) {
294066
294085
  runner = null;
294067
294086
  }
294068
- const iface = index_js_1.Interface.from(abi49);
294087
+ const iface = index_js_1.Interface.from(abi50);
294069
294088
  (0, index_js_3.defineProperties)(this, { target, runner, interface: iface });
294070
294089
  Object.defineProperty(this, internal, { value: {} });
294071
294090
  let addrPromise;
@@ -294428,10 +294447,10 @@ var require_contract5 = __commonJS({
294428
294447
  /**
294429
294448
  * Create a new Class for the %%abi%%.
294430
294449
  */
294431
- static buildClass(abi49) {
294450
+ static buildClass(abi50) {
294432
294451
  class CustomContract extends _BaseContract {
294433
294452
  constructor(address, runner = null) {
294434
- super(address, abi49, runner);
294453
+ super(address, abi50, runner);
294435
294454
  }
294436
294455
  }
294437
294456
  return CustomContract;
@@ -294439,11 +294458,11 @@ var require_contract5 = __commonJS({
294439
294458
  /**
294440
294459
  * Create a new BaseContract with a specified Interface.
294441
294460
  */
294442
- static from(target, abi49, runner) {
294461
+ static from(target, abi50, runner) {
294443
294462
  if (runner == null) {
294444
294463
  runner = null;
294445
294464
  }
294446
- const contract = new this(target, abi49, runner);
294465
+ const contract = new this(target, abi50, runner);
294447
294466
  return contract;
294448
294467
  }
294449
294468
  };
@@ -294487,8 +294506,8 @@ var require_factory2 = __commonJS({
294487
294506
  * The %%bytecode%% may be the ``bytecode`` property within the
294488
294507
  * standard Solidity JSON output.
294489
294508
  */
294490
- constructor(abi49, bytecode, runner) {
294491
- const iface = index_js_1.Interface.from(abi49);
294509
+ constructor(abi50, bytecode, runner) {
294510
+ const iface = index_js_1.Interface.from(abi50);
294492
294511
  if (bytecode instanceof Uint8Array) {
294493
294512
  bytecode = (0, index_js_3.hexlify)((0, index_js_3.getBytes)(bytecode));
294494
294513
  } else {
@@ -294558,14 +294577,14 @@ var require_factory2 = __commonJS({
294558
294577
  if (typeof output === "string") {
294559
294578
  output = JSON.parse(output);
294560
294579
  }
294561
- const abi49 = output.abi;
294580
+ const abi50 = output.abi;
294562
294581
  let bytecode = "";
294563
294582
  if (output.bytecode) {
294564
294583
  bytecode = output.bytecode;
294565
294584
  } else if (output.evm && output.evm.bytecode) {
294566
294585
  bytecode = output.evm.bytecode;
294567
294586
  }
294568
- return new this(abi49, bytecode, runner);
294587
+ return new this(abi50, bytecode, runner);
294569
294588
  }
294570
294589
  };
294571
294590
  exports2.ContractFactory = ContractFactory;
@@ -299515,8 +299534,8 @@ var require_provider_etherscan2 = __commonJS({
299515
299534
  action: "getabi",
299516
299535
  address
299517
299536
  });
299518
- const abi49 = JSON.parse(resp);
299519
- return new index_js_2.Contract(address, abi49, this);
299537
+ const abi50 = JSON.parse(resp);
299538
+ return new index_js_2.Contract(address, abi50, this);
299520
299539
  } catch (error) {
299521
299540
  return null;
299522
299541
  }
@@ -324339,13 +324358,13 @@ var require_interface4 = __commonJS({
324339
324358
  function Interface2(fragments) {
324340
324359
  var _newTarget = this.constructor;
324341
324360
  var _this = this;
324342
- var abi49 = [];
324361
+ var abi50 = [];
324343
324362
  if (typeof fragments === "string") {
324344
- abi49 = JSON.parse(fragments);
324363
+ abi50 = JSON.parse(fragments);
324345
324364
  } else {
324346
- abi49 = fragments;
324365
+ abi50 = fragments;
324347
324366
  }
324348
- (0, properties_1.defineReadOnly)(this, "fragments", abi49.map(function(fragment) {
324367
+ (0, properties_1.defineReadOnly)(this, "fragments", abi50.map(function(fragment) {
324349
324368
  return fragments_1.Fragment.from(fragment);
324350
324369
  }).filter(function(fragment) {
324351
324370
  return fragment != null;
@@ -324399,15 +324418,15 @@ var require_interface4 = __commonJS({
324399
324418
  if (format2 === fragments_1.FormatTypes.sighash) {
324400
324419
  logger2.throwArgumentError("interface does not support formatting sighash", "format", format2);
324401
324420
  }
324402
- var abi49 = this.fragments.map(function(fragment) {
324421
+ var abi50 = this.fragments.map(function(fragment) {
324403
324422
  return fragment.format(format2);
324404
324423
  });
324405
324424
  if (format2 === fragments_1.FormatTypes.json) {
324406
- return JSON.stringify(abi49.map(function(j) {
324425
+ return JSON.stringify(abi50.map(function(j) {
324407
324426
  return JSON.parse(j);
324408
324427
  }));
324409
324428
  }
324410
- return abi49;
324429
+ return abi50;
324411
324430
  };
324412
324431
  Interface2.getAbiCoder = function() {
324413
324432
  return abi_coder_1.defaultAbiCoder;
@@ -356172,10 +356191,10 @@ init_formatAbiItem2();
356172
356191
  init_getAbiItem();
356173
356192
  var docsPath = "/docs/contract/encodeEventTopics";
356174
356193
  function encodeEventTopics(parameters) {
356175
- const { abi: abi49, eventName, args } = parameters;
356176
- let abiItem = abi49[0];
356194
+ const { abi: abi50, eventName, args } = parameters;
356195
+ let abiItem = abi50[0];
356177
356196
  if (eventName) {
356178
- const item = getAbiItem({ abi: abi49, name: eventName });
356197
+ const item = getAbiItem({ abi: abi50, name: eventName });
356179
356198
  if (!item)
356180
356199
  throw new AbiEventNotFoundError(eventName, { docsPath });
356181
356200
  abiItem = item;
@@ -356222,12 +356241,12 @@ function createFilterRequestScope(client, { method }) {
356222
356241
 
356223
356242
  // ../../node_modules/viem/_esm/actions/public/createContractEventFilter.js
356224
356243
  async function createContractEventFilter(client, parameters) {
356225
- const { address, abi: abi49, args, eventName, fromBlock, strict, toBlock } = parameters;
356244
+ const { address, abi: abi50, args, eventName, fromBlock, strict, toBlock } = parameters;
356226
356245
  const getRequest = createFilterRequestScope(client, {
356227
356246
  method: "eth_newFilter"
356228
356247
  });
356229
356248
  const topics = eventName ? encodeEventTopics({
356230
- abi: abi49,
356249
+ abi: abi50,
356231
356250
  args,
356232
356251
  eventName
356233
356252
  }) : void 0;
@@ -356243,7 +356262,7 @@ async function createContractEventFilter(client, parameters) {
356243
356262
  ]
356244
356263
  });
356245
356264
  return {
356246
- abi: abi49,
356265
+ abi: abi50,
356247
356266
  args,
356248
356267
  eventName,
356249
356268
  id,
@@ -356264,7 +356283,7 @@ init_contract();
356264
356283
  init_request();
356265
356284
  init_rpc();
356266
356285
  var EXECUTION_REVERTED_ERROR_CODE = 3;
356267
- function getContractError(err, { abi: abi49, address, args, docsPath: docsPath8, functionName, sender }) {
356286
+ function getContractError(err, { abi: abi50, address, args, docsPath: docsPath8, functionName, sender }) {
356268
356287
  const error = err instanceof RawContractError ? err : err instanceof BaseError2 ? err.walk((err2) => "data" in err2) || err.walk() : {};
356269
356288
  const { code, data, details, message: message2, shortMessage } = error;
356270
356289
  const cause = (() => {
@@ -356272,7 +356291,7 @@ function getContractError(err, { abi: abi49, address, args, docsPath: docsPath8,
356272
356291
  return new ContractFunctionZeroDataError({ functionName });
356273
356292
  if ([EXECUTION_REVERTED_ERROR_CODE, InternalRpcError.code].includes(code) && (data || details || message2 || shortMessage)) {
356274
356293
  return new ContractFunctionRevertedError({
356275
- abi: abi49,
356294
+ abi: abi50,
356276
356295
  data: typeof data === "object" ? data.data : data,
356277
356296
  functionName,
356278
356297
  message: error instanceof RpcRequestError ? details : shortMessage ?? message2
@@ -356281,7 +356300,7 @@ function getContractError(err, { abi: abi49, address, args, docsPath: docsPath8,
356281
356300
  return err;
356282
356301
  })();
356283
356302
  return new ContractFunctionExecutionError(cause, {
356284
- abi: abi49,
356303
+ abi: abi50,
356285
356304
  args,
356286
356305
  contractAddress: address,
356287
356306
  docsPath: docsPath8,
@@ -357238,9 +357257,9 @@ async function estimateGas(client, args) {
357238
357257
 
357239
357258
  // ../../node_modules/viem/_esm/actions/public/estimateContractGas.js
357240
357259
  async function estimateContractGas(client, parameters) {
357241
- const { abi: abi49, address, args, functionName, dataSuffix, ...request } = parameters;
357260
+ const { abi: abi50, address, args, functionName, dataSuffix, ...request } = parameters;
357242
357261
  const data = encodeFunctionData({
357243
- abi: abi49,
357262
+ abi: abi50,
357244
357263
  args,
357245
357264
  functionName
357246
357265
  });
@@ -357254,7 +357273,7 @@ async function estimateContractGas(client, parameters) {
357254
357273
  } catch (error) {
357255
357274
  const account = request.account ? parseAccount(request.account) : void 0;
357256
357275
  throw getContractError(error, {
357257
- abi: abi49,
357276
+ abi: abi50,
357258
357277
  address,
357259
357278
  args,
357260
357279
  docsPath: "/docs/contract/estimateContractGas",
@@ -357283,15 +357302,15 @@ init_decodeAbiParameters();
357283
357302
  init_formatAbiItem2();
357284
357303
  var docsPath3 = "/docs/contract/decodeEventLog";
357285
357304
  function decodeEventLog(parameters) {
357286
- const { abi: abi49, data, strict: strict_, topics } = parameters;
357305
+ const { abi: abi50, data, strict: strict_, topics } = parameters;
357287
357306
  const strict = strict_ ?? true;
357288
357307
  const [signature, ...argTopics] = topics;
357289
357308
  if (!signature)
357290
357309
  throw new AbiEventSignatureEmptyTopicsError({ docsPath: docsPath3 });
357291
357310
  const abiItem = (() => {
357292
- if (abi49.length === 1)
357293
- return abi49[0];
357294
- return abi49.find((x) => x.type === "event" && signature === toEventSelector(formatAbiItem2(x)));
357311
+ if (abi50.length === 1)
357312
+ return abi50[0];
357313
+ return abi50.find((x) => x.type === "event" && signature === toEventSelector(formatAbiItem2(x)));
357295
357314
  })();
357296
357315
  if (!(abiItem && "name" in abiItem) || abiItem.type !== "event")
357297
357316
  throw new AbiEventSignatureNotFoundError(signature, { docsPath: docsPath3 });
@@ -357358,7 +357377,7 @@ function decodeTopic({ param, value }) {
357358
357377
 
357359
357378
  // ../../node_modules/viem/_esm/utils/abi/parseEventLogs.js
357360
357379
  function parseEventLogs(parameters) {
357361
- const { abi: abi49, args, logs, strict = true } = parameters;
357380
+ const { abi: abi50, args, logs, strict = true } = parameters;
357362
357381
  const eventName = (() => {
357363
357382
  if (!parameters.eventName)
357364
357383
  return void 0;
@@ -357368,7 +357387,7 @@ function parseEventLogs(parameters) {
357368
357387
  })();
357369
357388
  return logs.map((log2) => {
357370
357389
  try {
357371
- const abiItem = abi49.find((abiItem2) => abiItem2.type === "event" && log2.topics[0] === toEventSelector(abiItem2));
357390
+ const abiItem = abi50.find((abiItem2) => abiItem2.type === "event" && log2.topics[0] === toEventSelector(abiItem2));
357372
357391
  if (!abiItem)
357373
357392
  return null;
357374
357393
  const event = decodeEventLog({
@@ -357504,9 +357523,9 @@ async function getLogs(client, { address, blockHash, fromBlock, toBlock, event,
357504
357523
 
357505
357524
  // ../../node_modules/viem/_esm/actions/public/getContractEvents.js
357506
357525
  async function getContractEvents(client, parameters) {
357507
- const { abi: abi49, address, args, blockHash, eventName, fromBlock, toBlock, strict } = parameters;
357508
- const event = eventName ? getAbiItem({ abi: abi49, name: eventName }) : void 0;
357509
- const events = !event ? abi49.filter((x) => x.type === "event") : void 0;
357526
+ const { abi: abi50, address, args, blockHash, eventName, fromBlock, toBlock, strict } = parameters;
357527
+ const event = eventName ? getAbiItem({ abi: abi50, name: eventName }) : void 0;
357528
+ const events = !event ? abi50.filter((x) => x.type === "event") : void 0;
357510
357529
  return getAction(client, getLogs, "getLogs")({
357511
357530
  address,
357512
357531
  args,
@@ -357524,9 +357543,9 @@ init_decodeFunctionResult();
357524
357543
  init_encodeFunctionData();
357525
357544
  init_call();
357526
357545
  async function readContract(client, parameters) {
357527
- const { abi: abi49, address, args, functionName, ...rest } = parameters;
357546
+ const { abi: abi50, address, args, functionName, ...rest } = parameters;
357528
357547
  const calldata = encodeFunctionData({
357529
- abi: abi49,
357548
+ abi: abi50,
357530
357549
  args,
357531
357550
  functionName
357532
357551
  });
@@ -357537,14 +357556,14 @@ async function readContract(client, parameters) {
357537
357556
  to: address
357538
357557
  });
357539
357558
  return decodeFunctionResult({
357540
- abi: abi49,
357559
+ abi: abi50,
357541
357560
  args,
357542
357561
  functionName,
357543
357562
  data: data || "0x"
357544
357563
  });
357545
357564
  } catch (error) {
357546
357565
  throw getContractError(error, {
357547
- abi: abi49,
357566
+ abi: abi50,
357548
357567
  address,
357549
357568
  args,
357550
357569
  docsPath: "/docs/contract/readContract",
@@ -357559,9 +357578,9 @@ init_decodeFunctionResult();
357559
357578
  init_encodeFunctionData();
357560
357579
  init_call();
357561
357580
  async function simulateContract(client, parameters) {
357562
- const { abi: abi49, address, args, dataSuffix, functionName, ...callRequest } = parameters;
357581
+ const { abi: abi50, address, args, dataSuffix, functionName, ...callRequest } = parameters;
357563
357582
  const account = callRequest.account ? parseAccount(callRequest.account) : client.account;
357564
- const calldata = encodeFunctionData({ abi: abi49, args, functionName });
357583
+ const calldata = encodeFunctionData({ abi: abi50, args, functionName });
357565
357584
  try {
357566
357585
  const { data } = await getAction(client, call, "call")({
357567
357586
  batch: false,
@@ -357571,12 +357590,12 @@ async function simulateContract(client, parameters) {
357571
357590
  account
357572
357591
  });
357573
357592
  const result = decodeFunctionResult({
357574
- abi: abi49,
357593
+ abi: abi50,
357575
357594
  args,
357576
357595
  functionName,
357577
357596
  data: data || "0x"
357578
357597
  });
357579
- const minimizedAbi = abi49.filter((abiItem) => "name" in abiItem && abiItem.name === parameters.functionName);
357598
+ const minimizedAbi = abi50.filter((abiItem) => "name" in abiItem && abiItem.name === parameters.functionName);
357580
357599
  return {
357581
357600
  result,
357582
357601
  request: {
@@ -357591,7 +357610,7 @@ async function simulateContract(client, parameters) {
357591
357610
  };
357592
357611
  } catch (error) {
357593
357612
  throw getContractError(error, {
357594
- abi: abi49,
357613
+ abi: abi50,
357595
357614
  address,
357596
357615
  args,
357597
357616
  docsPath: "/docs/contract/simulateContract",
@@ -357759,7 +357778,7 @@ async function uninstallFilter(_client, { filter }) {
357759
357778
 
357760
357779
  // ../../node_modules/viem/_esm/actions/public/watchContractEvent.js
357761
357780
  function watchContractEvent(client, parameters) {
357762
- const { abi: abi49, address, args, batch = true, eventName, fromBlock, onError, onLogs, poll: poll_, pollingInterval = client.pollingInterval, strict: strict_ } = parameters;
357781
+ const { abi: abi50, address, args, batch = true, eventName, fromBlock, onError, onLogs, poll: poll_, pollingInterval = client.pollingInterval, strict: strict_ } = parameters;
357763
357782
  const enablePolling = (() => {
357764
357783
  if (typeof poll_ !== "undefined")
357765
357784
  return poll_;
@@ -357794,7 +357813,7 @@ function watchContractEvent(client, parameters) {
357794
357813
  if (!initialized) {
357795
357814
  try {
357796
357815
  filter = await getAction(client, createContractEventFilter, "createContractEventFilter")({
357797
- abi: abi49,
357816
+ abi: abi50,
357798
357817
  address,
357799
357818
  args,
357800
357819
  eventName,
@@ -357814,7 +357833,7 @@ function watchContractEvent(client, parameters) {
357814
357833
  const blockNumber = await getAction(client, getBlockNumber, "getBlockNumber")({});
357815
357834
  if (previousBlockNumber && previousBlockNumber < blockNumber) {
357816
357835
  logs = await getAction(client, getContractEvents, "getContractEvents")({
357817
- abi: abi49,
357836
+ abi: abi50,
357818
357837
  address,
357819
357838
  args,
357820
357839
  eventName,
@@ -357878,7 +357897,7 @@ function watchContractEvent(client, parameters) {
357878
357897
  return client.transport;
357879
357898
  })();
357880
357899
  const topics = eventName ? encodeEventTopics({
357881
- abi: abi49,
357900
+ abi: abi50,
357882
357901
  eventName,
357883
357902
  args
357884
357903
  }) : [];
@@ -357890,7 +357909,7 @@ function watchContractEvent(client, parameters) {
357890
357909
  const log2 = data.result;
357891
357910
  try {
357892
357911
  const { eventName: eventName2, args: args2 } = decodeEventLog({
357893
- abi: abi49,
357912
+ abi: abi50,
357894
357913
  data: log2.data,
357895
357914
  topics: log2.topics,
357896
357915
  strict: strict_
@@ -358145,14 +358164,14 @@ async function sendTransaction(client, parameters) {
358145
358164
 
358146
358165
  // ../../node_modules/viem/_esm/actions/wallet/writeContract.js
358147
358166
  async function writeContract(client, parameters) {
358148
- const { abi: abi49, account: account_ = client.account, address, args, dataSuffix, functionName, ...request } = parameters;
358167
+ const { abi: abi50, account: account_ = client.account, address, args, dataSuffix, functionName, ...request } = parameters;
358149
358168
  if (typeof account_ === "undefined")
358150
358169
  throw new AccountNotFoundError({
358151
358170
  docsPath: "/docs/contract/writeContract"
358152
358171
  });
358153
358172
  const account = account_ ? parseAccount(account_) : null;
358154
358173
  const data = encodeFunctionData({
358155
- abi: abi49,
358174
+ abi: abi50,
358156
358175
  args,
358157
358176
  functionName
358158
358177
  });
@@ -358165,7 +358184,7 @@ async function writeContract(client, parameters) {
358165
358184
  });
358166
358185
  } catch (error) {
358167
358186
  throw getContractError(error, {
358168
- abi: abi49,
358187
+ abi: abi50,
358169
358188
  address,
358170
358189
  args,
358171
358190
  docsPath: "/docs/contract/writeContract",
@@ -358176,7 +358195,7 @@ async function writeContract(client, parameters) {
358176
358195
  }
358177
358196
 
358178
358197
  // ../../node_modules/viem/_esm/actions/getContract.js
358179
- function getContract({ abi: abi49, address, client: client_ }) {
358198
+ function getContract({ abi: abi50, address, client: client_ }) {
358180
358199
  const client = client_;
358181
358200
  const [publicClient, walletClient] = (() => {
358182
358201
  if (!client)
@@ -358195,7 +358214,7 @@ function getContract({ abi: abi49, address, client: client_ }) {
358195
358214
  let hasReadFunction = false;
358196
358215
  let hasWriteFunction = false;
358197
358216
  let hasEvent = false;
358198
- for (const item of abi49) {
358217
+ for (const item of abi50) {
358199
358218
  if (item.type === "function")
358200
358219
  if (item.stateMutability === "view" || item.stateMutability === "pure")
358201
358220
  hasReadFunction = true;
@@ -358213,7 +358232,7 @@ function getContract({ abi: abi49, address, client: client_ }) {
358213
358232
  return (...parameters) => {
358214
358233
  const { args, options } = getFunctionParameters(parameters);
358215
358234
  return getAction(publicClient, readContract, "readContract")({
358216
- abi: abi49,
358235
+ abi: abi50,
358217
358236
  address,
358218
358237
  functionName,
358219
358238
  args,
@@ -358228,7 +358247,7 @@ function getContract({ abi: abi49, address, client: client_ }) {
358228
358247
  return (...parameters) => {
358229
358248
  const { args, options } = getFunctionParameters(parameters);
358230
358249
  return getAction(publicClient, simulateContract, "simulateContract")({
358231
- abi: abi49,
358250
+ abi: abi50,
358232
358251
  address,
358233
358252
  functionName,
358234
358253
  args,
@@ -358241,10 +358260,10 @@ function getContract({ abi: abi49, address, client: client_ }) {
358241
358260
  contract.createEventFilter = new Proxy({}, {
358242
358261
  get(_, eventName) {
358243
358262
  return (...parameters) => {
358244
- const abiEvent = abi49.find((x) => x.type === "event" && x.name === eventName);
358263
+ const abiEvent = abi50.find((x) => x.type === "event" && x.name === eventName);
358245
358264
  const { args, options } = getEventParameters(parameters, abiEvent);
358246
358265
  return getAction(publicClient, createContractEventFilter, "createContractEventFilter")({
358247
- abi: abi49,
358266
+ abi: abi50,
358248
358267
  address,
358249
358268
  eventName,
358250
358269
  args,
@@ -358256,10 +358275,10 @@ function getContract({ abi: abi49, address, client: client_ }) {
358256
358275
  contract.getEvents = new Proxy({}, {
358257
358276
  get(_, eventName) {
358258
358277
  return (...parameters) => {
358259
- const abiEvent = abi49.find((x) => x.type === "event" && x.name === eventName);
358278
+ const abiEvent = abi50.find((x) => x.type === "event" && x.name === eventName);
358260
358279
  const { args, options } = getEventParameters(parameters, abiEvent);
358261
358280
  return getAction(publicClient, getContractEvents, "getContractEvents")({
358262
- abi: abi49,
358281
+ abi: abi50,
358263
358282
  address,
358264
358283
  eventName,
358265
358284
  args,
@@ -358271,10 +358290,10 @@ function getContract({ abi: abi49, address, client: client_ }) {
358271
358290
  contract.watchEvent = new Proxy({}, {
358272
358291
  get(_, eventName) {
358273
358292
  return (...parameters) => {
358274
- const abiEvent = abi49.find((x) => x.type === "event" && x.name === eventName);
358293
+ const abiEvent = abi50.find((x) => x.type === "event" && x.name === eventName);
358275
358294
  const { args, options } = getEventParameters(parameters, abiEvent);
358276
358295
  return getAction(publicClient, watchContractEvent, "watchContractEvent")({
358277
- abi: abi49,
358296
+ abi: abi50,
358278
358297
  address,
358279
358298
  eventName,
358280
358299
  args,
@@ -358292,7 +358311,7 @@ function getContract({ abi: abi49, address, client: client_ }) {
358292
358311
  return (...parameters) => {
358293
358312
  const { args, options } = getFunctionParameters(parameters);
358294
358313
  return getAction(walletClient, writeContract, "writeContract")({
358295
- abi: abi49,
358314
+ abi: abi50,
358296
358315
  address,
358297
358316
  functionName,
358298
358317
  args,
@@ -358310,7 +358329,7 @@ function getContract({ abi: abi49, address, client: client_ }) {
358310
358329
  const { args, options } = getFunctionParameters(parameters);
358311
358330
  const client2 = publicClient ?? walletClient;
358312
358331
  return getAction(client2, estimateContractGas, "estimateContractGas")({
358313
- abi: abi49,
358332
+ abi: abi50,
358314
358333
  address,
358315
358334
  functionName,
358316
358335
  args,
@@ -358322,7 +358341,7 @@ function getContract({ abi: abi49, address, client: client_ }) {
358322
358341
  });
358323
358342
  }
358324
358343
  contract.address = address;
358325
- contract.abi = abi49;
358344
+ contract.abi = abi50;
358326
358345
  return contract;
358327
358346
  }
358328
358347
  function getFunctionParameters(values) {
@@ -360774,9 +360793,9 @@ async function multicall(client, parameters) {
360774
360793
  let currentChunk = 0;
360775
360794
  let currentChunkSize = 0;
360776
360795
  for (let i = 0; i < contracts2.length; i++) {
360777
- const { abi: abi49, address, args, functionName } = contracts2[i];
360796
+ const { abi: abi50, address, args, functionName } = contracts2[i];
360778
360797
  try {
360779
- const callData = encodeFunctionData({ abi: abi49, args, functionName });
360798
+ const callData = encodeFunctionData({ abi: abi50, args, functionName });
360780
360799
  currentChunkSize += (callData.length - 2) / 2;
360781
360800
  if (
360782
360801
  // Check if batching is enabled.
@@ -360798,7 +360817,7 @@ async function multicall(client, parameters) {
360798
360817
  ];
360799
360818
  } catch (err) {
360800
360819
  const error = getContractError(err, {
360801
- abi: abi49,
360820
+ abi: abi50,
360802
360821
  address,
360803
360822
  args,
360804
360823
  docsPath: "/docs/contract/multicall",
@@ -360844,14 +360863,14 @@ async function multicall(client, parameters) {
360844
360863
  for (let j = 0; j < aggregate3Result.length; j++) {
360845
360864
  const { returnData, success } = aggregate3Result[j];
360846
360865
  const { callData } = chunkedCalls[i][j];
360847
- const { abi: abi49, address, functionName, args } = contracts2[results.length];
360866
+ const { abi: abi50, address, functionName, args } = contracts2[results.length];
360848
360867
  try {
360849
360868
  if (callData === "0x")
360850
360869
  throw new AbiDecodingZeroDataError();
360851
360870
  if (!success)
360852
360871
  throw new RawContractError({ data: returnData });
360853
360872
  const result2 = decodeFunctionResult({
360854
- abi: abi49,
360873
+ abi: abi50,
360855
360874
  args,
360856
360875
  data: returnData,
360857
360876
  functionName
@@ -360859,7 +360878,7 @@ async function multicall(client, parameters) {
360859
360878
  results.push(allowFailure ? { result: result2, status: "success" } : result2);
360860
360879
  } catch (err) {
360861
360880
  const error = getContractError(err, {
360862
- abi: abi49,
360881
+ abi: abi50,
360863
360882
  address,
360864
360883
  args,
360865
360884
  docsPath: "/docs/contract/multicall",
@@ -361398,13 +361417,13 @@ async function simulateBlocks(client, parameters) {
361398
361417
  return result.map((block2, i) => ({
361399
361418
  ...formatBlock(block2),
361400
361419
  calls: block2.calls.map((call2, j) => {
361401
- const { abi: abi49, args, functionName, to } = blocks[i].calls[j];
361420
+ const { abi: abi50, args, functionName, to } = blocks[i].calls[j];
361402
361421
  const data = call2.error?.data ?? call2.returnData;
361403
361422
  const gasUsed = BigInt(call2.gasUsed);
361404
361423
  const logs = call2.logs?.map((log2) => formatLog(log2));
361405
361424
  const status = call2.status === "0x1" ? "success" : "failure";
361406
- const result2 = abi49 && status === "success" && data !== "0x" ? decodeFunctionResult({
361407
- abi: abi49,
361425
+ const result2 = abi50 && status === "success" && data !== "0x" ? decodeFunctionResult({
361426
+ abi: abi50,
361408
361427
  data,
361409
361428
  functionName
361410
361429
  }) : null;
@@ -361419,7 +361438,7 @@ async function simulateBlocks(client, parameters) {
361419
361438
  if (!error2)
361420
361439
  return void 0;
361421
361440
  return getContractError(error2, {
361422
- abi: abi49 ?? [],
361441
+ abi: abi50 ?? [],
361423
361442
  address: to,
361424
361443
  args,
361425
361444
  functionName: functionName ?? "<unknown>"
@@ -361967,10 +361986,10 @@ function from2(abiItem, options = {}) {
361967
361986
  ...prepare ? { hash: getSignatureHash(item) } : {}
361968
361987
  };
361969
361988
  }
361970
- function fromAbi(abi49, name, options) {
361989
+ function fromAbi(abi50, name, options) {
361971
361990
  const { args = [], prepare = true } = options ?? {};
361972
361991
  const isSelector = validate(name, { strict: false });
361973
- const abiItems = abi49.filter((abiItem2) => {
361992
+ const abiItems = abi50.filter((abiItem2) => {
361974
361993
  if (isSelector) {
361975
361994
  if (abiItem2.type === "function" || abiItem2.type === "error")
361976
361995
  return getSelector(abiItem2) === slice2(name, 0, 4);
@@ -362570,8 +362589,8 @@ function encodeData2(abiFunction, ...args) {
362570
362589
  function from4(abiFunction, options = {}) {
362571
362590
  return from2(abiFunction, options);
362572
362591
  }
362573
- function fromAbi2(abi49, name, options) {
362574
- const item = fromAbi(abi49, name, options);
362592
+ function fromAbi2(abi50, name, options) {
362593
+ const item = fromAbi(abi50, name, options);
362575
362594
  if (item.type !== "function")
362576
362595
  throw new NotFoundError({ name, type: "function" });
362577
362596
  return item;
@@ -363146,7 +363165,7 @@ function watchBlocks(client, { blockTag = "latest", emitMissed = false, emitOnBe
363146
363165
  blockTag,
363147
363166
  includeTransactions
363148
363167
  });
363149
- if (block.number && prevBlock?.number) {
363168
+ if (block.number !== null && prevBlock?.number != null) {
363150
363169
  if (block.number === prevBlock.number)
363151
363170
  return;
363152
363171
  if (block.number - prevBlock.number > 1 && emitMissed) {
@@ -363162,10 +363181,10 @@ function watchBlocks(client, { blockTag = "latest", emitMissed = false, emitOnBe
363162
363181
  }
363163
363182
  if (
363164
363183
  // If no previous block exists, emit.
363165
- !prevBlock?.number || // If the block tag is "pending" with no block number, emit.
363166
- blockTag === "pending" && !block?.number || // If the next block number is greater than the previous block number, emit.
363184
+ prevBlock?.number == null || // If the block tag is "pending" with no block number, emit.
363185
+ blockTag === "pending" && block?.number == null || // If the next block number is greater than the previous block number, emit.
363167
363186
  // We don't want to emit blocks in the past.
363168
- block.number && block.number > prevBlock.number
363187
+ block.number !== null && block.number > prevBlock.number
363169
363188
  ) {
363170
363189
  emit.onBlock(block, prevBlock);
363171
363190
  prevBlock = block;
@@ -364008,8 +364027,8 @@ async function addChain(client, { chain }) {
364008
364027
  // ../../node_modules/viem/_esm/actions/wallet/deployContract.js
364009
364028
  init_encodeDeployData();
364010
364029
  function deployContract(walletClient, parameters) {
364011
- const { abi: abi49, args, bytecode, ...request } = parameters;
364012
- const calldata = encodeDeployData({ abi: abi49, args, bytecode });
364030
+ const { abi: abi50, args, bytecode, ...request } = parameters;
364031
+ const calldata = encodeDeployData({ abi: abi50, args, bytecode });
364013
364032
  return sendTransaction(walletClient, {
364014
364033
  ...request,
364015
364034
  ...request.authorizationList ? { to: null } : {},
@@ -364038,8 +364057,14 @@ async function getCapabilities(client, parameters = {}) {
364038
364057
  params
364039
364058
  });
364040
364059
  const capabilities = {};
364041
- for (const [key, value] of Object.entries(capabilities_raw))
364042
- capabilities[Number(key)] = value;
364060
+ for (const [chainId2, capabilities_] of Object.entries(capabilities_raw)) {
364061
+ capabilities[Number(chainId2)] = {};
364062
+ for (let [key, value] of Object.entries(capabilities_)) {
364063
+ if (key === "addSubAccount")
364064
+ key = "unstable_addSubAccount";
364065
+ capabilities[Number(chainId2)][key] = value;
364066
+ }
364067
+ }
364043
364068
  return typeof chainId === "number" ? capabilities[chainId] : capabilities;
364044
364069
  }
364045
364070
 
@@ -364104,7 +364129,7 @@ init_parseAccount();
364104
364129
  init_encodeFunctionData();
364105
364130
  init_toHex();
364106
364131
  async function sendCalls(client, parameters) {
364107
- const { account: account_ = client.account, capabilities, chain = client.chain, forceAtomic = false, id, version: version4 = "2.0.0" } = parameters;
364132
+ const { account: account_ = client.account, chain = client.chain, forceAtomic = false, id, version: version4 = "2.0.0" } = parameters;
364108
364133
  if (typeof account_ === "undefined")
364109
364134
  throw new AccountNotFoundError({
364110
364135
  docsPath: "/docs/actions/wallet/sendCalls"
@@ -364130,7 +364155,7 @@ async function sendCalls(client, parameters) {
364130
364155
  {
364131
364156
  atomicRequired: forceAtomic,
364132
364157
  calls,
364133
- capabilities,
364158
+ capabilities: formatRequestCapabilities(parameters.capabilities),
364134
364159
  chainId: numberToHex(chain.id),
364135
364160
  from: account?.address,
364136
364161
  id,
@@ -364149,6 +364174,18 @@ async function sendCalls(client, parameters) {
364149
364174
  });
364150
364175
  }
364151
364176
  }
364177
+ function formatRequestCapabilities(capabilities) {
364178
+ const paymasterService = capabilities?.paymasterService ? Object.entries(capabilities.paymasterService).reduce((paymasterService2, [chainId, value]) => ({
364179
+ ...paymasterService2 ?? {},
364180
+ [numberToHex(Number(chainId))]: value
364181
+ }), {}) : void 0;
364182
+ return {
364183
+ ...capabilities,
364184
+ ...paymasterService ? {
364185
+ paymasterService
364186
+ } : {}
364187
+ };
364188
+ }
364152
364189
 
364153
364190
  // ../../node_modules/viem/_esm/actions/wallet/showCallsStatus.js
364154
364191
  async function showCallsStatus(client, parameters) {
@@ -376691,6 +376728,19 @@ var BLOCKS_PER_WEEK_BY_NETWORK = {
376691
376728
  WorldChain: BigInt(Math.floor(WEEK / BLOCK_DURATION_BY_NETWORK.WorldChain))
376692
376729
  };
376693
376730
 
376731
+ // ../../node_modules/@gearbox-protocol/sdk/dist/esm/sdk/constants/versions.js
376732
+ var VERSION_RANGE_300 = [300, 309];
376733
+ var VERSION_RANGE_310 = [310, 319];
376734
+ function isV300(version4) {
376735
+ return isVersionRange(version4, VERSION_RANGE_300);
376736
+ }
376737
+ function isV310(version4) {
376738
+ return isVersionRange(version4, VERSION_RANGE_310);
376739
+ }
376740
+ function isVersionRange(version4, range2) {
376741
+ return Number(version4) >= range2[0] && Number(version4) <= range2[1];
376742
+ }
376743
+
376694
376744
  // ../../node_modules/@gearbox-protocol/sdk/dist/esm/sdk/utils/AddressMap.js
376695
376745
  var AddressMap = class {
376696
376746
  #map;
@@ -376833,12 +376883,12 @@ var json_parse = (s) => {
376833
376883
  function createRawTx(to, parameters, description) {
376834
376884
  const { args } = parameters;
376835
376885
  const fname = parameters.functionName;
376836
- const { abi: abi49, functionName } = (() => {
376886
+ const { abi: abi50, functionName } = (() => {
376837
376887
  if (parameters.abi.length === 1 && parameters.functionName?.startsWith("0x"))
376838
376888
  return parameters;
376839
376889
  return prepareEncodeFunctionData(parameters);
376840
376890
  })();
376841
- const abiItem = abi49[0];
376891
+ const abiItem = abi50[0];
376842
376892
  const signature = functionName;
376843
376893
  const data = "inputs" in abiItem && abiItem.inputs ? encodeAbiParameters(abiItem.inputs, args ?? []) : void 0;
376844
376894
  const functionEncodedData = concatHex([signature, data ?? "0x"]);
@@ -378211,13 +378261,14 @@ var base64urlRegex = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_
378211
378261
  var dateRegexSource = `((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))`;
378212
378262
  var dateRegex = new RegExp(`^${dateRegexSource}$`);
378213
378263
  function timeRegexSource(args) {
378214
- let regex = `([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d`;
378264
+ let secondsRegexSource = `[0-5]\\d`;
378215
378265
  if (args.precision) {
378216
- regex = `${regex}\\.\\d{${args.precision}}`;
378266
+ secondsRegexSource = `${secondsRegexSource}\\.\\d{${args.precision}}`;
378217
378267
  } else if (args.precision == null) {
378218
- regex = `${regex}(\\.\\d+)?`;
378268
+ secondsRegexSource = `${secondsRegexSource}(\\.\\d+)?`;
378219
378269
  }
378220
- return regex;
378270
+ const secondsQuantifier = args.precision ? "+" : "?";
378271
+ return `([01]\\d|2[0-3]):[0-5]\\d(:${secondsRegexSource})${secondsQuantifier}`;
378221
378272
  }
378222
378273
  function timeRegex(args) {
378223
378274
  return new RegExp(`^${timeRegexSource(args)}$`);
@@ -397427,10 +397478,10 @@ function balancesAfterOpen(target, targetAmount, expected, leftover) {
397427
397478
 
397428
397479
  // ../../node_modules/@gearbox-protocol/sdk/dist/esm/sdk/router/createRouter.js
397429
397480
  function createRouter(sdk, address, version4) {
397430
- if (version4 >= 300 && version4 < 310) {
397481
+ if (isV300(version4)) {
397431
397482
  return new RouterV300Contract(sdk, address, version4);
397432
397483
  }
397433
- if (version4 === 310) {
397484
+ if (isV310(version4)) {
397434
397485
  return new RouterV310Contract(sdk, address, version4);
397435
397486
  }
397436
397487
  throw new Error(`Unsupported router version ${version4}`);
@@ -397562,9 +397613,9 @@ async function simulateMulticall(client, parameters) {
397562
397613
  }
397563
397614
  const calls = [];
397564
397615
  for (const contract of contracts2) {
397565
- const { abi: abi49, address, args, functionName } = contract;
397616
+ const { abi: abi50, address, args, functionName } = contract;
397566
397617
  try {
397567
- const callData = encodeFunctionData({ abi: abi49, args, functionName });
397618
+ const callData = encodeFunctionData({ abi: abi50, args, functionName });
397568
397619
  calls.push({
397569
397620
  allowFailure: true,
397570
397621
  callData,
@@ -397572,7 +397623,7 @@ async function simulateMulticall(client, parameters) {
397572
397623
  });
397573
397624
  } catch (err) {
397574
397625
  const error = getContractError(err, {
397575
- abi: abi49,
397626
+ abi: abi50,
397576
397627
  address,
397577
397628
  args,
397578
397629
  docsPath: "/docs/contract/multicall",
@@ -397632,12 +397683,12 @@ async function simulateMulticall(client, parameters) {
397632
397683
  for (let j = 0; j < result.length; j++) {
397633
397684
  const { returnData, success } = result[j];
397634
397685
  const { callData } = calls[j];
397635
- const { abi: abi49, address, functionName, args } = contracts2[results.length];
397686
+ const { abi: abi50, address, functionName, args } = contracts2[results.length];
397636
397687
  try {
397637
397688
  if (callData === "0x") throw new AbiDecodingZeroDataError();
397638
397689
  if (!success) throw new RawContractError({ data: returnData });
397639
397690
  const result2 = decodeFunctionResult({
397640
- abi: abi49,
397691
+ abi: abi50,
397641
397692
  args,
397642
397693
  data: returnData,
397643
397694
  functionName
@@ -397645,7 +397696,7 @@ async function simulateMulticall(client, parameters) {
397645
397696
  results.push(allowFailure ? { result: result2, status: "success" } : result2);
397646
397697
  } catch (err) {
397647
397698
  const error = getContractError(err, {
397648
- abi: abi49,
397699
+ abi: abi50,
397649
397700
  address,
397650
397701
  args,
397651
397702
  docsPath: "/docs/contract/multicall",
@@ -397872,8 +397923,9 @@ var CreditAccountsService = class extends SDKConstruct {
397872
397923
  #logger;
397873
397924
  constructor(sdk, options) {
397874
397925
  super(sdk);
397875
- [this.#compressor] = sdk.addressProvider.getLatestVersion(
397876
- AP_CREDIT_ACCOUNT_COMPRESSOR
397926
+ [this.#compressor] = sdk.addressProvider.mustGetLatest(
397927
+ AP_CREDIT_ACCOUNT_COMPRESSOR,
397928
+ VERSION_RANGE_310
397877
397929
  );
397878
397930
  this.#batchSize = options?.batchSize;
397879
397931
  this.#logger = childLogger("CreditAccountsService", sdk.logger);
@@ -399009,11 +399061,15 @@ var CreditAccountsService = class extends SDKConstruct {
399009
399061
  return this.sdk.marketRegister.marketConfigurators.map((mc) => mc.address);
399010
399062
  }
399011
399063
  get rewardCompressor() {
399012
- return this.sdk.addressProvider.getLatestVersion(AP_REWARDS_COMPRESSOR)[0];
399064
+ return this.sdk.addressProvider.mustGetLatest(
399065
+ AP_REWARDS_COMPRESSOR,
399066
+ VERSION_RANGE_310
399067
+ )[0];
399013
399068
  }
399014
399069
  get peripheryCompressor() {
399015
- return this.sdk.addressProvider.getLatestVersion(
399016
- AP_PERIPHERY_COMPRESSOR
399070
+ return this.sdk.addressProvider.mustGetLatest(
399071
+ AP_PERIPHERY_COMPRESSOR,
399072
+ VERSION_RANGE_310
399017
399073
  )[0];
399018
399074
  }
399019
399075
  };
@@ -399021,7 +399077,6 @@ var CreditAccountsService = class extends SDKConstruct {
399021
399077
  // ../../node_modules/@gearbox-protocol/sdk/dist/esm/sdk/core/address-provider/AbstractAddressProviderContract.js
399022
399078
  var AbstractAddressProviderContract = class extends BaseContract {
399023
399079
  #addresses = {};
399024
- #latest = {};
399025
399080
  constructor(sdk, args, addresses = {}) {
399026
399081
  super(sdk, args);
399027
399082
  this.#addresses = addresses;
@@ -399032,9 +399087,6 @@ var AbstractAddressProviderContract = class extends BaseContract {
399032
399087
  this.#addresses[k] = {};
399033
399088
  }
399034
399089
  this.#addresses[k][version4] = address;
399035
- if (!this.#latest[k] || version4 > this.#latest[k]) {
399036
- this.#latest[k] = version4;
399037
- }
399038
399090
  this.logger?.debug(`Set address for ${k}@${version4} to ${address}`);
399039
399091
  }
399040
399092
  getAddress(contract, version4 = NO_VERSION) {
@@ -399047,14 +399099,7 @@ var AbstractAddressProviderContract = class extends BaseContract {
399047
399099
  }
399048
399100
  return result;
399049
399101
  }
399050
- getLatestVersion(contract) {
399051
- const version4 = this.#latest[contract];
399052
- if (!version4) {
399053
- throw new Error(`Latest version for ${contract} not found`);
399054
- }
399055
- return [this.getAddress(contract, version4), version4];
399056
- }
399057
- getLatestInRange(contract, range2) {
399102
+ getLatest(contract, range2) {
399058
399103
  const allVersions = this.#addresses[contract];
399059
399104
  if (!allVersions) {
399060
399105
  return void 0;
@@ -399073,6 +399118,13 @@ var AbstractAddressProviderContract = class extends BaseContract {
399073
399118
  }
399074
399119
  return [address, version4];
399075
399120
  }
399121
+ mustGetLatest(contract, range2) {
399122
+ const result = this.getLatest(contract, range2);
399123
+ if (!result) {
399124
+ throw new Error(`no address found for ${contract} in range ${range2}`);
399125
+ }
399126
+ return result;
399127
+ }
399076
399128
  get state() {
399077
399129
  return {
399078
399130
  baseParams: {
@@ -399111,17 +399163,17 @@ var AbstractAddressProviderContract = class extends BaseContract {
399111
399163
  }
399112
399164
  };
399113
399165
 
399114
- // ../../node_modules/@gearbox-protocol/sdk/dist/esm/sdk/core/address-provider/AddressProviderV3_1Contract.js
399115
- var abi4 = iAddressProviderV310Abi;
399116
- var AddressProviderContractV3_1 = class extends AbstractAddressProviderContract {
399117
- constructor(sdk, address, addresses = {}) {
399166
+ // ../../node_modules/@gearbox-protocol/sdk/dist/esm/sdk/core/address-provider/AddressProviderV300Contract.js
399167
+ var abi4 = iAddressProviderV300Abi;
399168
+ var AddressProviderV300Contract = class extends AbstractAddressProviderContract {
399169
+ constructor(sdk, address, version4, addresses = {}) {
399118
399170
  super(
399119
399171
  sdk,
399120
399172
  {
399121
399173
  addr: address,
399122
- name: "AddressProviderV3_1",
399174
+ name: "AddressProviderV300",
399123
399175
  abi: abi4,
399124
- version: 310
399176
+ version: version4
399125
399177
  },
399126
399178
  addresses
399127
399179
  );
@@ -399148,8 +399200,12 @@ var AddressProviderContractV3_1 = class extends AbstractAddressProviderContract
399148
399200
  eventName: "SetAddress",
399149
399201
  logs: [log2]
399150
399202
  })[0];
399151
- const { key, ver, value } = args;
399152
- this.setInternalAddress(key, value, Number(ver));
399203
+ const { key, version: version4 } = args;
399204
+ this.setInternalAddress(
399205
+ key,
399206
+ log2.args.value,
399207
+ Number(version4)
399208
+ );
399153
399209
  break;
399154
399210
  }
399155
399211
  default:
@@ -399158,29 +399214,38 @@ var AddressProviderContractV3_1 = class extends AbstractAddressProviderContract
399158
399214
  }
399159
399215
  }
399160
399216
  async syncState(blockNumber) {
399161
- const entries = await this.contract.read.getAllEntries({
399162
- blockNumber
399163
- });
399217
+ const fromBlock = ADDRESS_PROVIDER_BLOCK[this.sdk.provider.networkType];
399164
399218
  this.logger?.debug(
399165
- `loaded ${entries.length} events in block ${blockNumber}`
399219
+ `loading events from block ${fromBlock} to ${blockNumber}`
399166
399220
  );
399167
- for (const { key, ver, value } of entries) {
399168
- this.setInternalAddress(key, value, Number(ver));
399221
+ const events = await getLogsSafe(this.sdk.provider.publicClient, {
399222
+ address: this.address,
399223
+ event: getAbiItem({ abi: this.abi, name: "SetAddress" }),
399224
+ fromBlock,
399225
+ toBlock: blockNumber,
399226
+ strict: true
399227
+ });
399228
+ for (const event of events) {
399229
+ this.setInternalAddress(
399230
+ event.args.key,
399231
+ event.args.value,
399232
+ Number(event.args.version)
399233
+ );
399169
399234
  }
399170
399235
  }
399171
399236
  };
399172
399237
 
399173
- // ../../node_modules/@gearbox-protocol/sdk/dist/esm/sdk/core/address-provider/AddressProviderV3Contract.js
399174
- var abi5 = iAddressProviderV300Abi;
399175
- var AddressProviderContractV3 = class extends AbstractAddressProviderContract {
399176
- constructor(sdk, address, addresses = {}) {
399238
+ // ../../node_modules/@gearbox-protocol/sdk/dist/esm/sdk/core/address-provider/AddressProviderV310Contract.js
399239
+ var abi5 = iAddressProviderV310Abi;
399240
+ var AddressProviderV310Contract = class extends AbstractAddressProviderContract {
399241
+ constructor(sdk, address, version4, addresses = {}) {
399177
399242
  super(
399178
399243
  sdk,
399179
399244
  {
399180
399245
  addr: address,
399181
- name: "AddressProviderV3",
399246
+ name: "AddressProviderV310",
399182
399247
  abi: abi5,
399183
- version: 300
399248
+ version: version4
399184
399249
  },
399185
399250
  addresses
399186
399251
  );
@@ -399207,12 +399272,8 @@ var AddressProviderContractV3 = class extends AbstractAddressProviderContract {
399207
399272
  eventName: "SetAddress",
399208
399273
  logs: [log2]
399209
399274
  })[0];
399210
- const { key, version: version4 } = args;
399211
- this.setInternalAddress(
399212
- key,
399213
- log2.args.value,
399214
- Number(version4)
399215
- );
399275
+ const { key, ver, value } = args;
399276
+ this.setInternalAddress(key, value, Number(ver));
399216
399277
  break;
399217
399278
  }
399218
399279
  default:
@@ -399221,55 +399282,39 @@ var AddressProviderContractV3 = class extends AbstractAddressProviderContract {
399221
399282
  }
399222
399283
  }
399223
399284
  async syncState(blockNumber) {
399224
- const fromBlock = ADDRESS_PROVIDER_BLOCK[this.sdk.provider.networkType];
399285
+ const entries = await this.contract.read.getAllEntries({
399286
+ blockNumber
399287
+ });
399225
399288
  this.logger?.debug(
399226
- `loading events from block ${fromBlock} to ${blockNumber}`
399289
+ `loaded ${entries.length} events in block ${blockNumber}`
399227
399290
  );
399228
- const events = await getLogsSafe(this.sdk.provider.publicClient, {
399229
- address: this.address,
399230
- event: getAbiItem({ abi: this.abi, name: "SetAddress" }),
399231
- fromBlock,
399232
- toBlock: blockNumber,
399233
- strict: true
399234
- });
399235
- for (const event of events) {
399236
- this.setInternalAddress(
399237
- event.args.key,
399238
- event.args.value,
399239
- Number(event.args.version)
399240
- );
399291
+ for (const { key, ver, value } of entries) {
399292
+ this.setInternalAddress(key, value, Number(ver));
399241
399293
  }
399242
399294
  }
399243
399295
  };
399244
399296
 
399245
399297
  // ../../node_modules/@gearbox-protocol/sdk/dist/esm/sdk/core/address-provider/createAddressProvider.js
399246
- async function createAddressProvider(sdk, address, options) {
399247
- const addr = options?.state?.baseParams.addr ?? address;
399248
- let v = options?.state?.baseParams.version ?? options?.version;
399249
- if (!v) {
399250
- const vv = await sdk.provider.publicClient.readContract({
399251
- address: addr,
399252
- abi: iVersionAbi,
399253
- functionName: "version"
399254
- });
399255
- v = Number(vv);
399256
- }
399257
- switch (v) {
399258
- case 300:
399259
- return new AddressProviderContractV3(
399260
- sdk,
399261
- addr,
399262
- options?.state?.addresses
399263
- );
399264
- case 310:
399265
- return new AddressProviderContractV3_1(
399266
- sdk,
399267
- addr,
399268
- options?.state?.addresses
399269
- );
399270
- default:
399271
- throw new Error(`Unsupported address provider version: ${v}`);
399298
+ async function createAddressProvider(sdk, address) {
399299
+ const v = await sdk.provider.publicClient.readContract({
399300
+ address,
399301
+ abi: iVersionAbi,
399302
+ functionName: "version"
399303
+ });
399304
+ return newAddressProvider(sdk, address, Number(v));
399305
+ }
399306
+ function hydrateAddressProvider(sdk, state) {
399307
+ const { addr, version: version4 } = state.baseParams;
399308
+ return newAddressProvider(sdk, addr, Number(version4), state.addresses);
399309
+ }
399310
+ function newAddressProvider(sdk, address, version4, addresses) {
399311
+ if (isV300(version4)) {
399312
+ return new AddressProviderV300Contract(sdk, address, version4, addresses);
399313
+ }
399314
+ if (isV310(version4)) {
399315
+ return new AddressProviderV310Contract(sdk, address, version4, addresses);
399272
399316
  }
399317
+ throw new Error(`unsupported address provider version: ${version4}`);
399273
399318
  }
399274
399319
 
399275
399320
  // ../../node_modules/@gearbox-protocol/sdk/dist/esm/sdk/core/BotListV3Contract.js
@@ -400062,9 +400107,9 @@ var CreditManagerV310Contract = class extends BaseContract {
400062
400107
  // ../../node_modules/@gearbox-protocol/sdk/dist/esm/sdk/market/credit/createCreditConfigurator.js
400063
400108
  function createCreditConfigurator(sdk, data) {
400064
400109
  const v = data.creditConfigurator.baseParams.version;
400065
- if (v >= 300 && v < 310) {
400110
+ if (isV300(v)) {
400066
400111
  return new CreditConfiguratorV300Contract(sdk, data);
400067
- } else if (v === 310n) {
400112
+ } else if (isV310(v)) {
400068
400113
  return new CreditConfiguratorV310Contract(sdk, data);
400069
400114
  }
400070
400115
  throw new Error(`Unsupported credit configurator version: ${v}`);
@@ -400073,9 +400118,9 @@ function createCreditConfigurator(sdk, data) {
400073
400118
  // ../../node_modules/@gearbox-protocol/sdk/dist/esm/sdk/market/credit/createCreditFacade.js
400074
400119
  function createCreditFacade(sdk, data) {
400075
400120
  const v = data.creditFacade.baseParams.version;
400076
- if (v >= 300 && v < 310) {
400121
+ if (isV300(v)) {
400077
400122
  return new CreditFacadeV300Contract(sdk, data);
400078
- } else if (v === 310n) {
400123
+ } else if (isV310(v)) {
400079
400124
  return new CreditFacadeV310Contract(sdk, data);
400080
400125
  }
400081
400126
  throw new Error(`Unsupported credit facade version: ${v}`);
@@ -400084,9 +400129,9 @@ function createCreditFacade(sdk, data) {
400084
400129
  // ../../node_modules/@gearbox-protocol/sdk/dist/esm/sdk/market/credit/createCreditManager.js
400085
400130
  function createCreditManager(sdk, data) {
400086
400131
  const v = data.creditManager.baseParams.version;
400087
- if (v >= 300 && v < 310) {
400132
+ if (isV300(v)) {
400088
400133
  return new CreditManagerV300Contract(sdk, data);
400089
- } else if (v === 310n) {
400134
+ } else if (isV310(v)) {
400090
400135
  return new CreditManagerV310Contract(sdk, data);
400091
400136
  }
400092
400137
  throw new Error(`Unsupported credit manager version: ${v}`);
@@ -400116,11 +400161,6 @@ var CreditSuite = class extends SDKConstruct {
400116
400161
  get router() {
400117
400162
  return this.sdk.routerFor(this);
400118
400163
  }
400119
- async tvl() {
400120
- const tvl = 0n;
400121
- const tvlUSD = 0n;
400122
- return { tvl, tvlUSD };
400123
- }
400124
400164
  get dirty() {
400125
400165
  return this.creditFacade.dirty || this.creditManager.dirty || this.creditConfigurator.dirty;
400126
400166
  }
@@ -405645,9 +405685,9 @@ var PriceFeedRegister = class extends SDKConstruct {
405645
405685
  * This is not saved anywhere in PriceFeedRegister, and can later be used to load price feed updates
405646
405686
  */
405647
405687
  async getPartialUpdatablePriceFeeds(marketConfigurators, pools) {
405648
- const priceFeedCompressorAddress = this.sdk.addressProvider.getAddress(
405688
+ const [priceFeedCompressorAddress] = this.sdk.addressProvider.mustGetLatest(
405649
405689
  AP_PRICE_FEED_COMPRESSOR,
405650
- 310
405690
+ VERSION_RANGE_310
405651
405691
  );
405652
405692
  const configurators = marketConfigurators ?? this.sdk.marketRegister.marketConfigurators.map((mc) => mc.address);
405653
405693
  this.logger?.debug(
@@ -405957,8 +405997,9 @@ var PriceOracleBaseContract = class extends BaseContract {
405957
405997
  )
405958
405998
  );
405959
405999
  }
405960
- const [address] = this.sdk.addressProvider.getLatestVersion(
405961
- AP_PRICE_FEED_COMPRESSOR
406000
+ const [address] = this.sdk.addressProvider.mustGetLatest(
406001
+ AP_PRICE_FEED_COMPRESSOR,
406002
+ VERSION_RANGE_310
405962
406003
  );
405963
406004
  return {
405964
406005
  call: {
@@ -406183,10 +406224,10 @@ var PriceOracleV310Contract = class extends PriceOracleBaseContract {
406183
406224
  // ../../node_modules/@gearbox-protocol/sdk/dist/esm/sdk/market/oracle/createPriceOracle.js
406184
406225
  function createPriceOracle(sdk, data, underlying) {
406185
406226
  const v = data.baseParams.version;
406186
- if (v >= 300n && v < 310n) {
406227
+ if (isV300(v)) {
406187
406228
  return new PriceOracleV300Contract(sdk, data, underlying);
406188
406229
  }
406189
- if (v === 310n) {
406230
+ if (isV310(v)) {
406190
406231
  return new PriceOracleV310Contract(sdk, data, underlying);
406191
406232
  }
406192
406233
  throw new Error(`Unsupported oracle version ${v}`);
@@ -406625,10 +406666,10 @@ var PoolV310Contract = class extends BaseContract {
406625
406666
  // ../../node_modules/@gearbox-protocol/sdk/dist/esm/sdk/market/pool/createPool.js
406626
406667
  function createPool(sdk, data) {
406627
406668
  const v = data.baseParams.version;
406628
- if (v >= 300n && v < 310n) {
406669
+ if (isV300(v)) {
406629
406670
  return new PoolV300Contract(sdk, data);
406630
406671
  }
406631
- if (v === 310n) {
406672
+ if (isV310(v)) {
406632
406673
  return new PoolV310Contract(sdk, data);
406633
406674
  }
406634
406675
  throw new Error(`Unsupported pool version ${v}`);
@@ -406694,10 +406735,10 @@ var PoolQuotaKeeperV310Contract = class extends BaseContract {
406694
406735
  // ../../node_modules/@gearbox-protocol/sdk/dist/esm/sdk/market/pool/createPoolQuotaKeeper.js
406695
406736
  function createPoolQuotaKeeper(sdk, pool, pqk) {
406696
406737
  const v = pqk.baseParams.version;
406697
- if (v >= 300n && v < 310n) {
406738
+ if (isV300(v)) {
406698
406739
  return new PoolQuotaKeeperV300Contract(sdk, pool, pqk);
406699
406740
  }
406700
- if (v === 310n) {
406741
+ if (isV310(v)) {
406701
406742
  return new PoolQuotaKeeperV310Contract(sdk, pool, pqk);
406702
406743
  }
406703
406744
  throw new Error(`Unsupported pool quota keeper version ${v}`);
@@ -406903,10 +406944,13 @@ var MarketRegister = class extends SDKConstruct {
406903
406944
  */
406904
406945
  #markets = new AddressMap(void 0, "markets");
406905
406946
  #marketFilter;
406906
- constructor(sdk, markets) {
406947
+ constructor(sdk) {
406907
406948
  super(sdk);
406908
406949
  this.#logger = childLogger("MarketRegister", sdk.logger);
406909
- for (const data of markets ?? []) {
406950
+ }
406951
+ hydrate(state) {
406952
+ this.#markets.clear();
406953
+ for (const data of state) {
406910
406954
  this.#markets.upsert(
406911
406955
  data.pool.baseParams.addr,
406912
406956
  new MarketSuite(this.sdk, data)
@@ -406951,9 +406995,9 @@ var MarketRegister = class extends SDKConstruct {
406951
406995
  pools,
406952
406996
  underlying: ADDRESS_0X0
406953
406997
  };
406954
- const marketCompressorAddress = this.sdk.addressProvider.getAddress(
406998
+ const [marketCompressorAddress] = this.sdk.addressProvider.mustGetLatest(
406955
406999
  AP_MARKET_COMPRESSOR,
406956
- 310
407000
+ VERSION_RANGE_310
406957
407001
  );
406958
407002
  let txs = [];
406959
407003
  if (!ignoreUpdateablePrices) {
@@ -407099,27 +407143,23 @@ var MarketRegister = class extends SDKConstruct {
407099
407143
  get markets() {
407100
407144
  return this.#markets.values();
407101
407145
  }
407102
- async tvl() {
407103
- const creditManagers = this.creditManagers;
407104
- const tvls = await Promise.all(creditManagers.map((cm) => cm.tvl()));
407105
- return tvls.reduce(
407106
- (acc, curr) => {
407107
- acc.tvl += curr.tvl;
407108
- acc.tvlUSD += curr.tvlUSD;
407109
- return acc;
407110
- },
407111
- { tvl: 0n, tvlUSD: 0n }
407146
+ };
407147
+
407148
+ // ../../node_modules/@gearbox-protocol/sdk/dist/esm/sdk/plugins/errors.js
407149
+ var PluginStateVersionError = class extends Error {
407150
+ constructor(plugin, state) {
407151
+ super(
407152
+ `plugin ${plugin.constructor.name} state version mismatch: expected ${plugin.version}, got ${state.version}`
407112
407153
  );
407113
407154
  }
407114
407155
  };
407115
407156
 
407116
- // ../../node_modules/@gearbox-protocol/sdk/dist/esm/sdk/plugins/defaultPlugins.js
407117
- var defaultPlugins = {};
407118
-
407119
407157
  // ../../node_modules/@gearbox-protocol/sdk/dist/esm/sdk/plugins/V300StalenessPeriodPlugin.js
407120
407158
  var V300StalenessPeriodPlugin = class extends SDKConstruct {
407121
407159
  #syncedTo;
407122
407160
  #logger;
407161
+ #events = [];
407162
+ version = 1;
407123
407163
  constructor(sdk) {
407124
407164
  super(sdk);
407125
407165
  this.#syncedTo = ADDRESS_PROVIDER_BLOCK[sdk.provider.networkType] - 1n;
@@ -407132,15 +407172,13 @@ var V300StalenessPeriodPlugin = class extends SDKConstruct {
407132
407172
  await this.#syncReservePriceFeeds();
407133
407173
  }
407134
407174
  async #syncReservePriceFeeds() {
407135
- const markets = this.sdk.marketRegister.markets;
407136
- const oracles = markets.filter((m) => m.priceOracle.version === 300).map((m) => m.priceOracle);
407137
- const addresses = Array.from(new Set(oracles.map((o) => o.address)));
407175
+ const oracles = this.#getOraclesMap();
407138
407176
  const [fromBlock, toBlock] = [this.#syncedTo + 1n, this.sdk.currentBlock];
407139
- if (addresses.length === 0 || fromBlock > toBlock) {
407177
+ if (oracles.size === 0 || fromBlock > toBlock) {
407140
407178
  return;
407141
407179
  }
407142
407180
  const events = await getLogsSafe(this.client, {
407143
- address: addresses,
407181
+ address: oracles.keys(),
407144
407182
  events: [
407145
407183
  getAbiItem({
407146
407184
  abi: iPriceOracleV300Abi,
@@ -407159,30 +407197,64 @@ var V300StalenessPeriodPlugin = class extends SDKConstruct {
407159
407197
  `loaded ${events.length} SetReservePriceFeed events in range [${fromBlock}; ${toBlock}]`
407160
407198
  );
407161
407199
  for (const e of events) {
407162
- const oracle = getAddress(e.address);
407200
+ const oracle = oracles.mustGet(e.address);
407163
407201
  const priceFeed = getAddress(e.args.priceFeed);
407164
407202
  const token = getAddress(e.args.token);
407165
407203
  const stalenessPeriod = e.args.stalenessPeriod;
407166
- for (const o of oracles) {
407167
- const map = e.eventName === "SetReservePriceFeed" ? o.reservePriceFeeds : o.mainPriceFeeds;
407168
- const pf = map.get(token);
407169
- if (hexEq(pf?.address, priceFeed) && hexEq(o.address, oracle)) {
407170
- map.upsert(
407171
- token,
407172
- new PriceFeedRef(this.sdk, priceFeed, stalenessPeriod)
407173
- );
407174
- this.#logger?.info(
407175
- `updated staleness period for ${this.labelAddress(token)}/${this.labelAddress(priceFeed)} in oracle ${this.labelAddress(oracle)} to ${formatDuration2(stalenessPeriod)}`
407176
- );
407177
- }
407204
+ const reserve = e.eventName === "SetReservePriceFeed";
407205
+ const map = reserve ? oracle.reservePriceFeeds : oracle.mainPriceFeeds;
407206
+ const pf = map.get(token);
407207
+ if (hexEq(pf?.address, priceFeed)) {
407208
+ map.upsert(
407209
+ token,
407210
+ new PriceFeedRef(this.sdk, priceFeed, stalenessPeriod)
407211
+ );
407212
+ this.#events.push({
407213
+ oracle: oracle.address,
407214
+ priceFeed,
407215
+ token,
407216
+ stalenessPeriod,
407217
+ reserve
407218
+ });
407219
+ this.#logger?.info(
407220
+ `updated staleness period for ${this.labelAddress(token)}/${this.labelAddress(priceFeed)} in oracle ${oracle.name} to ${formatDuration2(stalenessPeriod)}`
407221
+ );
407178
407222
  }
407179
407223
  }
407180
407224
  this.#syncedTo = toBlock;
407181
407225
  }
407226
+ get state() {
407227
+ return {
407228
+ version: this.version,
407229
+ events: this.#events
407230
+ };
407231
+ }
407232
+ hydrate(state) {
407233
+ this.#events = state.events;
407234
+ const oracles = this.#getOraclesMap();
407235
+ for (const e of this.#events) {
407236
+ const oracle = oracles.mustGet(e.oracle);
407237
+ const map = e.reserve ? oracle.reservePriceFeeds : oracle.mainPriceFeeds;
407238
+ map.upsert(
407239
+ e.token,
407240
+ new PriceFeedRef(this.sdk, e.priceFeed, e.stalenessPeriod)
407241
+ );
407242
+ this.#logger?.info(
407243
+ `hydrated staleness period for ${this.labelAddress(e.token)}/${this.labelAddress(e.priceFeed)} in oracle ${oracle.name} to ${formatDuration2(e.stalenessPeriod)}`
407244
+ );
407245
+ }
407246
+ this.#syncedTo = this.sdk.currentBlock;
407247
+ }
407248
+ #getOraclesMap() {
407249
+ return new AddressMap(
407250
+ this.sdk.marketRegister.markets.filter((m) => m.priceOracle.version === 300).map((m) => [m.priceOracle.address, m.priceOracle])
407251
+ );
407252
+ }
407182
407253
  };
407183
407254
 
407184
407255
  // ../../node_modules/@gearbox-protocol/sdk/dist/esm/sdk/GearboxSDK.js
407185
407256
  var ERR_NOT_ATTACHED = new Error("Gearbox SDK not attached");
407257
+ var STATE_VERSION = 1;
407186
407258
  var GearboxSDK = class _GearboxSDK {
407187
407259
  #hooks = new Hooks();
407188
407260
  // Represents chain object
@@ -407194,13 +407266,9 @@ var GearboxSDK = class _GearboxSDK {
407194
407266
  #syncing = false;
407195
407267
  // Collection of core singleton contracts
407196
407268
  #addressProvider;
407197
- #botListContract;
407198
- #gearStakingContract;
407199
407269
  #attachConfig;
407200
407270
  // Collection of markets
407201
407271
  #marketRegister;
407202
- // Routers by address
407203
- #routers = new AddressMap();
407204
407272
  logger;
407205
407273
  /**
407206
407274
  * Interest rate models can be reused across chain (and SDK operates on chain level)
@@ -407268,17 +407336,24 @@ var GearboxSDK = class _GearboxSDK {
407268
407336
  marketConfigurators
407269
407337
  });
407270
407338
  }
407339
+ static hydrate(options, state) {
407340
+ const { logger: logger2, plugins, ...rest } = options;
407341
+ const provider = new Provider({
407342
+ ...rest,
407343
+ chainId: state.chainId,
407344
+ networkType: state.network
407345
+ });
407346
+ return new _GearboxSDK({ provider, plugins, logger: logger2 }).#hydrate(rest, state);
407347
+ }
407271
407348
  constructor(options) {
407272
407349
  this.#provider = options.provider;
407273
407350
  this.logger = options.logger;
407274
407351
  this.priceFeeds = new PriceFeedRegister(this);
407275
407352
  this.strictContractTypes = options.strictContractTypes ?? false;
407276
407353
  const pluginsInstances = {};
407277
- const pluginConstructros = {
407278
- ...defaultPlugins,
407279
- ...options.plugins
407280
- };
407281
- for (const [name, Plugin] of TypedObjectUtils.entries(pluginConstructros)) {
407354
+ for (const [name, Plugin] of TypedObjectUtils.entries(
407355
+ options.plugins ?? {}
407356
+ )) {
407282
407357
  pluginsInstances[name] = new Plugin(this);
407283
407358
  }
407284
407359
  this.plugins = pluginsInstances;
@@ -407288,7 +407363,6 @@ var GearboxSDK = class _GearboxSDK {
407288
407363
  addressProvider,
407289
407364
  blockNumber,
407290
407365
  redstoneHistoricTimestamp,
407291
- redstoneGateways,
407292
407366
  ignoreUpdateablePrices,
407293
407367
  marketConfigurators
407294
407368
  } = opts;
@@ -407316,12 +407390,7 @@ var GearboxSDK = class _GearboxSDK {
407316
407390
  );
407317
407391
  this.#currentBlock = block.number;
407318
407392
  this.#timestamp = block.timestamp;
407319
- if (redstoneHistoricTimestamp) {
407320
- this.priceFeeds.redstoneUpdater.historicalTimestamp = redstoneHistoricTimestamp === true ? Number(block.timestamp) * 1e3 : redstoneHistoricTimestamp;
407321
- }
407322
- if (redstoneGateways?.length) {
407323
- this.priceFeeds.redstoneUpdater.gateways = redstoneGateways;
407324
- }
407393
+ this.#confugureRedstone(opts);
407325
407394
  this.logger?.debug(
407326
407395
  `${re}attach block number ${this.currentBlock} timestamp ${this.timestamp}`
407327
407396
  );
@@ -407330,23 +407399,6 @@ var GearboxSDK = class _GearboxSDK {
407330
407399
  `address provider version: ${this.#addressProvider.version}`
407331
407400
  );
407332
407401
  await this.#addressProvider.syncState(this.currentBlock);
407333
- try {
407334
- const botListAddress = this.#addressProvider.getAddress(
407335
- AP_BOT_LIST,
407336
- NO_VERSION
407337
- );
407338
- this.#botListContract = new BotListContract(this, botListAddress);
407339
- } catch (e) {
407340
- this.logger?.error(e);
407341
- }
407342
- const gearStakingAddress = this.#addressProvider.getAddress(
407343
- AP_GEAR_STAKING,
407344
- NO_VERSION
407345
- );
407346
- this.#gearStakingContract = new GearStakingContract(
407347
- this,
407348
- gearStakingAddress
407349
- );
407350
407402
  this.#marketRegister = new MarketRegister(this);
407351
407403
  await this.#marketRegister.loadMarkets(
407352
407404
  marketConfigurators,
@@ -407373,13 +407425,57 @@ var GearboxSDK = class _GearboxSDK {
407373
407425
  this.logger?.info(`${re}attach time: ${Date.now() - time} ms`);
407374
407426
  return this;
407375
407427
  }
407428
+ #hydrate(options, state) {
407429
+ const { logger: _logger, ...opts } = options;
407430
+ if (state.version !== STATE_VERSION) {
407431
+ throw new Error(
407432
+ `hydrated state version is ${state.version}, but expected ${STATE_VERSION}`
407433
+ );
407434
+ }
407435
+ this.#currentBlock = state.currentBlock;
407436
+ this.#timestamp = state.timestamp;
407437
+ this.#confugureRedstone(opts);
407438
+ this.#addressProvider = hydrateAddressProvider(this, state.addressProvider);
407439
+ this.logger?.debug(
407440
+ `address provider version: ${this.#addressProvider.version}`
407441
+ );
407442
+ this.#marketRegister = new MarketRegister(this);
407443
+ this.#marketRegister.hydrate(state.markets);
407444
+ this.#attachConfig = {
407445
+ ...opts,
407446
+ addressProvider: this.addressProvider.address,
407447
+ marketConfigurators: this.marketRegister.marketConfigurators.map(
407448
+ (m) => m.address
407449
+ ),
407450
+ blockNumber: this.currentBlock
407451
+ };
407452
+ for (const [name, plugin] of TypedObjectUtils.entries(this.plugins)) {
407453
+ const pluginState = state.plugins[name];
407454
+ if (plugin.hydrate && pluginState) {
407455
+ if (pluginState.version !== plugin.version) {
407456
+ throw new PluginStateVersionError(plugin, pluginState);
407457
+ }
407458
+ plugin.hydrate(pluginState);
407459
+ }
407460
+ }
407461
+ return this;
407462
+ }
407463
+ #confugureRedstone(opts) {
407464
+ const { redstoneGateways, redstoneHistoricTimestamp } = opts;
407465
+ if (redstoneHistoricTimestamp) {
407466
+ this.priceFeeds.redstoneUpdater.historicalTimestamp = redstoneHistoricTimestamp === true ? Number(this.timestamp) * 1e3 : redstoneHistoricTimestamp;
407467
+ }
407468
+ if (redstoneGateways?.length) {
407469
+ this.priceFeeds.redstoneUpdater.gateways = redstoneGateways;
407470
+ }
407471
+ }
407376
407472
  /**
407377
407473
  * Reattach SDK with the same config as before, without re-creating instance. Will load all state from scratch
407378
407474
  * Be mindful of block number, for example
407379
407475
  */
407380
407476
  async reattach() {
407381
407477
  if (!this.#attachConfig) {
407382
- throw new Error("SDK not attached");
407478
+ throw new Error("cannot reattach, attach config is not set");
407383
407479
  }
407384
407480
  await this.#attach(this.#attachConfig);
407385
407481
  }
@@ -407437,8 +407533,8 @@ var GearboxSDK = class _GearboxSDK {
407437
407533
  timestamp: Number(this.timestamp),
407438
407534
  core: {
407439
407535
  addressProviderV3: this.addressProvider.stateHuman(raw),
407440
- botList: this.botListContract.stateHuman(raw),
407441
- gearStakingV3: this.gearStakingContract.stateHuman(raw)
407536
+ botList: this.botListContract?.stateHuman(raw),
407537
+ gearStakingV3: this.gearStakingContract?.stateHuman(raw)
407442
407538
  },
407443
407539
  tokens: this.tokensMeta.values(),
407444
407540
  plugins: Object.fromEntries(
@@ -407452,16 +407548,21 @@ var GearboxSDK = class _GearboxSDK {
407452
407548
  }
407453
407549
  get state() {
407454
407550
  return {
407551
+ version: STATE_VERSION,
407552
+ network: this.provider.networkType,
407553
+ chainId: this.provider.chainId,
407455
407554
  currentBlock: this.currentBlock,
407555
+ timestamp: this.timestamp,
407456
407556
  addressProvider: this.addressProvider.state,
407457
- markets: this.marketRegister.state
407557
+ markets: this.marketRegister.state,
407558
+ plugins: Object.fromEntries(
407559
+ TypedObjectUtils.entries(this.plugins).map(([name, plugin]) => [
407560
+ name,
407561
+ plugin.state
407562
+ ])
407563
+ )
407458
407564
  };
407459
407565
  }
407460
- async tvl() {
407461
- const { tvl, tvlUSD } = await this.marketRegister.tvl();
407462
- this.logger?.info(tvl);
407463
- this.logger?.info(`Total TVL: ${formatBN(tvlUSD, 8)}`);
407464
- }
407465
407566
  /**
407466
407567
  * Reloads markets states based on events from last processed block to new block (defaults to latest block)
407467
407568
  * @param opts
@@ -407568,16 +407669,18 @@ var GearboxSDK = class _GearboxSDK {
407568
407669
  return this.#addressProvider;
407569
407670
  }
407570
407671
  get botListContract() {
407571
- if (this.#botListContract === void 0) {
407572
- throw ERR_NOT_ATTACHED;
407672
+ const addr = this.addressProvider.getAddress(AP_BOT_LIST, NO_VERSION);
407673
+ if (!this.contracts.has(addr)) {
407674
+ return new BotListContract(this, addr);
407573
407675
  }
407574
- return this.#botListContract;
407676
+ return this.contracts.get(addr);
407575
407677
  }
407576
407678
  get gearStakingContract() {
407577
- if (this.#gearStakingContract === void 0) {
407578
- throw ERR_NOT_ATTACHED;
407679
+ const addr = this.addressProvider.getAddress(AP_GEAR_STAKING, NO_VERSION);
407680
+ if (!this.contracts.has(addr)) {
407681
+ return new GearStakingContract(this, addr);
407579
407682
  }
407580
- return this.#gearStakingContract;
407683
+ return this.contracts.get(addr);
407581
407684
  }
407582
407685
  get marketRegister() {
407583
407686
  if (this.#marketRegister === void 0) {
@@ -407601,21 +407704,18 @@ var GearboxSDK = class _GearboxSDK {
407601
407704
  facadeAddr = cm.creditFacade.address;
407602
407705
  }
407603
407706
  const facadeV = this.contracts.mustGet(facadeAddr).version;
407604
- const routerRange = facadeV >= 310 ? [310, 319] : [300, 309];
407605
- const routerEntry = this.addressProvider.getLatestInRange(
407606
- AP_ROUTER,
407607
- routerRange
407608
- );
407707
+ const routerRange = isV310(facadeV) ? VERSION_RANGE_310 : VERSION_RANGE_300;
407708
+ const routerEntry = this.addressProvider.getLatest(AP_ROUTER, routerRange);
407609
407709
  if (!routerEntry) {
407610
407710
  throw new Error(
407611
407711
  `router not found for facade v ${facadeV} at ${facadeAddr}`
407612
407712
  );
407613
407713
  }
407614
407714
  const [routerAddr, routerV] = routerEntry;
407615
- if (!this.#routers.has(routerAddr)) {
407616
- this.#routers.upsert(routerAddr, createRouter(this, routerAddr, routerV));
407715
+ if (!this.contracts.has(routerAddr)) {
407716
+ return createRouter(this, routerAddr, routerV);
407617
407717
  }
407618
- return this.#routers.mustGet(routerAddr);
407718
+ return this.contracts.get(routerAddr);
407619
407719
  }
407620
407720
  };
407621
407721
 
@@ -414404,734 +414504,11 @@ var iDataCompressorV2_1Abi = [
414404
414504
  ]
414405
414505
  }
414406
414506
  ],
414407
- stateMutability: "view"
414408
- },
414409
- {
414410
- type: "function",
414411
- inputs: [{ name: "borrower", internalType: "address", type: "address" }],
414412
- name: "getCreditAccountsByBorrower",
414413
- outputs: [
414414
- {
414415
- name: "",
414416
- internalType: "struct CreditAccountData[]",
414417
- type: "tuple[]",
414418
- components: [
414419
- { name: "isSuccessful", internalType: "bool", type: "bool" },
414420
- {
414421
- name: "priceFeedsNeeded",
414422
- internalType: "address[]",
414423
- type: "address[]"
414424
- },
414425
- { name: "addr", internalType: "address", type: "address" },
414426
- { name: "borrower", internalType: "address", type: "address" },
414427
- { name: "creditManager", internalType: "address", type: "address" },
414428
- { name: "cmName", internalType: "string", type: "string" },
414429
- { name: "creditFacade", internalType: "address", type: "address" },
414430
- { name: "underlying", internalType: "address", type: "address" },
414431
- { name: "debt", internalType: "uint256", type: "uint256" },
414432
- {
414433
- name: "cumulativeIndexLastUpdate",
414434
- internalType: "uint256",
414435
- type: "uint256"
414436
- },
414437
- {
414438
- name: "cumulativeQuotaInterest",
414439
- internalType: "uint128",
414440
- type: "uint128"
414441
- },
414442
- { name: "accruedInterest", internalType: "uint256", type: "uint256" },
414443
- { name: "accruedFees", internalType: "uint256", type: "uint256" },
414444
- { name: "totalDebtUSD", internalType: "uint256", type: "uint256" },
414445
- { name: "totalValue", internalType: "uint256", type: "uint256" },
414446
- { name: "totalValueUSD", internalType: "uint256", type: "uint256" },
414447
- { name: "twvUSD", internalType: "uint256", type: "uint256" },
414448
- {
414449
- name: "enabledTokensMask",
414450
- internalType: "uint256",
414451
- type: "uint256"
414452
- },
414453
- { name: "healthFactor", internalType: "uint256", type: "uint256" },
414454
- { name: "baseBorrowRate", internalType: "uint256", type: "uint256" },
414455
- {
414456
- name: "aggregatedBorrowRate",
414457
- internalType: "uint256",
414458
- type: "uint256"
414459
- },
414460
- {
414461
- name: "balances",
414462
- internalType: "struct TokenBalance[]",
414463
- type: "tuple[]",
414464
- components: [
414465
- { name: "token", internalType: "address", type: "address" },
414466
- { name: "balance", internalType: "uint256", type: "uint256" },
414467
- { name: "isForbidden", internalType: "bool", type: "bool" },
414468
- { name: "isEnabled", internalType: "bool", type: "bool" },
414469
- { name: "isQuoted", internalType: "bool", type: "bool" },
414470
- { name: "quota", internalType: "uint256", type: "uint256" },
414471
- { name: "quotaRate", internalType: "uint16", type: "uint16" },
414472
- {
414473
- name: "quotaCumulativeIndexLU",
414474
- internalType: "uint256",
414475
- type: "uint256"
414476
- }
414477
- ]
414478
- },
414479
- { name: "since", internalType: "uint64", type: "uint64" },
414480
- { name: "cfVersion", internalType: "uint256", type: "uint256" },
414481
- { name: "expirationDate", internalType: "uint40", type: "uint40" },
414482
- { name: "activeBots", internalType: "address[]", type: "address[]" }
414483
- ]
414484
- }
414485
- ],
414486
- stateMutability: "view"
414487
- },
414488
- {
414489
- type: "function",
414490
- inputs: [
414491
- { name: "_creditManager", internalType: "address", type: "address" }
414492
- ],
414493
- name: "getCreditManagerData",
414494
- outputs: [
414495
- {
414496
- name: "",
414497
- internalType: "struct CreditManagerData",
414498
- type: "tuple",
414499
- components: [
414500
- { name: "addr", internalType: "address", type: "address" },
414501
- { name: "name", internalType: "string", type: "string" },
414502
- { name: "cfVersion", internalType: "uint256", type: "uint256" },
414503
- { name: "creditFacade", internalType: "address", type: "address" },
414504
- {
414505
- name: "creditConfigurator",
414506
- internalType: "address",
414507
- type: "address"
414508
- },
414509
- { name: "underlying", internalType: "address", type: "address" },
414510
- { name: "pool", internalType: "address", type: "address" },
414511
- { name: "totalDebt", internalType: "uint256", type: "uint256" },
414512
- { name: "totalDebtLimit", internalType: "uint256", type: "uint256" },
414513
- { name: "baseBorrowRate", internalType: "uint256", type: "uint256" },
414514
- { name: "minDebt", internalType: "uint256", type: "uint256" },
414515
- { name: "maxDebt", internalType: "uint256", type: "uint256" },
414516
- {
414517
- name: "availableToBorrow",
414518
- internalType: "uint256",
414519
- type: "uint256"
414520
- },
414521
- {
414522
- name: "collateralTokens",
414523
- internalType: "address[]",
414524
- type: "address[]"
414525
- },
414526
- {
414527
- name: "adapters",
414528
- internalType: "struct ContractAdapter[]",
414529
- type: "tuple[]",
414530
- components: [
414531
- {
414532
- name: "targetContract",
414533
- internalType: "address",
414534
- type: "address"
414535
- },
414536
- { name: "adapter", internalType: "address", type: "address" }
414537
- ]
414538
- },
414539
- {
414540
- name: "liquidationThresholds",
414541
- internalType: "uint256[]",
414542
- type: "uint256[]"
414543
- },
414544
- { name: "isDegenMode", internalType: "bool", type: "bool" },
414545
- { name: "degenNFT", internalType: "address", type: "address" },
414546
- {
414547
- name: "forbiddenTokenMask",
414548
- internalType: "uint256",
414549
- type: "uint256"
414550
- },
414551
- {
414552
- name: "maxEnabledTokensLength",
414553
- internalType: "uint8",
414554
- type: "uint8"
414555
- },
414556
- { name: "feeInterest", internalType: "uint16", type: "uint16" },
414557
- { name: "feeLiquidation", internalType: "uint16", type: "uint16" },
414558
- {
414559
- name: "liquidationDiscount",
414560
- internalType: "uint16",
414561
- type: "uint16"
414562
- },
414563
- {
414564
- name: "feeLiquidationExpired",
414565
- internalType: "uint16",
414566
- type: "uint16"
414567
- },
414568
- {
414569
- name: "liquidationDiscountExpired",
414570
- internalType: "uint16",
414571
- type: "uint16"
414572
- },
414573
- {
414574
- name: "quotas",
414575
- internalType: "struct QuotaInfo[]",
414576
- type: "tuple[]",
414577
- components: [
414578
- { name: "token", internalType: "address", type: "address" },
414579
- { name: "rate", internalType: "uint16", type: "uint16" },
414580
- {
414581
- name: "quotaIncreaseFee",
414582
- internalType: "uint16",
414583
- type: "uint16"
414584
- },
414585
- { name: "totalQuoted", internalType: "uint96", type: "uint96" },
414586
- { name: "limit", internalType: "uint96", type: "uint96" },
414587
- { name: "isActive", internalType: "bool", type: "bool" }
414588
- ]
414589
- },
414590
- {
414591
- name: "lirm",
414592
- internalType: "struct LinearModel",
414593
- type: "tuple",
414594
- components: [
414595
- {
414596
- name: "interestModel",
414597
- internalType: "address",
414598
- type: "address"
414599
- },
414600
- { name: "version", internalType: "uint256", type: "uint256" },
414601
- { name: "U_1", internalType: "uint16", type: "uint16" },
414602
- { name: "U_2", internalType: "uint16", type: "uint16" },
414603
- { name: "R_base", internalType: "uint16", type: "uint16" },
414604
- { name: "R_slope1", internalType: "uint16", type: "uint16" },
414605
- { name: "R_slope2", internalType: "uint16", type: "uint16" },
414606
- { name: "R_slope3", internalType: "uint16", type: "uint16" },
414607
- {
414608
- name: "isBorrowingMoreU2Forbidden",
414609
- internalType: "bool",
414610
- type: "bool"
414611
- }
414612
- ]
414613
- },
414614
- { name: "isPaused", internalType: "bool", type: "bool" }
414615
- ]
414616
- }
414617
- ],
414618
- stateMutability: "view"
414619
- },
414620
- {
414621
- type: "function",
414622
- inputs: [],
414623
- name: "getCreditManagersV2List",
414624
- outputs: [
414625
- {
414626
- name: "",
414627
- internalType: "struct CreditManagerData[]",
414628
- type: "tuple[]",
414629
- components: [
414630
- { name: "addr", internalType: "address", type: "address" },
414631
- { name: "name", internalType: "string", type: "string" },
414632
- { name: "cfVersion", internalType: "uint256", type: "uint256" },
414633
- { name: "creditFacade", internalType: "address", type: "address" },
414634
- {
414635
- name: "creditConfigurator",
414636
- internalType: "address",
414637
- type: "address"
414638
- },
414639
- { name: "underlying", internalType: "address", type: "address" },
414640
- { name: "pool", internalType: "address", type: "address" },
414641
- { name: "totalDebt", internalType: "uint256", type: "uint256" },
414642
- { name: "totalDebtLimit", internalType: "uint256", type: "uint256" },
414643
- { name: "baseBorrowRate", internalType: "uint256", type: "uint256" },
414644
- { name: "minDebt", internalType: "uint256", type: "uint256" },
414645
- { name: "maxDebt", internalType: "uint256", type: "uint256" },
414646
- {
414647
- name: "availableToBorrow",
414648
- internalType: "uint256",
414649
- type: "uint256"
414650
- },
414651
- {
414652
- name: "collateralTokens",
414653
- internalType: "address[]",
414654
- type: "address[]"
414655
- },
414656
- {
414657
- name: "adapters",
414658
- internalType: "struct ContractAdapter[]",
414659
- type: "tuple[]",
414660
- components: [
414661
- {
414662
- name: "targetContract",
414663
- internalType: "address",
414664
- type: "address"
414665
- },
414666
- { name: "adapter", internalType: "address", type: "address" }
414667
- ]
414668
- },
414669
- {
414670
- name: "liquidationThresholds",
414671
- internalType: "uint256[]",
414672
- type: "uint256[]"
414673
- },
414674
- { name: "isDegenMode", internalType: "bool", type: "bool" },
414675
- { name: "degenNFT", internalType: "address", type: "address" },
414676
- {
414677
- name: "forbiddenTokenMask",
414678
- internalType: "uint256",
414679
- type: "uint256"
414680
- },
414681
- {
414682
- name: "maxEnabledTokensLength",
414683
- internalType: "uint8",
414684
- type: "uint8"
414685
- },
414686
- { name: "feeInterest", internalType: "uint16", type: "uint16" },
414687
- { name: "feeLiquidation", internalType: "uint16", type: "uint16" },
414688
- {
414689
- name: "liquidationDiscount",
414690
- internalType: "uint16",
414691
- type: "uint16"
414692
- },
414693
- {
414694
- name: "feeLiquidationExpired",
414695
- internalType: "uint16",
414696
- type: "uint16"
414697
- },
414698
- {
414699
- name: "liquidationDiscountExpired",
414700
- internalType: "uint16",
414701
- type: "uint16"
414702
- },
414703
- {
414704
- name: "quotas",
414705
- internalType: "struct QuotaInfo[]",
414706
- type: "tuple[]",
414707
- components: [
414708
- { name: "token", internalType: "address", type: "address" },
414709
- { name: "rate", internalType: "uint16", type: "uint16" },
414710
- {
414711
- name: "quotaIncreaseFee",
414712
- internalType: "uint16",
414713
- type: "uint16"
414714
- },
414715
- { name: "totalQuoted", internalType: "uint96", type: "uint96" },
414716
- { name: "limit", internalType: "uint96", type: "uint96" },
414717
- { name: "isActive", internalType: "bool", type: "bool" }
414718
- ]
414719
- },
414720
- {
414721
- name: "lirm",
414722
- internalType: "struct LinearModel",
414723
- type: "tuple",
414724
- components: [
414725
- {
414726
- name: "interestModel",
414727
- internalType: "address",
414728
- type: "address"
414729
- },
414730
- { name: "version", internalType: "uint256", type: "uint256" },
414731
- { name: "U_1", internalType: "uint16", type: "uint16" },
414732
- { name: "U_2", internalType: "uint16", type: "uint16" },
414733
- { name: "R_base", internalType: "uint16", type: "uint16" },
414734
- { name: "R_slope1", internalType: "uint16", type: "uint16" },
414735
- { name: "R_slope2", internalType: "uint16", type: "uint16" },
414736
- { name: "R_slope3", internalType: "uint16", type: "uint16" },
414737
- {
414738
- name: "isBorrowingMoreU2Forbidden",
414739
- internalType: "bool",
414740
- type: "bool"
414741
- }
414742
- ]
414743
- },
414744
- { name: "isPaused", internalType: "bool", type: "bool" }
414745
- ]
414746
- }
414747
- ],
414748
- stateMutability: "view"
414749
- },
414750
- {
414751
- type: "function",
414752
- inputs: [{ name: "_pool", internalType: "address", type: "address" }],
414753
- name: "getPoolData",
414754
- outputs: [
414755
- {
414756
- name: "",
414757
- internalType: "struct PoolData",
414758
- type: "tuple",
414759
- components: [
414760
- { name: "addr", internalType: "address", type: "address" },
414761
- { name: "underlying", internalType: "address", type: "address" },
414762
- { name: "dieselToken", internalType: "address", type: "address" },
414763
- { name: "symbol", internalType: "string", type: "string" },
414764
- { name: "name", internalType: "string", type: "string" },
414765
- {
414766
- name: "baseInterestIndex",
414767
- internalType: "uint256",
414768
- type: "uint256"
414769
- },
414770
- {
414771
- name: "availableLiquidity",
414772
- internalType: "uint256",
414773
- type: "uint256"
414774
- },
414775
- {
414776
- name: "expectedLiquidity",
414777
- internalType: "uint256",
414778
- type: "uint256"
414779
- },
414780
- { name: "totalBorrowed", internalType: "uint256", type: "uint256" },
414781
- { name: "totalDebtLimit", internalType: "uint256", type: "uint256" },
414782
- {
414783
- name: "creditManagerDebtParams",
414784
- internalType: "struct CreditManagerDebtParams[]",
414785
- type: "tuple[]",
414786
- components: [
414787
- {
414788
- name: "creditManager",
414789
- internalType: "address",
414790
- type: "address"
414791
- },
414792
- { name: "borrowed", internalType: "uint256", type: "uint256" },
414793
- { name: "limit", internalType: "uint256", type: "uint256" },
414794
- {
414795
- name: "availableToBorrow",
414796
- internalType: "uint256",
414797
- type: "uint256"
414798
- }
414799
- ]
414800
- },
414801
- { name: "totalAssets", internalType: "uint256", type: "uint256" },
414802
- { name: "totalSupply", internalType: "uint256", type: "uint256" },
414803
- { name: "supplyRate", internalType: "uint256", type: "uint256" },
414804
- {
414805
- name: "baseInterestRate",
414806
- internalType: "uint256",
414807
- type: "uint256"
414808
- },
414809
- { name: "dieselRate_RAY", internalType: "uint256", type: "uint256" },
414810
- { name: "withdrawFee", internalType: "uint256", type: "uint256" },
414811
- {
414812
- name: "lastBaseInterestUpdate",
414813
- internalType: "uint256",
414814
- type: "uint256"
414815
- },
414816
- {
414817
- name: "baseInterestIndexLU",
414818
- internalType: "uint256",
414819
- type: "uint256"
414820
- },
414821
- { name: "version", internalType: "uint256", type: "uint256" },
414822
- { name: "poolQuotaKeeper", internalType: "address", type: "address" },
414823
- { name: "gauge", internalType: "address", type: "address" },
414824
- {
414825
- name: "quotas",
414826
- internalType: "struct QuotaInfo[]",
414827
- type: "tuple[]",
414828
- components: [
414829
- { name: "token", internalType: "address", type: "address" },
414830
- { name: "rate", internalType: "uint16", type: "uint16" },
414831
- {
414832
- name: "quotaIncreaseFee",
414833
- internalType: "uint16",
414834
- type: "uint16"
414835
- },
414836
- { name: "totalQuoted", internalType: "uint96", type: "uint96" },
414837
- { name: "limit", internalType: "uint96", type: "uint96" },
414838
- { name: "isActive", internalType: "bool", type: "bool" }
414839
- ]
414840
- },
414841
- {
414842
- name: "zappers",
414843
- internalType: "struct ZapperInfo[]",
414844
- type: "tuple[]",
414845
- components: [
414846
- { name: "zapper", internalType: "address", type: "address" },
414847
- { name: "tokenIn", internalType: "address", type: "address" },
414848
- { name: "tokenOut", internalType: "address", type: "address" }
414849
- ]
414850
- },
414851
- {
414852
- name: "lirm",
414853
- internalType: "struct LinearModel",
414854
- type: "tuple",
414855
- components: [
414856
- {
414857
- name: "interestModel",
414858
- internalType: "address",
414859
- type: "address"
414860
- },
414861
- { name: "version", internalType: "uint256", type: "uint256" },
414862
- { name: "U_1", internalType: "uint16", type: "uint16" },
414863
- { name: "U_2", internalType: "uint16", type: "uint16" },
414864
- { name: "R_base", internalType: "uint16", type: "uint16" },
414865
- { name: "R_slope1", internalType: "uint16", type: "uint16" },
414866
- { name: "R_slope2", internalType: "uint16", type: "uint16" },
414867
- { name: "R_slope3", internalType: "uint16", type: "uint16" },
414868
- {
414869
- name: "isBorrowingMoreU2Forbidden",
414870
- internalType: "bool",
414871
- type: "bool"
414872
- }
414873
- ]
414874
- },
414875
- { name: "isPaused", internalType: "bool", type: "bool" }
414876
- ]
414877
- }
414878
- ],
414879
- stateMutability: "view"
414880
- },
414881
- {
414882
- type: "function",
414883
- inputs: [],
414884
- name: "getPoolsV1List",
414885
- outputs: [
414886
- {
414887
- name: "",
414888
- internalType: "struct PoolData[]",
414889
- type: "tuple[]",
414890
- components: [
414891
- { name: "addr", internalType: "address", type: "address" },
414892
- { name: "underlying", internalType: "address", type: "address" },
414893
- { name: "dieselToken", internalType: "address", type: "address" },
414894
- { name: "symbol", internalType: "string", type: "string" },
414895
- { name: "name", internalType: "string", type: "string" },
414896
- {
414897
- name: "baseInterestIndex",
414898
- internalType: "uint256",
414899
- type: "uint256"
414900
- },
414901
- {
414902
- name: "availableLiquidity",
414903
- internalType: "uint256",
414904
- type: "uint256"
414905
- },
414906
- {
414907
- name: "expectedLiquidity",
414908
- internalType: "uint256",
414909
- type: "uint256"
414910
- },
414911
- { name: "totalBorrowed", internalType: "uint256", type: "uint256" },
414912
- { name: "totalDebtLimit", internalType: "uint256", type: "uint256" },
414913
- {
414914
- name: "creditManagerDebtParams",
414915
- internalType: "struct CreditManagerDebtParams[]",
414916
- type: "tuple[]",
414917
- components: [
414918
- {
414919
- name: "creditManager",
414920
- internalType: "address",
414921
- type: "address"
414922
- },
414923
- { name: "borrowed", internalType: "uint256", type: "uint256" },
414924
- { name: "limit", internalType: "uint256", type: "uint256" },
414925
- {
414926
- name: "availableToBorrow",
414927
- internalType: "uint256",
414928
- type: "uint256"
414929
- }
414930
- ]
414931
- },
414932
- { name: "totalAssets", internalType: "uint256", type: "uint256" },
414933
- { name: "totalSupply", internalType: "uint256", type: "uint256" },
414934
- { name: "supplyRate", internalType: "uint256", type: "uint256" },
414935
- {
414936
- name: "baseInterestRate",
414937
- internalType: "uint256",
414938
- type: "uint256"
414939
- },
414940
- { name: "dieselRate_RAY", internalType: "uint256", type: "uint256" },
414941
- { name: "withdrawFee", internalType: "uint256", type: "uint256" },
414942
- {
414943
- name: "lastBaseInterestUpdate",
414944
- internalType: "uint256",
414945
- type: "uint256"
414946
- },
414947
- {
414948
- name: "baseInterestIndexLU",
414949
- internalType: "uint256",
414950
- type: "uint256"
414951
- },
414952
- { name: "version", internalType: "uint256", type: "uint256" },
414953
- { name: "poolQuotaKeeper", internalType: "address", type: "address" },
414954
- { name: "gauge", internalType: "address", type: "address" },
414955
- {
414956
- name: "quotas",
414957
- internalType: "struct QuotaInfo[]",
414958
- type: "tuple[]",
414959
- components: [
414960
- { name: "token", internalType: "address", type: "address" },
414961
- { name: "rate", internalType: "uint16", type: "uint16" },
414962
- {
414963
- name: "quotaIncreaseFee",
414964
- internalType: "uint16",
414965
- type: "uint16"
414966
- },
414967
- { name: "totalQuoted", internalType: "uint96", type: "uint96" },
414968
- { name: "limit", internalType: "uint96", type: "uint96" },
414969
- { name: "isActive", internalType: "bool", type: "bool" }
414970
- ]
414971
- },
414972
- {
414973
- name: "zappers",
414974
- internalType: "struct ZapperInfo[]",
414975
- type: "tuple[]",
414976
- components: [
414977
- { name: "zapper", internalType: "address", type: "address" },
414978
- { name: "tokenIn", internalType: "address", type: "address" },
414979
- { name: "tokenOut", internalType: "address", type: "address" }
414980
- ]
414981
- },
414982
- {
414983
- name: "lirm",
414984
- internalType: "struct LinearModel",
414985
- type: "tuple",
414986
- components: [
414987
- {
414988
- name: "interestModel",
414989
- internalType: "address",
414990
- type: "address"
414991
- },
414992
- { name: "version", internalType: "uint256", type: "uint256" },
414993
- { name: "U_1", internalType: "uint16", type: "uint16" },
414994
- { name: "U_2", internalType: "uint16", type: "uint16" },
414995
- { name: "R_base", internalType: "uint16", type: "uint16" },
414996
- { name: "R_slope1", internalType: "uint16", type: "uint16" },
414997
- { name: "R_slope2", internalType: "uint16", type: "uint16" },
414998
- { name: "R_slope3", internalType: "uint16", type: "uint16" },
414999
- {
415000
- name: "isBorrowingMoreU2Forbidden",
415001
- internalType: "bool",
415002
- type: "bool"
415003
- }
415004
- ]
415005
- },
415006
- { name: "isPaused", internalType: "bool", type: "bool" }
415007
- ]
415008
- }
415009
- ],
415010
- stateMutability: "view"
415011
- },
415012
- {
415013
- type: "function",
415014
- inputs: [
415015
- { name: "creditManager", internalType: "address", type: "address" },
415016
- { name: "borrower", internalType: "address", type: "address" }
415017
- ],
415018
- name: "hasOpenedCreditAccount",
415019
- outputs: [{ name: "", internalType: "bool", type: "bool" }],
415020
- stateMutability: "view"
415021
- },
415022
- {
415023
- type: "function",
415024
- inputs: [],
415025
- name: "version",
415026
- outputs: [{ name: "", internalType: "uint256", type: "uint256" }],
415027
- stateMutability: "view"
415028
- }
415029
- ];
415030
- var iDataCompressorV3Abi = [
415031
- {
415032
- type: "function",
415033
- inputs: [
415034
- { name: "creditAccount", internalType: "address", type: "address" },
415035
- {
415036
- name: "priceUpdates",
415037
- internalType: "struct PriceOnDemand[]",
415038
- type: "tuple[]",
415039
- components: [
415040
- { name: "token", internalType: "address", type: "address" },
415041
- { name: "callData", internalType: "bytes", type: "bytes" }
415042
- ]
415043
- }
415044
- ],
415045
- name: "getCreditAccountData",
415046
- outputs: [
415047
- {
415048
- name: "",
415049
- internalType: "struct CreditAccountData",
415050
- type: "tuple",
415051
- components: [
415052
- { name: "isSuccessful", internalType: "bool", type: "bool" },
415053
- {
415054
- name: "priceFeedsNeeded",
415055
- internalType: "address[]",
415056
- type: "address[]"
415057
- },
415058
- { name: "addr", internalType: "address", type: "address" },
415059
- { name: "borrower", internalType: "address", type: "address" },
415060
- { name: "creditManager", internalType: "address", type: "address" },
415061
- { name: "cmName", internalType: "string", type: "string" },
415062
- { name: "creditFacade", internalType: "address", type: "address" },
415063
- { name: "underlying", internalType: "address", type: "address" },
415064
- { name: "debt", internalType: "uint256", type: "uint256" },
415065
- {
415066
- name: "cumulativeIndexLastUpdate",
415067
- internalType: "uint256",
415068
- type: "uint256"
415069
- },
415070
- {
415071
- name: "cumulativeQuotaInterest",
415072
- internalType: "uint128",
415073
- type: "uint128"
415074
- },
415075
- { name: "accruedInterest", internalType: "uint256", type: "uint256" },
415076
- { name: "accruedFees", internalType: "uint256", type: "uint256" },
415077
- { name: "totalDebtUSD", internalType: "uint256", type: "uint256" },
415078
- { name: "totalValue", internalType: "uint256", type: "uint256" },
415079
- { name: "totalValueUSD", internalType: "uint256", type: "uint256" },
415080
- { name: "twvUSD", internalType: "uint256", type: "uint256" },
415081
- {
415082
- name: "enabledTokensMask",
415083
- internalType: "uint256",
415084
- type: "uint256"
415085
- },
415086
- { name: "healthFactor", internalType: "uint256", type: "uint256" },
415087
- { name: "baseBorrowRate", internalType: "uint256", type: "uint256" },
415088
- {
415089
- name: "aggregatedBorrowRate",
415090
- internalType: "uint256",
415091
- type: "uint256"
415092
- },
415093
- {
415094
- name: "balances",
415095
- internalType: "struct TokenBalance[]",
415096
- type: "tuple[]",
415097
- components: [
415098
- { name: "token", internalType: "address", type: "address" },
415099
- { name: "balance", internalType: "uint256", type: "uint256" },
415100
- { name: "isForbidden", internalType: "bool", type: "bool" },
415101
- { name: "isEnabled", internalType: "bool", type: "bool" },
415102
- { name: "isQuoted", internalType: "bool", type: "bool" },
415103
- { name: "quota", internalType: "uint256", type: "uint256" },
415104
- { name: "quotaRate", internalType: "uint16", type: "uint16" },
415105
- {
415106
- name: "quotaCumulativeIndexLU",
415107
- internalType: "uint256",
415108
- type: "uint256"
415109
- }
415110
- ]
415111
- },
415112
- { name: "since", internalType: "uint64", type: "uint64" },
415113
- { name: "cfVersion", internalType: "uint256", type: "uint256" },
415114
- { name: "expirationDate", internalType: "uint40", type: "uint40" },
415115
- { name: "activeBots", internalType: "address[]", type: "address[]" }
415116
- ]
415117
- }
415118
- ],
415119
- stateMutability: "nonpayable"
414507
+ stateMutability: "view"
415120
414508
  },
415121
414509
  {
415122
414510
  type: "function",
415123
- inputs: [
415124
- { name: "borrower", internalType: "address", type: "address" },
415125
- {
415126
- name: "priceUpdates",
415127
- internalType: "struct PriceOnDemand[]",
415128
- type: "tuple[]",
415129
- components: [
415130
- { name: "token", internalType: "address", type: "address" },
415131
- { name: "callData", internalType: "bytes", type: "bytes" }
415132
- ]
415133
- }
415134
- ],
414511
+ inputs: [{ name: "borrower", internalType: "address", type: "address" }],
415135
414512
  name: "getCreditAccountsByBorrower",
415136
414513
  outputs: [
415137
414514
  {
@@ -415206,102 +414583,12 @@ var iDataCompressorV3Abi = [
415206
414583
  ]
415207
414584
  }
415208
414585
  ],
415209
- stateMutability: "nonpayable"
415210
- },
415211
- {
415212
- type: "function",
415213
- inputs: [
415214
- { name: "creditManager", internalType: "address", type: "address" },
415215
- {
415216
- name: "priceUpdates",
415217
- internalType: "struct PriceOnDemand[]",
415218
- type: "tuple[]",
415219
- components: [
415220
- { name: "token", internalType: "address", type: "address" },
415221
- { name: "callData", internalType: "bytes", type: "bytes" }
415222
- ]
415223
- }
415224
- ],
415225
- name: "getCreditAccountsByCreditManager",
415226
- outputs: [
415227
- {
415228
- name: "",
415229
- internalType: "struct CreditAccountData[]",
415230
- type: "tuple[]",
415231
- components: [
415232
- { name: "isSuccessful", internalType: "bool", type: "bool" },
415233
- {
415234
- name: "priceFeedsNeeded",
415235
- internalType: "address[]",
415236
- type: "address[]"
415237
- },
415238
- { name: "addr", internalType: "address", type: "address" },
415239
- { name: "borrower", internalType: "address", type: "address" },
415240
- { name: "creditManager", internalType: "address", type: "address" },
415241
- { name: "cmName", internalType: "string", type: "string" },
415242
- { name: "creditFacade", internalType: "address", type: "address" },
415243
- { name: "underlying", internalType: "address", type: "address" },
415244
- { name: "debt", internalType: "uint256", type: "uint256" },
415245
- {
415246
- name: "cumulativeIndexLastUpdate",
415247
- internalType: "uint256",
415248
- type: "uint256"
415249
- },
415250
- {
415251
- name: "cumulativeQuotaInterest",
415252
- internalType: "uint128",
415253
- type: "uint128"
415254
- },
415255
- { name: "accruedInterest", internalType: "uint256", type: "uint256" },
415256
- { name: "accruedFees", internalType: "uint256", type: "uint256" },
415257
- { name: "totalDebtUSD", internalType: "uint256", type: "uint256" },
415258
- { name: "totalValue", internalType: "uint256", type: "uint256" },
415259
- { name: "totalValueUSD", internalType: "uint256", type: "uint256" },
415260
- { name: "twvUSD", internalType: "uint256", type: "uint256" },
415261
- {
415262
- name: "enabledTokensMask",
415263
- internalType: "uint256",
415264
- type: "uint256"
415265
- },
415266
- { name: "healthFactor", internalType: "uint256", type: "uint256" },
415267
- { name: "baseBorrowRate", internalType: "uint256", type: "uint256" },
415268
- {
415269
- name: "aggregatedBorrowRate",
415270
- internalType: "uint256",
415271
- type: "uint256"
415272
- },
415273
- {
415274
- name: "balances",
415275
- internalType: "struct TokenBalance[]",
415276
- type: "tuple[]",
415277
- components: [
415278
- { name: "token", internalType: "address", type: "address" },
415279
- { name: "balance", internalType: "uint256", type: "uint256" },
415280
- { name: "isForbidden", internalType: "bool", type: "bool" },
415281
- { name: "isEnabled", internalType: "bool", type: "bool" },
415282
- { name: "isQuoted", internalType: "bool", type: "bool" },
415283
- { name: "quota", internalType: "uint256", type: "uint256" },
415284
- { name: "quotaRate", internalType: "uint16", type: "uint16" },
415285
- {
415286
- name: "quotaCumulativeIndexLU",
415287
- internalType: "uint256",
415288
- type: "uint256"
415289
- }
415290
- ]
415291
- },
415292
- { name: "since", internalType: "uint64", type: "uint64" },
415293
- { name: "cfVersion", internalType: "uint256", type: "uint256" },
415294
- { name: "expirationDate", internalType: "uint40", type: "uint40" },
415295
- { name: "activeBots", internalType: "address[]", type: "address[]" }
415296
- ]
415297
- }
415298
- ],
415299
- stateMutability: "nonpayable"
414586
+ stateMutability: "view"
415300
414587
  },
415301
414588
  {
415302
414589
  type: "function",
415303
414590
  inputs: [
415304
- { name: "creditManager", internalType: "address", type: "address" }
414591
+ { name: "_creditManager", internalType: "address", type: "address" }
415305
414592
  ],
415306
414593
  name: "getCreditManagerData",
415307
414594
  outputs: [
@@ -415433,7 +414720,7 @@ var iDataCompressorV3Abi = [
415433
414720
  {
415434
414721
  type: "function",
415435
414722
  inputs: [],
415436
- name: "getCreditManagersV3List",
414723
+ name: "getCreditManagersV2List",
415437
414724
  outputs: [
415438
414725
  {
415439
414726
  name: "",
@@ -415560,156 +414847,6 @@ var iDataCompressorV3Abi = [
415560
414847
  ],
415561
414848
  stateMutability: "view"
415562
414849
  },
415563
- {
415564
- type: "function",
415565
- inputs: [{ name: "staker", internalType: "address", type: "address" }],
415566
- name: "getGaugesV3Data",
415567
- outputs: [
415568
- {
415569
- name: "result",
415570
- internalType: "struct GaugeInfo[]",
415571
- type: "tuple[]",
415572
- components: [
415573
- { name: "addr", internalType: "address", type: "address" },
415574
- { name: "pool", internalType: "address", type: "address" },
415575
- { name: "symbol", internalType: "string", type: "string" },
415576
- { name: "name", internalType: "string", type: "string" },
415577
- { name: "underlying", internalType: "address", type: "address" },
415578
- { name: "currentEpoch", internalType: "uint16", type: "uint16" },
415579
- { name: "epochFrozen", internalType: "bool", type: "bool" },
415580
- {
415581
- name: "quotaParams",
415582
- internalType: "struct GaugeQuotaParams[]",
415583
- type: "tuple[]",
415584
- components: [
415585
- { name: "token", internalType: "address", type: "address" },
415586
- { name: "minRate", internalType: "uint16", type: "uint16" },
415587
- { name: "maxRate", internalType: "uint16", type: "uint16" },
415588
- {
415589
- name: "totalVotesLpSide",
415590
- internalType: "uint96",
415591
- type: "uint96"
415592
- },
415593
- {
415594
- name: "totalVotesCaSide",
415595
- internalType: "uint96",
415596
- type: "uint96"
415597
- },
415598
- { name: "rate", internalType: "uint16", type: "uint16" },
415599
- {
415600
- name: "quotaIncreaseFee",
415601
- internalType: "uint16",
415602
- type: "uint16"
415603
- },
415604
- { name: "totalQuoted", internalType: "uint96", type: "uint96" },
415605
- { name: "limit", internalType: "uint96", type: "uint96" },
415606
- { name: "isActive", internalType: "bool", type: "bool" },
415607
- {
415608
- name: "stakerVotesLpSide",
415609
- internalType: "uint96",
415610
- type: "uint96"
415611
- },
415612
- {
415613
- name: "stakerVotesCaSide",
415614
- internalType: "uint96",
415615
- type: "uint96"
415616
- }
415617
- ]
415618
- }
415619
- ]
415620
- }
415621
- ],
415622
- stateMutability: "view"
415623
- },
415624
- {
415625
- type: "function",
415626
- inputs: [
415627
- {
415628
- name: "priceUpdates",
415629
- internalType: "struct PriceOnDemand[]",
415630
- type: "tuple[]",
415631
- components: [
415632
- { name: "token", internalType: "address", type: "address" },
415633
- { name: "callData", internalType: "bytes", type: "bytes" }
415634
- ]
415635
- }
415636
- ],
415637
- name: "getLiquidatableCreditAccounts",
415638
- outputs: [
415639
- {
415640
- name: "result",
415641
- internalType: "struct CreditAccountData[]",
415642
- type: "tuple[]",
415643
- components: [
415644
- { name: "isSuccessful", internalType: "bool", type: "bool" },
415645
- {
415646
- name: "priceFeedsNeeded",
415647
- internalType: "address[]",
415648
- type: "address[]"
415649
- },
415650
- { name: "addr", internalType: "address", type: "address" },
415651
- { name: "borrower", internalType: "address", type: "address" },
415652
- { name: "creditManager", internalType: "address", type: "address" },
415653
- { name: "cmName", internalType: "string", type: "string" },
415654
- { name: "creditFacade", internalType: "address", type: "address" },
415655
- { name: "underlying", internalType: "address", type: "address" },
415656
- { name: "debt", internalType: "uint256", type: "uint256" },
415657
- {
415658
- name: "cumulativeIndexLastUpdate",
415659
- internalType: "uint256",
415660
- type: "uint256"
415661
- },
415662
- {
415663
- name: "cumulativeQuotaInterest",
415664
- internalType: "uint128",
415665
- type: "uint128"
415666
- },
415667
- { name: "accruedInterest", internalType: "uint256", type: "uint256" },
415668
- { name: "accruedFees", internalType: "uint256", type: "uint256" },
415669
- { name: "totalDebtUSD", internalType: "uint256", type: "uint256" },
415670
- { name: "totalValue", internalType: "uint256", type: "uint256" },
415671
- { name: "totalValueUSD", internalType: "uint256", type: "uint256" },
415672
- { name: "twvUSD", internalType: "uint256", type: "uint256" },
415673
- {
415674
- name: "enabledTokensMask",
415675
- internalType: "uint256",
415676
- type: "uint256"
415677
- },
415678
- { name: "healthFactor", internalType: "uint256", type: "uint256" },
415679
- { name: "baseBorrowRate", internalType: "uint256", type: "uint256" },
415680
- {
415681
- name: "aggregatedBorrowRate",
415682
- internalType: "uint256",
415683
- type: "uint256"
415684
- },
415685
- {
415686
- name: "balances",
415687
- internalType: "struct TokenBalance[]",
415688
- type: "tuple[]",
415689
- components: [
415690
- { name: "token", internalType: "address", type: "address" },
415691
- { name: "balance", internalType: "uint256", type: "uint256" },
415692
- { name: "isForbidden", internalType: "bool", type: "bool" },
415693
- { name: "isEnabled", internalType: "bool", type: "bool" },
415694
- { name: "isQuoted", internalType: "bool", type: "bool" },
415695
- { name: "quota", internalType: "uint256", type: "uint256" },
415696
- { name: "quotaRate", internalType: "uint16", type: "uint16" },
415697
- {
415698
- name: "quotaCumulativeIndexLU",
415699
- internalType: "uint256",
415700
- type: "uint256"
415701
- }
415702
- ]
415703
- },
415704
- { name: "since", internalType: "uint64", type: "uint64" },
415705
- { name: "cfVersion", internalType: "uint256", type: "uint256" },
415706
- { name: "expirationDate", internalType: "uint40", type: "uint40" },
415707
- { name: "activeBots", internalType: "address[]", type: "address[]" }
415708
- ]
415709
- }
415710
- ],
415711
- stateMutability: "nonpayable"
415712
- },
415713
414850
  {
415714
414851
  type: "function",
415715
414852
  inputs: [{ name: "_pool", internalType: "address", type: "address" }],
@@ -415844,7 +414981,7 @@ var iDataCompressorV3Abi = [
415844
414981
  {
415845
414982
  type: "function",
415846
414983
  inputs: [],
415847
- name: "getPoolsV3List",
414984
+ name: "getPoolsV1List",
415848
414985
  outputs: [
415849
414986
  {
415850
414987
  name: "",
@@ -415972,6 +415109,16 @@ var iDataCompressorV3Abi = [
415972
415109
  ],
415973
415110
  stateMutability: "view"
415974
415111
  },
415112
+ {
415113
+ type: "function",
415114
+ inputs: [
415115
+ { name: "creditManager", internalType: "address", type: "address" },
415116
+ { name: "borrower", internalType: "address", type: "address" }
415117
+ ],
415118
+ name: "hasOpenedCreditAccount",
415119
+ outputs: [{ name: "", internalType: "bool", type: "bool" }],
415120
+ stateMutability: "view"
415121
+ },
415975
415122
  {
415976
415123
  type: "function",
415977
415124
  inputs: [],
@@ -425096,7 +424243,7 @@ function normalizeTransactions(batch) {
425096
424243
  });
425097
424244
  }
425098
424245
  function normalizeDirectTx(t) {
425099
- const abi49 = [
424246
+ const abi50 = [
425100
424247
  {
425101
424248
  type: "function",
425102
424249
  outputs: [],
@@ -425118,10 +424265,10 @@ function normalizeDirectTx(t) {
425118
424265
  return {
425119
424266
  target: t.to,
425120
424267
  value: t.value,
425121
- signature: formatAbiItem2(abi49[0], { includeName: false }),
424268
+ signature: formatAbiItem2(abi50[0], { includeName: false }),
425122
424269
  parameters,
425123
424270
  data: encodeFunctionData({
425124
- abi: abi49,
424271
+ abi: abi50,
425125
424272
  functionName: t.contractMethod.name,
425126
424273
  args: values
425127
424274
  })
@@ -429602,101 +428749,6 @@ async function migrateFaucet(sdk, faucet) {
429602
428749
  });
429603
428750
  }
429604
428751
 
429605
- // ../../node_modules/@gearbox-protocol/sdk/dist/esm/dev/setLTZero.js
429606
- async function setLTZero(anvil, cm, logger2) {
429607
- const aclAddr = await anvil.readContract({
429608
- address: cm.creditConfigurator,
429609
- abi: iaclTraitAbi,
429610
- functionName: "acl"
429611
- });
429612
- const configuratorAddr = await anvil.readContract({
429613
- address: aclAddr,
429614
- abi: iOwnableAbi,
429615
- functionName: "owner"
429616
- });
429617
- await anvil.impersonateAccount({
429618
- address: configuratorAddr
429619
- });
429620
- await anvil.setBalance({
429621
- address: configuratorAddr,
429622
- value: parseEther("100")
429623
- });
429624
- let hash2 = await anvil.writeContract({
429625
- chain: anvil.chain,
429626
- address: cm.creditConfigurator,
429627
- account: configuratorAddr,
429628
- abi: iCreditConfiguratorV300Abi,
429629
- functionName: "setFees",
429630
- args: [
429631
- cm.feeInterest,
429632
- cm.liquidationDiscount - 1,
429633
- Number(PERCENTAGE_FACTOR) - cm.liquidationDiscount,
429634
- cm.feeLiquidationExpired,
429635
- cm.liquidationDiscountExpired
429636
- ]
429637
- });
429638
- await anvil.waitForTransactionReceipt({ hash: hash2 });
429639
- logger2?.debug(`[${cm.name}] setFees part 2`);
429640
- hash2 = await anvil.writeContract({
429641
- chain: anvil.chain,
429642
- address: cm.creditConfigurator,
429643
- account: configuratorAddr,
429644
- abi: iCreditConfiguratorV300Abi,
429645
- functionName: "setFees",
429646
- args: [
429647
- cm.feeInterest,
429648
- cm.feeLiquidation,
429649
- Number(PERCENTAGE_FACTOR) - cm.liquidationDiscount,
429650
- cm.feeLiquidationExpired,
429651
- cm.liquidationDiscountExpired
429652
- ]
429653
- });
429654
- await anvil.waitForTransactionReceipt({ hash: hash2 });
429655
- logger2?.debug(`[${cm.name}] setFees done`);
429656
- await anvil.impersonateAccount({
429657
- address: cm.creditConfigurator
429658
- });
429659
- await anvil.setBalance({
429660
- address: cm.creditConfigurator,
429661
- value: parseEther("100")
429662
- });
429663
- logger2?.debug(
429664
- `[${cm.name}] impresonating creditConfigurator ${cm.creditConfigurator}`
429665
- );
429666
- logger2?.debug(`[${cm.name}] setting liquidation threshold`);
429667
- hash2 = await anvil.writeContract({
429668
- chain: anvil.chain,
429669
- address: cm.baseParams.addr,
429670
- account: cm.creditConfigurator,
429671
- abi: iCreditManagerV300Abi,
429672
- functionName: "setCollateralTokenData",
429673
- args: [cm.underlying, 1, 1, Number(2n ** 40n - 1n), 0]
429674
- });
429675
- await anvil.waitForTransactionReceipt({ hash: hash2 });
429676
- logger2?.debug(`[${cm.name}] setting configurator ${cm.creditConfigurator}`);
429677
- hash2 = await anvil.writeContract({
429678
- chain: anvil.chain,
429679
- address: cm.baseParams.addr,
429680
- account: cm.creditConfigurator,
429681
- abi: iCreditManagerV300Abi,
429682
- functionName: "setCreditConfigurator",
429683
- args: [cm.creditConfigurator]
429684
- });
429685
- await anvil.waitForTransactionReceipt({ hash: hash2 });
429686
- logger2?.debug(`[${cm.name}] done`);
429687
- await anvil.stopImpersonatingAccount({
429688
- address: cm.creditConfigurator
429689
- });
429690
- await anvil.stopImpersonatingAccount({ address: configuratorAddr });
429691
- const lt = await anvil.readContract({
429692
- address: cm.baseParams.addr,
429693
- abi: iCreditManagerV300Abi,
429694
- functionName: "liquidationThresholds",
429695
- args: [cm.underlying]
429696
- });
429697
- logger2?.debug(`[${cm.name}] underlying lt: ${lt}`);
429698
- }
429699
-
429700
428752
  // ../../packages/node/dist/ProviderBase.js
429701
428753
  var NetworkMismatchError = class extends Error {
429702
428754
  constructor(expected, received) {
@@ -430170,7 +429222,7 @@ var GEARBOX_V1_BLOCK = 13810899;
430170
429222
  // ../../packages/node/dist/Verifier.js
430171
429223
  var import_bytecode_utils2 = __toESM(require_main(), 1);
430172
429224
  var import_lib_sourcify = __toESM(require_main2(), 1);
430173
- var import_abi45 = __toESM(require_lib13(), 1);
429225
+ var import_abi44 = __toESM(require_lib13(), 1);
430174
429226
  var Verifier = class {
430175
429227
  logger;
430176
429228
  constructor() {
@@ -430245,8 +429297,8 @@ var Verifier = class {
430245
429297
  error: `Failed to match with creation bytecode: constructor ABI Inputs are missing`
430246
429298
  };
430247
429299
  }
430248
- const decodeResult = import_abi45.defaultAbiCoder.decode(constructorAbiParamInputs, abiEncodedConstructorArguments);
430249
- const encodeResult = import_abi45.defaultAbiCoder.encode(constructorAbiParamInputs, decodeResult);
429300
+ const decodeResult = import_abi44.defaultAbiCoder.decode(constructorAbiParamInputs, abiEncodedConstructorArguments);
429301
+ const encodeResult = import_abi44.defaultAbiCoder.encode(constructorAbiParamInputs, decodeResult);
430250
429302
  if (encodeResult !== abiEncodedConstructorArguments) {
430251
429303
  return {
430252
429304
  ...result,
@@ -432165,9 +431217,9 @@ var AbstractParser = class {
432165
431217
  };
432166
431218
  }
432167
431219
  parseConstructor(address, encodedArgs) {
432168
- for (const { abi: abi49, comment } of this.constructorAbis) {
431220
+ for (const { abi: abi50, comment } of this.constructorAbis) {
432169
431221
  try {
432170
- return this.#parseConstructor(address, encodedArgs, abi49, comment);
431222
+ return this.#parseConstructor(address, encodedArgs, abi50, comment);
432171
431223
  } catch (e) {
432172
431224
  this.logger.warn(`constructor ${comment} of ${address} failed to parse args: ${e}`);
432173
431225
  }
@@ -434853,37 +433905,6 @@ var UpdateParser = class extends ProviderBase {
434853
433905
  }
434854
433906
  };
434855
433907
 
434856
- // ../../packages/node/dist/ZeroLT.js
434857
- var ZeroLT = class extends ProviderBase {
434858
- async setLtZero(opts) {
434859
- this.logger.info(`running zero lt script on ${opts.cm ?? "all managers"}`);
434860
- await this.init();
434861
- const dc300Addr = await this.client.readContract({
434862
- address: this.address("ADDRESS_PROVIDER"),
434863
- abi: iAddressProviderV3Abi,
434864
- functionName: "getAddressOrRevert",
434865
- args: [stringToHex("DATA_COMPRESSOR", { size: 32 }), 300n]
434866
- });
434867
- this.logger.debug(`data compressor: ${dc300Addr}`);
434868
- const cms = await this.client.readContract({
434869
- address: dc300Addr,
434870
- abi: iDataCompressorV3Abi,
434871
- functionName: "getCreditManagersV3List"
434872
- });
434873
- this.logger.debug(`total managers: ${cms.length}`);
434874
- for (const cm of cms) {
434875
- await setLTZero(this.client, {
434876
- ...cm,
434877
- // fake v3.0 to v3.1 compatibility
434878
- baseParams: {
434879
- addr: cm.addr
434880
- }
434881
- }, this.logger);
434882
- }
434883
- this.logger.info("zero lt finished");
434884
- }
434885
- };
434886
-
434887
433908
  // src/commands/option-parsers.ts
434888
433909
  function parseBigInt(value, _prev) {
434889
433910
  try {
@@ -436553,6 +435574,7 @@ var YearnV2RouterAdapterContract = class extends AbstractAdapterContract {
436553
435574
  // ../../node_modules/@gearbox-protocol/sdk/dist/esm/adapters/AdaptersPlugin.js
436554
435575
  var AdaptersPlugin = class extends SDKConstruct {
436555
435576
  name = "Adapters";
435577
+ version = 1;
436556
435578
  createContract(data) {
436557
435579
  const args = data;
436558
435580
  const adapterType = bytes32ToString(
@@ -436620,6 +435642,13 @@ var AdaptersPlugin = class extends SDKConstruct {
436620
435642
  stateHuman(_) {
436621
435643
  return {};
436622
435644
  }
435645
+ get state() {
435646
+ return {
435647
+ version: this.version
435648
+ };
435649
+ }
435650
+ hydrate(_) {
435651
+ }
436623
435652
  };
436624
435653
 
436625
435654
  // src/commands/open-accounts.ts
@@ -436833,7 +435862,7 @@ function getRenderer(opts) {
436833
435862
  var package_default = {
436834
435863
  name: "@gearbox-protocol/deploy-tools",
436835
435864
  description: "Gearbox deploy tools",
436836
- version: "5.28.14",
435865
+ version: "5.29.1",
436837
435866
  homepage: "https://gearbox.fi",
436838
435867
  keywords: [
436839
435868
  "gearbox"
@@ -436871,24 +435900,24 @@ var package_default = {
436871
435900
  "@actions/core": "^1.11.1",
436872
435901
  "@chialab/esbuild-plugin-commonjs": "^0.18.0",
436873
435902
  "@commander-js/extra-typings": "^13.1.0",
436874
- "@ethereum-sourcify/bytecode-utils": "^1.3.5",
435903
+ "@ethereum-sourcify/bytecode-utils": "^1.3.6",
436875
435904
  "@ethereum-sourcify/lib-sourcify": "^1.12.1",
436876
435905
  "@gearbox-protocol/deploy-tools-node": "0.0.0",
436877
435906
  "@gearbox-protocol/deploy-tools-shared": "0.0.0",
436878
435907
  "@gearbox-protocol/deploy-tools-types": "0.0.0",
436879
- "@gearbox-protocol/sdk": "^4.1.8",
435908
+ "@gearbox-protocol/sdk": "5.0.0",
436880
435909
  "@gearbox-protocol/sdk-gov": "^2.37.0",
436881
435910
  "@types/lodash-es": "^4.17.12",
436882
- "@types/node": "^22.14.1",
436883
- "@types/react": "^19.1.2",
435911
+ "@types/node": "^22.15.12",
435912
+ "@types/react": "^19.1.3",
436884
435913
  "@types/react-dom": "^19.1.3",
436885
435914
  abitype: "^1.0.8",
436886
435915
  chalk: "^5.4.1",
436887
435916
  commander: "^13.0.0",
436888
435917
  "date-fns": "^4.1.0",
436889
435918
  dotenv: "^16.5.0",
436890
- esbuild: "^0.25.2",
436891
- "lint-staged": "^15.5.1",
435919
+ esbuild: "^0.25.4",
435920
+ "lint-staged": "^15.5.2",
436892
435921
  "lodash-es": "^4.17.21",
436893
435922
  "p-retry": "^6.2.1",
436894
435923
  pino: "^9.6.0",
@@ -436898,9 +435927,9 @@ var package_default = {
436898
435927
  "react-dom": "^19.1.0",
436899
435928
  table: "^6.9.0",
436900
435929
  tsx: "^4.19.4",
436901
- viem: "^2.28.3",
435930
+ viem: "^2.29.0",
436902
435931
  yaml: "^2.7.1",
436903
- zod: "^3.24.3"
435932
+ zod: "^3.24.4"
436904
435933
  },
436905
435934
  prettier: "@gearbox-protocol/prettier-config",
436906
435935
  "lint-staged": {
@@ -437238,27 +436267,181 @@ var iPartialLiquidationBotV300Abi = [
437238
436267
  { type: "error", name: "UnderlyingNotLiquidatableException", inputs: [] }
437239
436268
  ];
437240
436269
 
437241
- // ../../node_modules/@gearbox-protocol/sdk/dist/esm/bots/PartialLiquidationBotV300Contract.js
437242
- var abi48 = iPartialLiquidationBotV300Abi;
437243
- var PartialLiquidationBotV300Contract = class extends BaseContract {
436270
+ // ../../node_modules/@gearbox-protocol/sdk/dist/esm/bots/abi/iPartialLiquidationBotV310.js
436271
+ var iPartialLiquidationBotV310Abi = [
436272
+ {
436273
+ type: "function",
436274
+ name: "contractType",
436275
+ inputs: [],
436276
+ outputs: [{ name: "", type: "bytes32", internalType: "bytes32" }],
436277
+ stateMutability: "view"
436278
+ },
436279
+ {
436280
+ type: "function",
436281
+ name: "feeScaleFactor",
436282
+ inputs: [],
436283
+ outputs: [{ name: "", type: "uint16", internalType: "uint16" }],
436284
+ stateMutability: "view"
436285
+ },
436286
+ {
436287
+ type: "function",
436288
+ name: "maxHealthFactor",
436289
+ inputs: [],
436290
+ outputs: [{ name: "", type: "uint16", internalType: "uint16" }],
436291
+ stateMutability: "view"
436292
+ },
436293
+ {
436294
+ type: "function",
436295
+ name: "minHealthFactor",
436296
+ inputs: [],
436297
+ outputs: [{ name: "", type: "uint16", internalType: "uint16" }],
436298
+ stateMutability: "view"
436299
+ },
436300
+ {
436301
+ type: "function",
436302
+ name: "partiallyLiquidate",
436303
+ inputs: [
436304
+ { name: "creditAccount", type: "address", internalType: "address" },
436305
+ { name: "token", type: "address", internalType: "address" },
436306
+ { name: "repaidAmount", type: "uint256", internalType: "uint256" },
436307
+ { name: "minSeizedAmount", type: "uint256", internalType: "uint256" },
436308
+ { name: "to", type: "address", internalType: "address" },
436309
+ {
436310
+ name: "priceUpdates",
436311
+ type: "tuple[]",
436312
+ internalType: "struct PriceUpdate[]",
436313
+ components: [
436314
+ { name: "priceFeed", type: "address", internalType: "address" },
436315
+ { name: "data", type: "bytes", internalType: "bytes" }
436316
+ ]
436317
+ }
436318
+ ],
436319
+ outputs: [
436320
+ { name: "seizedAmount", type: "uint256", internalType: "uint256" }
436321
+ ],
436322
+ stateMutability: "nonpayable"
436323
+ },
436324
+ {
436325
+ type: "function",
436326
+ name: "premiumScaleFactor",
436327
+ inputs: [],
436328
+ outputs: [{ name: "", type: "uint16", internalType: "uint16" }],
436329
+ stateMutability: "view"
436330
+ },
436331
+ {
436332
+ type: "function",
436333
+ name: "requiredPermissions",
436334
+ inputs: [],
436335
+ outputs: [{ name: "", type: "uint192", internalType: "uint192" }],
436336
+ stateMutability: "view"
436337
+ },
436338
+ {
436339
+ type: "function",
436340
+ name: "serialize",
436341
+ inputs: [],
436342
+ outputs: [{ name: "serializedData", type: "bytes", internalType: "bytes" }],
436343
+ stateMutability: "view"
436344
+ },
436345
+ {
436346
+ type: "function",
436347
+ name: "treasury",
436348
+ inputs: [],
436349
+ outputs: [{ name: "", type: "address", internalType: "address" }],
436350
+ stateMutability: "view"
436351
+ },
436352
+ {
436353
+ type: "function",
436354
+ name: "version",
436355
+ inputs: [],
436356
+ outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
436357
+ stateMutability: "view"
436358
+ },
436359
+ {
436360
+ type: "event",
436361
+ name: "PartiallyLiquidate",
436362
+ inputs: [
436363
+ {
436364
+ name: "creditManager",
436365
+ type: "address",
436366
+ indexed: true,
436367
+ internalType: "address"
436368
+ },
436369
+ {
436370
+ name: "creditAccount",
436371
+ type: "address",
436372
+ indexed: true,
436373
+ internalType: "address"
436374
+ },
436375
+ {
436376
+ name: "token",
436377
+ type: "address",
436378
+ indexed: true,
436379
+ internalType: "address"
436380
+ },
436381
+ {
436382
+ name: "liquidator",
436383
+ type: "address",
436384
+ indexed: false,
436385
+ internalType: "address"
436386
+ },
436387
+ {
436388
+ name: "repaidDebt",
436389
+ type: "uint256",
436390
+ indexed: false,
436391
+ internalType: "uint256"
436392
+ },
436393
+ {
436394
+ name: "seizedCollateral",
436395
+ type: "uint256",
436396
+ indexed: false,
436397
+ internalType: "uint256"
436398
+ },
436399
+ { name: "fee", type: "uint256", indexed: false, internalType: "uint256" }
436400
+ ],
436401
+ anonymous: false
436402
+ },
436403
+ { type: "error", name: "LiquidatedLessThanNeededException", inputs: [] },
436404
+ { type: "error", name: "LiquidatedMoreThanNeededException", inputs: [] },
436405
+ { type: "error", name: "SeizedLessThanRequiredException", inputs: [] },
436406
+ { type: "error", name: "UnderlyingNotLiquidatableException", inputs: [] }
436407
+ ];
436408
+
436409
+ // ../../node_modules/@gearbox-protocol/sdk/dist/esm/bots/PartialLiquidationBotBaseContract.js
436410
+ var PartialLiquidationBotBaseContract = class extends BaseContract {
437244
436411
  requiredPermissions;
437245
- botType;
437246
436412
  marketConfigurator;
437247
- constructor(sdk, args, params, type, marketConfigurator) {
437248
- super(sdk, {
437249
- abi: abi48,
437250
- ...args.baseParams,
437251
- name: `PartialLiquidationBotV300 (${type})`
437252
- });
437253
- this.marketConfigurator = marketConfigurator;
436413
+ #serializedParams;
436414
+ constructor(sdk, args) {
436415
+ super(sdk, args);
436416
+ this.#serializedParams = args.serializedParams;
436417
+ const [
436418
+ treasury,
436419
+ minHealthFactor,
436420
+ maxHealthFactor,
436421
+ premiumScaleFactor,
436422
+ feeScaleFactor
436423
+ ] = decodeAbiParameters(
436424
+ [
436425
+ { name: "treasury", type: "address" },
436426
+ { name: "minHealthFactor", type: "uint16" },
436427
+ { name: "maxHealthFactor", type: "uint16" },
436428
+ { name: "premiumScaleFactor", type: "uint16" },
436429
+ { name: "feeScaleFactor", type: "uint16" }
436430
+ ],
436431
+ args.serializedParams
436432
+ );
436433
+ this.treasury = treasury;
436434
+ this.minHealthFactor = minHealthFactor;
436435
+ this.maxHealthFactor = maxHealthFactor;
436436
+ this.premiumScaleFactor = premiumScaleFactor;
436437
+ this.feeScaleFactor = feeScaleFactor;
436438
+ this.marketConfigurator = args.marketConfigurator;
437254
436439
  this.requiredPermissions = args.requiredPermissions;
437255
- Object.assign(this, params);
437256
- this.botType = type;
437257
436440
  }
437258
436441
  stateHuman(raw) {
437259
436442
  return {
437260
436443
  ...super.stateHuman(raw),
437261
- botType: this.botType,
436444
+ treasury: this.treasury,
437262
436445
  minHealthFactor: formatPercentage(this.minHealthFactor),
437263
436446
  maxHealthFactor: formatPercentage(this.maxHealthFactor),
437264
436447
  premiumScaleFactor: formatPercentage(this.premiumScaleFactor),
@@ -437266,6 +436449,69 @@ var PartialLiquidationBotV300Contract = class extends BaseContract {
437266
436449
  requiredPermissions: this.requiredPermissions.toString(10)
437267
436450
  };
437268
436451
  }
436452
+ get state() {
436453
+ return {
436454
+ baseParams: {
436455
+ addr: this.address,
436456
+ version: BigInt(this.version),
436457
+ contractType: this.contractType,
436458
+ serializedParams: this.#serializedParams
436459
+ },
436460
+ requiredPermissions: this.requiredPermissions
436461
+ };
436462
+ }
436463
+ };
436464
+
436465
+ // ../../node_modules/@gearbox-protocol/sdk/dist/esm/bots/PartialLiquidationBotV300Contract.js
436466
+ var abi48 = iPartialLiquidationBotV300Abi;
436467
+ var PartialLiquidationBotV300Contract = class extends PartialLiquidationBotBaseContract {
436468
+ #botType;
436469
+ constructor(sdk, args, marketConfigurator) {
436470
+ super(sdk, {
436471
+ abi: abi48,
436472
+ ...args.baseParams,
436473
+ requiredPermissions: args.requiredPermissions,
436474
+ marketConfigurator,
436475
+ name: "PartialLiquidationBotV300"
436476
+ });
436477
+ }
436478
+ stateHuman(raw) {
436479
+ return {
436480
+ ...super.stateHuman(raw),
436481
+ botType: this.botType
436482
+ };
436483
+ }
436484
+ /**
436485
+ * Set the bot type
436486
+ * This method should only be called once from BotsPlugin
436487
+ */
436488
+ set botType(type) {
436489
+ if (this.#botType) {
436490
+ throw new Error("bot type already set");
436491
+ }
436492
+ this.#botType = type;
436493
+ this.name = `PartialLiquidationBotV300 (${type})`;
436494
+ }
436495
+ get botType() {
436496
+ if (!this.#botType) {
436497
+ throw new Error("bot type not set");
436498
+ }
436499
+ return this.#botType;
436500
+ }
436501
+ };
436502
+
436503
+ // ../../node_modules/@gearbox-protocol/sdk/dist/esm/bots/PartialLiquidationBotV310Contract.js
436504
+ var abi49 = iPartialLiquidationBotV310Abi;
436505
+ var PartialLiquidationBotV310Contract = class extends PartialLiquidationBotBaseContract {
436506
+ constructor(sdk, args, marketConfigurator) {
436507
+ super(sdk, {
436508
+ abi: abi49,
436509
+ ...args.baseParams,
436510
+ requiredPermissions: args.requiredPermissions,
436511
+ marketConfigurator,
436512
+ name: "PartialLiquidationBotV310"
436513
+ });
436514
+ }
437269
436515
  };
437270
436516
 
437271
436517
  // ../../node_modules/@gearbox-protocol/sdk/dist/esm/bots/types.js
@@ -437277,17 +436523,9 @@ var BOT_TYPES = [
437277
436523
  ];
437278
436524
 
437279
436525
  // ../../node_modules/@gearbox-protocol/sdk/dist/esm/bots/BotsPlugin.js
437280
- var UnsupportedBotVersionError = class extends Error {
437281
- state;
437282
- constructor(state) {
437283
- super(
437284
- `unsupported bot version ${state.baseParams.version} for bot at ${state.baseParams.addr}`
437285
- );
437286
- this.state = state;
437287
- }
437288
- };
437289
436526
  var BotsPlugin = class extends SDKConstruct {
437290
436527
  #logger;
436528
+ version = 1;
437291
436529
  #botsByMarket = new AddressMap();
437292
436530
  constructor(sdk) {
437293
436531
  super(sdk);
@@ -437307,9 +436545,9 @@ var BotsPlugin = class extends SDKConstruct {
437307
436545
  }
437308
436546
  async #load() {
437309
436547
  this.#botsByMarket.clear();
437310
- const pcAddr = this.sdk.addressProvider.getAddress(
436548
+ const [pcAddr] = this.sdk.addressProvider.mustGetLatest(
437311
436549
  AP_PERIPHERY_COMPRESSOR,
437312
- 310
436550
+ VERSION_RANGE_310
437313
436551
  );
437314
436552
  this.#logger?.debug(`loading bots with periphery compressor ${pcAddr}`);
437315
436553
  const mcs = this.sdk.marketRegister.marketConfigurators.map(
@@ -437326,106 +436564,23 @@ var BotsPlugin = class extends SDKConstruct {
437326
436564
  ),
437327
436565
  allowFailure: false
437328
436566
  });
437329
- const botsByMcV300 = {};
437330
436567
  for (let i = 0; i < mcs.length; i++) {
437331
436568
  const mc = mcs[i];
437332
436569
  const marketBotData = botsData[i];
437333
- const marketBotsV300 = [];
437334
- for (const bot of marketBotData) {
437335
- if (bot.baseParams.version === 300n) {
437336
- marketBotsV300.push(bot);
437337
- } else {
437338
- this.#logger?.warn(new UnsupportedBotVersionError(bot));
437339
- }
437340
- }
437341
- if (marketBotsV300.length === 4) {
437342
- botsByMcV300[mc] = marketBotsV300;
437343
- } else if (marketBotsV300.length > 0) {
437344
- this.#logger?.warn(
437345
- `each market configurator should have 4 v300 bots, but ${mc} has ${marketBotsV300.length}`
437346
- );
437347
- }
437348
- }
437349
- const botAddrsV300 = Object.values(botsByMcV300).flatMap(
437350
- (b) => b.map((b2) => b2.baseParams.addr)
437351
- );
437352
- this.#logger?.debug(`loaded ${botAddrsV300.length} v300 bots`);
437353
- const params = await this.#getBotsV300Parameters(botAddrsV300);
437354
- for (const [mc, botStates] of TypedObjectUtils.entries(botsByMcV300)) {
437355
- this.#botsByMarket.upsert(
437356
- mc,
437357
- botStates.map((state, i) => ({
437358
- state,
437359
- params: params[state.baseParams.addr],
437360
- type: BOT_TYPES[i]
437361
- })).sort((a, b) => a.params.minHealthFactor - b.params.minHealthFactor).map(
437362
- ({ state, params: params2, type }) => new PartialLiquidationBotV300Contract(
437363
- this.sdk,
437364
- state,
437365
- params2,
437366
- type,
437367
- mc
437368
- )
437369
- )
437370
- );
436570
+ this.#loadStateMarketState(mc, marketBotData);
437371
436571
  }
437372
436572
  }
437373
- async #getBotsV300Parameters(addresses) {
437374
- if (addresses.length === 0) {
437375
- return {};
436573
+ #loadStateMarketState(mc, state) {
436574
+ const bots = state.map((state2) => this.#createBot(mc, state2)).sort((a, b) => a.minHealthFactor - b.minHealthFactor);
436575
+ if (bots.length && isV300(Number(bots[0].version))) {
436576
+ if (bots.length !== 4) {
436577
+ throw new Error(`expected 4 bots v300 for market configurator ${mc}`);
436578
+ }
436579
+ for (let i = 0; i < bots.length; i++) {
436580
+ bots[i].botType = BOT_TYPES[i];
436581
+ }
437376
436582
  }
437377
- const BOT_INFO_LENGTH = 4;
437378
- const resp = await this.provider.publicClient.multicall({
437379
- allowFailure: false,
437380
- contracts: addresses.map(
437381
- (address) => [
437382
- {
437383
- address,
437384
- abi: iPartialLiquidationBotV300Abi,
437385
- functionName: "minHealthFactor",
437386
- args: []
437387
- },
437388
- {
437389
- address,
437390
- abi: iPartialLiquidationBotV300Abi,
437391
- functionName: "maxHealthFactor",
437392
- args: []
437393
- },
437394
- {
437395
- address,
437396
- abi: iPartialLiquidationBotV300Abi,
437397
- functionName: "premiumScaleFactor",
437398
- args: []
437399
- },
437400
- {
437401
- address,
437402
- abi: iPartialLiquidationBotV300Abi,
437403
- functionName: "feeScaleFactor",
437404
- args: []
437405
- }
437406
- ]
437407
- ).flat(1)
437408
- });
437409
- return addresses.reduce(
437410
- (acc, address, index2) => {
437411
- const from5 = index2 * BOT_INFO_LENGTH;
437412
- const to = (index2 + 1) * BOT_INFO_LENGTH;
437413
- const [
437414
- minHealthFactor,
437415
- maxHealthFactor,
437416
- premiumScaleFactor,
437417
- feeScaleFactor
437418
- ] = resp.slice(from5, to);
437419
- acc[address] = {
437420
- minHealthFactor,
437421
- maxHealthFactor,
437422
- premiumScaleFactor,
437423
- feeScaleFactor
437424
- };
437425
- return acc;
437426
- },
437427
- {}
437428
- );
436583
+ this.#botsByMarket.upsert(mc, bots);
437429
436584
  }
437430
436585
  stateHuman(raw) {
437431
436586
  return {
@@ -437437,31 +436592,66 @@ var BotsPlugin = class extends SDKConstruct {
437437
436592
  )
437438
436593
  };
437439
436594
  }
436595
+ get state() {
436596
+ return {
436597
+ version: this.version,
436598
+ bots: TypedObjectUtils.fromEntries(
436599
+ this.#botsByMarket.entries().map(([mc, bots]) => [mc, bots.map((b) => b.state)])
436600
+ )
436601
+ };
436602
+ }
436603
+ hydrate(state) {
436604
+ this.#botsByMarket.clear();
436605
+ for (const [mc, botStates] of TypedObjectUtils.entries(state.bots)) {
436606
+ this.#loadStateMarketState(mc, botStates);
436607
+ }
436608
+ }
436609
+ #createBot(marketConfigurator, data) {
436610
+ const v = Number(data.baseParams.version);
436611
+ if (isV300(v)) {
436612
+ return new PartialLiquidationBotV300Contract(
436613
+ this.sdk,
436614
+ data,
436615
+ marketConfigurator
436616
+ );
436617
+ } else if (isV310(v)) {
436618
+ return new PartialLiquidationBotV310Contract(
436619
+ this.sdk,
436620
+ data,
436621
+ marketConfigurator
436622
+ );
436623
+ } else {
436624
+ throw new Error(`unsupported bot version: ${v}`);
436625
+ }
436626
+ }
437440
436627
  };
437441
436628
 
437442
436629
  // ../../node_modules/@gearbox-protocol/sdk/dist/esm/zappers/ZappersPlugin.js
437443
436630
  var ZappersPlugin = class extends SDKConstruct {
437444
436631
  #zappers;
436632
+ version = 1;
437445
436633
  async attach() {
437446
436634
  await this.loadZappers();
437447
436635
  }
437448
436636
  async loadZappers() {
437449
436637
  this.#zappers = new AddressMap(void 0, "zappers");
437450
- const pcAddr = this.sdk.addressProvider.getAddress(
436638
+ const [pcAddr] = this.sdk.addressProvider.mustGetLatest(
437451
436639
  AP_PERIPHERY_COMPRESSOR,
437452
- 310
436640
+ VERSION_RANGE_310
437453
436641
  );
437454
436642
  this.sdk.logger?.debug(
437455
436643
  `loading zappers with periphery compressor ${pcAddr}`
437456
436644
  );
437457
436645
  const markets = this.sdk.marketRegister.markets;
437458
436646
  const resp = await this.provider.publicClient.multicall({
437459
- contracts: markets.map((m) => ({
437460
- abi: iPeripheryCompressorAbi,
437461
- address: pcAddr,
437462
- functionName: "getZappers",
437463
- args: [m.configurator.address, m.pool.pool.address]
437464
- })),
436647
+ contracts: markets.map(
436648
+ (m) => ({
436649
+ abi: iPeripheryCompressorAbi,
436650
+ address: pcAddr,
436651
+ functionName: "getZappers",
436652
+ args: [m.configurator.address, m.pool.pool.address]
436653
+ })
436654
+ ),
437465
436655
  allowFailure: true
437466
436656
  });
437467
436657
  for (let i = 0; i < resp.length; i++) {
@@ -437469,10 +436659,9 @@ var ZappersPlugin = class extends SDKConstruct {
437469
436659
  const marketConfigurator = markets[i].configurator.address;
437470
436660
  const pool = markets[i].pool.pool.address;
437471
436661
  if (status === "success") {
437472
- const list = result;
437473
436662
  this.#zappers.upsert(
437474
436663
  pool,
437475
- list.map((z2) => ({ ...z2, pool }))
436664
+ result.map((z2) => ({ ...z2, pool }))
437476
436665
  );
437477
436666
  } else {
437478
436667
  this.sdk.logger?.error(
@@ -437480,11 +436669,7 @@ var ZappersPlugin = class extends SDKConstruct {
437480
436669
  );
437481
436670
  }
437482
436671
  }
437483
- const zappersTokens = this.#zappers.values().flatMap((l) => l.flatMap((z2) => [z2.tokenIn, z2.tokenOut]));
437484
- for (const t of zappersTokens) {
437485
- this.sdk.tokensMeta.upsert(t.addr, t);
437486
- this.sdk.provider.addressLabels.set(t.addr, t.symbol);
437487
- }
436672
+ this.#loadZapperTokens();
437488
436673
  }
437489
436674
  get zappers() {
437490
436675
  if (!this.#zappers) {
@@ -437503,6 +436688,23 @@ var ZappersPlugin = class extends SDKConstruct {
437503
436688
  }))
437504
436689
  );
437505
436690
  }
436691
+ get state() {
436692
+ return {
436693
+ version: this.version,
436694
+ zappers: this.zappers.asRecord()
436695
+ };
436696
+ }
436697
+ hydrate(state) {
436698
+ this.#zappers = new AddressMap(Object.entries(state.zappers), "zappers");
436699
+ this.#loadZapperTokens();
436700
+ }
436701
+ #loadZapperTokens() {
436702
+ const zappersTokens = this.zappers.values().flatMap((l) => l.flatMap((z2) => [z2.tokenIn, z2.tokenOut]));
436703
+ for (const t of zappersTokens) {
436704
+ this.sdk.tokensMeta.upsert(t.addr, t);
436705
+ this.sdk.provider.addressLabels.set(t.addr, t.symbol);
436706
+ }
436707
+ }
437506
436708
  };
437507
436709
 
437508
436710
  // src/commands/sdk-example.ts
@@ -437590,14 +436792,6 @@ function verifyEtherscan() {
437590
436792
  });
437591
436793
  }
437592
436794
 
437593
- // src/commands/zero-lt.ts
437594
- function zeroLT() {
437595
- return newCommand().name("zero-lt").description("sets LTs to zero on credit managers").addOption(new Option("--cm <address>", "Single credit manager option")).action(async ({ anvilUrl, ...opts }) => {
437596
- const zlt = new ZeroLT({ ...opts, rpcUrl: anvilUrl });
437597
- await zlt.setLtZero(opts);
437598
- });
437599
- }
437600
-
437601
436795
  // src/index.ts
437602
436796
  var program2 = new Command();
437603
436797
  program2.name("deploy-tools").description("gearbox deploy tools").version(version_default);
@@ -437609,7 +436803,6 @@ program2.addCommand(prices());
437609
436803
  program2.addCommand(printSafeTx());
437610
436804
  program2.addCommand(sdkExample());
437611
436805
  program2.addCommand(verifyEtherscan());
437612
- program2.addCommand(zeroLT());
437613
436806
  program2.addCommand(executeJson());
437614
436807
  program2.parse();
437615
436808
  /*! Bundled license information: