@lagoon-protocol/v0-core 0.3.0 → 0.5.0

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/esm/index.js CHANGED
@@ -1,3 +1,2110 @@
1
+ var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
2
+
3
+ // ../../node_modules/abitype/dist/esm/version.js
4
+ var version = "1.0.8";
5
+
6
+ // ../../node_modules/abitype/dist/esm/errors.js
7
+ var BaseError;
8
+ var init_errors = __esm(() => {
9
+ BaseError = class BaseError extends Error {
10
+ constructor(shortMessage, args = {}) {
11
+ const details = args.cause instanceof BaseError ? args.cause.details : args.cause?.message ? args.cause.message : args.details;
12
+ const docsPath = args.cause instanceof BaseError ? args.cause.docsPath || args.docsPath : args.docsPath;
13
+ const message = [
14
+ shortMessage || "An error occurred.",
15
+ "",
16
+ ...args.metaMessages ? [...args.metaMessages, ""] : [],
17
+ ...docsPath ? [`Docs: https://abitype.dev${docsPath}`] : [],
18
+ ...details ? [`Details: ${details}`] : [],
19
+ `Version: abitype@${version}`
20
+ ].join(`
21
+ `);
22
+ super(message);
23
+ Object.defineProperty(this, "details", {
24
+ enumerable: true,
25
+ configurable: true,
26
+ writable: true,
27
+ value: undefined
28
+ });
29
+ Object.defineProperty(this, "docsPath", {
30
+ enumerable: true,
31
+ configurable: true,
32
+ writable: true,
33
+ value: undefined
34
+ });
35
+ Object.defineProperty(this, "metaMessages", {
36
+ enumerable: true,
37
+ configurable: true,
38
+ writable: true,
39
+ value: undefined
40
+ });
41
+ Object.defineProperty(this, "shortMessage", {
42
+ enumerable: true,
43
+ configurable: true,
44
+ writable: true,
45
+ value: undefined
46
+ });
47
+ Object.defineProperty(this, "name", {
48
+ enumerable: true,
49
+ configurable: true,
50
+ writable: true,
51
+ value: "AbiTypeError"
52
+ });
53
+ if (args.cause)
54
+ this.cause = args.cause;
55
+ this.details = details;
56
+ this.docsPath = docsPath;
57
+ this.metaMessages = args.metaMessages;
58
+ this.shortMessage = shortMessage;
59
+ }
60
+ };
61
+ });
62
+
63
+ // ../../node_modules/abitype/dist/esm/regex.js
64
+ function execTyped(regex, string) {
65
+ const match = regex.exec(string);
66
+ return match?.groups;
67
+ }
68
+ var bytesRegex, integerRegex, isTupleRegex;
69
+ var init_regex = __esm(() => {
70
+ bytesRegex = /^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/;
71
+ integerRegex = /^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;
72
+ isTupleRegex = /^\(.+?\).*?$/;
73
+ });
74
+
75
+ // ../../node_modules/abitype/dist/esm/human-readable/formatAbiParameter.js
76
+ function formatAbiParameter(abiParameter) {
77
+ let type = abiParameter.type;
78
+ if (tupleRegex.test(abiParameter.type) && "components" in abiParameter) {
79
+ type = "(";
80
+ const length = abiParameter.components.length;
81
+ for (let i = 0;i < length; i++) {
82
+ const component = abiParameter.components[i];
83
+ type += formatAbiParameter(component);
84
+ if (i < length - 1)
85
+ type += ", ";
86
+ }
87
+ const result = execTyped(tupleRegex, abiParameter.type);
88
+ type += `)${result?.array ?? ""}`;
89
+ return formatAbiParameter({
90
+ ...abiParameter,
91
+ type
92
+ });
93
+ }
94
+ if ("indexed" in abiParameter && abiParameter.indexed)
95
+ type = `${type} indexed`;
96
+ if (abiParameter.name)
97
+ return `${type} ${abiParameter.name}`;
98
+ return type;
99
+ }
100
+ var tupleRegex;
101
+ var init_formatAbiParameter = __esm(() => {
102
+ init_regex();
103
+ tupleRegex = /^tuple(?<array>(\[(\d*)\])*)$/;
104
+ });
105
+
106
+ // ../../node_modules/abitype/dist/esm/human-readable/formatAbiParameters.js
107
+ function formatAbiParameters(abiParameters) {
108
+ let params = "";
109
+ const length = abiParameters.length;
110
+ for (let i = 0;i < length; i++) {
111
+ const abiParameter = abiParameters[i];
112
+ params += formatAbiParameter(abiParameter);
113
+ if (i !== length - 1)
114
+ params += ", ";
115
+ }
116
+ return params;
117
+ }
118
+ var init_formatAbiParameters = __esm(() => {
119
+ init_formatAbiParameter();
120
+ });
121
+
122
+ // ../../node_modules/abitype/dist/esm/human-readable/formatAbiItem.js
123
+ function formatAbiItem(abiItem) {
124
+ if (abiItem.type === "function")
125
+ return `function ${abiItem.name}(${formatAbiParameters(abiItem.inputs)})${abiItem.stateMutability && abiItem.stateMutability !== "nonpayable" ? ` ${abiItem.stateMutability}` : ""}${abiItem.outputs?.length ? ` returns (${formatAbiParameters(abiItem.outputs)})` : ""}`;
126
+ if (abiItem.type === "event")
127
+ return `event ${abiItem.name}(${formatAbiParameters(abiItem.inputs)})`;
128
+ if (abiItem.type === "error")
129
+ return `error ${abiItem.name}(${formatAbiParameters(abiItem.inputs)})`;
130
+ if (abiItem.type === "constructor")
131
+ return `constructor(${formatAbiParameters(abiItem.inputs)})${abiItem.stateMutability === "payable" ? " payable" : ""}`;
132
+ if (abiItem.type === "fallback")
133
+ return `fallback() external${abiItem.stateMutability === "payable" ? " payable" : ""}`;
134
+ return "receive() external payable";
135
+ }
136
+ var init_formatAbiItem = __esm(() => {
137
+ init_formatAbiParameters();
138
+ });
139
+
140
+ // ../../node_modules/abitype/dist/esm/human-readable/runtime/signatures.js
141
+ function isStructSignature(signature) {
142
+ return structSignatureRegex.test(signature);
143
+ }
144
+ function execStructSignature(signature) {
145
+ return execTyped(structSignatureRegex, signature);
146
+ }
147
+ var structSignatureRegex, modifiers, eventModifiers, functionModifiers;
148
+ var init_signatures = __esm(() => {
149
+ init_regex();
150
+ structSignatureRegex = /^struct (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?<properties>.*?)\}$/;
151
+ modifiers = new Set([
152
+ "memory",
153
+ "indexed",
154
+ "storage",
155
+ "calldata"
156
+ ]);
157
+ eventModifiers = new Set(["indexed"]);
158
+ functionModifiers = new Set([
159
+ "calldata",
160
+ "memory",
161
+ "storage"
162
+ ]);
163
+ });
164
+
165
+ // ../../node_modules/abitype/dist/esm/human-readable/errors/abiItem.js
166
+ var UnknownTypeError, UnknownSolidityTypeError;
167
+ var init_abiItem = __esm(() => {
168
+ init_errors();
169
+ UnknownTypeError = class UnknownTypeError extends BaseError {
170
+ constructor({ type }) {
171
+ super("Unknown type.", {
172
+ metaMessages: [
173
+ `Type "${type}" is not a valid ABI type. Perhaps you forgot to include a struct signature?`
174
+ ]
175
+ });
176
+ Object.defineProperty(this, "name", {
177
+ enumerable: true,
178
+ configurable: true,
179
+ writable: true,
180
+ value: "UnknownTypeError"
181
+ });
182
+ }
183
+ };
184
+ UnknownSolidityTypeError = class UnknownSolidityTypeError extends BaseError {
185
+ constructor({ type }) {
186
+ super("Unknown type.", {
187
+ metaMessages: [`Type "${type}" is not a valid ABI type.`]
188
+ });
189
+ Object.defineProperty(this, "name", {
190
+ enumerable: true,
191
+ configurable: true,
192
+ writable: true,
193
+ value: "UnknownSolidityTypeError"
194
+ });
195
+ }
196
+ };
197
+ });
198
+
199
+ // ../../node_modules/abitype/dist/esm/human-readable/errors/abiParameter.js
200
+ var InvalidAbiParameterError, InvalidAbiParametersError, InvalidParameterError, SolidityProtectedKeywordError, InvalidModifierError, InvalidFunctionModifierError, InvalidAbiTypeParameterError;
201
+ var init_abiParameter = __esm(() => {
202
+ init_errors();
203
+ InvalidAbiParameterError = class InvalidAbiParameterError extends BaseError {
204
+ constructor({ param }) {
205
+ super("Failed to parse ABI parameter.", {
206
+ details: `parseAbiParameter(${JSON.stringify(param, null, 2)})`,
207
+ docsPath: "/api/human#parseabiparameter-1"
208
+ });
209
+ Object.defineProperty(this, "name", {
210
+ enumerable: true,
211
+ configurable: true,
212
+ writable: true,
213
+ value: "InvalidAbiParameterError"
214
+ });
215
+ }
216
+ };
217
+ InvalidAbiParametersError = class InvalidAbiParametersError extends BaseError {
218
+ constructor({ params }) {
219
+ super("Failed to parse ABI parameters.", {
220
+ details: `parseAbiParameters(${JSON.stringify(params, null, 2)})`,
221
+ docsPath: "/api/human#parseabiparameters-1"
222
+ });
223
+ Object.defineProperty(this, "name", {
224
+ enumerable: true,
225
+ configurable: true,
226
+ writable: true,
227
+ value: "InvalidAbiParametersError"
228
+ });
229
+ }
230
+ };
231
+ InvalidParameterError = class InvalidParameterError extends BaseError {
232
+ constructor({ param }) {
233
+ super("Invalid ABI parameter.", {
234
+ details: param
235
+ });
236
+ Object.defineProperty(this, "name", {
237
+ enumerable: true,
238
+ configurable: true,
239
+ writable: true,
240
+ value: "InvalidParameterError"
241
+ });
242
+ }
243
+ };
244
+ SolidityProtectedKeywordError = class SolidityProtectedKeywordError extends BaseError {
245
+ constructor({ param, name }) {
246
+ super("Invalid ABI parameter.", {
247
+ details: param,
248
+ metaMessages: [
249
+ `"${name}" is a protected Solidity keyword. More info: https://docs.soliditylang.org/en/latest/cheatsheet.html`
250
+ ]
251
+ });
252
+ Object.defineProperty(this, "name", {
253
+ enumerable: true,
254
+ configurable: true,
255
+ writable: true,
256
+ value: "SolidityProtectedKeywordError"
257
+ });
258
+ }
259
+ };
260
+ InvalidModifierError = class InvalidModifierError extends BaseError {
261
+ constructor({ param, type, modifier }) {
262
+ super("Invalid ABI parameter.", {
263
+ details: param,
264
+ metaMessages: [
265
+ `Modifier "${modifier}" not allowed${type ? ` in "${type}" type` : ""}.`
266
+ ]
267
+ });
268
+ Object.defineProperty(this, "name", {
269
+ enumerable: true,
270
+ configurable: true,
271
+ writable: true,
272
+ value: "InvalidModifierError"
273
+ });
274
+ }
275
+ };
276
+ InvalidFunctionModifierError = class InvalidFunctionModifierError extends BaseError {
277
+ constructor({ param, type, modifier }) {
278
+ super("Invalid ABI parameter.", {
279
+ details: param,
280
+ metaMessages: [
281
+ `Modifier "${modifier}" not allowed${type ? ` in "${type}" type` : ""}.`,
282
+ `Data location can only be specified for array, struct, or mapping types, but "${modifier}" was given.`
283
+ ]
284
+ });
285
+ Object.defineProperty(this, "name", {
286
+ enumerable: true,
287
+ configurable: true,
288
+ writable: true,
289
+ value: "InvalidFunctionModifierError"
290
+ });
291
+ }
292
+ };
293
+ InvalidAbiTypeParameterError = class InvalidAbiTypeParameterError extends BaseError {
294
+ constructor({ abiParameter }) {
295
+ super("Invalid ABI parameter.", {
296
+ details: JSON.stringify(abiParameter, null, 2),
297
+ metaMessages: ["ABI parameter type is invalid."]
298
+ });
299
+ Object.defineProperty(this, "name", {
300
+ enumerable: true,
301
+ configurable: true,
302
+ writable: true,
303
+ value: "InvalidAbiTypeParameterError"
304
+ });
305
+ }
306
+ };
307
+ });
308
+
309
+ // ../../node_modules/abitype/dist/esm/human-readable/errors/signature.js
310
+ var InvalidSignatureError, InvalidStructSignatureError;
311
+ var init_signature = __esm(() => {
312
+ init_errors();
313
+ InvalidSignatureError = class InvalidSignatureError extends BaseError {
314
+ constructor({ signature, type }) {
315
+ super(`Invalid ${type} signature.`, {
316
+ details: signature
317
+ });
318
+ Object.defineProperty(this, "name", {
319
+ enumerable: true,
320
+ configurable: true,
321
+ writable: true,
322
+ value: "InvalidSignatureError"
323
+ });
324
+ }
325
+ };
326
+ InvalidStructSignatureError = class InvalidStructSignatureError extends BaseError {
327
+ constructor({ signature }) {
328
+ super("Invalid struct signature.", {
329
+ details: signature,
330
+ metaMessages: ["No properties exist."]
331
+ });
332
+ Object.defineProperty(this, "name", {
333
+ enumerable: true,
334
+ configurable: true,
335
+ writable: true,
336
+ value: "InvalidStructSignatureError"
337
+ });
338
+ }
339
+ };
340
+ });
341
+
342
+ // ../../node_modules/abitype/dist/esm/human-readable/errors/struct.js
343
+ var CircularReferenceError;
344
+ var init_struct = __esm(() => {
345
+ init_errors();
346
+ CircularReferenceError = class CircularReferenceError extends BaseError {
347
+ constructor({ type }) {
348
+ super("Circular reference detected.", {
349
+ metaMessages: [`Struct "${type}" is a circular reference.`]
350
+ });
351
+ Object.defineProperty(this, "name", {
352
+ enumerable: true,
353
+ configurable: true,
354
+ writable: true,
355
+ value: "CircularReferenceError"
356
+ });
357
+ }
358
+ };
359
+ });
360
+
361
+ // ../../node_modules/abitype/dist/esm/human-readable/errors/splitParameters.js
362
+ var InvalidParenthesisError;
363
+ var init_splitParameters = __esm(() => {
364
+ init_errors();
365
+ InvalidParenthesisError = class InvalidParenthesisError extends BaseError {
366
+ constructor({ current, depth }) {
367
+ super("Unbalanced parentheses.", {
368
+ metaMessages: [
369
+ `"${current.trim()}" has too many ${depth > 0 ? "opening" : "closing"} parentheses.`
370
+ ],
371
+ details: `Depth "${depth}"`
372
+ });
373
+ Object.defineProperty(this, "name", {
374
+ enumerable: true,
375
+ configurable: true,
376
+ writable: true,
377
+ value: "InvalidParenthesisError"
378
+ });
379
+ }
380
+ };
381
+ });
382
+
383
+ // ../../node_modules/abitype/dist/esm/human-readable/runtime/cache.js
384
+ function getParameterCacheKey(param, type, structs) {
385
+ let structKey = "";
386
+ if (structs)
387
+ for (const struct of Object.entries(structs)) {
388
+ if (!struct)
389
+ continue;
390
+ let propertyKey = "";
391
+ for (const property of struct[1]) {
392
+ propertyKey += `[${property.type}${property.name ? `:${property.name}` : ""}]`;
393
+ }
394
+ structKey += `(${struct[0]}{${propertyKey}})`;
395
+ }
396
+ if (type)
397
+ return `${type}:${param}${structKey}`;
398
+ return param;
399
+ }
400
+ var parameterCache;
401
+ var init_cache = __esm(() => {
402
+ parameterCache = new Map([
403
+ ["address", { type: "address" }],
404
+ ["bool", { type: "bool" }],
405
+ ["bytes", { type: "bytes" }],
406
+ ["bytes32", { type: "bytes32" }],
407
+ ["int", { type: "int256" }],
408
+ ["int256", { type: "int256" }],
409
+ ["string", { type: "string" }],
410
+ ["uint", { type: "uint256" }],
411
+ ["uint8", { type: "uint8" }],
412
+ ["uint16", { type: "uint16" }],
413
+ ["uint24", { type: "uint24" }],
414
+ ["uint32", { type: "uint32" }],
415
+ ["uint64", { type: "uint64" }],
416
+ ["uint96", { type: "uint96" }],
417
+ ["uint112", { type: "uint112" }],
418
+ ["uint160", { type: "uint160" }],
419
+ ["uint192", { type: "uint192" }],
420
+ ["uint256", { type: "uint256" }],
421
+ ["address owner", { type: "address", name: "owner" }],
422
+ ["address to", { type: "address", name: "to" }],
423
+ ["bool approved", { type: "bool", name: "approved" }],
424
+ ["bytes _data", { type: "bytes", name: "_data" }],
425
+ ["bytes data", { type: "bytes", name: "data" }],
426
+ ["bytes signature", { type: "bytes", name: "signature" }],
427
+ ["bytes32 hash", { type: "bytes32", name: "hash" }],
428
+ ["bytes32 r", { type: "bytes32", name: "r" }],
429
+ ["bytes32 root", { type: "bytes32", name: "root" }],
430
+ ["bytes32 s", { type: "bytes32", name: "s" }],
431
+ ["string name", { type: "string", name: "name" }],
432
+ ["string symbol", { type: "string", name: "symbol" }],
433
+ ["string tokenURI", { type: "string", name: "tokenURI" }],
434
+ ["uint tokenId", { type: "uint256", name: "tokenId" }],
435
+ ["uint8 v", { type: "uint8", name: "v" }],
436
+ ["uint256 balance", { type: "uint256", name: "balance" }],
437
+ ["uint256 tokenId", { type: "uint256", name: "tokenId" }],
438
+ ["uint256 value", { type: "uint256", name: "value" }],
439
+ [
440
+ "event:address indexed from",
441
+ { type: "address", name: "from", indexed: true }
442
+ ],
443
+ ["event:address indexed to", { type: "address", name: "to", indexed: true }],
444
+ [
445
+ "event:uint indexed tokenId",
446
+ { type: "uint256", name: "tokenId", indexed: true }
447
+ ],
448
+ [
449
+ "event:uint256 indexed tokenId",
450
+ { type: "uint256", name: "tokenId", indexed: true }
451
+ ]
452
+ ]);
453
+ });
454
+
455
+ // ../../node_modules/abitype/dist/esm/human-readable/runtime/utils.js
456
+ function parseAbiParameter(param, options) {
457
+ const parameterCacheKey = getParameterCacheKey(param, options?.type, options?.structs);
458
+ if (parameterCache.has(parameterCacheKey))
459
+ return parameterCache.get(parameterCacheKey);
460
+ const isTuple = isTupleRegex.test(param);
461
+ const match = execTyped(isTuple ? abiParameterWithTupleRegex : abiParameterWithoutTupleRegex, param);
462
+ if (!match)
463
+ throw new InvalidParameterError({ param });
464
+ if (match.name && isSolidityKeyword(match.name))
465
+ throw new SolidityProtectedKeywordError({ param, name: match.name });
466
+ const name = match.name ? { name: match.name } : {};
467
+ const indexed = match.modifier === "indexed" ? { indexed: true } : {};
468
+ const structs = options?.structs ?? {};
469
+ let type;
470
+ let components = {};
471
+ if (isTuple) {
472
+ type = "tuple";
473
+ const params = splitParameters(match.type);
474
+ const components_ = [];
475
+ const length = params.length;
476
+ for (let i = 0;i < length; i++) {
477
+ components_.push(parseAbiParameter(params[i], { structs }));
478
+ }
479
+ components = { components: components_ };
480
+ } else if (match.type in structs) {
481
+ type = "tuple";
482
+ components = { components: structs[match.type] };
483
+ } else if (dynamicIntegerRegex.test(match.type)) {
484
+ type = `${match.type}256`;
485
+ } else {
486
+ type = match.type;
487
+ if (!(options?.type === "struct") && !isSolidityType(type))
488
+ throw new UnknownSolidityTypeError({ type });
489
+ }
490
+ if (match.modifier) {
491
+ if (!options?.modifiers?.has?.(match.modifier))
492
+ throw new InvalidModifierError({
493
+ param,
494
+ type: options?.type,
495
+ modifier: match.modifier
496
+ });
497
+ if (functionModifiers.has(match.modifier) && !isValidDataLocation(type, !!match.array))
498
+ throw new InvalidFunctionModifierError({
499
+ param,
500
+ type: options?.type,
501
+ modifier: match.modifier
502
+ });
503
+ }
504
+ const abiParameter = {
505
+ type: `${type}${match.array ?? ""}`,
506
+ ...name,
507
+ ...indexed,
508
+ ...components
509
+ };
510
+ parameterCache.set(parameterCacheKey, abiParameter);
511
+ return abiParameter;
512
+ }
513
+ function splitParameters(params, result = [], current = "", depth = 0) {
514
+ const length = params.trim().length;
515
+ for (let i = 0;i < length; i++) {
516
+ const char = params[i];
517
+ const tail = params.slice(i + 1);
518
+ switch (char) {
519
+ case ",":
520
+ return depth === 0 ? splitParameters(tail, [...result, current.trim()]) : splitParameters(tail, result, `${current}${char}`, depth);
521
+ case "(":
522
+ return splitParameters(tail, result, `${current}${char}`, depth + 1);
523
+ case ")":
524
+ return splitParameters(tail, result, `${current}${char}`, depth - 1);
525
+ default:
526
+ return splitParameters(tail, result, `${current}${char}`, depth);
527
+ }
528
+ }
529
+ if (current === "")
530
+ return result;
531
+ if (depth !== 0)
532
+ throw new InvalidParenthesisError({ current, depth });
533
+ result.push(current.trim());
534
+ return result;
535
+ }
536
+ function isSolidityType(type) {
537
+ return type === "address" || type === "bool" || type === "function" || type === "string" || bytesRegex.test(type) || integerRegex.test(type);
538
+ }
539
+ function isSolidityKeyword(name) {
540
+ return name === "address" || name === "bool" || name === "function" || name === "string" || name === "tuple" || bytesRegex.test(name) || integerRegex.test(name) || protectedKeywordsRegex.test(name);
541
+ }
542
+ function isValidDataLocation(type, isArray) {
543
+ return isArray || type === "bytes" || type === "string" || type === "tuple";
544
+ }
545
+ var abiParameterWithoutTupleRegex, abiParameterWithTupleRegex, dynamicIntegerRegex, protectedKeywordsRegex;
546
+ var init_utils = __esm(() => {
547
+ init_regex();
548
+ init_abiItem();
549
+ init_abiParameter();
550
+ init_splitParameters();
551
+ init_cache();
552
+ init_signatures();
553
+ abiParameterWithoutTupleRegex = /^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/;
554
+ abiParameterWithTupleRegex = /^\((?<type>.+?)\)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/;
555
+ dynamicIntegerRegex = /^u?int$/;
556
+ protectedKeywordsRegex = /^(?:after|alias|anonymous|apply|auto|byte|calldata|case|catch|constant|copyof|default|defined|error|event|external|false|final|function|immutable|implements|in|indexed|inline|internal|let|mapping|match|memory|mutable|null|of|override|partial|private|promise|public|pure|reference|relocatable|return|returns|sizeof|static|storage|struct|super|supports|switch|this|true|try|typedef|typeof|var|view|virtual)$/;
557
+ });
558
+
559
+ // ../../node_modules/abitype/dist/esm/human-readable/runtime/structs.js
560
+ function parseStructs(signatures) {
561
+ const shallowStructs = {};
562
+ const signaturesLength = signatures.length;
563
+ for (let i = 0;i < signaturesLength; i++) {
564
+ const signature = signatures[i];
565
+ if (!isStructSignature(signature))
566
+ continue;
567
+ const match = execStructSignature(signature);
568
+ if (!match)
569
+ throw new InvalidSignatureError({ signature, type: "struct" });
570
+ const properties = match.properties.split(";");
571
+ const components = [];
572
+ const propertiesLength = properties.length;
573
+ for (let k = 0;k < propertiesLength; k++) {
574
+ const property = properties[k];
575
+ const trimmed = property.trim();
576
+ if (!trimmed)
577
+ continue;
578
+ const abiParameter = parseAbiParameter(trimmed, {
579
+ type: "struct"
580
+ });
581
+ components.push(abiParameter);
582
+ }
583
+ if (!components.length)
584
+ throw new InvalidStructSignatureError({ signature });
585
+ shallowStructs[match.name] = components;
586
+ }
587
+ const resolvedStructs = {};
588
+ const entries = Object.entries(shallowStructs);
589
+ const entriesLength = entries.length;
590
+ for (let i = 0;i < entriesLength; i++) {
591
+ const [name, parameters] = entries[i];
592
+ resolvedStructs[name] = resolveStructs(parameters, shallowStructs);
593
+ }
594
+ return resolvedStructs;
595
+ }
596
+ function resolveStructs(abiParameters, structs, ancestors = new Set) {
597
+ const components = [];
598
+ const length = abiParameters.length;
599
+ for (let i = 0;i < length; i++) {
600
+ const abiParameter = abiParameters[i];
601
+ const isTuple = isTupleRegex.test(abiParameter.type);
602
+ if (isTuple)
603
+ components.push(abiParameter);
604
+ else {
605
+ const match = execTyped(typeWithoutTupleRegex, abiParameter.type);
606
+ if (!match?.type)
607
+ throw new InvalidAbiTypeParameterError({ abiParameter });
608
+ const { array, type } = match;
609
+ if (type in structs) {
610
+ if (ancestors.has(type))
611
+ throw new CircularReferenceError({ type });
612
+ components.push({
613
+ ...abiParameter,
614
+ type: `tuple${array ?? ""}`,
615
+ components: resolveStructs(structs[type] ?? [], structs, new Set([...ancestors, type]))
616
+ });
617
+ } else {
618
+ if (isSolidityType(type))
619
+ components.push(abiParameter);
620
+ else
621
+ throw new UnknownTypeError({ type });
622
+ }
623
+ }
624
+ }
625
+ return components;
626
+ }
627
+ var typeWithoutTupleRegex;
628
+ var init_structs = __esm(() => {
629
+ init_regex();
630
+ init_abiItem();
631
+ init_abiParameter();
632
+ init_signature();
633
+ init_struct();
634
+ init_signatures();
635
+ init_utils();
636
+ typeWithoutTupleRegex = /^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?$/;
637
+ });
638
+
639
+ // ../../node_modules/abitype/dist/esm/human-readable/parseAbiParameter.js
640
+ function parseAbiParameter2(param) {
641
+ let abiParameter;
642
+ if (typeof param === "string")
643
+ abiParameter = parseAbiParameter(param, {
644
+ modifiers
645
+ });
646
+ else {
647
+ const structs = parseStructs(param);
648
+ const length = param.length;
649
+ for (let i = 0;i < length; i++) {
650
+ const signature = param[i];
651
+ if (isStructSignature(signature))
652
+ continue;
653
+ abiParameter = parseAbiParameter(signature, { modifiers, structs });
654
+ break;
655
+ }
656
+ }
657
+ if (!abiParameter)
658
+ throw new InvalidAbiParameterError({ param });
659
+ return abiParameter;
660
+ }
661
+ var init_parseAbiParameter = __esm(() => {
662
+ init_abiParameter();
663
+ init_signatures();
664
+ init_structs();
665
+ init_utils();
666
+ });
667
+
668
+ // ../../node_modules/abitype/dist/esm/human-readable/parseAbiParameters.js
669
+ function parseAbiParameters(params) {
670
+ const abiParameters = [];
671
+ if (typeof params === "string") {
672
+ const parameters = splitParameters(params);
673
+ const length = parameters.length;
674
+ for (let i = 0;i < length; i++) {
675
+ abiParameters.push(parseAbiParameter(parameters[i], { modifiers }));
676
+ }
677
+ } else {
678
+ const structs = parseStructs(params);
679
+ const length = params.length;
680
+ for (let i = 0;i < length; i++) {
681
+ const signature = params[i];
682
+ if (isStructSignature(signature))
683
+ continue;
684
+ const parameters = splitParameters(signature);
685
+ const length2 = parameters.length;
686
+ for (let k = 0;k < length2; k++) {
687
+ abiParameters.push(parseAbiParameter(parameters[k], { modifiers, structs }));
688
+ }
689
+ }
690
+ }
691
+ if (abiParameters.length === 0)
692
+ throw new InvalidAbiParametersError({ params });
693
+ return abiParameters;
694
+ }
695
+ var init_parseAbiParameters = __esm(() => {
696
+ init_abiParameter();
697
+ init_signatures();
698
+ init_structs();
699
+ init_utils();
700
+ init_utils();
701
+ });
702
+
703
+ // ../../node_modules/abitype/dist/esm/exports/index.js
704
+ var init_exports = __esm(() => {
705
+ init_formatAbiItem();
706
+ init_parseAbiParameter();
707
+ init_parseAbiParameters();
708
+ });
709
+
710
+ // ../../node_modules/viem/_esm/utils/abi/formatAbiItem.js
711
+ function formatAbiItem2(abiItem, { includeName = false } = {}) {
712
+ if (abiItem.type !== "function" && abiItem.type !== "event" && abiItem.type !== "error")
713
+ throw new InvalidDefinitionTypeError(abiItem.type);
714
+ return `${abiItem.name}(${formatAbiParams(abiItem.inputs, { includeName })})`;
715
+ }
716
+ function formatAbiParams(params, { includeName = false } = {}) {
717
+ if (!params)
718
+ return "";
719
+ return params.map((param) => formatAbiParam(param, { includeName })).join(includeName ? ", " : ",");
720
+ }
721
+ function formatAbiParam(param, { includeName }) {
722
+ if (param.type.startsWith("tuple")) {
723
+ return `(${formatAbiParams(param.components, { includeName })})${param.type.slice("tuple".length)}`;
724
+ }
725
+ return param.type + (includeName && param.name ? ` ${param.name}` : "");
726
+ }
727
+ var init_formatAbiItem2 = __esm(() => {
728
+ init_abi();
729
+ });
730
+
731
+ // ../../node_modules/viem/_esm/utils/data/isHex.js
732
+ function isHex(value, { strict = true } = {}) {
733
+ if (!value)
734
+ return false;
735
+ if (typeof value !== "string")
736
+ return false;
737
+ return strict ? /^0x[0-9a-fA-F]*$/.test(value) : value.startsWith("0x");
738
+ }
739
+
740
+ // ../../node_modules/viem/_esm/utils/data/size.js
741
+ function size(value) {
742
+ if (isHex(value, { strict: false }))
743
+ return Math.ceil((value.length - 2) / 2);
744
+ return value.length;
745
+ }
746
+ var init_size = () => {};
747
+
748
+ // ../../node_modules/viem/_esm/errors/version.js
749
+ var version2 = "2.31.3";
750
+
751
+ // ../../node_modules/viem/_esm/errors/base.js
752
+ function walk(err, fn) {
753
+ if (fn?.(err))
754
+ return err;
755
+ if (err && typeof err === "object" && "cause" in err && err.cause !== undefined)
756
+ return walk(err.cause, fn);
757
+ return fn ? null : err;
758
+ }
759
+ var errorConfig, BaseError2;
760
+ var init_base = __esm(() => {
761
+ errorConfig = {
762
+ getDocsUrl: ({ docsBaseUrl, docsPath = "", docsSlug }) => docsPath ? `${docsBaseUrl ?? "https://viem.sh"}${docsPath}${docsSlug ? `#${docsSlug}` : ""}` : undefined,
763
+ version: `viem@${version2}`
764
+ };
765
+ BaseError2 = class BaseError2 extends Error {
766
+ constructor(shortMessage, args = {}) {
767
+ const details = (() => {
768
+ if (args.cause instanceof BaseError2)
769
+ return args.cause.details;
770
+ if (args.cause?.message)
771
+ return args.cause.message;
772
+ return args.details;
773
+ })();
774
+ const docsPath = (() => {
775
+ if (args.cause instanceof BaseError2)
776
+ return args.cause.docsPath || args.docsPath;
777
+ return args.docsPath;
778
+ })();
779
+ const docsUrl = errorConfig.getDocsUrl?.({ ...args, docsPath });
780
+ const message = [
781
+ shortMessage || "An error occurred.",
782
+ "",
783
+ ...args.metaMessages ? [...args.metaMessages, ""] : [],
784
+ ...docsUrl ? [`Docs: ${docsUrl}`] : [],
785
+ ...details ? [`Details: ${details}`] : [],
786
+ ...errorConfig.version ? [`Version: ${errorConfig.version}`] : []
787
+ ].join(`
788
+ `);
789
+ super(message, args.cause ? { cause: args.cause } : undefined);
790
+ Object.defineProperty(this, "details", {
791
+ enumerable: true,
792
+ configurable: true,
793
+ writable: true,
794
+ value: undefined
795
+ });
796
+ Object.defineProperty(this, "docsPath", {
797
+ enumerable: true,
798
+ configurable: true,
799
+ writable: true,
800
+ value: undefined
801
+ });
802
+ Object.defineProperty(this, "metaMessages", {
803
+ enumerable: true,
804
+ configurable: true,
805
+ writable: true,
806
+ value: undefined
807
+ });
808
+ Object.defineProperty(this, "shortMessage", {
809
+ enumerable: true,
810
+ configurable: true,
811
+ writable: true,
812
+ value: undefined
813
+ });
814
+ Object.defineProperty(this, "version", {
815
+ enumerable: true,
816
+ configurable: true,
817
+ writable: true,
818
+ value: undefined
819
+ });
820
+ Object.defineProperty(this, "name", {
821
+ enumerable: true,
822
+ configurable: true,
823
+ writable: true,
824
+ value: "BaseError"
825
+ });
826
+ this.details = details;
827
+ this.docsPath = docsPath;
828
+ this.metaMessages = args.metaMessages;
829
+ this.name = args.name ?? this.name;
830
+ this.shortMessage = shortMessage;
831
+ this.version = version2;
832
+ }
833
+ walk(fn) {
834
+ return walk(this, fn);
835
+ }
836
+ };
837
+ });
838
+
839
+ // ../../node_modules/viem/_esm/errors/abi.js
840
+ var AbiEncodingArrayLengthMismatchError, AbiEncodingBytesSizeMismatchError, AbiEncodingLengthMismatchError, AbiFunctionNotFoundError, AbiItemAmbiguityError, InvalidAbiEncodingTypeError, InvalidArrayError, InvalidDefinitionTypeError;
841
+ var init_abi = __esm(() => {
842
+ init_formatAbiItem2();
843
+ init_size();
844
+ init_base();
845
+ AbiEncodingArrayLengthMismatchError = class AbiEncodingArrayLengthMismatchError extends BaseError2 {
846
+ constructor({ expectedLength, givenLength, type }) {
847
+ super([
848
+ `ABI encoding array length mismatch for type ${type}.`,
849
+ `Expected length: ${expectedLength}`,
850
+ `Given length: ${givenLength}`
851
+ ].join(`
852
+ `), { name: "AbiEncodingArrayLengthMismatchError" });
853
+ }
854
+ };
855
+ AbiEncodingBytesSizeMismatchError = class AbiEncodingBytesSizeMismatchError extends BaseError2 {
856
+ constructor({ expectedSize, value }) {
857
+ super(`Size of bytes "${value}" (bytes${size(value)}) does not match expected size (bytes${expectedSize}).`, { name: "AbiEncodingBytesSizeMismatchError" });
858
+ }
859
+ };
860
+ AbiEncodingLengthMismatchError = class AbiEncodingLengthMismatchError extends BaseError2 {
861
+ constructor({ expectedLength, givenLength }) {
862
+ super([
863
+ "ABI encoding params/values length mismatch.",
864
+ `Expected length (params): ${expectedLength}`,
865
+ `Given length (values): ${givenLength}`
866
+ ].join(`
867
+ `), { name: "AbiEncodingLengthMismatchError" });
868
+ }
869
+ };
870
+ AbiFunctionNotFoundError = class AbiFunctionNotFoundError extends BaseError2 {
871
+ constructor(functionName, { docsPath } = {}) {
872
+ super([
873
+ `Function ${functionName ? `"${functionName}" ` : ""}not found on ABI.`,
874
+ "Make sure you are using the correct ABI and that the function exists on it."
875
+ ].join(`
876
+ `), {
877
+ docsPath,
878
+ name: "AbiFunctionNotFoundError"
879
+ });
880
+ }
881
+ };
882
+ AbiItemAmbiguityError = class AbiItemAmbiguityError extends BaseError2 {
883
+ constructor(x, y) {
884
+ super("Found ambiguous types in overloaded ABI items.", {
885
+ metaMessages: [
886
+ `\`${x.type}\` in \`${formatAbiItem2(x.abiItem)}\`, and`,
887
+ `\`${y.type}\` in \`${formatAbiItem2(y.abiItem)}\``,
888
+ "",
889
+ "These types encode differently and cannot be distinguished at runtime.",
890
+ "Remove one of the ambiguous items in the ABI."
891
+ ],
892
+ name: "AbiItemAmbiguityError"
893
+ });
894
+ }
895
+ };
896
+ InvalidAbiEncodingTypeError = class InvalidAbiEncodingTypeError extends BaseError2 {
897
+ constructor(type, { docsPath }) {
898
+ super([
899
+ `Type "${type}" is not a valid encoding type.`,
900
+ "Please provide a valid ABI type."
901
+ ].join(`
902
+ `), { docsPath, name: "InvalidAbiEncodingType" });
903
+ }
904
+ };
905
+ InvalidArrayError = class InvalidArrayError extends BaseError2 {
906
+ constructor(value) {
907
+ super([`Value "${value}" is not a valid array.`].join(`
908
+ `), {
909
+ name: "InvalidArrayError"
910
+ });
911
+ }
912
+ };
913
+ InvalidDefinitionTypeError = class InvalidDefinitionTypeError extends BaseError2 {
914
+ constructor(type) {
915
+ super([
916
+ `"${type}" is not a valid definition type.`,
917
+ 'Valid types: "function", "event", "error"'
918
+ ].join(`
919
+ `), { name: "InvalidDefinitionTypeError" });
920
+ }
921
+ };
922
+ });
923
+
924
+ // ../../node_modules/viem/_esm/errors/data.js
925
+ var SliceOffsetOutOfBoundsError, SizeExceedsPaddingSizeError;
926
+ var init_data = __esm(() => {
927
+ init_base();
928
+ SliceOffsetOutOfBoundsError = class SliceOffsetOutOfBoundsError extends BaseError2 {
929
+ constructor({ offset, position, size: size2 }) {
930
+ super(`Slice ${position === "start" ? "starting" : "ending"} at offset "${offset}" is out-of-bounds (size: ${size2}).`, { name: "SliceOffsetOutOfBoundsError" });
931
+ }
932
+ };
933
+ SizeExceedsPaddingSizeError = class SizeExceedsPaddingSizeError extends BaseError2 {
934
+ constructor({ size: size2, targetSize, type }) {
935
+ super(`${type.charAt(0).toUpperCase()}${type.slice(1).toLowerCase()} size (${size2}) exceeds padding size (${targetSize}).`, { name: "SizeExceedsPaddingSizeError" });
936
+ }
937
+ };
938
+ });
939
+
940
+ // ../../node_modules/viem/_esm/utils/data/pad.js
941
+ function pad(hexOrBytes, { dir, size: size2 = 32 } = {}) {
942
+ if (typeof hexOrBytes === "string")
943
+ return padHex(hexOrBytes, { dir, size: size2 });
944
+ return padBytes(hexOrBytes, { dir, size: size2 });
945
+ }
946
+ function padHex(hex_, { dir, size: size2 = 32 } = {}) {
947
+ if (size2 === null)
948
+ return hex_;
949
+ const hex = hex_.replace("0x", "");
950
+ if (hex.length > size2 * 2)
951
+ throw new SizeExceedsPaddingSizeError({
952
+ size: Math.ceil(hex.length / 2),
953
+ targetSize: size2,
954
+ type: "hex"
955
+ });
956
+ return `0x${hex[dir === "right" ? "padEnd" : "padStart"](size2 * 2, "0")}`;
957
+ }
958
+ function padBytes(bytes, { dir, size: size2 = 32 } = {}) {
959
+ if (size2 === null)
960
+ return bytes;
961
+ if (bytes.length > size2)
962
+ throw new SizeExceedsPaddingSizeError({
963
+ size: bytes.length,
964
+ targetSize: size2,
965
+ type: "bytes"
966
+ });
967
+ const paddedBytes = new Uint8Array(size2);
968
+ for (let i = 0;i < size2; i++) {
969
+ const padEnd = dir === "right";
970
+ paddedBytes[padEnd ? i : size2 - i - 1] = bytes[padEnd ? i : bytes.length - i - 1];
971
+ }
972
+ return paddedBytes;
973
+ }
974
+ var init_pad = __esm(() => {
975
+ init_data();
976
+ });
977
+
978
+ // ../../node_modules/viem/_esm/errors/encoding.js
979
+ var IntegerOutOfRangeError, SizeOverflowError;
980
+ var init_encoding = __esm(() => {
981
+ init_base();
982
+ IntegerOutOfRangeError = class IntegerOutOfRangeError extends BaseError2 {
983
+ constructor({ max, min, signed, size: size2, value }) {
984
+ super(`Number "${value}" is not in safe ${size2 ? `${size2 * 8}-bit ${signed ? "signed" : "unsigned"} ` : ""}integer range ${max ? `(${min} to ${max})` : `(above ${min})`}`, { name: "IntegerOutOfRangeError" });
985
+ }
986
+ };
987
+ SizeOverflowError = class SizeOverflowError extends BaseError2 {
988
+ constructor({ givenSize, maxSize }) {
989
+ super(`Size cannot exceed ${maxSize} bytes. Given size: ${givenSize} bytes.`, { name: "SizeOverflowError" });
990
+ }
991
+ };
992
+ });
993
+
994
+ // ../../node_modules/viem/_esm/utils/encoding/fromHex.js
995
+ function assertSize(hexOrBytes, { size: size2 }) {
996
+ if (size(hexOrBytes) > size2)
997
+ throw new SizeOverflowError({
998
+ givenSize: size(hexOrBytes),
999
+ maxSize: size2
1000
+ });
1001
+ }
1002
+ var init_fromHex = __esm(() => {
1003
+ init_encoding();
1004
+ init_size();
1005
+ });
1006
+
1007
+ // ../../node_modules/viem/_esm/utils/encoding/toHex.js
1008
+ function toHex(value, opts = {}) {
1009
+ if (typeof value === "number" || typeof value === "bigint")
1010
+ return numberToHex(value, opts);
1011
+ if (typeof value === "string") {
1012
+ return stringToHex(value, opts);
1013
+ }
1014
+ if (typeof value === "boolean")
1015
+ return boolToHex(value, opts);
1016
+ return bytesToHex(value, opts);
1017
+ }
1018
+ function boolToHex(value, opts = {}) {
1019
+ const hex = `0x${Number(value)}`;
1020
+ if (typeof opts.size === "number") {
1021
+ assertSize(hex, { size: opts.size });
1022
+ return pad(hex, { size: opts.size });
1023
+ }
1024
+ return hex;
1025
+ }
1026
+ function bytesToHex(value, opts = {}) {
1027
+ let string = "";
1028
+ for (let i = 0;i < value.length; i++) {
1029
+ string += hexes[value[i]];
1030
+ }
1031
+ const hex = `0x${string}`;
1032
+ if (typeof opts.size === "number") {
1033
+ assertSize(hex, { size: opts.size });
1034
+ return pad(hex, { dir: "right", size: opts.size });
1035
+ }
1036
+ return hex;
1037
+ }
1038
+ function numberToHex(value_, opts = {}) {
1039
+ const { signed, size: size2 } = opts;
1040
+ const value = BigInt(value_);
1041
+ let maxValue;
1042
+ if (size2) {
1043
+ if (signed)
1044
+ maxValue = (1n << BigInt(size2) * 8n - 1n) - 1n;
1045
+ else
1046
+ maxValue = 2n ** (BigInt(size2) * 8n) - 1n;
1047
+ } else if (typeof value_ === "number") {
1048
+ maxValue = BigInt(Number.MAX_SAFE_INTEGER);
1049
+ }
1050
+ const minValue = typeof maxValue === "bigint" && signed ? -maxValue - 1n : 0;
1051
+ if (maxValue && value > maxValue || value < minValue) {
1052
+ const suffix = typeof value_ === "bigint" ? "n" : "";
1053
+ throw new IntegerOutOfRangeError({
1054
+ max: maxValue ? `${maxValue}${suffix}` : undefined,
1055
+ min: `${minValue}${suffix}`,
1056
+ signed,
1057
+ size: size2,
1058
+ value: `${value_}${suffix}`
1059
+ });
1060
+ }
1061
+ const hex = `0x${(signed && value < 0 ? (1n << BigInt(size2 * 8)) + BigInt(value) : value).toString(16)}`;
1062
+ if (size2)
1063
+ return pad(hex, { size: size2 });
1064
+ return hex;
1065
+ }
1066
+ function stringToHex(value_, opts = {}) {
1067
+ const value = encoder.encode(value_);
1068
+ return bytesToHex(value, opts);
1069
+ }
1070
+ var hexes, encoder;
1071
+ var init_toHex = __esm(() => {
1072
+ init_encoding();
1073
+ init_pad();
1074
+ init_fromHex();
1075
+ hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_v, i) => i.toString(16).padStart(2, "0"));
1076
+ encoder = /* @__PURE__ */ new TextEncoder;
1077
+ });
1078
+
1079
+ // ../../node_modules/viem/_esm/utils/encoding/toBytes.js
1080
+ function toBytes(value, opts = {}) {
1081
+ if (typeof value === "number" || typeof value === "bigint")
1082
+ return numberToBytes(value, opts);
1083
+ if (typeof value === "boolean")
1084
+ return boolToBytes(value, opts);
1085
+ if (isHex(value))
1086
+ return hexToBytes(value, opts);
1087
+ return stringToBytes(value, opts);
1088
+ }
1089
+ function boolToBytes(value, opts = {}) {
1090
+ const bytes = new Uint8Array(1);
1091
+ bytes[0] = Number(value);
1092
+ if (typeof opts.size === "number") {
1093
+ assertSize(bytes, { size: opts.size });
1094
+ return pad(bytes, { size: opts.size });
1095
+ }
1096
+ return bytes;
1097
+ }
1098
+ function charCodeToBase16(char) {
1099
+ if (char >= charCodeMap.zero && char <= charCodeMap.nine)
1100
+ return char - charCodeMap.zero;
1101
+ if (char >= charCodeMap.A && char <= charCodeMap.F)
1102
+ return char - (charCodeMap.A - 10);
1103
+ if (char >= charCodeMap.a && char <= charCodeMap.f)
1104
+ return char - (charCodeMap.a - 10);
1105
+ return;
1106
+ }
1107
+ function hexToBytes(hex_, opts = {}) {
1108
+ let hex = hex_;
1109
+ if (opts.size) {
1110
+ assertSize(hex, { size: opts.size });
1111
+ hex = pad(hex, { dir: "right", size: opts.size });
1112
+ }
1113
+ let hexString = hex.slice(2);
1114
+ if (hexString.length % 2)
1115
+ hexString = `0${hexString}`;
1116
+ const length = hexString.length / 2;
1117
+ const bytes = new Uint8Array(length);
1118
+ for (let index = 0, j = 0;index < length; index++) {
1119
+ const nibbleLeft = charCodeToBase16(hexString.charCodeAt(j++));
1120
+ const nibbleRight = charCodeToBase16(hexString.charCodeAt(j++));
1121
+ if (nibbleLeft === undefined || nibbleRight === undefined) {
1122
+ throw new BaseError2(`Invalid byte sequence ("${hexString[j - 2]}${hexString[j - 1]}" in "${hexString}").`);
1123
+ }
1124
+ bytes[index] = nibbleLeft * 16 + nibbleRight;
1125
+ }
1126
+ return bytes;
1127
+ }
1128
+ function numberToBytes(value, opts) {
1129
+ const hex = numberToHex(value, opts);
1130
+ return hexToBytes(hex);
1131
+ }
1132
+ function stringToBytes(value, opts = {}) {
1133
+ const bytes = encoder2.encode(value);
1134
+ if (typeof opts.size === "number") {
1135
+ assertSize(bytes, { size: opts.size });
1136
+ return pad(bytes, { dir: "right", size: opts.size });
1137
+ }
1138
+ return bytes;
1139
+ }
1140
+ var encoder2, charCodeMap;
1141
+ var init_toBytes = __esm(() => {
1142
+ init_base();
1143
+ init_pad();
1144
+ init_fromHex();
1145
+ init_toHex();
1146
+ encoder2 = /* @__PURE__ */ new TextEncoder;
1147
+ charCodeMap = {
1148
+ zero: 48,
1149
+ nine: 57,
1150
+ A: 65,
1151
+ F: 70,
1152
+ a: 97,
1153
+ f: 102
1154
+ };
1155
+ });
1156
+
1157
+ // ../../node_modules/@noble/hashes/esm/_u64.js
1158
+ function fromBig(n, le = false) {
1159
+ if (le)
1160
+ return { h: Number(n & U32_MASK64), l: Number(n >> _32n & U32_MASK64) };
1161
+ return { h: Number(n >> _32n & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 };
1162
+ }
1163
+ function split(lst, le = false) {
1164
+ const len = lst.length;
1165
+ let Ah = new Uint32Array(len);
1166
+ let Al = new Uint32Array(len);
1167
+ for (let i = 0;i < len; i++) {
1168
+ const { h, l } = fromBig(lst[i], le);
1169
+ [Ah[i], Al[i]] = [h, l];
1170
+ }
1171
+ return [Ah, Al];
1172
+ }
1173
+ var U32_MASK64, _32n, rotlSH = (h, l, s) => h << s | l >>> 32 - s, rotlSL = (h, l, s) => l << s | h >>> 32 - s, rotlBH = (h, l, s) => l << s - 32 | h >>> 64 - s, rotlBL = (h, l, s) => h << s - 32 | l >>> 64 - s;
1174
+ var init__u64 = __esm(() => {
1175
+ U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1);
1176
+ _32n = /* @__PURE__ */ BigInt(32);
1177
+ });
1178
+
1179
+ // ../../node_modules/@noble/hashes/esm/utils.js
1180
+ function isBytes(a) {
1181
+ return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array";
1182
+ }
1183
+ function anumber(n) {
1184
+ if (!Number.isSafeInteger(n) || n < 0)
1185
+ throw new Error("positive integer expected, got " + n);
1186
+ }
1187
+ function abytes(b, ...lengths) {
1188
+ if (!isBytes(b))
1189
+ throw new Error("Uint8Array expected");
1190
+ if (lengths.length > 0 && !lengths.includes(b.length))
1191
+ throw new Error("Uint8Array expected of length " + lengths + ", got length=" + b.length);
1192
+ }
1193
+ function aexists(instance, checkFinished = true) {
1194
+ if (instance.destroyed)
1195
+ throw new Error("Hash instance has been destroyed");
1196
+ if (checkFinished && instance.finished)
1197
+ throw new Error("Hash#digest() has already been called");
1198
+ }
1199
+ function aoutput(out, instance) {
1200
+ abytes(out);
1201
+ const min = instance.outputLen;
1202
+ if (out.length < min) {
1203
+ throw new Error("digestInto() expects output buffer of length at least " + min);
1204
+ }
1205
+ }
1206
+ function u32(arr) {
1207
+ return new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));
1208
+ }
1209
+ function clean(...arrays) {
1210
+ for (let i = 0;i < arrays.length; i++) {
1211
+ arrays[i].fill(0);
1212
+ }
1213
+ }
1214
+ function byteSwap(word) {
1215
+ return word << 24 & 4278190080 | word << 8 & 16711680 | word >>> 8 & 65280 | word >>> 24 & 255;
1216
+ }
1217
+ function byteSwap32(arr) {
1218
+ for (let i = 0;i < arr.length; i++) {
1219
+ arr[i] = byteSwap(arr[i]);
1220
+ }
1221
+ return arr;
1222
+ }
1223
+ function utf8ToBytes(str) {
1224
+ if (typeof str !== "string")
1225
+ throw new Error("string expected");
1226
+ return new Uint8Array(new TextEncoder().encode(str));
1227
+ }
1228
+ function toBytes2(data) {
1229
+ if (typeof data === "string")
1230
+ data = utf8ToBytes(data);
1231
+ abytes(data);
1232
+ return data;
1233
+ }
1234
+
1235
+ class Hash {
1236
+ }
1237
+ function createHasher(hashCons) {
1238
+ const hashC = (msg) => hashCons().update(toBytes2(msg)).digest();
1239
+ const tmp = hashCons();
1240
+ hashC.outputLen = tmp.outputLen;
1241
+ hashC.blockLen = tmp.blockLen;
1242
+ hashC.create = () => hashCons();
1243
+ return hashC;
1244
+ }
1245
+ var isLE, swap32IfBE;
1246
+ var init_utils2 = __esm(() => {
1247
+ /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
1248
+ isLE = /* @__PURE__ */ (() => new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68)();
1249
+ swap32IfBE = isLE ? (u) => u : byteSwap32;
1250
+ });
1251
+
1252
+ // ../../node_modules/@noble/hashes/esm/sha3.js
1253
+ function keccakP(s, rounds = 24) {
1254
+ const B = new Uint32Array(5 * 2);
1255
+ for (let round = 24 - rounds;round < 24; round++) {
1256
+ for (let x = 0;x < 10; x++)
1257
+ B[x] = s[x] ^ s[x + 10] ^ s[x + 20] ^ s[x + 30] ^ s[x + 40];
1258
+ for (let x = 0;x < 10; x += 2) {
1259
+ const idx1 = (x + 8) % 10;
1260
+ const idx0 = (x + 2) % 10;
1261
+ const B0 = B[idx0];
1262
+ const B1 = B[idx0 + 1];
1263
+ const Th = rotlH(B0, B1, 1) ^ B[idx1];
1264
+ const Tl = rotlL(B0, B1, 1) ^ B[idx1 + 1];
1265
+ for (let y = 0;y < 50; y += 10) {
1266
+ s[x + y] ^= Th;
1267
+ s[x + y + 1] ^= Tl;
1268
+ }
1269
+ }
1270
+ let curH = s[2];
1271
+ let curL = s[3];
1272
+ for (let t = 0;t < 24; t++) {
1273
+ const shift = SHA3_ROTL[t];
1274
+ const Th = rotlH(curH, curL, shift);
1275
+ const Tl = rotlL(curH, curL, shift);
1276
+ const PI = SHA3_PI[t];
1277
+ curH = s[PI];
1278
+ curL = s[PI + 1];
1279
+ s[PI] = Th;
1280
+ s[PI + 1] = Tl;
1281
+ }
1282
+ for (let y = 0;y < 50; y += 10) {
1283
+ for (let x = 0;x < 10; x++)
1284
+ B[x] = s[y + x];
1285
+ for (let x = 0;x < 10; x++)
1286
+ s[y + x] ^= ~B[(x + 2) % 10] & B[(x + 4) % 10];
1287
+ }
1288
+ s[0] ^= SHA3_IOTA_H[round];
1289
+ s[1] ^= SHA3_IOTA_L[round];
1290
+ }
1291
+ clean(B);
1292
+ }
1293
+ var _0n, _1n, _2n, _7n, _256n, _0x71n, SHA3_PI, SHA3_ROTL, _SHA3_IOTA, IOTAS, SHA3_IOTA_H, SHA3_IOTA_L, rotlH = (h, l, s) => s > 32 ? rotlBH(h, l, s) : rotlSH(h, l, s), rotlL = (h, l, s) => s > 32 ? rotlBL(h, l, s) : rotlSL(h, l, s), Keccak, gen = (suffix, blockLen, outputLen) => createHasher(() => new Keccak(blockLen, suffix, outputLen)), keccak_256;
1294
+ var init_sha3 = __esm(() => {
1295
+ init__u64();
1296
+ init_utils2();
1297
+ _0n = BigInt(0);
1298
+ _1n = BigInt(1);
1299
+ _2n = BigInt(2);
1300
+ _7n = BigInt(7);
1301
+ _256n = BigInt(256);
1302
+ _0x71n = BigInt(113);
1303
+ SHA3_PI = [];
1304
+ SHA3_ROTL = [];
1305
+ _SHA3_IOTA = [];
1306
+ for (let round = 0, R = _1n, x = 1, y = 0;round < 24; round++) {
1307
+ [x, y] = [y, (2 * x + 3 * y) % 5];
1308
+ SHA3_PI.push(2 * (5 * y + x));
1309
+ SHA3_ROTL.push((round + 1) * (round + 2) / 2 % 64);
1310
+ let t = _0n;
1311
+ for (let j = 0;j < 7; j++) {
1312
+ R = (R << _1n ^ (R >> _7n) * _0x71n) % _256n;
1313
+ if (R & _2n)
1314
+ t ^= _1n << (_1n << /* @__PURE__ */ BigInt(j)) - _1n;
1315
+ }
1316
+ _SHA3_IOTA.push(t);
1317
+ }
1318
+ IOTAS = split(_SHA3_IOTA, true);
1319
+ SHA3_IOTA_H = IOTAS[0];
1320
+ SHA3_IOTA_L = IOTAS[1];
1321
+ Keccak = class Keccak extends Hash {
1322
+ constructor(blockLen, suffix, outputLen, enableXOF = false, rounds = 24) {
1323
+ super();
1324
+ this.pos = 0;
1325
+ this.posOut = 0;
1326
+ this.finished = false;
1327
+ this.destroyed = false;
1328
+ this.enableXOF = false;
1329
+ this.blockLen = blockLen;
1330
+ this.suffix = suffix;
1331
+ this.outputLen = outputLen;
1332
+ this.enableXOF = enableXOF;
1333
+ this.rounds = rounds;
1334
+ anumber(outputLen);
1335
+ if (!(0 < blockLen && blockLen < 200))
1336
+ throw new Error("only keccak-f1600 function is supported");
1337
+ this.state = new Uint8Array(200);
1338
+ this.state32 = u32(this.state);
1339
+ }
1340
+ clone() {
1341
+ return this._cloneInto();
1342
+ }
1343
+ keccak() {
1344
+ swap32IfBE(this.state32);
1345
+ keccakP(this.state32, this.rounds);
1346
+ swap32IfBE(this.state32);
1347
+ this.posOut = 0;
1348
+ this.pos = 0;
1349
+ }
1350
+ update(data) {
1351
+ aexists(this);
1352
+ data = toBytes2(data);
1353
+ abytes(data);
1354
+ const { blockLen, state } = this;
1355
+ const len = data.length;
1356
+ for (let pos = 0;pos < len; ) {
1357
+ const take = Math.min(blockLen - this.pos, len - pos);
1358
+ for (let i = 0;i < take; i++)
1359
+ state[this.pos++] ^= data[pos++];
1360
+ if (this.pos === blockLen)
1361
+ this.keccak();
1362
+ }
1363
+ return this;
1364
+ }
1365
+ finish() {
1366
+ if (this.finished)
1367
+ return;
1368
+ this.finished = true;
1369
+ const { state, suffix, pos, blockLen } = this;
1370
+ state[pos] ^= suffix;
1371
+ if ((suffix & 128) !== 0 && pos === blockLen - 1)
1372
+ this.keccak();
1373
+ state[blockLen - 1] ^= 128;
1374
+ this.keccak();
1375
+ }
1376
+ writeInto(out) {
1377
+ aexists(this, false);
1378
+ abytes(out);
1379
+ this.finish();
1380
+ const bufferOut = this.state;
1381
+ const { blockLen } = this;
1382
+ for (let pos = 0, len = out.length;pos < len; ) {
1383
+ if (this.posOut >= blockLen)
1384
+ this.keccak();
1385
+ const take = Math.min(blockLen - this.posOut, len - pos);
1386
+ out.set(bufferOut.subarray(this.posOut, this.posOut + take), pos);
1387
+ this.posOut += take;
1388
+ pos += take;
1389
+ }
1390
+ return out;
1391
+ }
1392
+ xofInto(out) {
1393
+ if (!this.enableXOF)
1394
+ throw new Error("XOF is not possible for this instance");
1395
+ return this.writeInto(out);
1396
+ }
1397
+ xof(bytes) {
1398
+ anumber(bytes);
1399
+ return this.xofInto(new Uint8Array(bytes));
1400
+ }
1401
+ digestInto(out) {
1402
+ aoutput(out, this);
1403
+ if (this.finished)
1404
+ throw new Error("digest() was already called");
1405
+ this.writeInto(out);
1406
+ this.destroy();
1407
+ return out;
1408
+ }
1409
+ digest() {
1410
+ return this.digestInto(new Uint8Array(this.outputLen));
1411
+ }
1412
+ destroy() {
1413
+ this.destroyed = true;
1414
+ clean(this.state);
1415
+ }
1416
+ _cloneInto(to) {
1417
+ const { blockLen, suffix, outputLen, rounds, enableXOF } = this;
1418
+ to || (to = new Keccak(blockLen, suffix, outputLen, enableXOF, rounds));
1419
+ to.state32.set(this.state32);
1420
+ to.pos = this.pos;
1421
+ to.posOut = this.posOut;
1422
+ to.finished = this.finished;
1423
+ to.rounds = rounds;
1424
+ to.suffix = suffix;
1425
+ to.outputLen = outputLen;
1426
+ to.enableXOF = enableXOF;
1427
+ to.destroyed = this.destroyed;
1428
+ return to;
1429
+ }
1430
+ };
1431
+ keccak_256 = /* @__PURE__ */ (() => gen(1, 136, 256 / 8))();
1432
+ });
1433
+
1434
+ // ../../node_modules/viem/_esm/utils/hash/keccak256.js
1435
+ function keccak256(value, to_) {
1436
+ const to = to_ || "hex";
1437
+ const bytes = keccak_256(isHex(value, { strict: false }) ? toBytes(value) : value);
1438
+ if (to === "bytes")
1439
+ return bytes;
1440
+ return toHex(bytes);
1441
+ }
1442
+ var init_keccak256 = __esm(() => {
1443
+ init_sha3();
1444
+ init_toBytes();
1445
+ init_toHex();
1446
+ });
1447
+
1448
+ // ../../node_modules/viem/_esm/utils/hash/hashSignature.js
1449
+ function hashSignature(sig) {
1450
+ return hash(sig);
1451
+ }
1452
+ var hash = (value) => keccak256(toBytes(value));
1453
+ var init_hashSignature = __esm(() => {
1454
+ init_toBytes();
1455
+ init_keccak256();
1456
+ });
1457
+
1458
+ // ../../node_modules/viem/_esm/utils/hash/normalizeSignature.js
1459
+ function normalizeSignature(signature) {
1460
+ let active = true;
1461
+ let current = "";
1462
+ let level = 0;
1463
+ let result = "";
1464
+ let valid = false;
1465
+ for (let i = 0;i < signature.length; i++) {
1466
+ const char = signature[i];
1467
+ if (["(", ")", ","].includes(char))
1468
+ active = true;
1469
+ if (char === "(")
1470
+ level++;
1471
+ if (char === ")")
1472
+ level--;
1473
+ if (!active)
1474
+ continue;
1475
+ if (level === 0) {
1476
+ if (char === " " && ["event", "function", ""].includes(result))
1477
+ result = "";
1478
+ else {
1479
+ result += char;
1480
+ if (char === ")") {
1481
+ valid = true;
1482
+ break;
1483
+ }
1484
+ }
1485
+ continue;
1486
+ }
1487
+ if (char === " ") {
1488
+ if (signature[i - 1] !== "," && current !== "," && current !== ",(") {
1489
+ current = "";
1490
+ active = false;
1491
+ }
1492
+ continue;
1493
+ }
1494
+ result += char;
1495
+ current += char;
1496
+ }
1497
+ if (!valid)
1498
+ throw new BaseError2("Unable to normalize signature.");
1499
+ return result;
1500
+ }
1501
+ var init_normalizeSignature = __esm(() => {
1502
+ init_base();
1503
+ });
1504
+
1505
+ // ../../node_modules/viem/_esm/utils/hash/toSignature.js
1506
+ var toSignature = (def) => {
1507
+ const def_ = (() => {
1508
+ if (typeof def === "string")
1509
+ return def;
1510
+ return formatAbiItem(def);
1511
+ })();
1512
+ return normalizeSignature(def_);
1513
+ };
1514
+ var init_toSignature = __esm(() => {
1515
+ init_exports();
1516
+ init_normalizeSignature();
1517
+ });
1518
+
1519
+ // ../../node_modules/viem/_esm/utils/hash/toSignatureHash.js
1520
+ function toSignatureHash(fn) {
1521
+ return hashSignature(toSignature(fn));
1522
+ }
1523
+ var init_toSignatureHash = __esm(() => {
1524
+ init_hashSignature();
1525
+ init_toSignature();
1526
+ });
1527
+
1528
+ // ../../node_modules/viem/_esm/utils/hash/toEventSelector.js
1529
+ var toEventSelector;
1530
+ var init_toEventSelector = __esm(() => {
1531
+ init_toSignatureHash();
1532
+ toEventSelector = toSignatureHash;
1533
+ });
1534
+
1535
+ // ../../node_modules/viem/_esm/errors/address.js
1536
+ var InvalidAddressError;
1537
+ var init_address = __esm(() => {
1538
+ init_base();
1539
+ InvalidAddressError = class InvalidAddressError extends BaseError2 {
1540
+ constructor({ address }) {
1541
+ super(`Address "${address}" is invalid.`, {
1542
+ metaMessages: [
1543
+ "- Address must be a hex value of 20 bytes (40 hex characters).",
1544
+ "- Address must match its checksum counterpart."
1545
+ ],
1546
+ name: "InvalidAddressError"
1547
+ });
1548
+ }
1549
+ };
1550
+ });
1551
+
1552
+ // ../../node_modules/viem/_esm/utils/lru.js
1553
+ var LruMap;
1554
+ var init_lru = __esm(() => {
1555
+ LruMap = class LruMap extends Map {
1556
+ constructor(size2) {
1557
+ super();
1558
+ Object.defineProperty(this, "maxSize", {
1559
+ enumerable: true,
1560
+ configurable: true,
1561
+ writable: true,
1562
+ value: undefined
1563
+ });
1564
+ this.maxSize = size2;
1565
+ }
1566
+ get(key) {
1567
+ const value = super.get(key);
1568
+ if (super.has(key) && value !== undefined) {
1569
+ this.delete(key);
1570
+ super.set(key, value);
1571
+ }
1572
+ return value;
1573
+ }
1574
+ set(key, value) {
1575
+ super.set(key, value);
1576
+ if (this.maxSize && this.size > this.maxSize) {
1577
+ const firstKey = this.keys().next().value;
1578
+ if (firstKey)
1579
+ this.delete(firstKey);
1580
+ }
1581
+ return this;
1582
+ }
1583
+ };
1584
+ });
1585
+
1586
+ // ../../node_modules/viem/_esm/utils/address/getAddress.js
1587
+ function checksumAddress(address_, chainId) {
1588
+ if (checksumAddressCache.has(`${address_}.${chainId}`))
1589
+ return checksumAddressCache.get(`${address_}.${chainId}`);
1590
+ const hexAddress = chainId ? `${chainId}${address_.toLowerCase()}` : address_.substring(2).toLowerCase();
1591
+ const hash2 = keccak256(stringToBytes(hexAddress), "bytes");
1592
+ const address = (chainId ? hexAddress.substring(`${chainId}0x`.length) : hexAddress).split("");
1593
+ for (let i = 0;i < 40; i += 2) {
1594
+ if (hash2[i >> 1] >> 4 >= 8 && address[i]) {
1595
+ address[i] = address[i].toUpperCase();
1596
+ }
1597
+ if ((hash2[i >> 1] & 15) >= 8 && address[i + 1]) {
1598
+ address[i + 1] = address[i + 1].toUpperCase();
1599
+ }
1600
+ }
1601
+ const result = `0x${address.join("")}`;
1602
+ checksumAddressCache.set(`${address_}.${chainId}`, result);
1603
+ return result;
1604
+ }
1605
+ var checksumAddressCache;
1606
+ var init_getAddress = __esm(() => {
1607
+ init_toBytes();
1608
+ init_keccak256();
1609
+ init_lru();
1610
+ checksumAddressCache = /* @__PURE__ */ new LruMap(8192);
1611
+ });
1612
+
1613
+ // ../../node_modules/viem/_esm/utils/address/isAddress.js
1614
+ function isAddress(address, options) {
1615
+ const { strict = true } = options ?? {};
1616
+ const cacheKey = `${address}.${strict}`;
1617
+ if (isAddressCache.has(cacheKey))
1618
+ return isAddressCache.get(cacheKey);
1619
+ const result = (() => {
1620
+ if (!addressRegex.test(address))
1621
+ return false;
1622
+ if (address.toLowerCase() === address)
1623
+ return true;
1624
+ if (strict)
1625
+ return checksumAddress(address) === address;
1626
+ return true;
1627
+ })();
1628
+ isAddressCache.set(cacheKey, result);
1629
+ return result;
1630
+ }
1631
+ var addressRegex, isAddressCache;
1632
+ var init_isAddress = __esm(() => {
1633
+ init_lru();
1634
+ init_getAddress();
1635
+ addressRegex = /^0x[a-fA-F0-9]{40}$/;
1636
+ isAddressCache = /* @__PURE__ */ new LruMap(8192);
1637
+ });
1638
+
1639
+ // ../../node_modules/viem/_esm/utils/data/concat.js
1640
+ function concat(values) {
1641
+ if (typeof values[0] === "string")
1642
+ return concatHex(values);
1643
+ return concatBytes(values);
1644
+ }
1645
+ function concatBytes(values) {
1646
+ let length = 0;
1647
+ for (const arr of values) {
1648
+ length += arr.length;
1649
+ }
1650
+ const result = new Uint8Array(length);
1651
+ let offset = 0;
1652
+ for (const arr of values) {
1653
+ result.set(arr, offset);
1654
+ offset += arr.length;
1655
+ }
1656
+ return result;
1657
+ }
1658
+ function concatHex(values) {
1659
+ return `0x${values.reduce((acc, x) => acc + x.replace("0x", ""), "")}`;
1660
+ }
1661
+
1662
+ // ../../node_modules/viem/_esm/utils/data/slice.js
1663
+ function slice(value, start, end, { strict } = {}) {
1664
+ if (isHex(value, { strict: false }))
1665
+ return sliceHex(value, start, end, {
1666
+ strict
1667
+ });
1668
+ return sliceBytes(value, start, end, {
1669
+ strict
1670
+ });
1671
+ }
1672
+ function assertStartOffset(value, start) {
1673
+ if (typeof start === "number" && start > 0 && start > size(value) - 1)
1674
+ throw new SliceOffsetOutOfBoundsError({
1675
+ offset: start,
1676
+ position: "start",
1677
+ size: size(value)
1678
+ });
1679
+ }
1680
+ function assertEndOffset(value, start, end) {
1681
+ if (typeof start === "number" && typeof end === "number" && size(value) !== end - start) {
1682
+ throw new SliceOffsetOutOfBoundsError({
1683
+ offset: end,
1684
+ position: "end",
1685
+ size: size(value)
1686
+ });
1687
+ }
1688
+ }
1689
+ function sliceBytes(value_, start, end, { strict } = {}) {
1690
+ assertStartOffset(value_, start);
1691
+ const value = value_.slice(start, end);
1692
+ if (strict)
1693
+ assertEndOffset(value, start, end);
1694
+ return value;
1695
+ }
1696
+ function sliceHex(value_, start, end, { strict } = {}) {
1697
+ assertStartOffset(value_, start);
1698
+ const value = `0x${value_.replace("0x", "").slice((start ?? 0) * 2, (end ?? value_.length) * 2)}`;
1699
+ if (strict)
1700
+ assertEndOffset(value, start, end);
1701
+ return value;
1702
+ }
1703
+ var init_slice = __esm(() => {
1704
+ init_data();
1705
+ init_size();
1706
+ });
1707
+
1708
+ // ../../node_modules/viem/_esm/utils/regex.js
1709
+ var integerRegex2;
1710
+ var init_regex2 = __esm(() => {
1711
+ integerRegex2 = /^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;
1712
+ });
1713
+
1714
+ // ../../node_modules/viem/_esm/utils/abi/encodeAbiParameters.js
1715
+ function encodeAbiParameters(params, values) {
1716
+ if (params.length !== values.length)
1717
+ throw new AbiEncodingLengthMismatchError({
1718
+ expectedLength: params.length,
1719
+ givenLength: values.length
1720
+ });
1721
+ const preparedParams = prepareParams({
1722
+ params,
1723
+ values
1724
+ });
1725
+ const data = encodeParams(preparedParams);
1726
+ if (data.length === 0)
1727
+ return "0x";
1728
+ return data;
1729
+ }
1730
+ function prepareParams({ params, values }) {
1731
+ const preparedParams = [];
1732
+ for (let i = 0;i < params.length; i++) {
1733
+ preparedParams.push(prepareParam({ param: params[i], value: values[i] }));
1734
+ }
1735
+ return preparedParams;
1736
+ }
1737
+ function prepareParam({ param, value }) {
1738
+ const arrayComponents = getArrayComponents(param.type);
1739
+ if (arrayComponents) {
1740
+ const [length, type] = arrayComponents;
1741
+ return encodeArray(value, { length, param: { ...param, type } });
1742
+ }
1743
+ if (param.type === "tuple") {
1744
+ return encodeTuple(value, {
1745
+ param
1746
+ });
1747
+ }
1748
+ if (param.type === "address") {
1749
+ return encodeAddress(value);
1750
+ }
1751
+ if (param.type === "bool") {
1752
+ return encodeBool(value);
1753
+ }
1754
+ if (param.type.startsWith("uint") || param.type.startsWith("int")) {
1755
+ const signed = param.type.startsWith("int");
1756
+ const [, , size2 = "256"] = integerRegex2.exec(param.type) ?? [];
1757
+ return encodeNumber(value, {
1758
+ signed,
1759
+ size: Number(size2)
1760
+ });
1761
+ }
1762
+ if (param.type.startsWith("bytes")) {
1763
+ return encodeBytes(value, { param });
1764
+ }
1765
+ if (param.type === "string") {
1766
+ return encodeString(value);
1767
+ }
1768
+ throw new InvalidAbiEncodingTypeError(param.type, {
1769
+ docsPath: "/docs/contract/encodeAbiParameters"
1770
+ });
1771
+ }
1772
+ function encodeParams(preparedParams) {
1773
+ let staticSize = 0;
1774
+ for (let i = 0;i < preparedParams.length; i++) {
1775
+ const { dynamic, encoded } = preparedParams[i];
1776
+ if (dynamic)
1777
+ staticSize += 32;
1778
+ else
1779
+ staticSize += size(encoded);
1780
+ }
1781
+ const staticParams = [];
1782
+ const dynamicParams = [];
1783
+ let dynamicSize = 0;
1784
+ for (let i = 0;i < preparedParams.length; i++) {
1785
+ const { dynamic, encoded } = preparedParams[i];
1786
+ if (dynamic) {
1787
+ staticParams.push(numberToHex(staticSize + dynamicSize, { size: 32 }));
1788
+ dynamicParams.push(encoded);
1789
+ dynamicSize += size(encoded);
1790
+ } else {
1791
+ staticParams.push(encoded);
1792
+ }
1793
+ }
1794
+ return concat([...staticParams, ...dynamicParams]);
1795
+ }
1796
+ function encodeAddress(value) {
1797
+ if (!isAddress(value))
1798
+ throw new InvalidAddressError({ address: value });
1799
+ return { dynamic: false, encoded: padHex(value.toLowerCase()) };
1800
+ }
1801
+ function encodeArray(value, { length, param }) {
1802
+ const dynamic = length === null;
1803
+ if (!Array.isArray(value))
1804
+ throw new InvalidArrayError(value);
1805
+ if (!dynamic && value.length !== length)
1806
+ throw new AbiEncodingArrayLengthMismatchError({
1807
+ expectedLength: length,
1808
+ givenLength: value.length,
1809
+ type: `${param.type}[${length}]`
1810
+ });
1811
+ let dynamicChild = false;
1812
+ const preparedParams = [];
1813
+ for (let i = 0;i < value.length; i++) {
1814
+ const preparedParam = prepareParam({ param, value: value[i] });
1815
+ if (preparedParam.dynamic)
1816
+ dynamicChild = true;
1817
+ preparedParams.push(preparedParam);
1818
+ }
1819
+ if (dynamic || dynamicChild) {
1820
+ const data = encodeParams(preparedParams);
1821
+ if (dynamic) {
1822
+ const length2 = numberToHex(preparedParams.length, { size: 32 });
1823
+ return {
1824
+ dynamic: true,
1825
+ encoded: preparedParams.length > 0 ? concat([length2, data]) : length2
1826
+ };
1827
+ }
1828
+ if (dynamicChild)
1829
+ return { dynamic: true, encoded: data };
1830
+ }
1831
+ return {
1832
+ dynamic: false,
1833
+ encoded: concat(preparedParams.map(({ encoded }) => encoded))
1834
+ };
1835
+ }
1836
+ function encodeBytes(value, { param }) {
1837
+ const [, paramSize] = param.type.split("bytes");
1838
+ const bytesSize = size(value);
1839
+ if (!paramSize) {
1840
+ let value_ = value;
1841
+ if (bytesSize % 32 !== 0)
1842
+ value_ = padHex(value_, {
1843
+ dir: "right",
1844
+ size: Math.ceil((value.length - 2) / 2 / 32) * 32
1845
+ });
1846
+ return {
1847
+ dynamic: true,
1848
+ encoded: concat([padHex(numberToHex(bytesSize, { size: 32 })), value_])
1849
+ };
1850
+ }
1851
+ if (bytesSize !== Number.parseInt(paramSize))
1852
+ throw new AbiEncodingBytesSizeMismatchError({
1853
+ expectedSize: Number.parseInt(paramSize),
1854
+ value
1855
+ });
1856
+ return { dynamic: false, encoded: padHex(value, { dir: "right" }) };
1857
+ }
1858
+ function encodeBool(value) {
1859
+ if (typeof value !== "boolean")
1860
+ throw new BaseError2(`Invalid boolean value: "${value}" (type: ${typeof value}). Expected: \`true\` or \`false\`.`);
1861
+ return { dynamic: false, encoded: padHex(boolToHex(value)) };
1862
+ }
1863
+ function encodeNumber(value, { signed, size: size2 = 256 }) {
1864
+ if (typeof size2 === "number") {
1865
+ const max = 2n ** (BigInt(size2) - (signed ? 1n : 0n)) - 1n;
1866
+ const min = signed ? -max - 1n : 0n;
1867
+ if (value > max || value < min)
1868
+ throw new IntegerOutOfRangeError({
1869
+ max: max.toString(),
1870
+ min: min.toString(),
1871
+ signed,
1872
+ size: size2 / 8,
1873
+ value: value.toString()
1874
+ });
1875
+ }
1876
+ return {
1877
+ dynamic: false,
1878
+ encoded: numberToHex(value, {
1879
+ size: 32,
1880
+ signed
1881
+ })
1882
+ };
1883
+ }
1884
+ function encodeString(value) {
1885
+ const hexValue = stringToHex(value);
1886
+ const partsLength = Math.ceil(size(hexValue) / 32);
1887
+ const parts = [];
1888
+ for (let i = 0;i < partsLength; i++) {
1889
+ parts.push(padHex(slice(hexValue, i * 32, (i + 1) * 32), {
1890
+ dir: "right"
1891
+ }));
1892
+ }
1893
+ return {
1894
+ dynamic: true,
1895
+ encoded: concat([
1896
+ padHex(numberToHex(size(hexValue), { size: 32 })),
1897
+ ...parts
1898
+ ])
1899
+ };
1900
+ }
1901
+ function encodeTuple(value, { param }) {
1902
+ let dynamic = false;
1903
+ const preparedParams = [];
1904
+ for (let i = 0;i < param.components.length; i++) {
1905
+ const param_ = param.components[i];
1906
+ const index = Array.isArray(value) ? i : param_.name;
1907
+ const preparedParam = prepareParam({
1908
+ param: param_,
1909
+ value: value[index]
1910
+ });
1911
+ preparedParams.push(preparedParam);
1912
+ if (preparedParam.dynamic)
1913
+ dynamic = true;
1914
+ }
1915
+ return {
1916
+ dynamic,
1917
+ encoded: dynamic ? encodeParams(preparedParams) : concat(preparedParams.map(({ encoded }) => encoded))
1918
+ };
1919
+ }
1920
+ function getArrayComponents(type) {
1921
+ const matches = type.match(/^(.*)\[(\d+)?\]$/);
1922
+ return matches ? [matches[2] ? Number(matches[2]) : null, matches[1]] : undefined;
1923
+ }
1924
+ var init_encodeAbiParameters = __esm(() => {
1925
+ init_abi();
1926
+ init_address();
1927
+ init_base();
1928
+ init_encoding();
1929
+ init_isAddress();
1930
+ init_pad();
1931
+ init_size();
1932
+ init_slice();
1933
+ init_toHex();
1934
+ init_regex2();
1935
+ });
1936
+
1937
+ // ../../node_modules/viem/_esm/utils/hash/toFunctionSelector.js
1938
+ var toFunctionSelector = (fn) => slice(toSignatureHash(fn), 0, 4);
1939
+ var init_toFunctionSelector = __esm(() => {
1940
+ init_slice();
1941
+ init_toSignatureHash();
1942
+ });
1943
+
1944
+ // ../../node_modules/viem/_esm/utils/abi/getAbiItem.js
1945
+ function getAbiItem(parameters) {
1946
+ const { abi, args = [], name } = parameters;
1947
+ const isSelector = isHex(name, { strict: false });
1948
+ const abiItems = abi.filter((abiItem) => {
1949
+ if (isSelector) {
1950
+ if (abiItem.type === "function")
1951
+ return toFunctionSelector(abiItem) === name;
1952
+ if (abiItem.type === "event")
1953
+ return toEventSelector(abiItem) === name;
1954
+ return false;
1955
+ }
1956
+ return "name" in abiItem && abiItem.name === name;
1957
+ });
1958
+ if (abiItems.length === 0)
1959
+ return;
1960
+ if (abiItems.length === 1)
1961
+ return abiItems[0];
1962
+ let matchedAbiItem = undefined;
1963
+ for (const abiItem of abiItems) {
1964
+ if (!("inputs" in abiItem))
1965
+ continue;
1966
+ if (!args || args.length === 0) {
1967
+ if (!abiItem.inputs || abiItem.inputs.length === 0)
1968
+ return abiItem;
1969
+ continue;
1970
+ }
1971
+ if (!abiItem.inputs)
1972
+ continue;
1973
+ if (abiItem.inputs.length === 0)
1974
+ continue;
1975
+ if (abiItem.inputs.length !== args.length)
1976
+ continue;
1977
+ const matched = args.every((arg, index) => {
1978
+ const abiParameter = "inputs" in abiItem && abiItem.inputs[index];
1979
+ if (!abiParameter)
1980
+ return false;
1981
+ return isArgOfType(arg, abiParameter);
1982
+ });
1983
+ if (matched) {
1984
+ if (matchedAbiItem && "inputs" in matchedAbiItem && matchedAbiItem.inputs) {
1985
+ const ambiguousTypes = getAmbiguousTypes(abiItem.inputs, matchedAbiItem.inputs, args);
1986
+ if (ambiguousTypes)
1987
+ throw new AbiItemAmbiguityError({
1988
+ abiItem,
1989
+ type: ambiguousTypes[0]
1990
+ }, {
1991
+ abiItem: matchedAbiItem,
1992
+ type: ambiguousTypes[1]
1993
+ });
1994
+ }
1995
+ matchedAbiItem = abiItem;
1996
+ }
1997
+ }
1998
+ if (matchedAbiItem)
1999
+ return matchedAbiItem;
2000
+ return abiItems[0];
2001
+ }
2002
+ function isArgOfType(arg, abiParameter) {
2003
+ const argType = typeof arg;
2004
+ const abiParameterType = abiParameter.type;
2005
+ switch (abiParameterType) {
2006
+ case "address":
2007
+ return isAddress(arg, { strict: false });
2008
+ case "bool":
2009
+ return argType === "boolean";
2010
+ case "function":
2011
+ return argType === "string";
2012
+ case "string":
2013
+ return argType === "string";
2014
+ default: {
2015
+ if (abiParameterType === "tuple" && "components" in abiParameter)
2016
+ return Object.values(abiParameter.components).every((component, index) => {
2017
+ return isArgOfType(Object.values(arg)[index], component);
2018
+ });
2019
+ if (/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(abiParameterType))
2020
+ return argType === "number" || argType === "bigint";
2021
+ if (/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(abiParameterType))
2022
+ return argType === "string" || arg instanceof Uint8Array;
2023
+ if (/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(abiParameterType)) {
2024
+ return Array.isArray(arg) && arg.every((x) => isArgOfType(x, {
2025
+ ...abiParameter,
2026
+ type: abiParameterType.replace(/(\[[0-9]{0,}\])$/, "")
2027
+ }));
2028
+ }
2029
+ return false;
2030
+ }
2031
+ }
2032
+ }
2033
+ function getAmbiguousTypes(sourceParameters, targetParameters, args) {
2034
+ for (const parameterIndex in sourceParameters) {
2035
+ const sourceParameter = sourceParameters[parameterIndex];
2036
+ const targetParameter = targetParameters[parameterIndex];
2037
+ if (sourceParameter.type === "tuple" && targetParameter.type === "tuple" && "components" in sourceParameter && "components" in targetParameter)
2038
+ return getAmbiguousTypes(sourceParameter.components, targetParameter.components, args[parameterIndex]);
2039
+ const types = [sourceParameter.type, targetParameter.type];
2040
+ const ambiguous = (() => {
2041
+ if (types.includes("address") && types.includes("bytes20"))
2042
+ return true;
2043
+ if (types.includes("address") && types.includes("string"))
2044
+ return isAddress(args[parameterIndex], { strict: false });
2045
+ if (types.includes("address") && types.includes("bytes"))
2046
+ return isAddress(args[parameterIndex], { strict: false });
2047
+ return false;
2048
+ })();
2049
+ if (ambiguous)
2050
+ return types;
2051
+ }
2052
+ return;
2053
+ }
2054
+ var init_getAbiItem = __esm(() => {
2055
+ init_abi();
2056
+ init_isAddress();
2057
+ init_toEventSelector();
2058
+ init_toFunctionSelector();
2059
+ });
2060
+
2061
+ // ../../node_modules/viem/_esm/utils/abi/prepareEncodeFunctionData.js
2062
+ function prepareEncodeFunctionData(parameters) {
2063
+ const { abi, args, functionName } = parameters;
2064
+ let abiItem = abi[0];
2065
+ if (functionName) {
2066
+ const item = getAbiItem({
2067
+ abi,
2068
+ args,
2069
+ name: functionName
2070
+ });
2071
+ if (!item)
2072
+ throw new AbiFunctionNotFoundError(functionName, { docsPath });
2073
+ abiItem = item;
2074
+ }
2075
+ if (abiItem.type !== "function")
2076
+ throw new AbiFunctionNotFoundError(undefined, { docsPath });
2077
+ return {
2078
+ abi: [abiItem],
2079
+ functionName: toFunctionSelector(formatAbiItem2(abiItem))
2080
+ };
2081
+ }
2082
+ var docsPath = "/docs/contract/encodeFunctionData";
2083
+ var init_prepareEncodeFunctionData = __esm(() => {
2084
+ init_abi();
2085
+ init_toFunctionSelector();
2086
+ init_formatAbiItem2();
2087
+ init_getAbiItem();
2088
+ });
2089
+
2090
+ // ../../node_modules/viem/_esm/utils/abi/encodeFunctionData.js
2091
+ function encodeFunctionData(parameters) {
2092
+ const { args } = parameters;
2093
+ const { abi, functionName } = (() => {
2094
+ if (parameters.abi.length === 1 && parameters.functionName?.startsWith("0x"))
2095
+ return parameters;
2096
+ return prepareEncodeFunctionData(parameters);
2097
+ })();
2098
+ const abiItem = abi[0];
2099
+ const signature = functionName;
2100
+ const data = "inputs" in abiItem && abiItem.inputs ? encodeAbiParameters(abiItem.inputs, args ?? []) : undefined;
2101
+ return concatHex([signature, data ?? "0x"]);
2102
+ }
2103
+ var init_encodeFunctionData = __esm(() => {
2104
+ init_encodeAbiParameters();
2105
+ init_prepareEncodeFunctionData();
2106
+ });
2107
+
1
2108
  // src/constants/abis.ts
2
2109
  var vaultAbi_v0_5_0 = [{ type: "constructor", inputs: [{ name: "disable", type: "bool", internalType: "bool" }], stateMutability: "nonpayable" }, { type: "function", name: "MAX_MANAGEMENT_RATE", inputs: [], outputs: [{ name: "", type: "uint16", internalType: "uint16" }], stateMutability: "view" }, { type: "function", name: "MAX_PERFORMANCE_RATE", inputs: [], outputs: [{ name: "", type: "uint16", internalType: "uint16" }], stateMutability: "view" }, { type: "function", name: "MAX_PROTOCOL_RATE", inputs: [], outputs: [{ name: "", type: "uint16", internalType: "uint16" }], stateMutability: "view" }, { type: "function", name: "acceptOwnership", inputs: [], outputs: [], stateMutability: "nonpayable" }, { type: "function", name: "addToWhitelist", inputs: [{ name: "accounts", type: "address[]", internalType: "address[]" }], outputs: [], stateMutability: "nonpayable" }, { type: "function", name: "allowance", inputs: [{ name: "owner", type: "address", internalType: "address" }, { name: "spender", type: "address", internalType: "address" }], outputs: [{ name: "", type: "uint256", internalType: "uint256" }], stateMutability: "view" }, { type: "function", name: "approve", inputs: [{ name: "spender", type: "address", internalType: "address" }, { name: "value", type: "uint256", internalType: "uint256" }], outputs: [{ name: "", type: "bool", internalType: "bool" }], stateMutability: "nonpayable" }, { type: "function", name: "asset", inputs: [], outputs: [{ name: "", type: "address", internalType: "address" }], stateMutability: "view" }, { type: "function", name: "balanceOf", inputs: [{ name: "account", type: "address", internalType: "address" }], outputs: [{ name: "", type: "uint256", internalType: "uint256" }], stateMutability: "view" }, { type: "function", name: "cancelRequestDeposit", inputs: [], outputs: [], stateMutability: "nonpayable" }, { type: "function", name: "claimSharesAndRequestRedeem", inputs: [{ name: "sharesToRedeem", type: "uint256", internalType: "uint256" }], outputs: [{ name: "requestId", type: "uint40", internalType: "uint40" }], stateMutability: "nonpayable" }, { type: "function", name: "claimSharesOnBehalf", inputs: [{ name: "controllers", type: "address[]", internalType: "address[]" }], outputs: [], stateMutability: "nonpayable" }, { type: "function", name: "claimableDepositRequest", inputs: [{ name: "requestId", type: "uint256", internalType: "uint256" }, { name: "controller", type: "address", internalType: "address" }], outputs: [{ name: "assets", type: "uint256", internalType: "uint256" }], stateMutability: "view" }, { type: "function", name: "claimableRedeemRequest", inputs: [{ name: "requestId", type: "uint256", internalType: "uint256" }, { name: "controller", type: "address", internalType: "address" }], outputs: [{ name: "shares", type: "uint256", internalType: "uint256" }], stateMutability: "view" }, { type: "function", name: "close", inputs: [{ name: "_newTotalAssets", type: "uint256", internalType: "uint256" }], outputs: [], stateMutability: "nonpayable" }, { type: "function", name: "convertToAssets", inputs: [{ name: "shares", type: "uint256", internalType: "uint256" }], outputs: [{ name: "", type: "uint256", internalType: "uint256" }], stateMutability: "view" }, { type: "function", name: "convertToAssets", inputs: [{ name: "shares", type: "uint256", internalType: "uint256" }, { name: "requestId", type: "uint256", internalType: "uint256" }], outputs: [{ name: "", type: "uint256", internalType: "uint256" }], stateMutability: "view" }, { type: "function", name: "convertToShares", inputs: [{ name: "assets", type: "uint256", internalType: "uint256" }], outputs: [{ name: "", type: "uint256", internalType: "uint256" }], stateMutability: "view" }, { type: "function", name: "convertToShares", inputs: [{ name: "assets", type: "uint256", internalType: "uint256" }, { name: "requestId", type: "uint256", internalType: "uint256" }], outputs: [{ name: "", type: "uint256", internalType: "uint256" }], stateMutability: "view" }, { type: "function", name: "decimals", inputs: [], outputs: [{ name: "", type: "uint8", internalType: "uint8" }], stateMutability: "view" }, { type: "function", name: "deposit", inputs: [{ name: "assets", type: "uint256", internalType: "uint256" }, { name: "receiver", type: "address", internalType: "address" }, { name: "controller", type: "address", internalType: "address" }], outputs: [{ name: "", type: "uint256", internalType: "uint256" }], stateMutability: "nonpayable" }, { type: "function", name: "deposit", inputs: [{ name: "assets", type: "uint256", internalType: "uint256" }, { name: "receiver", type: "address", internalType: "address" }], outputs: [{ name: "", type: "uint256", internalType: "uint256" }], stateMutability: "nonpayable" }, { type: "function", name: "disableWhitelist", inputs: [], outputs: [], stateMutability: "nonpayable" }, { type: "function", name: "expireTotalAssets", inputs: [], outputs: [], stateMutability: "nonpayable" }, { type: "function", name: "feeRates", inputs: [], outputs: [{ name: "", type: "tuple", internalType: "struct Rates", components: [{ name: "managementRate", type: "uint16", internalType: "uint16" }, { name: "performanceRate", type: "uint16", internalType: "uint16" }] }], stateMutability: "view" }, { type: "function", name: "getRolesStorage", inputs: [], outputs: [{ name: "_rolesStorage", type: "tuple", internalType: "struct Roles.RolesStorage", components: [{ name: "whitelistManager", type: "address", internalType: "address" }, { name: "feeReceiver", type: "address", internalType: "address" }, { name: "safe", type: "address", internalType: "address" }, { name: "feeRegistry", type: "address", internalType: "contract FeeRegistry" }, { name: "valuationManager", type: "address", internalType: "address" }] }], stateMutability: "pure" }, { type: "function", name: "initialize", inputs: [{ name: "data", type: "bytes", internalType: "bytes" }, { name: "feeRegistry", type: "address", internalType: "address" }, { name: "wrappedNativeToken", type: "address", internalType: "address" }], outputs: [], stateMutability: "nonpayable" }, { type: "function", name: "initiateClosing", inputs: [], outputs: [], stateMutability: "nonpayable" }, { type: "function", name: "isOperator", inputs: [{ name: "controller", type: "address", internalType: "address" }, { name: "operator", type: "address", internalType: "address" }], outputs: [{ name: "", type: "bool", internalType: "bool" }], stateMutability: "view" }, { type: "function", name: "isTotalAssetsValid", inputs: [], outputs: [{ name: "", type: "bool", internalType: "bool" }], stateMutability: "view" }, { type: "function", name: "isWhitelisted", inputs: [{ name: "account", type: "address", internalType: "address" }], outputs: [{ name: "", type: "bool", internalType: "bool" }], stateMutability: "view" }, { type: "function", name: "maxDeposit", inputs: [{ name: "controller", type: "address", internalType: "address" }], outputs: [{ name: "", type: "uint256", internalType: "uint256" }], stateMutability: "view" }, { type: "function", name: "maxMint", inputs: [{ name: "controller", type: "address", internalType: "address" }], outputs: [{ name: "", type: "uint256", internalType: "uint256" }], stateMutability: "view" }, { type: "function", name: "maxRedeem", inputs: [{ name: "controller", type: "address", internalType: "address" }], outputs: [{ name: "", type: "uint256", internalType: "uint256" }], stateMutability: "view" }, { type: "function", name: "maxWithdraw", inputs: [{ name: "controller", type: "address", internalType: "address" }], outputs: [{ name: "", type: "uint256", internalType: "uint256" }], stateMutability: "view" }, { type: "function", name: "mint", inputs: [{ name: "shares", type: "uint256", internalType: "uint256" }, { name: "receiver", type: "address", internalType: "address" }], outputs: [{ name: "", type: "uint256", internalType: "uint256" }], stateMutability: "nonpayable" }, { type: "function", name: "mint", inputs: [{ name: "shares", type: "uint256", internalType: "uint256" }, { name: "receiver", type: "address", internalType: "address" }, { name: "controller", type: "address", internalType: "address" }], outputs: [{ name: "", type: "uint256", internalType: "uint256" }], stateMutability: "nonpayable" }, { type: "function", name: "name", inputs: [], outputs: [{ name: "", type: "string", internalType: "string" }], stateMutability: "view" }, { type: "function", name: "owner", inputs: [], outputs: [{ name: "", type: "address", internalType: "address" }], stateMutability: "view" }, { type: "function", name: "pause", inputs: [], outputs: [], stateMutability: "nonpayable" }, { type: "function", name: "paused", inputs: [], outputs: [{ name: "", type: "bool", internalType: "bool" }], stateMutability: "view" }, { type: "function", name: "pendingDepositRequest", inputs: [{ name: "requestId", type: "uint256", internalType: "uint256" }, { name: "controller", type: "address", internalType: "address" }], outputs: [{ name: "assets", type: "uint256", internalType: "uint256" }], stateMutability: "view" }, { type: "function", name: "pendingOwner", inputs: [], outputs: [{ name: "", type: "address", internalType: "address" }], stateMutability: "view" }, { type: "function", name: "pendingRedeemRequest", inputs: [{ name: "requestId", type: "uint256", internalType: "uint256" }, { name: "controller", type: "address", internalType: "address" }], outputs: [{ name: "shares", type: "uint256", internalType: "uint256" }], stateMutability: "view" }, { type: "function", name: "previewDeposit", inputs: [{ name: "", type: "uint256", internalType: "uint256" }], outputs: [{ name: "", type: "uint256", internalType: "uint256" }], stateMutability: "pure" }, { type: "function", name: "previewMint", inputs: [{ name: "", type: "uint256", internalType: "uint256" }], outputs: [{ name: "", type: "uint256", internalType: "uint256" }], stateMutability: "pure" }, { type: "function", name: "previewRedeem", inputs: [{ name: "", type: "uint256", internalType: "uint256" }], outputs: [{ name: "", type: "uint256", internalType: "uint256" }], stateMutability: "pure" }, { type: "function", name: "previewWithdraw", inputs: [{ name: "", type: "uint256", internalType: "uint256" }], outputs: [{ name: "", type: "uint256", internalType: "uint256" }], stateMutability: "pure" }, { type: "function", name: "redeem", inputs: [{ name: "shares", type: "uint256", internalType: "uint256" }, { name: "receiver", type: "address", internalType: "address" }, { name: "controller", type: "address", internalType: "address" }], outputs: [{ name: "assets", type: "uint256", internalType: "uint256" }], stateMutability: "nonpayable" }, { type: "function", name: "renounceOwnership", inputs: [], outputs: [], stateMutability: "nonpayable" }, { type: "function", name: "requestDeposit", inputs: [{ name: "assets", type: "uint256", internalType: "uint256" }, { name: "controller", type: "address", internalType: "address" }, { name: "owner", type: "address", internalType: "address" }], outputs: [{ name: "requestId", type: "uint256", internalType: "uint256" }], stateMutability: "payable" }, { type: "function", name: "requestDeposit", inputs: [{ name: "assets", type: "uint256", internalType: "uint256" }, { name: "controller", type: "address", internalType: "address" }, { name: "owner", type: "address", internalType: "address" }, { name: "referral", type: "address", internalType: "address" }], outputs: [{ name: "requestId", type: "uint256", internalType: "uint256" }], stateMutability: "payable" }, { type: "function", name: "requestRedeem", inputs: [{ name: "shares", type: "uint256", internalType: "uint256" }, { name: "controller", type: "address", internalType: "address" }, { name: "owner", type: "address", internalType: "address" }], outputs: [{ name: "requestId", type: "uint256", internalType: "uint256" }], stateMutability: "nonpayable" }, { type: "function", name: "revokeFromWhitelist", inputs: [{ name: "accounts", type: "address[]", internalType: "address[]" }], outputs: [], stateMutability: "nonpayable" }, { type: "function", name: "safe", inputs: [], outputs: [{ name: "", type: "address", internalType: "address" }], stateMutability: "view" }, { type: "function", name: "setOperator", inputs: [{ name: "operator", type: "address", internalType: "address" }, { name: "approved", type: "bool", internalType: "bool" }], outputs: [{ name: "success", type: "bool", internalType: "bool" }], stateMutability: "nonpayable" }, { type: "function", name: "settleDeposit", inputs: [{ name: "_newTotalAssets", type: "uint256", internalType: "uint256" }], outputs: [], stateMutability: "nonpayable" }, { type: "function", name: "settleRedeem", inputs: [{ name: "_newTotalAssets", type: "uint256", internalType: "uint256" }], outputs: [], stateMutability: "nonpayable" }, { type: "function", name: "share", inputs: [], outputs: [{ name: "", type: "address", internalType: "address" }], stateMutability: "view" }, { type: "function", name: "supportsInterface", inputs: [{ name: "interfaceId", type: "bytes4", internalType: "bytes4" }], outputs: [{ name: "", type: "bool", internalType: "bool" }], stateMutability: "view" }, { type: "function", name: "symbol", inputs: [], outputs: [{ name: "", type: "string", internalType: "string" }], stateMutability: "view" }, { type: "function", name: "syncDeposit", inputs: [{ name: "assets", type: "uint256", internalType: "uint256" }, { name: "receiver", type: "address", internalType: "address" }, { name: "referral", type: "address", internalType: "address" }], outputs: [{ name: "shares", type: "uint256", internalType: "uint256" }], stateMutability: "payable" }, { type: "function", name: "totalAssets", inputs: [], outputs: [{ name: "", type: "uint256", internalType: "uint256" }], stateMutability: "view" }, { type: "function", name: "totalSupply", inputs: [], outputs: [{ name: "", type: "uint256", internalType: "uint256" }], stateMutability: "view" }, { type: "function", name: "transfer", inputs: [{ name: "to", type: "address", internalType: "address" }, { name: "value", type: "uint256", internalType: "uint256" }], outputs: [{ name: "", type: "bool", internalType: "bool" }], stateMutability: "nonpayable" }, { type: "function", name: "transferFrom", inputs: [{ name: "from", type: "address", internalType: "address" }, { name: "to", type: "address", internalType: "address" }, { name: "value", type: "uint256", internalType: "uint256" }], outputs: [{ name: "", type: "bool", internalType: "bool" }], stateMutability: "nonpayable" }, { type: "function", name: "transferOwnership", inputs: [{ name: "newOwner", type: "address", internalType: "address" }], outputs: [], stateMutability: "nonpayable" }, { type: "function", name: "unpause", inputs: [], outputs: [], stateMutability: "nonpayable" }, { type: "function", name: "updateFeeReceiver", inputs: [{ name: "_feeReceiver", type: "address", internalType: "address" }], outputs: [], stateMutability: "nonpayable" }, { type: "function", name: "updateNewTotalAssets", inputs: [{ name: "_newTotalAssets", type: "uint256", internalType: "uint256" }], outputs: [], stateMutability: "nonpayable" }, { type: "function", name: "updateRates", inputs: [{ name: "newRates", type: "tuple", internalType: "struct Rates", components: [{ name: "managementRate", type: "uint16", internalType: "uint16" }, { name: "performanceRate", type: "uint16", internalType: "uint16" }] }], outputs: [], stateMutability: "nonpayable" }, { type: "function", name: "updateTotalAssetsLifespan", inputs: [{ name: "lifespan", type: "uint128", internalType: "uint128" }], outputs: [], stateMutability: "nonpayable" }, { type: "function", name: "updateValuationManager", inputs: [{ name: "_valuationManager", type: "address", internalType: "address" }], outputs: [], stateMutability: "nonpayable" }, { type: "function", name: "updateWhitelistManager", inputs: [{ name: "_whitelistManager", type: "address", internalType: "address" }], outputs: [], stateMutability: "nonpayable" }, { type: "function", name: "version", inputs: [], outputs: [{ name: "", type: "string", internalType: "string" }], stateMutability: "pure" }, { type: "function", name: "withdraw", inputs: [{ name: "assets", type: "uint256", internalType: "uint256" }, { name: "receiver", type: "address", internalType: "address" }, { name: "controller", type: "address", internalType: "address" }], outputs: [{ name: "shares", type: "uint256", internalType: "uint256" }], stateMutability: "nonpayable" }, { type: "event", name: "Approval", inputs: [{ name: "owner", type: "address", indexed: true, internalType: "address" }, { name: "spender", type: "address", indexed: true, internalType: "address" }, { name: "value", type: "uint256", indexed: false, internalType: "uint256" }], anonymous: false }, { type: "event", name: "Deposit", inputs: [{ name: "sender", type: "address", indexed: true, internalType: "address" }, { name: "owner", type: "address", indexed: true, internalType: "address" }, { name: "assets", type: "uint256", indexed: false, internalType: "uint256" }, { name: "shares", type: "uint256", indexed: false, internalType: "uint256" }], anonymous: false }, { type: "event", name: "DepositRequest", inputs: [{ name: "controller", type: "address", indexed: true, internalType: "address" }, { name: "owner", type: "address", indexed: true, internalType: "address" }, { name: "requestId", type: "uint256", indexed: true, internalType: "uint256" }, { name: "sender", type: "address", indexed: false, internalType: "address" }, { name: "assets", type: "uint256", indexed: false, internalType: "uint256" }], anonymous: false }, { type: "event", name: "DepositRequestCanceled", inputs: [{ name: "requestId", type: "uint256", indexed: true, internalType: "uint256" }, { name: "controller", type: "address", indexed: true, internalType: "address" }], anonymous: false }, { type: "event", name: "DepositSync", inputs: [{ name: "sender", type: "address", indexed: true, internalType: "address" }, { name: "owner", type: "address", indexed: true, internalType: "address" }, { name: "assets", type: "uint256", indexed: false, internalType: "uint256" }, { name: "shares", type: "uint256", indexed: false, internalType: "uint256" }], anonymous: false }, { type: "event", name: "FeeReceiverUpdated", inputs: [{ name: "oldReceiver", type: "address", indexed: false, internalType: "address" }, { name: "newReceiver", type: "address", indexed: false, internalType: "address" }], anonymous: false }, { type: "event", name: "HighWaterMarkUpdated", inputs: [{ name: "oldHighWaterMark", type: "uint256", indexed: false, internalType: "uint256" }, { name: "newHighWaterMark", type: "uint256", indexed: false, internalType: "uint256" }], anonymous: false }, { type: "event", name: "Initialized", inputs: [{ name: "version", type: "uint64", indexed: false, internalType: "uint64" }], anonymous: false }, { type: "event", name: "NewTotalAssetsUpdated", inputs: [{ name: "totalAssets", type: "uint256", indexed: false, internalType: "uint256" }], anonymous: false }, { type: "event", name: "OperatorSet", inputs: [{ name: "controller", type: "address", indexed: true, internalType: "address" }, { name: "operator", type: "address", indexed: true, internalType: "address" }, { name: "approved", type: "bool", indexed: false, internalType: "bool" }], anonymous: false }, { type: "event", name: "OwnershipTransferStarted", inputs: [{ name: "previousOwner", type: "address", indexed: true, internalType: "address" }, { name: "newOwner", type: "address", indexed: true, internalType: "address" }], anonymous: false }, { type: "event", name: "OwnershipTransferred", inputs: [{ name: "previousOwner", type: "address", indexed: true, internalType: "address" }, { name: "newOwner", type: "address", indexed: true, internalType: "address" }], anonymous: false }, { type: "event", name: "Paused", inputs: [{ name: "account", type: "address", indexed: false, internalType: "address" }], anonymous: false }, { type: "event", name: "RatesUpdated", inputs: [{ name: "oldRates", type: "tuple", indexed: false, internalType: "struct Rates", components: [{ name: "managementRate", type: "uint16", internalType: "uint16" }, { name: "performanceRate", type: "uint16", internalType: "uint16" }] }, { name: "newRate", type: "tuple", indexed: false, internalType: "struct Rates", components: [{ name: "managementRate", type: "uint16", internalType: "uint16" }, { name: "performanceRate", type: "uint16", internalType: "uint16" }] }, { name: "timestamp", type: "uint256", indexed: false, internalType: "uint256" }], anonymous: false }, { type: "event", name: "RedeemRequest", inputs: [{ name: "controller", type: "address", indexed: true, internalType: "address" }, { name: "owner", type: "address", indexed: true, internalType: "address" }, { name: "requestId", type: "uint256", indexed: true, internalType: "uint256" }, { name: "sender", type: "address", indexed: false, internalType: "address" }, { name: "shares", type: "uint256", indexed: false, internalType: "uint256" }], anonymous: false }, { type: "event", name: "Referral", inputs: [{ name: "referral", type: "address", indexed: true, internalType: "address" }, { name: "owner", type: "address", indexed: true, internalType: "address" }, { name: "requestId", type: "uint256", indexed: true, internalType: "uint256" }, { name: "assets", type: "uint256", indexed: false, internalType: "uint256" }], anonymous: false }, { type: "event", name: "SettleDeposit", inputs: [{ name: "epochId", type: "uint40", indexed: true, internalType: "uint40" }, { name: "settledId", type: "uint40", indexed: true, internalType: "uint40" }, { name: "totalAssets", type: "uint256", indexed: false, internalType: "uint256" }, { name: "totalSupply", type: "uint256", indexed: false, internalType: "uint256" }, { name: "assetsDeposited", type: "uint256", indexed: false, internalType: "uint256" }, { name: "sharesMinted", type: "uint256", indexed: false, internalType: "uint256" }], anonymous: false }, { type: "event", name: "SettleRedeem", inputs: [{ name: "epochId", type: "uint40", indexed: true, internalType: "uint40" }, { name: "settledId", type: "uint40", indexed: true, internalType: "uint40" }, { name: "totalAssets", type: "uint256", indexed: false, internalType: "uint256" }, { name: "totalSupply", type: "uint256", indexed: false, internalType: "uint256" }, { name: "assetsWithdrawed", type: "uint256", indexed: false, internalType: "uint256" }, { name: "sharesBurned", type: "uint256", indexed: false, internalType: "uint256" }], anonymous: false }, { type: "event", name: "StateUpdated", inputs: [{ name: "state", type: "uint8", indexed: false, internalType: "enum State" }], anonymous: false }, { type: "event", name: "TotalAssetsLifespanUpdated", inputs: [{ name: "oldLifespan", type: "uint128", indexed: false, internalType: "uint128" }, { name: "newLifespan", type: "uint128", indexed: false, internalType: "uint128" }], anonymous: false }, { type: "event", name: "TotalAssetsUpdated", inputs: [{ name: "totalAssets", type: "uint256", indexed: false, internalType: "uint256" }], anonymous: false }, { type: "event", name: "Transfer", inputs: [{ name: "from", type: "address", indexed: true, internalType: "address" }, { name: "to", type: "address", indexed: true, internalType: "address" }, { name: "value", type: "uint256", indexed: false, internalType: "uint256" }], anonymous: false }, { type: "event", name: "Unpaused", inputs: [{ name: "account", type: "address", indexed: false, internalType: "address" }], anonymous: false }, { type: "event", name: "ValuationManagerUpdated", inputs: [{ name: "oldManager", type: "address", indexed: false, internalType: "address" }, { name: "newManager", type: "address", indexed: false, internalType: "address" }], anonymous: false }, { type: "event", name: "WhitelistDisabled", inputs: [], anonymous: false }, { type: "event", name: "WhitelistManagerUpdated", inputs: [{ name: "oldManager", type: "address", indexed: false, internalType: "address" }, { name: "newManager", type: "address", indexed: false, internalType: "address" }], anonymous: false }, { type: "event", name: "WhitelistUpdated", inputs: [{ name: "account", type: "address", indexed: true, internalType: "address" }, { name: "authorized", type: "bool", indexed: false, internalType: "bool" }], anonymous: false }, { type: "event", name: "Withdraw", inputs: [{ name: "sender", type: "address", indexed: true, internalType: "address" }, { name: "receiver", type: "address", indexed: true, internalType: "address" }, { name: "owner", type: "address", indexed: true, internalType: "address" }, { name: "assets", type: "uint256", indexed: false, internalType: "uint256" }, { name: "shares", type: "uint256", indexed: false, internalType: "uint256" }], anonymous: false }, { type: "error", name: "AboveMaxRate", inputs: [{ name: "maxRate", type: "uint256", internalType: "uint256" }] }, { type: "error", name: "AddressEmptyCode", inputs: [{ name: "target", type: "address", internalType: "address" }] }, { type: "error", name: "AddressInsufficientBalance", inputs: [{ name: "account", type: "address", internalType: "address" }] }, { type: "error", name: "CantDepositNativeToken", inputs: [] }, { type: "error", name: "Closed", inputs: [] }, { type: "error", name: "ERC20InsufficientAllowance", inputs: [{ name: "spender", type: "address", internalType: "address" }, { name: "allowance", type: "uint256", internalType: "uint256" }, { name: "needed", type: "uint256", internalType: "uint256" }] }, { type: "error", name: "ERC20InsufficientBalance", inputs: [{ name: "sender", type: "address", internalType: "address" }, { name: "balance", type: "uint256", internalType: "uint256" }, { name: "needed", type: "uint256", internalType: "uint256" }] }, { type: "error", name: "ERC20InvalidApprover", inputs: [{ name: "approver", type: "address", internalType: "address" }] }, { type: "error", name: "ERC20InvalidReceiver", inputs: [{ name: "receiver", type: "address", internalType: "address" }] }, { type: "error", name: "ERC20InvalidSender", inputs: [{ name: "sender", type: "address", internalType: "address" }] }, { type: "error", name: "ERC20InvalidSpender", inputs: [{ name: "spender", type: "address", internalType: "address" }] }, { type: "error", name: "ERC4626ExceededMaxDeposit", inputs: [{ name: "receiver", type: "address", internalType: "address" }, { name: "assets", type: "uint256", internalType: "uint256" }, { name: "max", type: "uint256", internalType: "uint256" }] }, { type: "error", name: "ERC4626ExceededMaxMint", inputs: [{ name: "receiver", type: "address", internalType: "address" }, { name: "shares", type: "uint256", internalType: "uint256" }, { name: "max", type: "uint256", internalType: "uint256" }] }, { type: "error", name: "ERC4626ExceededMaxRedeem", inputs: [{ name: "owner", type: "address", internalType: "address" }, { name: "shares", type: "uint256", internalType: "uint256" }, { name: "max", type: "uint256", internalType: "uint256" }] }, { type: "error", name: "ERC4626ExceededMaxWithdraw", inputs: [{ name: "owner", type: "address", internalType: "address" }, { name: "assets", type: "uint256", internalType: "uint256" }, { name: "max", type: "uint256", internalType: "uint256" }] }, { type: "error", name: "ERC7540InvalidOperator", inputs: [] }, { type: "error", name: "ERC7540PreviewDepositDisabled", inputs: [] }, { type: "error", name: "ERC7540PreviewMintDisabled", inputs: [] }, { type: "error", name: "ERC7540PreviewRedeemDisabled", inputs: [] }, { type: "error", name: "ERC7540PreviewWithdrawDisabled", inputs: [] }, { type: "error", name: "EnforcedPause", inputs: [] }, { type: "error", name: "ExpectedPause", inputs: [] }, { type: "error", name: "FailedInnerCall", inputs: [] }, { type: "error", name: "InvalidInitialization", inputs: [] }, { type: "error", name: "MathOverflowedMulDiv", inputs: [] }, { type: "error", name: "NewTotalAssetsMissing", inputs: [] }, { type: "error", name: "NotClosing", inputs: [{ name: "currentState", type: "uint8", internalType: "enum State" }] }, { type: "error", name: "NotInitializing", inputs: [] }, { type: "error", name: "NotOpen", inputs: [{ name: "currentState", type: "uint8", internalType: "enum State" }] }, { type: "error", name: "NotWhitelisted", inputs: [] }, { type: "error", name: "OnlyAsyncDepositAllowed", inputs: [] }, { type: "error", name: "OnlyOneRequestAllowed", inputs: [] }, { type: "error", name: "OnlySafe", inputs: [{ name: "safe", type: "address", internalType: "address" }] }, { type: "error", name: "OnlySyncDepositAllowed", inputs: [] }, { type: "error", name: "OnlyValuationManager", inputs: [{ name: "valuationManager", type: "address", internalType: "address" }] }, { type: "error", name: "OnlyWhitelistManager", inputs: [{ name: "whitelistManager", type: "address", internalType: "address" }] }, { type: "error", name: "OwnableInvalidOwner", inputs: [{ name: "owner", type: "address", internalType: "address" }] }, { type: "error", name: "OwnableUnauthorizedAccount", inputs: [{ name: "account", type: "address", internalType: "address" }] }, { type: "error", name: "RequestIdNotClaimable", inputs: [] }, { type: "error", name: "RequestNotCancelable", inputs: [{ name: "requestId", type: "uint256", internalType: "uint256" }] }, { type: "error", name: "SafeERC20FailedOperation", inputs: [{ name: "token", type: "address", internalType: "address" }] }, { type: "error", name: "ValuationUpdateNotAllowed", inputs: [] }, { type: "error", name: "WrongNewTotalAssets", inputs: [] }];
3
2110
  var vaultAbi_v0_4_0 = [{ type: "constructor", inputs: [{ name: "disable", type: "bool", internalType: "bool" }], stateMutability: "nonpayable" }, { type: "function", name: "MAX_MANAGEMENT_RATE", inputs: [], outputs: [{ name: "", type: "uint16", internalType: "uint16" }], stateMutability: "view" }, { type: "function", name: "MAX_PERFORMANCE_RATE", inputs: [], outputs: [{ name: "", type: "uint16", internalType: "uint16" }], stateMutability: "view" }, { type: "function", name: "MAX_PROTOCOL_RATE", inputs: [], outputs: [{ name: "", type: "uint16", internalType: "uint16" }], stateMutability: "view" }, { type: "function", name: "acceptOwnership", inputs: [], outputs: [], stateMutability: "nonpayable" }, { type: "function", name: "addToWhitelist", inputs: [{ name: "accounts", type: "address[]", internalType: "address[]" }], outputs: [], stateMutability: "nonpayable" }, { type: "function", name: "allowance", inputs: [{ name: "owner", type: "address", internalType: "address" }, { name: "spender", type: "address", internalType: "address" }], outputs: [{ name: "", type: "uint256", internalType: "uint256" }], stateMutability: "view" }, { type: "function", name: "approve", inputs: [{ name: "spender", type: "address", internalType: "address" }, { name: "value", type: "uint256", internalType: "uint256" }], outputs: [{ name: "", type: "bool", internalType: "bool" }], stateMutability: "nonpayable" }, { type: "function", name: "asset", inputs: [], outputs: [{ name: "", type: "address", internalType: "address" }], stateMutability: "view" }, { type: "function", name: "balanceOf", inputs: [{ name: "account", type: "address", internalType: "address" }], outputs: [{ name: "", type: "uint256", internalType: "uint256" }], stateMutability: "view" }, { type: "function", name: "cancelRequestDeposit", inputs: [], outputs: [], stateMutability: "nonpayable" }, { type: "function", name: "claimSharesAndRequestRedeem", inputs: [{ name: "sharesToRedeem", type: "uint256", internalType: "uint256" }], outputs: [{ name: "requestId", type: "uint40", internalType: "uint40" }], stateMutability: "nonpayable" }, { type: "function", name: "claimSharesOnBehalf", inputs: [{ name: "controllers", type: "address[]", internalType: "address[]" }], outputs: [], stateMutability: "nonpayable" }, { type: "function", name: "claimableDepositRequest", inputs: [{ name: "requestId", type: "uint256", internalType: "uint256" }, { name: "controller", type: "address", internalType: "address" }], outputs: [{ name: "assets", type: "uint256", internalType: "uint256" }], stateMutability: "view" }, { type: "function", name: "claimableRedeemRequest", inputs: [{ name: "requestId", type: "uint256", internalType: "uint256" }, { name: "controller", type: "address", internalType: "address" }], outputs: [{ name: "shares", type: "uint256", internalType: "uint256" }], stateMutability: "view" }, { type: "function", name: "close", inputs: [{ name: "_newTotalAssets", type: "uint256", internalType: "uint256" }], outputs: [], stateMutability: "nonpayable" }, { type: "function", name: "convertToAssets", inputs: [{ name: "shares", type: "uint256", internalType: "uint256" }], outputs: [{ name: "", type: "uint256", internalType: "uint256" }], stateMutability: "view" }, { type: "function", name: "convertToAssets", inputs: [{ name: "shares", type: "uint256", internalType: "uint256" }, { name: "requestId", type: "uint256", internalType: "uint256" }], outputs: [{ name: "", type: "uint256", internalType: "uint256" }], stateMutability: "view" }, { type: "function", name: "convertToShares", inputs: [{ name: "assets", type: "uint256", internalType: "uint256" }], outputs: [{ name: "", type: "uint256", internalType: "uint256" }], stateMutability: "view" }, { type: "function", name: "convertToShares", inputs: [{ name: "assets", type: "uint256", internalType: "uint256" }, { name: "requestId", type: "uint256", internalType: "uint256" }], outputs: [{ name: "", type: "uint256", internalType: "uint256" }], stateMutability: "view" }, { type: "function", name: "decimals", inputs: [], outputs: [{ name: "", type: "uint8", internalType: "uint8" }], stateMutability: "view" }, { type: "function", name: "deposit", inputs: [{ name: "assets", type: "uint256", internalType: "uint256" }, { name: "receiver", type: "address", internalType: "address" }, { name: "controller", type: "address", internalType: "address" }], outputs: [{ name: "", type: "uint256", internalType: "uint256" }], stateMutability: "nonpayable" }, { type: "function", name: "deposit", inputs: [{ name: "assets", type: "uint256", internalType: "uint256" }, { name: "receiver", type: "address", internalType: "address" }], outputs: [{ name: "", type: "uint256", internalType: "uint256" }], stateMutability: "nonpayable" }, { type: "function", name: "disableWhitelist", inputs: [], outputs: [], stateMutability: "nonpayable" }, { type: "function", name: "feeRates", inputs: [], outputs: [{ name: "", type: "tuple", internalType: "struct Rates", components: [{ name: "managementRate", type: "uint16", internalType: "uint16" }, { name: "performanceRate", type: "uint16", internalType: "uint16" }] }], stateMutability: "view" }, { type: "function", name: "getRolesStorage", inputs: [], outputs: [{ name: "_rolesStorage", type: "tuple", internalType: "struct Roles.RolesStorage", components: [{ name: "whitelistManager", type: "address", internalType: "address" }, { name: "feeReceiver", type: "address", internalType: "address" }, { name: "safe", type: "address", internalType: "address" }, { name: "feeRegistry", type: "address", internalType: "contract FeeRegistry" }, { name: "valuationManager", type: "address", internalType: "address" }] }], stateMutability: "pure" }, { type: "function", name: "highWaterMark", inputs: [], outputs: [{ name: "", type: "uint256", internalType: "uint256" }], stateMutability: "view" }, { type: "function", name: "initialize", inputs: [{ name: "data", type: "bytes", internalType: "bytes" }, { name: "feeRegistry", type: "address", internalType: "address" }, { name: "wrappedNativeToken", type: "address", internalType: "address" }], outputs: [], stateMutability: "nonpayable" }, { type: "function", name: "initiateClosing", inputs: [], outputs: [], stateMutability: "nonpayable" }, { type: "function", name: "isOperator", inputs: [{ name: "controller", type: "address", internalType: "address" }, { name: "operator", type: "address", internalType: "address" }], outputs: [{ name: "", type: "bool", internalType: "bool" }], stateMutability: "view" }, { type: "function", name: "isWhitelistActivated", inputs: [], outputs: [{ name: "", type: "bool", internalType: "bool" }], stateMutability: "view" }, { type: "function", name: "isWhitelisted", inputs: [{ name: "account", type: "address", internalType: "address" }], outputs: [{ name: "", type: "bool", internalType: "bool" }], stateMutability: "view" }, { type: "function", name: "lastDepositRequestId", inputs: [{ name: "controller", type: "address", internalType: "address" }], outputs: [{ name: "", type: "uint40", internalType: "uint40" }], stateMutability: "view" }, { type: "function", name: "lastFeeTime", inputs: [], outputs: [{ name: "", type: "uint256", internalType: "uint256" }], stateMutability: "view" }, { type: "function", name: "lastRedeemRequestId", inputs: [{ name: "controller", type: "address", internalType: "address" }], outputs: [{ name: "", type: "uint40", internalType: "uint40" }], stateMutability: "view" }, { type: "function", name: "maxDeposit", inputs: [{ name: "controller", type: "address", internalType: "address" }], outputs: [{ name: "", type: "uint256", internalType: "uint256" }], stateMutability: "view" }, { type: "function", name: "maxMint", inputs: [{ name: "controller", type: "address", internalType: "address" }], outputs: [{ name: "", type: "uint256", internalType: "uint256" }], stateMutability: "view" }, { type: "function", name: "maxRedeem", inputs: [{ name: "controller", type: "address", internalType: "address" }], outputs: [{ name: "", type: "uint256", internalType: "uint256" }], stateMutability: "view" }, { type: "function", name: "maxWithdraw", inputs: [{ name: "controller", type: "address", internalType: "address" }], outputs: [{ name: "", type: "uint256", internalType: "uint256" }], stateMutability: "view" }, { type: "function", name: "mint", inputs: [{ name: "shares", type: "uint256", internalType: "uint256" }, { name: "receiver", type: "address", internalType: "address" }], outputs: [{ name: "", type: "uint256", internalType: "uint256" }], stateMutability: "nonpayable" }, { type: "function", name: "mint", inputs: [{ name: "shares", type: "uint256", internalType: "uint256" }, { name: "receiver", type: "address", internalType: "address" }, { name: "controller", type: "address", internalType: "address" }], outputs: [{ name: "", type: "uint256", internalType: "uint256" }], stateMutability: "nonpayable" }, { type: "function", name: "name", inputs: [], outputs: [{ name: "", type: "string", internalType: "string" }], stateMutability: "view" }, { type: "function", name: "owner", inputs: [], outputs: [{ name: "", type: "address", internalType: "address" }], stateMutability: "view" }, { type: "function", name: "pause", inputs: [], outputs: [], stateMutability: "nonpayable" }, { type: "function", name: "paused", inputs: [], outputs: [{ name: "", type: "bool", internalType: "bool" }], stateMutability: "view" }, { type: "function", name: "pendingDepositRequest", inputs: [{ name: "requestId", type: "uint256", internalType: "uint256" }, { name: "controller", type: "address", internalType: "address" }], outputs: [{ name: "assets", type: "uint256", internalType: "uint256" }], stateMutability: "view" }, { type: "function", name: "pendingOwner", inputs: [], outputs: [{ name: "", type: "address", internalType: "address" }], stateMutability: "view" }, { type: "function", name: "pendingRedeemRequest", inputs: [{ name: "requestId", type: "uint256", internalType: "uint256" }, { name: "controller", type: "address", internalType: "address" }], outputs: [{ name: "shares", type: "uint256", internalType: "uint256" }], stateMutability: "view" }, { type: "function", name: "pendingSilo", inputs: [], outputs: [{ name: "", type: "address", internalType: "address" }], stateMutability: "view" }, { type: "function", name: "previewDeposit", inputs: [{ name: "", type: "uint256", internalType: "uint256" }], outputs: [{ name: "", type: "uint256", internalType: "uint256" }], stateMutability: "pure" }, { type: "function", name: "previewMint", inputs: [{ name: "", type: "uint256", internalType: "uint256" }], outputs: [{ name: "", type: "uint256", internalType: "uint256" }], stateMutability: "pure" }, { type: "function", name: "previewRedeem", inputs: [{ name: "", type: "uint256", internalType: "uint256" }], outputs: [{ name: "", type: "uint256", internalType: "uint256" }], stateMutability: "pure" }, { type: "function", name: "previewWithdraw", inputs: [{ name: "", type: "uint256", internalType: "uint256" }], outputs: [{ name: "", type: "uint256", internalType: "uint256" }], stateMutability: "pure" }, { type: "function", name: "redeem", inputs: [{ name: "shares", type: "uint256", internalType: "uint256" }, { name: "receiver", type: "address", internalType: "address" }, { name: "controller", type: "address", internalType: "address" }], outputs: [{ name: "assets", type: "uint256", internalType: "uint256" }], stateMutability: "nonpayable" }, { type: "function", name: "renounceOwnership", inputs: [], outputs: [], stateMutability: "nonpayable" }, { type: "function", name: "requestDeposit", inputs: [{ name: "assets", type: "uint256", internalType: "uint256" }, { name: "controller", type: "address", internalType: "address" }, { name: "owner", type: "address", internalType: "address" }], outputs: [{ name: "requestId", type: "uint256", internalType: "uint256" }], stateMutability: "payable" }, { type: "function", name: "requestDeposit", inputs: [{ name: "assets", type: "uint256", internalType: "uint256" }, { name: "controller", type: "address", internalType: "address" }, { name: "owner", type: "address", internalType: "address" }, { name: "referral", type: "address", internalType: "address" }], outputs: [{ name: "requestId", type: "uint256", internalType: "uint256" }], stateMutability: "payable" }, { type: "function", name: "requestRedeem", inputs: [{ name: "shares", type: "uint256", internalType: "uint256" }, { name: "controller", type: "address", internalType: "address" }, { name: "owner", type: "address", internalType: "address" }], outputs: [{ name: "requestId", type: "uint256", internalType: "uint256" }], stateMutability: "nonpayable" }, { type: "function", name: "revokeFromWhitelist", inputs: [{ name: "accounts", type: "address[]", internalType: "address[]" }], outputs: [], stateMutability: "nonpayable" }, { type: "function", name: "setOperator", inputs: [{ name: "operator", type: "address", internalType: "address" }, { name: "approved", type: "bool", internalType: "bool" }], outputs: [{ name: "success", type: "bool", internalType: "bool" }], stateMutability: "nonpayable" }, { type: "function", name: "settleDeposit", inputs: [{ name: "_newTotalAssets", type: "uint256", internalType: "uint256" }], outputs: [], stateMutability: "nonpayable" }, { type: "function", name: "settleRedeem", inputs: [{ name: "_newTotalAssets", type: "uint256", internalType: "uint256" }], outputs: [], stateMutability: "nonpayable" }, { type: "function", name: "share", inputs: [], outputs: [{ name: "", type: "address", internalType: "address" }], stateMutability: "view" }, { type: "function", name: "supportsInterface", inputs: [{ name: "interfaceId", type: "bytes4", internalType: "bytes4" }], outputs: [{ name: "", type: "bool", internalType: "bool" }], stateMutability: "view" }, { type: "function", name: "symbol", inputs: [], outputs: [{ name: "", type: "string", internalType: "string" }], stateMutability: "view" }, { type: "function", name: "totalAssets", inputs: [], outputs: [{ name: "", type: "uint256", internalType: "uint256" }], stateMutability: "view" }, { type: "function", name: "totalSupply", inputs: [], outputs: [{ name: "", type: "uint256", internalType: "uint256" }], stateMutability: "view" }, { type: "function", name: "transfer", inputs: [{ name: "to", type: "address", internalType: "address" }, { name: "value", type: "uint256", internalType: "uint256" }], outputs: [{ name: "", type: "bool", internalType: "bool" }], stateMutability: "nonpayable" }, { type: "function", name: "transferFrom", inputs: [{ name: "from", type: "address", internalType: "address" }, { name: "to", type: "address", internalType: "address" }, { name: "value", type: "uint256", internalType: "uint256" }], outputs: [{ name: "", type: "bool", internalType: "bool" }], stateMutability: "nonpayable" }, { type: "function", name: "transferOwnership", inputs: [{ name: "newOwner", type: "address", internalType: "address" }], outputs: [], stateMutability: "nonpayable" }, { type: "function", name: "unpause", inputs: [], outputs: [], stateMutability: "nonpayable" }, { type: "function", name: "updateFeeReceiver", inputs: [{ name: "_feeReceiver", type: "address", internalType: "address" }], outputs: [], stateMutability: "nonpayable" }, { type: "function", name: "updateNewTotalAssets", inputs: [{ name: "_newTotalAssets", type: "uint256", internalType: "uint256" }], outputs: [], stateMutability: "nonpayable" }, { type: "function", name: "updateRates", inputs: [{ name: "newRates", type: "tuple", internalType: "struct Rates", components: [{ name: "managementRate", type: "uint16", internalType: "uint16" }, { name: "performanceRate", type: "uint16", internalType: "uint16" }] }], outputs: [], stateMutability: "nonpayable" }, { type: "function", name: "updateValuationManager", inputs: [{ name: "_valuationManager", type: "address", internalType: "address" }], outputs: [], stateMutability: "nonpayable" }, { type: "function", name: "updateWhitelistManager", inputs: [{ name: "_whitelistManager", type: "address", internalType: "address" }], outputs: [], stateMutability: "nonpayable" }, { type: "function", name: "version", inputs: [], outputs: [{ name: "", type: "string", internalType: "string" }], stateMutability: "pure" }, { type: "function", name: "withdraw", inputs: [{ name: "assets", type: "uint256", internalType: "uint256" }, { name: "receiver", type: "address", internalType: "address" }, { name: "controller", type: "address", internalType: "address" }], outputs: [{ name: "shares", type: "uint256", internalType: "uint256" }], stateMutability: "nonpayable" }, { type: "event", name: "Approval", inputs: [{ name: "owner", type: "address", indexed: true, internalType: "address" }, { name: "spender", type: "address", indexed: true, internalType: "address" }, { name: "value", type: "uint256", indexed: false, internalType: "uint256" }], anonymous: false }, { type: "event", name: "Deposit", inputs: [{ name: "sender", type: "address", indexed: true, internalType: "address" }, { name: "owner", type: "address", indexed: true, internalType: "address" }, { name: "assets", type: "uint256", indexed: false, internalType: "uint256" }, { name: "shares", type: "uint256", indexed: false, internalType: "uint256" }], anonymous: false }, { type: "event", name: "DepositRequest", inputs: [{ name: "controller", type: "address", indexed: true, internalType: "address" }, { name: "owner", type: "address", indexed: true, internalType: "address" }, { name: "requestId", type: "uint256", indexed: true, internalType: "uint256" }, { name: "sender", type: "address", indexed: false, internalType: "address" }, { name: "assets", type: "uint256", indexed: false, internalType: "uint256" }], anonymous: false }, { type: "event", name: "DepositRequestCanceled", inputs: [{ name: "requestId", type: "uint256", indexed: true, internalType: "uint256" }, { name: "controller", type: "address", indexed: true, internalType: "address" }], anonymous: false }, { type: "event", name: "FeeReceiverUpdated", inputs: [{ name: "oldReceiver", type: "address", indexed: false, internalType: "address" }, { name: "newReceiver", type: "address", indexed: false, internalType: "address" }], anonymous: false }, { type: "event", name: "HighWaterMarkUpdated", inputs: [{ name: "oldHighWaterMark", type: "uint256", indexed: false, internalType: "uint256" }, { name: "newHighWaterMark", type: "uint256", indexed: false, internalType: "uint256" }], anonymous: false }, { type: "event", name: "Initialized", inputs: [{ name: "version", type: "uint64", indexed: false, internalType: "uint64" }], anonymous: false }, { type: "event", name: "NewTotalAssetsUpdated", inputs: [{ name: "totalAssets", type: "uint256", indexed: false, internalType: "uint256" }], anonymous: false }, { type: "event", name: "OperatorSet", inputs: [{ name: "controller", type: "address", indexed: true, internalType: "address" }, { name: "operator", type: "address", indexed: true, internalType: "address" }, { name: "approved", type: "bool", indexed: false, internalType: "bool" }], anonymous: false }, { type: "event", name: "OwnershipTransferStarted", inputs: [{ name: "previousOwner", type: "address", indexed: true, internalType: "address" }, { name: "newOwner", type: "address", indexed: true, internalType: "address" }], anonymous: false }, { type: "event", name: "OwnershipTransferred", inputs: [{ name: "previousOwner", type: "address", indexed: true, internalType: "address" }, { name: "newOwner", type: "address", indexed: true, internalType: "address" }], anonymous: false }, { type: "event", name: "Paused", inputs: [{ name: "account", type: "address", indexed: false, internalType: "address" }], anonymous: false }, { type: "event", name: "RatesUpdated", inputs: [{ name: "oldRates", type: "tuple", indexed: false, internalType: "struct Rates", components: [{ name: "managementRate", type: "uint16", internalType: "uint16" }, { name: "performanceRate", type: "uint16", internalType: "uint16" }] }, { name: "newRate", type: "tuple", indexed: false, internalType: "struct Rates", components: [{ name: "managementRate", type: "uint16", internalType: "uint16" }, { name: "performanceRate", type: "uint16", internalType: "uint16" }] }, { name: "timestamp", type: "uint256", indexed: false, internalType: "uint256" }], anonymous: false }, { type: "event", name: "RedeemRequest", inputs: [{ name: "controller", type: "address", indexed: true, internalType: "address" }, { name: "owner", type: "address", indexed: true, internalType: "address" }, { name: "requestId", type: "uint256", indexed: true, internalType: "uint256" }, { name: "sender", type: "address", indexed: false, internalType: "address" }, { name: "shares", type: "uint256", indexed: false, internalType: "uint256" }], anonymous: false }, { type: "event", name: "Referral", inputs: [{ name: "referral", type: "address", indexed: true, internalType: "address" }, { name: "owner", type: "address", indexed: true, internalType: "address" }, { name: "requestId", type: "uint256", indexed: true, internalType: "uint256" }, { name: "assets", type: "uint256", indexed: false, internalType: "uint256" }], anonymous: false }, { type: "event", name: "SettleDeposit", inputs: [{ name: "epochId", type: "uint40", indexed: true, internalType: "uint40" }, { name: "settledId", type: "uint40", indexed: true, internalType: "uint40" }, { name: "totalAssets", type: "uint256", indexed: false, internalType: "uint256" }, { name: "totalSupply", type: "uint256", indexed: false, internalType: "uint256" }, { name: "assetsDeposited", type: "uint256", indexed: false, internalType: "uint256" }, { name: "sharesMinted", type: "uint256", indexed: false, internalType: "uint256" }], anonymous: false }, { type: "event", name: "SettleRedeem", inputs: [{ name: "epochId", type: "uint40", indexed: true, internalType: "uint40" }, { name: "settledId", type: "uint40", indexed: true, internalType: "uint40" }, { name: "totalAssets", type: "uint256", indexed: false, internalType: "uint256" }, { name: "totalSupply", type: "uint256", indexed: false, internalType: "uint256" }, { name: "assetsWithdrawed", type: "uint256", indexed: false, internalType: "uint256" }, { name: "sharesBurned", type: "uint256", indexed: false, internalType: "uint256" }], anonymous: false }, { type: "event", name: "StateUpdated", inputs: [{ name: "state", type: "uint8", indexed: false, internalType: "enum State" }], anonymous: false }, { type: "event", name: "TotalAssetsUpdated", inputs: [{ name: "totalAssets", type: "uint256", indexed: false, internalType: "uint256" }], anonymous: false }, { type: "event", name: "Transfer", inputs: [{ name: "from", type: "address", indexed: true, internalType: "address" }, { name: "to", type: "address", indexed: true, internalType: "address" }, { name: "value", type: "uint256", indexed: false, internalType: "uint256" }], anonymous: false }, { type: "event", name: "Unpaused", inputs: [{ name: "account", type: "address", indexed: false, internalType: "address" }], anonymous: false }, { type: "event", name: "ValuationManagerUpdated", inputs: [{ name: "oldManager", type: "address", indexed: false, internalType: "address" }, { name: "newManager", type: "address", indexed: false, internalType: "address" }], anonymous: false }, { type: "event", name: "WhitelistDisabled", inputs: [], anonymous: false }, { type: "event", name: "WhitelistManagerUpdated", inputs: [{ name: "oldManager", type: "address", indexed: false, internalType: "address" }, { name: "newManager", type: "address", indexed: false, internalType: "address" }], anonymous: false }, { type: "event", name: "WhitelistUpdated", inputs: [{ name: "account", type: "address", indexed: true, internalType: "address" }, { name: "authorized", type: "bool", indexed: false, internalType: "bool" }], anonymous: false }, { type: "event", name: "Withdraw", inputs: [{ name: "sender", type: "address", indexed: true, internalType: "address" }, { name: "receiver", type: "address", indexed: true, internalType: "address" }, { name: "owner", type: "address", indexed: true, internalType: "address" }, { name: "assets", type: "uint256", indexed: false, internalType: "uint256" }, { name: "shares", type: "uint256", indexed: false, internalType: "uint256" }], anonymous: false }, { type: "error", name: "AboveMaxRate", inputs: [{ name: "maxRate", type: "uint256", internalType: "uint256" }] }, { type: "error", name: "AddressEmptyCode", inputs: [{ name: "target", type: "address", internalType: "address" }] }, { type: "error", name: "AddressInsufficientBalance", inputs: [{ name: "account", type: "address", internalType: "address" }] }, { type: "error", name: "CantDepositNativeToken", inputs: [] }, { type: "error", name: "Closed", inputs: [] }, { type: "error", name: "ERC20InsufficientAllowance", inputs: [{ name: "spender", type: "address", internalType: "address" }, { name: "allowance", type: "uint256", internalType: "uint256" }, { name: "needed", type: "uint256", internalType: "uint256" }] }, { type: "error", name: "ERC20InsufficientBalance", inputs: [{ name: "sender", type: "address", internalType: "address" }, { name: "balance", type: "uint256", internalType: "uint256" }, { name: "needed", type: "uint256", internalType: "uint256" }] }, { type: "error", name: "ERC20InvalidApprover", inputs: [{ name: "approver", type: "address", internalType: "address" }] }, { type: "error", name: "ERC20InvalidReceiver", inputs: [{ name: "receiver", type: "address", internalType: "address" }] }, { type: "error", name: "ERC20InvalidSender", inputs: [{ name: "sender", type: "address", internalType: "address" }] }, { type: "error", name: "ERC20InvalidSpender", inputs: [{ name: "spender", type: "address", internalType: "address" }] }, { type: "error", name: "ERC4626ExceededMaxDeposit", inputs: [{ name: "receiver", type: "address", internalType: "address" }, { name: "assets", type: "uint256", internalType: "uint256" }, { name: "max", type: "uint256", internalType: "uint256" }] }, { type: "error", name: "ERC4626ExceededMaxMint", inputs: [{ name: "receiver", type: "address", internalType: "address" }, { name: "shares", type: "uint256", internalType: "uint256" }, { name: "max", type: "uint256", internalType: "uint256" }] }, { type: "error", name: "ERC4626ExceededMaxRedeem", inputs: [{ name: "owner", type: "address", internalType: "address" }, { name: "shares", type: "uint256", internalType: "uint256" }, { name: "max", type: "uint256", internalType: "uint256" }] }, { type: "error", name: "ERC4626ExceededMaxWithdraw", inputs: [{ name: "owner", type: "address", internalType: "address" }, { name: "assets", type: "uint256", internalType: "uint256" }, { name: "max", type: "uint256", internalType: "uint256" }] }, { type: "error", name: "ERC7540InvalidOperator", inputs: [] }, { type: "error", name: "ERC7540PreviewDepositDisabled", inputs: [] }, { type: "error", name: "ERC7540PreviewMintDisabled", inputs: [] }, { type: "error", name: "ERC7540PreviewRedeemDisabled", inputs: [] }, { type: "error", name: "ERC7540PreviewWithdrawDisabled", inputs: [] }, { type: "error", name: "EnforcedPause", inputs: [] }, { type: "error", name: "ExpectedPause", inputs: [] }, { type: "error", name: "FailedInnerCall", inputs: [] }, { type: "error", name: "InvalidInitialization", inputs: [] }, { type: "error", name: "MathOverflowedMulDiv", inputs: [] }, { type: "error", name: "NewTotalAssetsMissing", inputs: [] }, { type: "error", name: "NotClosing", inputs: [{ name: "currentState", type: "uint8", internalType: "enum State" }] }, { type: "error", name: "NotInitializing", inputs: [] }, { type: "error", name: "NotOpen", inputs: [{ name: "currentState", type: "uint8", internalType: "enum State" }] }, { type: "error", name: "NotWhitelisted", inputs: [] }, { type: "error", name: "OnlyOneRequestAllowed", inputs: [] }, { type: "error", name: "OnlySafe", inputs: [{ name: "safe", type: "address", internalType: "address" }] }, { type: "error", name: "OnlyValuationManager", inputs: [{ name: "valuationManager", type: "address", internalType: "address" }] }, { type: "error", name: "OnlyWhitelistManager", inputs: [{ name: "whitelistManager", type: "address", internalType: "address" }] }, { type: "error", name: "OwnableInvalidOwner", inputs: [{ name: "owner", type: "address", internalType: "address" }] }, { type: "error", name: "OwnableUnauthorizedAccount", inputs: [{ name: "account", type: "address", internalType: "address" }] }, { type: "error", name: "RequestIdNotClaimable", inputs: [] }, { type: "error", name: "RequestNotCancelable", inputs: [{ name: "requestId", type: "uint256", internalType: "uint256" }] }, { type: "error", name: "SafeERC20FailedOperation", inputs: [{ name: "token", type: "address", internalType: "address" }] }, { type: "error", name: "WrongNewTotalAssets", inputs: [] }];
@@ -138,15 +2245,6 @@ class Token {
138
2245
  var VaultUtils;
139
2246
  ((VaultUtils) => {
140
2247
  VaultUtils.VIRTUAL_ASSETS = 1n;
141
- VaultUtils.ERC20_STORAGE_LOCATION = "0x52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace00";
142
- VaultUtils.ERC4626_STORAGE_LOCATION = "0x0773e532dfede91f04b12a73d3d2acd361424f41f76b4fb79f090161e36b4e00";
143
- VaultUtils.ERC7540_STORAGE_LOCATION = "0x5c74d456014b1c0eb4368d944667a568313858a3029a650ff0cb7b56f8b57a00";
144
- VaultUtils.FEE_MANAGER_STORAGE_LOCATION = "0xa5292f7ccd85acc1b3080c01f5da9af7799f2c26826bd4d79081d6511780bd00";
145
- VaultUtils.OWNABLE_STORAGE_LOCATION = "0x9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300";
146
- VaultUtils.OWNABLE_2_STEP_UPGRADEABLE_STORAGE_LOCATION = "0x237e158222e3e6968b72b9db0d8043aacf074ad9f650f0d1606b4d82ee432c00";
147
- VaultUtils.ROLES_STORAGE_LOCATION = "0x7c302ed2c673c3d6b4551cf74a01ee649f887e14fd20d13dbca1b6099534d900";
148
- VaultUtils.VAULT_STORAGE_LOCATION = "0x0e6b3200a60a991c539f47dddaca04a18eb4bcf2b53906fb44751d827f001400";
149
- VaultUtils.WHITELISTABLE_STORAGE_LOCATION = "0x083cc98ab296d1a1f01854b5f7a2f47df4425a56ba7b35f7faa3a336067e4800";
150
2248
  VaultUtils.ONE_SHARE = 10n ** 18n;
151
2249
  function decimalsOffset(decimals) {
152
2250
  return MathLib.zeroFloorSub(18n, decimals);
@@ -338,6 +2436,88 @@ class Vault extends Token {
338
2436
  throw new Error("Unknown version");
339
2437
  }
340
2438
  }
2439
+ // ../../node_modules/viem/_esm/index.js
2440
+ init_exports();
2441
+ init_encodeAbiParameters();
2442
+ init_encodeFunctionData();
2443
+
2444
+ // src/vault/EncodingUtils.ts
2445
+ var EncodingUtils;
2446
+ ((EncodingUtils) => {
2447
+ EncodingUtils.ERC20_STORAGE_LOCATION = "0x52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace00";
2448
+ EncodingUtils.ERC4626_STORAGE_LOCATION = "0x0773e532dfede91f04b12a73d3d2acd361424f41f76b4fb79f090161e36b4e00";
2449
+ EncodingUtils.ERC7540_STORAGE_LOCATION = "0x5c74d456014b1c0eb4368d944667a568313858a3029a650ff0cb7b56f8b57a00";
2450
+ EncodingUtils.FEE_MANAGER_STORAGE_LOCATION = "0xa5292f7ccd85acc1b3080c01f5da9af7799f2c26826bd4d79081d6511780bd00";
2451
+ EncodingUtils.OWNABLE_STORAGE_LOCATION = "0x9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300";
2452
+ EncodingUtils.OWNABLE_2_STEP_UPGRADEABLE_STORAGE_LOCATION = "0x237e158222e3e6968b72b9db0d8043aacf074ad9f650f0d1606b4d82ee432c00";
2453
+ EncodingUtils.ROLES_STORAGE_LOCATION = "0x7c302ed2c673c3d6b4551cf74a01ee649f887e14fd20d13dbca1b6099534d900";
2454
+ EncodingUtils.VAULT_STORAGE_LOCATION = "0x0e6b3200a60a991c539f47dddaca04a18eb4bcf2b53906fb44751d827f001400";
2455
+ EncodingUtils.WHITELISTABLE_STORAGE_LOCATION = "0x083cc98ab296d1a1f01854b5f7a2f47df4425a56ba7b35f7faa3a336067e4800";
2456
+ EncodingUtils.EIP1967_PROXY_IMPLEMENTATION_SLOT = "0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc";
2457
+ function initializeEncodedCall(vault) {
2458
+ const initAbiParams = parseAbiParameter2([
2459
+ "InitStruct init",
2460
+ "struct InitStruct { address underlying; string name; string symbol; address safe; address whitelistManager; address valuationManager; address admin; address feeReceiver; uint16 managementRate; uint16 performanceRate; bool enableWhitelist; uint256 rateUpdateCooldown; }"
2461
+ ]);
2462
+ const initStructEncoded = encodeAbiParameters([initAbiParams], [
2463
+ {
2464
+ underlying: vault.asset,
2465
+ name: vault.name ?? "",
2466
+ symbol: vault.symbol ?? "",
2467
+ safe: vault.safe,
2468
+ whitelistManager: vault.whitelistManager,
2469
+ valuationManager: vault.valuationManager,
2470
+ admin: vault.owner,
2471
+ feeReceiver: vault.feeReceiver,
2472
+ managementRate: vault.feeRates.managementRate,
2473
+ performanceRate: vault.feeRates.performanceRate,
2474
+ enableWhitelist: vault.isWhitelistActivated,
2475
+ rateUpdateCooldown: vault.cooldown
2476
+ }
2477
+ ]);
2478
+ return encodeFunctionData({
2479
+ abi: [
2480
+ {
2481
+ type: "function",
2482
+ name: "initialize",
2483
+ stateMutability: "nonpayable",
2484
+ inputs: [
2485
+ { name: "initStruct", type: "bytes" },
2486
+ { name: "registry", type: "address" },
2487
+ { name: "wrappedNative", type: "address" }
2488
+ ],
2489
+ outputs: []
2490
+ }
2491
+ ],
2492
+ functionName: "initialize",
2493
+ args: [initStructEncoded, vault.feeRegistry, vault.wrappedNativeToken]
2494
+ });
2495
+ }
2496
+ EncodingUtils.initializeEncodedCall = initializeEncodedCall;
2497
+ function siloConstructorEncodedParams(vault) {
2498
+ const constructorEncoded = encodeAbiParameters(parseAbiParameters("address,address"), [vault.asset, vault.wrappedNativeToken]);
2499
+ return constructorEncoded;
2500
+ }
2501
+ EncodingUtils.siloConstructorEncodedParams = siloConstructorEncodedParams;
2502
+ function beaconProxyConstructorEncodedParams(vault, beacon) {
2503
+ const data = initializeEncodedCall(vault);
2504
+ return encodeAbiParameters(parseAbiParameters("address beacon, bytes data"), [beacon, data]);
2505
+ }
2506
+ EncodingUtils.beaconProxyConstructorEncodedParams = beaconProxyConstructorEncodedParams;
2507
+ function optinProxyConstructorEncodedParams(params) {
2508
+ return encodeAbiParameters(parseAbiParameters("address _logic, address _logicRegistry, address _initialOwner, uint256 _initialDelay, bytes _data"), [params.logic, params.logicRegistry, params.initialOwner, params.initialDelay, params.data]);
2509
+ }
2510
+ EncodingUtils.optinProxyConstructorEncodedParams = optinProxyConstructorEncodedParams;
2511
+ function optinProxyWithVaultInitConstructorEncodedParams(vault, params) {
2512
+ const initData = initializeEncodedCall(vault);
2513
+ return optinProxyConstructorEncodedParams({ ...params, data: initData });
2514
+ }
2515
+ EncodingUtils.optinProxyWithVaultInitConstructorEncodedParams = optinProxyWithVaultInitConstructorEncodedParams;
2516
+ function delayProxyAdminConstructorEncodedParams(params) {
2517
+ return encodeAbiParameters(parseAbiParameters("address initialOwner, uint256 initialDelay"), [params.initialOwner, params.initialDelay]);
2518
+ }
2519
+ EncodingUtils.delayProxyAdminConstructorEncodedParams = delayProxyAdminConstructorEncodedParams;
2520
+ })(EncodingUtils ||= {});
341
2521
  // src/vault/SettleData.ts
342
2522
  class SettleData {
343
2523
  static _CACHE = {};
@@ -375,6 +2555,53 @@ class CacheMissError extends Error {
375
2555
  this.msg = msg;
376
2556
  }
377
2557
  }
2558
+ // src/proxy/DelayProxyAdmin.ts
2559
+ class DelayProxyAdmin {
2560
+ address;
2561
+ owner;
2562
+ MAX_DELAY = 2592000n;
2563
+ MIN_DELAY = 86400n;
2564
+ implementationUpdateTime;
2565
+ newImplementation;
2566
+ delayUpdateTime;
2567
+ newDelay;
2568
+ delay;
2569
+ constructor({
2570
+ address,
2571
+ owner,
2572
+ implementationUpdateTime,
2573
+ newImplementation,
2574
+ delayUpdateTime,
2575
+ newDelay,
2576
+ delay
2577
+ }) {
2578
+ this.address = address;
2579
+ this.owner = owner;
2580
+ this.implementationUpdateTime = BigInt(implementationUpdateTime);
2581
+ this.newImplementation = newImplementation;
2582
+ this.delayUpdateTime = BigInt(delayUpdateTime);
2583
+ this.newDelay = BigInt(newDelay);
2584
+ this.delay = BigInt(delay);
2585
+ }
2586
+ }
2587
+ // src/proxy/OptinProxy.ts
2588
+ class OptinProxy {
2589
+ address;
2590
+ admin;
2591
+ logicRegistry;
2592
+ implementation;
2593
+ constructor({
2594
+ address,
2595
+ admin,
2596
+ logicRegistry,
2597
+ implementation
2598
+ }) {
2599
+ this.address = address;
2600
+ this.admin = admin;
2601
+ this.logicRegistry = logicRegistry;
2602
+ this.implementation = implementation;
2603
+ }
2604
+ }
378
2605
  // src/chain.ts
379
2606
  var ChainId;
380
2607
  ((ChainId2) => {
@@ -397,6 +2624,9 @@ var ChainId;
397
2624
  ChainId2[ChainId2["BerachainMainnet"] = 80094] = "BerachainMainnet";
398
2625
  ChainId2[ChainId2["MantleMainnet"] = 5000] = "MantleMainnet";
399
2626
  ChainId2[ChainId2["AvalancheMainnet"] = 43114] = "AvalancheMainnet";
2627
+ ChainId2[ChainId2["TacMainnet"] = 239] = "TacMainnet";
2628
+ ChainId2[ChainId2["KatanaMainnet"] = 747474] = "KatanaMainnet";
2629
+ ChainId2[ChainId2["BscMainnet"] = 64] = "BscMainnet";
400
2630
  })(ChainId ||= {});
401
2631
  var ChainUtils;
402
2632
  ((ChainUtils) => {
@@ -545,6 +2775,27 @@ var ChainUtils;
545
2775
  nativeCurrency: { name: "Avalanche", symbol: "AVAX", decimals: 18 },
546
2776
  explorerUrl: "https://snowtrace.io",
547
2777
  identifier: "avalanche"
2778
+ },
2779
+ [239 /* TacMainnet */]: {
2780
+ name: "Tac",
2781
+ id: 239 /* TacMainnet */,
2782
+ nativeCurrency: { name: "Tac", symbol: "TAC", decimals: 18 },
2783
+ explorerUrl: "https://explorer.tac.build/",
2784
+ identifier: "tac"
2785
+ },
2786
+ [747474 /* KatanaMainnet */]: {
2787
+ name: "Katana",
2788
+ id: 747474 /* KatanaMainnet */,
2789
+ nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
2790
+ explorerUrl: "https://katanascan.com/",
2791
+ identifier: "katana"
2792
+ },
2793
+ [64 /* BscMainnet */]: {
2794
+ name: "Binance Smart Chain",
2795
+ id: 64 /* BscMainnet */,
2796
+ nativeCurrency: { name: "Binance", symbol: "BNB", decimals: 18 },
2797
+ explorerUrl: "https://bscscan.com/",
2798
+ identifier: "bsc"
548
2799
  }
549
2800
  };
550
2801
  })(ChainUtils ||= {});
@@ -556,7 +2807,8 @@ var addresses = {
556
2807
  beaconProxyFactory: "0x09C8803f7Dc251f9FaAE5f56E3B91f8A6d0b70ee",
557
2808
  feeRegistry: "0x6dA4D1859bA1d02D095D2246142CdAd52233e27C",
558
2809
  v0_5_0: "0xe50554ec802375c9c3f9c087a8a7bb8c26d3dedf",
559
- wrappedNative: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"
2810
+ wrappedNative: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
2811
+ optinFactory: "0x8D6f5479B14348186faE9BC7E636e947c260f9B1"
560
2812
  },
561
2813
  [42161 /* ArbitrumMainnet */]: {
562
2814
  beaconProxyFactory: "0x58a7729125acA9e5E9C687018E66bfDd5b2D4490",
@@ -566,49 +2818,76 @@ var addresses = {
566
2818
  dev: {
567
2819
  beaconProxyFactory: "0x29f3dba953C57814A5579e08462724B9C760333e",
568
2820
  feeRegistry: "0x45BA44B8899D39abdc383a25bB17fcD18240c6Bc"
569
- }
2821
+ },
2822
+ optinFactory: "0x9De724B0efEe0FbA07FE21a16B9Bf9bBb5204Fb4"
570
2823
  },
571
2824
  [8453 /* BaseMainnet */]: {
572
2825
  beaconProxyFactory: "0xC953Fd298FdfA8Ed0D38ee73772D3e21Bf19c61b",
573
2826
  feeRegistry: "0x6dA4D1859bA1d02D095D2246142CdAd52233e27C",
574
2827
  v0_5_0: "0xE50554ec802375C9c3F9c087a8a7bb8C26d3DEDf",
575
- wrappedNative: "0x4200000000000000000000000000000000000006"
2828
+ wrappedNative: "0x4200000000000000000000000000000000000006",
2829
+ optinFactory: "0x6FC0F2320483fa03FBFdF626DDbAE2CC4B112b51"
576
2830
  },
577
2831
  [130 /* UnichainMainnet */]: {
578
2832
  beaconProxyFactory: "0xaba1A2e157Dae248f8630cA550bd826725Ff745c",
579
2833
  feeRegistry: "0x652716FaD571f04D26a3c8fFd9E593F17123Ab20",
580
2834
  v0_5_0: "0xE50554ec802375C9c3F9c087a8a7bb8C26d3DEDf",
581
- wrappedNative: "0x4200000000000000000000000000000000000006"
2835
+ wrappedNative: "0x4200000000000000000000000000000000000006",
2836
+ optinFactory: "0x6FC0F2320483fa03FBFdF626DDbAE2CC4B112b51"
582
2837
  },
583
2838
  [80094 /* BerachainMainnet */]: {
584
2839
  beaconProxyFactory: "0x7cf8cf276450bd568187fdc0b0959d30ec599853",
585
2840
  feeRegistry: "0xaba1A2e157Dae248f8630cA550bd826725Ff745c",
586
2841
  v0_5_0: "0xE50554ec802375C9c3F9c087a8a7bb8C26d3DEDf",
587
- wrappedNative: "0x6969696969696969696969696969696969696969"
2842
+ wrappedNative: "0x6969696969696969696969696969696969696969",
2843
+ optinFactory: "0x245d1C095a0fFa6f1Af0f7Df81818DeFc9Cfc69D"
588
2844
  },
589
2845
  [146 /* SonicMainnet */]: {
590
2846
  beaconProxyFactory: "0x99CD0b8b32B15922f0754Fddc21323b5278c5261",
591
2847
  feeRegistry: "0xab4aC28D10a4Bc279aD073B1D74Bfa0E385C010C",
592
2848
  v0_5_0: "0xE50554ec802375C9c3F9c087a8a7bb8C26d3DEDf",
593
- wrappedNative: "0x039e2fB66102314Ce7b64Ce5Ce3E5183bc94aD38"
2849
+ wrappedNative: "0x039e2fB66102314Ce7b64Ce5Ce3E5183bc94aD38",
2850
+ optinFactory: "0x6FC0F2320483fa03FBFdF626DDbAE2CC4B112b51"
594
2851
  },
595
2852
  [5000 /* MantleMainnet */]: {
596
2853
  beaconProxyFactory: "0x57D969B556C6AebB3Ac8f54c98CF3a3f921d5659",
597
2854
  feeRegistry: "0x47A144e67834408716cB40Fa87fc886D63362ddC",
598
2855
  v0_4_0: "0xA7260Cee56B679eC05a736A7b603b8DA8525Dd69",
599
- wrappedNative: "0x78c1b0C915c4FAA5FffA6CAbf0219DA63d7f4cb8"
2856
+ wrappedNative: "0x78c1b0C915c4FAA5FffA6CAbf0219DA63d7f4cb8",
2857
+ optinFactory: "0xc094c224ce0406bc338e00837b96ad2e265f7287"
600
2858
  },
601
2859
  [480 /* WorldChainMainnet */]: {
602
2860
  beaconProxyFactory: "0x600fA26581771F56221FC9847A834B3E5fd34AF7",
603
2861
  feeRegistry: "0x68e793658def657551fd4D3cA6Bc04b4E7723655",
604
2862
  v0_5_0: "0x1D42DbDde553F4099691A25F712bbd8f2686E355 ",
605
- wrappedNative: "0x4200000000000000000000000000000000000006"
2863
+ wrappedNative: "0x4200000000000000000000000000000000000006",
2864
+ optinFactory: "0xC094C224ce0406BC338E00837B96aD2e265F7287"
606
2865
  },
607
2866
  [43114 /* AvalancheMainnet */]: {
608
2867
  beaconProxyFactory: "0x5e231c6d030a5c0f51fa7d0f891d3f50a928c685",
609
2868
  feeRegistry: "0xD7F69ba99c6981Eab5579Aa16871Ae94c509d578",
610
2869
  v0_5_0: "0x33F65C8D025b5418C7f8dd248C2Ec1d31881D465",
611
- wrappedNative: "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7"
2870
+ wrappedNative: "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7",
2871
+ optinFactory: "0xC094C224ce0406BC338E00837B96aD2e265F7287"
2872
+ },
2873
+ [239 /* TacMainnet */]: {
2874
+ feeRegistry: "0x3408C51BFc34CBF7112a20Fb3F4Bc9b74aed7982",
2875
+ v0_5_0: "0x11652Aead69716E1D5D132F3bf0848D2fD422b8a",
2876
+ wrappedNative: "0xB63B9f0eb4A6E6f191529D71d4D88cc8900Df2C9",
2877
+ optinFactory: "0x66Ab87A9282dF99E38C148114F815a9C073ECA8D"
2878
+ },
2879
+ [747474 /* KatanaMainnet */]: {
2880
+ beaconProxyFactory: "0x37f4b3f0102fdc1ff0c7ef644751052fb276dc6e",
2881
+ feeRegistry: "0xC0Ef4c34A118a1bEc0912B8Ba8C6424F871A1628",
2882
+ v0_5_0: "0x7fe0c16eAa18562f1E37E6f6B205fDA70164e2fb",
2883
+ wrappedNative: "0x4200000000000000000000000000000000000006",
2884
+ optinFactory: "0xC094C224ce0406BC338E00837B96aD2e265F7287"
2885
+ },
2886
+ [64 /* BscMainnet */]: {
2887
+ feeRegistry: "0x9c275714Fb882988FbbFfdc39a162E0cc9feA64c",
2888
+ v0_5_0: "0x7175E7E5C246e2E5c8C54Ede2ee0180e39fcA879",
2889
+ wrappedNative: "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c",
2890
+ optinFactory: "0x3f680aB9E51EEED9381dE5275f4995611Ff884d5"
612
2891
  }
613
2892
  };
614
2893
  // src/utils.ts
@@ -636,9 +2915,12 @@ export {
636
2915
  Token,
637
2916
  State,
638
2917
  SettleData,
2918
+ OptinProxy,
639
2919
  NATIVE_ADDRESS,
640
2920
  MathLib,
641
2921
  LATEST_VERSION,
2922
+ EncodingUtils,
2923
+ DelayProxyAdmin,
642
2924
  ChainUtils,
643
2925
  ChainId,
644
2926
  CacheMissError