@gearbox-protocol/deploy-tools 5.20.1 → 5.20.2
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.
- package/dist/index.mjs +1828 -477
- package/package.json +2 -2
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
|
|
4171
|
+
const abi49 = [];
|
|
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
|
-
|
|
4177
|
+
abi49.push(parseSignature(signature, structs));
|
|
4178
4178
|
}
|
|
4179
|
-
return
|
|
4179
|
+
return abi49;
|
|
4180
4180
|
}
|
|
4181
4181
|
var init_parseAbi = __esm({
|
|
4182
4182
|
"../../node_modules/abitype/dist/esm/human-readable/parseAbi.js"() {
|
|
@@ -5893,9 +5893,9 @@ var init_toFunctionSelector = __esm({
|
|
|
5893
5893
|
|
|
5894
5894
|
// ../../node_modules/viem/_esm/utils/abi/getAbiItem.js
|
|
5895
5895
|
function getAbiItem(parameters) {
|
|
5896
|
-
const { abi:
|
|
5896
|
+
const { abi: abi49, args = [], name } = parameters;
|
|
5897
5897
|
const isSelector = isHex(name, { strict: false });
|
|
5898
|
-
const abiItems =
|
|
5898
|
+
const abiItems = abi49.filter((abiItem) => {
|
|
5899
5899
|
if (isSelector) {
|
|
5900
5900
|
if (abiItem.type === "function")
|
|
5901
5901
|
return toFunctionSelector(abiItem) === name;
|
|
@@ -6025,11 +6025,11 @@ var init_parseAccount = __esm({
|
|
|
6025
6025
|
|
|
6026
6026
|
// ../../node_modules/viem/_esm/utils/abi/prepareEncodeFunctionData.js
|
|
6027
6027
|
function prepareEncodeFunctionData(parameters) {
|
|
6028
|
-
const { abi:
|
|
6029
|
-
let abiItem =
|
|
6028
|
+
const { abi: abi49, args, functionName } = parameters;
|
|
6029
|
+
let abiItem = abi49[0];
|
|
6030
6030
|
if (functionName) {
|
|
6031
6031
|
const item = getAbiItem({
|
|
6032
|
-
abi:
|
|
6032
|
+
abi: abi49,
|
|
6033
6033
|
args,
|
|
6034
6034
|
name: functionName
|
|
6035
6035
|
});
|
|
@@ -6058,12 +6058,12 @@ var init_prepareEncodeFunctionData = __esm({
|
|
|
6058
6058
|
// ../../node_modules/viem/_esm/utils/abi/encodeFunctionData.js
|
|
6059
6059
|
function encodeFunctionData(parameters) {
|
|
6060
6060
|
const { args } = parameters;
|
|
6061
|
-
const { abi:
|
|
6061
|
+
const { abi: abi49, functionName } = (() => {
|
|
6062
6062
|
if (parameters.abi.length === 1 && parameters.functionName?.startsWith("0x"))
|
|
6063
6063
|
return parameters;
|
|
6064
6064
|
return prepareEncodeFunctionData(parameters);
|
|
6065
6065
|
})();
|
|
6066
|
-
const abiItem =
|
|
6066
|
+
const abiItem = abi49[0];
|
|
6067
6067
|
const signature = functionName;
|
|
6068
6068
|
const data = "inputs" in abiItem && abiItem.inputs ? encodeAbiParameters(abiItem.inputs, args ?? []) : void 0;
|
|
6069
6069
|
return concatHex([signature, data ?? "0x"]);
|
|
@@ -6558,11 +6558,11 @@ var init_decodeAbiParameters = __esm({
|
|
|
6558
6558
|
|
|
6559
6559
|
// ../../node_modules/viem/_esm/utils/abi/decodeErrorResult.js
|
|
6560
6560
|
function decodeErrorResult(parameters) {
|
|
6561
|
-
const { abi:
|
|
6561
|
+
const { abi: abi49, data } = parameters;
|
|
6562
6562
|
const signature = slice(data, 0, 4);
|
|
6563
6563
|
if (signature === "0x")
|
|
6564
6564
|
throw new AbiDecodingZeroDataError();
|
|
6565
|
-
const abi_ = [...
|
|
6565
|
+
const abi_ = [...abi49 || [], solidityError, solidityPanic];
|
|
6566
6566
|
const abiItem = abi_.find((x) => x.type === "error" && signature === toFunctionSelector(formatAbiItem2(x)));
|
|
6567
6567
|
if (!abiItem)
|
|
6568
6568
|
throw new AbiErrorSignatureNotFoundError(signature, {
|
|
@@ -6905,8 +6905,8 @@ ${prettyStateOverride(stateOverride)}`;
|
|
|
6905
6905
|
}
|
|
6906
6906
|
};
|
|
6907
6907
|
ContractFunctionExecutionError = class extends BaseError2 {
|
|
6908
|
-
constructor(cause, { abi:
|
|
6909
|
-
const abiItem = getAbiItem({ abi:
|
|
6908
|
+
constructor(cause, { abi: abi49, args, contractAddress, docsPath: docsPath6, functionName, sender }) {
|
|
6909
|
+
const abiItem = getAbiItem({ abi: abi49, args, name: functionName });
|
|
6910
6910
|
const formattedArgs = abiItem ? formatAbiItemWithArgs({
|
|
6911
6911
|
abiItem,
|
|
6912
6912
|
args,
|
|
@@ -6972,7 +6972,7 @@ ${prettyStateOverride(stateOverride)}`;
|
|
|
6972
6972
|
writable: true,
|
|
6973
6973
|
value: void 0
|
|
6974
6974
|
});
|
|
6975
|
-
this.abi =
|
|
6975
|
+
this.abi = abi49;
|
|
6976
6976
|
this.args = args;
|
|
6977
6977
|
this.cause = cause;
|
|
6978
6978
|
this.contractAddress = contractAddress;
|
|
@@ -6981,14 +6981,14 @@ ${prettyStateOverride(stateOverride)}`;
|
|
|
6981
6981
|
}
|
|
6982
6982
|
};
|
|
6983
6983
|
ContractFunctionRevertedError = class extends BaseError2 {
|
|
6984
|
-
constructor({ abi:
|
|
6984
|
+
constructor({ abi: abi49, data, functionName, message }) {
|
|
6985
6985
|
let cause;
|
|
6986
6986
|
let decodedData = void 0;
|
|
6987
6987
|
let metaMessages;
|
|
6988
6988
|
let reason;
|
|
6989
6989
|
if (data && data !== "0x") {
|
|
6990
6990
|
try {
|
|
6991
|
-
decodedData = decodeErrorResult({ abi:
|
|
6991
|
+
decodedData = decodeErrorResult({ abi: abi49, data });
|
|
6992
6992
|
const { abiItem, errorName, args: errorArgs } = decodedData;
|
|
6993
6993
|
if (errorName === "Error") {
|
|
6994
6994
|
reason = errorArgs[0];
|
|
@@ -10595,10 +10595,10 @@ var init_isAddressEqual = __esm({
|
|
|
10595
10595
|
|
|
10596
10596
|
// ../../node_modules/viem/_esm/utils/abi/decodeFunctionResult.js
|
|
10597
10597
|
function decodeFunctionResult(parameters) {
|
|
10598
|
-
const { abi:
|
|
10599
|
-
let abiItem =
|
|
10598
|
+
const { abi: abi49, args, functionName, data } = parameters;
|
|
10599
|
+
let abiItem = abi49[0];
|
|
10600
10600
|
if (functionName) {
|
|
10601
|
-
const item = getAbiItem({ abi:
|
|
10601
|
+
const item = getAbiItem({ abi: abi49, args, name: functionName });
|
|
10602
10602
|
if (!item)
|
|
10603
10603
|
throw new AbiFunctionNotFoundError(functionName, { docsPath: docsPath4 });
|
|
10604
10604
|
abiItem = item;
|
|
@@ -11434,10 +11434,10 @@ var init_chain = __esm({
|
|
|
11434
11434
|
|
|
11435
11435
|
// ../../node_modules/viem/_esm/utils/abi/encodeDeployData.js
|
|
11436
11436
|
function encodeDeployData(parameters) {
|
|
11437
|
-
const { abi:
|
|
11437
|
+
const { abi: abi49, args, bytecode } = parameters;
|
|
11438
11438
|
if (!args || args.length === 0)
|
|
11439
11439
|
return bytecode;
|
|
11440
|
-
const description =
|
|
11440
|
+
const description = abi49.find((x) => "type" in x && x.type === "constructor");
|
|
11441
11441
|
if (!description)
|
|
11442
11442
|
throw new AbiConstructorNotFoundError({ docsPath: docsPath5 });
|
|
11443
11443
|
if (!("inputs" in description))
|
|
@@ -21294,13 +21294,13 @@ var require_interface = __commonJS({
|
|
|
21294
21294
|
function Interface2(fragments) {
|
|
21295
21295
|
var _newTarget = this.constructor;
|
|
21296
21296
|
var _this = this;
|
|
21297
|
-
var
|
|
21297
|
+
var abi49 = [];
|
|
21298
21298
|
if (typeof fragments === "string") {
|
|
21299
|
-
|
|
21299
|
+
abi49 = JSON.parse(fragments);
|
|
21300
21300
|
} else {
|
|
21301
|
-
|
|
21301
|
+
abi49 = fragments;
|
|
21302
21302
|
}
|
|
21303
|
-
(0, properties_1.defineReadOnly)(this, "fragments",
|
|
21303
|
+
(0, properties_1.defineReadOnly)(this, "fragments", abi49.map(function(fragment) {
|
|
21304
21304
|
return fragments_1.Fragment.from(fragment);
|
|
21305
21305
|
}).filter(function(fragment) {
|
|
21306
21306
|
return fragment != null;
|
|
@@ -21354,15 +21354,15 @@ var require_interface = __commonJS({
|
|
|
21354
21354
|
if (format === fragments_1.FormatTypes.sighash) {
|
|
21355
21355
|
logger2.throwArgumentError("interface does not support formatting sighash", "format", format);
|
|
21356
21356
|
}
|
|
21357
|
-
var
|
|
21357
|
+
var abi49 = this.fragments.map(function(fragment) {
|
|
21358
21358
|
return fragment.format(format);
|
|
21359
21359
|
});
|
|
21360
21360
|
if (format === fragments_1.FormatTypes.json) {
|
|
21361
|
-
return JSON.stringify(
|
|
21361
|
+
return JSON.stringify(abi49.map(function(j) {
|
|
21362
21362
|
return JSON.parse(j);
|
|
21363
21363
|
}));
|
|
21364
21364
|
}
|
|
21365
|
-
return
|
|
21365
|
+
return abi49;
|
|
21366
21366
|
};
|
|
21367
21367
|
Interface2.getAbiCoder = function() {
|
|
21368
21368
|
return abi_coder_1.defaultAbiCoder;
|
|
@@ -37104,14 +37104,14 @@ var require_lib29 = __commonJS({
|
|
|
37104
37104
|
if (typeof compilerOutput === "string") {
|
|
37105
37105
|
compilerOutput = JSON.parse(compilerOutput);
|
|
37106
37106
|
}
|
|
37107
|
-
var
|
|
37107
|
+
var abi49 = compilerOutput.abi;
|
|
37108
37108
|
var bytecode = null;
|
|
37109
37109
|
if (compilerOutput.bytecode) {
|
|
37110
37110
|
bytecode = compilerOutput.bytecode;
|
|
37111
37111
|
} else if (compilerOutput.evm && compilerOutput.evm.bytecode) {
|
|
37112
37112
|
bytecode = compilerOutput.evm.bytecode;
|
|
37113
37113
|
}
|
|
37114
|
-
return new this(
|
|
37114
|
+
return new this(abi49, bytecode, signer);
|
|
37115
37115
|
};
|
|
37116
37116
|
ContractFactory2.getInterface = function(contractInterface) {
|
|
37117
37117
|
return Contract.getInterface(contractInterface);
|
|
@@ -48852,7 +48852,7 @@ var require_decimal = __commonJS({
|
|
|
48852
48852
|
// Whether to use cryptographically-secure random number generation, if available.
|
|
48853
48853
|
crypto: false
|
|
48854
48854
|
// true/false
|
|
48855
|
-
},
|
|
48855
|
+
}, Decimal2, inexact, noConflict, quadrant, external = true, decimalError = "[DecimalError] ", invalidArgument = decimalError + "Invalid argument: ", precisionLimitExceeded = decimalError + "Precision limit exceeded", cryptoUnavailable = decimalError + "crypto unavailable", tag = "[object Decimal]", mathfloor = Math.floor, mathpow = Math.pow, isBinary = /^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i, isHex2 = /^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i, isOctal = /^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i, isDecimal = /^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i, BASE = 1e7, LOG_BASE = 7, MAX_SAFE_INTEGER3 = 9007199254740991, LN10_PRECISION = LN10.length - 1, PI_PRECISION = PI.length - 1, P = { toStringTag: tag };
|
|
48856
48856
|
P.absoluteValue = P.abs = function() {
|
|
48857
48857
|
var x = new this.constructor(this);
|
|
48858
48858
|
if (x.s < 0) x.s = 1;
|
|
@@ -50363,7 +50363,7 @@ var require_decimal = __commonJS({
|
|
|
50363
50363
|
x.d = xd;
|
|
50364
50364
|
external = false;
|
|
50365
50365
|
if (isFloat) x = divide(x, divisor, len * 4);
|
|
50366
|
-
if (p) x = x.times(Math.abs(p) < 54 ? mathpow(2, p) :
|
|
50366
|
+
if (p) x = x.times(Math.abs(p) < 54 ? mathpow(2, p) : Decimal2.pow(2, p));
|
|
50367
50367
|
external = true;
|
|
50368
50368
|
return x;
|
|
50369
50369
|
}
|
|
@@ -50647,17 +50647,17 @@ var require_decimal = __commonJS({
|
|
|
50647
50647
|
}
|
|
50648
50648
|
function clone(obj) {
|
|
50649
50649
|
var i, p, ps;
|
|
50650
|
-
function
|
|
50650
|
+
function Decimal3(v) {
|
|
50651
50651
|
var e, i2, t, x = this;
|
|
50652
|
-
if (!(x instanceof
|
|
50653
|
-
x.constructor =
|
|
50652
|
+
if (!(x instanceof Decimal3)) return new Decimal3(v);
|
|
50653
|
+
x.constructor = Decimal3;
|
|
50654
50654
|
if (isDecimalInstance(v)) {
|
|
50655
50655
|
x.s = v.s;
|
|
50656
50656
|
if (external) {
|
|
50657
|
-
if (!v.d || v.e >
|
|
50657
|
+
if (!v.d || v.e > Decimal3.maxE) {
|
|
50658
50658
|
x.e = NaN;
|
|
50659
50659
|
x.d = null;
|
|
50660
|
-
} else if (v.e <
|
|
50660
|
+
} else if (v.e < Decimal3.minE) {
|
|
50661
50661
|
x.e = 0;
|
|
50662
50662
|
x.d = [0];
|
|
50663
50663
|
} else {
|
|
@@ -50687,10 +50687,10 @@ var require_decimal = __commonJS({
|
|
|
50687
50687
|
if (v === ~~v && v < 1e7) {
|
|
50688
50688
|
for (e = 0, i2 = v; i2 >= 10; i2 /= 10) e++;
|
|
50689
50689
|
if (external) {
|
|
50690
|
-
if (e >
|
|
50690
|
+
if (e > Decimal3.maxE) {
|
|
50691
50691
|
x.e = NaN;
|
|
50692
50692
|
x.d = null;
|
|
50693
|
-
} else if (e <
|
|
50693
|
+
} else if (e < Decimal3.minE) {
|
|
50694
50694
|
x.e = 0;
|
|
50695
50695
|
x.d = [0];
|
|
50696
50696
|
} else {
|
|
@@ -50732,58 +50732,58 @@ var require_decimal = __commonJS({
|
|
|
50732
50732
|
}
|
|
50733
50733
|
throw Error(invalidArgument + v);
|
|
50734
50734
|
}
|
|
50735
|
-
|
|
50736
|
-
|
|
50737
|
-
|
|
50738
|
-
|
|
50739
|
-
|
|
50740
|
-
|
|
50741
|
-
|
|
50742
|
-
|
|
50743
|
-
|
|
50744
|
-
|
|
50745
|
-
|
|
50746
|
-
|
|
50747
|
-
|
|
50748
|
-
|
|
50749
|
-
|
|
50750
|
-
|
|
50751
|
-
|
|
50752
|
-
|
|
50753
|
-
|
|
50754
|
-
|
|
50755
|
-
|
|
50756
|
-
|
|
50757
|
-
|
|
50758
|
-
|
|
50759
|
-
|
|
50760
|
-
|
|
50761
|
-
|
|
50762
|
-
|
|
50763
|
-
|
|
50764
|
-
|
|
50765
|
-
|
|
50766
|
-
|
|
50767
|
-
|
|
50768
|
-
|
|
50769
|
-
|
|
50770
|
-
|
|
50771
|
-
|
|
50772
|
-
|
|
50773
|
-
|
|
50774
|
-
|
|
50775
|
-
|
|
50776
|
-
|
|
50777
|
-
|
|
50778
|
-
|
|
50779
|
-
|
|
50780
|
-
|
|
50781
|
-
|
|
50782
|
-
|
|
50783
|
-
|
|
50784
|
-
|
|
50785
|
-
|
|
50786
|
-
|
|
50735
|
+
Decimal3.prototype = P;
|
|
50736
|
+
Decimal3.ROUND_UP = 0;
|
|
50737
|
+
Decimal3.ROUND_DOWN = 1;
|
|
50738
|
+
Decimal3.ROUND_CEIL = 2;
|
|
50739
|
+
Decimal3.ROUND_FLOOR = 3;
|
|
50740
|
+
Decimal3.ROUND_HALF_UP = 4;
|
|
50741
|
+
Decimal3.ROUND_HALF_DOWN = 5;
|
|
50742
|
+
Decimal3.ROUND_HALF_EVEN = 6;
|
|
50743
|
+
Decimal3.ROUND_HALF_CEIL = 7;
|
|
50744
|
+
Decimal3.ROUND_HALF_FLOOR = 8;
|
|
50745
|
+
Decimal3.EUCLID = 9;
|
|
50746
|
+
Decimal3.config = Decimal3.set = config;
|
|
50747
|
+
Decimal3.clone = clone;
|
|
50748
|
+
Decimal3.isDecimal = isDecimalInstance;
|
|
50749
|
+
Decimal3.abs = abs;
|
|
50750
|
+
Decimal3.acos = acos;
|
|
50751
|
+
Decimal3.acosh = acosh;
|
|
50752
|
+
Decimal3.add = add2;
|
|
50753
|
+
Decimal3.asin = asin;
|
|
50754
|
+
Decimal3.asinh = asinh;
|
|
50755
|
+
Decimal3.atan = atan;
|
|
50756
|
+
Decimal3.atanh = atanh;
|
|
50757
|
+
Decimal3.atan2 = atan2;
|
|
50758
|
+
Decimal3.cbrt = cbrt;
|
|
50759
|
+
Decimal3.ceil = ceil;
|
|
50760
|
+
Decimal3.clamp = clamp;
|
|
50761
|
+
Decimal3.cos = cos;
|
|
50762
|
+
Decimal3.cosh = cosh;
|
|
50763
|
+
Decimal3.div = div;
|
|
50764
|
+
Decimal3.exp = exp;
|
|
50765
|
+
Decimal3.floor = floor;
|
|
50766
|
+
Decimal3.hypot = hypot;
|
|
50767
|
+
Decimal3.ln = ln;
|
|
50768
|
+
Decimal3.log = log2;
|
|
50769
|
+
Decimal3.log10 = log10;
|
|
50770
|
+
Decimal3.log2 = log22;
|
|
50771
|
+
Decimal3.max = max;
|
|
50772
|
+
Decimal3.min = min;
|
|
50773
|
+
Decimal3.mod = mod2;
|
|
50774
|
+
Decimal3.mul = mul;
|
|
50775
|
+
Decimal3.pow = pow3;
|
|
50776
|
+
Decimal3.random = random;
|
|
50777
|
+
Decimal3.round = round;
|
|
50778
|
+
Decimal3.sign = sign2;
|
|
50779
|
+
Decimal3.sin = sin;
|
|
50780
|
+
Decimal3.sinh = sinh;
|
|
50781
|
+
Decimal3.sqrt = sqrt;
|
|
50782
|
+
Decimal3.sub = sub;
|
|
50783
|
+
Decimal3.sum = sum;
|
|
50784
|
+
Decimal3.tan = tan;
|
|
50785
|
+
Decimal3.tanh = tanh;
|
|
50786
|
+
Decimal3.trunc = trunc;
|
|
50787
50787
|
if (obj === void 0) obj = {};
|
|
50788
50788
|
if (obj) {
|
|
50789
50789
|
if (obj.defaults !== true) {
|
|
@@ -50791,8 +50791,8 @@ var require_decimal = __commonJS({
|
|
|
50791
50791
|
for (i = 0; i < ps.length; ) if (!obj.hasOwnProperty(p = ps[i++])) obj[p] = this[p];
|
|
50792
50792
|
}
|
|
50793
50793
|
}
|
|
50794
|
-
|
|
50795
|
-
return
|
|
50794
|
+
Decimal3.config(obj);
|
|
50795
|
+
return Decimal3;
|
|
50796
50796
|
}
|
|
50797
50797
|
function div(x, y) {
|
|
50798
50798
|
return new this(x).div(y);
|
|
@@ -50822,7 +50822,7 @@ var require_decimal = __commonJS({
|
|
|
50822
50822
|
return t.sqrt();
|
|
50823
50823
|
}
|
|
50824
50824
|
function isDecimalInstance(obj) {
|
|
50825
|
-
return obj instanceof
|
|
50825
|
+
return obj instanceof Decimal2 || obj && obj.toStringTag === tag || false;
|
|
50826
50826
|
}
|
|
50827
50827
|
function ln(x) {
|
|
50828
50828
|
return new this(x).ln();
|
|
@@ -50938,31 +50938,31 @@ var require_decimal = __commonJS({
|
|
|
50938
50938
|
function trunc(x) {
|
|
50939
50939
|
return finalise(x = new this(x), x.e + 1, 1);
|
|
50940
50940
|
}
|
|
50941
|
-
|
|
50942
|
-
|
|
50943
|
-
|
|
50944
|
-
LN10 = new
|
|
50945
|
-
PI = new
|
|
50941
|
+
Decimal2 = clone(DEFAULTS);
|
|
50942
|
+
Decimal2.prototype.constructor = Decimal2;
|
|
50943
|
+
Decimal2["default"] = Decimal2.Decimal = Decimal2;
|
|
50944
|
+
LN10 = new Decimal2(LN10);
|
|
50945
|
+
PI = new Decimal2(PI);
|
|
50946
50946
|
if (typeof define == "function" && define.amd) {
|
|
50947
50947
|
define(function() {
|
|
50948
|
-
return
|
|
50948
|
+
return Decimal2;
|
|
50949
50949
|
});
|
|
50950
50950
|
} else if (typeof module2 != "undefined" && module2.exports) {
|
|
50951
50951
|
if (typeof Symbol == "function" && typeof Symbol.iterator == "symbol") {
|
|
50952
50952
|
P[Symbol["for"]("nodejs.util.inspect.custom")] = P.toString;
|
|
50953
50953
|
P[Symbol.toStringTag] = "Decimal";
|
|
50954
50954
|
}
|
|
50955
|
-
module2.exports =
|
|
50955
|
+
module2.exports = Decimal2;
|
|
50956
50956
|
} else {
|
|
50957
50957
|
if (!globalScope) {
|
|
50958
50958
|
globalScope = typeof self != "undefined" && self && self.self == self ? self : window;
|
|
50959
50959
|
}
|
|
50960
50960
|
noConflict = globalScope.Decimal;
|
|
50961
|
-
|
|
50961
|
+
Decimal2.noConflict = function() {
|
|
50962
50962
|
globalScope.Decimal = noConflict;
|
|
50963
|
-
return
|
|
50963
|
+
return Decimal2;
|
|
50964
50964
|
};
|
|
50965
|
-
globalScope.Decimal =
|
|
50965
|
+
globalScope.Decimal = Decimal2;
|
|
50966
50966
|
}
|
|
50967
50967
|
})(exports2);
|
|
50968
50968
|
}
|
|
@@ -51169,7 +51169,7 @@ var require_node_gyp_build = __commonJS({
|
|
|
51169
51169
|
var runtimeRequire = typeof __webpack_require__ === "function" ? __non_webpack_require__ : __require;
|
|
51170
51170
|
var vars = process.config && process.config.variables || {};
|
|
51171
51171
|
var prebuildsOnly = !!process.env.PREBUILDS_ONLY;
|
|
51172
|
-
var
|
|
51172
|
+
var abi49 = process.versions.modules;
|
|
51173
51173
|
var runtime = isElectron() ? "electron" : isNwjs() ? "node-webkit" : "node";
|
|
51174
51174
|
var arch = process.env.npm_config_arch || os2.arch();
|
|
51175
51175
|
var platform = process.env.npm_config_platform || os2.platform();
|
|
@@ -51201,7 +51201,7 @@ var require_node_gyp_build = __commonJS({
|
|
|
51201
51201
|
"platform=" + platform,
|
|
51202
51202
|
"arch=" + arch,
|
|
51203
51203
|
"runtime=" + runtime,
|
|
51204
|
-
"abi=" +
|
|
51204
|
+
"abi=" + abi49,
|
|
51205
51205
|
"uv=" + uv,
|
|
51206
51206
|
armv ? "armv=" + armv : "",
|
|
51207
51207
|
"libc=" + libc,
|
|
@@ -51217,7 +51217,7 @@ var require_node_gyp_build = __commonJS({
|
|
|
51217
51217
|
if (!tuple) return;
|
|
51218
51218
|
var prebuilds = path12.join(dir2, "prebuilds", tuple.name);
|
|
51219
51219
|
var parsed = readdirSync(prebuilds).map(parseTags);
|
|
51220
|
-
var candidates = parsed.filter(matchTags(runtime,
|
|
51220
|
+
var candidates = parsed.filter(matchTags(runtime, abi49));
|
|
51221
51221
|
var winner = candidates.sort(compareTags(runtime))[0];
|
|
51222
51222
|
if (winner) return path12.join(prebuilds, winner.file);
|
|
51223
51223
|
}
|
|
@@ -51282,11 +51282,11 @@ var require_node_gyp_build = __commonJS({
|
|
|
51282
51282
|
}
|
|
51283
51283
|
return tags;
|
|
51284
51284
|
}
|
|
51285
|
-
function matchTags(runtime2,
|
|
51285
|
+
function matchTags(runtime2, abi50) {
|
|
51286
51286
|
return function(tags) {
|
|
51287
51287
|
if (tags == null) return false;
|
|
51288
51288
|
if (tags.runtime && tags.runtime !== runtime2 && !runtimeAgnostic(tags)) return false;
|
|
51289
|
-
if (tags.abi && tags.abi !==
|
|
51289
|
+
if (tags.abi && tags.abi !== abi50 && !tags.napi) return false;
|
|
51290
51290
|
if (tags.uv && tags.uv !== uv) return false;
|
|
51291
51291
|
if (tags.armv && tags.armv !== armv) return false;
|
|
51292
51292
|
if (tags.libc && tags.libc !== libc) return false;
|
|
@@ -82081,6 +82081,992 @@ var require_src5 = __commonJS({
|
|
|
82081
82081
|
}
|
|
82082
82082
|
});
|
|
82083
82083
|
|
|
82084
|
+
// ../../node_modules/decimal.js-light/decimal.js
|
|
82085
|
+
var require_decimal2 = __commonJS({
|
|
82086
|
+
"../../node_modules/decimal.js-light/decimal.js"(exports2, module2) {
|
|
82087
|
+
(function(globalScope) {
|
|
82088
|
+
"use strict";
|
|
82089
|
+
var MAX_DIGITS = 1e9, Decimal2 = {
|
|
82090
|
+
// These values must be integers within the stated ranges (inclusive).
|
|
82091
|
+
// Most of these values can be changed during run-time using `Decimal.config`.
|
|
82092
|
+
// The maximum number of significant digits of the result of a calculation or base conversion.
|
|
82093
|
+
// E.g. `Decimal.config({ precision: 20 });`
|
|
82094
|
+
precision: 20,
|
|
82095
|
+
// 1 to MAX_DIGITS
|
|
82096
|
+
// The rounding mode used by default by `toInteger`, `toDecimalPlaces`, `toExponential`,
|
|
82097
|
+
// `toFixed`, `toPrecision` and `toSignificantDigits`.
|
|
82098
|
+
//
|
|
82099
|
+
// ROUND_UP 0 Away from zero.
|
|
82100
|
+
// ROUND_DOWN 1 Towards zero.
|
|
82101
|
+
// ROUND_CEIL 2 Towards +Infinity.
|
|
82102
|
+
// ROUND_FLOOR 3 Towards -Infinity.
|
|
82103
|
+
// ROUND_HALF_UP 4 Towards nearest neighbour. If equidistant, up.
|
|
82104
|
+
// ROUND_HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.
|
|
82105
|
+
// ROUND_HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.
|
|
82106
|
+
// ROUND_HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.
|
|
82107
|
+
// ROUND_HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.
|
|
82108
|
+
//
|
|
82109
|
+
// E.g.
|
|
82110
|
+
// `Decimal.rounding = 4;`
|
|
82111
|
+
// `Decimal.rounding = Decimal.ROUND_HALF_UP;`
|
|
82112
|
+
rounding: 4,
|
|
82113
|
+
// 0 to 8
|
|
82114
|
+
// The exponent value at and beneath which `toString` returns exponential notation.
|
|
82115
|
+
// JavaScript numbers: -7
|
|
82116
|
+
toExpNeg: -7,
|
|
82117
|
+
// 0 to -MAX_E
|
|
82118
|
+
// The exponent value at and above which `toString` returns exponential notation.
|
|
82119
|
+
// JavaScript numbers: 21
|
|
82120
|
+
toExpPos: 21,
|
|
82121
|
+
// 0 to MAX_E
|
|
82122
|
+
// The natural logarithm of 10.
|
|
82123
|
+
// 115 digits
|
|
82124
|
+
LN10: "2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286"
|
|
82125
|
+
}, external = true, decimalError = "[DecimalError] ", invalidArgument = decimalError + "Invalid argument: ", exponentOutOfRange = decimalError + "Exponent out of range: ", mathfloor = Math.floor, mathpow = Math.pow, isDecimal = /^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i, ONE, BASE = 1e7, LOG_BASE = 7, MAX_SAFE_INTEGER3 = 9007199254740991, MAX_E = mathfloor(MAX_SAFE_INTEGER3 / LOG_BASE), P = {};
|
|
82126
|
+
P.absoluteValue = P.abs = function() {
|
|
82127
|
+
var x = new this.constructor(this);
|
|
82128
|
+
if (x.s) x.s = 1;
|
|
82129
|
+
return x;
|
|
82130
|
+
};
|
|
82131
|
+
P.comparedTo = P.cmp = function(y) {
|
|
82132
|
+
var i, j, xdL, ydL, x = this;
|
|
82133
|
+
y = new x.constructor(y);
|
|
82134
|
+
if (x.s !== y.s) return x.s || -y.s;
|
|
82135
|
+
if (x.e !== y.e) return x.e > y.e ^ x.s < 0 ? 1 : -1;
|
|
82136
|
+
xdL = x.d.length;
|
|
82137
|
+
ydL = y.d.length;
|
|
82138
|
+
for (i = 0, j = xdL < ydL ? xdL : ydL; i < j; ++i) {
|
|
82139
|
+
if (x.d[i] !== y.d[i]) return x.d[i] > y.d[i] ^ x.s < 0 ? 1 : -1;
|
|
82140
|
+
}
|
|
82141
|
+
return xdL === ydL ? 0 : xdL > ydL ^ x.s < 0 ? 1 : -1;
|
|
82142
|
+
};
|
|
82143
|
+
P.decimalPlaces = P.dp = function() {
|
|
82144
|
+
var x = this, w = x.d.length - 1, dp = (w - x.e) * LOG_BASE;
|
|
82145
|
+
w = x.d[w];
|
|
82146
|
+
if (w) for (; w % 10 == 0; w /= 10) dp--;
|
|
82147
|
+
return dp < 0 ? 0 : dp;
|
|
82148
|
+
};
|
|
82149
|
+
P.dividedBy = P.div = function(y) {
|
|
82150
|
+
return divide(this, new this.constructor(y));
|
|
82151
|
+
};
|
|
82152
|
+
P.dividedToIntegerBy = P.idiv = function(y) {
|
|
82153
|
+
var x = this, Ctor = x.constructor;
|
|
82154
|
+
return round(divide(x, new Ctor(y), 0, 1), Ctor.precision);
|
|
82155
|
+
};
|
|
82156
|
+
P.equals = P.eq = function(y) {
|
|
82157
|
+
return !this.cmp(y);
|
|
82158
|
+
};
|
|
82159
|
+
P.exponent = function() {
|
|
82160
|
+
return getBase10Exponent(this);
|
|
82161
|
+
};
|
|
82162
|
+
P.greaterThan = P.gt = function(y) {
|
|
82163
|
+
return this.cmp(y) > 0;
|
|
82164
|
+
};
|
|
82165
|
+
P.greaterThanOrEqualTo = P.gte = function(y) {
|
|
82166
|
+
return this.cmp(y) >= 0;
|
|
82167
|
+
};
|
|
82168
|
+
P.isInteger = P.isint = function() {
|
|
82169
|
+
return this.e > this.d.length - 2;
|
|
82170
|
+
};
|
|
82171
|
+
P.isNegative = P.isneg = function() {
|
|
82172
|
+
return this.s < 0;
|
|
82173
|
+
};
|
|
82174
|
+
P.isPositive = P.ispos = function() {
|
|
82175
|
+
return this.s > 0;
|
|
82176
|
+
};
|
|
82177
|
+
P.isZero = function() {
|
|
82178
|
+
return this.s === 0;
|
|
82179
|
+
};
|
|
82180
|
+
P.lessThan = P.lt = function(y) {
|
|
82181
|
+
return this.cmp(y) < 0;
|
|
82182
|
+
};
|
|
82183
|
+
P.lessThanOrEqualTo = P.lte = function(y) {
|
|
82184
|
+
return this.cmp(y) < 1;
|
|
82185
|
+
};
|
|
82186
|
+
P.logarithm = P.log = function(base2) {
|
|
82187
|
+
var r, x = this, Ctor = x.constructor, pr = Ctor.precision, wpr = pr + 5;
|
|
82188
|
+
if (base2 === void 0) {
|
|
82189
|
+
base2 = new Ctor(10);
|
|
82190
|
+
} else {
|
|
82191
|
+
base2 = new Ctor(base2);
|
|
82192
|
+
if (base2.s < 1 || base2.eq(ONE)) throw Error(decimalError + "NaN");
|
|
82193
|
+
}
|
|
82194
|
+
if (x.s < 1) throw Error(decimalError + (x.s ? "NaN" : "-Infinity"));
|
|
82195
|
+
if (x.eq(ONE)) return new Ctor(0);
|
|
82196
|
+
external = false;
|
|
82197
|
+
r = divide(ln(x, wpr), ln(base2, wpr), wpr);
|
|
82198
|
+
external = true;
|
|
82199
|
+
return round(r, pr);
|
|
82200
|
+
};
|
|
82201
|
+
P.minus = P.sub = function(y) {
|
|
82202
|
+
var x = this;
|
|
82203
|
+
y = new x.constructor(y);
|
|
82204
|
+
return x.s == y.s ? subtract(x, y) : add2(x, (y.s = -y.s, y));
|
|
82205
|
+
};
|
|
82206
|
+
P.modulo = P.mod = function(y) {
|
|
82207
|
+
var q, x = this, Ctor = x.constructor, pr = Ctor.precision;
|
|
82208
|
+
y = new Ctor(y);
|
|
82209
|
+
if (!y.s) throw Error(decimalError + "NaN");
|
|
82210
|
+
if (!x.s) return round(new Ctor(x), pr);
|
|
82211
|
+
external = false;
|
|
82212
|
+
q = divide(x, y, 0, 1).times(y);
|
|
82213
|
+
external = true;
|
|
82214
|
+
return x.minus(q);
|
|
82215
|
+
};
|
|
82216
|
+
P.naturalExponential = P.exp = function() {
|
|
82217
|
+
return exp(this);
|
|
82218
|
+
};
|
|
82219
|
+
P.naturalLogarithm = P.ln = function() {
|
|
82220
|
+
return ln(this);
|
|
82221
|
+
};
|
|
82222
|
+
P.negated = P.neg = function() {
|
|
82223
|
+
var x = new this.constructor(this);
|
|
82224
|
+
x.s = -x.s || 0;
|
|
82225
|
+
return x;
|
|
82226
|
+
};
|
|
82227
|
+
P.plus = P.add = function(y) {
|
|
82228
|
+
var x = this;
|
|
82229
|
+
y = new x.constructor(y);
|
|
82230
|
+
return x.s == y.s ? add2(x, y) : subtract(x, (y.s = -y.s, y));
|
|
82231
|
+
};
|
|
82232
|
+
P.precision = P.sd = function(z2) {
|
|
82233
|
+
var e, sd, w, x = this;
|
|
82234
|
+
if (z2 !== void 0 && z2 !== !!z2 && z2 !== 1 && z2 !== 0) throw Error(invalidArgument + z2);
|
|
82235
|
+
e = getBase10Exponent(x) + 1;
|
|
82236
|
+
w = x.d.length - 1;
|
|
82237
|
+
sd = w * LOG_BASE + 1;
|
|
82238
|
+
w = x.d[w];
|
|
82239
|
+
if (w) {
|
|
82240
|
+
for (; w % 10 == 0; w /= 10) sd--;
|
|
82241
|
+
for (w = x.d[0]; w >= 10; w /= 10) sd++;
|
|
82242
|
+
}
|
|
82243
|
+
return z2 && e > sd ? e : sd;
|
|
82244
|
+
};
|
|
82245
|
+
P.squareRoot = P.sqrt = function() {
|
|
82246
|
+
var e, n, pr, r, s, t, wpr, x = this, Ctor = x.constructor;
|
|
82247
|
+
if (x.s < 1) {
|
|
82248
|
+
if (!x.s) return new Ctor(0);
|
|
82249
|
+
throw Error(decimalError + "NaN");
|
|
82250
|
+
}
|
|
82251
|
+
e = getBase10Exponent(x);
|
|
82252
|
+
external = false;
|
|
82253
|
+
s = Math.sqrt(+x);
|
|
82254
|
+
if (s == 0 || s == 1 / 0) {
|
|
82255
|
+
n = digitsToString(x.d);
|
|
82256
|
+
if ((n.length + e) % 2 == 0) n += "0";
|
|
82257
|
+
s = Math.sqrt(n);
|
|
82258
|
+
e = mathfloor((e + 1) / 2) - (e < 0 || e % 2);
|
|
82259
|
+
if (s == 1 / 0) {
|
|
82260
|
+
n = "5e" + e;
|
|
82261
|
+
} else {
|
|
82262
|
+
n = s.toExponential();
|
|
82263
|
+
n = n.slice(0, n.indexOf("e") + 1) + e;
|
|
82264
|
+
}
|
|
82265
|
+
r = new Ctor(n);
|
|
82266
|
+
} else {
|
|
82267
|
+
r = new Ctor(s.toString());
|
|
82268
|
+
}
|
|
82269
|
+
pr = Ctor.precision;
|
|
82270
|
+
s = wpr = pr + 3;
|
|
82271
|
+
for (; ; ) {
|
|
82272
|
+
t = r;
|
|
82273
|
+
r = t.plus(divide(x, t, wpr + 2)).times(0.5);
|
|
82274
|
+
if (digitsToString(t.d).slice(0, wpr) === (n = digitsToString(r.d)).slice(0, wpr)) {
|
|
82275
|
+
n = n.slice(wpr - 3, wpr + 1);
|
|
82276
|
+
if (s == wpr && n == "4999") {
|
|
82277
|
+
round(t, pr + 1, 0);
|
|
82278
|
+
if (t.times(t).eq(x)) {
|
|
82279
|
+
r = t;
|
|
82280
|
+
break;
|
|
82281
|
+
}
|
|
82282
|
+
} else if (n != "9999") {
|
|
82283
|
+
break;
|
|
82284
|
+
}
|
|
82285
|
+
wpr += 4;
|
|
82286
|
+
}
|
|
82287
|
+
}
|
|
82288
|
+
external = true;
|
|
82289
|
+
return round(r, pr);
|
|
82290
|
+
};
|
|
82291
|
+
P.times = P.mul = function(y) {
|
|
82292
|
+
var carry, e, i, k, r, rL, t, xdL, ydL, x = this, Ctor = x.constructor, xd = x.d, yd = (y = new Ctor(y)).d;
|
|
82293
|
+
if (!x.s || !y.s) return new Ctor(0);
|
|
82294
|
+
y.s *= x.s;
|
|
82295
|
+
e = x.e + y.e;
|
|
82296
|
+
xdL = xd.length;
|
|
82297
|
+
ydL = yd.length;
|
|
82298
|
+
if (xdL < ydL) {
|
|
82299
|
+
r = xd;
|
|
82300
|
+
xd = yd;
|
|
82301
|
+
yd = r;
|
|
82302
|
+
rL = xdL;
|
|
82303
|
+
xdL = ydL;
|
|
82304
|
+
ydL = rL;
|
|
82305
|
+
}
|
|
82306
|
+
r = [];
|
|
82307
|
+
rL = xdL + ydL;
|
|
82308
|
+
for (i = rL; i--; ) r.push(0);
|
|
82309
|
+
for (i = ydL; --i >= 0; ) {
|
|
82310
|
+
carry = 0;
|
|
82311
|
+
for (k = xdL + i; k > i; ) {
|
|
82312
|
+
t = r[k] + yd[i] * xd[k - i - 1] + carry;
|
|
82313
|
+
r[k--] = t % BASE | 0;
|
|
82314
|
+
carry = t / BASE | 0;
|
|
82315
|
+
}
|
|
82316
|
+
r[k] = (r[k] + carry) % BASE | 0;
|
|
82317
|
+
}
|
|
82318
|
+
for (; !r[--rL]; ) r.pop();
|
|
82319
|
+
if (carry) ++e;
|
|
82320
|
+
else r.shift();
|
|
82321
|
+
y.d = r;
|
|
82322
|
+
y.e = e;
|
|
82323
|
+
return external ? round(y, Ctor.precision) : y;
|
|
82324
|
+
};
|
|
82325
|
+
P.toDecimalPlaces = P.todp = function(dp, rm2) {
|
|
82326
|
+
var x = this, Ctor = x.constructor;
|
|
82327
|
+
x = new Ctor(x);
|
|
82328
|
+
if (dp === void 0) return x;
|
|
82329
|
+
checkInt32(dp, 0, MAX_DIGITS);
|
|
82330
|
+
if (rm2 === void 0) rm2 = Ctor.rounding;
|
|
82331
|
+
else checkInt32(rm2, 0, 8);
|
|
82332
|
+
return round(x, dp + getBase10Exponent(x) + 1, rm2);
|
|
82333
|
+
};
|
|
82334
|
+
P.toExponential = function(dp, rm2) {
|
|
82335
|
+
var str, x = this, Ctor = x.constructor;
|
|
82336
|
+
if (dp === void 0) {
|
|
82337
|
+
str = toString2(x, true);
|
|
82338
|
+
} else {
|
|
82339
|
+
checkInt32(dp, 0, MAX_DIGITS);
|
|
82340
|
+
if (rm2 === void 0) rm2 = Ctor.rounding;
|
|
82341
|
+
else checkInt32(rm2, 0, 8);
|
|
82342
|
+
x = round(new Ctor(x), dp + 1, rm2);
|
|
82343
|
+
str = toString2(x, true, dp + 1);
|
|
82344
|
+
}
|
|
82345
|
+
return str;
|
|
82346
|
+
};
|
|
82347
|
+
P.toFixed = function(dp, rm2) {
|
|
82348
|
+
var str, y, x = this, Ctor = x.constructor;
|
|
82349
|
+
if (dp === void 0) return toString2(x);
|
|
82350
|
+
checkInt32(dp, 0, MAX_DIGITS);
|
|
82351
|
+
if (rm2 === void 0) rm2 = Ctor.rounding;
|
|
82352
|
+
else checkInt32(rm2, 0, 8);
|
|
82353
|
+
y = round(new Ctor(x), dp + getBase10Exponent(x) + 1, rm2);
|
|
82354
|
+
str = toString2(y.abs(), false, dp + getBase10Exponent(y) + 1);
|
|
82355
|
+
return x.isneg() && !x.isZero() ? "-" + str : str;
|
|
82356
|
+
};
|
|
82357
|
+
P.toInteger = P.toint = function() {
|
|
82358
|
+
var x = this, Ctor = x.constructor;
|
|
82359
|
+
return round(new Ctor(x), getBase10Exponent(x) + 1, Ctor.rounding);
|
|
82360
|
+
};
|
|
82361
|
+
P.toNumber = function() {
|
|
82362
|
+
return +this;
|
|
82363
|
+
};
|
|
82364
|
+
P.toPower = P.pow = function(y) {
|
|
82365
|
+
var e, k, pr, r, sign2, yIsInt, x = this, Ctor = x.constructor, guard = 12, yn = +(y = new Ctor(y));
|
|
82366
|
+
if (!y.s) return new Ctor(ONE);
|
|
82367
|
+
x = new Ctor(x);
|
|
82368
|
+
if (!x.s) {
|
|
82369
|
+
if (y.s < 1) throw Error(decimalError + "Infinity");
|
|
82370
|
+
return x;
|
|
82371
|
+
}
|
|
82372
|
+
if (x.eq(ONE)) return x;
|
|
82373
|
+
pr = Ctor.precision;
|
|
82374
|
+
if (y.eq(ONE)) return round(x, pr);
|
|
82375
|
+
e = y.e;
|
|
82376
|
+
k = y.d.length - 1;
|
|
82377
|
+
yIsInt = e >= k;
|
|
82378
|
+
sign2 = x.s;
|
|
82379
|
+
if (!yIsInt) {
|
|
82380
|
+
if (sign2 < 0) throw Error(decimalError + "NaN");
|
|
82381
|
+
} else if ((k = yn < 0 ? -yn : yn) <= MAX_SAFE_INTEGER3) {
|
|
82382
|
+
r = new Ctor(ONE);
|
|
82383
|
+
e = Math.ceil(pr / LOG_BASE + 4);
|
|
82384
|
+
external = false;
|
|
82385
|
+
for (; ; ) {
|
|
82386
|
+
if (k % 2) {
|
|
82387
|
+
r = r.times(x);
|
|
82388
|
+
truncate(r.d, e);
|
|
82389
|
+
}
|
|
82390
|
+
k = mathfloor(k / 2);
|
|
82391
|
+
if (k === 0) break;
|
|
82392
|
+
x = x.times(x);
|
|
82393
|
+
truncate(x.d, e);
|
|
82394
|
+
}
|
|
82395
|
+
external = true;
|
|
82396
|
+
return y.s < 0 ? new Ctor(ONE).div(r) : round(r, pr);
|
|
82397
|
+
}
|
|
82398
|
+
sign2 = sign2 < 0 && y.d[Math.max(e, k)] & 1 ? -1 : 1;
|
|
82399
|
+
x.s = 1;
|
|
82400
|
+
external = false;
|
|
82401
|
+
r = y.times(ln(x, pr + guard));
|
|
82402
|
+
external = true;
|
|
82403
|
+
r = exp(r);
|
|
82404
|
+
r.s = sign2;
|
|
82405
|
+
return r;
|
|
82406
|
+
};
|
|
82407
|
+
P.toPrecision = function(sd, rm2) {
|
|
82408
|
+
var e, str, x = this, Ctor = x.constructor;
|
|
82409
|
+
if (sd === void 0) {
|
|
82410
|
+
e = getBase10Exponent(x);
|
|
82411
|
+
str = toString2(x, e <= Ctor.toExpNeg || e >= Ctor.toExpPos);
|
|
82412
|
+
} else {
|
|
82413
|
+
checkInt32(sd, 1, MAX_DIGITS);
|
|
82414
|
+
if (rm2 === void 0) rm2 = Ctor.rounding;
|
|
82415
|
+
else checkInt32(rm2, 0, 8);
|
|
82416
|
+
x = round(new Ctor(x), sd, rm2);
|
|
82417
|
+
e = getBase10Exponent(x);
|
|
82418
|
+
str = toString2(x, sd <= e || e <= Ctor.toExpNeg, sd);
|
|
82419
|
+
}
|
|
82420
|
+
return str;
|
|
82421
|
+
};
|
|
82422
|
+
P.toSignificantDigits = P.tosd = function(sd, rm2) {
|
|
82423
|
+
var x = this, Ctor = x.constructor;
|
|
82424
|
+
if (sd === void 0) {
|
|
82425
|
+
sd = Ctor.precision;
|
|
82426
|
+
rm2 = Ctor.rounding;
|
|
82427
|
+
} else {
|
|
82428
|
+
checkInt32(sd, 1, MAX_DIGITS);
|
|
82429
|
+
if (rm2 === void 0) rm2 = Ctor.rounding;
|
|
82430
|
+
else checkInt32(rm2, 0, 8);
|
|
82431
|
+
}
|
|
82432
|
+
return round(new Ctor(x), sd, rm2);
|
|
82433
|
+
};
|
|
82434
|
+
P.toString = P.valueOf = P.val = P.toJSON = function() {
|
|
82435
|
+
var x = this, e = getBase10Exponent(x), Ctor = x.constructor;
|
|
82436
|
+
return toString2(x, e <= Ctor.toExpNeg || e >= Ctor.toExpPos);
|
|
82437
|
+
};
|
|
82438
|
+
function add2(x, y) {
|
|
82439
|
+
var carry, d, e, i, k, len, xd, yd, Ctor = x.constructor, pr = Ctor.precision;
|
|
82440
|
+
if (!x.s || !y.s) {
|
|
82441
|
+
if (!y.s) y = new Ctor(x);
|
|
82442
|
+
return external ? round(y, pr) : y;
|
|
82443
|
+
}
|
|
82444
|
+
xd = x.d;
|
|
82445
|
+
yd = y.d;
|
|
82446
|
+
k = x.e;
|
|
82447
|
+
e = y.e;
|
|
82448
|
+
xd = xd.slice();
|
|
82449
|
+
i = k - e;
|
|
82450
|
+
if (i) {
|
|
82451
|
+
if (i < 0) {
|
|
82452
|
+
d = xd;
|
|
82453
|
+
i = -i;
|
|
82454
|
+
len = yd.length;
|
|
82455
|
+
} else {
|
|
82456
|
+
d = yd;
|
|
82457
|
+
e = k;
|
|
82458
|
+
len = xd.length;
|
|
82459
|
+
}
|
|
82460
|
+
k = Math.ceil(pr / LOG_BASE);
|
|
82461
|
+
len = k > len ? k + 1 : len + 1;
|
|
82462
|
+
if (i > len) {
|
|
82463
|
+
i = len;
|
|
82464
|
+
d.length = 1;
|
|
82465
|
+
}
|
|
82466
|
+
d.reverse();
|
|
82467
|
+
for (; i--; ) d.push(0);
|
|
82468
|
+
d.reverse();
|
|
82469
|
+
}
|
|
82470
|
+
len = xd.length;
|
|
82471
|
+
i = yd.length;
|
|
82472
|
+
if (len - i < 0) {
|
|
82473
|
+
i = len;
|
|
82474
|
+
d = yd;
|
|
82475
|
+
yd = xd;
|
|
82476
|
+
xd = d;
|
|
82477
|
+
}
|
|
82478
|
+
for (carry = 0; i; ) {
|
|
82479
|
+
carry = (xd[--i] = xd[i] + yd[i] + carry) / BASE | 0;
|
|
82480
|
+
xd[i] %= BASE;
|
|
82481
|
+
}
|
|
82482
|
+
if (carry) {
|
|
82483
|
+
xd.unshift(carry);
|
|
82484
|
+
++e;
|
|
82485
|
+
}
|
|
82486
|
+
for (len = xd.length; xd[--len] == 0; ) xd.pop();
|
|
82487
|
+
y.d = xd;
|
|
82488
|
+
y.e = e;
|
|
82489
|
+
return external ? round(y, pr) : y;
|
|
82490
|
+
}
|
|
82491
|
+
function checkInt32(i, min, max) {
|
|
82492
|
+
if (i !== ~~i || i < min || i > max) {
|
|
82493
|
+
throw Error(invalidArgument + i);
|
|
82494
|
+
}
|
|
82495
|
+
}
|
|
82496
|
+
function digitsToString(d) {
|
|
82497
|
+
var i, k, ws, indexOfLastWord = d.length - 1, str = "", w = d[0];
|
|
82498
|
+
if (indexOfLastWord > 0) {
|
|
82499
|
+
str += w;
|
|
82500
|
+
for (i = 1; i < indexOfLastWord; i++) {
|
|
82501
|
+
ws = d[i] + "";
|
|
82502
|
+
k = LOG_BASE - ws.length;
|
|
82503
|
+
if (k) str += getZeroString(k);
|
|
82504
|
+
str += ws;
|
|
82505
|
+
}
|
|
82506
|
+
w = d[i];
|
|
82507
|
+
ws = w + "";
|
|
82508
|
+
k = LOG_BASE - ws.length;
|
|
82509
|
+
if (k) str += getZeroString(k);
|
|
82510
|
+
} else if (w === 0) {
|
|
82511
|
+
return "0";
|
|
82512
|
+
}
|
|
82513
|
+
for (; w % 10 === 0; ) w /= 10;
|
|
82514
|
+
return str + w;
|
|
82515
|
+
}
|
|
82516
|
+
var divide = /* @__PURE__ */ function() {
|
|
82517
|
+
function multiplyInteger(x, k) {
|
|
82518
|
+
var temp, carry = 0, i = x.length;
|
|
82519
|
+
for (x = x.slice(); i--; ) {
|
|
82520
|
+
temp = x[i] * k + carry;
|
|
82521
|
+
x[i] = temp % BASE | 0;
|
|
82522
|
+
carry = temp / BASE | 0;
|
|
82523
|
+
}
|
|
82524
|
+
if (carry) x.unshift(carry);
|
|
82525
|
+
return x;
|
|
82526
|
+
}
|
|
82527
|
+
function compare(a, b, aL, bL) {
|
|
82528
|
+
var i, r;
|
|
82529
|
+
if (aL != bL) {
|
|
82530
|
+
r = aL > bL ? 1 : -1;
|
|
82531
|
+
} else {
|
|
82532
|
+
for (i = r = 0; i < aL; i++) {
|
|
82533
|
+
if (a[i] != b[i]) {
|
|
82534
|
+
r = a[i] > b[i] ? 1 : -1;
|
|
82535
|
+
break;
|
|
82536
|
+
}
|
|
82537
|
+
}
|
|
82538
|
+
}
|
|
82539
|
+
return r;
|
|
82540
|
+
}
|
|
82541
|
+
function subtract2(a, b, aL) {
|
|
82542
|
+
var i = 0;
|
|
82543
|
+
for (; aL--; ) {
|
|
82544
|
+
a[aL] -= i;
|
|
82545
|
+
i = a[aL] < b[aL] ? 1 : 0;
|
|
82546
|
+
a[aL] = i * BASE + a[aL] - b[aL];
|
|
82547
|
+
}
|
|
82548
|
+
for (; !a[0] && a.length > 1; ) a.shift();
|
|
82549
|
+
}
|
|
82550
|
+
return function(x, y, pr, dp) {
|
|
82551
|
+
var cmp, e, i, k, prod, prodL, q, qd, rem, remL, rem0, sd, t, xi, xL, yd0, yL, yz, Ctor = x.constructor, sign2 = x.s == y.s ? 1 : -1, xd = x.d, yd = y.d;
|
|
82552
|
+
if (!x.s) return new Ctor(x);
|
|
82553
|
+
if (!y.s) throw Error(decimalError + "Division by zero");
|
|
82554
|
+
e = x.e - y.e;
|
|
82555
|
+
yL = yd.length;
|
|
82556
|
+
xL = xd.length;
|
|
82557
|
+
q = new Ctor(sign2);
|
|
82558
|
+
qd = q.d = [];
|
|
82559
|
+
for (i = 0; yd[i] == (xd[i] || 0); ) ++i;
|
|
82560
|
+
if (yd[i] > (xd[i] || 0)) --e;
|
|
82561
|
+
if (pr == null) {
|
|
82562
|
+
sd = pr = Ctor.precision;
|
|
82563
|
+
} else if (dp) {
|
|
82564
|
+
sd = pr + (getBase10Exponent(x) - getBase10Exponent(y)) + 1;
|
|
82565
|
+
} else {
|
|
82566
|
+
sd = pr;
|
|
82567
|
+
}
|
|
82568
|
+
if (sd < 0) return new Ctor(0);
|
|
82569
|
+
sd = sd / LOG_BASE + 2 | 0;
|
|
82570
|
+
i = 0;
|
|
82571
|
+
if (yL == 1) {
|
|
82572
|
+
k = 0;
|
|
82573
|
+
yd = yd[0];
|
|
82574
|
+
sd++;
|
|
82575
|
+
for (; (i < xL || k) && sd--; i++) {
|
|
82576
|
+
t = k * BASE + (xd[i] || 0);
|
|
82577
|
+
qd[i] = t / yd | 0;
|
|
82578
|
+
k = t % yd | 0;
|
|
82579
|
+
}
|
|
82580
|
+
} else {
|
|
82581
|
+
k = BASE / (yd[0] + 1) | 0;
|
|
82582
|
+
if (k > 1) {
|
|
82583
|
+
yd = multiplyInteger(yd, k);
|
|
82584
|
+
xd = multiplyInteger(xd, k);
|
|
82585
|
+
yL = yd.length;
|
|
82586
|
+
xL = xd.length;
|
|
82587
|
+
}
|
|
82588
|
+
xi = yL;
|
|
82589
|
+
rem = xd.slice(0, yL);
|
|
82590
|
+
remL = rem.length;
|
|
82591
|
+
for (; remL < yL; ) rem[remL++] = 0;
|
|
82592
|
+
yz = yd.slice();
|
|
82593
|
+
yz.unshift(0);
|
|
82594
|
+
yd0 = yd[0];
|
|
82595
|
+
if (yd[1] >= BASE / 2) ++yd0;
|
|
82596
|
+
do {
|
|
82597
|
+
k = 0;
|
|
82598
|
+
cmp = compare(yd, rem, yL, remL);
|
|
82599
|
+
if (cmp < 0) {
|
|
82600
|
+
rem0 = rem[0];
|
|
82601
|
+
if (yL != remL) rem0 = rem0 * BASE + (rem[1] || 0);
|
|
82602
|
+
k = rem0 / yd0 | 0;
|
|
82603
|
+
if (k > 1) {
|
|
82604
|
+
if (k >= BASE) k = BASE - 1;
|
|
82605
|
+
prod = multiplyInteger(yd, k);
|
|
82606
|
+
prodL = prod.length;
|
|
82607
|
+
remL = rem.length;
|
|
82608
|
+
cmp = compare(prod, rem, prodL, remL);
|
|
82609
|
+
if (cmp == 1) {
|
|
82610
|
+
k--;
|
|
82611
|
+
subtract2(prod, yL < prodL ? yz : yd, prodL);
|
|
82612
|
+
}
|
|
82613
|
+
} else {
|
|
82614
|
+
if (k == 0) cmp = k = 1;
|
|
82615
|
+
prod = yd.slice();
|
|
82616
|
+
}
|
|
82617
|
+
prodL = prod.length;
|
|
82618
|
+
if (prodL < remL) prod.unshift(0);
|
|
82619
|
+
subtract2(rem, prod, remL);
|
|
82620
|
+
if (cmp == -1) {
|
|
82621
|
+
remL = rem.length;
|
|
82622
|
+
cmp = compare(yd, rem, yL, remL);
|
|
82623
|
+
if (cmp < 1) {
|
|
82624
|
+
k++;
|
|
82625
|
+
subtract2(rem, yL < remL ? yz : yd, remL);
|
|
82626
|
+
}
|
|
82627
|
+
}
|
|
82628
|
+
remL = rem.length;
|
|
82629
|
+
} else if (cmp === 0) {
|
|
82630
|
+
k++;
|
|
82631
|
+
rem = [0];
|
|
82632
|
+
}
|
|
82633
|
+
qd[i++] = k;
|
|
82634
|
+
if (cmp && rem[0]) {
|
|
82635
|
+
rem[remL++] = xd[xi] || 0;
|
|
82636
|
+
} else {
|
|
82637
|
+
rem = [xd[xi]];
|
|
82638
|
+
remL = 1;
|
|
82639
|
+
}
|
|
82640
|
+
} while ((xi++ < xL || rem[0] !== void 0) && sd--);
|
|
82641
|
+
}
|
|
82642
|
+
if (!qd[0]) qd.shift();
|
|
82643
|
+
q.e = e;
|
|
82644
|
+
return round(q, dp ? pr + getBase10Exponent(q) + 1 : pr);
|
|
82645
|
+
};
|
|
82646
|
+
}();
|
|
82647
|
+
function exp(x, sd) {
|
|
82648
|
+
var denominator, guard, pow3, sum, t, wpr, i = 0, k = 0, Ctor = x.constructor, pr = Ctor.precision;
|
|
82649
|
+
if (getBase10Exponent(x) > 16) throw Error(exponentOutOfRange + getBase10Exponent(x));
|
|
82650
|
+
if (!x.s) return new Ctor(ONE);
|
|
82651
|
+
if (sd == null) {
|
|
82652
|
+
external = false;
|
|
82653
|
+
wpr = pr;
|
|
82654
|
+
} else {
|
|
82655
|
+
wpr = sd;
|
|
82656
|
+
}
|
|
82657
|
+
t = new Ctor(0.03125);
|
|
82658
|
+
while (x.abs().gte(0.1)) {
|
|
82659
|
+
x = x.times(t);
|
|
82660
|
+
k += 5;
|
|
82661
|
+
}
|
|
82662
|
+
guard = Math.log(mathpow(2, k)) / Math.LN10 * 2 + 5 | 0;
|
|
82663
|
+
wpr += guard;
|
|
82664
|
+
denominator = pow3 = sum = new Ctor(ONE);
|
|
82665
|
+
Ctor.precision = wpr;
|
|
82666
|
+
for (; ; ) {
|
|
82667
|
+
pow3 = round(pow3.times(x), wpr);
|
|
82668
|
+
denominator = denominator.times(++i);
|
|
82669
|
+
t = sum.plus(divide(pow3, denominator, wpr));
|
|
82670
|
+
if (digitsToString(t.d).slice(0, wpr) === digitsToString(sum.d).slice(0, wpr)) {
|
|
82671
|
+
while (k--) sum = round(sum.times(sum), wpr);
|
|
82672
|
+
Ctor.precision = pr;
|
|
82673
|
+
return sd == null ? (external = true, round(sum, pr)) : sum;
|
|
82674
|
+
}
|
|
82675
|
+
sum = t;
|
|
82676
|
+
}
|
|
82677
|
+
}
|
|
82678
|
+
function getBase10Exponent(x) {
|
|
82679
|
+
var e = x.e * LOG_BASE, w = x.d[0];
|
|
82680
|
+
for (; w >= 10; w /= 10) e++;
|
|
82681
|
+
return e;
|
|
82682
|
+
}
|
|
82683
|
+
function getLn10(Ctor, sd, pr) {
|
|
82684
|
+
if (sd > Ctor.LN10.sd()) {
|
|
82685
|
+
external = true;
|
|
82686
|
+
if (pr) Ctor.precision = pr;
|
|
82687
|
+
throw Error(decimalError + "LN10 precision limit exceeded");
|
|
82688
|
+
}
|
|
82689
|
+
return round(new Ctor(Ctor.LN10), sd);
|
|
82690
|
+
}
|
|
82691
|
+
function getZeroString(k) {
|
|
82692
|
+
var zs = "";
|
|
82693
|
+
for (; k--; ) zs += "0";
|
|
82694
|
+
return zs;
|
|
82695
|
+
}
|
|
82696
|
+
function ln(y, sd) {
|
|
82697
|
+
var c, c0, denominator, e, numerator, sum, t, wpr, x2, n = 1, guard = 10, x = y, xd = x.d, Ctor = x.constructor, pr = Ctor.precision;
|
|
82698
|
+
if (x.s < 1) throw Error(decimalError + (x.s ? "NaN" : "-Infinity"));
|
|
82699
|
+
if (x.eq(ONE)) return new Ctor(0);
|
|
82700
|
+
if (sd == null) {
|
|
82701
|
+
external = false;
|
|
82702
|
+
wpr = pr;
|
|
82703
|
+
} else {
|
|
82704
|
+
wpr = sd;
|
|
82705
|
+
}
|
|
82706
|
+
if (x.eq(10)) {
|
|
82707
|
+
if (sd == null) external = true;
|
|
82708
|
+
return getLn10(Ctor, wpr);
|
|
82709
|
+
}
|
|
82710
|
+
wpr += guard;
|
|
82711
|
+
Ctor.precision = wpr;
|
|
82712
|
+
c = digitsToString(xd);
|
|
82713
|
+
c0 = c.charAt(0);
|
|
82714
|
+
e = getBase10Exponent(x);
|
|
82715
|
+
if (Math.abs(e) < 15e14) {
|
|
82716
|
+
while (c0 < 7 && c0 != 1 || c0 == 1 && c.charAt(1) > 3) {
|
|
82717
|
+
x = x.times(y);
|
|
82718
|
+
c = digitsToString(x.d);
|
|
82719
|
+
c0 = c.charAt(0);
|
|
82720
|
+
n++;
|
|
82721
|
+
}
|
|
82722
|
+
e = getBase10Exponent(x);
|
|
82723
|
+
if (c0 > 1) {
|
|
82724
|
+
x = new Ctor("0." + c);
|
|
82725
|
+
e++;
|
|
82726
|
+
} else {
|
|
82727
|
+
x = new Ctor(c0 + "." + c.slice(1));
|
|
82728
|
+
}
|
|
82729
|
+
} else {
|
|
82730
|
+
t = getLn10(Ctor, wpr + 2, pr).times(e + "");
|
|
82731
|
+
x = ln(new Ctor(c0 + "." + c.slice(1)), wpr - guard).plus(t);
|
|
82732
|
+
Ctor.precision = pr;
|
|
82733
|
+
return sd == null ? (external = true, round(x, pr)) : x;
|
|
82734
|
+
}
|
|
82735
|
+
sum = numerator = x = divide(x.minus(ONE), x.plus(ONE), wpr);
|
|
82736
|
+
x2 = round(x.times(x), wpr);
|
|
82737
|
+
denominator = 3;
|
|
82738
|
+
for (; ; ) {
|
|
82739
|
+
numerator = round(numerator.times(x2), wpr);
|
|
82740
|
+
t = sum.plus(divide(numerator, new Ctor(denominator), wpr));
|
|
82741
|
+
if (digitsToString(t.d).slice(0, wpr) === digitsToString(sum.d).slice(0, wpr)) {
|
|
82742
|
+
sum = sum.times(2);
|
|
82743
|
+
if (e !== 0) sum = sum.plus(getLn10(Ctor, wpr + 2, pr).times(e + ""));
|
|
82744
|
+
sum = divide(sum, new Ctor(n), wpr);
|
|
82745
|
+
Ctor.precision = pr;
|
|
82746
|
+
return sd == null ? (external = true, round(sum, pr)) : sum;
|
|
82747
|
+
}
|
|
82748
|
+
sum = t;
|
|
82749
|
+
denominator += 2;
|
|
82750
|
+
}
|
|
82751
|
+
}
|
|
82752
|
+
function parseDecimal(x, str) {
|
|
82753
|
+
var e, i, len;
|
|
82754
|
+
if ((e = str.indexOf(".")) > -1) str = str.replace(".", "");
|
|
82755
|
+
if ((i = str.search(/e/i)) > 0) {
|
|
82756
|
+
if (e < 0) e = i;
|
|
82757
|
+
e += +str.slice(i + 1);
|
|
82758
|
+
str = str.substring(0, i);
|
|
82759
|
+
} else if (e < 0) {
|
|
82760
|
+
e = str.length;
|
|
82761
|
+
}
|
|
82762
|
+
for (i = 0; str.charCodeAt(i) === 48; ) ++i;
|
|
82763
|
+
for (len = str.length; str.charCodeAt(len - 1) === 48; ) --len;
|
|
82764
|
+
str = str.slice(i, len);
|
|
82765
|
+
if (str) {
|
|
82766
|
+
len -= i;
|
|
82767
|
+
e = e - i - 1;
|
|
82768
|
+
x.e = mathfloor(e / LOG_BASE);
|
|
82769
|
+
x.d = [];
|
|
82770
|
+
i = (e + 1) % LOG_BASE;
|
|
82771
|
+
if (e < 0) i += LOG_BASE;
|
|
82772
|
+
if (i < len) {
|
|
82773
|
+
if (i) x.d.push(+str.slice(0, i));
|
|
82774
|
+
for (len -= LOG_BASE; i < len; ) x.d.push(+str.slice(i, i += LOG_BASE));
|
|
82775
|
+
str = str.slice(i);
|
|
82776
|
+
i = LOG_BASE - str.length;
|
|
82777
|
+
} else {
|
|
82778
|
+
i -= len;
|
|
82779
|
+
}
|
|
82780
|
+
for (; i--; ) str += "0";
|
|
82781
|
+
x.d.push(+str);
|
|
82782
|
+
if (external && (x.e > MAX_E || x.e < -MAX_E)) throw Error(exponentOutOfRange + e);
|
|
82783
|
+
} else {
|
|
82784
|
+
x.s = 0;
|
|
82785
|
+
x.e = 0;
|
|
82786
|
+
x.d = [0];
|
|
82787
|
+
}
|
|
82788
|
+
return x;
|
|
82789
|
+
}
|
|
82790
|
+
function round(x, sd, rm2) {
|
|
82791
|
+
var i, j, k, n, rd, doRound, w, xdi, xd = x.d;
|
|
82792
|
+
for (n = 1, k = xd[0]; k >= 10; k /= 10) n++;
|
|
82793
|
+
i = sd - n;
|
|
82794
|
+
if (i < 0) {
|
|
82795
|
+
i += LOG_BASE;
|
|
82796
|
+
j = sd;
|
|
82797
|
+
w = xd[xdi = 0];
|
|
82798
|
+
} else {
|
|
82799
|
+
xdi = Math.ceil((i + 1) / LOG_BASE);
|
|
82800
|
+
k = xd.length;
|
|
82801
|
+
if (xdi >= k) return x;
|
|
82802
|
+
w = k = xd[xdi];
|
|
82803
|
+
for (n = 1; k >= 10; k /= 10) n++;
|
|
82804
|
+
i %= LOG_BASE;
|
|
82805
|
+
j = i - LOG_BASE + n;
|
|
82806
|
+
}
|
|
82807
|
+
if (rm2 !== void 0) {
|
|
82808
|
+
k = mathpow(10, n - j - 1);
|
|
82809
|
+
rd = w / k % 10 | 0;
|
|
82810
|
+
doRound = sd < 0 || xd[xdi + 1] !== void 0 || w % k;
|
|
82811
|
+
doRound = rm2 < 4 ? (rd || doRound) && (rm2 == 0 || rm2 == (x.s < 0 ? 3 : 2)) : rd > 5 || rd == 5 && (rm2 == 4 || doRound || rm2 == 6 && // Check whether the digit to the left of the rounding digit is odd.
|
|
82812
|
+
(i > 0 ? j > 0 ? w / mathpow(10, n - j) : 0 : xd[xdi - 1]) % 10 & 1 || rm2 == (x.s < 0 ? 8 : 7));
|
|
82813
|
+
}
|
|
82814
|
+
if (sd < 1 || !xd[0]) {
|
|
82815
|
+
if (doRound) {
|
|
82816
|
+
k = getBase10Exponent(x);
|
|
82817
|
+
xd.length = 1;
|
|
82818
|
+
sd = sd - k - 1;
|
|
82819
|
+
xd[0] = mathpow(10, (LOG_BASE - sd % LOG_BASE) % LOG_BASE);
|
|
82820
|
+
x.e = mathfloor(-sd / LOG_BASE) || 0;
|
|
82821
|
+
} else {
|
|
82822
|
+
xd.length = 1;
|
|
82823
|
+
xd[0] = x.e = x.s = 0;
|
|
82824
|
+
}
|
|
82825
|
+
return x;
|
|
82826
|
+
}
|
|
82827
|
+
if (i == 0) {
|
|
82828
|
+
xd.length = xdi;
|
|
82829
|
+
k = 1;
|
|
82830
|
+
xdi--;
|
|
82831
|
+
} else {
|
|
82832
|
+
xd.length = xdi + 1;
|
|
82833
|
+
k = mathpow(10, LOG_BASE - i);
|
|
82834
|
+
xd[xdi] = j > 0 ? (w / mathpow(10, n - j) % mathpow(10, j) | 0) * k : 0;
|
|
82835
|
+
}
|
|
82836
|
+
if (doRound) {
|
|
82837
|
+
for (; ; ) {
|
|
82838
|
+
if (xdi == 0) {
|
|
82839
|
+
if ((xd[0] += k) == BASE) {
|
|
82840
|
+
xd[0] = 1;
|
|
82841
|
+
++x.e;
|
|
82842
|
+
}
|
|
82843
|
+
break;
|
|
82844
|
+
} else {
|
|
82845
|
+
xd[xdi] += k;
|
|
82846
|
+
if (xd[xdi] != BASE) break;
|
|
82847
|
+
xd[xdi--] = 0;
|
|
82848
|
+
k = 1;
|
|
82849
|
+
}
|
|
82850
|
+
}
|
|
82851
|
+
}
|
|
82852
|
+
for (i = xd.length; xd[--i] === 0; ) xd.pop();
|
|
82853
|
+
if (external && (x.e > MAX_E || x.e < -MAX_E)) {
|
|
82854
|
+
throw Error(exponentOutOfRange + getBase10Exponent(x));
|
|
82855
|
+
}
|
|
82856
|
+
return x;
|
|
82857
|
+
}
|
|
82858
|
+
function subtract(x, y) {
|
|
82859
|
+
var d, e, i, j, k, len, xd, xe, xLTy, yd, Ctor = x.constructor, pr = Ctor.precision;
|
|
82860
|
+
if (!x.s || !y.s) {
|
|
82861
|
+
if (y.s) y.s = -y.s;
|
|
82862
|
+
else y = new Ctor(x);
|
|
82863
|
+
return external ? round(y, pr) : y;
|
|
82864
|
+
}
|
|
82865
|
+
xd = x.d;
|
|
82866
|
+
yd = y.d;
|
|
82867
|
+
e = y.e;
|
|
82868
|
+
xe = x.e;
|
|
82869
|
+
xd = xd.slice();
|
|
82870
|
+
k = xe - e;
|
|
82871
|
+
if (k) {
|
|
82872
|
+
xLTy = k < 0;
|
|
82873
|
+
if (xLTy) {
|
|
82874
|
+
d = xd;
|
|
82875
|
+
k = -k;
|
|
82876
|
+
len = yd.length;
|
|
82877
|
+
} else {
|
|
82878
|
+
d = yd;
|
|
82879
|
+
e = xe;
|
|
82880
|
+
len = xd.length;
|
|
82881
|
+
}
|
|
82882
|
+
i = Math.max(Math.ceil(pr / LOG_BASE), len) + 2;
|
|
82883
|
+
if (k > i) {
|
|
82884
|
+
k = i;
|
|
82885
|
+
d.length = 1;
|
|
82886
|
+
}
|
|
82887
|
+
d.reverse();
|
|
82888
|
+
for (i = k; i--; ) d.push(0);
|
|
82889
|
+
d.reverse();
|
|
82890
|
+
} else {
|
|
82891
|
+
i = xd.length;
|
|
82892
|
+
len = yd.length;
|
|
82893
|
+
xLTy = i < len;
|
|
82894
|
+
if (xLTy) len = i;
|
|
82895
|
+
for (i = 0; i < len; i++) {
|
|
82896
|
+
if (xd[i] != yd[i]) {
|
|
82897
|
+
xLTy = xd[i] < yd[i];
|
|
82898
|
+
break;
|
|
82899
|
+
}
|
|
82900
|
+
}
|
|
82901
|
+
k = 0;
|
|
82902
|
+
}
|
|
82903
|
+
if (xLTy) {
|
|
82904
|
+
d = xd;
|
|
82905
|
+
xd = yd;
|
|
82906
|
+
yd = d;
|
|
82907
|
+
y.s = -y.s;
|
|
82908
|
+
}
|
|
82909
|
+
len = xd.length;
|
|
82910
|
+
for (i = yd.length - len; i > 0; --i) xd[len++] = 0;
|
|
82911
|
+
for (i = yd.length; i > k; ) {
|
|
82912
|
+
if (xd[--i] < yd[i]) {
|
|
82913
|
+
for (j = i; j && xd[--j] === 0; ) xd[j] = BASE - 1;
|
|
82914
|
+
--xd[j];
|
|
82915
|
+
xd[i] += BASE;
|
|
82916
|
+
}
|
|
82917
|
+
xd[i] -= yd[i];
|
|
82918
|
+
}
|
|
82919
|
+
for (; xd[--len] === 0; ) xd.pop();
|
|
82920
|
+
for (; xd[0] === 0; xd.shift()) --e;
|
|
82921
|
+
if (!xd[0]) return new Ctor(0);
|
|
82922
|
+
y.d = xd;
|
|
82923
|
+
y.e = e;
|
|
82924
|
+
return external ? round(y, pr) : y;
|
|
82925
|
+
}
|
|
82926
|
+
function toString2(x, isExp, sd) {
|
|
82927
|
+
var k, e = getBase10Exponent(x), str = digitsToString(x.d), len = str.length;
|
|
82928
|
+
if (isExp) {
|
|
82929
|
+
if (sd && (k = sd - len) > 0) {
|
|
82930
|
+
str = str.charAt(0) + "." + str.slice(1) + getZeroString(k);
|
|
82931
|
+
} else if (len > 1) {
|
|
82932
|
+
str = str.charAt(0) + "." + str.slice(1);
|
|
82933
|
+
}
|
|
82934
|
+
str = str + (e < 0 ? "e" : "e+") + e;
|
|
82935
|
+
} else if (e < 0) {
|
|
82936
|
+
str = "0." + getZeroString(-e - 1) + str;
|
|
82937
|
+
if (sd && (k = sd - len) > 0) str += getZeroString(k);
|
|
82938
|
+
} else if (e >= len) {
|
|
82939
|
+
str += getZeroString(e + 1 - len);
|
|
82940
|
+
if (sd && (k = sd - e - 1) > 0) str = str + "." + getZeroString(k);
|
|
82941
|
+
} else {
|
|
82942
|
+
if ((k = e + 1) < len) str = str.slice(0, k) + "." + str.slice(k);
|
|
82943
|
+
if (sd && (k = sd - len) > 0) {
|
|
82944
|
+
if (e + 1 === len) str += ".";
|
|
82945
|
+
str += getZeroString(k);
|
|
82946
|
+
}
|
|
82947
|
+
}
|
|
82948
|
+
return x.s < 0 ? "-" + str : str;
|
|
82949
|
+
}
|
|
82950
|
+
function truncate(arr, len) {
|
|
82951
|
+
if (arr.length > len) {
|
|
82952
|
+
arr.length = len;
|
|
82953
|
+
return true;
|
|
82954
|
+
}
|
|
82955
|
+
}
|
|
82956
|
+
function clone(obj) {
|
|
82957
|
+
var i, p, ps;
|
|
82958
|
+
function Decimal3(value) {
|
|
82959
|
+
var x = this;
|
|
82960
|
+
if (!(x instanceof Decimal3)) return new Decimal3(value);
|
|
82961
|
+
x.constructor = Decimal3;
|
|
82962
|
+
if (value instanceof Decimal3) {
|
|
82963
|
+
x.s = value.s;
|
|
82964
|
+
x.e = value.e;
|
|
82965
|
+
x.d = (value = value.d) ? value.slice() : value;
|
|
82966
|
+
return;
|
|
82967
|
+
}
|
|
82968
|
+
if (typeof value === "number") {
|
|
82969
|
+
if (value * 0 !== 0) {
|
|
82970
|
+
throw Error(invalidArgument + value);
|
|
82971
|
+
}
|
|
82972
|
+
if (value > 0) {
|
|
82973
|
+
x.s = 1;
|
|
82974
|
+
} else if (value < 0) {
|
|
82975
|
+
value = -value;
|
|
82976
|
+
x.s = -1;
|
|
82977
|
+
} else {
|
|
82978
|
+
x.s = 0;
|
|
82979
|
+
x.e = 0;
|
|
82980
|
+
x.d = [0];
|
|
82981
|
+
return;
|
|
82982
|
+
}
|
|
82983
|
+
if (value === ~~value && value < 1e7) {
|
|
82984
|
+
x.e = 0;
|
|
82985
|
+
x.d = [value];
|
|
82986
|
+
return;
|
|
82987
|
+
}
|
|
82988
|
+
return parseDecimal(x, value.toString());
|
|
82989
|
+
} else if (typeof value !== "string") {
|
|
82990
|
+
throw Error(invalidArgument + value);
|
|
82991
|
+
}
|
|
82992
|
+
if (value.charCodeAt(0) === 45) {
|
|
82993
|
+
value = value.slice(1);
|
|
82994
|
+
x.s = -1;
|
|
82995
|
+
} else {
|
|
82996
|
+
x.s = 1;
|
|
82997
|
+
}
|
|
82998
|
+
if (isDecimal.test(value)) parseDecimal(x, value);
|
|
82999
|
+
else throw Error(invalidArgument + value);
|
|
83000
|
+
}
|
|
83001
|
+
Decimal3.prototype = P;
|
|
83002
|
+
Decimal3.ROUND_UP = 0;
|
|
83003
|
+
Decimal3.ROUND_DOWN = 1;
|
|
83004
|
+
Decimal3.ROUND_CEIL = 2;
|
|
83005
|
+
Decimal3.ROUND_FLOOR = 3;
|
|
83006
|
+
Decimal3.ROUND_HALF_UP = 4;
|
|
83007
|
+
Decimal3.ROUND_HALF_DOWN = 5;
|
|
83008
|
+
Decimal3.ROUND_HALF_EVEN = 6;
|
|
83009
|
+
Decimal3.ROUND_HALF_CEIL = 7;
|
|
83010
|
+
Decimal3.ROUND_HALF_FLOOR = 8;
|
|
83011
|
+
Decimal3.clone = clone;
|
|
83012
|
+
Decimal3.config = Decimal3.set = config;
|
|
83013
|
+
if (obj === void 0) obj = {};
|
|
83014
|
+
if (obj) {
|
|
83015
|
+
ps = ["precision", "rounding", "toExpNeg", "toExpPos", "LN10"];
|
|
83016
|
+
for (i = 0; i < ps.length; ) if (!obj.hasOwnProperty(p = ps[i++])) obj[p] = this[p];
|
|
83017
|
+
}
|
|
83018
|
+
Decimal3.config(obj);
|
|
83019
|
+
return Decimal3;
|
|
83020
|
+
}
|
|
83021
|
+
function config(obj) {
|
|
83022
|
+
if (!obj || typeof obj !== "object") {
|
|
83023
|
+
throw Error(decimalError + "Object expected");
|
|
83024
|
+
}
|
|
83025
|
+
var i, p, v, ps = [
|
|
83026
|
+
"precision",
|
|
83027
|
+
1,
|
|
83028
|
+
MAX_DIGITS,
|
|
83029
|
+
"rounding",
|
|
83030
|
+
0,
|
|
83031
|
+
8,
|
|
83032
|
+
"toExpNeg",
|
|
83033
|
+
-1 / 0,
|
|
83034
|
+
0,
|
|
83035
|
+
"toExpPos",
|
|
83036
|
+
0,
|
|
83037
|
+
1 / 0
|
|
83038
|
+
];
|
|
83039
|
+
for (i = 0; i < ps.length; i += 3) {
|
|
83040
|
+
if ((v = obj[p = ps[i]]) !== void 0) {
|
|
83041
|
+
if (mathfloor(v) === v && v >= ps[i + 1] && v <= ps[i + 2]) this[p] = v;
|
|
83042
|
+
else throw Error(invalidArgument + p + ": " + v);
|
|
83043
|
+
}
|
|
83044
|
+
}
|
|
83045
|
+
if ((v = obj[p = "LN10"]) !== void 0) {
|
|
83046
|
+
if (v == Math.LN10) this[p] = new this(v);
|
|
83047
|
+
else throw Error(invalidArgument + p + ": " + v);
|
|
83048
|
+
}
|
|
83049
|
+
return this;
|
|
83050
|
+
}
|
|
83051
|
+
Decimal2 = clone(Decimal2);
|
|
83052
|
+
Decimal2["default"] = Decimal2.Decimal = Decimal2;
|
|
83053
|
+
ONE = new Decimal2(1);
|
|
83054
|
+
if (typeof define == "function" && define.amd) {
|
|
83055
|
+
define(function() {
|
|
83056
|
+
return Decimal2;
|
|
83057
|
+
});
|
|
83058
|
+
} else if (typeof module2 != "undefined" && module2.exports) {
|
|
83059
|
+
module2.exports = Decimal2;
|
|
83060
|
+
} else {
|
|
83061
|
+
if (!globalScope) {
|
|
83062
|
+
globalScope = typeof self != "undefined" && self && self.self == self ? self : Function("return this")();
|
|
83063
|
+
}
|
|
83064
|
+
globalScope.Decimal = Decimal2;
|
|
83065
|
+
}
|
|
83066
|
+
})(exports2);
|
|
83067
|
+
}
|
|
83068
|
+
});
|
|
83069
|
+
|
|
82084
83070
|
// ../../node_modules/@gearbox-protocol/sdk-gov/lib/bots/permissions.js
|
|
82085
83071
|
var require_permissions = __commonJS({
|
|
82086
83072
|
"../../node_modules/@gearbox-protocol/sdk-gov/lib/bots/permissions.js"(exports2) {
|
|
@@ -111126,17 +112112,17 @@ var require_interface2 = __commonJS({
|
|
|
111126
112112
|
* Create a new Interface for the %%fragments%%.
|
|
111127
112113
|
*/
|
|
111128
112114
|
constructor(fragments) {
|
|
111129
|
-
let
|
|
112115
|
+
let abi49 = [];
|
|
111130
112116
|
if (typeof fragments === "string") {
|
|
111131
|
-
|
|
112117
|
+
abi49 = JSON.parse(fragments);
|
|
111132
112118
|
} else {
|
|
111133
|
-
|
|
112119
|
+
abi49 = fragments;
|
|
111134
112120
|
}
|
|
111135
112121
|
this.#functions = /* @__PURE__ */ new Map();
|
|
111136
112122
|
this.#errors = /* @__PURE__ */ new Map();
|
|
111137
112123
|
this.#events = /* @__PURE__ */ new Map();
|
|
111138
112124
|
const frags = [];
|
|
111139
|
-
for (const a of
|
|
112125
|
+
for (const a of abi49) {
|
|
111140
112126
|
try {
|
|
111141
112127
|
frags.push(fragments_js_1.Fragment.from(a));
|
|
111142
112128
|
} catch (error) {
|
|
@@ -111200,16 +112186,16 @@ var require_interface2 = __commonJS({
|
|
|
111200
112186
|
*/
|
|
111201
112187
|
format(minimal) {
|
|
111202
112188
|
const format = minimal ? "minimal" : "full";
|
|
111203
|
-
const
|
|
111204
|
-
return
|
|
112189
|
+
const abi49 = this.fragments.map((f) => f.format(format));
|
|
112190
|
+
return abi49;
|
|
111205
112191
|
}
|
|
111206
112192
|
/**
|
|
111207
112193
|
* Return the JSON-encoded ABI. This is the format Solidiy
|
|
111208
112194
|
* returns.
|
|
111209
112195
|
*/
|
|
111210
112196
|
formatJson() {
|
|
111211
|
-
const
|
|
111212
|
-
return JSON.stringify(
|
|
112197
|
+
const abi49 = this.fragments.map((f) => f.format("json"));
|
|
112198
|
+
return JSON.stringify(abi49.map((j) => JSON.parse(j)));
|
|
111213
112199
|
}
|
|
111214
112200
|
/**
|
|
111215
112201
|
* The ABI coder that will be used to encode and decode binary
|
|
@@ -113977,12 +114963,12 @@ var require_contract = __commonJS({
|
|
|
113977
114963
|
* optionally connected to a %%runner%% to perform operations on behalf
|
|
113978
114964
|
* of.
|
|
113979
114965
|
*/
|
|
113980
|
-
constructor(target,
|
|
114966
|
+
constructor(target, abi49, runner, _deployTx) {
|
|
113981
114967
|
(0, index_js_3.assertArgument)(typeof target === "string" || (0, index_js_2.isAddressable)(target), "invalid value for Contract target", "target", target);
|
|
113982
114968
|
if (runner == null) {
|
|
113983
114969
|
runner = null;
|
|
113984
114970
|
}
|
|
113985
|
-
const iface = index_js_1.Interface.from(
|
|
114971
|
+
const iface = index_js_1.Interface.from(abi49);
|
|
113986
114972
|
(0, index_js_3.defineProperties)(this, { target, runner, interface: iface });
|
|
113987
114973
|
Object.defineProperty(this, internal, { value: {} });
|
|
113988
114974
|
let addrPromise;
|
|
@@ -114345,10 +115331,10 @@ var require_contract = __commonJS({
|
|
|
114345
115331
|
/**
|
|
114346
115332
|
* Create a new Class for the %%abi%%.
|
|
114347
115333
|
*/
|
|
114348
|
-
static buildClass(
|
|
115334
|
+
static buildClass(abi49) {
|
|
114349
115335
|
class CustomContract extends _BaseContract {
|
|
114350
115336
|
constructor(address, runner = null) {
|
|
114351
|
-
super(address,
|
|
115337
|
+
super(address, abi49, runner);
|
|
114352
115338
|
}
|
|
114353
115339
|
}
|
|
114354
115340
|
return CustomContract;
|
|
@@ -114356,11 +115342,11 @@ var require_contract = __commonJS({
|
|
|
114356
115342
|
/**
|
|
114357
115343
|
* Create a new BaseContract with a specified Interface.
|
|
114358
115344
|
*/
|
|
114359
|
-
static from(target,
|
|
115345
|
+
static from(target, abi49, runner) {
|
|
114360
115346
|
if (runner == null) {
|
|
114361
115347
|
runner = null;
|
|
114362
115348
|
}
|
|
114363
|
-
const contract = new this(target,
|
|
115349
|
+
const contract = new this(target, abi49, runner);
|
|
114364
115350
|
return contract;
|
|
114365
115351
|
}
|
|
114366
115352
|
};
|
|
@@ -114404,8 +115390,8 @@ var require_factory = __commonJS({
|
|
|
114404
115390
|
* The %%bytecode%% may be the ``bytecode`` property within the
|
|
114405
115391
|
* standard Solidity JSON output.
|
|
114406
115392
|
*/
|
|
114407
|
-
constructor(
|
|
114408
|
-
const iface = index_js_1.Interface.from(
|
|
115393
|
+
constructor(abi49, bytecode, runner) {
|
|
115394
|
+
const iface = index_js_1.Interface.from(abi49);
|
|
114409
115395
|
if (bytecode instanceof Uint8Array) {
|
|
114410
115396
|
bytecode = (0, index_js_3.hexlify)((0, index_js_3.getBytes)(bytecode));
|
|
114411
115397
|
} else {
|
|
@@ -114475,14 +115461,14 @@ var require_factory = __commonJS({
|
|
|
114475
115461
|
if (typeof output === "string") {
|
|
114476
115462
|
output = JSON.parse(output);
|
|
114477
115463
|
}
|
|
114478
|
-
const
|
|
115464
|
+
const abi49 = output.abi;
|
|
114479
115465
|
let bytecode = "";
|
|
114480
115466
|
if (output.bytecode) {
|
|
114481
115467
|
bytecode = output.bytecode;
|
|
114482
115468
|
} else if (output.evm && output.evm.bytecode) {
|
|
114483
115469
|
bytecode = output.evm.bytecode;
|
|
114484
115470
|
}
|
|
114485
|
-
return new this(
|
|
115471
|
+
return new this(abi49, bytecode, runner);
|
|
114486
115472
|
}
|
|
114487
115473
|
};
|
|
114488
115474
|
exports2.ContractFactory = ContractFactory;
|
|
@@ -119410,8 +120396,8 @@ var require_provider_etherscan = __commonJS({
|
|
|
119410
120396
|
action: "getabi",
|
|
119411
120397
|
address
|
|
119412
120398
|
});
|
|
119413
|
-
const
|
|
119414
|
-
return new index_js_2.Contract(address,
|
|
120399
|
+
const abi49 = JSON.parse(resp);
|
|
120400
|
+
return new index_js_2.Contract(address, abi49, this);
|
|
119415
120401
|
} catch (error) {
|
|
119416
120402
|
return null;
|
|
119417
120403
|
}
|
|
@@ -145374,9 +146360,9 @@ var require_node_gyp_build_optional_packages = __commonJS({
|
|
|
145374
146360
|
var vars = process.config && process.config.variables || {};
|
|
145375
146361
|
var prebuildsOnly = !!process.env.PREBUILDS_ONLY;
|
|
145376
146362
|
var versions = process.versions;
|
|
145377
|
-
var
|
|
146363
|
+
var abi49 = versions.modules;
|
|
145378
146364
|
if (versions.deno || process.isBun) {
|
|
145379
|
-
|
|
146365
|
+
abi49 = "unsupported";
|
|
145380
146366
|
}
|
|
145381
146367
|
var runtime = isElectron() ? "electron" : "node";
|
|
145382
146368
|
var arch = process.arch;
|
|
@@ -145423,7 +146409,7 @@ var require_node_gyp_build_optional_packages = __commonJS({
|
|
|
145423
146409
|
"platform=" + platform,
|
|
145424
146410
|
"arch=" + arch,
|
|
145425
146411
|
"runtime=" + runtime,
|
|
145426
|
-
"abi=" +
|
|
146412
|
+
"abi=" + abi49,
|
|
145427
146413
|
"uv=" + uv,
|
|
145428
146414
|
armv ? "armv=" + armv : "",
|
|
145429
146415
|
"libc=" + libc,
|
|
@@ -145441,7 +146427,7 @@ var require_node_gyp_build_optional_packages = __commonJS({
|
|
|
145441
146427
|
}
|
|
145442
146428
|
function resolveFile(prebuilds) {
|
|
145443
146429
|
var parsed = readdirSync(prebuilds).map(parseTags);
|
|
145444
|
-
var candidates = parsed.filter(matchTags(runtime,
|
|
146430
|
+
var candidates = parsed.filter(matchTags(runtime, abi49));
|
|
145445
146431
|
var winner = candidates.sort(compareTags(runtime))[0];
|
|
145446
146432
|
if (winner) return path12.join(prebuilds, winner.file);
|
|
145447
146433
|
}
|
|
@@ -145506,11 +146492,11 @@ var require_node_gyp_build_optional_packages = __commonJS({
|
|
|
145506
146492
|
}
|
|
145507
146493
|
return tags;
|
|
145508
146494
|
}
|
|
145509
|
-
function matchTags(runtime2,
|
|
146495
|
+
function matchTags(runtime2, abi50) {
|
|
145510
146496
|
return function(tags) {
|
|
145511
146497
|
if (tags == null) return false;
|
|
145512
146498
|
if (tags.runtime !== runtime2 && !runtimeAgnostic(tags)) return false;
|
|
145513
|
-
if (tags.abi !==
|
|
146499
|
+
if (tags.abi !== abi50 && !tags.napi) return false;
|
|
145514
146500
|
if (tags.uv && tags.uv !== uv) return false;
|
|
145515
146501
|
if (tags.armv && tags.armv !== armv) return false;
|
|
145516
146502
|
if (tags.libc && tags.libc !== libc) return false;
|
|
@@ -151763,11 +152749,11 @@ var require_formatAbi = __commonJS({
|
|
|
151763
152749
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
151764
152750
|
exports2.formatAbi = formatAbi;
|
|
151765
152751
|
var formatAbiItem_js_1 = require_formatAbiItem();
|
|
151766
|
-
function formatAbi(
|
|
152752
|
+
function formatAbi(abi49) {
|
|
151767
152753
|
const signatures = [];
|
|
151768
|
-
const length =
|
|
152754
|
+
const length = abi49.length;
|
|
151769
152755
|
for (let i = 0; i < length; i++) {
|
|
151770
|
-
const abiItem =
|
|
152756
|
+
const abiItem = abi49[i];
|
|
151771
152757
|
const signature = (0, formatAbiItem_js_1.formatAbiItem)(abiItem);
|
|
151772
152758
|
signatures.push(signature);
|
|
151773
152759
|
}
|
|
@@ -152530,15 +153516,15 @@ var require_parseAbi = __commonJS({
|
|
|
152530
153516
|
var utils_js_1 = require_utils13();
|
|
152531
153517
|
function parseAbi2(signatures) {
|
|
152532
153518
|
const structs = (0, structs_js_1.parseStructs)(signatures);
|
|
152533
|
-
const
|
|
153519
|
+
const abi49 = [];
|
|
152534
153520
|
const length = signatures.length;
|
|
152535
153521
|
for (let i = 0; i < length; i++) {
|
|
152536
153522
|
const signature = signatures[i];
|
|
152537
153523
|
if ((0, signatures_js_1.isStructSignature)(signature))
|
|
152538
153524
|
continue;
|
|
152539
|
-
|
|
153525
|
+
abi49.push((0, utils_js_1.parseSignature)(signature, structs));
|
|
152540
153526
|
}
|
|
152541
|
-
return
|
|
153527
|
+
return abi49;
|
|
152542
153528
|
}
|
|
152543
153529
|
}
|
|
152544
153530
|
});
|
|
@@ -162330,9 +163316,9 @@ var require_getAbiItem = __commonJS({
|
|
|
162330
163316
|
var toEventSelector_js_1 = require_toEventSelector();
|
|
162331
163317
|
var toFunctionSelector_js_1 = require_toFunctionSelector();
|
|
162332
163318
|
function getAbiItem2(parameters) {
|
|
162333
|
-
const { abi:
|
|
163319
|
+
const { abi: abi49, args = [], name } = parameters;
|
|
162334
163320
|
const isSelector = (0, isHex_js_1.isHex)(name, { strict: false });
|
|
162335
|
-
const abiItems =
|
|
163321
|
+
const abiItems = abi49.filter((abiItem) => {
|
|
162336
163322
|
if (isSelector) {
|
|
162337
163323
|
if (abiItem.type === "function")
|
|
162338
163324
|
return (0, toFunctionSelector_js_1.toFunctionSelector)(abiItem) === name;
|
|
@@ -162457,10 +163443,10 @@ var require_encodeEventTopics = __commonJS({
|
|
|
162457
163443
|
var getAbiItem_js_1 = require_getAbiItem();
|
|
162458
163444
|
var docsPath6 = "/docs/contract/encodeEventTopics";
|
|
162459
163445
|
function encodeEventTopics2(parameters) {
|
|
162460
|
-
const { abi:
|
|
162461
|
-
let abiItem =
|
|
163446
|
+
const { abi: abi49, eventName, args } = parameters;
|
|
163447
|
+
let abiItem = abi49[0];
|
|
162462
163448
|
if (eventName) {
|
|
162463
|
-
const item = (0, getAbiItem_js_1.getAbiItem)({ abi:
|
|
163449
|
+
const item = (0, getAbiItem_js_1.getAbiItem)({ abi: abi49, name: eventName });
|
|
162464
163450
|
if (!item)
|
|
162465
163451
|
throw new abi_js_1.AbiEventNotFoundError(eventName, { docsPath: docsPath6 });
|
|
162466
163452
|
abiItem = item;
|
|
@@ -162521,12 +163507,12 @@ var require_createContractEventFilter = __commonJS({
|
|
|
162521
163507
|
var toHex_js_1 = require_toHex();
|
|
162522
163508
|
var createFilterRequestScope_js_1 = require_createFilterRequestScope();
|
|
162523
163509
|
async function createContractEventFilter2(client, parameters) {
|
|
162524
|
-
const { address, abi:
|
|
163510
|
+
const { address, abi: abi49, args, eventName, fromBlock, strict, toBlock } = parameters;
|
|
162525
163511
|
const getRequest = (0, createFilterRequestScope_js_1.createFilterRequestScope)(client, {
|
|
162526
163512
|
method: "eth_newFilter"
|
|
162527
163513
|
});
|
|
162528
163514
|
const topics = eventName ? (0, encodeEventTopics_js_1.encodeEventTopics)({
|
|
162529
|
-
abi:
|
|
163515
|
+
abi: abi49,
|
|
162530
163516
|
args,
|
|
162531
163517
|
eventName
|
|
162532
163518
|
}) : void 0;
|
|
@@ -162542,7 +163528,7 @@ var require_createContractEventFilter = __commonJS({
|
|
|
162542
163528
|
]
|
|
162543
163529
|
});
|
|
162544
163530
|
return {
|
|
162545
|
-
abi:
|
|
163531
|
+
abi: abi49,
|
|
162546
163532
|
args,
|
|
162547
163533
|
eventName,
|
|
162548
163534
|
id,
|
|
@@ -162580,11 +163566,11 @@ var require_prepareEncodeFunctionData = __commonJS({
|
|
|
162580
163566
|
var getAbiItem_js_1 = require_getAbiItem();
|
|
162581
163567
|
var docsPath6 = "/docs/contract/encodeFunctionData";
|
|
162582
163568
|
function prepareEncodeFunctionData2(parameters) {
|
|
162583
|
-
const { abi:
|
|
162584
|
-
let abiItem =
|
|
163569
|
+
const { abi: abi49, args, functionName } = parameters;
|
|
163570
|
+
let abiItem = abi49[0];
|
|
162585
163571
|
if (functionName) {
|
|
162586
163572
|
const item = (0, getAbiItem_js_1.getAbiItem)({
|
|
162587
|
-
abi:
|
|
163573
|
+
abi: abi49,
|
|
162588
163574
|
args,
|
|
162589
163575
|
name: functionName
|
|
162590
163576
|
});
|
|
@@ -162613,12 +163599,12 @@ var require_encodeFunctionData = __commonJS({
|
|
|
162613
163599
|
var prepareEncodeFunctionData_js_1 = require_prepareEncodeFunctionData();
|
|
162614
163600
|
function encodeFunctionData2(parameters) {
|
|
162615
163601
|
const { args } = parameters;
|
|
162616
|
-
const { abi:
|
|
163602
|
+
const { abi: abi49, functionName } = (() => {
|
|
162617
163603
|
if (parameters.abi.length === 1 && parameters.functionName?.startsWith("0x"))
|
|
162618
163604
|
return parameters;
|
|
162619
163605
|
return (0, prepareEncodeFunctionData_js_1.prepareEncodeFunctionData)(parameters);
|
|
162620
163606
|
})();
|
|
162621
|
-
const abiItem =
|
|
163607
|
+
const abiItem = abi49[0];
|
|
162622
163608
|
const signature = functionName;
|
|
162623
163609
|
const data = "inputs" in abiItem && abiItem.inputs ? (0, encodeAbiParameters_js_1.encodeAbiParameters)(abiItem.inputs, args ?? []) : void 0;
|
|
162624
163610
|
return (0, concat_js_1.concatHex)([signature, data ?? "0x"]);
|
|
@@ -163150,11 +164136,11 @@ var require_decodeErrorResult = __commonJS({
|
|
|
163150
164136
|
var decodeAbiParameters_js_1 = require_decodeAbiParameters();
|
|
163151
164137
|
var formatAbiItem_js_1 = require_formatAbiItem2();
|
|
163152
164138
|
function decodeErrorResult2(parameters) {
|
|
163153
|
-
const { abi:
|
|
164139
|
+
const { abi: abi49, data } = parameters;
|
|
163154
164140
|
const signature = (0, slice_js_1.slice)(data, 0, 4);
|
|
163155
164141
|
if (signature === "0x")
|
|
163156
164142
|
throw new abi_js_1.AbiDecodingZeroDataError();
|
|
163157
|
-
const abi_ = [...
|
|
164143
|
+
const abi_ = [...abi49 || [], solidity_js_1.solidityError, solidity_js_1.solidityPanic];
|
|
163158
164144
|
const abiItem = abi_.find((x) => x.type === "error" && signature === (0, toFunctionSelector_js_1.toFunctionSelector)((0, formatAbiItem_js_1.formatAbiItem)(x)));
|
|
163159
164145
|
if (!abiItem)
|
|
163160
164146
|
throw new abi_js_1.AbiErrorSignatureNotFoundError(signature, {
|
|
@@ -163576,8 +164562,8 @@ ${(0, stateOverride_js_1.prettyStateOverride)(stateOverride)}`;
|
|
|
163576
164562
|
};
|
|
163577
164563
|
exports2.CallExecutionError = CallExecutionError2;
|
|
163578
164564
|
var ContractFunctionExecutionError2 = class extends base_js_1.BaseError {
|
|
163579
|
-
constructor(cause, { abi:
|
|
163580
|
-
const abiItem = (0, getAbiItem_js_1.getAbiItem)({ abi:
|
|
164565
|
+
constructor(cause, { abi: abi49, args, contractAddress, docsPath: docsPath6, functionName, sender }) {
|
|
164566
|
+
const abiItem = (0, getAbiItem_js_1.getAbiItem)({ abi: abi49, args, name: functionName });
|
|
163581
164567
|
const formattedArgs = abiItem ? (0, formatAbiItemWithArgs_js_1.formatAbiItemWithArgs)({
|
|
163582
164568
|
abiItem,
|
|
163583
164569
|
args,
|
|
@@ -163643,7 +164629,7 @@ ${(0, stateOverride_js_1.prettyStateOverride)(stateOverride)}`;
|
|
|
163643
164629
|
writable: true,
|
|
163644
164630
|
value: void 0
|
|
163645
164631
|
});
|
|
163646
|
-
this.abi =
|
|
164632
|
+
this.abi = abi49;
|
|
163647
164633
|
this.args = args;
|
|
163648
164634
|
this.cause = cause;
|
|
163649
164635
|
this.contractAddress = contractAddress;
|
|
@@ -163653,14 +164639,14 @@ ${(0, stateOverride_js_1.prettyStateOverride)(stateOverride)}`;
|
|
|
163653
164639
|
};
|
|
163654
164640
|
exports2.ContractFunctionExecutionError = ContractFunctionExecutionError2;
|
|
163655
164641
|
var ContractFunctionRevertedError2 = class extends base_js_1.BaseError {
|
|
163656
|
-
constructor({ abi:
|
|
164642
|
+
constructor({ abi: abi49, data, functionName, message }) {
|
|
163657
164643
|
let cause;
|
|
163658
164644
|
let decodedData = void 0;
|
|
163659
164645
|
let metaMessages;
|
|
163660
164646
|
let reason;
|
|
163661
164647
|
if (data && data !== "0x") {
|
|
163662
164648
|
try {
|
|
163663
|
-
decodedData = (0, decodeErrorResult_js_1.decodeErrorResult)({ abi:
|
|
164649
|
+
decodedData = (0, decodeErrorResult_js_1.decodeErrorResult)({ abi: abi49, data });
|
|
163664
164650
|
const { abiItem, errorName, args: errorArgs } = decodedData;
|
|
163665
164651
|
if (errorName === "Error") {
|
|
163666
164652
|
reason = errorArgs[0];
|
|
@@ -164260,7 +165246,7 @@ var require_getContractError = __commonJS({
|
|
|
164260
165246
|
var request_js_1 = require_request();
|
|
164261
165247
|
var rpc_js_1 = require_rpc();
|
|
164262
165248
|
var EXECUTION_REVERTED_ERROR_CODE2 = 3;
|
|
164263
|
-
function getContractError2(err, { abi:
|
|
165249
|
+
function getContractError2(err, { abi: abi49, address, args, docsPath: docsPath6, functionName, sender }) {
|
|
164264
165250
|
const error = err instanceof contract_js_1.RawContractError ? err : err instanceof base_js_1.BaseError ? err.walk((err2) => "data" in err2) || err.walk() : {};
|
|
164265
165251
|
const { code, data, details, message, shortMessage } = error;
|
|
164266
165252
|
const cause = (() => {
|
|
@@ -164268,7 +165254,7 @@ var require_getContractError = __commonJS({
|
|
|
164268
165254
|
return new contract_js_1.ContractFunctionZeroDataError({ functionName });
|
|
164269
165255
|
if ([EXECUTION_REVERTED_ERROR_CODE2, rpc_js_1.InternalRpcError.code].includes(code) && (data || details || message || shortMessage)) {
|
|
164270
165256
|
return new contract_js_1.ContractFunctionRevertedError({
|
|
164271
|
-
abi:
|
|
165257
|
+
abi: abi49,
|
|
164272
165258
|
data: typeof data === "object" ? data.data : data,
|
|
164273
165259
|
functionName,
|
|
164274
165260
|
message: error instanceof request_js_1.RpcRequestError ? details : shortMessage ?? message
|
|
@@ -164277,7 +165263,7 @@ var require_getContractError = __commonJS({
|
|
|
164277
165263
|
return err;
|
|
164278
165264
|
})();
|
|
164279
165265
|
return new contract_js_1.ContractFunctionExecutionError(cause, {
|
|
164280
|
-
abi:
|
|
165266
|
+
abi: abi49,
|
|
164281
165267
|
args,
|
|
164282
165268
|
contractAddress: address,
|
|
164283
165269
|
docsPath: docsPath6,
|
|
@@ -168744,9 +169730,9 @@ var require_estimateContractGas = __commonJS({
|
|
|
168744
169730
|
var getAction_js_1 = require_getAction();
|
|
168745
169731
|
var estimateGas_js_1 = require_estimateGas2();
|
|
168746
169732
|
async function estimateContractGas2(client, parameters) {
|
|
168747
|
-
const { abi:
|
|
169733
|
+
const { abi: abi49, address, args, functionName, dataSuffix, ...request } = parameters;
|
|
168748
169734
|
const data = (0, encodeFunctionData_js_1.encodeFunctionData)({
|
|
168749
|
-
abi:
|
|
169735
|
+
abi: abi49,
|
|
168750
169736
|
args,
|
|
168751
169737
|
functionName
|
|
168752
169738
|
});
|
|
@@ -168760,7 +169746,7 @@ var require_estimateContractGas = __commonJS({
|
|
|
168760
169746
|
} catch (error) {
|
|
168761
169747
|
const account = request.account ? (0, parseAccount_js_1.parseAccount)(request.account) : void 0;
|
|
168762
169748
|
throw (0, getContractError_js_1.getContractError)(error, {
|
|
168763
|
-
abi:
|
|
169749
|
+
abi: abi49,
|
|
168764
169750
|
address,
|
|
168765
169751
|
args,
|
|
168766
169752
|
docsPath: "/docs/contract/estimateContractGas",
|
|
@@ -168804,15 +169790,15 @@ var require_decodeEventLog = __commonJS({
|
|
|
168804
169790
|
var formatAbiItem_js_1 = require_formatAbiItem2();
|
|
168805
169791
|
var docsPath6 = "/docs/contract/decodeEventLog";
|
|
168806
169792
|
function decodeEventLog2(parameters) {
|
|
168807
|
-
const { abi:
|
|
169793
|
+
const { abi: abi49, data, strict: strict_, topics } = parameters;
|
|
168808
169794
|
const strict = strict_ ?? true;
|
|
168809
169795
|
const [signature, ...argTopics] = topics;
|
|
168810
169796
|
if (!signature)
|
|
168811
169797
|
throw new abi_js_1.AbiEventSignatureEmptyTopicsError({ docsPath: docsPath6 });
|
|
168812
169798
|
const abiItem = (() => {
|
|
168813
|
-
if (
|
|
168814
|
-
return
|
|
168815
|
-
return
|
|
169799
|
+
if (abi49.length === 1)
|
|
169800
|
+
return abi49[0];
|
|
169801
|
+
return abi49.find((x) => x.type === "event" && signature === (0, toEventSelector_js_1.toEventSelector)((0, formatAbiItem_js_1.formatAbiItem)(x)));
|
|
168816
169802
|
})();
|
|
168817
169803
|
if (!(abiItem && "name" in abiItem) || abiItem.type !== "event")
|
|
168818
169804
|
throw new abi_js_1.AbiEventSignatureNotFoundError(signature, { docsPath: docsPath6 });
|
|
@@ -168892,7 +169878,7 @@ var require_parseEventLogs = __commonJS({
|
|
|
168892
169878
|
var toEventSelector_js_1 = require_toEventSelector();
|
|
168893
169879
|
var decodeEventLog_js_1 = require_decodeEventLog();
|
|
168894
169880
|
function parseEventLogs2(parameters) {
|
|
168895
|
-
const { abi:
|
|
169881
|
+
const { abi: abi49, args, logs, strict = true } = parameters;
|
|
168896
169882
|
const eventName = (() => {
|
|
168897
169883
|
if (!parameters.eventName)
|
|
168898
169884
|
return void 0;
|
|
@@ -168902,7 +169888,7 @@ var require_parseEventLogs = __commonJS({
|
|
|
168902
169888
|
})();
|
|
168903
169889
|
return logs.map((log2) => {
|
|
168904
169890
|
try {
|
|
168905
|
-
const abiItem =
|
|
169891
|
+
const abiItem = abi49.find((abiItem2) => abiItem2.type === "event" && log2.topics[0] === (0, toEventSelector_js_1.toEventSelector)(abiItem2));
|
|
168906
169892
|
if (!abiItem)
|
|
168907
169893
|
return null;
|
|
168908
169894
|
const event = (0, decodeEventLog_js_1.decodeEventLog)({
|
|
@@ -169063,9 +170049,9 @@ var require_getContractEvents = __commonJS({
|
|
|
169063
170049
|
var getAction_js_1 = require_getAction();
|
|
169064
170050
|
var getLogs_js_1 = require_getLogs();
|
|
169065
170051
|
async function getContractEvents2(client, parameters) {
|
|
169066
|
-
const { abi:
|
|
169067
|
-
const event = eventName ? (0, getAbiItem_js_1.getAbiItem)({ abi:
|
|
169068
|
-
const events = !event ?
|
|
170052
|
+
const { abi: abi49, address, args, blockHash, eventName, fromBlock, toBlock, strict } = parameters;
|
|
170053
|
+
const event = eventName ? (0, getAbiItem_js_1.getAbiItem)({ abi: abi49, name: eventName }) : void 0;
|
|
170054
|
+
const events = !event ? abi49.filter((x) => x.type === "event") : void 0;
|
|
169069
170055
|
return (0, getAction_js_1.getAction)(client, getLogs_js_1.getLogs, "getLogs")({
|
|
169070
170056
|
address,
|
|
169071
170057
|
args,
|
|
@@ -169091,10 +170077,10 @@ var require_decodeFunctionResult = __commonJS({
|
|
|
169091
170077
|
var getAbiItem_js_1 = require_getAbiItem();
|
|
169092
170078
|
var docsPath6 = "/docs/contract/decodeFunctionResult";
|
|
169093
170079
|
function decodeFunctionResult2(parameters) {
|
|
169094
|
-
const { abi:
|
|
169095
|
-
let abiItem =
|
|
170080
|
+
const { abi: abi49, args, functionName, data } = parameters;
|
|
170081
|
+
let abiItem = abi49[0];
|
|
169096
170082
|
if (functionName) {
|
|
169097
|
-
const item = (0, getAbiItem_js_1.getAbiItem)({ abi:
|
|
170083
|
+
const item = (0, getAbiItem_js_1.getAbiItem)({ abi: abi49, args, name: functionName });
|
|
169098
170084
|
if (!item)
|
|
169099
170085
|
throw new abi_js_1.AbiFunctionNotFoundError(functionName, { docsPath: docsPath6 });
|
|
169100
170086
|
abiItem = item;
|
|
@@ -170649,10 +171635,10 @@ var require_encodeDeployData = __commonJS({
|
|
|
170649
171635
|
var encodeAbiParameters_js_1 = require_encodeAbiParameters();
|
|
170650
171636
|
var docsPath6 = "/docs/contract/encodeDeployData";
|
|
170651
171637
|
function encodeDeployData2(parameters) {
|
|
170652
|
-
const { abi:
|
|
171638
|
+
const { abi: abi49, args, bytecode } = parameters;
|
|
170653
171639
|
if (!args || args.length === 0)
|
|
170654
171640
|
return bytecode;
|
|
170655
|
-
const description =
|
|
171641
|
+
const description = abi49.find((x) => "type" in x && x.type === "constructor");
|
|
170656
171642
|
if (!description)
|
|
170657
171643
|
throw new abi_js_1.AbiConstructorNotFoundError({ docsPath: docsPath6 });
|
|
170658
171644
|
if (!("inputs" in description))
|
|
@@ -171191,9 +172177,9 @@ var require_readContract = __commonJS({
|
|
|
171191
172177
|
var getAction_js_1 = require_getAction();
|
|
171192
172178
|
var call_js_1 = require_call();
|
|
171193
172179
|
async function readContract2(client, parameters) {
|
|
171194
|
-
const { abi:
|
|
172180
|
+
const { abi: abi49, address, args, functionName, ...rest } = parameters;
|
|
171195
172181
|
const calldata = (0, encodeFunctionData_js_1.encodeFunctionData)({
|
|
171196
|
-
abi:
|
|
172182
|
+
abi: abi49,
|
|
171197
172183
|
args,
|
|
171198
172184
|
functionName
|
|
171199
172185
|
});
|
|
@@ -171204,14 +172190,14 @@ var require_readContract = __commonJS({
|
|
|
171204
172190
|
to: address
|
|
171205
172191
|
});
|
|
171206
172192
|
return (0, decodeFunctionResult_js_1.decodeFunctionResult)({
|
|
171207
|
-
abi:
|
|
172193
|
+
abi: abi49,
|
|
171208
172194
|
args,
|
|
171209
172195
|
functionName,
|
|
171210
172196
|
data: data || "0x"
|
|
171211
172197
|
});
|
|
171212
172198
|
} catch (error) {
|
|
171213
172199
|
throw (0, getContractError_js_1.getContractError)(error, {
|
|
171214
|
-
abi:
|
|
172200
|
+
abi: abi49,
|
|
171215
172201
|
address,
|
|
171216
172202
|
args,
|
|
171217
172203
|
docsPath: "/docs/contract/readContract",
|
|
@@ -171235,9 +172221,9 @@ var require_simulateContract = __commonJS({
|
|
|
171235
172221
|
var getAction_js_1 = require_getAction();
|
|
171236
172222
|
var call_js_1 = require_call();
|
|
171237
172223
|
async function simulateContract2(client, parameters) {
|
|
171238
|
-
const { abi:
|
|
172224
|
+
const { abi: abi49, address, args, dataSuffix, functionName, ...callRequest } = parameters;
|
|
171239
172225
|
const account = callRequest.account ? (0, parseAccount_js_1.parseAccount)(callRequest.account) : client.account;
|
|
171240
|
-
const calldata = (0, encodeFunctionData_js_1.encodeFunctionData)({ abi:
|
|
172226
|
+
const calldata = (0, encodeFunctionData_js_1.encodeFunctionData)({ abi: abi49, args, functionName });
|
|
171241
172227
|
try {
|
|
171242
172228
|
const { data } = await (0, getAction_js_1.getAction)(client, call_js_1.call, "call")({
|
|
171243
172229
|
batch: false,
|
|
@@ -171247,12 +172233,12 @@ var require_simulateContract = __commonJS({
|
|
|
171247
172233
|
account
|
|
171248
172234
|
});
|
|
171249
172235
|
const result = (0, decodeFunctionResult_js_1.decodeFunctionResult)({
|
|
171250
|
-
abi:
|
|
172236
|
+
abi: abi49,
|
|
171251
172237
|
args,
|
|
171252
172238
|
functionName,
|
|
171253
172239
|
data: data || "0x"
|
|
171254
172240
|
});
|
|
171255
|
-
const minimizedAbi =
|
|
172241
|
+
const minimizedAbi = abi49.filter((abiItem) => "name" in abiItem && abiItem.name === parameters.functionName);
|
|
171256
172242
|
return {
|
|
171257
172243
|
result,
|
|
171258
172244
|
request: {
|
|
@@ -171267,7 +172253,7 @@ var require_simulateContract = __commonJS({
|
|
|
171267
172253
|
};
|
|
171268
172254
|
} catch (error) {
|
|
171269
172255
|
throw (0, getContractError_js_1.getContractError)(error, {
|
|
171270
|
-
abi:
|
|
172256
|
+
abi: abi49,
|
|
171271
172257
|
address,
|
|
171272
172258
|
args,
|
|
171273
172259
|
docsPath: "/docs/contract/simulateContract",
|
|
@@ -171509,7 +172495,7 @@ var require_watchContractEvent = __commonJS({
|
|
|
171509
172495
|
var getFilterChanges_js_1 = require_getFilterChanges();
|
|
171510
172496
|
var uninstallFilter_js_1 = require_uninstallFilter();
|
|
171511
172497
|
function watchContractEvent2(client, parameters) {
|
|
171512
|
-
const { abi:
|
|
172498
|
+
const { abi: abi49, address, args, batch = true, eventName, fromBlock, onError, onLogs, poll: poll_, pollingInterval = client.pollingInterval, strict: strict_ } = parameters;
|
|
171513
172499
|
const enablePolling = (() => {
|
|
171514
172500
|
if (typeof poll_ !== "undefined")
|
|
171515
172501
|
return poll_;
|
|
@@ -171544,7 +172530,7 @@ var require_watchContractEvent = __commonJS({
|
|
|
171544
172530
|
if (!initialized) {
|
|
171545
172531
|
try {
|
|
171546
172532
|
filter = await (0, getAction_js_1.getAction)(client, createContractEventFilter_js_1.createContractEventFilter, "createContractEventFilter")({
|
|
171547
|
-
abi:
|
|
172533
|
+
abi: abi49,
|
|
171548
172534
|
address,
|
|
171549
172535
|
args,
|
|
171550
172536
|
eventName,
|
|
@@ -171564,7 +172550,7 @@ var require_watchContractEvent = __commonJS({
|
|
|
171564
172550
|
const blockNumber = await (0, getAction_js_1.getAction)(client, getBlockNumber_js_1.getBlockNumber, "getBlockNumber")({});
|
|
171565
172551
|
if (previousBlockNumber && previousBlockNumber < blockNumber) {
|
|
171566
172552
|
logs = await (0, getAction_js_1.getAction)(client, getContractEvents_js_1.getContractEvents, "getContractEvents")({
|
|
171567
|
-
abi:
|
|
172553
|
+
abi: abi49,
|
|
171568
172554
|
address,
|
|
171569
172555
|
args,
|
|
171570
172556
|
eventName,
|
|
@@ -171628,7 +172614,7 @@ var require_watchContractEvent = __commonJS({
|
|
|
171628
172614
|
return client.transport;
|
|
171629
172615
|
})();
|
|
171630
172616
|
const topics = eventName ? (0, encodeEventTopics_js_1.encodeEventTopics)({
|
|
171631
|
-
abi:
|
|
172617
|
+
abi: abi49,
|
|
171632
172618
|
eventName,
|
|
171633
172619
|
args
|
|
171634
172620
|
}) : [];
|
|
@@ -171640,7 +172626,7 @@ var require_watchContractEvent = __commonJS({
|
|
|
171640
172626
|
const log2 = data.result;
|
|
171641
172627
|
try {
|
|
171642
172628
|
const { eventName: eventName2, args: args2 } = (0, decodeEventLog_js_1.decodeEventLog)({
|
|
171643
|
-
abi:
|
|
172629
|
+
abi: abi49,
|
|
171644
172630
|
data: log2.data,
|
|
171645
172631
|
topics: log2.topics,
|
|
171646
172632
|
strict: strict_
|
|
@@ -171940,14 +172926,14 @@ var require_writeContract = __commonJS({
|
|
|
171940
172926
|
var getAction_js_1 = require_getAction();
|
|
171941
172927
|
var sendTransaction_js_1 = require_sendTransaction();
|
|
171942
172928
|
async function writeContract2(client, parameters) {
|
|
171943
|
-
const { abi:
|
|
172929
|
+
const { abi: abi49, account: account_ = client.account, address, args, dataSuffix, functionName, ...request } = parameters;
|
|
171944
172930
|
if (typeof account_ === "undefined")
|
|
171945
172931
|
throw new account_js_1.AccountNotFoundError({
|
|
171946
172932
|
docsPath: "/docs/contract/writeContract"
|
|
171947
172933
|
});
|
|
171948
172934
|
const account = account_ ? (0, parseAccount_js_1.parseAccount)(account_) : null;
|
|
171949
172935
|
const data = (0, encodeFunctionData_js_1.encodeFunctionData)({
|
|
171950
|
-
abi:
|
|
172936
|
+
abi: abi49,
|
|
171951
172937
|
args,
|
|
171952
172938
|
functionName
|
|
171953
172939
|
});
|
|
@@ -171960,7 +172946,7 @@ var require_writeContract = __commonJS({
|
|
|
171960
172946
|
});
|
|
171961
172947
|
} catch (error) {
|
|
171962
172948
|
throw (0, getContractError_js_1.getContractError)(error, {
|
|
171963
|
-
abi:
|
|
172949
|
+
abi: abi49,
|
|
171964
172950
|
address,
|
|
171965
172951
|
args,
|
|
171966
172952
|
docsPath: "/docs/contract/writeContract",
|
|
@@ -171988,7 +172974,7 @@ var require_getContract = __commonJS({
|
|
|
171988
172974
|
var simulateContract_js_1 = require_simulateContract();
|
|
171989
172975
|
var watchContractEvent_js_1 = require_watchContractEvent();
|
|
171990
172976
|
var writeContract_js_1 = require_writeContract();
|
|
171991
|
-
function getContract2({ abi:
|
|
172977
|
+
function getContract2({ abi: abi49, address, client: client_ }) {
|
|
171992
172978
|
const client = client_;
|
|
171993
172979
|
const [publicClient, walletClient] = (() => {
|
|
171994
172980
|
if (!client)
|
|
@@ -172007,7 +172993,7 @@ var require_getContract = __commonJS({
|
|
|
172007
172993
|
let hasReadFunction = false;
|
|
172008
172994
|
let hasWriteFunction = false;
|
|
172009
172995
|
let hasEvent = false;
|
|
172010
|
-
for (const item of
|
|
172996
|
+
for (const item of abi49) {
|
|
172011
172997
|
if (item.type === "function")
|
|
172012
172998
|
if (item.stateMutability === "view" || item.stateMutability === "pure")
|
|
172013
172999
|
hasReadFunction = true;
|
|
@@ -172025,7 +173011,7 @@ var require_getContract = __commonJS({
|
|
|
172025
173011
|
return (...parameters) => {
|
|
172026
173012
|
const { args, options } = getFunctionParameters2(parameters);
|
|
172027
173013
|
return (0, getAction_js_1.getAction)(publicClient, readContract_js_1.readContract, "readContract")({
|
|
172028
|
-
abi:
|
|
173014
|
+
abi: abi49,
|
|
172029
173015
|
address,
|
|
172030
173016
|
functionName,
|
|
172031
173017
|
args,
|
|
@@ -172040,7 +173026,7 @@ var require_getContract = __commonJS({
|
|
|
172040
173026
|
return (...parameters) => {
|
|
172041
173027
|
const { args, options } = getFunctionParameters2(parameters);
|
|
172042
173028
|
return (0, getAction_js_1.getAction)(publicClient, simulateContract_js_1.simulateContract, "simulateContract")({
|
|
172043
|
-
abi:
|
|
173029
|
+
abi: abi49,
|
|
172044
173030
|
address,
|
|
172045
173031
|
functionName,
|
|
172046
173032
|
args,
|
|
@@ -172053,10 +173039,10 @@ var require_getContract = __commonJS({
|
|
|
172053
173039
|
contract.createEventFilter = new Proxy({}, {
|
|
172054
173040
|
get(_, eventName) {
|
|
172055
173041
|
return (...parameters) => {
|
|
172056
|
-
const abiEvent =
|
|
173042
|
+
const abiEvent = abi49.find((x) => x.type === "event" && x.name === eventName);
|
|
172057
173043
|
const { args, options } = getEventParameters2(parameters, abiEvent);
|
|
172058
173044
|
return (0, getAction_js_1.getAction)(publicClient, createContractEventFilter_js_1.createContractEventFilter, "createContractEventFilter")({
|
|
172059
|
-
abi:
|
|
173045
|
+
abi: abi49,
|
|
172060
173046
|
address,
|
|
172061
173047
|
eventName,
|
|
172062
173048
|
args,
|
|
@@ -172068,10 +173054,10 @@ var require_getContract = __commonJS({
|
|
|
172068
173054
|
contract.getEvents = new Proxy({}, {
|
|
172069
173055
|
get(_, eventName) {
|
|
172070
173056
|
return (...parameters) => {
|
|
172071
|
-
const abiEvent =
|
|
173057
|
+
const abiEvent = abi49.find((x) => x.type === "event" && x.name === eventName);
|
|
172072
173058
|
const { args, options } = getEventParameters2(parameters, abiEvent);
|
|
172073
173059
|
return (0, getAction_js_1.getAction)(publicClient, getContractEvents_js_1.getContractEvents, "getContractEvents")({
|
|
172074
|
-
abi:
|
|
173060
|
+
abi: abi49,
|
|
172075
173061
|
address,
|
|
172076
173062
|
eventName,
|
|
172077
173063
|
args,
|
|
@@ -172083,10 +173069,10 @@ var require_getContract = __commonJS({
|
|
|
172083
173069
|
contract.watchEvent = new Proxy({}, {
|
|
172084
173070
|
get(_, eventName) {
|
|
172085
173071
|
return (...parameters) => {
|
|
172086
|
-
const abiEvent =
|
|
173072
|
+
const abiEvent = abi49.find((x) => x.type === "event" && x.name === eventName);
|
|
172087
173073
|
const { args, options } = getEventParameters2(parameters, abiEvent);
|
|
172088
173074
|
return (0, getAction_js_1.getAction)(publicClient, watchContractEvent_js_1.watchContractEvent, "watchContractEvent")({
|
|
172089
|
-
abi:
|
|
173075
|
+
abi: abi49,
|
|
172090
173076
|
address,
|
|
172091
173077
|
eventName,
|
|
172092
173078
|
args,
|
|
@@ -172104,7 +173090,7 @@ var require_getContract = __commonJS({
|
|
|
172104
173090
|
return (...parameters) => {
|
|
172105
173091
|
const { args, options } = getFunctionParameters2(parameters);
|
|
172106
173092
|
return (0, getAction_js_1.getAction)(walletClient, writeContract_js_1.writeContract, "writeContract")({
|
|
172107
|
-
abi:
|
|
173093
|
+
abi: abi49,
|
|
172108
173094
|
address,
|
|
172109
173095
|
functionName,
|
|
172110
173096
|
args,
|
|
@@ -172122,7 +173108,7 @@ var require_getContract = __commonJS({
|
|
|
172122
173108
|
const { args, options } = getFunctionParameters2(parameters);
|
|
172123
173109
|
const client2 = publicClient ?? walletClient;
|
|
172124
173110
|
return (0, getAction_js_1.getAction)(client2, estimateContractGas_js_1.estimateContractGas, "estimateContractGas")({
|
|
172125
|
-
abi:
|
|
173111
|
+
abi: abi49,
|
|
172126
173112
|
address,
|
|
172127
173113
|
functionName,
|
|
172128
173114
|
args,
|
|
@@ -172134,7 +173120,7 @@ var require_getContract = __commonJS({
|
|
|
172134
173120
|
});
|
|
172135
173121
|
}
|
|
172136
173122
|
contract.address = address;
|
|
172137
|
-
contract.abi =
|
|
173123
|
+
contract.abi = abi49;
|
|
172138
173124
|
return contract;
|
|
172139
173125
|
}
|
|
172140
173126
|
function getFunctionParameters2(values) {
|
|
@@ -173760,7 +174746,7 @@ var require_getEip712Domain = __commonJS({
|
|
|
173760
174746
|
const { address, factory, factoryData } = parameters;
|
|
173761
174747
|
try {
|
|
173762
174748
|
const [fields, name, version4, chainId, verifyingContract, salt, extensions] = await (0, getAction_js_1.getAction)(client, readContract_js_1.readContract, "readContract")({
|
|
173763
|
-
abi:
|
|
174749
|
+
abi: abi49,
|
|
173764
174750
|
address,
|
|
173765
174751
|
functionName: "eip712Domain",
|
|
173766
174752
|
factory,
|
|
@@ -173785,7 +174771,7 @@ var require_getEip712Domain = __commonJS({
|
|
|
173785
174771
|
throw error;
|
|
173786
174772
|
}
|
|
173787
174773
|
}
|
|
173788
|
-
var
|
|
174774
|
+
var abi49 = [
|
|
173789
174775
|
{
|
|
173790
174776
|
inputs: [],
|
|
173791
174777
|
name: "eip712Domain",
|
|
@@ -178120,9 +179106,9 @@ var require_decodeFunctionData = __commonJS({
|
|
|
178120
179106
|
var decodeAbiParameters_js_1 = require_decodeAbiParameters();
|
|
178121
179107
|
var formatAbiItem_js_1 = require_formatAbiItem2();
|
|
178122
179108
|
function decodeFunctionData2(parameters) {
|
|
178123
|
-
const { abi:
|
|
179109
|
+
const { abi: abi49, data } = parameters;
|
|
178124
179110
|
const signature = (0, slice_js_1.slice)(data, 0, 4);
|
|
178125
|
-
const description =
|
|
179111
|
+
const description = abi49.find((x) => x.type === "function" && signature === (0, toFunctionSelector_js_1.toFunctionSelector)((0, formatAbiItem_js_1.formatAbiItem)(x)));
|
|
178126
179112
|
if (!description)
|
|
178127
179113
|
throw new abi_js_1.AbiFunctionSignatureNotFoundError(signature, {
|
|
178128
179114
|
docsPath: "/docs/contract/decodeFunctionData"
|
|
@@ -178149,10 +179135,10 @@ var require_encodeErrorResult = __commonJS({
|
|
|
178149
179135
|
var getAbiItem_js_1 = require_getAbiItem();
|
|
178150
179136
|
var docsPath6 = "/docs/contract/encodeErrorResult";
|
|
178151
179137
|
function encodeErrorResult(parameters) {
|
|
178152
|
-
const { abi:
|
|
178153
|
-
let abiItem =
|
|
179138
|
+
const { abi: abi49, errorName, args } = parameters;
|
|
179139
|
+
let abiItem = abi49[0];
|
|
178154
179140
|
if (errorName) {
|
|
178155
|
-
const item = (0, getAbiItem_js_1.getAbiItem)({ abi:
|
|
179141
|
+
const item = (0, getAbiItem_js_1.getAbiItem)({ abi: abi49, args, name: errorName });
|
|
178156
179142
|
if (!item)
|
|
178157
179143
|
throw new abi_js_1.AbiErrorNotFoundError(errorName, { docsPath: docsPath6 });
|
|
178158
179144
|
abiItem = item;
|
|
@@ -178183,10 +179169,10 @@ var require_encodeFunctionResult = __commonJS({
|
|
|
178183
179169
|
var getAbiItem_js_1 = require_getAbiItem();
|
|
178184
179170
|
var docsPath6 = "/docs/contract/encodeFunctionResult";
|
|
178185
179171
|
function encodeFunctionResult(parameters) {
|
|
178186
|
-
const { abi:
|
|
178187
|
-
let abiItem =
|
|
179172
|
+
const { abi: abi49, functionName, result } = parameters;
|
|
179173
|
+
let abiItem = abi49[0];
|
|
178188
179174
|
if (functionName) {
|
|
178189
|
-
const item = (0, getAbiItem_js_1.getAbiItem)({ abi:
|
|
179175
|
+
const item = (0, getAbiItem_js_1.getAbiItem)({ abi: abi49, name: functionName });
|
|
178190
179176
|
if (!item)
|
|
178191
179177
|
throw new abi_js_1.AbiFunctionNotFoundError(functionName, { docsPath: docsPath6 });
|
|
178192
179178
|
abiItem = item;
|
|
@@ -180475,9 +181461,9 @@ var require_multicall2 = __commonJS({
|
|
|
180475
181461
|
let currentChunk = 0;
|
|
180476
181462
|
let currentChunkSize = 0;
|
|
180477
181463
|
for (let i = 0; i < contracts2.length; i++) {
|
|
180478
|
-
const { abi:
|
|
181464
|
+
const { abi: abi49, address, args, functionName } = contracts2[i];
|
|
180479
181465
|
try {
|
|
180480
|
-
const callData = (0, encodeFunctionData_js_1.encodeFunctionData)({ abi:
|
|
181466
|
+
const callData = (0, encodeFunctionData_js_1.encodeFunctionData)({ abi: abi49, args, functionName });
|
|
180481
181467
|
currentChunkSize += (callData.length - 2) / 2;
|
|
180482
181468
|
if (batchSize > 0 && currentChunkSize > batchSize && chunkedCalls[currentChunk].length > 0) {
|
|
180483
181469
|
currentChunk++;
|
|
@@ -180494,7 +181480,7 @@ var require_multicall2 = __commonJS({
|
|
|
180494
181480
|
];
|
|
180495
181481
|
} catch (err) {
|
|
180496
181482
|
const error = (0, getContractError_js_1.getContractError)(err, {
|
|
180497
|
-
abi:
|
|
181483
|
+
abi: abi49,
|
|
180498
181484
|
address,
|
|
180499
181485
|
args,
|
|
180500
181486
|
docsPath: "/docs/contract/multicall",
|
|
@@ -180540,14 +181526,14 @@ var require_multicall2 = __commonJS({
|
|
|
180540
181526
|
for (let j = 0; j < aggregate3Result.length; j++) {
|
|
180541
181527
|
const { returnData, success } = aggregate3Result[j];
|
|
180542
181528
|
const { callData } = chunkedCalls[i][j];
|
|
180543
|
-
const { abi:
|
|
181529
|
+
const { abi: abi49, address, functionName, args } = contracts2[results.length];
|
|
180544
181530
|
try {
|
|
180545
181531
|
if (callData === "0x")
|
|
180546
181532
|
throw new abi_js_1.AbiDecodingZeroDataError();
|
|
180547
181533
|
if (!success)
|
|
180548
181534
|
throw new contract_js_1.RawContractError({ data: returnData });
|
|
180549
181535
|
const result2 = (0, decodeFunctionResult_js_1.decodeFunctionResult)({
|
|
180550
|
-
abi:
|
|
181536
|
+
abi: abi49,
|
|
180551
181537
|
args,
|
|
180552
181538
|
data: returnData,
|
|
180553
181539
|
functionName
|
|
@@ -180555,7 +181541,7 @@ var require_multicall2 = __commonJS({
|
|
|
180555
181541
|
results.push(allowFailure ? { result: result2, status: "success" } : result2);
|
|
180556
181542
|
} catch (err) {
|
|
180557
181543
|
const error = (0, getContractError_js_1.getContractError)(err, {
|
|
180558
|
-
abi:
|
|
181544
|
+
abi: abi49,
|
|
180559
181545
|
address,
|
|
180560
181546
|
args,
|
|
180561
181547
|
docsPath: "/docs/contract/multicall",
|
|
@@ -181607,13 +182593,13 @@ var require_simulateBlocks = __commonJS({
|
|
|
181607
182593
|
return result.map((block2, i) => ({
|
|
181608
182594
|
...(0, block_js_1.formatBlock)(block2),
|
|
181609
182595
|
calls: block2.calls.map((call2, j) => {
|
|
181610
|
-
const { abi:
|
|
182596
|
+
const { abi: abi49, args, functionName, to } = blocks[i].calls[j];
|
|
181611
182597
|
const data = call2.error?.data ?? call2.returnData;
|
|
181612
182598
|
const gasUsed = BigInt(call2.gasUsed);
|
|
181613
182599
|
const logs = call2.logs?.map((log2) => (0, log_js_1.formatLog)(log2));
|
|
181614
182600
|
const status = call2.status === "0x1" ? "success" : "failure";
|
|
181615
|
-
const result2 =
|
|
181616
|
-
abi:
|
|
182601
|
+
const result2 = abi49 && status === "success" && data !== "0x" ? (0, decodeFunctionResult_js_1.decodeFunctionResult)({
|
|
182602
|
+
abi: abi49,
|
|
181617
182603
|
data,
|
|
181618
182604
|
functionName
|
|
181619
182605
|
}) : null;
|
|
@@ -181628,7 +182614,7 @@ var require_simulateBlocks = __commonJS({
|
|
|
181628
182614
|
if (!error2)
|
|
181629
182615
|
return void 0;
|
|
181630
182616
|
return (0, getContractError_js_1.getContractError)(error2, {
|
|
181631
|
-
abi:
|
|
182617
|
+
abi: abi49 ?? [],
|
|
181632
182618
|
address: to,
|
|
181633
182619
|
args,
|
|
181634
182620
|
functionName: functionName ?? "<unknown>"
|
|
@@ -182208,10 +183194,10 @@ var require_AbiItem = __commonJS({
|
|
|
182208
183194
|
...prepare ? { hash: getSignatureHash2(item) } : {}
|
|
182209
183195
|
};
|
|
182210
183196
|
}
|
|
182211
|
-
function fromAbi3(
|
|
183197
|
+
function fromAbi3(abi49, name, options) {
|
|
182212
183198
|
const { args = [], prepare = true } = options ?? {};
|
|
182213
183199
|
const isSelector = Hex.validate(name, { strict: false });
|
|
182214
|
-
const abiItems =
|
|
183200
|
+
const abiItems = abi49.filter((abiItem2) => {
|
|
182215
183201
|
if (isSelector) {
|
|
182216
183202
|
if (abiItem2.type === "function" || abiItem2.type === "error")
|
|
182217
183203
|
return getSelector3(abiItem2) === Hex.slice(name, 0, 4);
|
|
@@ -183354,8 +184340,8 @@ var require_AbiConstructor = __commonJS({
|
|
|
183354
184340
|
function from5(abiConstructor) {
|
|
183355
184341
|
return AbiItem.from(abiConstructor);
|
|
183356
184342
|
}
|
|
183357
|
-
function fromAbi3(
|
|
183358
|
-
const item =
|
|
184343
|
+
function fromAbi3(abi49) {
|
|
184344
|
+
const item = abi49.find((item2) => item2.type === "constructor");
|
|
183359
184345
|
if (!item)
|
|
183360
184346
|
throw new AbiItem.NotFoundError({ name: "constructor" });
|
|
183361
184347
|
return item;
|
|
@@ -183430,8 +184416,8 @@ var require_AbiFunction = __commonJS({
|
|
|
183430
184416
|
function from5(abiFunction, options = {}) {
|
|
183431
184417
|
return AbiItem.from(abiFunction, options);
|
|
183432
184418
|
}
|
|
183433
|
-
function fromAbi3(
|
|
183434
|
-
const item = AbiItem.fromAbi(
|
|
184419
|
+
function fromAbi3(abi49, name, options) {
|
|
184420
|
+
const item = AbiItem.fromAbi(abi49, name, options);
|
|
183435
184421
|
if (item.type !== "function")
|
|
183436
184422
|
throw new AbiItem.NotFoundError({ name, type: "function" });
|
|
183437
184423
|
return item;
|
|
@@ -185331,8 +186317,8 @@ var require_deployContract = __commonJS({
|
|
|
185331
186317
|
var encodeDeployData_js_1 = require_encodeDeployData();
|
|
185332
186318
|
var sendTransaction_js_1 = require_sendTransaction();
|
|
185333
186319
|
function deployContract2(walletClient, parameters) {
|
|
185334
|
-
const { abi:
|
|
185335
|
-
const calldata = (0, encodeDeployData_js_1.encodeDeployData)({ abi:
|
|
186320
|
+
const { abi: abi49, args, bytecode, ...request } = parameters;
|
|
186321
|
+
const calldata = (0, encodeDeployData_js_1.encodeDeployData)({ abi: abi49, args, bytecode });
|
|
185336
186322
|
return (0, sendTransaction_js_1.sendTransaction)(walletClient, {
|
|
185337
186323
|
...request,
|
|
185338
186324
|
...request.authorizationList ? { to: null } : {},
|
|
@@ -185756,10 +186742,10 @@ var require_decodeDeployData = __commonJS({
|
|
|
185756
186742
|
var decodeAbiParameters_js_1 = require_decodeAbiParameters();
|
|
185757
186743
|
var docsPath6 = "/docs/contract/decodeDeployData";
|
|
185758
186744
|
function decodeDeployData(parameters) {
|
|
185759
|
-
const { abi:
|
|
186745
|
+
const { abi: abi49, bytecode, data } = parameters;
|
|
185760
186746
|
if (data === bytecode)
|
|
185761
186747
|
return { bytecode };
|
|
185762
|
-
const description =
|
|
186748
|
+
const description = abi49.find((x) => "type" in x && x.type === "constructor");
|
|
185763
186749
|
if (!description)
|
|
185764
186750
|
throw new abi_js_1.AbiConstructorNotFoundError({ docsPath: docsPath6 });
|
|
185765
186751
|
if (!("inputs" in description))
|
|
@@ -230741,21 +231727,21 @@ var require_BaseContract2 = __commonJS({
|
|
|
230741
231727
|
return this.contractAddress;
|
|
230742
231728
|
};
|
|
230743
231729
|
this.encode = (functionToEncode, args) => {
|
|
230744
|
-
const
|
|
231730
|
+
const abi49 = this.contractAbi;
|
|
230745
231731
|
const functionName = functionToEncode;
|
|
230746
231732
|
const params = args;
|
|
230747
231733
|
return (0, viem_1.encodeFunctionData)({
|
|
230748
|
-
abi:
|
|
231734
|
+
abi: abi49,
|
|
230749
231735
|
functionName,
|
|
230750
231736
|
args: params
|
|
230751
231737
|
});
|
|
230752
231738
|
};
|
|
230753
231739
|
this.estimateGas = async (functionToEstimate, args, options = {}) => {
|
|
230754
231740
|
const contractOptions = this.convertOptions(options);
|
|
230755
|
-
const
|
|
231741
|
+
const abi49 = this.contractAbi;
|
|
230756
231742
|
const params = args;
|
|
230757
231743
|
return (0, actions_1.estimateContractGas)(this.runner, {
|
|
230758
|
-
abi:
|
|
231744
|
+
abi: abi49,
|
|
230759
231745
|
functionName: functionToEstimate,
|
|
230760
231746
|
address: this.getAddress(),
|
|
230761
231747
|
args: params,
|
|
@@ -278135,17 +279121,17 @@ var require_interface3 = __commonJS({
|
|
|
278135
279121
|
* Create a new Interface for the %%fragments%%.
|
|
278136
279122
|
*/
|
|
278137
279123
|
constructor(fragments) {
|
|
278138
|
-
let
|
|
279124
|
+
let abi49 = [];
|
|
278139
279125
|
if (typeof fragments === "string") {
|
|
278140
|
-
|
|
279126
|
+
abi49 = JSON.parse(fragments);
|
|
278141
279127
|
} else {
|
|
278142
|
-
|
|
279128
|
+
abi49 = fragments;
|
|
278143
279129
|
}
|
|
278144
279130
|
this.#functions = /* @__PURE__ */ new Map();
|
|
278145
279131
|
this.#errors = /* @__PURE__ */ new Map();
|
|
278146
279132
|
this.#events = /* @__PURE__ */ new Map();
|
|
278147
279133
|
const frags = [];
|
|
278148
|
-
for (const a of
|
|
279134
|
+
for (const a of abi49) {
|
|
278149
279135
|
try {
|
|
278150
279136
|
frags.push(fragments_js_1.Fragment.from(a));
|
|
278151
279137
|
} catch (error) {
|
|
@@ -278209,16 +279195,16 @@ var require_interface3 = __commonJS({
|
|
|
278209
279195
|
*/
|
|
278210
279196
|
format(minimal) {
|
|
278211
279197
|
const format = minimal ? "minimal" : "full";
|
|
278212
|
-
const
|
|
278213
|
-
return
|
|
279198
|
+
const abi49 = this.fragments.map((f) => f.format(format));
|
|
279199
|
+
return abi49;
|
|
278214
279200
|
}
|
|
278215
279201
|
/**
|
|
278216
279202
|
* Return the JSON-encoded ABI. This is the format Solidiy
|
|
278217
279203
|
* returns.
|
|
278218
279204
|
*/
|
|
278219
279205
|
formatJson() {
|
|
278220
|
-
const
|
|
278221
|
-
return JSON.stringify(
|
|
279206
|
+
const abi49 = this.fragments.map((f) => f.format("json"));
|
|
279207
|
+
return JSON.stringify(abi49.map((j) => JSON.parse(j)));
|
|
278222
279208
|
}
|
|
278223
279209
|
/**
|
|
278224
279210
|
* The ABI coder that will be used to encode and decode binary
|
|
@@ -280986,12 +281972,12 @@ var require_contract5 = __commonJS({
|
|
|
280986
281972
|
* optionally connected to a %%runner%% to perform operations on behalf
|
|
280987
281973
|
* of.
|
|
280988
281974
|
*/
|
|
280989
|
-
constructor(target,
|
|
281975
|
+
constructor(target, abi49, runner, _deployTx) {
|
|
280990
281976
|
(0, index_js_3.assertArgument)(typeof target === "string" || (0, index_js_2.isAddressable)(target), "invalid value for Contract target", "target", target);
|
|
280991
281977
|
if (runner == null) {
|
|
280992
281978
|
runner = null;
|
|
280993
281979
|
}
|
|
280994
|
-
const iface = index_js_1.Interface.from(
|
|
281980
|
+
const iface = index_js_1.Interface.from(abi49);
|
|
280995
281981
|
(0, index_js_3.defineProperties)(this, { target, runner, interface: iface });
|
|
280996
281982
|
Object.defineProperty(this, internal, { value: {} });
|
|
280997
281983
|
let addrPromise;
|
|
@@ -281354,10 +282340,10 @@ var require_contract5 = __commonJS({
|
|
|
281354
282340
|
/**
|
|
281355
282341
|
* Create a new Class for the %%abi%%.
|
|
281356
282342
|
*/
|
|
281357
|
-
static buildClass(
|
|
282343
|
+
static buildClass(abi49) {
|
|
281358
282344
|
class CustomContract extends _BaseContract {
|
|
281359
282345
|
constructor(address, runner = null) {
|
|
281360
|
-
super(address,
|
|
282346
|
+
super(address, abi49, runner);
|
|
281361
282347
|
}
|
|
281362
282348
|
}
|
|
281363
282349
|
return CustomContract;
|
|
@@ -281365,11 +282351,11 @@ var require_contract5 = __commonJS({
|
|
|
281365
282351
|
/**
|
|
281366
282352
|
* Create a new BaseContract with a specified Interface.
|
|
281367
282353
|
*/
|
|
281368
|
-
static from(target,
|
|
282354
|
+
static from(target, abi49, runner) {
|
|
281369
282355
|
if (runner == null) {
|
|
281370
282356
|
runner = null;
|
|
281371
282357
|
}
|
|
281372
|
-
const contract = new this(target,
|
|
282358
|
+
const contract = new this(target, abi49, runner);
|
|
281373
282359
|
return contract;
|
|
281374
282360
|
}
|
|
281375
282361
|
};
|
|
@@ -281413,8 +282399,8 @@ var require_factory2 = __commonJS({
|
|
|
281413
282399
|
* The %%bytecode%% may be the ``bytecode`` property within the
|
|
281414
282400
|
* standard Solidity JSON output.
|
|
281415
282401
|
*/
|
|
281416
|
-
constructor(
|
|
281417
|
-
const iface = index_js_1.Interface.from(
|
|
282402
|
+
constructor(abi49, bytecode, runner) {
|
|
282403
|
+
const iface = index_js_1.Interface.from(abi49);
|
|
281418
282404
|
if (bytecode instanceof Uint8Array) {
|
|
281419
282405
|
bytecode = (0, index_js_3.hexlify)((0, index_js_3.getBytes)(bytecode));
|
|
281420
282406
|
} else {
|
|
@@ -281484,14 +282470,14 @@ var require_factory2 = __commonJS({
|
|
|
281484
282470
|
if (typeof output === "string") {
|
|
281485
282471
|
output = JSON.parse(output);
|
|
281486
282472
|
}
|
|
281487
|
-
const
|
|
282473
|
+
const abi49 = output.abi;
|
|
281488
282474
|
let bytecode = "";
|
|
281489
282475
|
if (output.bytecode) {
|
|
281490
282476
|
bytecode = output.bytecode;
|
|
281491
282477
|
} else if (output.evm && output.evm.bytecode) {
|
|
281492
282478
|
bytecode = output.evm.bytecode;
|
|
281493
282479
|
}
|
|
281494
|
-
return new this(
|
|
282480
|
+
return new this(abi49, bytecode, runner);
|
|
281495
282481
|
}
|
|
281496
282482
|
};
|
|
281497
282483
|
exports2.ContractFactory = ContractFactory;
|
|
@@ -286441,8 +287427,8 @@ var require_provider_etherscan2 = __commonJS({
|
|
|
286441
287427
|
action: "getabi",
|
|
286442
287428
|
address
|
|
286443
287429
|
});
|
|
286444
|
-
const
|
|
286445
|
-
return new index_js_2.Contract(address,
|
|
287430
|
+
const abi49 = JSON.parse(resp);
|
|
287431
|
+
return new index_js_2.Contract(address, abi49, this);
|
|
286446
287432
|
} catch (error) {
|
|
286447
287433
|
return null;
|
|
286448
287434
|
}
|
|
@@ -311265,13 +312251,13 @@ var require_interface4 = __commonJS({
|
|
|
311265
312251
|
function Interface2(fragments) {
|
|
311266
312252
|
var _newTarget = this.constructor;
|
|
311267
312253
|
var _this = this;
|
|
311268
|
-
var
|
|
312254
|
+
var abi49 = [];
|
|
311269
312255
|
if (typeof fragments === "string") {
|
|
311270
|
-
|
|
312256
|
+
abi49 = JSON.parse(fragments);
|
|
311271
312257
|
} else {
|
|
311272
|
-
|
|
312258
|
+
abi49 = fragments;
|
|
311273
312259
|
}
|
|
311274
|
-
(0, properties_1.defineReadOnly)(this, "fragments",
|
|
312260
|
+
(0, properties_1.defineReadOnly)(this, "fragments", abi49.map(function(fragment) {
|
|
311275
312261
|
return fragments_1.Fragment.from(fragment);
|
|
311276
312262
|
}).filter(function(fragment) {
|
|
311277
312263
|
return fragment != null;
|
|
@@ -311325,15 +312311,15 @@ var require_interface4 = __commonJS({
|
|
|
311325
312311
|
if (format === fragments_1.FormatTypes.sighash) {
|
|
311326
312312
|
logger2.throwArgumentError("interface does not support formatting sighash", "format", format);
|
|
311327
312313
|
}
|
|
311328
|
-
var
|
|
312314
|
+
var abi49 = this.fragments.map(function(fragment) {
|
|
311329
312315
|
return fragment.format(format);
|
|
311330
312316
|
});
|
|
311331
312317
|
if (format === fragments_1.FormatTypes.json) {
|
|
311332
|
-
return JSON.stringify(
|
|
312318
|
+
return JSON.stringify(abi49.map(function(j) {
|
|
311333
312319
|
return JSON.parse(j);
|
|
311334
312320
|
}));
|
|
311335
312321
|
}
|
|
311336
|
-
return
|
|
312322
|
+
return abi49;
|
|
311337
312323
|
};
|
|
311338
312324
|
Interface2.getAbiCoder = function() {
|
|
311339
312325
|
return abi_coder_1.defaultAbiCoder;
|
|
@@ -342190,10 +343176,10 @@ init_formatAbiItem2();
|
|
|
342190
343176
|
init_getAbiItem();
|
|
342191
343177
|
var docsPath = "/docs/contract/encodeEventTopics";
|
|
342192
343178
|
function encodeEventTopics(parameters) {
|
|
342193
|
-
const { abi:
|
|
342194
|
-
let abiItem =
|
|
343179
|
+
const { abi: abi49, eventName, args } = parameters;
|
|
343180
|
+
let abiItem = abi49[0];
|
|
342195
343181
|
if (eventName) {
|
|
342196
|
-
const item = getAbiItem({ abi:
|
|
343182
|
+
const item = getAbiItem({ abi: abi49, name: eventName });
|
|
342197
343183
|
if (!item)
|
|
342198
343184
|
throw new AbiEventNotFoundError(eventName, { docsPath });
|
|
342199
343185
|
abiItem = item;
|
|
@@ -342240,12 +343226,12 @@ function createFilterRequestScope(client, { method }) {
|
|
|
342240
343226
|
|
|
342241
343227
|
// ../../node_modules/viem/_esm/actions/public/createContractEventFilter.js
|
|
342242
343228
|
async function createContractEventFilter(client, parameters) {
|
|
342243
|
-
const { address, abi:
|
|
343229
|
+
const { address, abi: abi49, args, eventName, fromBlock, strict, toBlock } = parameters;
|
|
342244
343230
|
const getRequest = createFilterRequestScope(client, {
|
|
342245
343231
|
method: "eth_newFilter"
|
|
342246
343232
|
});
|
|
342247
343233
|
const topics = eventName ? encodeEventTopics({
|
|
342248
|
-
abi:
|
|
343234
|
+
abi: abi49,
|
|
342249
343235
|
args,
|
|
342250
343236
|
eventName
|
|
342251
343237
|
}) : void 0;
|
|
@@ -342261,7 +343247,7 @@ async function createContractEventFilter(client, parameters) {
|
|
|
342261
343247
|
]
|
|
342262
343248
|
});
|
|
342263
343249
|
return {
|
|
342264
|
-
abi:
|
|
343250
|
+
abi: abi49,
|
|
342265
343251
|
args,
|
|
342266
343252
|
eventName,
|
|
342267
343253
|
id,
|
|
@@ -342282,7 +343268,7 @@ init_contract();
|
|
|
342282
343268
|
init_request();
|
|
342283
343269
|
init_rpc();
|
|
342284
343270
|
var EXECUTION_REVERTED_ERROR_CODE = 3;
|
|
342285
|
-
function getContractError(err, { abi:
|
|
343271
|
+
function getContractError(err, { abi: abi49, address, args, docsPath: docsPath6, functionName, sender }) {
|
|
342286
343272
|
const error = err instanceof RawContractError ? err : err instanceof BaseError2 ? err.walk((err2) => "data" in err2) || err.walk() : {};
|
|
342287
343273
|
const { code, data, details, message, shortMessage } = error;
|
|
342288
343274
|
const cause = (() => {
|
|
@@ -342290,7 +343276,7 @@ function getContractError(err, { abi: abi48, address, args, docsPath: docsPath6,
|
|
|
342290
343276
|
return new ContractFunctionZeroDataError({ functionName });
|
|
342291
343277
|
if ([EXECUTION_REVERTED_ERROR_CODE, InternalRpcError.code].includes(code) && (data || details || message || shortMessage)) {
|
|
342292
343278
|
return new ContractFunctionRevertedError({
|
|
342293
|
-
abi:
|
|
343279
|
+
abi: abi49,
|
|
342294
343280
|
data: typeof data === "object" ? data.data : data,
|
|
342295
343281
|
functionName,
|
|
342296
343282
|
message: error instanceof RpcRequestError ? details : shortMessage ?? message
|
|
@@ -342299,7 +343285,7 @@ function getContractError(err, { abi: abi48, address, args, docsPath: docsPath6,
|
|
|
342299
343285
|
return err;
|
|
342300
343286
|
})();
|
|
342301
343287
|
return new ContractFunctionExecutionError(cause, {
|
|
342302
|
-
abi:
|
|
343288
|
+
abi: abi49,
|
|
342303
343289
|
args,
|
|
342304
343290
|
contractAddress: address,
|
|
342305
343291
|
docsPath: docsPath6,
|
|
@@ -343252,9 +344238,9 @@ async function estimateGas(client, args) {
|
|
|
343252
344238
|
|
|
343253
344239
|
// ../../node_modules/viem/_esm/actions/public/estimateContractGas.js
|
|
343254
344240
|
async function estimateContractGas(client, parameters) {
|
|
343255
|
-
const { abi:
|
|
344241
|
+
const { abi: abi49, address, args, functionName, dataSuffix, ...request } = parameters;
|
|
343256
344242
|
const data = encodeFunctionData({
|
|
343257
|
-
abi:
|
|
344243
|
+
abi: abi49,
|
|
343258
344244
|
args,
|
|
343259
344245
|
functionName
|
|
343260
344246
|
});
|
|
@@ -343268,7 +344254,7 @@ async function estimateContractGas(client, parameters) {
|
|
|
343268
344254
|
} catch (error) {
|
|
343269
344255
|
const account = request.account ? parseAccount(request.account) : void 0;
|
|
343270
344256
|
throw getContractError(error, {
|
|
343271
|
-
abi:
|
|
344257
|
+
abi: abi49,
|
|
343272
344258
|
address,
|
|
343273
344259
|
args,
|
|
343274
344260
|
docsPath: "/docs/contract/estimateContractGas",
|
|
@@ -343297,15 +344283,15 @@ init_decodeAbiParameters();
|
|
|
343297
344283
|
init_formatAbiItem2();
|
|
343298
344284
|
var docsPath3 = "/docs/contract/decodeEventLog";
|
|
343299
344285
|
function decodeEventLog(parameters) {
|
|
343300
|
-
const { abi:
|
|
344286
|
+
const { abi: abi49, data, strict: strict_, topics } = parameters;
|
|
343301
344287
|
const strict = strict_ ?? true;
|
|
343302
344288
|
const [signature, ...argTopics] = topics;
|
|
343303
344289
|
if (!signature)
|
|
343304
344290
|
throw new AbiEventSignatureEmptyTopicsError({ docsPath: docsPath3 });
|
|
343305
344291
|
const abiItem = (() => {
|
|
343306
|
-
if (
|
|
343307
|
-
return
|
|
343308
|
-
return
|
|
344292
|
+
if (abi49.length === 1)
|
|
344293
|
+
return abi49[0];
|
|
344294
|
+
return abi49.find((x) => x.type === "event" && signature === toEventSelector(formatAbiItem2(x)));
|
|
343309
344295
|
})();
|
|
343310
344296
|
if (!(abiItem && "name" in abiItem) || abiItem.type !== "event")
|
|
343311
344297
|
throw new AbiEventSignatureNotFoundError(signature, { docsPath: docsPath3 });
|
|
@@ -343372,7 +344358,7 @@ function decodeTopic({ param, value }) {
|
|
|
343372
344358
|
|
|
343373
344359
|
// ../../node_modules/viem/_esm/utils/abi/parseEventLogs.js
|
|
343374
344360
|
function parseEventLogs(parameters) {
|
|
343375
|
-
const { abi:
|
|
344361
|
+
const { abi: abi49, args, logs, strict = true } = parameters;
|
|
343376
344362
|
const eventName = (() => {
|
|
343377
344363
|
if (!parameters.eventName)
|
|
343378
344364
|
return void 0;
|
|
@@ -343382,7 +344368,7 @@ function parseEventLogs(parameters) {
|
|
|
343382
344368
|
})();
|
|
343383
344369
|
return logs.map((log2) => {
|
|
343384
344370
|
try {
|
|
343385
|
-
const abiItem =
|
|
344371
|
+
const abiItem = abi49.find((abiItem2) => abiItem2.type === "event" && log2.topics[0] === toEventSelector(abiItem2));
|
|
343386
344372
|
if (!abiItem)
|
|
343387
344373
|
return null;
|
|
343388
344374
|
const event = decodeEventLog({
|
|
@@ -343518,9 +344504,9 @@ async function getLogs(client, { address, blockHash, fromBlock, toBlock, event,
|
|
|
343518
344504
|
|
|
343519
344505
|
// ../../node_modules/viem/_esm/actions/public/getContractEvents.js
|
|
343520
344506
|
async function getContractEvents(client, parameters) {
|
|
343521
|
-
const { abi:
|
|
343522
|
-
const event = eventName ? getAbiItem({ abi:
|
|
343523
|
-
const events = !event ?
|
|
344507
|
+
const { abi: abi49, address, args, blockHash, eventName, fromBlock, toBlock, strict } = parameters;
|
|
344508
|
+
const event = eventName ? getAbiItem({ abi: abi49, name: eventName }) : void 0;
|
|
344509
|
+
const events = !event ? abi49.filter((x) => x.type === "event") : void 0;
|
|
343524
344510
|
return getAction(client, getLogs, "getLogs")({
|
|
343525
344511
|
address,
|
|
343526
344512
|
args,
|
|
@@ -343538,9 +344524,9 @@ init_decodeFunctionResult();
|
|
|
343538
344524
|
init_encodeFunctionData();
|
|
343539
344525
|
init_call();
|
|
343540
344526
|
async function readContract(client, parameters) {
|
|
343541
|
-
const { abi:
|
|
344527
|
+
const { abi: abi49, address, args, functionName, ...rest } = parameters;
|
|
343542
344528
|
const calldata = encodeFunctionData({
|
|
343543
|
-
abi:
|
|
344529
|
+
abi: abi49,
|
|
343544
344530
|
args,
|
|
343545
344531
|
functionName
|
|
343546
344532
|
});
|
|
@@ -343551,14 +344537,14 @@ async function readContract(client, parameters) {
|
|
|
343551
344537
|
to: address
|
|
343552
344538
|
});
|
|
343553
344539
|
return decodeFunctionResult({
|
|
343554
|
-
abi:
|
|
344540
|
+
abi: abi49,
|
|
343555
344541
|
args,
|
|
343556
344542
|
functionName,
|
|
343557
344543
|
data: data || "0x"
|
|
343558
344544
|
});
|
|
343559
344545
|
} catch (error) {
|
|
343560
344546
|
throw getContractError(error, {
|
|
343561
|
-
abi:
|
|
344547
|
+
abi: abi49,
|
|
343562
344548
|
address,
|
|
343563
344549
|
args,
|
|
343564
344550
|
docsPath: "/docs/contract/readContract",
|
|
@@ -343573,9 +344559,9 @@ init_decodeFunctionResult();
|
|
|
343573
344559
|
init_encodeFunctionData();
|
|
343574
344560
|
init_call();
|
|
343575
344561
|
async function simulateContract(client, parameters) {
|
|
343576
|
-
const { abi:
|
|
344562
|
+
const { abi: abi49, address, args, dataSuffix, functionName, ...callRequest } = parameters;
|
|
343577
344563
|
const account = callRequest.account ? parseAccount(callRequest.account) : client.account;
|
|
343578
|
-
const calldata = encodeFunctionData({ abi:
|
|
344564
|
+
const calldata = encodeFunctionData({ abi: abi49, args, functionName });
|
|
343579
344565
|
try {
|
|
343580
344566
|
const { data } = await getAction(client, call, "call")({
|
|
343581
344567
|
batch: false,
|
|
@@ -343585,12 +344571,12 @@ async function simulateContract(client, parameters) {
|
|
|
343585
344571
|
account
|
|
343586
344572
|
});
|
|
343587
344573
|
const result = decodeFunctionResult({
|
|
343588
|
-
abi:
|
|
344574
|
+
abi: abi49,
|
|
343589
344575
|
args,
|
|
343590
344576
|
functionName,
|
|
343591
344577
|
data: data || "0x"
|
|
343592
344578
|
});
|
|
343593
|
-
const minimizedAbi =
|
|
344579
|
+
const minimizedAbi = abi49.filter((abiItem) => "name" in abiItem && abiItem.name === parameters.functionName);
|
|
343594
344580
|
return {
|
|
343595
344581
|
result,
|
|
343596
344582
|
request: {
|
|
@@ -343605,7 +344591,7 @@ async function simulateContract(client, parameters) {
|
|
|
343605
344591
|
};
|
|
343606
344592
|
} catch (error) {
|
|
343607
344593
|
throw getContractError(error, {
|
|
343608
|
-
abi:
|
|
344594
|
+
abi: abi49,
|
|
343609
344595
|
address,
|
|
343610
344596
|
args,
|
|
343611
344597
|
docsPath: "/docs/contract/simulateContract",
|
|
@@ -343773,7 +344759,7 @@ async function uninstallFilter(_client, { filter }) {
|
|
|
343773
344759
|
|
|
343774
344760
|
// ../../node_modules/viem/_esm/actions/public/watchContractEvent.js
|
|
343775
344761
|
function watchContractEvent(client, parameters) {
|
|
343776
|
-
const { abi:
|
|
344762
|
+
const { abi: abi49, address, args, batch = true, eventName, fromBlock, onError, onLogs, poll: poll_, pollingInterval = client.pollingInterval, strict: strict_ } = parameters;
|
|
343777
344763
|
const enablePolling = (() => {
|
|
343778
344764
|
if (typeof poll_ !== "undefined")
|
|
343779
344765
|
return poll_;
|
|
@@ -343808,7 +344794,7 @@ function watchContractEvent(client, parameters) {
|
|
|
343808
344794
|
if (!initialized) {
|
|
343809
344795
|
try {
|
|
343810
344796
|
filter = await getAction(client, createContractEventFilter, "createContractEventFilter")({
|
|
343811
|
-
abi:
|
|
344797
|
+
abi: abi49,
|
|
343812
344798
|
address,
|
|
343813
344799
|
args,
|
|
343814
344800
|
eventName,
|
|
@@ -343828,7 +344814,7 @@ function watchContractEvent(client, parameters) {
|
|
|
343828
344814
|
const blockNumber = await getAction(client, getBlockNumber, "getBlockNumber")({});
|
|
343829
344815
|
if (previousBlockNumber && previousBlockNumber < blockNumber) {
|
|
343830
344816
|
logs = await getAction(client, getContractEvents, "getContractEvents")({
|
|
343831
|
-
abi:
|
|
344817
|
+
abi: abi49,
|
|
343832
344818
|
address,
|
|
343833
344819
|
args,
|
|
343834
344820
|
eventName,
|
|
@@ -343892,7 +344878,7 @@ function watchContractEvent(client, parameters) {
|
|
|
343892
344878
|
return client.transport;
|
|
343893
344879
|
})();
|
|
343894
344880
|
const topics = eventName ? encodeEventTopics({
|
|
343895
|
-
abi:
|
|
344881
|
+
abi: abi49,
|
|
343896
344882
|
eventName,
|
|
343897
344883
|
args
|
|
343898
344884
|
}) : [];
|
|
@@ -343904,7 +344890,7 @@ function watchContractEvent(client, parameters) {
|
|
|
343904
344890
|
const log2 = data.result;
|
|
343905
344891
|
try {
|
|
343906
344892
|
const { eventName: eventName2, args: args2 } = decodeEventLog({
|
|
343907
|
-
abi:
|
|
344893
|
+
abi: abi49,
|
|
343908
344894
|
data: log2.data,
|
|
343909
344895
|
topics: log2.topics,
|
|
343910
344896
|
strict: strict_
|
|
@@ -344157,14 +345143,14 @@ async function sendTransaction(client, parameters) {
|
|
|
344157
345143
|
|
|
344158
345144
|
// ../../node_modules/viem/_esm/actions/wallet/writeContract.js
|
|
344159
345145
|
async function writeContract(client, parameters) {
|
|
344160
|
-
const { abi:
|
|
345146
|
+
const { abi: abi49, account: account_ = client.account, address, args, dataSuffix, functionName, ...request } = parameters;
|
|
344161
345147
|
if (typeof account_ === "undefined")
|
|
344162
345148
|
throw new AccountNotFoundError({
|
|
344163
345149
|
docsPath: "/docs/contract/writeContract"
|
|
344164
345150
|
});
|
|
344165
345151
|
const account = account_ ? parseAccount(account_) : null;
|
|
344166
345152
|
const data = encodeFunctionData({
|
|
344167
|
-
abi:
|
|
345153
|
+
abi: abi49,
|
|
344168
345154
|
args,
|
|
344169
345155
|
functionName
|
|
344170
345156
|
});
|
|
@@ -344177,7 +345163,7 @@ async function writeContract(client, parameters) {
|
|
|
344177
345163
|
});
|
|
344178
345164
|
} catch (error) {
|
|
344179
345165
|
throw getContractError(error, {
|
|
344180
|
-
abi:
|
|
345166
|
+
abi: abi49,
|
|
344181
345167
|
address,
|
|
344182
345168
|
args,
|
|
344183
345169
|
docsPath: "/docs/contract/writeContract",
|
|
@@ -344188,7 +345174,7 @@ async function writeContract(client, parameters) {
|
|
|
344188
345174
|
}
|
|
344189
345175
|
|
|
344190
345176
|
// ../../node_modules/viem/_esm/actions/getContract.js
|
|
344191
|
-
function getContract({ abi:
|
|
345177
|
+
function getContract({ abi: abi49, address, client: client_ }) {
|
|
344192
345178
|
const client = client_;
|
|
344193
345179
|
const [publicClient, walletClient] = (() => {
|
|
344194
345180
|
if (!client)
|
|
@@ -344207,7 +345193,7 @@ function getContract({ abi: abi48, address, client: client_ }) {
|
|
|
344207
345193
|
let hasReadFunction = false;
|
|
344208
345194
|
let hasWriteFunction = false;
|
|
344209
345195
|
let hasEvent = false;
|
|
344210
|
-
for (const item of
|
|
345196
|
+
for (const item of abi49) {
|
|
344211
345197
|
if (item.type === "function")
|
|
344212
345198
|
if (item.stateMutability === "view" || item.stateMutability === "pure")
|
|
344213
345199
|
hasReadFunction = true;
|
|
@@ -344225,7 +345211,7 @@ function getContract({ abi: abi48, address, client: client_ }) {
|
|
|
344225
345211
|
return (...parameters) => {
|
|
344226
345212
|
const { args, options } = getFunctionParameters(parameters);
|
|
344227
345213
|
return getAction(publicClient, readContract, "readContract")({
|
|
344228
|
-
abi:
|
|
345214
|
+
abi: abi49,
|
|
344229
345215
|
address,
|
|
344230
345216
|
functionName,
|
|
344231
345217
|
args,
|
|
@@ -344240,7 +345226,7 @@ function getContract({ abi: abi48, address, client: client_ }) {
|
|
|
344240
345226
|
return (...parameters) => {
|
|
344241
345227
|
const { args, options } = getFunctionParameters(parameters);
|
|
344242
345228
|
return getAction(publicClient, simulateContract, "simulateContract")({
|
|
344243
|
-
abi:
|
|
345229
|
+
abi: abi49,
|
|
344244
345230
|
address,
|
|
344245
345231
|
functionName,
|
|
344246
345232
|
args,
|
|
@@ -344253,10 +345239,10 @@ function getContract({ abi: abi48, address, client: client_ }) {
|
|
|
344253
345239
|
contract.createEventFilter = new Proxy({}, {
|
|
344254
345240
|
get(_, eventName) {
|
|
344255
345241
|
return (...parameters) => {
|
|
344256
|
-
const abiEvent =
|
|
345242
|
+
const abiEvent = abi49.find((x) => x.type === "event" && x.name === eventName);
|
|
344257
345243
|
const { args, options } = getEventParameters(parameters, abiEvent);
|
|
344258
345244
|
return getAction(publicClient, createContractEventFilter, "createContractEventFilter")({
|
|
344259
|
-
abi:
|
|
345245
|
+
abi: abi49,
|
|
344260
345246
|
address,
|
|
344261
345247
|
eventName,
|
|
344262
345248
|
args,
|
|
@@ -344268,10 +345254,10 @@ function getContract({ abi: abi48, address, client: client_ }) {
|
|
|
344268
345254
|
contract.getEvents = new Proxy({}, {
|
|
344269
345255
|
get(_, eventName) {
|
|
344270
345256
|
return (...parameters) => {
|
|
344271
|
-
const abiEvent =
|
|
345257
|
+
const abiEvent = abi49.find((x) => x.type === "event" && x.name === eventName);
|
|
344272
345258
|
const { args, options } = getEventParameters(parameters, abiEvent);
|
|
344273
345259
|
return getAction(publicClient, getContractEvents, "getContractEvents")({
|
|
344274
|
-
abi:
|
|
345260
|
+
abi: abi49,
|
|
344275
345261
|
address,
|
|
344276
345262
|
eventName,
|
|
344277
345263
|
args,
|
|
@@ -344283,10 +345269,10 @@ function getContract({ abi: abi48, address, client: client_ }) {
|
|
|
344283
345269
|
contract.watchEvent = new Proxy({}, {
|
|
344284
345270
|
get(_, eventName) {
|
|
344285
345271
|
return (...parameters) => {
|
|
344286
|
-
const abiEvent =
|
|
345272
|
+
const abiEvent = abi49.find((x) => x.type === "event" && x.name === eventName);
|
|
344287
345273
|
const { args, options } = getEventParameters(parameters, abiEvent);
|
|
344288
345274
|
return getAction(publicClient, watchContractEvent, "watchContractEvent")({
|
|
344289
|
-
abi:
|
|
345275
|
+
abi: abi49,
|
|
344290
345276
|
address,
|
|
344291
345277
|
eventName,
|
|
344292
345278
|
args,
|
|
@@ -344304,7 +345290,7 @@ function getContract({ abi: abi48, address, client: client_ }) {
|
|
|
344304
345290
|
return (...parameters) => {
|
|
344305
345291
|
const { args, options } = getFunctionParameters(parameters);
|
|
344306
345292
|
return getAction(walletClient, writeContract, "writeContract")({
|
|
344307
|
-
abi:
|
|
345293
|
+
abi: abi49,
|
|
344308
345294
|
address,
|
|
344309
345295
|
functionName,
|
|
344310
345296
|
args,
|
|
@@ -344322,7 +345308,7 @@ function getContract({ abi: abi48, address, client: client_ }) {
|
|
|
344322
345308
|
const { args, options } = getFunctionParameters(parameters);
|
|
344323
345309
|
const client2 = publicClient ?? walletClient;
|
|
344324
345310
|
return getAction(client2, estimateContractGas, "estimateContractGas")({
|
|
344325
|
-
abi:
|
|
345311
|
+
abi: abi49,
|
|
344326
345312
|
address,
|
|
344327
345313
|
functionName,
|
|
344328
345314
|
args,
|
|
@@ -344334,7 +345320,7 @@ function getContract({ abi: abi48, address, client: client_ }) {
|
|
|
344334
345320
|
});
|
|
344335
345321
|
}
|
|
344336
345322
|
contract.address = address;
|
|
344337
|
-
contract.abi =
|
|
345323
|
+
contract.abi = abi49;
|
|
344338
345324
|
return contract;
|
|
344339
345325
|
}
|
|
344340
345326
|
function getFunctionParameters(values) {
|
|
@@ -346043,9 +347029,9 @@ init_toFunctionSelector();
|
|
|
346043
347029
|
init_decodeAbiParameters();
|
|
346044
347030
|
init_formatAbiItem2();
|
|
346045
347031
|
function decodeFunctionData(parameters) {
|
|
346046
|
-
const { abi:
|
|
347032
|
+
const { abi: abi49, data } = parameters;
|
|
346047
347033
|
const signature = slice(data, 0, 4);
|
|
346048
|
-
const description =
|
|
347034
|
+
const description = abi49.find((x) => x.type === "function" && signature === toFunctionSelector(formatAbiItem2(x)));
|
|
346049
347035
|
if (!description)
|
|
346050
347036
|
throw new AbiFunctionSignatureNotFoundError(signature, {
|
|
346051
347037
|
docsPath: "/docs/contract/decodeFunctionData"
|
|
@@ -346689,9 +347675,9 @@ async function multicall(client, parameters) {
|
|
|
346689
347675
|
let currentChunk = 0;
|
|
346690
347676
|
let currentChunkSize = 0;
|
|
346691
347677
|
for (let i = 0; i < contracts2.length; i++) {
|
|
346692
|
-
const { abi:
|
|
347678
|
+
const { abi: abi49, address, args, functionName } = contracts2[i];
|
|
346693
347679
|
try {
|
|
346694
|
-
const callData = encodeFunctionData({ abi:
|
|
347680
|
+
const callData = encodeFunctionData({ abi: abi49, args, functionName });
|
|
346695
347681
|
currentChunkSize += (callData.length - 2) / 2;
|
|
346696
347682
|
if (
|
|
346697
347683
|
// Check if batching is enabled.
|
|
@@ -346713,7 +347699,7 @@ async function multicall(client, parameters) {
|
|
|
346713
347699
|
];
|
|
346714
347700
|
} catch (err) {
|
|
346715
347701
|
const error = getContractError(err, {
|
|
346716
|
-
abi:
|
|
347702
|
+
abi: abi49,
|
|
346717
347703
|
address,
|
|
346718
347704
|
args,
|
|
346719
347705
|
docsPath: "/docs/contract/multicall",
|
|
@@ -346759,14 +347745,14 @@ async function multicall(client, parameters) {
|
|
|
346759
347745
|
for (let j = 0; j < aggregate3Result.length; j++) {
|
|
346760
347746
|
const { returnData, success } = aggregate3Result[j];
|
|
346761
347747
|
const { callData } = chunkedCalls[i][j];
|
|
346762
|
-
const { abi:
|
|
347748
|
+
const { abi: abi49, address, functionName, args } = contracts2[results.length];
|
|
346763
347749
|
try {
|
|
346764
347750
|
if (callData === "0x")
|
|
346765
347751
|
throw new AbiDecodingZeroDataError();
|
|
346766
347752
|
if (!success)
|
|
346767
347753
|
throw new RawContractError({ data: returnData });
|
|
346768
347754
|
const result2 = decodeFunctionResult({
|
|
346769
|
-
abi:
|
|
347755
|
+
abi: abi49,
|
|
346770
347756
|
args,
|
|
346771
347757
|
data: returnData,
|
|
346772
347758
|
functionName
|
|
@@ -346774,7 +347760,7 @@ async function multicall(client, parameters) {
|
|
|
346774
347760
|
results.push(allowFailure ? { result: result2, status: "success" } : result2);
|
|
346775
347761
|
} catch (err) {
|
|
346776
347762
|
const error = getContractError(err, {
|
|
346777
|
-
abi:
|
|
347763
|
+
abi: abi49,
|
|
346778
347764
|
address,
|
|
346779
347765
|
args,
|
|
346780
347766
|
docsPath: "/docs/contract/multicall",
|
|
@@ -347313,13 +348299,13 @@ async function simulateBlocks(client, parameters) {
|
|
|
347313
348299
|
return result.map((block2, i) => ({
|
|
347314
348300
|
...formatBlock(block2),
|
|
347315
348301
|
calls: block2.calls.map((call2, j) => {
|
|
347316
|
-
const { abi:
|
|
348302
|
+
const { abi: abi49, args, functionName, to } = blocks[i].calls[j];
|
|
347317
348303
|
const data = call2.error?.data ?? call2.returnData;
|
|
347318
348304
|
const gasUsed = BigInt(call2.gasUsed);
|
|
347319
348305
|
const logs = call2.logs?.map((log2) => formatLog(log2));
|
|
347320
348306
|
const status = call2.status === "0x1" ? "success" : "failure";
|
|
347321
|
-
const result2 =
|
|
347322
|
-
abi:
|
|
348307
|
+
const result2 = abi49 && status === "success" && data !== "0x" ? decodeFunctionResult({
|
|
348308
|
+
abi: abi49,
|
|
347323
348309
|
data,
|
|
347324
348310
|
functionName
|
|
347325
348311
|
}) : null;
|
|
@@ -347334,7 +348320,7 @@ async function simulateBlocks(client, parameters) {
|
|
|
347334
348320
|
if (!error2)
|
|
347335
348321
|
return void 0;
|
|
347336
348322
|
return getContractError(error2, {
|
|
347337
|
-
abi:
|
|
348323
|
+
abi: abi49 ?? [],
|
|
347338
348324
|
address: to,
|
|
347339
348325
|
args,
|
|
347340
348326
|
functionName: functionName ?? "<unknown>"
|
|
@@ -347611,10 +348597,10 @@ function from2(abiItem, options = {}) {
|
|
|
347611
348597
|
...prepare ? { hash: getSignatureHash(item) } : {}
|
|
347612
348598
|
};
|
|
347613
348599
|
}
|
|
347614
|
-
function fromAbi(
|
|
348600
|
+
function fromAbi(abi49, name, options) {
|
|
347615
348601
|
const { args = [], prepare = true } = options ?? {};
|
|
347616
348602
|
const isSelector = validate(name, { strict: false });
|
|
347617
|
-
const abiItems =
|
|
348603
|
+
const abiItems = abi49.filter((abiItem2) => {
|
|
347618
348604
|
if (isSelector) {
|
|
347619
348605
|
if (abiItem2.type === "function" || abiItem2.type === "error")
|
|
347620
348606
|
return getSelector(abiItem2) === slice2(name, 0, 4);
|
|
@@ -348214,8 +349200,8 @@ function encodeData2(abiFunction, ...args) {
|
|
|
348214
349200
|
function from4(abiFunction, options = {}) {
|
|
348215
349201
|
return from2(abiFunction, options);
|
|
348216
349202
|
}
|
|
348217
|
-
function fromAbi2(
|
|
348218
|
-
const item = fromAbi(
|
|
349203
|
+
function fromAbi2(abi49, name, options) {
|
|
349204
|
+
const item = fromAbi(abi49, name, options);
|
|
348219
349205
|
if (item.type !== "function")
|
|
348220
349206
|
throw new NotFoundError({ name, type: "function" });
|
|
348221
349207
|
return item;
|
|
@@ -349634,8 +350620,8 @@ function createTestClient(parameters) {
|
|
|
349634
350620
|
// ../../node_modules/viem/_esm/actions/wallet/deployContract.js
|
|
349635
350621
|
init_encodeDeployData();
|
|
349636
350622
|
function deployContract(walletClient, parameters) {
|
|
349637
|
-
const { abi:
|
|
349638
|
-
const calldata = encodeDeployData({ abi:
|
|
350623
|
+
const { abi: abi49, args, bytecode, ...request } = parameters;
|
|
350624
|
+
const calldata = encodeDeployData({ abi: abi49, args, bytecode });
|
|
349639
350625
|
return sendTransaction(walletClient, {
|
|
349640
350626
|
...request,
|
|
349641
350627
|
...request.authorizationList ? { to: null } : {},
|
|
@@ -361506,12 +362492,12 @@ var json_parse = (s) => {
|
|
|
361506
362492
|
function createRawTx(to, parameters, description) {
|
|
361507
362493
|
const { args } = parameters;
|
|
361508
362494
|
const fname = parameters.functionName;
|
|
361509
|
-
const { abi:
|
|
362495
|
+
const { abi: abi49, functionName } = (() => {
|
|
361510
362496
|
if (parameters.abi.length === 1 && parameters.functionName?.startsWith("0x"))
|
|
361511
362497
|
return parameters;
|
|
361512
362498
|
return prepareEncodeFunctionData(parameters);
|
|
361513
362499
|
})();
|
|
361514
|
-
const abiItem =
|
|
362500
|
+
const abiItem = abi49[0];
|
|
361515
362501
|
const signature = functionName;
|
|
361516
362502
|
const data = "inputs" in abiItem && abiItem.inputs ? encodeAbiParameters(abiItem.inputs, args ?? []) : void 0;
|
|
361517
362503
|
const functionEncodedData = concatHex([signature, data ?? "0x"]);
|
|
@@ -366148,9 +367134,9 @@ async function simulateMulticall(client, parameters) {
|
|
|
366148
367134
|
let currentChunk = 0;
|
|
366149
367135
|
let currentChunkSize = 0;
|
|
366150
367136
|
for (const contract of contracts2) {
|
|
366151
|
-
const { abi:
|
|
367137
|
+
const { abi: abi49, address, args, functionName } = contract;
|
|
366152
367138
|
try {
|
|
366153
|
-
const callData = encodeFunctionData({ abi:
|
|
367139
|
+
const callData = encodeFunctionData({ abi: abi49, args, functionName });
|
|
366154
367140
|
currentChunkSize += (callData.length - 2) / 2;
|
|
366155
367141
|
if (
|
|
366156
367142
|
// Check if batching is enabled.
|
|
@@ -366172,7 +367158,7 @@ async function simulateMulticall(client, parameters) {
|
|
|
366172
367158
|
];
|
|
366173
367159
|
} catch (err) {
|
|
366174
367160
|
const error = getContractError(err, {
|
|
366175
|
-
abi:
|
|
367161
|
+
abi: abi49,
|
|
366176
367162
|
address,
|
|
366177
367163
|
args,
|
|
366178
367164
|
docsPath: "/docs/contract/multicall",
|
|
@@ -366229,12 +367215,12 @@ async function simulateMulticall(client, parameters) {
|
|
|
366229
367215
|
for (let j = 0; j < aggregate3Result.length; j++) {
|
|
366230
367216
|
const { returnData, success } = aggregate3Result[j];
|
|
366231
367217
|
const { callData } = chunkedCalls[i][j];
|
|
366232
|
-
const { abi:
|
|
367218
|
+
const { abi: abi49, address, functionName, args } = contracts2[results.length];
|
|
366233
367219
|
try {
|
|
366234
367220
|
if (callData === "0x") throw new AbiDecodingZeroDataError();
|
|
366235
367221
|
if (!success) throw new RawContractError({ data: returnData });
|
|
366236
367222
|
const result2 = decodeFunctionResult({
|
|
366237
|
-
abi:
|
|
367223
|
+
abi: abi49,
|
|
366238
367224
|
args,
|
|
366239
367225
|
data: returnData,
|
|
366240
367226
|
functionName
|
|
@@ -366242,7 +367228,7 @@ async function simulateMulticall(client, parameters) {
|
|
|
366242
367228
|
results.push(allowFailure ? { result: result2, status: "success" } : result2);
|
|
366243
367229
|
} catch (err) {
|
|
366244
367230
|
const error = getContractError(err, {
|
|
366245
|
-
abi:
|
|
367231
|
+
abi: abi49,
|
|
366246
367232
|
address,
|
|
366247
367233
|
args,
|
|
366248
367234
|
docsPath: "/docs/contract/multicall",
|
|
@@ -377802,7 +378788,8 @@ var connectors = {
|
|
|
377802
378788
|
"eBTC",
|
|
377803
378789
|
"LBTC",
|
|
377804
378790
|
"solvBTC",
|
|
377805
|
-
"pumpBTC"
|
|
378791
|
+
"pumpBTC",
|
|
378792
|
+
"waEthLidowstETH"
|
|
377806
378793
|
],
|
|
377807
378794
|
Arbitrum: ["WETH", "DAI", "USDC", "USDT", "rETH", "USDC_e", "wstETH"],
|
|
377808
378795
|
Optimism: ["WETH", "USDC", "USDT", "USDC_e", "wstETH"],
|
|
@@ -383498,6 +384485,16 @@ var PriceFeedRef = class extends SDKConstruct {
|
|
|
383498
384485
|
};
|
|
383499
384486
|
|
|
383500
384487
|
// ../../node_modules/@gearbox-protocol/sdk/dist/esm/sdk/market/pricefeeds/AbstractPriceFeed.js
|
|
384488
|
+
var PartialPriceFeedInitError = class extends Error {
|
|
384489
|
+
priceFeed;
|
|
384490
|
+
constructor(priceFeed) {
|
|
384491
|
+
super(
|
|
384492
|
+
`price feed ${priceFeed.baseParams.addr} has been initialized with BaseParams only`
|
|
384493
|
+
);
|
|
384494
|
+
this.name = "ErrPartialPriceFeed";
|
|
384495
|
+
this.priceFeed = priceFeed;
|
|
384496
|
+
}
|
|
384497
|
+
};
|
|
383501
384498
|
var AbstractPriceFeedContract = class extends BaseContract {
|
|
383502
384499
|
/**
|
|
383503
384500
|
* True if the contract deployed at this address implements IUpdatablePriceFeed interface
|
|
@@ -383506,6 +384503,7 @@ var AbstractPriceFeedContract = class extends BaseContract {
|
|
|
383506
384503
|
#decimals;
|
|
383507
384504
|
#underlyingPriceFeeds;
|
|
383508
384505
|
#skipCheck;
|
|
384506
|
+
#args;
|
|
383509
384507
|
hasLowerBoundCap = false;
|
|
383510
384508
|
description;
|
|
383511
384509
|
constructor(sdk, args) {
|
|
@@ -383516,6 +384514,7 @@ var AbstractPriceFeedContract = class extends BaseContract {
|
|
|
383516
384514
|
contractType: args.baseParams.contractType,
|
|
383517
384515
|
version: args.baseParams.version
|
|
383518
384516
|
});
|
|
384517
|
+
this.#args = args;
|
|
383519
384518
|
this.description = args.description;
|
|
383520
384519
|
this.#decimals = args.decimals;
|
|
383521
384520
|
this.#updatable = args.updatable;
|
|
@@ -383535,25 +384534,25 @@ var AbstractPriceFeedContract = class extends BaseContract {
|
|
|
383535
384534
|
}
|
|
383536
384535
|
get decimals() {
|
|
383537
384536
|
if (this.#decimals === void 0) {
|
|
383538
|
-
throw new
|
|
384537
|
+
throw new PartialPriceFeedInitError(this);
|
|
383539
384538
|
}
|
|
383540
384539
|
return this.#decimals;
|
|
383541
384540
|
}
|
|
383542
384541
|
get updatable() {
|
|
383543
384542
|
if (this.#updatable === void 0) {
|
|
383544
|
-
throw new
|
|
384543
|
+
throw new PartialPriceFeedInitError(this.#args);
|
|
383545
384544
|
}
|
|
383546
384545
|
return this.#updatable;
|
|
383547
384546
|
}
|
|
383548
384547
|
get skipCheck() {
|
|
383549
384548
|
if (this.#skipCheck === void 0) {
|
|
383550
|
-
throw new
|
|
384549
|
+
throw new PartialPriceFeedInitError(this.#args);
|
|
383551
384550
|
}
|
|
383552
384551
|
return this.#skipCheck;
|
|
383553
384552
|
}
|
|
383554
384553
|
get underlyingPriceFeeds() {
|
|
383555
384554
|
if (!this.#underlyingPriceFeeds) {
|
|
383556
|
-
throw new
|
|
384555
|
+
throw new PartialPriceFeedInitError(this.#args);
|
|
383557
384556
|
}
|
|
383558
384557
|
return this.#underlyingPriceFeeds;
|
|
383559
384558
|
}
|
|
@@ -384068,6 +385067,9 @@ var RedstonePriceFeedContract = class extends AbstractPriceFeedContract {
|
|
|
384068
385067
|
};
|
|
384069
385068
|
}
|
|
384070
385069
|
};
|
|
385070
|
+
function isRedstone(pf) {
|
|
385071
|
+
return pf.contractType === "PRICE_FEED::REDSTONE";
|
|
385072
|
+
}
|
|
384071
385073
|
|
|
384072
385074
|
// ../../node_modules/@gearbox-protocol/sdk/dist/esm/sdk/market/pricefeeds/RedstoneUpdater.js
|
|
384073
385075
|
var import_evm_connector = __toESM(require_src5(), 1);
|
|
@@ -384366,35 +385368,55 @@ var PriceFeedRegister = class extends SDKConstruct {
|
|
|
384366
385368
|
return existing;
|
|
384367
385369
|
}
|
|
384368
385370
|
const feed = this.create(data);
|
|
385371
|
+
if (!feed.loaded) {
|
|
385372
|
+
throw new PartialPriceFeedInitError({ ...data, abi: [], name: "" });
|
|
385373
|
+
}
|
|
384369
385374
|
this.#feeds.upsert(data.baseParams.addr, feed);
|
|
384370
385375
|
return feed;
|
|
384371
385376
|
}
|
|
384372
385377
|
/**
|
|
384373
385378
|
* Loads PARTIAL information about all updatable price feeds from MarketCompressor
|
|
384374
|
-
* This can later be used to load price feed updates
|
|
385379
|
+
* This is not saved anywhere in PriceFeedRegister, and can later be used to load price feed updates
|
|
384375
385380
|
*/
|
|
384376
|
-
async
|
|
384377
|
-
const
|
|
384378
|
-
|
|
384379
|
-
|
|
385381
|
+
async getPartialUpdatablePriceFeeds(marketConfigurators, pools) {
|
|
385382
|
+
const marketCompressorAddress = this.sdk.addressProvider.getAddress(
|
|
385383
|
+
AP_MARKET_COMPRESSOR,
|
|
385384
|
+
310
|
|
384380
385385
|
);
|
|
384381
|
-
|
|
384382
|
-
|
|
384383
|
-
|
|
384384
|
-
|
|
385386
|
+
const configurators = marketConfigurators ?? this.sdk.marketRegister.marketConfigurators.map((mc) => mc.address);
|
|
385387
|
+
this.logger?.debug(
|
|
385388
|
+
{ configurators, pools },
|
|
385389
|
+
"calling getUpdatablePriceFeeds"
|
|
385390
|
+
);
|
|
385391
|
+
const result = await this.provider.publicClient.readContract({
|
|
385392
|
+
address: marketCompressorAddress,
|
|
385393
|
+
abi: iMarketCompressorAbi,
|
|
385394
|
+
functionName: "getUpdatablePriceFeeds",
|
|
385395
|
+
args: [
|
|
385396
|
+
{
|
|
385397
|
+
configurators,
|
|
385398
|
+
pools: pools ?? [],
|
|
385399
|
+
underlying: ADDRESS_0X0
|
|
385400
|
+
}
|
|
385401
|
+
]
|
|
385402
|
+
});
|
|
385403
|
+
this.logger?.debug(`loaded ${result.length} partial updatable price feeds`);
|
|
385404
|
+
return result.map((baseParams) => this.#createUpdatableProxy({ baseParams }));
|
|
384385
385405
|
}
|
|
384386
385406
|
/**
|
|
384387
385407
|
* Generates price update transaction via multicall3 without any market data knowledge
|
|
385408
|
+
*
|
|
385409
|
+
* @deprecated TODO: seems that it's not used anywhere
|
|
385410
|
+
*
|
|
384388
385411
|
* @param marketConfigurators
|
|
384389
385412
|
* @param pools
|
|
384390
385413
|
* @returns
|
|
384391
385414
|
*/
|
|
384392
385415
|
async getUpdatePriceFeedsTx(marketConfigurators, pools) {
|
|
384393
|
-
const
|
|
385416
|
+
const feeds = await this.getPartialUpdatablePriceFeeds(
|
|
384394
385417
|
marketConfigurators,
|
|
384395
385418
|
pools
|
|
384396
385419
|
);
|
|
384397
|
-
const feeds = feedsData.map((data) => this.create({ baseParams: data }));
|
|
384398
385420
|
const updates = await this.#generatePriceFeedsUpdateTxs(feeds);
|
|
384399
385421
|
return createRawTx(
|
|
384400
385422
|
getChainContractAddress({
|
|
@@ -384418,7 +385440,7 @@ var PriceFeedRegister = class extends SDKConstruct {
|
|
|
384418
385440
|
const txs = [];
|
|
384419
385441
|
const redstonePFs = [];
|
|
384420
385442
|
for (const pf of updateables) {
|
|
384421
|
-
if (pf
|
|
385443
|
+
if (isRedstone(pf)) {
|
|
384422
385444
|
redstonePFs.push(pf);
|
|
384423
385445
|
}
|
|
384424
385446
|
}
|
|
@@ -384445,34 +385467,6 @@ var PriceFeedRegister = class extends SDKConstruct {
|
|
|
384445
385467
|
}
|
|
384446
385468
|
return result;
|
|
384447
385469
|
}
|
|
384448
|
-
async #loadUpdatablePriceFeeds(marketConfigurators, pools) {
|
|
384449
|
-
const marketCompressorAddress = this.sdk.addressProvider.getAddress(
|
|
384450
|
-
AP_MARKET_COMPRESSOR,
|
|
384451
|
-
310
|
|
384452
|
-
);
|
|
384453
|
-
const configurators = marketConfigurators ?? this.sdk.marketRegister.marketConfigurators.map((mc) => mc.address);
|
|
384454
|
-
this.logger?.debug(
|
|
384455
|
-
{ configurators, pools },
|
|
384456
|
-
"calling getUpdatablePriceFeeds"
|
|
384457
|
-
);
|
|
384458
|
-
const result = await this.provider.publicClient.readContract({
|
|
384459
|
-
address: marketCompressorAddress,
|
|
384460
|
-
abi: iMarketCompressorAbi,
|
|
384461
|
-
functionName: "getUpdatablePriceFeeds",
|
|
384462
|
-
args: [
|
|
384463
|
-
{
|
|
384464
|
-
configurators,
|
|
384465
|
-
pools: pools ?? [],
|
|
384466
|
-
underlying: ADDRESS_0X0
|
|
384467
|
-
}
|
|
384468
|
-
]
|
|
384469
|
-
// It's passed as ...rest in viem readContract action, but this might change
|
|
384470
|
-
// @ts-ignore
|
|
384471
|
-
// gas: 500_000_000n,
|
|
384472
|
-
});
|
|
384473
|
-
this.logger?.debug(`loaded ${result.length} updatable price feeds`);
|
|
384474
|
-
return result;
|
|
384475
|
-
}
|
|
384476
385470
|
create(data) {
|
|
384477
385471
|
const contractType = bytes32ToString(
|
|
384478
385472
|
data.baseParams.contractType
|
|
@@ -384522,6 +385516,16 @@ var PriceFeedRegister = class extends SDKConstruct {
|
|
|
384522
385516
|
}
|
|
384523
385517
|
}
|
|
384524
385518
|
}
|
|
385519
|
+
#createUpdatableProxy(data) {
|
|
385520
|
+
return new Proxy(this.create(data), {
|
|
385521
|
+
get(target, prop) {
|
|
385522
|
+
if (prop === "updatableDependencies") {
|
|
385523
|
+
return () => [];
|
|
385524
|
+
}
|
|
385525
|
+
return target[prop];
|
|
385526
|
+
}
|
|
385527
|
+
});
|
|
385528
|
+
}
|
|
384525
385529
|
};
|
|
384526
385530
|
|
|
384527
385531
|
// ../../node_modules/@gearbox-protocol/sdk/dist/esm/sdk/market/pricefeeds/utils.js
|
|
@@ -385640,11 +386644,11 @@ var MarketRegister = class extends SDKConstruct {
|
|
|
385640
386644
|
);
|
|
385641
386645
|
let txs = [];
|
|
385642
386646
|
if (!ignoreUpdateablePrices) {
|
|
385643
|
-
await this.sdk.priceFeeds.
|
|
386647
|
+
const updatables = await this.sdk.priceFeeds.getPartialUpdatablePriceFeeds(
|
|
385644
386648
|
configurators,
|
|
385645
386649
|
pools
|
|
385646
386650
|
);
|
|
385647
|
-
const updates = await this.sdk.priceFeeds.generatePriceFeedsUpdateTxs();
|
|
386651
|
+
const updates = await this.sdk.priceFeeds.generatePriceFeedsUpdateTxs(updatables);
|
|
385648
386652
|
txs = updates.txs;
|
|
385649
386653
|
}
|
|
385650
386654
|
this.#logger?.debug(
|
|
@@ -386842,6 +387846,12 @@ var BigIntMath = class {
|
|
|
386842
387846
|
static neg = (a) => a > 0 ? a * -1n : a;
|
|
386843
387847
|
};
|
|
386844
387848
|
|
|
387849
|
+
// ../../node_modules/@gearbox-protocol/sdk/dist/esm/sdk/sdk-legacy/utils/formatter.js
|
|
387850
|
+
var import_decimal = __toESM(require_decimal2(), 1);
|
|
387851
|
+
function formatPercentage(healthFactor, decimals2 = 2) {
|
|
387852
|
+
return (healthFactor / Number(PERCENTAGE_FACTOR)).toFixed(decimals2);
|
|
387853
|
+
}
|
|
387854
|
+
|
|
386845
387855
|
// ../../node_modules/@gearbox-protocol/sdk/dist/esm/sdk/router/RouterV310Contract.js
|
|
386846
387856
|
var abi20 = iGearboxRouterV310Abi;
|
|
386847
387857
|
var ERR_NOT_IMPLEMENTED = new Error("Not implemented in router v3.1");
|
|
@@ -406471,7 +407481,7 @@ function normalizeTransactions(batch) {
|
|
|
406471
407481
|
});
|
|
406472
407482
|
}
|
|
406473
407483
|
function normalizeDirectTx(t) {
|
|
406474
|
-
const
|
|
407484
|
+
const abi49 = [
|
|
406475
407485
|
{
|
|
406476
407486
|
type: "function",
|
|
406477
407487
|
outputs: [],
|
|
@@ -406493,10 +407503,10 @@ function normalizeDirectTx(t) {
|
|
|
406493
407503
|
return {
|
|
406494
407504
|
target: t.to,
|
|
406495
407505
|
value: t.value,
|
|
406496
|
-
signature: formatAbiItem2(
|
|
407506
|
+
signature: formatAbiItem2(abi49[0], { includeName: false }),
|
|
406497
407507
|
parameters,
|
|
406498
407508
|
data: encodeFunctionData({
|
|
406499
|
-
abi:
|
|
407509
|
+
abi: abi49,
|
|
406500
407510
|
functionName: t.contractMethod.name,
|
|
406501
407511
|
args: values
|
|
406502
407512
|
})
|
|
@@ -413162,9 +414172,9 @@ var AbstractParser = class {
|
|
|
413162
414172
|
};
|
|
413163
414173
|
}
|
|
413164
414174
|
parseConstructor(address, encodedArgs) {
|
|
413165
|
-
for (const { abi:
|
|
414175
|
+
for (const { abi: abi49, comment } of this.constructorAbis) {
|
|
413166
414176
|
try {
|
|
413167
|
-
return this.#parseConstructor(address, encodedArgs,
|
|
414177
|
+
return this.#parseConstructor(address, encodedArgs, abi49, comment);
|
|
413168
414178
|
} catch (e) {
|
|
413169
414179
|
this.logger.warn(`constructor ${comment} of ${address} failed to parse args: ${e}`);
|
|
413170
414180
|
}
|
|
@@ -417620,8 +418630,8 @@ var YearnV2RouterAdapterContract = class extends AbstractAdapterContract {
|
|
|
417620
418630
|
}
|
|
417621
418631
|
};
|
|
417622
418632
|
|
|
417623
|
-
// ../../node_modules/@gearbox-protocol/sdk/dist/esm/adapters/
|
|
417624
|
-
var
|
|
418633
|
+
// ../../node_modules/@gearbox-protocol/sdk/dist/esm/adapters/AdaptersPlugin.js
|
|
418634
|
+
var AdaptersPlugin = class extends SDKConstruct {
|
|
417625
418635
|
name = "Adapters";
|
|
417626
418636
|
createContract(data) {
|
|
417627
418637
|
const args = data;
|
|
@@ -417692,72 +418702,6 @@ var GearboxAdaptersPlugin = class extends SDKConstruct {
|
|
|
417692
418702
|
}
|
|
417693
418703
|
};
|
|
417694
418704
|
|
|
417695
|
-
// ../../node_modules/@gearbox-protocol/sdk/dist/esm/zappers/GearboxZappersPlugin.js
|
|
417696
|
-
var GearboxZappersPlugin = class extends SDKConstruct {
|
|
417697
|
-
#zappers;
|
|
417698
|
-
async attach() {
|
|
417699
|
-
await this.loadZappers();
|
|
417700
|
-
}
|
|
417701
|
-
async loadZappers() {
|
|
417702
|
-
this.#zappers = new AddressMap(void 0, "zappers");
|
|
417703
|
-
const pcAddr = this.sdk.addressProvider.getAddress(
|
|
417704
|
-
AP_PERIPHERY_COMPRESSOR,
|
|
417705
|
-
310
|
|
417706
|
-
);
|
|
417707
|
-
this.sdk.logger?.debug(
|
|
417708
|
-
`loading zappers with periphery compressor ${pcAddr}`
|
|
417709
|
-
);
|
|
417710
|
-
const markets = this.sdk.marketRegister.markets;
|
|
417711
|
-
const resp = await this.provider.publicClient.multicall({
|
|
417712
|
-
contracts: markets.map((m) => ({
|
|
417713
|
-
abi: iPeripheryCompressorAbi,
|
|
417714
|
-
address: pcAddr,
|
|
417715
|
-
functionName: "getZappers",
|
|
417716
|
-
args: [m.configurator.address, m.pool.pool.address]
|
|
417717
|
-
})),
|
|
417718
|
-
allowFailure: true
|
|
417719
|
-
});
|
|
417720
|
-
for (let i = 0; i < resp.length; i++) {
|
|
417721
|
-
const { status, result, error } = resp[i];
|
|
417722
|
-
const marketConfigurator = markets[i].configurator.address;
|
|
417723
|
-
const pool = markets[i].pool.pool.address;
|
|
417724
|
-
if (status === "success") {
|
|
417725
|
-
const list = result;
|
|
417726
|
-
this.#zappers.upsert(
|
|
417727
|
-
pool,
|
|
417728
|
-
list.map((z2) => ({ ...z2, pool }))
|
|
417729
|
-
);
|
|
417730
|
-
} else {
|
|
417731
|
-
this.sdk.logger?.error(
|
|
417732
|
-
`failed to load zapper for market configurator ${this.labelAddress(marketConfigurator)} and pool ${this.labelAddress(pool)}: ${error}`
|
|
417733
|
-
);
|
|
417734
|
-
}
|
|
417735
|
-
}
|
|
417736
|
-
const zappersTokens = this.#zappers.values().flatMap((l) => l.flatMap((z2) => [z2.tokenIn, z2.tokenOut]));
|
|
417737
|
-
for (const t of zappersTokens) {
|
|
417738
|
-
this.sdk.tokensMeta.upsert(t.addr, t);
|
|
417739
|
-
this.sdk.provider.addressLabels.set(t.addr, t.symbol);
|
|
417740
|
-
}
|
|
417741
|
-
}
|
|
417742
|
-
get zappers() {
|
|
417743
|
-
if (!this.#zappers) {
|
|
417744
|
-
throw new Error("zappers plugin not attached");
|
|
417745
|
-
}
|
|
417746
|
-
return this.#zappers;
|
|
417747
|
-
}
|
|
417748
|
-
stateHuman(raw) {
|
|
417749
|
-
return this.zappers.values().flatMap(
|
|
417750
|
-
(l) => l.flatMap((z2) => ({
|
|
417751
|
-
address: z2.baseParams.addr,
|
|
417752
|
-
contractType: z2.baseParams.contractType,
|
|
417753
|
-
version: Number(z2.baseParams.version),
|
|
417754
|
-
tokenIn: this.labelAddress(z2.tokenIn.addr),
|
|
417755
|
-
tokenOut: this.labelAddress(z2.tokenOut.addr)
|
|
417756
|
-
}))
|
|
417757
|
-
);
|
|
417758
|
-
}
|
|
417759
|
-
};
|
|
417760
|
-
|
|
417761
418705
|
// src/commands/open-accounts.ts
|
|
417762
418706
|
function openAccounts() {
|
|
417763
418707
|
return newCommand().name("open-accounts").description("Script to open accounts in v3.1").addOption(
|
|
@@ -417790,11 +418734,9 @@ function openAccounts() {
|
|
|
417790
418734
|
ignoreUpdateablePrices: false,
|
|
417791
418735
|
strictContractTypes: true,
|
|
417792
418736
|
plugins: {
|
|
417793
|
-
adapters:
|
|
417794
|
-
zappers: GearboxZappersPlugin
|
|
418737
|
+
adapters: AdaptersPlugin
|
|
417795
418738
|
}
|
|
417796
418739
|
});
|
|
417797
|
-
console.log(`loaded ${sdk.plugins.zappers.zappers.size} zappers`);
|
|
417798
418740
|
await writeFile4(
|
|
417799
418741
|
path9.resolve(sharedDir, "deploy-state", "stateAfter.human.json"),
|
|
417800
418742
|
json_stringify(sdk.stateHuman()),
|
|
@@ -418016,7 +418958,7 @@ function getRenderer(opts) {
|
|
|
418016
418958
|
var package_default = {
|
|
418017
418959
|
name: "@gearbox-protocol/deploy-tools",
|
|
418018
418960
|
description: "Gearbox deploy tools",
|
|
418019
|
-
version: "5.20.
|
|
418961
|
+
version: "5.20.2",
|
|
418020
418962
|
homepage: "https://gearbox.fi",
|
|
418021
418963
|
keywords: [
|
|
418022
418964
|
"gearbox"
|
|
@@ -418059,7 +419001,7 @@ var package_default = {
|
|
|
418059
419001
|
"@gearbox-protocol/deploy-tools-node": "0.0.0",
|
|
418060
419002
|
"@gearbox-protocol/deploy-tools-shared": "0.0.0",
|
|
418061
419003
|
"@gearbox-protocol/deploy-tools-types": "0.0.0",
|
|
418062
|
-
"@gearbox-protocol/sdk": "3.0.0-vfour.
|
|
419004
|
+
"@gearbox-protocol/sdk": "3.0.0-vfour.313",
|
|
418063
419005
|
"@gearbox-protocol/sdk-gov": "^2.36.6",
|
|
418064
419006
|
"@types/lodash-es": "^4.17.12",
|
|
418065
419007
|
"@types/node": "^22.13.10",
|
|
@@ -418263,6 +419205,411 @@ function printSafeTx() {
|
|
|
418263
419205
|
// src/commands/sdk-example.ts
|
|
418264
419206
|
import { mkdir as mkdir2, writeFile as writeFile6 } from "node:fs/promises";
|
|
418265
419207
|
import path11 from "node:path";
|
|
419208
|
+
|
|
419209
|
+
// ../../node_modules/@gearbox-protocol/sdk/dist/esm/bots/abi/iPartialLiquidationBotV300.js
|
|
419210
|
+
var iPartialLiquidationBotV300Abi = [
|
|
419211
|
+
{
|
|
419212
|
+
type: "function",
|
|
419213
|
+
name: "feeScaleFactor",
|
|
419214
|
+
inputs: [],
|
|
419215
|
+
outputs: [{ name: "", type: "uint16", internalType: "uint16" }],
|
|
419216
|
+
stateMutability: "view"
|
|
419217
|
+
},
|
|
419218
|
+
{
|
|
419219
|
+
type: "function",
|
|
419220
|
+
name: "liquidateExactCollateral",
|
|
419221
|
+
inputs: [
|
|
419222
|
+
{ name: "creditAccount", type: "address", internalType: "address" },
|
|
419223
|
+
{ name: "token", type: "address", internalType: "address" },
|
|
419224
|
+
{ name: "seizedAmount", type: "uint256", internalType: "uint256" },
|
|
419225
|
+
{ name: "maxRepaidAmount", type: "uint256", internalType: "uint256" },
|
|
419226
|
+
{ name: "to", type: "address", internalType: "address" },
|
|
419227
|
+
{
|
|
419228
|
+
name: "priceUpdates",
|
|
419229
|
+
type: "tuple[]",
|
|
419230
|
+
internalType: "struct IPartialLiquidationBotV3.PriceUpdate[]",
|
|
419231
|
+
components: [
|
|
419232
|
+
{ name: "token", type: "address", internalType: "address" },
|
|
419233
|
+
{ name: "reserve", type: "bool", internalType: "bool" },
|
|
419234
|
+
{ name: "data", type: "bytes", internalType: "bytes" }
|
|
419235
|
+
]
|
|
419236
|
+
}
|
|
419237
|
+
],
|
|
419238
|
+
outputs: [
|
|
419239
|
+
{ name: "repaidAmount", type: "uint256", internalType: "uint256" }
|
|
419240
|
+
],
|
|
419241
|
+
stateMutability: "nonpayable"
|
|
419242
|
+
},
|
|
419243
|
+
{
|
|
419244
|
+
type: "function",
|
|
419245
|
+
name: "liquidateExactDebt",
|
|
419246
|
+
inputs: [
|
|
419247
|
+
{ name: "creditAccount", type: "address", internalType: "address" },
|
|
419248
|
+
{ name: "token", type: "address", internalType: "address" },
|
|
419249
|
+
{ name: "repaidAmount", type: "uint256", internalType: "uint256" },
|
|
419250
|
+
{ name: "minSeizedAmount", type: "uint256", internalType: "uint256" },
|
|
419251
|
+
{ name: "to", type: "address", internalType: "address" },
|
|
419252
|
+
{
|
|
419253
|
+
name: "priceUpdates",
|
|
419254
|
+
type: "tuple[]",
|
|
419255
|
+
internalType: "struct IPartialLiquidationBotV3.PriceUpdate[]",
|
|
419256
|
+
components: [
|
|
419257
|
+
{ name: "token", type: "address", internalType: "address" },
|
|
419258
|
+
{ name: "reserve", type: "bool", internalType: "bool" },
|
|
419259
|
+
{ name: "data", type: "bytes", internalType: "bytes" }
|
|
419260
|
+
]
|
|
419261
|
+
}
|
|
419262
|
+
],
|
|
419263
|
+
outputs: [
|
|
419264
|
+
{ name: "seizedAmount", type: "uint256", internalType: "uint256" }
|
|
419265
|
+
],
|
|
419266
|
+
stateMutability: "nonpayable"
|
|
419267
|
+
},
|
|
419268
|
+
{
|
|
419269
|
+
type: "function",
|
|
419270
|
+
name: "maxHealthFactor",
|
|
419271
|
+
inputs: [],
|
|
419272
|
+
outputs: [{ name: "", type: "uint16", internalType: "uint16" }],
|
|
419273
|
+
stateMutability: "view"
|
|
419274
|
+
},
|
|
419275
|
+
{
|
|
419276
|
+
type: "function",
|
|
419277
|
+
name: "minHealthFactor",
|
|
419278
|
+
inputs: [],
|
|
419279
|
+
outputs: [{ name: "", type: "uint16", internalType: "uint16" }],
|
|
419280
|
+
stateMutability: "view"
|
|
419281
|
+
},
|
|
419282
|
+
{
|
|
419283
|
+
type: "function",
|
|
419284
|
+
name: "premiumScaleFactor",
|
|
419285
|
+
inputs: [],
|
|
419286
|
+
outputs: [{ name: "", type: "uint16", internalType: "uint16" }],
|
|
419287
|
+
stateMutability: "view"
|
|
419288
|
+
},
|
|
419289
|
+
{
|
|
419290
|
+
type: "function",
|
|
419291
|
+
name: "treasury",
|
|
419292
|
+
inputs: [],
|
|
419293
|
+
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
419294
|
+
stateMutability: "view"
|
|
419295
|
+
},
|
|
419296
|
+
{
|
|
419297
|
+
type: "function",
|
|
419298
|
+
name: "version",
|
|
419299
|
+
inputs: [],
|
|
419300
|
+
outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
|
|
419301
|
+
stateMutability: "view"
|
|
419302
|
+
},
|
|
419303
|
+
{
|
|
419304
|
+
type: "event",
|
|
419305
|
+
name: "LiquidatePartial",
|
|
419306
|
+
inputs: [
|
|
419307
|
+
{
|
|
419308
|
+
name: "creditManager",
|
|
419309
|
+
type: "address",
|
|
419310
|
+
indexed: true,
|
|
419311
|
+
internalType: "address"
|
|
419312
|
+
},
|
|
419313
|
+
{
|
|
419314
|
+
name: "creditAccount",
|
|
419315
|
+
type: "address",
|
|
419316
|
+
indexed: true,
|
|
419317
|
+
internalType: "address"
|
|
419318
|
+
},
|
|
419319
|
+
{
|
|
419320
|
+
name: "token",
|
|
419321
|
+
type: "address",
|
|
419322
|
+
indexed: true,
|
|
419323
|
+
internalType: "address"
|
|
419324
|
+
},
|
|
419325
|
+
{
|
|
419326
|
+
name: "repaidDebt",
|
|
419327
|
+
type: "uint256",
|
|
419328
|
+
indexed: false,
|
|
419329
|
+
internalType: "uint256"
|
|
419330
|
+
},
|
|
419331
|
+
{
|
|
419332
|
+
name: "seizedCollateral",
|
|
419333
|
+
type: "uint256",
|
|
419334
|
+
indexed: false,
|
|
419335
|
+
internalType: "uint256"
|
|
419336
|
+
},
|
|
419337
|
+
{ name: "fee", type: "uint256", indexed: false, internalType: "uint256" }
|
|
419338
|
+
],
|
|
419339
|
+
anonymous: false
|
|
419340
|
+
},
|
|
419341
|
+
{ type: "error", name: "LiquidatedLessThanNeededException", inputs: [] },
|
|
419342
|
+
{ type: "error", name: "LiquidatedMoreThanNeededException", inputs: [] },
|
|
419343
|
+
{ type: "error", name: "RepaidMoreThanAllowedException", inputs: [] },
|
|
419344
|
+
{ type: "error", name: "SeizedLessThanRequiredException", inputs: [] },
|
|
419345
|
+
{ type: "error", name: "UnderlyingNotLiquidatableException", inputs: [] }
|
|
419346
|
+
];
|
|
419347
|
+
|
|
419348
|
+
// ../../node_modules/@gearbox-protocol/sdk/dist/esm/bots/PartialLiquidationBotV300Contract.js
|
|
419349
|
+
var abi48 = iPartialLiquidationBotV300Abi;
|
|
419350
|
+
var PartialLiquidationBotV300Contract = class extends BaseContract {
|
|
419351
|
+
requiredPermissions;
|
|
419352
|
+
botType;
|
|
419353
|
+
constructor(sdk, args, params, type) {
|
|
419354
|
+
super(sdk, {
|
|
419355
|
+
abi: abi48,
|
|
419356
|
+
...args.baseParams,
|
|
419357
|
+
name: `PartialLiquidationBotV300 (${type})`
|
|
419358
|
+
});
|
|
419359
|
+
this.requiredPermissions = args.requiredPermissions;
|
|
419360
|
+
Object.assign(this, params);
|
|
419361
|
+
this.botType = type;
|
|
419362
|
+
}
|
|
419363
|
+
stateHuman(raw) {
|
|
419364
|
+
return {
|
|
419365
|
+
...super.stateHuman(raw),
|
|
419366
|
+
botType: this.botType,
|
|
419367
|
+
minHealthFactor: formatPercentage(this.minHealthFactor),
|
|
419368
|
+
maxHealthFactor: formatPercentage(this.maxHealthFactor),
|
|
419369
|
+
premiumScaleFactor: formatPercentage(this.premiumScaleFactor),
|
|
419370
|
+
feeScaleFactor: formatPercentage(this.feeScaleFactor),
|
|
419371
|
+
requiredPermissions: this.requiredPermissions.toString(10)
|
|
419372
|
+
};
|
|
419373
|
+
}
|
|
419374
|
+
};
|
|
419375
|
+
|
|
419376
|
+
// ../../node_modules/@gearbox-protocol/sdk/dist/esm/bots/types.js
|
|
419377
|
+
var BOT_TYPES = [
|
|
419378
|
+
"PARTIAL_LIQUIDATION_BOT",
|
|
419379
|
+
"DELEVERAGE_BOT_PEGGED",
|
|
419380
|
+
"DELEVERAGE_BOT_LV",
|
|
419381
|
+
"DELEVERAGE_BOT_HV"
|
|
419382
|
+
];
|
|
419383
|
+
|
|
419384
|
+
// ../../node_modules/@gearbox-protocol/sdk/dist/esm/bots/BotsPlugin.js
|
|
419385
|
+
var UnsupportedBotVersionError = class extends Error {
|
|
419386
|
+
state;
|
|
419387
|
+
constructor(state) {
|
|
419388
|
+
super(
|
|
419389
|
+
`unsupported bot version ${state.baseParams.version} for bot at ${state.baseParams.addr}`
|
|
419390
|
+
);
|
|
419391
|
+
this.state = state;
|
|
419392
|
+
}
|
|
419393
|
+
};
|
|
419394
|
+
var BotsPlugin = class extends SDKConstruct {
|
|
419395
|
+
#logger;
|
|
419396
|
+
#botsByMarket = new AddressMap();
|
|
419397
|
+
constructor(sdk) {
|
|
419398
|
+
super(sdk);
|
|
419399
|
+
this.#logger = sdk.logger?.child?.({ name: "BotsPlugin" }) ?? sdk.logger;
|
|
419400
|
+
}
|
|
419401
|
+
async attach() {
|
|
419402
|
+
await this.#load();
|
|
419403
|
+
}
|
|
419404
|
+
async syncState() {
|
|
419405
|
+
await this.#load();
|
|
419406
|
+
}
|
|
419407
|
+
botsByMarketConfigurator(mc) {
|
|
419408
|
+
return this.#botsByMarket.get(mc) ?? [];
|
|
419409
|
+
}
|
|
419410
|
+
get allBots() {
|
|
419411
|
+
return this.#botsByMarket.values().flat();
|
|
419412
|
+
}
|
|
419413
|
+
async #load() {
|
|
419414
|
+
this.#botsByMarket.clear();
|
|
419415
|
+
const pcAddr = this.sdk.addressProvider.getAddress(
|
|
419416
|
+
AP_PERIPHERY_COMPRESSOR,
|
|
419417
|
+
310
|
|
419418
|
+
);
|
|
419419
|
+
this.#logger?.debug(`loading bots with periphery compressor ${pcAddr}`);
|
|
419420
|
+
const mcs = this.sdk.marketRegister.marketConfigurators.map(
|
|
419421
|
+
(mc) => mc.address
|
|
419422
|
+
);
|
|
419423
|
+
const botsData = await this.client.multicall({
|
|
419424
|
+
contracts: mcs.map(
|
|
419425
|
+
(mc) => ({
|
|
419426
|
+
address: pcAddr,
|
|
419427
|
+
abi: iPeripheryCompressorAbi,
|
|
419428
|
+
functionName: "getBots",
|
|
419429
|
+
args: [mc]
|
|
419430
|
+
})
|
|
419431
|
+
),
|
|
419432
|
+
allowFailure: false
|
|
419433
|
+
});
|
|
419434
|
+
const botsByMcV300 = {};
|
|
419435
|
+
for (let i = 0; i < mcs.length; i++) {
|
|
419436
|
+
const mc = mcs[i];
|
|
419437
|
+
const marketBotData = botsData[i];
|
|
419438
|
+
const marketBotsV300 = [];
|
|
419439
|
+
for (const bot of marketBotData) {
|
|
419440
|
+
if (bot.baseParams.version === 300n) {
|
|
419441
|
+
marketBotsV300.push(bot);
|
|
419442
|
+
} else {
|
|
419443
|
+
this.#logger?.warn(new UnsupportedBotVersionError(bot));
|
|
419444
|
+
}
|
|
419445
|
+
}
|
|
419446
|
+
if (marketBotsV300.length === 4) {
|
|
419447
|
+
botsByMcV300[mc] = marketBotsV300;
|
|
419448
|
+
} else if (marketBotsV300.length > 0) {
|
|
419449
|
+
this.#logger?.warn(
|
|
419450
|
+
`each market configurator should have 4 v300 bots, but ${mc} has ${marketBotsV300.length}`
|
|
419451
|
+
);
|
|
419452
|
+
}
|
|
419453
|
+
}
|
|
419454
|
+
const botAddrsV300 = Object.values(botsByMcV300).flatMap(
|
|
419455
|
+
(b) => b.map((b2) => b2.baseParams.addr)
|
|
419456
|
+
);
|
|
419457
|
+
this.#logger?.debug(`loaded ${botAddrsV300.length} v300 bots`);
|
|
419458
|
+
const params = await this.#getBotsV300Parameters(botAddrsV300);
|
|
419459
|
+
for (const [mc, botStates] of TypedObjectUtils.entries(botsByMcV300)) {
|
|
419460
|
+
this.#botsByMarket.upsert(
|
|
419461
|
+
mc,
|
|
419462
|
+
botStates.map((state, i) => ({
|
|
419463
|
+
state,
|
|
419464
|
+
params: params[state.baseParams.addr],
|
|
419465
|
+
type: BOT_TYPES[i]
|
|
419466
|
+
})).sort((a, b) => a.params.minHealthFactor - b.params.minHealthFactor).map(
|
|
419467
|
+
({ state, params: params2, type }) => new PartialLiquidationBotV300Contract(
|
|
419468
|
+
this.sdk,
|
|
419469
|
+
state,
|
|
419470
|
+
params2,
|
|
419471
|
+
type
|
|
419472
|
+
)
|
|
419473
|
+
)
|
|
419474
|
+
);
|
|
419475
|
+
}
|
|
419476
|
+
}
|
|
419477
|
+
async #getBotsV300Parameters(addresses) {
|
|
419478
|
+
if (addresses.length === 0) {
|
|
419479
|
+
return {};
|
|
419480
|
+
}
|
|
419481
|
+
const BOT_INFO_LENGTH = 4;
|
|
419482
|
+
const resp = await this.provider.publicClient.multicall({
|
|
419483
|
+
allowFailure: false,
|
|
419484
|
+
contracts: addresses.map(
|
|
419485
|
+
(address) => [
|
|
419486
|
+
{
|
|
419487
|
+
address,
|
|
419488
|
+
abi: iPartialLiquidationBotV300Abi,
|
|
419489
|
+
functionName: "minHealthFactor",
|
|
419490
|
+
args: []
|
|
419491
|
+
},
|
|
419492
|
+
{
|
|
419493
|
+
address,
|
|
419494
|
+
abi: iPartialLiquidationBotV300Abi,
|
|
419495
|
+
functionName: "maxHealthFactor",
|
|
419496
|
+
args: []
|
|
419497
|
+
},
|
|
419498
|
+
{
|
|
419499
|
+
address,
|
|
419500
|
+
abi: iPartialLiquidationBotV300Abi,
|
|
419501
|
+
functionName: "premiumScaleFactor",
|
|
419502
|
+
args: []
|
|
419503
|
+
},
|
|
419504
|
+
{
|
|
419505
|
+
address,
|
|
419506
|
+
abi: iPartialLiquidationBotV300Abi,
|
|
419507
|
+
functionName: "feeScaleFactor",
|
|
419508
|
+
args: []
|
|
419509
|
+
}
|
|
419510
|
+
]
|
|
419511
|
+
).flat(1)
|
|
419512
|
+
});
|
|
419513
|
+
return addresses.reduce(
|
|
419514
|
+
(acc, address, index2) => {
|
|
419515
|
+
const from5 = index2 * BOT_INFO_LENGTH;
|
|
419516
|
+
const to = (index2 + 1) * BOT_INFO_LENGTH;
|
|
419517
|
+
const [
|
|
419518
|
+
minHealthFactor,
|
|
419519
|
+
maxHealthFactor,
|
|
419520
|
+
premiumScaleFactor,
|
|
419521
|
+
feeScaleFactor
|
|
419522
|
+
] = resp.slice(from5, to);
|
|
419523
|
+
acc[address] = {
|
|
419524
|
+
minHealthFactor,
|
|
419525
|
+
maxHealthFactor,
|
|
419526
|
+
premiumScaleFactor,
|
|
419527
|
+
feeScaleFactor
|
|
419528
|
+
};
|
|
419529
|
+
return acc;
|
|
419530
|
+
},
|
|
419531
|
+
{}
|
|
419532
|
+
);
|
|
419533
|
+
}
|
|
419534
|
+
stateHuman(raw) {
|
|
419535
|
+
return {
|
|
419536
|
+
bots: Object.fromEntries(
|
|
419537
|
+
this.#botsByMarket.entries().map(([mc, bots]) => [
|
|
419538
|
+
this.labelAddress(mc),
|
|
419539
|
+
bots.map((b) => b.stateHuman(raw))
|
|
419540
|
+
])
|
|
419541
|
+
)
|
|
419542
|
+
};
|
|
419543
|
+
}
|
|
419544
|
+
};
|
|
419545
|
+
|
|
419546
|
+
// ../../node_modules/@gearbox-protocol/sdk/dist/esm/zappers/ZappersPlugin.js
|
|
419547
|
+
var ZappersPlugin = class extends SDKConstruct {
|
|
419548
|
+
#zappers;
|
|
419549
|
+
async attach() {
|
|
419550
|
+
await this.loadZappers();
|
|
419551
|
+
}
|
|
419552
|
+
async loadZappers() {
|
|
419553
|
+
this.#zappers = new AddressMap(void 0, "zappers");
|
|
419554
|
+
const pcAddr = this.sdk.addressProvider.getAddress(
|
|
419555
|
+
AP_PERIPHERY_COMPRESSOR,
|
|
419556
|
+
310
|
|
419557
|
+
);
|
|
419558
|
+
this.sdk.logger?.debug(
|
|
419559
|
+
`loading zappers with periphery compressor ${pcAddr}`
|
|
419560
|
+
);
|
|
419561
|
+
const markets = this.sdk.marketRegister.markets;
|
|
419562
|
+
const resp = await this.provider.publicClient.multicall({
|
|
419563
|
+
contracts: markets.map((m) => ({
|
|
419564
|
+
abi: iPeripheryCompressorAbi,
|
|
419565
|
+
address: pcAddr,
|
|
419566
|
+
functionName: "getZappers",
|
|
419567
|
+
args: [m.configurator.address, m.pool.pool.address]
|
|
419568
|
+
})),
|
|
419569
|
+
allowFailure: true
|
|
419570
|
+
});
|
|
419571
|
+
for (let i = 0; i < resp.length; i++) {
|
|
419572
|
+
const { status, result, error } = resp[i];
|
|
419573
|
+
const marketConfigurator = markets[i].configurator.address;
|
|
419574
|
+
const pool = markets[i].pool.pool.address;
|
|
419575
|
+
if (status === "success") {
|
|
419576
|
+
const list = result;
|
|
419577
|
+
this.#zappers.upsert(
|
|
419578
|
+
pool,
|
|
419579
|
+
list.map((z2) => ({ ...z2, pool }))
|
|
419580
|
+
);
|
|
419581
|
+
} else {
|
|
419582
|
+
this.sdk.logger?.error(
|
|
419583
|
+
`failed to load zapper for market configurator ${this.labelAddress(marketConfigurator)} and pool ${this.labelAddress(pool)}: ${error}`
|
|
419584
|
+
);
|
|
419585
|
+
}
|
|
419586
|
+
}
|
|
419587
|
+
const zappersTokens = this.#zappers.values().flatMap((l) => l.flatMap((z2) => [z2.tokenIn, z2.tokenOut]));
|
|
419588
|
+
for (const t of zappersTokens) {
|
|
419589
|
+
this.sdk.tokensMeta.upsert(t.addr, t);
|
|
419590
|
+
this.sdk.provider.addressLabels.set(t.addr, t.symbol);
|
|
419591
|
+
}
|
|
419592
|
+
}
|
|
419593
|
+
get zappers() {
|
|
419594
|
+
if (!this.#zappers) {
|
|
419595
|
+
throw new Error("zappers plugin not attached");
|
|
419596
|
+
}
|
|
419597
|
+
return this.#zappers;
|
|
419598
|
+
}
|
|
419599
|
+
stateHuman(raw) {
|
|
419600
|
+
return this.zappers.values().flatMap(
|
|
419601
|
+
(l) => l.flatMap((z2) => ({
|
|
419602
|
+
address: z2.baseParams.addr,
|
|
419603
|
+
contractType: z2.baseParams.contractType,
|
|
419604
|
+
version: Number(z2.baseParams.version),
|
|
419605
|
+
tokenIn: this.labelAddress(z2.tokenIn.addr),
|
|
419606
|
+
tokenOut: this.labelAddress(z2.tokenOut.addr)
|
|
419607
|
+
}))
|
|
419608
|
+
);
|
|
419609
|
+
}
|
|
419610
|
+
};
|
|
419611
|
+
|
|
419612
|
+
// src/commands/sdk-example.ts
|
|
418266
419613
|
function sdkExample() {
|
|
418267
419614
|
return newCommand().name("sdk-example").description("SDK example for v3.1").addOption(
|
|
418268
419615
|
new Option("--shared-dir <dir>", "dir to put output files").env(
|
|
@@ -418296,8 +419643,9 @@ function sdkExample() {
|
|
|
418296
419643
|
ignoreUpdateablePrices: false,
|
|
418297
419644
|
strictContractTypes: true,
|
|
418298
419645
|
plugins: {
|
|
418299
|
-
adapters:
|
|
418300
|
-
zappers:
|
|
419646
|
+
adapters: AdaptersPlugin,
|
|
419647
|
+
zappers: ZappersPlugin,
|
|
419648
|
+
bots: BotsPlugin
|
|
418301
419649
|
}
|
|
418302
419650
|
});
|
|
418303
419651
|
await writeFile6(
|
|
@@ -418438,6 +419786,9 @@ lodash/lodash.js:
|
|
|
418438
419786
|
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
418439
419787
|
*)
|
|
418440
419788
|
|
|
419789
|
+
decimal.js-light/decimal.js:
|
|
419790
|
+
(*! decimal.js-light v2.5.1 https://github.com/MikeMcl/decimal.js-light/LICENCE *)
|
|
419791
|
+
|
|
418441
419792
|
@noble/hashes/utils.js:
|
|
418442
419793
|
(*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
|
418443
419794
|
|