@morpho-dev/router 0.7.1 → 0.8.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.
Files changed (70) hide show
  1. package/dist/cli.js +441 -141
  2. package/dist/drizzle/migrations/0000_setup_single_migration_folder.sql +64 -64
  3. package/dist/drizzle/migrations/0001_add-trigger-for-consumed-events.sql +5 -5
  4. package/dist/drizzle/migrations/0002_insert-status-code.sql +1 -1
  5. package/dist/drizzle/migrations/0003_update-triggers-for-consumed-events.sql +1 -1
  6. package/dist/drizzle/migrations/0004_drop-status-offers-foreign-key-constraint.sql +1 -1
  7. package/dist/drizzle/migrations/0005_add-index-to-boost-group-query-and-offer-hash.sql +1 -1
  8. package/dist/drizzle/migrations/0006_add-callbacks-and-positions-relations.sql +11 -11
  9. package/dist/drizzle/migrations/0008_validation.sql +10 -10
  10. package/dist/drizzle/migrations/0009_add-transfers-table.sql +4 -4
  11. package/dist/drizzle/migrations/0010_add-price.sql +1 -1
  12. package/dist/drizzle/migrations/0011_nullable-callback-amount.sql +1 -1
  13. package/dist/drizzle/migrations/0012_add-position-asset.sql +1 -1
  14. package/dist/drizzle/migrations/0013_remove-depecrated-domains.sql +13 -13
  15. package/dist/drizzle/migrations/0014_rename-offers-v2-into-offers.sql +19 -19
  16. package/dist/drizzle/migrations/0015_add-lots-table.sql +3 -3
  17. package/dist/drizzle/migrations/0016_merkle-metadata.sql +7 -7
  18. package/dist/drizzle/migrations/0017_dusty_the_hunter.sql +1 -1
  19. package/dist/drizzle/migrations/0018_add_chain_collector_constraints.sql +3 -3
  20. package/dist/drizzle/migrations/0019_add-obligation-units-shares.sql +2 -2
  21. package/dist/drizzle/migrations/0020_add-session.sql +1 -1
  22. package/dist/drizzle/migrations/0021_drop_chain_collector_epoch_indexes.sql +2 -2
  23. package/dist/drizzle/migrations/0021_migrate-rate-to-price.sql +6 -6
  24. package/dist/drizzle/migrations/0022_consolidate-price.sql +5 -5
  25. package/dist/drizzle/migrations/0023_remove-block-number-for-collaterals.sql +1 -1
  26. package/dist/drizzle/migrations/0024_add-obligation-id-to-lots.sql +8 -0
  27. package/dist/drizzle/migrations/0025_rename-price-to-tick.sql +202 -0
  28. package/dist/drizzle/migrations/meta/0000_snapshot.json +48 -48
  29. package/dist/drizzle/migrations/meta/0001_snapshot.json +48 -48
  30. package/dist/drizzle/migrations/meta/0002_snapshot.json +48 -48
  31. package/dist/drizzle/migrations/meta/0003_snapshot.json +48 -48
  32. package/dist/drizzle/migrations/meta/0004_snapshot.json +47 -47
  33. package/dist/drizzle/migrations/meta/0005_snapshot.json +47 -47
  34. package/dist/drizzle/migrations/meta/0006_snapshot.json +61 -61
  35. package/dist/drizzle/migrations/meta/0008_snapshot.json +62 -62
  36. package/dist/drizzle/migrations/meta/0009_snapshot.json +66 -66
  37. package/dist/drizzle/migrations/meta/0010_snapshot.json +66 -66
  38. package/dist/drizzle/migrations/meta/0013_snapshot.json +48 -48
  39. package/dist/drizzle/migrations/meta/0014_snapshot.json +48 -48
  40. package/dist/drizzle/migrations/meta/0015_snapshot.json +52 -52
  41. package/dist/drizzle/migrations/meta/0016_snapshot.json +61 -61
  42. package/dist/drizzle/migrations/meta/0017_snapshot.json +61 -61
  43. package/dist/drizzle/migrations/meta/0018_snapshot.json +62 -62
  44. package/dist/drizzle/migrations/meta/0019_snapshot.json +62 -62
  45. package/dist/drizzle/migrations/meta/0023_snapshot.json +62 -62
  46. package/dist/drizzle/migrations/meta/0024_snapshot.json +1448 -0
  47. package/dist/drizzle/migrations/meta/0025_snapshot.json +1448 -0
  48. package/dist/drizzle/migrations/meta/_journal.json +14 -0
  49. package/dist/evm/bytecode/erc20.txt +1 -1
  50. package/dist/evm/bytecode/morpho.txt +1 -1
  51. package/dist/evm/bytecode/multicall3.txt +1 -1
  52. package/dist/evm/bytecode/oracle.txt +1 -1
  53. package/dist/evm/bytecode/vault.txt +1 -1
  54. package/dist/index.browser.d.mts +1157 -81
  55. package/dist/index.browser.d.mts.map +1 -1
  56. package/dist/index.browser.d.ts +1157 -81
  57. package/dist/index.browser.d.ts.map +1 -1
  58. package/dist/index.browser.js +371 -151
  59. package/dist/index.browser.js.map +1 -1
  60. package/dist/index.browser.mjs +366 -152
  61. package/dist/index.browser.mjs.map +1 -1
  62. package/dist/index.node.d.mts +1196 -70
  63. package/dist/index.node.d.mts.map +1 -1
  64. package/dist/index.node.d.ts +1196 -70
  65. package/dist/index.node.d.ts.map +1 -1
  66. package/dist/index.node.js +491 -145
  67. package/dist/index.node.js.map +1 -1
  68. package/dist/index.node.mjs +486 -146
  69. package/dist/index.node.mjs.map +1 -1
  70. package/package.json +1 -1
@@ -16,15 +16,17 @@ declare namespace BookResponse_d_exports {
16
16
  export { BookLevelResponse, from$15 as from };
17
17
  }
18
18
  type BookLevelResponse = {
19
+ tick: number;
19
20
  price: string;
20
21
  assets: string;
21
22
  count: number;
22
23
  };
23
- declare function from$15(level: {
24
- price: bigint;
24
+ type Input$1 = {
25
+ tick: number;
25
26
  assets: bigint;
26
27
  count: number;
27
- }): BookLevelResponse;
28
+ };
29
+ declare function from$15(level: Input$1): BookLevelResponse;
28
30
  //#endregion
29
31
  //#region src/api/Schema/health.d.ts
30
32
  declare const CollectorHealth: z.ZodObject<{
@@ -34,9 +36,9 @@ declare const CollectorHealth: z.ZodObject<{
34
36
  updated_at: z.ZodNullable<z.ZodString>;
35
37
  lag: z.ZodNullable<z.ZodNumber>;
36
38
  status: z.ZodEnum<{
39
+ unknown: "unknown";
37
40
  live: "live";
38
41
  lagging: "lagging";
39
- unknown: "unknown";
40
42
  }>;
41
43
  initialized: z.ZodBoolean;
42
44
  }, z.core.$strip>;
@@ -47,9 +49,9 @@ declare const CollectorsHealthResponse: z.ZodArray<z.ZodObject<{
47
49
  updated_at: z.ZodNullable<z.ZodString>;
48
50
  lag: z.ZodNullable<z.ZodNumber>;
49
51
  status: z.ZodEnum<{
52
+ unknown: "unknown";
50
53
  live: "live";
51
54
  lagging: "lagging";
52
- unknown: "unknown";
53
55
  }>;
54
56
  initialized: z.ZodBoolean;
55
57
  }, z.core.$strip>>;
@@ -120,108 +122,1114 @@ declare const MetaMorpho: readonly [{
120
122
  readonly type: "uint256";
121
123
  }];
122
124
  }, {
123
- readonly name: "maxWithdraw";
124
- readonly type: "function";
125
- readonly stateMutability: "view";
125
+ readonly name: "maxWithdraw";
126
+ readonly type: "function";
127
+ readonly stateMutability: "view";
128
+ readonly inputs: readonly [{
129
+ readonly type: "address";
130
+ readonly name: "owner";
131
+ }];
132
+ readonly outputs: readonly [{
133
+ readonly type: "uint256";
134
+ readonly name: "assets";
135
+ }];
136
+ }, {
137
+ readonly name: "asset";
138
+ readonly type: "function";
139
+ readonly stateMutability: "view";
140
+ readonly inputs: readonly [];
141
+ readonly outputs: readonly [{
142
+ readonly type: "address";
143
+ }];
144
+ }, {
145
+ readonly name: "Transfer";
146
+ readonly type: "event";
147
+ readonly inputs: readonly [{
148
+ readonly type: "address";
149
+ readonly name: "from";
150
+ readonly indexed: true;
151
+ }, {
152
+ readonly type: "address";
153
+ readonly name: "to";
154
+ readonly indexed: true;
155
+ }, {
156
+ readonly type: "uint256";
157
+ readonly name: "value";
158
+ }];
159
+ }, {
160
+ readonly name: "withdrawQueue";
161
+ readonly type: "function";
162
+ readonly stateMutability: "view";
163
+ readonly inputs: readonly [{
164
+ readonly type: "uint256";
165
+ readonly name: "index";
166
+ }];
167
+ readonly outputs: readonly [{
168
+ readonly type: "bytes32";
169
+ }];
170
+ }, {
171
+ readonly name: "withdrawQueueLength";
172
+ readonly type: "function";
173
+ readonly stateMutability: "view";
174
+ readonly inputs: readonly [];
175
+ readonly outputs: readonly [{
176
+ readonly type: "uint256";
177
+ }];
178
+ }];
179
+ type MetaMorpho = typeof MetaMorpho;
180
+ //#endregion
181
+ //#region src/core/Abi/MetaMorphoFactory.d.ts
182
+ declare const MetaMorphoFactory: readonly [{
183
+ readonly name: "CreateMetaMorpho";
184
+ readonly type: "event";
185
+ readonly inputs: readonly [{
186
+ readonly type: "address";
187
+ readonly name: "metaMorpho";
188
+ readonly indexed: true;
189
+ }, {
190
+ readonly type: "address";
191
+ readonly name: "caller";
192
+ readonly indexed: true;
193
+ }, {
194
+ readonly type: "address";
195
+ readonly name: "initialOwner";
196
+ }, {
197
+ readonly type: "uint256";
198
+ readonly name: "initialTimelock";
199
+ }, {
200
+ readonly type: "address";
201
+ readonly name: "asset";
202
+ readonly indexed: true;
203
+ }, {
204
+ readonly type: "string";
205
+ readonly name: "name";
206
+ }, {
207
+ readonly type: "string";
208
+ readonly name: "symbol";
209
+ }, {
210
+ readonly type: "bytes32";
211
+ readonly name: "salt";
212
+ }];
213
+ }, {
214
+ readonly name: "isMetaMorpho";
215
+ readonly type: "function";
216
+ readonly stateMutability: "view";
217
+ readonly inputs: readonly [{
218
+ readonly type: "address";
219
+ }];
220
+ readonly outputs: readonly [{
221
+ readonly type: "bool";
222
+ }];
223
+ }];
224
+ type MetaMorphoFactory = typeof MetaMorphoFactory;
225
+ //#endregion
226
+ //#region src/core/Abi/MorphoV2.d.ts
227
+ declare const MorphoV2: readonly [{
228
+ readonly type: "constructor";
229
+ readonly stateMutability: "nonpayable";
230
+ readonly inputs: readonly [];
231
+ }, {
232
+ readonly name: "collateralOf";
233
+ readonly type: "function";
234
+ readonly stateMutability: "view";
235
+ readonly inputs: readonly [{
236
+ readonly type: "bytes32";
237
+ readonly name: "id";
238
+ }, {
239
+ readonly type: "address";
240
+ readonly name: "user";
241
+ }, {
242
+ readonly type: "address";
243
+ readonly name: "collateralToken";
244
+ }];
245
+ readonly outputs: readonly [{
246
+ readonly type: "uint256";
247
+ }];
248
+ }, {
249
+ readonly name: "consume";
250
+ readonly type: "function";
251
+ readonly stateMutability: "nonpayable";
252
+ readonly inputs: readonly [{
253
+ readonly type: "bytes32";
254
+ readonly name: "group";
255
+ }, {
256
+ readonly type: "uint256";
257
+ readonly name: "amount";
258
+ }];
259
+ readonly outputs: readonly [];
260
+ }, {
261
+ readonly name: "consumed";
262
+ readonly type: "function";
263
+ readonly stateMutability: "view";
264
+ readonly inputs: readonly [{
265
+ readonly type: "address";
266
+ readonly name: "user";
267
+ }, {
268
+ readonly type: "bytes32";
269
+ readonly name: "group";
270
+ }];
271
+ readonly outputs: readonly [{
272
+ readonly type: "uint256";
273
+ }];
274
+ }, {
275
+ readonly name: "debtOf";
276
+ readonly type: "function";
277
+ readonly stateMutability: "view";
278
+ readonly inputs: readonly [{
279
+ readonly type: "bytes32";
280
+ readonly name: "id";
281
+ }, {
282
+ readonly type: "address";
283
+ readonly name: "user";
284
+ }];
285
+ readonly outputs: readonly [{
286
+ readonly type: "uint256";
287
+ }];
288
+ }, {
289
+ readonly name: "defaultFees";
290
+ readonly type: "function";
291
+ readonly stateMutability: "view";
292
+ readonly inputs: readonly [{
293
+ readonly type: "address";
294
+ readonly name: "loanToken";
295
+ }, {
296
+ readonly type: "uint256";
297
+ readonly name: "index";
298
+ }];
299
+ readonly outputs: readonly [{
300
+ readonly type: "uint16";
301
+ }];
302
+ }, {
303
+ readonly name: "feeSetter";
304
+ readonly type: "function";
305
+ readonly stateMutability: "view";
306
+ readonly inputs: readonly [];
307
+ readonly outputs: readonly [{
308
+ readonly type: "address";
309
+ }];
310
+ }, {
311
+ readonly name: "fees";
312
+ readonly type: "function";
313
+ readonly stateMutability: "view";
314
+ readonly inputs: readonly [{
315
+ readonly type: "bytes32";
316
+ readonly name: "id";
317
+ }];
318
+ readonly outputs: readonly [{
319
+ readonly type: "uint16[6]";
320
+ }];
321
+ }, {
322
+ readonly name: "flashLoan";
323
+ readonly type: "function";
324
+ readonly stateMutability: "nonpayable";
325
+ readonly inputs: readonly [{
326
+ readonly type: "address";
327
+ readonly name: "token";
328
+ }, {
329
+ readonly type: "uint256";
330
+ readonly name: "assets";
331
+ }, {
332
+ readonly type: "address";
333
+ readonly name: "callback";
334
+ }, {
335
+ readonly type: "bytes";
336
+ readonly name: "data";
337
+ }];
338
+ readonly outputs: readonly [];
339
+ }, {
340
+ readonly name: "isHealthy";
341
+ readonly type: "function";
342
+ readonly stateMutability: "view";
343
+ readonly inputs: readonly [{
344
+ readonly type: "tuple";
345
+ readonly components: readonly [{
346
+ readonly type: "address";
347
+ readonly name: "loanToken";
348
+ }, {
349
+ readonly type: "tuple[]";
350
+ readonly components: readonly [{
351
+ readonly type: "address";
352
+ readonly name: "token";
353
+ }, {
354
+ readonly type: "uint256";
355
+ readonly name: "lltv";
356
+ }, {
357
+ readonly type: "address";
358
+ readonly name: "oracle";
359
+ }];
360
+ readonly name: "collaterals";
361
+ }, {
362
+ readonly type: "uint256";
363
+ readonly name: "maturity";
364
+ }];
365
+ readonly name: "obligation";
366
+ }, {
367
+ readonly type: "bytes32";
368
+ readonly name: "id";
369
+ }, {
370
+ readonly type: "address";
371
+ readonly name: "borrower";
372
+ }];
373
+ readonly outputs: readonly [{
374
+ readonly type: "bool";
375
+ }];
376
+ }, {
377
+ readonly name: "liquidate";
378
+ readonly type: "function";
379
+ readonly stateMutability: "nonpayable";
380
+ readonly inputs: readonly [{
381
+ readonly type: "tuple";
382
+ readonly components: readonly [{
383
+ readonly type: "address";
384
+ readonly name: "loanToken";
385
+ }, {
386
+ readonly type: "tuple[]";
387
+ readonly components: readonly [{
388
+ readonly type: "address";
389
+ readonly name: "token";
390
+ }, {
391
+ readonly type: "uint256";
392
+ readonly name: "lltv";
393
+ }, {
394
+ readonly type: "address";
395
+ readonly name: "oracle";
396
+ }];
397
+ readonly name: "collaterals";
398
+ }, {
399
+ readonly type: "uint256";
400
+ readonly name: "maturity";
401
+ }];
402
+ readonly name: "obligation";
403
+ }, {
404
+ readonly type: "tuple[]";
405
+ readonly components: readonly [{
406
+ readonly type: "uint256";
407
+ readonly name: "collateralIndex";
408
+ }, {
409
+ readonly type: "uint256";
410
+ readonly name: "repaid";
411
+ }, {
412
+ readonly type: "uint256";
413
+ readonly name: "seized";
414
+ }];
415
+ readonly name: "seizures";
416
+ }, {
417
+ readonly type: "address";
418
+ readonly name: "borrower";
419
+ }, {
420
+ readonly type: "bytes";
421
+ readonly name: "data";
422
+ }];
423
+ readonly outputs: readonly [{
424
+ readonly type: "tuple[]";
425
+ readonly components: readonly [{
426
+ readonly type: "uint256";
427
+ readonly name: "collateralIndex";
428
+ }, {
429
+ readonly type: "uint256";
430
+ readonly name: "repaid";
431
+ }, {
432
+ readonly type: "uint256";
433
+ readonly name: "seized";
434
+ }];
435
+ }];
436
+ }, {
437
+ readonly name: "multicall";
438
+ readonly type: "function";
439
+ readonly stateMutability: "nonpayable";
440
+ readonly inputs: readonly [{
441
+ readonly type: "bytes[]";
442
+ readonly name: "calls";
443
+ }];
444
+ readonly outputs: readonly [];
445
+ }, {
446
+ readonly name: "obligationCreated";
447
+ readonly type: "function";
448
+ readonly stateMutability: "view";
449
+ readonly inputs: readonly [{
450
+ readonly type: "bytes32";
451
+ readonly name: "id";
452
+ }];
453
+ readonly outputs: readonly [{
454
+ readonly type: "bool";
455
+ }];
456
+ }, {
457
+ readonly name: "obligationState";
458
+ readonly type: "function";
459
+ readonly stateMutability: "view";
460
+ readonly inputs: readonly [{
461
+ readonly type: "bytes32";
462
+ readonly name: "id";
463
+ }];
464
+ readonly outputs: readonly [{
465
+ readonly type: "uint128";
466
+ readonly name: "totalUnits";
467
+ }, {
468
+ readonly type: "uint128";
469
+ readonly name: "totalShares";
470
+ }, {
471
+ readonly type: "uint256";
472
+ readonly name: "withdrawable";
473
+ }, {
474
+ readonly type: "bool";
475
+ readonly name: "created";
476
+ }];
477
+ }, {
478
+ readonly name: "owner";
479
+ readonly type: "function";
480
+ readonly stateMutability: "view";
481
+ readonly inputs: readonly [];
482
+ readonly outputs: readonly [{
483
+ readonly type: "address";
484
+ }];
485
+ }, {
486
+ readonly name: "repay";
487
+ readonly type: "function";
488
+ readonly stateMutability: "nonpayable";
489
+ readonly inputs: readonly [{
490
+ readonly type: "tuple";
491
+ readonly components: readonly [{
492
+ readonly type: "address";
493
+ readonly name: "loanToken";
494
+ }, {
495
+ readonly type: "tuple[]";
496
+ readonly components: readonly [{
497
+ readonly type: "address";
498
+ readonly name: "token";
499
+ }, {
500
+ readonly type: "uint256";
501
+ readonly name: "lltv";
502
+ }, {
503
+ readonly type: "address";
504
+ readonly name: "oracle";
505
+ }];
506
+ readonly name: "collaterals";
507
+ }, {
508
+ readonly type: "uint256";
509
+ readonly name: "maturity";
510
+ }];
511
+ readonly name: "obligation";
512
+ }, {
513
+ readonly type: "uint256";
514
+ readonly name: "obligationUnits";
515
+ }, {
516
+ readonly type: "address";
517
+ readonly name: "onBehalf";
518
+ }];
519
+ readonly outputs: readonly [];
520
+ }, {
521
+ readonly name: "session";
522
+ readonly type: "function";
523
+ readonly stateMutability: "view";
524
+ readonly inputs: readonly [{
525
+ readonly type: "address";
526
+ readonly name: "user";
527
+ }];
528
+ readonly outputs: readonly [{
529
+ readonly type: "bytes32";
530
+ }];
531
+ }, {
532
+ readonly name: "setDefaultTradingFee";
533
+ readonly type: "function";
534
+ readonly stateMutability: "nonpayable";
535
+ readonly inputs: readonly [{
536
+ readonly type: "address";
537
+ readonly name: "loanToken";
538
+ }, {
539
+ readonly type: "uint256";
540
+ readonly name: "index";
541
+ }, {
542
+ readonly type: "uint256";
543
+ readonly name: "newTradingFee";
544
+ }];
545
+ readonly outputs: readonly [];
546
+ }, {
547
+ readonly name: "setFeeSetter";
548
+ readonly type: "function";
549
+ readonly stateMutability: "nonpayable";
550
+ readonly inputs: readonly [{
551
+ readonly type: "address";
552
+ readonly name: "newFeeSetter";
553
+ }];
554
+ readonly outputs: readonly [];
555
+ }, {
556
+ readonly name: "setObligationTradingFee";
557
+ readonly type: "function";
558
+ readonly stateMutability: "nonpayable";
559
+ readonly inputs: readonly [{
560
+ readonly type: "bytes32";
561
+ readonly name: "id";
562
+ }, {
563
+ readonly type: "uint256";
564
+ readonly name: "index";
565
+ }, {
566
+ readonly type: "uint256";
567
+ readonly name: "newTradingFee";
568
+ }];
569
+ readonly outputs: readonly [];
570
+ }, {
571
+ readonly name: "setOwner";
572
+ readonly type: "function";
573
+ readonly stateMutability: "nonpayable";
574
+ readonly inputs: readonly [{
575
+ readonly type: "address";
576
+ readonly name: "newOwner";
577
+ }];
578
+ readonly outputs: readonly [];
579
+ }, {
580
+ readonly name: "setTradingFeeRecipient";
581
+ readonly type: "function";
582
+ readonly stateMutability: "nonpayable";
583
+ readonly inputs: readonly [{
584
+ readonly type: "address";
585
+ readonly name: "recipient";
586
+ }];
587
+ readonly outputs: readonly [];
588
+ }, {
589
+ readonly name: "sharesOf";
590
+ readonly type: "function";
591
+ readonly stateMutability: "view";
592
+ readonly inputs: readonly [{
593
+ readonly type: "bytes32";
594
+ readonly name: "id";
595
+ }, {
596
+ readonly type: "address";
597
+ readonly name: "user";
598
+ }];
599
+ readonly outputs: readonly [{
600
+ readonly type: "uint256";
601
+ }];
602
+ }, {
603
+ readonly name: "shuffleSession";
604
+ readonly type: "function";
605
+ readonly stateMutability: "nonpayable";
606
+ readonly inputs: readonly [];
607
+ readonly outputs: readonly [];
608
+ }, {
609
+ readonly name: "supplyCollateral";
610
+ readonly type: "function";
611
+ readonly stateMutability: "nonpayable";
612
+ readonly inputs: readonly [{
613
+ readonly type: "tuple";
614
+ readonly components: readonly [{
615
+ readonly type: "address";
616
+ readonly name: "loanToken";
617
+ }, {
618
+ readonly type: "tuple[]";
619
+ readonly components: readonly [{
620
+ readonly type: "address";
621
+ readonly name: "token";
622
+ }, {
623
+ readonly type: "uint256";
624
+ readonly name: "lltv";
625
+ }, {
626
+ readonly type: "address";
627
+ readonly name: "oracle";
628
+ }];
629
+ readonly name: "collaterals";
630
+ }, {
631
+ readonly type: "uint256";
632
+ readonly name: "maturity";
633
+ }];
634
+ readonly name: "obligation";
635
+ }, {
636
+ readonly type: "address";
637
+ readonly name: "collateral";
638
+ }, {
639
+ readonly type: "uint256";
640
+ readonly name: "assets";
641
+ }, {
642
+ readonly type: "address";
643
+ readonly name: "onBehalf";
644
+ }];
645
+ readonly outputs: readonly [];
646
+ }, {
647
+ readonly name: "take";
648
+ readonly type: "function";
649
+ readonly stateMutability: "nonpayable";
650
+ readonly inputs: readonly [{
651
+ readonly type: "uint256";
652
+ readonly name: "buyerAssets";
653
+ }, {
654
+ readonly type: "uint256";
655
+ readonly name: "sellerAssets";
656
+ }, {
657
+ readonly type: "uint256";
658
+ readonly name: "obligationUnits";
659
+ }, {
660
+ readonly type: "uint256";
661
+ readonly name: "obligationShares";
662
+ }, {
663
+ readonly type: "address";
664
+ readonly name: "taker";
665
+ }, {
666
+ readonly type: "tuple";
667
+ readonly components: readonly [{
668
+ readonly type: "tuple";
669
+ readonly components: readonly [{
670
+ readonly type: "address";
671
+ readonly name: "loanToken";
672
+ }, {
673
+ readonly type: "tuple[]";
674
+ readonly components: readonly [{
675
+ readonly type: "address";
676
+ readonly name: "token";
677
+ }, {
678
+ readonly type: "uint256";
679
+ readonly name: "lltv";
680
+ }, {
681
+ readonly type: "address";
682
+ readonly name: "oracle";
683
+ }];
684
+ readonly name: "collaterals";
685
+ }, {
686
+ readonly type: "uint256";
687
+ readonly name: "maturity";
688
+ }];
689
+ readonly name: "obligation";
690
+ }, {
691
+ readonly type: "bool";
692
+ readonly name: "buy";
693
+ }, {
694
+ readonly type: "address";
695
+ readonly name: "maker";
696
+ }, {
697
+ readonly type: "uint256";
698
+ readonly name: "assets";
699
+ }, {
700
+ readonly type: "uint256";
701
+ readonly name: "obligationUnits";
702
+ }, {
703
+ readonly type: "uint256";
704
+ readonly name: "obligationShares";
705
+ }, {
706
+ readonly type: "uint256";
707
+ readonly name: "start";
708
+ }, {
709
+ readonly type: "uint256";
710
+ readonly name: "expiry";
711
+ }, {
712
+ readonly type: "uint256";
713
+ readonly name: "tick";
714
+ }, {
715
+ readonly type: "bytes32";
716
+ readonly name: "group";
717
+ }, {
718
+ readonly type: "bytes32";
719
+ readonly name: "session";
720
+ }, {
721
+ readonly type: "address";
722
+ readonly name: "callback";
723
+ }, {
724
+ readonly type: "bytes";
725
+ readonly name: "callbackData";
726
+ }];
727
+ readonly name: "offer";
728
+ }, {
729
+ readonly type: "tuple";
730
+ readonly components: readonly [{
731
+ readonly type: "uint8";
732
+ readonly name: "v";
733
+ }, {
734
+ readonly type: "bytes32";
735
+ readonly name: "r";
736
+ }, {
737
+ readonly type: "bytes32";
738
+ readonly name: "s";
739
+ }];
740
+ readonly name: "sig";
741
+ }, {
742
+ readonly type: "bytes32";
743
+ readonly name: "root";
744
+ }, {
745
+ readonly type: "bytes32[]";
746
+ readonly name: "proof";
747
+ }, {
748
+ readonly type: "address";
749
+ readonly name: "takerCallback";
750
+ }, {
751
+ readonly type: "bytes";
752
+ readonly name: "takerCallbackData";
753
+ }];
754
+ readonly outputs: readonly [{
755
+ readonly type: "uint256";
756
+ }, {
757
+ readonly type: "uint256";
758
+ }, {
759
+ readonly type: "uint256";
760
+ }, {
761
+ readonly type: "uint256";
762
+ }];
763
+ }, {
764
+ readonly name: "totalShares";
765
+ readonly type: "function";
766
+ readonly stateMutability: "view";
767
+ readonly inputs: readonly [{
768
+ readonly type: "bytes32";
769
+ readonly name: "id";
770
+ }];
771
+ readonly outputs: readonly [{
772
+ readonly type: "uint256";
773
+ }];
774
+ }, {
775
+ readonly name: "totalUnits";
776
+ readonly type: "function";
777
+ readonly stateMutability: "view";
778
+ readonly inputs: readonly [{
779
+ readonly type: "bytes32";
780
+ readonly name: "id";
781
+ }];
782
+ readonly outputs: readonly [{
783
+ readonly type: "uint256";
784
+ }];
785
+ }, {
786
+ readonly name: "touchObligation";
787
+ readonly type: "function";
788
+ readonly stateMutability: "nonpayable";
789
+ readonly inputs: readonly [{
790
+ readonly type: "tuple";
791
+ readonly components: readonly [{
792
+ readonly type: "address";
793
+ readonly name: "loanToken";
794
+ }, {
795
+ readonly type: "tuple[]";
796
+ readonly components: readonly [{
797
+ readonly type: "address";
798
+ readonly name: "token";
799
+ }, {
800
+ readonly type: "uint256";
801
+ readonly name: "lltv";
802
+ }, {
803
+ readonly type: "address";
804
+ readonly name: "oracle";
805
+ }];
806
+ readonly name: "collaterals";
807
+ }, {
808
+ readonly type: "uint256";
809
+ readonly name: "maturity";
810
+ }];
811
+ readonly name: "obligation";
812
+ }];
813
+ readonly outputs: readonly [{
814
+ readonly type: "bytes32";
815
+ }];
816
+ }, {
817
+ readonly name: "tradingFee";
818
+ readonly type: "function";
819
+ readonly stateMutability: "view";
820
+ readonly inputs: readonly [{
821
+ readonly type: "bytes32";
822
+ readonly name: "id";
823
+ }, {
824
+ readonly type: "uint256";
825
+ readonly name: "timeToMaturity";
826
+ }];
827
+ readonly outputs: readonly [{
828
+ readonly type: "uint256";
829
+ }];
830
+ }, {
831
+ readonly name: "tradingFeeRecipient";
832
+ readonly type: "function";
833
+ readonly stateMutability: "view";
834
+ readonly inputs: readonly [];
835
+ readonly outputs: readonly [{
836
+ readonly type: "address";
837
+ }];
838
+ }, {
839
+ readonly name: "withdraw";
840
+ readonly type: "function";
841
+ readonly stateMutability: "nonpayable";
842
+ readonly inputs: readonly [{
843
+ readonly type: "tuple";
844
+ readonly components: readonly [{
845
+ readonly type: "address";
846
+ readonly name: "loanToken";
847
+ }, {
848
+ readonly type: "tuple[]";
849
+ readonly components: readonly [{
850
+ readonly type: "address";
851
+ readonly name: "token";
852
+ }, {
853
+ readonly type: "uint256";
854
+ readonly name: "lltv";
855
+ }, {
856
+ readonly type: "address";
857
+ readonly name: "oracle";
858
+ }];
859
+ readonly name: "collaterals";
860
+ }, {
861
+ readonly type: "uint256";
862
+ readonly name: "maturity";
863
+ }];
864
+ readonly name: "obligation";
865
+ }, {
866
+ readonly type: "uint256";
867
+ readonly name: "obligationUnits";
868
+ }, {
869
+ readonly type: "uint256";
870
+ readonly name: "shares";
871
+ }, {
872
+ readonly type: "address";
873
+ readonly name: "onBehalf";
874
+ }];
875
+ readonly outputs: readonly [{
876
+ readonly type: "uint256";
877
+ }, {
878
+ readonly type: "uint256";
879
+ }];
880
+ }, {
881
+ readonly name: "withdrawCollateral";
882
+ readonly type: "function";
883
+ readonly stateMutability: "nonpayable";
884
+ readonly inputs: readonly [{
885
+ readonly type: "tuple";
886
+ readonly components: readonly [{
887
+ readonly type: "address";
888
+ readonly name: "loanToken";
889
+ }, {
890
+ readonly type: "tuple[]";
891
+ readonly components: readonly [{
892
+ readonly type: "address";
893
+ readonly name: "token";
894
+ }, {
895
+ readonly type: "uint256";
896
+ readonly name: "lltv";
897
+ }, {
898
+ readonly type: "address";
899
+ readonly name: "oracle";
900
+ }];
901
+ readonly name: "collaterals";
902
+ }, {
903
+ readonly type: "uint256";
904
+ readonly name: "maturity";
905
+ }];
906
+ readonly name: "obligation";
907
+ }, {
908
+ readonly type: "address";
909
+ readonly name: "collateral";
910
+ }, {
911
+ readonly type: "uint256";
912
+ readonly name: "assets";
913
+ }, {
914
+ readonly type: "address";
915
+ readonly name: "onBehalf";
916
+ }];
917
+ readonly outputs: readonly [];
918
+ }, {
919
+ readonly name: "withdrawable";
920
+ readonly type: "function";
921
+ readonly stateMutability: "view";
922
+ readonly inputs: readonly [{
923
+ readonly type: "bytes32";
924
+ readonly name: "id";
925
+ }];
926
+ readonly outputs: readonly [{
927
+ readonly type: "uint256";
928
+ }];
929
+ }, {
930
+ readonly name: "Constructor";
931
+ readonly type: "event";
126
932
  readonly inputs: readonly [{
127
933
  readonly type: "address";
128
934
  readonly name: "owner";
935
+ readonly indexed: true;
129
936
  }];
130
- readonly outputs: readonly [{
937
+ }, {
938
+ readonly name: "Consume";
939
+ readonly type: "event";
940
+ readonly inputs: readonly [{
941
+ readonly type: "address";
942
+ readonly name: "user";
943
+ readonly indexed: true;
944
+ }, {
945
+ readonly type: "bytes32";
946
+ readonly name: "group";
947
+ readonly indexed: true;
948
+ }, {
131
949
  readonly type: "uint256";
132
- readonly name: "assets";
950
+ readonly name: "amount";
133
951
  }];
134
952
  }, {
135
- readonly name: "asset";
136
- readonly type: "function";
137
- readonly stateMutability: "view";
138
- readonly inputs: readonly [];
139
- readonly outputs: readonly [{
953
+ readonly name: "FlashLoan";
954
+ readonly type: "event";
955
+ readonly inputs: readonly [{
956
+ readonly type: "address";
957
+ readonly name: "caller";
958
+ readonly indexed: true;
959
+ }, {
140
960
  readonly type: "address";
961
+ readonly name: "token";
962
+ readonly indexed: true;
963
+ }, {
964
+ readonly type: "uint256";
965
+ readonly name: "assets";
141
966
  }];
142
967
  }, {
143
- readonly name: "Transfer";
968
+ readonly name: "Liquidate";
144
969
  readonly type: "event";
145
970
  readonly inputs: readonly [{
146
971
  readonly type: "address";
147
- readonly name: "from";
972
+ readonly name: "caller";
973
+ readonly indexed: true;
974
+ }, {
975
+ readonly type: "bytes32";
976
+ readonly name: "id";
148
977
  readonly indexed: true;
978
+ }, {
979
+ readonly type: "tuple[]";
980
+ readonly components: readonly [{
981
+ readonly type: "uint256";
982
+ readonly name: "collateralIndex";
983
+ }, {
984
+ readonly type: "uint256";
985
+ readonly name: "repaid";
986
+ }, {
987
+ readonly type: "uint256";
988
+ readonly name: "seized";
989
+ }];
990
+ readonly name: "seizures";
149
991
  }, {
150
992
  readonly type: "address";
151
- readonly name: "to";
993
+ readonly name: "borrower";
152
994
  readonly indexed: true;
153
995
  }, {
154
996
  readonly type: "uint256";
155
- readonly name: "value";
997
+ readonly name: "totalRepaid";
998
+ }, {
999
+ readonly type: "uint256";
1000
+ readonly name: "badDebt";
156
1001
  }];
157
1002
  }, {
158
- readonly name: "withdrawQueue";
159
- readonly type: "function";
160
- readonly stateMutability: "view";
1003
+ readonly name: "ObligationCreated";
1004
+ readonly type: "event";
1005
+ readonly inputs: readonly [{
1006
+ readonly type: "bytes32";
1007
+ readonly name: "id";
1008
+ readonly indexed: true;
1009
+ }, {
1010
+ readonly type: "tuple";
1011
+ readonly components: readonly [{
1012
+ readonly type: "address";
1013
+ readonly name: "loanToken";
1014
+ }, {
1015
+ readonly type: "tuple[]";
1016
+ readonly components: readonly [{
1017
+ readonly type: "address";
1018
+ readonly name: "token";
1019
+ }, {
1020
+ readonly type: "uint256";
1021
+ readonly name: "lltv";
1022
+ }, {
1023
+ readonly type: "address";
1024
+ readonly name: "oracle";
1025
+ }];
1026
+ readonly name: "collaterals";
1027
+ }, {
1028
+ readonly type: "uint256";
1029
+ readonly name: "maturity";
1030
+ }];
1031
+ readonly name: "obligation";
1032
+ }];
1033
+ }, {
1034
+ readonly name: "Repay";
1035
+ readonly type: "event";
1036
+ readonly inputs: readonly [{
1037
+ readonly type: "address";
1038
+ readonly name: "caller";
1039
+ readonly indexed: true;
1040
+ }, {
1041
+ readonly type: "bytes32";
1042
+ readonly name: "id";
1043
+ readonly indexed: true;
1044
+ }, {
1045
+ readonly type: "uint256";
1046
+ readonly name: "obligationUnits";
1047
+ }, {
1048
+ readonly type: "address";
1049
+ readonly name: "onBehalf";
1050
+ readonly indexed: true;
1051
+ }];
1052
+ }, {
1053
+ readonly name: "SetDefaultTradingFee";
1054
+ readonly type: "event";
161
1055
  readonly inputs: readonly [{
1056
+ readonly type: "address";
1057
+ readonly name: "loanToken";
1058
+ readonly indexed: true;
1059
+ }, {
162
1060
  readonly type: "uint256";
163
1061
  readonly name: "index";
1062
+ readonly indexed: true;
1063
+ }, {
1064
+ readonly type: "uint256";
1065
+ readonly name: "newTradingFee";
164
1066
  }];
165
- readonly outputs: readonly [{
166
- readonly type: "bytes32";
1067
+ }, {
1068
+ readonly name: "SetFeeSetter";
1069
+ readonly type: "event";
1070
+ readonly inputs: readonly [{
1071
+ readonly type: "address";
1072
+ readonly name: "feeSetter";
1073
+ readonly indexed: true;
167
1074
  }];
168
1075
  }, {
169
- readonly name: "withdrawQueueLength";
170
- readonly type: "function";
171
- readonly stateMutability: "view";
172
- readonly inputs: readonly [];
173
- readonly outputs: readonly [{
1076
+ readonly name: "SetObligationTradingFee";
1077
+ readonly type: "event";
1078
+ readonly inputs: readonly [{
1079
+ readonly type: "bytes32";
1080
+ readonly name: "id";
1081
+ readonly indexed: true;
1082
+ }, {
1083
+ readonly type: "uint256";
1084
+ readonly name: "index";
1085
+ readonly indexed: true;
1086
+ }, {
174
1087
  readonly type: "uint256";
1088
+ readonly name: "newTradingFee";
175
1089
  }];
176
- }];
177
- type MetaMorpho = typeof MetaMorpho;
178
- //#endregion
179
- //#region src/core/Abi/MetaMorphoFactory.d.ts
180
- declare const MetaMorphoFactory: readonly [{
181
- readonly name: "CreateMetaMorpho";
1090
+ }, {
1091
+ readonly name: "SetOwner";
182
1092
  readonly type: "event";
183
1093
  readonly inputs: readonly [{
184
1094
  readonly type: "address";
185
- readonly name: "metaMorpho";
1095
+ readonly name: "owner";
1096
+ readonly indexed: true;
1097
+ }];
1098
+ }, {
1099
+ readonly name: "SetTradingFeeRecipient";
1100
+ readonly type: "event";
1101
+ readonly inputs: readonly [{
1102
+ readonly type: "address";
1103
+ readonly name: "recipient";
1104
+ readonly indexed: true;
1105
+ }];
1106
+ }, {
1107
+ readonly name: "ShuffleSession";
1108
+ readonly type: "event";
1109
+ readonly inputs: readonly [{
1110
+ readonly type: "address";
1111
+ readonly name: "user";
186
1112
  readonly indexed: true;
187
1113
  }, {
1114
+ readonly type: "bytes32";
1115
+ readonly name: "session";
1116
+ }];
1117
+ }, {
1118
+ readonly name: "SupplyCollateral";
1119
+ readonly type: "event";
1120
+ readonly inputs: readonly [{
188
1121
  readonly type: "address";
189
1122
  readonly name: "caller";
1123
+ }, {
1124
+ readonly type: "bytes32";
1125
+ readonly name: "id";
190
1126
  readonly indexed: true;
191
1127
  }, {
192
1128
  readonly type: "address";
193
- readonly name: "initialOwner";
1129
+ readonly name: "collateral";
1130
+ readonly indexed: true;
194
1131
  }, {
195
1132
  readonly type: "uint256";
196
- readonly name: "initialTimelock";
1133
+ readonly name: "assets";
197
1134
  }, {
198
1135
  readonly type: "address";
199
- readonly name: "asset";
1136
+ readonly name: "onBehalf";
200
1137
  readonly indexed: true;
1138
+ }];
1139
+ }, {
1140
+ readonly name: "Take";
1141
+ readonly type: "event";
1142
+ readonly inputs: readonly [{
1143
+ readonly type: "address";
1144
+ readonly name: "caller";
201
1145
  }, {
202
- readonly type: "string";
203
- readonly name: "name";
1146
+ readonly type: "bytes32";
1147
+ readonly name: "id";
1148
+ readonly indexed: true;
204
1149
  }, {
205
- readonly type: "string";
206
- readonly name: "symbol";
1150
+ readonly type: "address";
1151
+ readonly name: "maker";
1152
+ readonly indexed: true;
1153
+ }, {
1154
+ readonly type: "address";
1155
+ readonly name: "taker";
1156
+ readonly indexed: true;
1157
+ }, {
1158
+ readonly type: "bool";
1159
+ readonly name: "offerIsBuy";
1160
+ }, {
1161
+ readonly type: "uint256";
1162
+ readonly name: "buyerAssets";
1163
+ }, {
1164
+ readonly type: "uint256";
1165
+ readonly name: "sellerAssets";
1166
+ }, {
1167
+ readonly type: "uint256";
1168
+ readonly name: "obligationUnits";
1169
+ }, {
1170
+ readonly type: "uint256";
1171
+ readonly name: "obligationShares";
1172
+ }, {
1173
+ readonly type: "bool";
1174
+ readonly name: "buyerIsLender";
1175
+ }, {
1176
+ readonly type: "bool";
1177
+ readonly name: "sellerIsBorrower";
207
1178
  }, {
208
1179
  readonly type: "bytes32";
209
- readonly name: "salt";
1180
+ readonly name: "group";
1181
+ }, {
1182
+ readonly type: "uint256";
1183
+ readonly name: "consumed";
210
1184
  }];
211
1185
  }, {
212
- readonly name: "isMetaMorpho";
213
- readonly type: "function";
214
- readonly stateMutability: "view";
1186
+ readonly name: "Withdraw";
1187
+ readonly type: "event";
215
1188
  readonly inputs: readonly [{
216
1189
  readonly type: "address";
1190
+ readonly name: "caller";
1191
+ readonly indexed: true;
1192
+ }, {
1193
+ readonly type: "bytes32";
1194
+ readonly name: "id";
1195
+ readonly indexed: true;
1196
+ }, {
1197
+ readonly type: "uint256";
1198
+ readonly name: "obligationUnits";
1199
+ }, {
1200
+ readonly type: "uint256";
1201
+ readonly name: "shares";
1202
+ }, {
1203
+ readonly type: "address";
1204
+ readonly name: "onBehalf";
1205
+ readonly indexed: true;
217
1206
  }];
218
- readonly outputs: readonly [{
219
- readonly type: "bool";
1207
+ }, {
1208
+ readonly name: "WithdrawCollateral";
1209
+ readonly type: "event";
1210
+ readonly inputs: readonly [{
1211
+ readonly type: "address";
1212
+ readonly name: "caller";
1213
+ }, {
1214
+ readonly type: "bytes32";
1215
+ readonly name: "id";
1216
+ readonly indexed: true;
1217
+ }, {
1218
+ readonly type: "address";
1219
+ readonly name: "collateral";
1220
+ readonly indexed: true;
1221
+ }, {
1222
+ readonly type: "uint256";
1223
+ readonly name: "assets";
1224
+ }, {
1225
+ readonly type: "address";
1226
+ readonly name: "onBehalf";
1227
+ readonly indexed: true;
220
1228
  }];
221
1229
  }];
222
- type MetaMorphoFactory = typeof MetaMorphoFactory;
1230
+ type MorphoV2 = typeof MorphoV2;
223
1231
  declare namespace index_d_exports {
224
- export { ERC4626, MetaMorpho, MetaMorphoFactory, Morpho, Oracle$1 as Oracle };
1232
+ export { ERC4626, MetaMorpho, MetaMorphoFactory, Morpho, MorphoV2, Oracle$1 as Oracle };
225
1233
  }
226
1234
  declare const Oracle$1: readonly [{
227
1235
  readonly type: "function";
@@ -936,8 +1944,8 @@ type Offer = {
936
1944
  /** The address that made the offer. */readonly maker: Address; /** The amount of assets offered. Mutually exclusive with obligationUnits and obligationShares. */
937
1945
  readonly assets: bigint; /** The max debt units to trade. Mutually exclusive with assets and obligationShares. */
938
1946
  readonly obligationUnits: bigint; /** The max lending shares to trade. Mutually exclusive with assets and obligationUnits. */
939
- readonly obligationShares: bigint; /** The price (18 decimals). */
940
- readonly price: bigint; /** The date at which all interests will be paid. */
1947
+ readonly obligationShares: bigint; /** The offer tick. */
1948
+ readonly tick: number; /** The date at which all interests will be paid. */
941
1949
  readonly maturity: Maturity; /** The date at which the offer will expire. */
942
1950
  readonly expiry: number; /** The date at which the offer will start. */
943
1951
  readonly start: number; /** The group. Used for OCO (One-Cancelled-Other) mechanism. */
@@ -965,7 +1973,7 @@ declare const OfferSchema: () => z$1.ZodObject<{
965
1973
  assets: z$1.ZodBigInt;
966
1974
  obligationUnits: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodBigInt>>;
967
1975
  obligationShares: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodBigInt>>;
968
- price: z$1.ZodBigInt;
1976
+ tick: z$1.ZodCoercedNumber<unknown>;
969
1977
  maturity: z$1.ZodPipe<z$1.ZodNumber, z$1.ZodTransform<Maturity, number>>;
970
1978
  expiry: z$1.ZodNumber;
971
1979
  start: z$1.ZodNumber;
@@ -1040,7 +2048,7 @@ declare const serialize: (offer: Offer) => {
1040
2048
  assets: string;
1041
2049
  obligationUnits: string;
1042
2050
  obligationShares: string;
1043
- price: string;
2051
+ tick: number;
1044
2052
  maturity: number;
1045
2053
  expiry: number;
1046
2054
  start: number;
@@ -1075,7 +2083,7 @@ type RandomConfig = {
1075
2083
  expiry?: number;
1076
2084
  group?: Hex | bigint | number | string;
1077
2085
  session?: Hex | bigint | number | string;
1078
- price?: bigint;
2086
+ tick?: number;
1079
2087
  callback?: {
1080
2088
  address: Address;
1081
2089
  data: Hex;
@@ -1124,7 +2132,7 @@ declare const types: {
1124
2132
  readonly name: "obligationShares";
1125
2133
  readonly type: "uint256";
1126
2134
  }, {
1127
- readonly name: "price";
2135
+ readonly name: "tick";
1128
2136
  readonly type: "uint256";
1129
2137
  }, {
1130
2138
  readonly name: "maturity";
@@ -1520,6 +2528,41 @@ declare class InvalidQuoteError extends BaseError<z$1.ZodError | Error> {
1520
2528
  readonly name = "Quote.InvalidQuoteError";
1521
2529
  constructor(error: z$1.ZodError | Error);
1522
2530
  }
2531
+ declare namespace Tick_d_exports {
2532
+ export { InvalidPriceError, InvalidTickError, MAX_PRICE, TICK_RANGE, priceToTick, tickToPrice };
2533
+ }
2534
+ /** Tick domain supported by Morpho V2. */
2535
+ declare const TICK_RANGE = 990;
2536
+ /** Max allowed price (1e18 in wad). */
2537
+ declare const MAX_PRICE: bigint;
2538
+ /**
2539
+ * Converts a tick to a wad price using the same approximation and rounding as TickLib.
2540
+ * @param tick - Tick value in the inclusive range [0, 990].
2541
+ * @returns The price in wad units.
2542
+ * @throws {@link InvalidTickError} If tick is not an integer in range [0, 990].
2543
+ */
2544
+ declare function tickToPrice(tick: number): bigint;
2545
+ declare namespace tickToPrice {
2546
+ type ErrorType = InvalidTickError;
2547
+ }
2548
+ /**
2549
+ * Returns the lowest tick with a higher-or-equal price.
2550
+ * @param price - Price in wad units.
2551
+ * @returns The first tick whose {@link tickToPrice} is greater than or equal to `price`.
2552
+ * @throws {@link InvalidPriceError} If price is outside [0, 1e18].
2553
+ */
2554
+ declare function priceToTick(price: bigint): number;
2555
+ declare namespace priceToTick {
2556
+ type ErrorType = InvalidPriceError;
2557
+ }
2558
+ declare class InvalidTickError extends BaseError {
2559
+ readonly name = "Tick.InvalidTickError";
2560
+ constructor(tick: number);
2561
+ }
2562
+ declare class InvalidPriceError extends BaseError {
2563
+ readonly name = "Tick.InvalidPriceError";
2564
+ constructor(price: bigint);
2565
+ }
1523
2566
  declare namespace TradingFee_d_exports {
1524
2567
  export { BREAKPOINTS, Fees, InvalidFeeError, InvalidFeesLengthError, TradingFee, WAD, activate, compute, deactivate, from$6 as from, getFees, isActivated };
1525
2568
  }
@@ -1836,13 +2879,13 @@ interface paths {
1836
2879
  };
1837
2880
  /**
1838
2881
  * Get aggregated book
1839
- * @description Returns aggregated book data for a given obligation and side. Offers are grouped by computed price with summed takeable amounts. Book levels are sorted by price (ascending for buy side, descending for sell side).
2882
+ * @description Returns aggregated book data for a given obligation and side. Offers are grouped by tick with summed takeable amounts, and each level includes the corresponding wad-scaled price. Book levels are sorted by tick (ascending for sell side, descending for buy side).
1840
2883
  */
1841
2884
  get: {
1842
2885
  parameters: {
1843
2886
  query?: {
1844
2887
  /**
1845
- * @description Maximum number of price levels to return.
2888
+ * @description Maximum number of tick levels to return.
1846
2889
  * @example 10
1847
2890
  */
1848
2891
  limit?: number;
@@ -1958,7 +3001,7 @@ interface paths {
1958
3001
  };
1959
3002
  /**
1960
3003
  * Get config rules
1961
- * @description Returns configured rules (maturities, loan tokens, oracles) for supported chains.
3004
+ * @description Returns configured rules (maturities, loan tokens, collateral tokens, oracles) for supported chains.
1962
3005
  */
1963
3006
  get: {
1964
3007
  parameters: {
@@ -1970,7 +3013,7 @@ interface paths {
1970
3013
  chains?: number[];
1971
3014
  /**
1972
3015
  * @description Filter by rule types (comma-separated).
1973
- * @example maturity,loan_token,oracle
3016
+ * @example maturity,loan_token,collateral_token,oracle
1974
3017
  */
1975
3018
  types?: string[];
1976
3019
  /**
@@ -2350,7 +3393,7 @@ interface paths {
2350
3393
  };
2351
3394
  /**
2352
3395
  * Get user positions
2353
- * @description Returns positions for a user with reserved balance. The reserved balance is the amount locked by active offers (max lot upper - offset - consumed).
3396
+ * @description Returns positions for a user with reserved balance per obligation. Each (position, obligation) pair is returned as a separate row. Positions with no lots return a single row with obligation_id = null and reserved = 0.
2354
3397
  */
2355
3398
  get: {
2356
3399
  parameters: {
@@ -2459,14 +3502,19 @@ interface components {
2459
3502
  schemas: {
2460
3503
  BookListResponse: {
2461
3504
  meta: components["schemas"]["Meta"]; /** @example eyJvZmZzZXQiOjEwMH0 */
2462
- cursor: string | null; /** @description Aggregated book levels grouped by computed price. */
3505
+ cursor: string | null; /** @description Aggregated book levels grouped by offer tick. */
2463
3506
  data: components["schemas"]["BookLevelResponse"][];
2464
3507
  };
2465
3508
  Meta: {
2466
3509
  /** @example 2024-01-01T12:00:00.000Z */timestamp: string;
2467
3510
  };
2468
3511
  BookLevelResponse: {
2469
- /** @example 2750000000000000000 */price: string; /** @example 369216000000000000000000 */
3512
+ /** @example 495 */tick: number;
3513
+ /**
3514
+ * @description Price derived from tick, scaled by 1e18.
3515
+ * @example 500000000000000000
3516
+ */
3517
+ price: string; /** @example 369216000000000000000000 */
2470
3518
  assets: string; /** @example 5 */
2471
3519
  count: number;
2472
3520
  };
@@ -2543,6 +3591,11 @@ interface components {
2543
3591
  * "address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
2544
3592
  * },
2545
3593
  * {
3594
+ * "type": "collateral_token",
3595
+ * "chain_id": 1,
3596
+ * "address": "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0"
3597
+ * },
3598
+ * {
2546
3599
  * "type": "oracle",
2547
3600
  * "chain_id": 1,
2548
3601
  * "address": "0xDddd770BADd886dF3864029e4B377B5F6a2B6b83"
@@ -2592,7 +3645,7 @@ interface components {
2592
3645
  * "obligation_shares": "0",
2593
3646
  * "start": 1761922790,
2594
3647
  * "expiry": 1761922799,
2595
- * "price": "2750000000000000000",
3648
+ * "tick": 495,
2596
3649
  * "group": "0x000000000000000000000000000000000000000000000000000000000008b8f4",
2597
3650
  * "session": "0x0000000000000000000000000000000000000000000000000000000000000000",
2598
3651
  * "callback": "0x0000000000000000000000000000000000000000",
@@ -2636,7 +3689,7 @@ interface components {
2636
3689
  * "obligation_shares": "0",
2637
3690
  * "start": 1761922790,
2638
3691
  * "expiry": 1761922799,
2639
- * "price": "2750000000000000000",
3692
+ * "tick": 495,
2640
3693
  * "group": "0x000000000000000000000000000000000000000000000000000000000008b8f4",
2641
3694
  * "session": "0x0000000000000000000000000000000000000000000000000000000000000000",
2642
3695
  * "callback": "0x0000000000000000000000000000000000000000",
@@ -2681,8 +3734,8 @@ interface components {
2681
3734
  obligation_units: string; /** @example 0 */
2682
3735
  obligation_shares: string; /** @example 1761922790 */
2683
3736
  start: number; /** @example 1761922799 */
2684
- expiry: number; /** @example 2750000000000000000 */
2685
- price: string; /** @example 0x000000000000000000000000000000000000000000000000000000000008b8f4 */
3737
+ expiry: number; /** @example 495 */
3738
+ tick: number; /** @example 0x000000000000000000000000000000000000000000000000000000000008b8f4 */
2686
3739
  group: string; /** @example 0x0000000000000000000000000000000000000000000000000000000000000000 */
2687
3740
  session: string; /** @example 0x0000000000000000000000000000000000000000 */
2688
3741
  callback: string; /** @example 0x */
@@ -2831,6 +3884,7 @@ interface components {
2831
3884
  * "chain_id": 1,
2832
3885
  * "contract": "0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078",
2833
3886
  * "user": "0x7b093658BE7f90B63D7c359e8f408e503c2D9401",
3887
+ * "obligation_id": "0x12590ae1aee324a005be565f3bcdd16dbf8daf7969b26c181c8b8f467dad9f67",
2834
3888
  * "reserved": "200000000000000000000",
2835
3889
  * "block_number": 21345678
2836
3890
  * }
@@ -2841,7 +3895,12 @@ interface components {
2841
3895
  PositionListItemResponse: {
2842
3896
  /** @example 1 */chain_id: number; /** @example 0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078 */
2843
3897
  contract: string; /** @example 0x7b093658BE7f90B63D7c359e8f408e503c2D9401 */
2844
- user: string; /** @example 200000000000000000000 */
3898
+ user: string;
3899
+ /**
3900
+ * @description Obligation id this reserved amount belongs to, or null if no lots exist.
3901
+ * @example 0x12590ae1aee324a005be565f3bcdd16dbf8daf7969b26c181c8b8f467dad9f67
3902
+ */
3903
+ obligation_id: string | null; /** @example 200000000000000000000 */
2845
3904
  reserved: string; /** @example 21345678 */
2846
3905
  block_number: number;
2847
3906
  };
@@ -2852,8 +3911,8 @@ interface components {
2852
3911
  /** @example 0x7b093658BE7f90B63D7c359e8f408e503c2D9401 */maker: string; /** @example 369216000000000000000000 */
2853
3912
  assets: string; /** @example 0 */
2854
3913
  obligation_units?: string; /** @example 0 */
2855
- obligation_shares?: string; /** @example 2750000000000000000 */
2856
- price: string; /** @example 1761922799 */
3914
+ obligation_shares?: string; /** @example 495 */
3915
+ tick: number; /** @example 1761922799 */
2857
3916
  maturity: number; /** @example 1761922799 */
2858
3917
  expiry: number; /** @example 1761922790 */
2859
3918
  start: number; /** @example 0x000000000000000000000000000000000000000000000000000000000008b8f4 */
@@ -2934,7 +3993,7 @@ type Input = Readonly<{
2934
3993
  assets: bigint;
2935
3994
  obligationUnits: bigint;
2936
3995
  obligationShares: bigint;
2937
- price: bigint;
3996
+ tick: number;
2938
3997
  maturity: number;
2939
3998
  expiry: number;
2940
3999
  start: number;
@@ -3010,7 +4069,8 @@ declare namespace getByUser {
3010
4069
  chainId: Id;
3011
4070
  contract: Address;
3012
4071
  user: Address;
3013
- blockNumber: number; /** The amount reserved by active offers: max(lot.upper) - offset - consumed */
4072
+ blockNumber: number; /** The obligation this reserved amount belongs to, or null if no lots exist */
4073
+ obligationId: string | null; /** The amount reserved by active offers: max(lot.upper) - offset - consumed */
3014
4074
  reserved: bigint;
3015
4075
  };
3016
4076
  type ReturnType = {
@@ -3025,6 +4085,7 @@ type PositionResponse = {
3025
4085
  chain_id: Id;
3026
4086
  contract: Address;
3027
4087
  user: Address;
4088
+ obligation_id: string | null;
3028
4089
  reserved: string;
3029
4090
  block_number: number;
3030
4091
  };
@@ -3071,10 +4132,11 @@ declare const schemas: {
3071
4132
  cursor: z$1.ZodOptional<z$1.ZodString>;
3072
4133
  limit: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodPipe<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<number, string>>, z$1.ZodNumber>>>;
3073
4134
  types: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodTransform<{} | null | undefined, unknown>, z$1.ZodArray<z$1.ZodEnum<{
4135
+ oracle: "oracle";
3074
4136
  maturity: "maturity";
3075
4137
  callback: "callback";
3076
4138
  loan_token: "loan_token";
3077
- oracle: "oracle";
4139
+ collateral_token: "collateral_token";
3078
4140
  }>>>>;
3079
4141
  chains: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodTransform<{} | null | undefined, unknown>, z$1.ZodArray<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<number, string>>>>>;
3080
4142
  }, z$1.core.$strip>;
@@ -3347,6 +4409,10 @@ type ConfigRule = {
3347
4409
  type: "loan_token";
3348
4410
  chain_id: Id;
3349
4411
  address: Address;
4412
+ } | {
4413
+ type: "collateral_token";
4414
+ chain_id: Id;
4415
+ address: Address;
3350
4416
  } | {
3351
4417
  type: "oracle";
3352
4418
  chain_id: Id;
@@ -3434,9 +4500,9 @@ type GatekeeperParameters = {
3434
4500
  declare function create(parameters: GatekeeperParameters): Gatekeeper;
3435
4501
  //#endregion
3436
4502
  //#region src/gatekeeper/morphoRules.d.ts
3437
- declare const morphoRules: (chains: Chain$1[]) => (Rule<Offer, "mixed_maker"> | Rule<Offer, "amount_mutual_exclusivity"> | Rule<Offer, "chain_ids"> | Rule<Offer, "maturity"> | Rule<Offer, "callback"> | Rule<Offer, "token"> | Rule<Offer, "oracle">)[];
4503
+ declare const morphoRules: (chains: Chain$1[]) => (Rule<Offer, "mixed_maker"> | Rule<Offer, "amount_mutual_exclusivity"> | Rule<Offer, "chain_ids"> | Rule<Offer, "maturity"> | Rule<Offer, "callback"> | Rule<Offer, "loan_token"> | Rule<Offer, "collateral_token"> | Rule<Offer, "oracle">)[];
3438
4504
  declare namespace Rules_d_exports {
3439
- export { ValidityParameters, amountMutualExclusivity, callback, chains, maturity, oracle, sameMaker, token, validity };
4505
+ export { ValidityParameters, amountMutualExclusivity, callback, chains, collateralToken, loanToken, maturity, oracle, sameMaker, validity };
3440
4506
  }
3441
4507
  type ValidityParameters = {
3442
4508
  client: PublicClient<Transport, Chain$1>;
@@ -3465,15 +4531,25 @@ declare const callback: ({
3465
4531
  allowedAddresses: Address[];
3466
4532
  }) => Rule<Offer, "callback">;
3467
4533
  /**
3468
- * A validation rule that checks if the offer's tokens are allowed for its chain.
3469
- * @param assetsByChainId - Allowed assets indexed by chain id.
4534
+ * A validation rule that checks if the offer's loan token is allowed for its chain.
4535
+ * @param assetsByChainId - Allowed loan tokens indexed by chain id.
3470
4536
  * @returns The issue that was found. If the offer is valid, this will be undefined.
3471
4537
  */
3472
- declare const token: ({
4538
+ declare const loanToken: ({
3473
4539
  assetsByChainId
3474
4540
  }: {
3475
4541
  assetsByChainId: Partial<Record<Id, Address[]>>;
3476
- }) => Rule<Offer, "token">;
4542
+ }) => Rule<Offer, "loan_token">;
4543
+ /**
4544
+ * A validation rule that checks if the offer's collateral tokens are allowed for its chain.
4545
+ * @param collateralAssetsByChainId - Allowed collateral tokens indexed by chain id.
4546
+ * @returns The issue that was found. If the offer is valid, this will be undefined.
4547
+ */
4548
+ declare const collateralToken: ({
4549
+ collateralAssetsByChainId
4550
+ }: {
4551
+ collateralAssetsByChainId: Partial<Record<Id, Address[]>>;
4552
+ }) => Rule<Offer, "collateral_token">;
3477
4553
  /**
3478
4554
  * A validation rule that checks if the offer's oracle addresses are allowed for its chain.
3479
4555
  * @param oraclesByChainId - Allowed oracles indexed by chain id.
@@ -3688,5 +4764,5 @@ declare namespace index_d_exports$2 {
3688
4764
  export { BaseError, GlobalErrorType, Group_d_exports as Group, Random_d_exports as Random, ReorgError, Snake, time_d_exports as Time, atMostOneNonZero, batch, batchMulticall, fromSnakeCase$3 as fromSnakeCase, lazy, max$1 as max, min, poll, retry, stringifyBigint, toSnakeCase$1 as toSnakeCase, wait };
3689
4765
  }
3690
4766
  //#endregion
3691
- export { index_d_exports as Abi, Brand, BrandTypeId, Callback_d_exports as Callback, Chain_d_exports as Chain, ChainRegistry_d_exports as ChainRegistry, Collateral_d_exports as Collateral, Compute, ConfigRule, ConfigRulesPayload, ERC4626_d_exports as ERC4626, ErrorPayload, Errors_d_exports as Errors, Format_d_exports as Format, Gatekeeper_d_exports as Gatekeeper, Client_d_exports as GatekeeperClient, LLTV_d_exports as LLTV, Liquidity_d_exports as Liquidity, Maturity_d_exports as Maturity, MempoolClient_d_exports as Mempool, Obligation_d_exports as Obligation, Offer_d_exports as Offer, Oracle_d_exports as Oracle, Position_d_exports as Position, Quote_d_exports as Quote, index_d_exports$1 as RouterApi, Client_d_exports$1 as RouterClient, Rules_d_exports as Rules, SuccessPayload, time_d_exports as Time, TradingFee_d_exports as TradingFee, Transfer_d_exports as Transfer, Tree_d_exports as Tree, index_d_exports$2 as Utils, ValidateOffersData, ValidateOffersIssues, ValidateOffersSuccess, Gate_d_exports as Validation, ValidationIssue, morphoRules };
4767
+ export { index_d_exports as Abi, Brand, BrandTypeId, Callback_d_exports as Callback, Chain_d_exports as Chain, ChainRegistry_d_exports as ChainRegistry, Collateral_d_exports as Collateral, Compute, ConfigRule, ConfigRulesPayload, ERC4626_d_exports as ERC4626, ErrorPayload, Errors_d_exports as Errors, Format_d_exports as Format, Gatekeeper_d_exports as Gatekeeper, Client_d_exports as GatekeeperClient, LLTV_d_exports as LLTV, Liquidity_d_exports as Liquidity, Maturity_d_exports as Maturity, MempoolClient_d_exports as Mempool, Obligation_d_exports as Obligation, Offer_d_exports as Offer, Oracle_d_exports as Oracle, Position_d_exports as Position, Quote_d_exports as Quote, index_d_exports$1 as RouterApi, Client_d_exports$1 as RouterClient, Rules_d_exports as Rules, SuccessPayload, Tick_d_exports as Tick, time_d_exports as Time, TradingFee_d_exports as TradingFee, Transfer_d_exports as Transfer, Tree_d_exports as Tree, index_d_exports$2 as Utils, ValidateOffersData, ValidateOffersIssues, ValidateOffersSuccess, Gate_d_exports as Validation, ValidationIssue, morphoRules };
3692
4768
  //# sourceMappingURL=index.browser.d.mts.map