@morpho-dev/router 0.10.0 → 0.12.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 (60) hide show
  1. package/README.md +20 -5
  2. package/dist/cli.js +14944 -8994
  3. package/dist/drizzle/migrations/0031_sell-takeable-reindex.sql +254 -0
  4. package/dist/drizzle/migrations/0032_callback-type.sql +3 -0
  5. package/dist/drizzle/migrations/0033_obligation-id-bytes20.sql +255 -0
  6. package/dist/drizzle/migrations/0034_chain-checkpoints.sql +1 -0
  7. package/dist/drizzle/migrations/0035_chain-tip-hash-cas.sql +1 -0
  8. package/dist/drizzle/migrations/0036_pending-links.sql +22 -0
  9. package/dist/drizzle/migrations/0037_chain-finalized-anchor.sql +2 -0
  10. package/dist/drizzle/migrations/0038_add-obligation-rcf-threshold.sql +2 -0
  11. package/dist/drizzle/migrations/0039_add-offers-composite-indexes.sql +2 -0
  12. package/dist/drizzle/migrations/0040_drop-redundant-offers-indexes.sql +2 -0
  13. package/dist/drizzle/migrations/0041_add-group-winner-expression-index.sql +10 -0
  14. package/dist/drizzle/migrations/0042_contract-sync-v1.14.sql +284 -0
  15. package/dist/drizzle/migrations/0043_add-obligation-side-tick-index.sql +1 -0
  16. package/dist/drizzle/migrations/0044_index-audit-cleanup.sql +27 -0
  17. package/dist/drizzle/migrations/0045_add-lots-offsets-availability-indexes.sql +5 -0
  18. package/dist/drizzle/migrations/0046_add-offers-active-tick-index.sql +1 -0
  19. package/dist/drizzle/migrations/0047_add-offers-book-winners-index.sql +1 -0
  20. package/dist/drizzle/migrations/0048_covering-indexes-for-winners-queries.sql +34 -0
  21. package/dist/drizzle/migrations/0049_contract-sync-v1.15.sql +305 -0
  22. package/dist/drizzle/migrations/meta/0031_snapshot.json +1652 -0
  23. package/dist/drizzle/migrations/meta/0033_snapshot.json +1658 -0
  24. package/dist/drizzle/migrations/meta/0036_snapshot.json +1864 -0
  25. package/dist/drizzle/migrations/meta/0037_snapshot.json +1876 -0
  26. package/dist/drizzle/migrations/meta/0038_snapshot.json +1882 -0
  27. package/dist/drizzle/migrations/meta/0039_snapshot.json +1960 -0
  28. package/dist/drizzle/migrations/meta/0040_snapshot.json +1912 -0
  29. package/dist/drizzle/migrations/meta/0041_snapshot.json +1912 -0
  30. package/dist/drizzle/migrations/meta/0042_snapshot.json +1882 -0
  31. package/dist/drizzle/migrations/meta/0043_snapshot.json +1909 -0
  32. package/dist/drizzle/migrations/meta/0044_snapshot.json +1853 -0
  33. package/dist/drizzle/migrations/meta/0045_snapshot.json +1921 -0
  34. package/dist/drizzle/migrations/meta/0046_snapshot.json +1966 -0
  35. package/dist/drizzle/migrations/meta/0047_snapshot.json +2005 -0
  36. package/dist/drizzle/migrations/meta/0048_snapshot.json +2035 -0
  37. package/dist/drizzle/migrations/meta/0049_snapshot.json +2035 -0
  38. package/dist/drizzle/migrations/meta/_journal.json +133 -0
  39. package/dist/evm/bytecode/morpho.txt +1 -1
  40. package/dist/index.browser.d.mts +784 -282
  41. package/dist/index.browser.d.mts.map +1 -1
  42. package/dist/index.browser.mjs +1516 -675
  43. package/dist/index.browser.mjs.map +1 -1
  44. package/dist/index.node.d.mts +1676 -602
  45. package/dist/index.node.d.mts.map +1 -1
  46. package/dist/index.node.mjs +10121 -5251
  47. package/dist/index.node.mjs.map +1 -1
  48. package/dist/register-otel-hook.js +7 -0
  49. package/dist/server-D4xxddev.js +9573 -0
  50. package/dist/server.js +9617 -0
  51. package/docs/integrator.md +14 -24
  52. package/package.json +36 -29
  53. package/dist/index.browser.d.ts +0 -5007
  54. package/dist/index.browser.d.ts.map +0 -1
  55. package/dist/index.browser.js +0 -5825
  56. package/dist/index.browser.js.map +0 -1
  57. package/dist/index.node.d.ts +0 -8263
  58. package/dist/index.node.d.ts.map +0 -1
  59. package/dist/index.node.js +0 -12566
  60. package/dist/index.node.js.map +0 -1
@@ -5,7 +5,7 @@ import * as z$1 from "zod";
5
5
  import { Client } from "openapi-fetch";
6
6
  import { AbiEvent, Address, ChainContract, ChainFormatters, GetLogsReturnType, Hex, MulticallParameters, PublicClient, Transport, WalletClient } from "viem";
7
7
  import { Chain } from "viem/chains";
8
- import { StandardMerkleTree } from "@openzeppelin/merkle-tree";
8
+ import { SimpleMerkleTree } from "@openzeppelin/merkle-tree";
9
9
  import "@electric-sql/pglite";
10
10
  import "drizzle-orm/node-postgres";
11
11
  import "drizzle-orm/pglite";
@@ -18,12 +18,12 @@ declare namespace BookResponse_d_exports {
18
18
  type BookLevelResponse = {
19
19
  tick: number;
20
20
  price: string;
21
- assets: string;
21
+ obligation_units: string;
22
22
  count: number;
23
23
  };
24
24
  type Input$1 = {
25
25
  tick: number;
26
- assets: bigint;
26
+ obligationUnits: bigint;
27
27
  count: number;
28
28
  };
29
29
  declare function from$15(level: Input$1): BookLevelResponse;
@@ -36,9 +36,9 @@ declare const CollectorHealth: z.ZodObject<{
36
36
  updated_at: z.ZodNullable<z.ZodString>;
37
37
  lag: z.ZodNullable<z.ZodNumber>;
38
38
  status: z.ZodEnum<{
39
- unknown: "unknown";
40
39
  live: "live";
41
40
  lagging: "lagging";
41
+ unknown: "unknown";
42
42
  }>;
43
43
  initialized: z.ZodBoolean;
44
44
  }, z.core.$strip>;
@@ -49,9 +49,9 @@ declare const CollectorsHealthResponse: z.ZodArray<z.ZodObject<{
49
49
  updated_at: z.ZodNullable<z.ZodString>;
50
50
  lag: z.ZodNullable<z.ZodNumber>;
51
51
  status: z.ZodEnum<{
52
- unknown: "unknown";
53
52
  live: "live";
54
53
  lagging: "lagging";
54
+ unknown: "unknown";
55
55
  }>;
56
56
  initialized: z.ZodBoolean;
57
57
  }, z.core.$strip>>;
@@ -229,7 +229,7 @@ declare const MorphoV2: readonly [{
229
229
  readonly stateMutability: "nonpayable";
230
230
  readonly inputs: readonly [];
231
231
  }, {
232
- readonly name: "collateralOf";
232
+ readonly name: "activatedCollaterals";
233
233
  readonly type: "function";
234
234
  readonly stateMutability: "view";
235
235
  readonly inputs: readonly [{
@@ -238,25 +238,27 @@ declare const MorphoV2: readonly [{
238
238
  }, {
239
239
  readonly type: "address";
240
240
  readonly name: "user";
241
- }, {
242
- readonly type: "address";
243
- readonly name: "collateralToken";
244
241
  }];
245
242
  readonly outputs: readonly [{
246
- readonly type: "uint256";
243
+ readonly type: "uint128";
247
244
  }];
248
245
  }, {
249
- readonly name: "consume";
246
+ readonly name: "collateralOf";
250
247
  readonly type: "function";
251
- readonly stateMutability: "nonpayable";
248
+ readonly stateMutability: "view";
252
249
  readonly inputs: readonly [{
253
250
  readonly type: "bytes32";
254
- readonly name: "group";
251
+ readonly name: "id";
252
+ }, {
253
+ readonly type: "address";
254
+ readonly name: "user";
255
255
  }, {
256
256
  readonly type: "uint256";
257
- readonly name: "amount";
257
+ readonly name: "index";
258
+ }];
259
+ readonly outputs: readonly [{
260
+ readonly type: "uint128";
258
261
  }];
259
- readonly outputs: readonly [];
260
262
  }, {
261
263
  readonly name: "consumed";
262
264
  readonly type: "function";
@@ -271,6 +273,34 @@ declare const MorphoV2: readonly [{
271
273
  readonly outputs: readonly [{
272
274
  readonly type: "uint256";
273
275
  }];
276
+ }, {
277
+ readonly name: "creditAfterSlashing";
278
+ readonly type: "function";
279
+ readonly stateMutability: "view";
280
+ readonly inputs: readonly [{
281
+ readonly type: "bytes32";
282
+ readonly name: "id";
283
+ }, {
284
+ readonly type: "address";
285
+ readonly name: "user";
286
+ }];
287
+ readonly outputs: readonly [{
288
+ readonly type: "uint256";
289
+ }];
290
+ }, {
291
+ readonly name: "creditOf";
292
+ readonly type: "function";
293
+ readonly stateMutability: "view";
294
+ readonly inputs: readonly [{
295
+ readonly type: "bytes32";
296
+ readonly name: "id";
297
+ }, {
298
+ readonly type: "address";
299
+ readonly name: "user";
300
+ }];
301
+ readonly outputs: readonly [{
302
+ readonly type: "uint256";
303
+ }];
274
304
  }, {
275
305
  readonly name: "debtOf";
276
306
  readonly type: "function";
@@ -294,7 +324,6 @@ declare const MorphoV2: readonly [{
294
324
  readonly name: "loanToken";
295
325
  }, {
296
326
  readonly type: "uint256";
297
- readonly name: "index";
298
327
  }];
299
328
  readonly outputs: readonly [{
300
329
  readonly type: "uint16";
@@ -316,7 +345,7 @@ declare const MorphoV2: readonly [{
316
345
  readonly name: "id";
317
346
  }];
318
347
  readonly outputs: readonly [{
319
- readonly type: "uint16[6]";
348
+ readonly type: "uint16[7]";
320
349
  }];
321
350
  }, {
322
351
  readonly name: "flashLoan";
@@ -336,6 +365,20 @@ declare const MorphoV2: readonly [{
336
365
  readonly name: "data";
337
366
  }];
338
367
  readonly outputs: readonly [];
368
+ }, {
369
+ readonly name: "isAuthorized";
370
+ readonly type: "function";
371
+ readonly stateMutability: "view";
372
+ readonly inputs: readonly [{
373
+ readonly type: "address";
374
+ readonly name: "authorizer";
375
+ }, {
376
+ readonly type: "address";
377
+ readonly name: "authorized";
378
+ }];
379
+ readonly outputs: readonly [{
380
+ readonly type: "bool";
381
+ }];
339
382
  }, {
340
383
  readonly name: "isHealthy";
341
384
  readonly type: "function";
@@ -353,6 +396,9 @@ declare const MorphoV2: readonly [{
353
396
  }, {
354
397
  readonly type: "uint256";
355
398
  readonly name: "lltv";
399
+ }, {
400
+ readonly type: "uint256";
401
+ readonly name: "maxLif";
356
402
  }, {
357
403
  readonly type: "address";
358
404
  readonly name: "oracle";
@@ -361,6 +407,9 @@ declare const MorphoV2: readonly [{
361
407
  }, {
362
408
  readonly type: "uint256";
363
409
  readonly name: "maturity";
410
+ }, {
411
+ readonly type: "uint256";
412
+ readonly name: "rcfThreshold";
364
413
  }];
365
414
  readonly name: "obligation";
366
415
  }, {
@@ -390,6 +439,9 @@ declare const MorphoV2: readonly [{
390
439
  }, {
391
440
  readonly type: "uint256";
392
441
  readonly name: "lltv";
442
+ }, {
443
+ readonly type: "uint256";
444
+ readonly name: "maxLif";
393
445
  }, {
394
446
  readonly type: "address";
395
447
  readonly name: "oracle";
@@ -398,21 +450,20 @@ declare const MorphoV2: readonly [{
398
450
  }, {
399
451
  readonly type: "uint256";
400
452
  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
453
  }, {
409
454
  readonly type: "uint256";
410
- readonly name: "repaid";
411
- }, {
412
- readonly type: "uint256";
413
- readonly name: "seized";
455
+ readonly name: "rcfThreshold";
414
456
  }];
415
- readonly name: "seizures";
457
+ readonly name: "obligation";
458
+ }, {
459
+ readonly type: "uint256";
460
+ readonly name: "collateralIndex";
461
+ }, {
462
+ readonly type: "uint256";
463
+ readonly name: "seizedAssets";
464
+ }, {
465
+ readonly type: "uint256";
466
+ readonly name: "repaidUnits";
416
467
  }, {
417
468
  readonly type: "address";
418
469
  readonly name: "borrower";
@@ -421,17 +472,67 @@ declare const MorphoV2: readonly [{
421
472
  readonly name: "data";
422
473
  }];
423
474
  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
- }];
475
+ readonly type: "uint256";
476
+ }, {
477
+ readonly type: "uint256";
478
+ }];
479
+ }, {
480
+ readonly name: "maxCollateralPerUser";
481
+ readonly type: "function";
482
+ readonly stateMutability: "view";
483
+ readonly inputs: readonly [{
484
+ readonly type: "address";
485
+ readonly name: "collateralToken";
486
+ }];
487
+ readonly outputs: readonly [{
488
+ readonly type: "uint256";
489
+ }];
490
+ }, {
491
+ readonly name: "maxLif";
492
+ readonly type: "function";
493
+ readonly stateMutability: "pure";
494
+ readonly inputs: readonly [{
495
+ readonly type: "uint256";
496
+ readonly name: "lltv";
497
+ }, {
498
+ readonly type: "uint256";
499
+ readonly name: "cursor";
500
+ }];
501
+ readonly outputs: readonly [{
502
+ readonly type: "uint256";
503
+ }];
504
+ }, {
505
+ readonly name: "maxTakeableAssets";
506
+ readonly type: "function";
507
+ readonly stateMutability: "view";
508
+ readonly inputs: readonly [{
509
+ readonly type: "address";
510
+ readonly name: "loanToken";
511
+ }];
512
+ readonly outputs: readonly [{
513
+ readonly type: "uint256";
514
+ }];
515
+ }, {
516
+ readonly name: "maxTotalUnits";
517
+ readonly type: "function";
518
+ readonly stateMutability: "view";
519
+ readonly inputs: readonly [{
520
+ readonly type: "address";
521
+ readonly name: "loanToken";
522
+ }];
523
+ readonly outputs: readonly [{
524
+ readonly type: "uint128";
525
+ }];
526
+ }, {
527
+ readonly name: "maxTradingFee";
528
+ readonly type: "function";
529
+ readonly stateMutability: "pure";
530
+ readonly inputs: readonly [{
531
+ readonly type: "uint256";
532
+ readonly name: "index";
533
+ }];
534
+ readonly outputs: readonly [{
535
+ readonly type: "uint256";
435
536
  }];
436
537
  }, {
437
538
  readonly name: "multicall";
@@ -464,12 +565,12 @@ declare const MorphoV2: readonly [{
464
565
  readonly outputs: readonly [{
465
566
  readonly type: "uint128";
466
567
  readonly name: "totalUnits";
467
- }, {
468
- readonly type: "uint128";
469
- readonly name: "totalShares";
470
568
  }, {
471
569
  readonly type: "uint256";
472
570
  readonly name: "withdrawable";
571
+ }, {
572
+ readonly type: "uint128";
573
+ readonly name: "lossIndex";
473
574
  }, {
474
575
  readonly type: "bool";
475
576
  readonly name: "created";
@@ -499,6 +600,9 @@ declare const MorphoV2: readonly [{
499
600
  }, {
500
601
  readonly type: "uint256";
501
602
  readonly name: "lltv";
603
+ }, {
604
+ readonly type: "uint256";
605
+ readonly name: "maxLif";
502
606
  }, {
503
607
  readonly type: "address";
504
608
  readonly name: "oracle";
@@ -507,6 +611,9 @@ declare const MorphoV2: readonly [{
507
611
  }, {
508
612
  readonly type: "uint256";
509
613
  readonly name: "maturity";
614
+ }, {
615
+ readonly type: "uint256";
616
+ readonly name: "rcfThreshold";
510
617
  }];
511
618
  readonly name: "obligation";
512
619
  }, {
@@ -528,6 +635,21 @@ declare const MorphoV2: readonly [{
528
635
  readonly outputs: readonly [{
529
636
  readonly type: "bytes32";
530
637
  }];
638
+ }, {
639
+ readonly name: "setConsumed";
640
+ readonly type: "function";
641
+ readonly stateMutability: "nonpayable";
642
+ readonly inputs: readonly [{
643
+ readonly type: "bytes32";
644
+ readonly name: "group";
645
+ }, {
646
+ readonly type: "uint256";
647
+ readonly name: "amount";
648
+ }, {
649
+ readonly type: "address";
650
+ readonly name: "onBehalf";
651
+ }];
652
+ readonly outputs: readonly [];
531
653
  }, {
532
654
  readonly name: "setDefaultTradingFee";
533
655
  readonly type: "function";
@@ -552,6 +674,57 @@ declare const MorphoV2: readonly [{
552
674
  readonly name: "newFeeSetter";
553
675
  }];
554
676
  readonly outputs: readonly [];
677
+ }, {
678
+ readonly name: "setIsAuthorized";
679
+ readonly type: "function";
680
+ readonly stateMutability: "nonpayable";
681
+ readonly inputs: readonly [{
682
+ readonly type: "address";
683
+ readonly name: "onBehalf";
684
+ }, {
685
+ readonly type: "address";
686
+ readonly name: "authorized";
687
+ }, {
688
+ readonly type: "bool";
689
+ readonly name: "newIsAuthorized";
690
+ }];
691
+ readonly outputs: readonly [];
692
+ }, {
693
+ readonly name: "setMaxCollateralPerUser";
694
+ readonly type: "function";
695
+ readonly stateMutability: "nonpayable";
696
+ readonly inputs: readonly [{
697
+ readonly type: "address";
698
+ readonly name: "collateralToken";
699
+ }, {
700
+ readonly type: "uint256";
701
+ readonly name: "newMaxCollateralPerUser";
702
+ }];
703
+ readonly outputs: readonly [];
704
+ }, {
705
+ readonly name: "setMaxTakeableAssets";
706
+ readonly type: "function";
707
+ readonly stateMutability: "nonpayable";
708
+ readonly inputs: readonly [{
709
+ readonly type: "address";
710
+ readonly name: "loanToken";
711
+ }, {
712
+ readonly type: "uint256";
713
+ readonly name: "newMaxTakeableAssets";
714
+ }];
715
+ readonly outputs: readonly [];
716
+ }, {
717
+ readonly name: "setMaxTotalUnits";
718
+ readonly type: "function";
719
+ readonly stateMutability: "nonpayable";
720
+ readonly inputs: readonly [{
721
+ readonly type: "address";
722
+ readonly name: "loanToken";
723
+ }, {
724
+ readonly type: "uint128";
725
+ readonly name: "newMaxTotalUnits";
726
+ }];
727
+ readonly outputs: readonly [];
555
728
  }, {
556
729
  readonly name: "setObligationTradingFee";
557
730
  readonly type: "function";
@@ -586,9 +759,18 @@ declare const MorphoV2: readonly [{
586
759
  }];
587
760
  readonly outputs: readonly [];
588
761
  }, {
589
- readonly name: "sharesOf";
762
+ readonly name: "shuffleSession";
590
763
  readonly type: "function";
591
- readonly stateMutability: "view";
764
+ readonly stateMutability: "nonpayable";
765
+ readonly inputs: readonly [{
766
+ readonly type: "address";
767
+ readonly name: "onBehalf";
768
+ }];
769
+ readonly outputs: readonly [];
770
+ }, {
771
+ readonly name: "slash";
772
+ readonly type: "function";
773
+ readonly stateMutability: "nonpayable";
592
774
  readonly inputs: readonly [{
593
775
  readonly type: "bytes32";
594
776
  readonly name: "id";
@@ -596,14 +778,6 @@ declare const MorphoV2: readonly [{
596
778
  readonly type: "address";
597
779
  readonly name: "user";
598
780
  }];
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
781
  readonly outputs: readonly [];
608
782
  }, {
609
783
  readonly name: "supplyCollateral";
@@ -622,6 +796,9 @@ declare const MorphoV2: readonly [{
622
796
  }, {
623
797
  readonly type: "uint256";
624
798
  readonly name: "lltv";
799
+ }, {
800
+ readonly type: "uint256";
801
+ readonly name: "maxLif";
625
802
  }, {
626
803
  readonly type: "address";
627
804
  readonly name: "oracle";
@@ -630,11 +807,14 @@ declare const MorphoV2: readonly [{
630
807
  }, {
631
808
  readonly type: "uint256";
632
809
  readonly name: "maturity";
810
+ }, {
811
+ readonly type: "uint256";
812
+ readonly name: "rcfThreshold";
633
813
  }];
634
814
  readonly name: "obligation";
635
815
  }, {
636
- readonly type: "address";
637
- readonly name: "collateral";
816
+ readonly type: "uint256";
817
+ readonly name: "collateralIndex";
638
818
  }, {
639
819
  readonly type: "uint256";
640
820
  readonly name: "assets";
@@ -648,17 +828,8 @@ declare const MorphoV2: readonly [{
648
828
  readonly type: "function";
649
829
  readonly stateMutability: "nonpayable";
650
830
  readonly inputs: readonly [{
651
- readonly type: "uint256";
652
- readonly name: "buyerAssets";
653
- }, {
654
- readonly type: "uint256";
655
- readonly name: "sellerAssets";
656
- }, {
657
831
  readonly type: "uint256";
658
832
  readonly name: "obligationUnits";
659
- }, {
660
- readonly type: "uint256";
661
- readonly name: "obligationShares";
662
833
  }, {
663
834
  readonly type: "address";
664
835
  readonly name: "taker";
@@ -686,6 +857,9 @@ declare const MorphoV2: readonly [{
686
857
  }, {
687
858
  readonly type: "uint256";
688
859
  readonly name: "lltv";
860
+ }, {
861
+ readonly type: "uint256";
862
+ readonly name: "maxLif";
689
863
  }, {
690
864
  readonly type: "address";
691
865
  readonly name: "oracle";
@@ -694,6 +868,9 @@ declare const MorphoV2: readonly [{
694
868
  }, {
695
869
  readonly type: "uint256";
696
870
  readonly name: "maturity";
871
+ }, {
872
+ readonly type: "uint256";
873
+ readonly name: "rcfThreshold";
697
874
  }];
698
875
  readonly name: "obligation";
699
876
  }, {
@@ -702,15 +879,9 @@ declare const MorphoV2: readonly [{
702
879
  }, {
703
880
  readonly type: "address";
704
881
  readonly name: "maker";
705
- }, {
706
- readonly type: "uint256";
707
- readonly name: "assets";
708
882
  }, {
709
883
  readonly type: "uint256";
710
884
  readonly name: "obligationUnits";
711
- }, {
712
- readonly type: "uint256";
713
- readonly name: "obligationShares";
714
885
  }, {
715
886
  readonly type: "uint256";
716
887
  readonly name: "start";
@@ -735,6 +906,9 @@ declare const MorphoV2: readonly [{
735
906
  }, {
736
907
  readonly type: "address";
737
908
  readonly name: "receiverIfMakerIsSeller";
909
+ }, {
910
+ readonly type: "bool";
911
+ readonly name: "exitOnly";
738
912
  }];
739
913
  readonly name: "offer";
740
914
  }, {
@@ -763,11 +937,46 @@ declare const MorphoV2: readonly [{
763
937
  readonly type: "uint256";
764
938
  }, {
765
939
  readonly type: "uint256";
766
- }, {
767
- readonly type: "uint256";
768
940
  }];
769
941
  }, {
770
- readonly name: "totalShares";
942
+ readonly name: "toId";
943
+ readonly type: "function";
944
+ readonly stateMutability: "view";
945
+ readonly inputs: readonly [{
946
+ readonly type: "tuple";
947
+ readonly components: readonly [{
948
+ readonly type: "address";
949
+ readonly name: "loanToken";
950
+ }, {
951
+ readonly type: "tuple[]";
952
+ readonly components: readonly [{
953
+ readonly type: "address";
954
+ readonly name: "token";
955
+ }, {
956
+ readonly type: "uint256";
957
+ readonly name: "lltv";
958
+ }, {
959
+ readonly type: "uint256";
960
+ readonly name: "maxLif";
961
+ }, {
962
+ readonly type: "address";
963
+ readonly name: "oracle";
964
+ }];
965
+ readonly name: "collaterals";
966
+ }, {
967
+ readonly type: "uint256";
968
+ readonly name: "maturity";
969
+ }, {
970
+ readonly type: "uint256";
971
+ readonly name: "rcfThreshold";
972
+ }];
973
+ readonly name: "obligation";
974
+ }];
975
+ readonly outputs: readonly [{
976
+ readonly type: "bytes32";
977
+ }];
978
+ }, {
979
+ readonly name: "toObligation";
771
980
  readonly type: "function";
772
981
  readonly stateMutability: "view";
773
982
  readonly inputs: readonly [{
@@ -775,7 +984,33 @@ declare const MorphoV2: readonly [{
775
984
  readonly name: "id";
776
985
  }];
777
986
  readonly outputs: readonly [{
778
- readonly type: "uint256";
987
+ readonly type: "tuple";
988
+ readonly components: readonly [{
989
+ readonly type: "address";
990
+ readonly name: "loanToken";
991
+ }, {
992
+ readonly type: "tuple[]";
993
+ readonly components: readonly [{
994
+ readonly type: "address";
995
+ readonly name: "token";
996
+ }, {
997
+ readonly type: "uint256";
998
+ readonly name: "lltv";
999
+ }, {
1000
+ readonly type: "uint256";
1001
+ readonly name: "maxLif";
1002
+ }, {
1003
+ readonly type: "address";
1004
+ readonly name: "oracle";
1005
+ }];
1006
+ readonly name: "collaterals";
1007
+ }, {
1008
+ readonly type: "uint256";
1009
+ readonly name: "maturity";
1010
+ }, {
1011
+ readonly type: "uint256";
1012
+ readonly name: "rcfThreshold";
1013
+ }];
779
1014
  }];
780
1015
  }, {
781
1016
  readonly name: "totalUnits";
@@ -805,6 +1040,9 @@ declare const MorphoV2: readonly [{
805
1040
  }, {
806
1041
  readonly type: "uint256";
807
1042
  readonly name: "lltv";
1043
+ }, {
1044
+ readonly type: "uint256";
1045
+ readonly name: "maxLif";
808
1046
  }, {
809
1047
  readonly type: "address";
810
1048
  readonly name: "oracle";
@@ -813,6 +1051,9 @@ declare const MorphoV2: readonly [{
813
1051
  }, {
814
1052
  readonly type: "uint256";
815
1053
  readonly name: "maturity";
1054
+ }, {
1055
+ readonly type: "uint256";
1056
+ readonly name: "rcfThreshold";
816
1057
  }];
817
1058
  readonly name: "obligation";
818
1059
  }];
@@ -841,6 +1082,20 @@ declare const MorphoV2: readonly [{
841
1082
  readonly outputs: readonly [{
842
1083
  readonly type: "address";
843
1084
  }];
1085
+ }, {
1086
+ readonly name: "userLossIndex";
1087
+ readonly type: "function";
1088
+ readonly stateMutability: "view";
1089
+ readonly inputs: readonly [{
1090
+ readonly type: "bytes32";
1091
+ readonly name: "id";
1092
+ }, {
1093
+ readonly type: "address";
1094
+ readonly name: "user";
1095
+ }];
1096
+ readonly outputs: readonly [{
1097
+ readonly type: "uint128";
1098
+ }];
844
1099
  }, {
845
1100
  readonly name: "withdraw";
846
1101
  readonly type: "function";
@@ -858,6 +1113,9 @@ declare const MorphoV2: readonly [{
858
1113
  }, {
859
1114
  readonly type: "uint256";
860
1115
  readonly name: "lltv";
1116
+ }, {
1117
+ readonly type: "uint256";
1118
+ readonly name: "maxLif";
861
1119
  }, {
862
1120
  readonly type: "address";
863
1121
  readonly name: "oracle";
@@ -866,14 +1124,14 @@ declare const MorphoV2: readonly [{
866
1124
  }, {
867
1125
  readonly type: "uint256";
868
1126
  readonly name: "maturity";
1127
+ }, {
1128
+ readonly type: "uint256";
1129
+ readonly name: "rcfThreshold";
869
1130
  }];
870
1131
  readonly name: "obligation";
871
1132
  }, {
872
1133
  readonly type: "uint256";
873
1134
  readonly name: "obligationUnits";
874
- }, {
875
- readonly type: "uint256";
876
- readonly name: "shares";
877
1135
  }, {
878
1136
  readonly type: "address";
879
1137
  readonly name: "onBehalf";
@@ -881,11 +1139,7 @@ declare const MorphoV2: readonly [{
881
1139
  readonly type: "address";
882
1140
  readonly name: "receiver";
883
1141
  }];
884
- readonly outputs: readonly [{
885
- readonly type: "uint256";
886
- }, {
887
- readonly type: "uint256";
888
- }];
1142
+ readonly outputs: readonly [];
889
1143
  }, {
890
1144
  readonly name: "withdrawCollateral";
891
1145
  readonly type: "function";
@@ -903,6 +1157,9 @@ declare const MorphoV2: readonly [{
903
1157
  }, {
904
1158
  readonly type: "uint256";
905
1159
  readonly name: "lltv";
1160
+ }, {
1161
+ readonly type: "uint256";
1162
+ readonly name: "maxLif";
906
1163
  }, {
907
1164
  readonly type: "address";
908
1165
  readonly name: "oracle";
@@ -911,11 +1168,14 @@ declare const MorphoV2: readonly [{
911
1168
  }, {
912
1169
  readonly type: "uint256";
913
1170
  readonly name: "maturity";
1171
+ }, {
1172
+ readonly type: "uint256";
1173
+ readonly name: "rcfThreshold";
914
1174
  }];
915
1175
  readonly name: "obligation";
916
1176
  }, {
917
- readonly type: "address";
918
- readonly name: "collateral";
1177
+ readonly type: "uint256";
1178
+ readonly name: "collateralIndex";
919
1179
  }, {
920
1180
  readonly type: "uint256";
921
1181
  readonly name: "assets";
@@ -943,23 +1203,8 @@ declare const MorphoV2: readonly [{
943
1203
  readonly type: "event";
944
1204
  readonly inputs: readonly [{
945
1205
  readonly type: "address";
946
- readonly name: "owner";
947
- readonly indexed: true;
948
- }];
949
- }, {
950
- readonly name: "Consume";
951
- readonly type: "event";
952
- readonly inputs: readonly [{
953
- readonly type: "address";
954
- readonly name: "user";
955
- readonly indexed: true;
956
- }, {
957
- readonly type: "bytes32";
958
- readonly name: "group";
1206
+ readonly name: "owner";
959
1207
  readonly indexed: true;
960
- }, {
961
- readonly type: "uint256";
962
- readonly name: "amount";
963
1208
  }];
964
1209
  }, {
965
1210
  readonly name: "FlashLoan";
@@ -985,38 +1230,34 @@ declare const MorphoV2: readonly [{
985
1230
  readonly indexed: true;
986
1231
  }, {
987
1232
  readonly type: "bytes32";
988
- readonly name: "id";
1233
+ readonly name: "id_";
989
1234
  readonly indexed: true;
990
1235
  }, {
991
- readonly type: "tuple[]";
992
- readonly components: readonly [{
993
- readonly type: "uint256";
994
- readonly name: "collateralIndex";
995
- }, {
996
- readonly type: "uint256";
997
- readonly name: "repaid";
998
- }, {
999
- readonly type: "uint256";
1000
- readonly name: "seized";
1001
- }];
1002
- readonly name: "seizures";
1236
+ readonly type: "uint256";
1237
+ readonly name: "collateralIndex";
1238
+ }, {
1239
+ readonly type: "uint256";
1240
+ readonly name: "seizedAssets";
1241
+ }, {
1242
+ readonly type: "uint256";
1243
+ readonly name: "repaidUnits";
1003
1244
  }, {
1004
1245
  readonly type: "address";
1005
1246
  readonly name: "borrower";
1006
1247
  readonly indexed: true;
1007
1248
  }, {
1008
1249
  readonly type: "uint256";
1009
- readonly name: "totalRepaid";
1250
+ readonly name: "badDebt";
1010
1251
  }, {
1011
1252
  readonly type: "uint256";
1012
- readonly name: "badDebt";
1253
+ readonly name: "latestLossIndex";
1013
1254
  }];
1014
1255
  }, {
1015
1256
  readonly name: "ObligationCreated";
1016
1257
  readonly type: "event";
1017
1258
  readonly inputs: readonly [{
1018
1259
  readonly type: "bytes32";
1019
- readonly name: "id";
1260
+ readonly name: "id_";
1020
1261
  readonly indexed: true;
1021
1262
  }, {
1022
1263
  readonly type: "tuple";
@@ -1031,6 +1272,9 @@ declare const MorphoV2: readonly [{
1031
1272
  }, {
1032
1273
  readonly type: "uint256";
1033
1274
  readonly name: "lltv";
1275
+ }, {
1276
+ readonly type: "uint256";
1277
+ readonly name: "maxLif";
1034
1278
  }, {
1035
1279
  readonly type: "address";
1036
1280
  readonly name: "oracle";
@@ -1039,6 +1283,9 @@ declare const MorphoV2: readonly [{
1039
1283
  }, {
1040
1284
  readonly type: "uint256";
1041
1285
  readonly name: "maturity";
1286
+ }, {
1287
+ readonly type: "uint256";
1288
+ readonly name: "rcfThreshold";
1042
1289
  }];
1043
1290
  readonly name: "obligation";
1044
1291
  }];
@@ -1051,7 +1298,7 @@ declare const MorphoV2: readonly [{
1051
1298
  readonly indexed: true;
1052
1299
  }, {
1053
1300
  readonly type: "bytes32";
1054
- readonly name: "id";
1301
+ readonly name: "id_";
1055
1302
  readonly indexed: true;
1056
1303
  }, {
1057
1304
  readonly type: "uint256";
@@ -1061,6 +1308,25 @@ declare const MorphoV2: readonly [{
1061
1308
  readonly name: "onBehalf";
1062
1309
  readonly indexed: true;
1063
1310
  }];
1311
+ }, {
1312
+ readonly name: "SetConsumed";
1313
+ readonly type: "event";
1314
+ readonly inputs: readonly [{
1315
+ readonly type: "address";
1316
+ readonly name: "caller";
1317
+ readonly indexed: true;
1318
+ }, {
1319
+ readonly type: "address";
1320
+ readonly name: "onBehalf";
1321
+ readonly indexed: true;
1322
+ }, {
1323
+ readonly type: "bytes32";
1324
+ readonly name: "group";
1325
+ readonly indexed: true;
1326
+ }, {
1327
+ readonly type: "uint256";
1328
+ readonly name: "amount";
1329
+ }];
1064
1330
  }, {
1065
1331
  readonly name: "SetDefaultTradingFee";
1066
1332
  readonly type: "event";
@@ -1084,12 +1350,64 @@ declare const MorphoV2: readonly [{
1084
1350
  readonly name: "feeSetter";
1085
1351
  readonly indexed: true;
1086
1352
  }];
1353
+ }, {
1354
+ readonly name: "SetIsAuthorized";
1355
+ readonly type: "event";
1356
+ readonly inputs: readonly [{
1357
+ readonly type: "address";
1358
+ readonly name: "caller";
1359
+ readonly indexed: true;
1360
+ }, {
1361
+ readonly type: "address";
1362
+ readonly name: "onBehalf";
1363
+ readonly indexed: true;
1364
+ }, {
1365
+ readonly type: "address";
1366
+ readonly name: "authorized";
1367
+ readonly indexed: true;
1368
+ }, {
1369
+ readonly type: "bool";
1370
+ readonly name: "newIsAuthorized";
1371
+ }];
1372
+ }, {
1373
+ readonly name: "SetMaxCollateralPerUser";
1374
+ readonly type: "event";
1375
+ readonly inputs: readonly [{
1376
+ readonly type: "address";
1377
+ readonly name: "collateralToken";
1378
+ readonly indexed: true;
1379
+ }, {
1380
+ readonly type: "uint256";
1381
+ readonly name: "maxCollateralPerUser";
1382
+ }];
1383
+ }, {
1384
+ readonly name: "SetMaxTakeableAssets";
1385
+ readonly type: "event";
1386
+ readonly inputs: readonly [{
1387
+ readonly type: "address";
1388
+ readonly name: "loanToken";
1389
+ readonly indexed: true;
1390
+ }, {
1391
+ readonly type: "uint256";
1392
+ readonly name: "maxTakeableAssets";
1393
+ }];
1394
+ }, {
1395
+ readonly name: "SetMaxTotalUnits";
1396
+ readonly type: "event";
1397
+ readonly inputs: readonly [{
1398
+ readonly type: "address";
1399
+ readonly name: "loanToken";
1400
+ readonly indexed: true;
1401
+ }, {
1402
+ readonly type: "uint128";
1403
+ readonly name: "maxTotalUnits";
1404
+ }];
1087
1405
  }, {
1088
1406
  readonly name: "SetObligationTradingFee";
1089
1407
  readonly type: "event";
1090
1408
  readonly inputs: readonly [{
1091
1409
  readonly type: "bytes32";
1092
- readonly name: "id";
1410
+ readonly name: "id_";
1093
1411
  readonly indexed: true;
1094
1412
  }, {
1095
1413
  readonly type: "uint256";
@@ -1120,12 +1438,37 @@ declare const MorphoV2: readonly [{
1120
1438
  readonly type: "event";
1121
1439
  readonly inputs: readonly [{
1122
1440
  readonly type: "address";
1123
- readonly name: "user";
1441
+ readonly name: "caller";
1442
+ readonly indexed: true;
1443
+ }, {
1444
+ readonly type: "address";
1445
+ readonly name: "onBehalf";
1124
1446
  readonly indexed: true;
1125
1447
  }, {
1126
1448
  readonly type: "bytes32";
1127
1449
  readonly name: "session";
1128
1450
  }];
1451
+ }, {
1452
+ readonly name: "Slash";
1453
+ readonly type: "event";
1454
+ readonly inputs: readonly [{
1455
+ readonly type: "address";
1456
+ readonly name: "caller";
1457
+ }, {
1458
+ readonly type: "bytes32";
1459
+ readonly name: "id_";
1460
+ readonly indexed: true;
1461
+ }, {
1462
+ readonly type: "address";
1463
+ readonly name: "user";
1464
+ readonly indexed: true;
1465
+ }, {
1466
+ readonly type: "uint256";
1467
+ readonly name: "credit";
1468
+ }, {
1469
+ readonly type: "uint256";
1470
+ readonly name: "latestLossIndex";
1471
+ }];
1129
1472
  }, {
1130
1473
  readonly name: "SupplyCollateral";
1131
1474
  readonly type: "event";
@@ -1134,7 +1477,7 @@ declare const MorphoV2: readonly [{
1134
1477
  readonly name: "caller";
1135
1478
  }, {
1136
1479
  readonly type: "bytes32";
1137
- readonly name: "id";
1480
+ readonly name: "id_";
1138
1481
  readonly indexed: true;
1139
1482
  }, {
1140
1483
  readonly type: "address";
@@ -1156,7 +1499,7 @@ declare const MorphoV2: readonly [{
1156
1499
  readonly name: "caller";
1157
1500
  }, {
1158
1501
  readonly type: "bytes32";
1159
- readonly name: "id";
1502
+ readonly name: "id_";
1160
1503
  readonly indexed: true;
1161
1504
  }, {
1162
1505
  readonly type: "address";
@@ -1178,15 +1521,6 @@ declare const MorphoV2: readonly [{
1178
1521
  }, {
1179
1522
  readonly type: "uint256";
1180
1523
  readonly name: "obligationUnits";
1181
- }, {
1182
- readonly type: "uint256";
1183
- readonly name: "obligationShares";
1184
- }, {
1185
- readonly type: "bool";
1186
- readonly name: "buyerIsLender";
1187
- }, {
1188
- readonly type: "bool";
1189
- readonly name: "sellerIsBorrower";
1190
1524
  }, {
1191
1525
  readonly type: "address";
1192
1526
  readonly name: "sellerReceiver";
@@ -1196,6 +1530,9 @@ declare const MorphoV2: readonly [{
1196
1530
  }, {
1197
1531
  readonly type: "uint256";
1198
1532
  readonly name: "consumed";
1533
+ }, {
1534
+ readonly type: "uint256";
1535
+ readonly name: "totalUnits";
1199
1536
  }];
1200
1537
  }, {
1201
1538
  readonly name: "Withdraw";
@@ -1205,14 +1542,11 @@ declare const MorphoV2: readonly [{
1205
1542
  readonly name: "caller";
1206
1543
  }, {
1207
1544
  readonly type: "bytes32";
1208
- readonly name: "id";
1545
+ readonly name: "id_";
1209
1546
  readonly indexed: true;
1210
1547
  }, {
1211
1548
  readonly type: "uint256";
1212
1549
  readonly name: "obligationUnits";
1213
- }, {
1214
- readonly type: "uint256";
1215
- readonly name: "shares";
1216
1550
  }, {
1217
1551
  readonly type: "address";
1218
1552
  readonly name: "onBehalf";
@@ -1230,7 +1564,7 @@ declare const MorphoV2: readonly [{
1230
1564
  readonly name: "caller";
1231
1565
  }, {
1232
1566
  readonly type: "bytes32";
1233
- readonly name: "id";
1567
+ readonly name: "id_";
1234
1568
  readonly indexed: true;
1235
1569
  }, {
1236
1570
  readonly type: "address";
@@ -1374,7 +1708,7 @@ declare const Morpho: readonly [{
1374
1708
  readonly stateMutability: "view";
1375
1709
  }];
1376
1710
  declare namespace Callback_d_exports {
1377
- export { Callback, Type$1 as Type, isEmptyCallback };
1711
+ export { Callback, CallbackType, Type$1 as Type, isEmptyCallback };
1378
1712
  }
1379
1713
  type Callback = {
1380
1714
  type: Type$1.BuyWithEmptyCallback;
@@ -1385,6 +1719,9 @@ declare enum Type$1 {
1385
1719
  BuyWithEmptyCallback = "buy_with_empty_callback",
1386
1720
  SellWithEmptyCallback = "sell_with_empty_callback"
1387
1721
  }
1722
+ declare enum CallbackType {
1723
+ Empty = "empty"
1724
+ }
1388
1725
  declare const isEmptyCallback: (offer: Offer) => boolean;
1389
1726
  declare namespace Errors_d_exports {
1390
1727
  export { BaseError, GlobalErrorType, ReorgError };
@@ -1419,7 +1756,7 @@ declare class ReorgError extends BaseError {
1419
1756
  constructor(blockNumber: number);
1420
1757
  }
1421
1758
  declare namespace Chain_d_exports {
1422
- export { Chain$1 as Chain, ChainId, Id, InvalidBatchSizeError, InvalidBlockRangeError, InvalidBlockWindowError, MissingBlockNumberError, Name, chainIds, chainNames, chains, getChain, getWhitelistedChains, streamLogs };
1759
+ export { Chain$1 as Chain, ChainId, Id, InvalidBatchSizeError, InvalidBlockRangeError, InvalidBlockWindowError, MissingBlockNumberError, Name, UnrecoverableLogsResponseSizeError, chainIds, chainNames, chains, getChain, getWhitelistedChains, streamLogs };
1423
1760
  }
1424
1761
  type Chain$1 = Compute<Omit<Chain<ChainFormatters, {
1425
1762
  morpho: ChainContract;
@@ -1478,6 +1815,8 @@ declare function streamLogs<abiEvent extends AbiEvent | undefined = undefined>(p
1478
1815
  }, void, void>;
1479
1816
  declare class InvalidBlockRangeError extends BaseError {
1480
1817
  name: string;
1818
+ readonly fromBlock: bigint;
1819
+ readonly toBlock: bigint;
1481
1820
  constructor(fromBlock: bigint, toBlock: bigint);
1482
1821
  }
1483
1822
  declare class InvalidBlockWindowError extends BaseError {
@@ -1492,6 +1831,10 @@ declare class MissingBlockNumberError extends BaseError {
1492
1831
  name: string;
1493
1832
  constructor();
1494
1833
  }
1834
+ declare class UnrecoverableLogsResponseSizeError extends BaseError<Error> {
1835
+ name: string;
1836
+ constructor(blockNumber: bigint, cause?: unknown);
1837
+ }
1495
1838
  declare namespace ChainRegistry_d_exports {
1496
1839
  export { ChainRegistry, create$1 as create };
1497
1840
  }
@@ -1542,7 +1885,8 @@ declare namespace Collateral_d_exports {
1542
1885
  }
1543
1886
  type Collateral = {
1544
1887
  /** Asset being used as collateral. */asset: Address; /** Liquidation Loan-to-Value of the collateral. */
1545
- lltv: LLTV; /** Oracle contract used to price the collateral. */
1888
+ lltv: LLTV; /** Maximum Liquidation Incentive Factor for this collateral. */
1889
+ maxLif: bigint; /** Oracle contract used to price the collateral. */
1546
1890
  oracle: Address;
1547
1891
  };
1548
1892
  declare const abi$1: readonly [{
@@ -1551,6 +1895,9 @@ declare const abi$1: readonly [{
1551
1895
  }, {
1552
1896
  readonly type: "uint256";
1553
1897
  readonly name: "lltv";
1898
+ }, {
1899
+ readonly type: "uint256";
1900
+ readonly name: "maxLif";
1554
1901
  }, {
1555
1902
  readonly type: "address";
1556
1903
  readonly name: "oracle";
@@ -1559,17 +1906,20 @@ declare const CollateralSchema: z$1.ZodObject<{
1559
1906
  asset: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
1560
1907
  oracle: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
1561
1908
  lltv: z$1.ZodPipe<z$1.ZodBigInt, z$1.ZodTransform<LLTV, bigint>>;
1909
+ maxLif: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodBigInt>>;
1562
1910
  }, z$1.core.$strip>;
1563
1911
  declare const CollateralsSchema: z$1.ZodArray<z$1.ZodObject<{
1564
1912
  asset: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
1565
1913
  oracle: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
1566
1914
  lltv: z$1.ZodPipe<z$1.ZodBigInt, z$1.ZodTransform<LLTV, bigint>>;
1915
+ maxLif: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodBigInt>>;
1567
1916
  }, z$1.core.$strip>>;
1568
1917
  declare const from$13: (parameters: from$13.Parameters) => from$13.ReturnType;
1569
1918
  declare namespace from$13 {
1570
1919
  type Parameters = {
1571
1920
  asset: Address;
1572
1921
  lltv: Options | bigint;
1922
+ maxLif?: bigint;
1573
1923
  oracle: Address;
1574
1924
  };
1575
1925
  type ReturnType = Collateral;
@@ -1749,7 +2099,8 @@ declare namespace Obligation_d_exports {
1749
2099
  type Obligation$1 = {
1750
2100
  /** The token that is being borrowed for this obligation. */loanToken: Address; /** The exact set of collaterals required to borrow the loan token. */
1751
2101
  collaterals: Collateral[]; /** The maturity of the obligation. */
1752
- maturity: Maturity;
2102
+ maturity: Maturity; /** Recovery-close-factor threshold in obligation units. */
2103
+ rcfThreshold: bigint;
1753
2104
  };
1754
2105
  declare const ObligationSchema: z$1.ZodObject<{
1755
2106
  loanToken: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
@@ -1757,8 +2108,10 @@ declare const ObligationSchema: z$1.ZodObject<{
1757
2108
  asset: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
1758
2109
  oracle: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
1759
2110
  lltv: z$1.ZodPipe<z$1.ZodBigInt, z$1.ZodTransform<LLTV, bigint>>;
2111
+ maxLif: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodBigInt>>;
1760
2112
  }, z$1.core.$strip>>;
1761
2113
  maturity: z$1.ZodPipe<z$1.ZodNumber, z$1.ZodTransform<Maturity, number>>;
2114
+ rcfThreshold: z$1.ZodBigInt;
1762
2115
  }, z$1.core.$strip>;
1763
2116
  declare const abi: readonly [{
1764
2117
  readonly type: "address";
@@ -1772,6 +2125,9 @@ declare const abi: readonly [{
1772
2125
  }, {
1773
2126
  readonly type: "uint256";
1774
2127
  readonly name: "lltv";
2128
+ }, {
2129
+ readonly type: "uint256";
2130
+ readonly name: "maxLif";
1775
2131
  }, {
1776
2132
  readonly type: "address";
1777
2133
  readonly name: "oracle";
@@ -1779,6 +2135,9 @@ declare const abi: readonly [{
1779
2135
  }, {
1780
2136
  readonly type: "uint256";
1781
2137
  readonly name: "maturity";
2138
+ }, {
2139
+ readonly type: "uint256";
2140
+ readonly name: "rcfThreshold";
1782
2141
  }];
1783
2142
  declare const tupleAbi: readonly [{
1784
2143
  readonly type: "tuple";
@@ -1794,6 +2153,9 @@ declare const tupleAbi: readonly [{
1794
2153
  }, {
1795
2154
  readonly type: "uint256";
1796
2155
  readonly name: "lltv";
2156
+ }, {
2157
+ readonly type: "uint256";
2158
+ readonly name: "maxLif";
1797
2159
  }, {
1798
2160
  readonly type: "address";
1799
2161
  readonly name: "oracle";
@@ -1801,6 +2163,9 @@ declare const tupleAbi: readonly [{
1801
2163
  }, {
1802
2164
  readonly type: "uint256";
1803
2165
  readonly name: "maturity";
2166
+ }, {
2167
+ readonly type: "uint256";
2168
+ readonly name: "rcfThreshold";
1804
2169
  }];
1805
2170
  }];
1806
2171
  /**
@@ -1822,6 +2187,7 @@ declare const tupleAbi: readonly [{
1822
2187
  * }),
1823
2188
  * ],
1824
2189
  * maturity: Maturity.from("end_of_next_quarter"),
2190
+ * rcfThreshold: 0n,
1825
2191
  * });
1826
2192
  * ```
1827
2193
  */
@@ -1830,7 +2196,8 @@ declare namespace from$11 {
1830
2196
  type Parameters = {
1831
2197
  /** The token that is being borrowed for this obligation. */loanToken: Address; /** The exact set of collaterals required to borrow the loan token. Must be sorted alphabetically by address. */
1832
2198
  collaterals: from$13.Parameters[] | readonly from$13.Parameters[]; /** The maturity of the obligation. */
1833
- maturity: from$12.Parameters;
2199
+ maturity: from$12.Parameters; /** Recovery-close-factor threshold in obligation units. */
2200
+ rcfThreshold: bigint;
1834
2201
  };
1835
2202
  type ReturnType = Obligation$1;
1836
2203
  type ErrorType = InvalidObligationError;
@@ -1843,13 +2210,14 @@ declare namespace from$11 {
1843
2210
  */
1844
2211
  declare function fromSnakeCase$2(input: fromSnakeCase$2.Parameters): fromSnakeCase$2.ReturnType;
1845
2212
  declare namespace fromSnakeCase$2 {
1846
- type Parameters = Snake<Obligation$1>;
2213
+ type SnakeCaseParameters = Obligation$1;
2214
+ type Parameters = Snake<SnakeCaseParameters>;
1847
2215
  type ReturnType = Obligation$1;
1848
2216
  type ErrorType = InvalidObligationError;
1849
2217
  }
1850
2218
  /**
1851
2219
  * Calculates a canonical key for an obligation payload.
1852
- * The key is computed as keccak256(abi.encode(loanToken, collaterals, maturity)).
2220
+ * The key is computed as keccak256(abi.encode(loanToken, collaterals, maturity, rcfThreshold)).
1853
2221
  * @throws If the collaterals are not sorted alphabetically by address. {@link CollateralsAreNotSortedError}
1854
2222
  * @param parameters - {@link key.Parameters}
1855
2223
  * @returns The obligation key as a 32-byte hex string. {@link key.ReturnType}
@@ -1868,9 +2236,11 @@ declare namespace key$1 {
1868
2236
  collaterals: {
1869
2237
  asset: Address;
1870
2238
  lltv: bigint;
2239
+ maxLif?: bigint;
1871
2240
  oracle: Address;
1872
2241
  }[];
1873
2242
  maturity: number;
2243
+ rcfThreshold: bigint;
1874
2244
  };
1875
2245
  type ReturnType = Hex;
1876
2246
  type ErrorType = CollateralsAreNotSortedError;
@@ -1897,7 +2267,6 @@ declare namespace random$2 {
1897
2267
  */
1898
2268
  declare function fromOffer$1(offer: Offer): fromOffer$1.ReturnType;
1899
2269
  declare namespace fromOffer$1 {
1900
- type Parameters = Offer;
1901
2270
  type ReturnType = Obligation$1;
1902
2271
  }
1903
2272
  declare class InvalidObligationError extends BaseError<z$1.ZodError | Error> {
@@ -1915,7 +2284,7 @@ type Obligation = Obligation$1;
1915
2284
  /**
1916
2285
  * Builds the same creation code as `IdLib.creationCode` in Solidity.
1917
2286
  *
1918
- * Layout: `prefix (11 bytes) + chainId (32 bytes) + morphoV2 (20 bytes) + abi.encode(obligation)`.
2287
+ * Layout: `prefix (11 bytes) + abi.encode(obligation)`.
1919
2288
  *
1920
2289
  * @param parameters - {@link creationCode.Parameters}
1921
2290
  * @returns The CREATE2 init code bytes. {@link creationCode.ReturnType}
@@ -1930,9 +2299,11 @@ declare namespace creationCode {
1930
2299
  type ReturnType = Hex;
1931
2300
  }
1932
2301
  /**
1933
- * Computes the same id as `IdLib.toId` in Solidity.
2302
+ * Computes the same id as `IdLib.toId` in Solidity using the CREATE2 preimage:
2303
+ * `keccak256(0xff ++ morphoV2 ++ chainId ++ keccak256(creationCode))`.
2304
+ *
1934
2305
  * @param parameters - {@link toId.Parameters}
1935
- * @returns The obligation id. {@link toId.ReturnType}
2306
+ * @returns The 32-byte obligation id. {@link toId.ReturnType}
1936
2307
  */
1937
2308
  declare function toId(parameters: toId.Parameters): toId.ReturnType;
1938
2309
  declare namespace toId {
@@ -2036,15 +2407,14 @@ declare function generateMarketLiquidityPoolId(parameters: {
2036
2407
  marketId: string;
2037
2408
  }): string;
2038
2409
  declare namespace Offer_d_exports {
2039
- export { InvalidOfferError, Offer, OfferConsumed, OfferInput, OfferSchema, RandomConfig, Status, Validation, consumedEvent, decode$1 as decode, encode$1 as encode, from$10 as from, fromSnakeCase$1 as fromSnakeCase, hash, liquidateEvent, obligationId, random$1 as random, repayEvent, serialize, supplyCollateralEvent, takeEvent, toSnakeCase, withdrawCollateralEvent };
2410
+ export { InvalidOfferError, Offer, OfferConsumed, OfferInput, OfferSchema, RandomConfig, Status, Validation, consumedEvent, decode$1 as decode, encode$1 as encode, from$10 as from, fromSnakeCase$1 as fromSnakeCase, hash, liquidateEvent, random$1 as random, repayEvent, serialize, supplyCollateralEvent, takeEvent, toSnakeCase, withdrawCollateralEvent };
2040
2411
  }
2041
2412
  type Offer = {
2042
- /** The address that made the offer. */readonly maker: Address; /** The amount of assets offered. Mutually exclusive with obligationUnits and obligationShares. */
2043
- readonly assets: bigint; /** The max debt units to trade. Mutually exclusive with assets and obligationShares. */
2044
- readonly obligationUnits: bigint; /** The max lending shares to trade. Mutually exclusive with assets and obligationUnits. */
2045
- readonly obligationShares: bigint; /** The offer tick. */
2413
+ /** The address that made the offer. */readonly maker: Address; /** The max debt units to trade. */
2414
+ readonly obligationUnits: bigint; /** The offer tick. */
2046
2415
  readonly tick: number; /** The date at which all interests will be paid. */
2047
- readonly maturity: Maturity; /** The date at which the offer will expire. */
2416
+ readonly maturity: Maturity; /** Recovery-close-factor threshold in obligation units. */
2417
+ readonly rcfThreshold: bigint; /** The date at which the offer will expire. */
2048
2418
  readonly expiry: number; /** The date at which the offer will start. */
2049
2419
  readonly start: number; /** The group. Used for OCO (One-Cancelled-Other) mechanism. */
2050
2420
  readonly group: Hex; /** The session. Used for session-based offer management. */
@@ -2056,7 +2426,8 @@ type Offer = {
2056
2426
  readonly address: Address;
2057
2427
  readonly data: Hex;
2058
2428
  }; /** Receiver of loan token proceeds when maker is seller on `take()`. */
2059
- readonly receiverIfMakerIsSeller: Address;
2429
+ readonly receiverIfMakerIsSeller: Address; /** Whether this offer can only reduce existing positions, not create new ones. */
2430
+ readonly exitOnly: boolean;
2060
2431
  };
2061
2432
  declare enum Status {
2062
2433
  VALID = "VALID",
@@ -2069,11 +2440,10 @@ type Validation = {
2069
2440
  };
2070
2441
  declare const OfferSchema: () => z$1.ZodObject<{
2071
2442
  maker: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
2072
- assets: z$1.ZodBigInt;
2073
2443
  obligationUnits: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodBigInt>>;
2074
- obligationShares: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodBigInt>>;
2075
2444
  tick: z$1.ZodCoercedNumber<unknown>;
2076
2445
  maturity: z$1.ZodPipe<z$1.ZodNumber, z$1.ZodTransform<Maturity, number>>;
2446
+ rcfThreshold: z$1.ZodBigInt;
2077
2447
  expiry: z$1.ZodNumber;
2078
2448
  start: z$1.ZodNumber;
2079
2449
  group: z$1.ZodPipe<z$1.ZodUnion<readonly [z$1.ZodString, z$1.ZodNumber, z$1.ZodBigInt]>, z$1.ZodTransform<`0x${string}`, string | number | bigint>>;
@@ -2084,12 +2454,14 @@ declare const OfferSchema: () => z$1.ZodObject<{
2084
2454
  asset: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
2085
2455
  oracle: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
2086
2456
  lltv: z$1.ZodPipe<z$1.ZodBigInt, z$1.ZodTransform<LLTV, bigint>>;
2457
+ maxLif: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodBigInt>>;
2087
2458
  }, z$1.core.$strip>>;
2088
2459
  callback: z$1.ZodObject<{
2089
2460
  address: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
2090
2461
  data: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
2091
2462
  }, z$1.core.$strip>;
2092
2463
  receiverIfMakerIsSeller: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
2464
+ exitOnly: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodBoolean>>;
2093
2465
  }, z$1.core.$strip>;
2094
2466
  /**
2095
2467
  * Input type for creating offers. Accepts flexible group types that will be coerced to Hex.
@@ -2102,12 +2474,13 @@ declare const OfferSchema: () => z$1.ZodObject<{
2102
2474
  *
2103
2475
  * All values validated to be non-negative and within bytes32 range.
2104
2476
  */
2105
- type OfferInput = Compute<Omit<Offer, "group" | "session" | "obligationUnits" | "obligationShares" | "receiverIfMakerIsSeller"> & {
2477
+ type OfferInput = Compute<Omit<Offer, "group" | "session" | "obligationUnits" | "rcfThreshold" | "receiverIfMakerIsSeller" | "exitOnly"> & {
2106
2478
  group: Hex | bigint | number | string; /** Optional: defaults to zero bytes32. */
2107
- session?: Hex | bigint | number | string; /** Optional: defaults to 0n. Mutually exclusive with assets and obligationShares. */
2108
- obligationUnits?: bigint; /** Optional: defaults to 0n. Mutually exclusive with assets and obligationUnits. */
2109
- obligationShares?: bigint; /** Optional: defaults to maker for backward compatibility. */
2110
- receiverIfMakerIsSeller?: Address;
2479
+ session?: Hex | bigint | number | string; /** Optional: defaults to 0n. */
2480
+ obligationUnits?: bigint; /** Recovery-close-factor threshold in obligation units. */
2481
+ rcfThreshold: bigint; /** Optional: defaults to maker for backward compatibility. */
2482
+ receiverIfMakerIsSeller?: Address; /** Optional: defaults to false. */
2483
+ exitOnly?: boolean;
2111
2484
  }>;
2112
2485
  /**
2113
2486
  * Creates an offer from a plain object.
@@ -2144,11 +2517,10 @@ declare function toSnakeCase(offer: Offer): Snake<Offer>;
2144
2517
  */
2145
2518
  declare const serialize: (offer: Offer) => {
2146
2519
  maker: `0x${string}`;
2147
- assets: string;
2148
2520
  obligationUnits: string;
2149
- obligationShares: string;
2150
2521
  tick: number;
2151
2522
  maturity: number;
2523
+ rcfThreshold: string;
2152
2524
  expiry: number;
2153
2525
  start: number;
2154
2526
  group: `0x${string}`;
@@ -2159,12 +2531,14 @@ declare const serialize: (offer: Offer) => {
2159
2531
  asset: `0x${string}`;
2160
2532
  oracle: `0x${string}`;
2161
2533
  lltv: string;
2534
+ maxLif: string;
2162
2535
  }[];
2163
2536
  callback: {
2164
2537
  address: `0x${string}`;
2165
2538
  data: `0x${string}`;
2166
2539
  };
2167
2540
  receiverIfMakerIsSeller: `0x${string}`;
2541
+ exitOnly: boolean;
2168
2542
  hash: `0x${string}`;
2169
2543
  };
2170
2544
  type RandomConfig = {
@@ -2172,11 +2546,10 @@ type RandomConfig = {
2172
2546
  collateralTokens?: Address[];
2173
2547
  assetsDecimals?: Record<Address, number>;
2174
2548
  buy?: boolean;
2175
- assets?: bigint;
2176
2549
  obligationUnits?: bigint;
2177
- obligationShares?: bigint;
2178
2550
  maker?: Address;
2179
2551
  maturity?: Maturity;
2552
+ rcfThreshold?: bigint;
2180
2553
  start?: number;
2181
2554
  expiry?: number;
2182
2555
  group?: Hex | bigint | number | string;
@@ -2188,6 +2561,7 @@ type RandomConfig = {
2188
2561
  };
2189
2562
  receiverIfMakerIsSeller?: Address;
2190
2563
  collaterals?: readonly Collateral[];
2564
+ exitOnly?: boolean;
2191
2565
  };
2192
2566
  /**
2193
2567
  * Generates a random Offer.
@@ -2204,21 +2578,6 @@ declare function random$1(config?: RandomConfig): Offer;
2204
2578
  * @returns 32-byte offer hash.
2205
2579
  */
2206
2580
  declare function hash(offer: Offer): Hex;
2207
- /**
2208
- * Calculates the onchain obligation id for an offer.
2209
- * The id is computed with {@link Id.toId}.
2210
- * @param offer - The offer to calculate the obligation id for.
2211
- * @param parameters - The chain context used by the onchain id function.
2212
- * @returns The obligation id as a 32-byte hex string.
2213
- */
2214
- declare function obligationId(offer: Offer, parameters: obligationId.Parameters): obligationId.ReturnType;
2215
- declare namespace obligationId {
2216
- type Parameters = {
2217
- chainId: Id;
2218
- morphoV2: Address;
2219
- };
2220
- type ReturnType = Hex;
2221
- }
2222
2581
  declare function encode$1(offer: Offer): `0x${string}`;
2223
2582
  declare function decode$1(data: Hex): Offer;
2224
2583
  type OfferConsumed = {
@@ -2241,7 +2600,7 @@ declare const takeEvent: {
2241
2600
  readonly indexed: false;
2242
2601
  readonly internalType: "address";
2243
2602
  }, {
2244
- readonly name: "id";
2603
+ readonly name: "id_";
2245
2604
  readonly type: "bytes32";
2246
2605
  readonly indexed: true;
2247
2606
  readonly internalType: "bytes32";
@@ -2275,21 +2634,6 @@ declare const takeEvent: {
2275
2634
  readonly type: "uint256";
2276
2635
  readonly indexed: false;
2277
2636
  readonly internalType: "uint256";
2278
- }, {
2279
- readonly name: "obligationShares";
2280
- readonly type: "uint256";
2281
- readonly indexed: false;
2282
- readonly internalType: "uint256";
2283
- }, {
2284
- readonly name: "buyerIsLender";
2285
- readonly type: "bool";
2286
- readonly indexed: false;
2287
- readonly internalType: "bool";
2288
- }, {
2289
- readonly name: "sellerIsBorrower";
2290
- readonly type: "bool";
2291
- readonly indexed: false;
2292
- readonly internalType: "bool";
2293
2637
  }, {
2294
2638
  readonly name: "sellerReceiver";
2295
2639
  readonly type: "address";
@@ -2305,17 +2649,27 @@ declare const takeEvent: {
2305
2649
  readonly type: "uint256";
2306
2650
  readonly indexed: false;
2307
2651
  readonly internalType: "uint256";
2652
+ }, {
2653
+ readonly name: "totalUnits";
2654
+ readonly type: "uint256";
2655
+ readonly indexed: false;
2656
+ readonly internalType: "uint256";
2308
2657
  }];
2309
2658
  readonly anonymous: false;
2310
2659
  };
2311
2660
  /**
2312
- * ABI for the Consume event emitted by the Obligation contract.
2661
+ * ABI for the SetConsumed event emitted by the Morpho V2 contract.
2313
2662
  */
2314
2663
  declare const consumedEvent: {
2315
2664
  readonly type: "event";
2316
- readonly name: "Consume";
2665
+ readonly name: "SetConsumed";
2317
2666
  readonly inputs: readonly [{
2318
- readonly name: "user";
2667
+ readonly name: "caller";
2668
+ readonly type: "address";
2669
+ readonly indexed: true;
2670
+ readonly internalType: "address";
2671
+ }, {
2672
+ readonly name: "onBehalf";
2319
2673
  readonly type: "address";
2320
2674
  readonly indexed: true;
2321
2675
  readonly internalType: "address";
@@ -2344,7 +2698,7 @@ declare const repayEvent: {
2344
2698
  readonly indexed: true;
2345
2699
  readonly internalType: "address";
2346
2700
  }, {
2347
- readonly name: "id";
2701
+ readonly name: "id_";
2348
2702
  readonly type: "bytes32";
2349
2703
  readonly indexed: true;
2350
2704
  readonly internalType: "bytes32";
@@ -2373,40 +2727,37 @@ declare const liquidateEvent: {
2373
2727
  readonly indexed: true;
2374
2728
  readonly internalType: "address";
2375
2729
  }, {
2376
- readonly name: "id";
2730
+ readonly name: "id_";
2377
2731
  readonly type: "bytes32";
2378
2732
  readonly indexed: true;
2379
2733
  readonly internalType: "bytes32";
2380
2734
  }, {
2381
- readonly name: "seizures";
2382
- readonly type: "tuple[]";
2735
+ readonly name: "collateralIndex";
2736
+ readonly type: "uint256";
2383
2737
  readonly indexed: false;
2384
- readonly internalType: "struct IMorphoV2.Seizure[]";
2385
- readonly components: readonly [{
2386
- readonly name: "collateralIndex";
2387
- readonly type: "uint256";
2388
- readonly internalType: "uint256";
2389
- }, {
2390
- readonly name: "repaid";
2391
- readonly type: "uint256";
2392
- readonly internalType: "uint256";
2393
- }, {
2394
- readonly name: "seized";
2395
- readonly type: "uint256";
2396
- readonly internalType: "uint256";
2397
- }];
2738
+ readonly internalType: "uint256";
2739
+ }, {
2740
+ readonly name: "seizedAssets";
2741
+ readonly type: "uint256";
2742
+ readonly indexed: false;
2743
+ readonly internalType: "uint256";
2744
+ }, {
2745
+ readonly name: "repaidUnits";
2746
+ readonly type: "uint256";
2747
+ readonly indexed: false;
2748
+ readonly internalType: "uint256";
2398
2749
  }, {
2399
2750
  readonly name: "borrower";
2400
2751
  readonly type: "address";
2401
2752
  readonly indexed: true;
2402
2753
  readonly internalType: "address";
2403
2754
  }, {
2404
- readonly name: "totalRepaid";
2755
+ readonly name: "badDebt";
2405
2756
  readonly type: "uint256";
2406
2757
  readonly indexed: false;
2407
2758
  readonly internalType: "uint256";
2408
2759
  }, {
2409
- readonly name: "badDebt";
2760
+ readonly name: "latestLossIndex";
2410
2761
  readonly type: "uint256";
2411
2762
  readonly indexed: false;
2412
2763
  readonly internalType: "uint256";
@@ -2425,7 +2776,7 @@ declare const supplyCollateralEvent: {
2425
2776
  readonly indexed: false;
2426
2777
  readonly internalType: "address";
2427
2778
  }, {
2428
- readonly name: "id";
2779
+ readonly name: "id_";
2429
2780
  readonly type: "bytes32";
2430
2781
  readonly indexed: true;
2431
2782
  readonly internalType: "bytes32";
@@ -2459,7 +2810,7 @@ declare const withdrawCollateralEvent: {
2459
2810
  readonly indexed: false;
2460
2811
  readonly internalType: "address";
2461
2812
  }, {
2462
- readonly name: "id";
2813
+ readonly name: "id_";
2463
2814
  readonly type: "bytes32";
2464
2815
  readonly indexed: true;
2465
2816
  readonly internalType: "bytes32";
@@ -2734,7 +3085,7 @@ declare class InvalidQuoteError extends BaseError<z$1.ZodError | Error> {
2734
3085
  constructor(error: z$1.ZodError | Error);
2735
3086
  }
2736
3087
  declare namespace Tick_d_exports {
2737
- export { InvalidPriceError, InvalidTickError, MAX_PRICE, TICK_RANGE, priceToTick, tickToPrice };
3088
+ export { InvalidPriceError, InvalidTickError, MAX_PRICE, TICK_RANGE, assetsToObligationUnits, obligationUnitsToAssets, priceToTick, tickToPrice };
2738
3089
  }
2739
3090
  /** Tick domain supported by Morpho V2. */
2740
3091
  declare const TICK_RANGE = 990;
@@ -2760,6 +3111,20 @@ declare function priceToTick(price: bigint): number;
2760
3111
  declare namespace priceToTick {
2761
3112
  type ErrorType = InvalidPriceError;
2762
3113
  }
3114
+ /**
3115
+ * Converts obligation units to assets using the tick price (mulDivDown).
3116
+ * @param obligationUnits - The obligation units to convert.
3117
+ * @param tick - The offer tick.
3118
+ * @returns The equivalent amount in assets.
3119
+ */
3120
+ declare function obligationUnitsToAssets(obligationUnits: bigint, tick: number): bigint;
3121
+ /**
3122
+ * Converts assets to obligation units using the tick price (mulDivUp).
3123
+ * @param assets - The asset amount to convert.
3124
+ * @param tick - The offer tick.
3125
+ * @returns The equivalent amount in obligation units.
3126
+ */
3127
+ declare function assetsToObligationUnits(assets: bigint, tick: number): bigint;
2763
3128
  declare class InvalidTickError extends BaseError {
2764
3129
  readonly name = "Tick.InvalidTickError";
2765
3130
  constructor(tick: number);
@@ -2773,15 +3138,15 @@ declare namespace TradingFee_d_exports {
2773
3138
  }
2774
3139
  /**
2775
3140
  * Time breakpoints in seconds for piecewise linear fee interpolation.
2776
- * Matches on-chain constants: 0d, 1d, 7d, 30d, 90d, 180d.
3141
+ * Matches on-chain constants: 0d, 1d, 7d, 30d, 90d, 180d, 360d.
2777
3142
  */
2778
- declare const BREAKPOINTS: readonly [0n, 86400n, 604800n, 2592000n, 7776000n, 15552000n];
3143
+ declare const BREAKPOINTS: readonly [0n, 86400n, 604800n, 2592000n, 7776000n, 15552000n, 31104000n];
2779
3144
  /** WAD constant (1e18) for fee scaling. */
2780
3145
  declare const WAD: bigint;
2781
- /** Tuple type for the 6 fee values at each breakpoint. */
2782
- type Fees = readonly [bigint, bigint, bigint, bigint, bigint, bigint];
3146
+ /** Tuple type for the 7 fee values at each breakpoint. */
3147
+ type Fees = readonly [bigint, bigint, bigint, bigint, bigint, bigint, bigint];
2783
3148
  /**
2784
- * TradingFee represents a piecewise linear fee curve with 6 breakpoints.
3149
+ * TradingFee represents a piecewise linear fee curve with 7 breakpoints.
2785
3150
  * The internal storage mimics on-chain bitmap behavior but uses a struct for clarity.
2786
3151
  */
2787
3152
  type TradingFee = {
@@ -2789,12 +3154,12 @@ type TradingFee = {
2789
3154
  readonly _fees: Fees;
2790
3155
  } & Brand<"TradingFee">;
2791
3156
  /**
2792
- * Create a TradingFee from an activation flag and 6 fee values.
3157
+ * Create a TradingFee from an activation flag and 7 fee values.
2793
3158
  * @param activated - Whether the fee is active.
2794
- * @param fees - Tuple of 6 fee values in WAD (one per breakpoint: 0d, 1d, 7d, 30d, 90d, 180d).
3159
+ * @param fees - Tuple of 7 fee values in WAD (one per breakpoint: 0d, 1d, 7d, 30d, 90d, 180d, 360d).
2795
3160
  * @returns A new TradingFee instance.
2796
3161
  * @throws {@link InvalidFeeError} if any fee exceeds WAD (100%).
2797
- * @throws {@link InvalidFeesLengthError} if fees array doesn't have exactly 6 elements.
3162
+ * @throws {@link InvalidFeesLengthError} if fees array doesn't have exactly 7 elements.
2798
3163
  */
2799
3164
  declare function from$6(activated: boolean, fees: Fees): TradingFee;
2800
3165
  declare namespace from$6 {
@@ -2828,7 +3193,7 @@ declare function deactivate(tradingFee: TradingFee): TradingFee;
2828
3193
  /**
2829
3194
  * Get the fee values at each breakpoint.
2830
3195
  * @param tradingFee - The TradingFee instance.
2831
- * @returns The tuple of 6 fee values.
3196
+ * @returns The tuple of 7 fee values.
2832
3197
  */
2833
3198
  declare function getFees(tradingFee: TradingFee): Fees;
2834
3199
  /** Error thrown when a fee value is invalid (negative or exceeds WAD). */
@@ -2836,7 +3201,7 @@ declare class InvalidFeeError extends BaseError {
2836
3201
  readonly name = "TradingFee.InvalidFeeError";
2837
3202
  constructor(fee: bigint, index: number);
2838
3203
  }
2839
- /** Error thrown when fees array doesn't have exactly 6 elements. */
3204
+ /** Error thrown when fees array doesn't have exactly 7 elements. */
2840
3205
  declare class InvalidFeesLengthError extends BaseError {
2841
3206
  readonly name = "TradingFee.InvalidFeesLengthError";
2842
3207
  constructor(length: number);
@@ -2883,13 +3248,13 @@ declare namespace from$5 {
2883
3248
  type ReturnType = Transfer;
2884
3249
  }
2885
3250
  declare namespace Tree_d_exports {
2886
- export { DecodeError, EncodeError, NormalizedSignatureDomain, Proof, SignatureDomain, SignatureDomainError, Tree, TreeError, VERSION, decode, encode, encodeUnsigned, from$4 as from, proofs, signatureDomain, signatureTypes };
3251
+ export { DecodeError, EncodeError, MAX_COMPRESSED_OFFERS_BYTES, MAX_DECOMPRESSED_OFFERS_BYTES, MAX_OFFERS_PER_TREE, NormalizedSignatureDomain, Proof, SignatureDomain, SignatureDomainError, Tree, TreeError, VERSION, decode, encode, encodeUnsigned, from$4 as from, proofs, signatureDomain, signatureTypes };
2887
3252
  }
2888
3253
  /**
2889
3254
  * A merkle tree of offers built from offer hashes.
2890
3255
  * Constructed via {@link from}. The tree root can be signed for onchain broadcast.
2891
3256
  */
2892
- type Tree = Compute<StandardMerkleTree<[Hex]> & {
3257
+ type Tree = Compute<SimpleMerkleTree & {
2893
3258
  /** The offers in the tree. */offers: Offer[]; /** The root of the tree. */
2894
3259
  root: Hex;
2895
3260
  }>;
@@ -2897,7 +3262,10 @@ type Proof = {
2897
3262
  /** The offer that the proof is for. */offer: Offer; /** The merkle proof path for the offer. */
2898
3263
  path: Hex[];
2899
3264
  };
2900
- declare const VERSION = 1;
3265
+ declare const VERSION = 2;
3266
+ declare const MAX_COMPRESSED_OFFERS_BYTES = 1000000;
3267
+ declare const MAX_DECOMPRESSED_OFFERS_BYTES = 4000000;
3268
+ declare const MAX_OFFERS_PER_TREE = 100;
2901
3269
  type SignatureDomain = {
2902
3270
  /** Chain id used in the EIP-712 domain. */chainId: number | bigint; /** MorphoV2 contract address used as verifying contract. */
2903
3271
  verifyingContract: Address;
@@ -2927,11 +3295,10 @@ declare const signatureTypes: {
2927
3295
  * Builds a Merkle tree from a list of offers.
2928
3296
  *
2929
3297
  * Leaves are the offer `hash` values as `bytes32` and are deterministically
2930
- * ordered following the StandardMerkleTree leaf ordering so that the resulting
2931
- * root is stable regardless of the input order.
3298
+ * ordered so that the resulting root is stable regardless of the input order.
2932
3299
  *
2933
3300
  * @param offers - Offers to include in the tree.
2934
- * @returns A `StandardMerkleTree` of `bytes32` leaves representing the offers.
3301
+ * @returns A `SimpleMerkleTree` of offer hashes representing the offers.
2935
3302
  * @throws {TreeError} If tree building fails due to offer inconsistencies.
2936
3303
  */
2937
3304
  declare const from$4: (offers: Offer[]) => Tree;
@@ -2939,7 +3306,7 @@ declare const from$4: (offers: Offer[]) => Tree;
2939
3306
  * Generates merkle proofs for all offers in a tree.
2940
3307
  *
2941
3308
  * Each proof allows independent verification that an offer is included in the tree
2942
- * without requiring the full tree. Proofs are ordered by StandardMerkleTree leaf ordering.
3309
+ * without requiring the full tree.
2943
3310
  *
2944
3311
  * @param tree - The {@link Tree} to generate proofs for.
2945
3312
  * @returns Array of proofs - {@link Proof}
@@ -3020,10 +3387,11 @@ declare const encodeUnsigned: (tree: Tree) => Hex;
3020
3387
  * Returns the tree with separately validated signature and recovered signer address.
3021
3388
  *
3022
3389
  * Validation order:
3023
- * 1. Version check
3390
+ * 1. Version and static size checks
3024
3391
  * 2. Signature verification (fail-fast, before decompression)
3025
- * 3. Decompression (only if signature valid)
3026
- * 4. Root verification (computed from offers vs embedded root)
3392
+ * 3. Streaming decompression with byte cap
3393
+ * 4. JSON array + offer count checks
3394
+ * 5. Root verification (computed from offers vs embedded root)
3027
3395
  *
3028
3396
  * @example
3029
3397
  * ```typescript
@@ -3729,7 +4097,7 @@ interface components {
3729
4097
  * @example 500000000000000000
3730
4098
  */
3731
4099
  price: string; /** @example 369216000000000000000000 */
3732
- assets: string; /** @example 5 */
4100
+ obligation_units: string; /** @example 5 */
3733
4101
  count: number;
3734
4102
  };
3735
4103
  BadRequestResponse: {
@@ -3847,16 +4215,16 @@ interface components {
3847
4215
  * {
3848
4216
  * "token": "0x34Cf890dB685FC536E05652FB41f02090c3fb751",
3849
4217
  * "lltv": "860000000000000000",
4218
+ * "max_lif": "0",
3850
4219
  * "oracle": "0x45093658BE7f90B63D7c359e8f408e503c2D9401"
3851
4220
  * }
3852
4221
  * ],
3853
- * "maturity": 1761922799
4222
+ * "maturity": 1761922799,
4223
+ * "rcf_threshold": "0"
3854
4224
  * },
3855
4225
  * "buy": false,
3856
4226
  * "maker": "0x7b093658BE7f90B63D7c359e8f408e503c2D9401",
3857
- * "assets": "369216000000000000000000",
3858
- * "obligation_units": "0",
3859
- * "obligation_shares": "0",
4227
+ * "obligation_units": "369216000000000000000000",
3860
4228
  * "start": 1761922790,
3861
4229
  * "expiry": 1761922799,
3862
4230
  * "tick": 495,
@@ -3864,10 +4232,11 @@ interface components {
3864
4232
  * "session": "0x0000000000000000000000000000000000000000000000000000000000000000",
3865
4233
  * "callback": "0x0000000000000000000000000000000000000000",
3866
4234
  * "callback_data": "0x",
3867
- * "receiver_if_maker_is_seller": "0x7b093658BE7f90B63D7c359e8f408e503c2D9401"
4235
+ * "receiver_if_maker_is_seller": "0x7b093658BE7f90B63D7c359e8f408e503c2D9401",
4236
+ * "exit_only": false
3868
4237
  * },
3869
4238
  * "offer_hash": "0xac4bd8318ec914f89f8af913f162230575b0ac0696a19256bc12138c5cfe1427",
3870
- * "obligation_id": "0x25690ae1aee324a005be565f3bcdd16dbf8daf7969b26c181c8b8f467dad9abc",
4239
+ * "obligation_id": "0x25690ae1aee324a005be565f3bcdd16dbf8daf79",
3871
4240
  * "chain_id": 1,
3872
4241
  * "consumed": "0",
3873
4242
  * "takeable": "369216000000000000000000",
@@ -3892,16 +4261,16 @@ interface components {
3892
4261
  * {
3893
4262
  * "token": "0x34Cf890dB685FC536E05652FB41f02090c3fb751",
3894
4263
  * "lltv": "860000000000000000",
4264
+ * "max_lif": "0",
3895
4265
  * "oracle": "0x45093658BE7f90B63D7c359e8f408e503c2D9401"
3896
4266
  * }
3897
4267
  * ],
3898
- * "maturity": 1761922799
4268
+ * "maturity": 1761922799,
4269
+ * "rcf_threshold": "0"
3899
4270
  * },
3900
4271
  * "buy": false,
3901
4272
  * "maker": "0x7b093658BE7f90B63D7c359e8f408e503c2D9401",
3902
- * "assets": "369216000000000000000000",
3903
- * "obligation_units": "0",
3904
- * "obligation_shares": "0",
4273
+ * "obligation_units": "369216000000000000000000",
3905
4274
  * "start": 1761922790,
3906
4275
  * "expiry": 1761922799,
3907
4276
  * "tick": 495,
@@ -3909,11 +4278,12 @@ interface components {
3909
4278
  * "session": "0x0000000000000000000000000000000000000000000000000000000000000000",
3910
4279
  * "callback": "0x0000000000000000000000000000000000000000",
3911
4280
  * "callback_data": "0x",
3912
- * "receiver_if_maker_is_seller": "0x7b093658BE7f90B63D7c359e8f408e503c2D9401"
4281
+ * "receiver_if_maker_is_seller": "0x7b093658BE7f90B63D7c359e8f408e503c2D9401",
4282
+ * "exit_only": false
3913
4283
  * }
3914
4284
  */
3915
4285
  offer: components["schemas"]["OfferDataResponse"]; /** @example 0xac4bd8318ec914f89f8af913f162230575b0ac0696a19256bc12138c5cfe1427 */
3916
- offer_hash: string; /** @example 0x25690ae1aee324a005be565f3bcdd16dbf8daf7969b26c181c8b8f467dad9abc */
4286
+ offer_hash: string; /** @example 0x25690ae1aee324a005be565f3bcdd16dbf8daf79 */
3917
4287
  obligation_id: string; /** @example 1 */
3918
4288
  chain_id: number; /** @example 0 */
3919
4289
  consumed: string; /** @example 369216000000000000000000 */
@@ -3937,18 +4307,18 @@ interface components {
3937
4307
  * {
3938
4308
  * "token": "0x34Cf890dB685FC536E05652FB41f02090c3fb751",
3939
4309
  * "lltv": "860000000000000000",
4310
+ * "max_lif": "0",
3940
4311
  * "oracle": "0x45093658BE7f90B63D7c359e8f408e503c2D9401"
3941
4312
  * }
3942
4313
  * ],
3943
- * "maturity": 1761922799
4314
+ * "maturity": 1761922799,
4315
+ * "rcf_threshold": "0"
3944
4316
  * }
3945
4317
  */
3946
4318
  obligation: components["schemas"]["ObligationOfferResponse"]; /** @example false */
3947
4319
  buy: boolean; /** @example 0x7b093658BE7f90B63D7c359e8f408e503c2D9401 */
3948
4320
  maker: string; /** @example 369216000000000000000000 */
3949
- assets: string; /** @example 0 */
3950
- obligation_units: string; /** @example 0 */
3951
- obligation_shares: string; /** @example 1761922790 */
4321
+ obligation_units: string; /** @example 1761922790 */
3952
4322
  start: number; /** @example 1761922799 */
3953
4323
  expiry: number; /** @example 495 */
3954
4324
  tick: number; /** @example 0x000000000000000000000000000000000000000000000000000000000008b8f4 */
@@ -3956,7 +4326,8 @@ interface components {
3956
4326
  session: string; /** @example 0x0000000000000000000000000000000000000000 */
3957
4327
  callback: string; /** @example 0x */
3958
4328
  callback_data: string; /** @example 0x7b093658BE7f90B63D7c359e8f408e503c2D9401 */
3959
- receiver_if_maker_is_seller: string;
4329
+ receiver_if_maker_is_seller: string; /** @example false */
4330
+ exit_only: boolean;
3960
4331
  };
3961
4332
  ObligationOfferResponse: {
3962
4333
  /** @example 0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078 */loan_token: string;
@@ -3965,16 +4336,19 @@ interface components {
3965
4336
  * {
3966
4337
  * "token": "0x34Cf890dB685FC536E05652FB41f02090c3fb751",
3967
4338
  * "lltv": "860000000000000000",
4339
+ * "max_lif": "0",
3968
4340
  * "oracle": "0x45093658BE7f90B63D7c359e8f408e503c2D9401"
3969
4341
  * }
3970
4342
  * ]
3971
4343
  */
3972
4344
  collaterals: components["schemas"]["CollateralResponse"][]; /** @example 1761922799 */
3973
- maturity: number;
4345
+ maturity: number; /** @example 0 */
4346
+ rcf_threshold: string;
3974
4347
  };
3975
4348
  CollateralResponse: {
3976
4349
  /** @example 0x34Cf890dB685FC536E05652FB41f02090c3fb751 */token: string; /** @example 860000000000000000 */
3977
- lltv: string; /** @example 0x45093658BE7f90B63D7c359e8f408e503c2D9401 */
4350
+ lltv: string; /** @example 0 */
4351
+ max_lif: string; /** @example 0x45093658BE7f90B63D7c359e8f408e503c2D9401 */
3978
4352
  oracle: string;
3979
4353
  };
3980
4354
  ObligationListResponse: {
@@ -3987,7 +4361,8 @@ interface components {
3987
4361
  chain_id: number; /** @example 0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078 */
3988
4362
  loan_token: string;
3989
4363
  collaterals: components["schemas"]["CollateralResponse"][]; /** @example 1761922800 */
3990
- maturity: number;
4364
+ maturity: number; /** @example 0 */
4365
+ rcf_threshold: string;
3991
4366
  ask: components["schemas"]["AskResponse"];
3992
4367
  bid: components["schemas"]["BidResponse"];
3993
4368
  };
@@ -4141,11 +4516,10 @@ interface components {
4141
4516
  };
4142
4517
  ValidateOfferRequest: {
4143
4518
  /** @example 0x7b093658BE7f90B63D7c359e8f408e503c2D9401 */maker: string; /** @example 369216000000000000000000 */
4144
- assets: string; /** @example 0 */
4145
- obligation_units?: string; /** @example 0 */
4146
- obligation_shares?: string; /** @example 495 */
4519
+ obligation_units?: string; /** @example 495 */
4147
4520
  tick: number; /** @example 1761922799 */
4148
- maturity: number; /** @example 1761922799 */
4521
+ maturity: number; /** @example 0 */
4522
+ rcf_threshold: string; /** @example 1761922799 */
4149
4523
  expiry: number; /** @example 1761922790 */
4150
4524
  start: number; /** @example 0x000000000000000000000000000000000000000000000000000000000008b8f4 */
4151
4525
  group: string; /** @example 0x0000000000000000000000000000000000000000000000000000000000000000 */
@@ -4157,7 +4531,8 @@ interface components {
4157
4531
  * {
4158
4532
  * "asset": "0x34Cf890dB685FC536E05652FB41f02090c3fb751",
4159
4533
  * "oracle": "0x45093658BE7f90B63D7c359e8f408e503c2D9401",
4160
- * "lltv": "860000000000000000"
4534
+ * "lltv": "860000000000000000",
4535
+ * "max_lif": "0"
4161
4536
  * }
4162
4537
  * ]
4163
4538
  */
@@ -4169,12 +4544,14 @@ interface components {
4169
4544
  * }
4170
4545
  */
4171
4546
  callback: components["schemas"]["ValidateCallbackRequest"]; /** @example 0x7b093658BE7f90B63D7c359e8f408e503c2D9401 */
4172
- receiver_if_maker_is_seller: string;
4547
+ receiver_if_maker_is_seller: string; /** @example false */
4548
+ exit_only?: boolean;
4173
4549
  };
4174
4550
  ValidateCollateralRequest: {
4175
4551
  /** @example 0x34Cf890dB685FC536E05652FB41f02090c3fb751 */asset: string; /** @example 0x45093658BE7f90B63D7c359e8f408e503c2D9401 */
4176
4552
  oracle: string; /** @example 860000000000000000 */
4177
- lltv: string;
4553
+ lltv: string; /** @example 0 */
4554
+ max_lif: string;
4178
4555
  };
4179
4556
  ValidateCallbackRequest: {
4180
4557
  /** @example 0x0000000000000000000000000000000000000000 */address: string; /** @example 0x */
@@ -4225,11 +4602,10 @@ type Input = Readonly<{
4225
4602
  hash: Hex;
4226
4603
  obligationId: Hex;
4227
4604
  maker: Address;
4228
- assets: bigint;
4229
4605
  obligationUnits: bigint;
4230
- obligationShares: bigint;
4231
4606
  tick: number;
4232
4607
  maturity: number;
4608
+ rcfThreshold: bigint;
4233
4609
  expiry: number;
4234
4610
  start: number;
4235
4611
  group: Hex;
@@ -4240,6 +4616,7 @@ type Input = Readonly<{
4240
4616
  collaterals: Readonly<{
4241
4617
  asset: Address;
4242
4618
  lltv: bigint;
4619
+ maxLif: bigint;
4243
4620
  oracle: Address;
4244
4621
  }[]>;
4245
4622
  callback: {
@@ -4247,6 +4624,7 @@ type Input = Readonly<{
4247
4624
  data: Hex;
4248
4625
  };
4249
4626
  receiverIfMakerIsSeller: Address;
4627
+ exitOnly: boolean;
4250
4628
  root?: Hex | undefined;
4251
4629
  proof?: Hex[] | undefined;
4252
4630
  signature?: Hex | undefined;
@@ -4292,6 +4670,33 @@ declare class UsersController {
4292
4670
  }
4293
4671
  declare const OpenApi: () => Promise<OpenAPIDocument>;
4294
4672
  //#endregion
4673
+ //#region src/database/domains/Groups.d.ts
4674
+ type GroupInput = {
4675
+ chainId: Id;
4676
+ maker: Address;
4677
+ group: Hex;
4678
+ blockNumber: number;
4679
+ consumed?: bigint;
4680
+ };
4681
+ type GroupKey = {
4682
+ chainId: Id;
4683
+ maker: Address;
4684
+ group: Hex;
4685
+ };
4686
+ type GroupsDomain = {
4687
+ /**
4688
+ * Insert groups (insert-only).
4689
+ * @param groups - Groups to insert. {@link GroupInput}
4690
+ */
4691
+ create: (groups: GroupInput[]) => Promise<void>;
4692
+ /**
4693
+ * Check which groups already exist in the database.
4694
+ * @param groups - Group keys to check. {@link GroupKey}
4695
+ * @returns The subset of input groups that exist in the database.
4696
+ */
4697
+ exists: (groups: GroupKey[]) => Promise<GroupKey[]>;
4698
+ };
4699
+ //#endregion
4295
4700
  //#region src/database/domains/Positions.d.ts
4296
4701
  type PaginationParams = {
4297
4702
  /** Cursor string returned by a previous call, for pagination */cursor?: string; /** Page size; defaults to {@link DEFAULT_LIMIT} */
@@ -4374,6 +4779,10 @@ declare const schemas: {
4374
4779
  loan_token: "loan_token";
4375
4780
  collateral_token: "collateral_token";
4376
4781
  oracle: "oracle";
4782
+ min_duration: "min_duration";
4783
+ max_collaterals: "max_collaterals";
4784
+ group_consistency: "group_consistency";
4785
+ group_immutability: "group_immutability";
4377
4786
  }>>>>;
4378
4787
  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>>>>>;
4379
4788
  }, z$1.core.$strip>;
@@ -4660,6 +5069,22 @@ type ConfigRule = {
4660
5069
  type: "oracle";
4661
5070
  chain_id: Id;
4662
5071
  address: Address;
5072
+ } | {
5073
+ type: "group_consistency";
5074
+ chain_id: Id;
5075
+ description: string;
5076
+ } | {
5077
+ type: "group_immutability";
5078
+ chain_id: Id;
5079
+ description: string;
5080
+ } | {
5081
+ type: "max_collaterals";
5082
+ chain_id: Id;
5083
+ max: number;
5084
+ } | {
5085
+ type: "min_duration";
5086
+ chain_id: Id;
5087
+ min_seconds: number;
4663
5088
  };
4664
5089
  type ValidationIssue = {
4665
5090
  index: number;
@@ -4753,9 +5178,12 @@ declare function create(parameters: GatekeeperParameters): Gatekeeper;
4753
5178
  declare const morphoRules: (parameters: {
4754
5179
  chains: Chain$1[];
4755
5180
  chainId: Id;
4756
- }) => (Rule<Offer, "mixed_maker"> | Rule<Offer, "amount_mutual_exclusivity"> | Rule<Offer, "maturity"> | Rule<Offer, "callback"> | Rule<Offer, "loan_token"> | Rule<Offer, "collateral_token"> | Rule<Offer, "oracle">)[];
5181
+ db?: {
5182
+ groups: GroupsDomain;
5183
+ };
5184
+ }) => Rule<Offer, string>[];
4757
5185
  declare namespace Rules_d_exports {
4758
- export { amountMutualExclusivity, callback, collateralToken, loanToken, maturity, oracle, sameMaker };
5186
+ export { amountNonZero, callback, collateralToken, groupConsistency, groupImmutability, loanToken, maturity, maxCollaterals, minDuration, oracle, sameMaker };
4759
5187
  }
4760
5188
  declare const maturity: ({
4761
5189
  maturities
@@ -4811,11 +5239,51 @@ declare const oracle: ({
4811
5239
  */
4812
5240
  declare const sameMaker: () => Rule<Offer, "mixed_maker">;
4813
5241
  /**
4814
- * A validation rule that ensures mutual exclusivity of offer amount fields.
4815
- * At most one of (assets, obligationUnits, obligationShares) can be non-zero.
4816
- * Matches contract requirement: `atMostOneNonZero(offer.assets, offer.obligationUnits, offer.obligationShares)`.
5242
+ * A validation rule that checks if the offer duration (expiry - start) meets a minimum threshold.
5243
+ * @param minSeconds - Minimum required duration in seconds.
5244
+ * @returns The issue that was found. If the offer is valid, this will be undefined.
5245
+ */
5246
+ declare const minDuration: ({
5247
+ minSeconds
5248
+ }: {
5249
+ minSeconds: number;
5250
+ }) => Rule<Offer, "min_duration">;
5251
+ /**
5252
+ * A validation rule that checks if an offer exceeds the maximum number of collaterals.
5253
+ * The contract enforces this limit; this rule rejects early to avoid on-chain reverts.
5254
+ * @param max - Maximum allowed collaterals per offer.
5255
+ * @returns The issue that was found. If the offer is valid, this will be undefined.
5256
+ */
5257
+ declare const maxCollaterals: ({
5258
+ max
5259
+ }: {
5260
+ max: number;
5261
+ }) => Rule<Offer, "max_collaterals">;
5262
+ /**
5263
+ * A validation rule that checks if the offer's obligationUnits is non-zero.
5264
+ * The contract requires a positive amount; this rule rejects early.
5265
+ * @returns The issue that was found. If the offer is valid, this will be undefined.
5266
+ */
5267
+ declare const amountNonZero: () => Rule<Offer, "amount_non_zero">;
5268
+ /**
5269
+ * A batch validation rule that ensures all offers within the same group are consistent.
5270
+ * All offers sharing the same group must have the same loan token, obligationUnits,
5271
+ * and side (buy/sell). The contract tracks consumed per group and requires these to match.
4817
5272
  */
4818
- declare const amountMutualExclusivity: () => Rule<Offer, "amount_mutual_exclusivity">;
5273
+ declare const groupConsistency: () => Rule<Offer, "group_consistency">;
5274
+ /**
5275
+ * A batch validation rule that prevents adding offers to groups that already exist in the database.
5276
+ * Groups are immutable after creation — new offers cannot be added to an existing group.
5277
+ */
5278
+ declare const groupImmutability: ({
5279
+ db,
5280
+ chainId
5281
+ }: {
5282
+ db: {
5283
+ groups: GroupsDomain;
5284
+ };
5285
+ chainId: Id;
5286
+ }) => Rule<Offer, "group_immutability">;
4819
5287
  //#endregion
4820
5288
  //#region src/mempool/MempoolEVMClient.d.ts
4821
5289
  declare function from(parameters: from.Parameters): from.ReturnType;
@@ -4877,7 +5345,7 @@ declare namespace connect {
4877
5345
  }
4878
5346
  //#endregion
4879
5347
  //#region src/utils/BigMath.d.ts
4880
- declare function max$1(a: bigint, b: bigint): bigint;
5348
+ declare function max$2(a: bigint, b: bigint): bigint;
4881
5349
  declare function min(a: bigint, b: bigint): bigint;
4882
5350
  /**
4883
5351
  * Checks if at most one of the given values is non-zero.
@@ -4944,6 +5412,20 @@ declare function lazy<T>(pollFn: (emit: (value: T) => void, {
4944
5412
  stop: () => void;
4945
5413
  }) => () => boolean): () => AsyncGenerator<Awaited<NonNullable<T>>, void, unknown>;
4946
5414
  //#endregion
5415
+ //#region src/utils/mapWithConcurrency.d.ts
5416
+ /**
5417
+ * Map values with a bounded number of concurrent async workers.
5418
+ *
5419
+ * Result ordering always matches the input order.
5420
+ * @param parameters - Input values, concurrency limit, and async mapper.
5421
+ * @returns Mapped results in input order.
5422
+ */
5423
+ declare function mapWithConcurrency<value, result>(parameters: {
5424
+ values: value[];
5425
+ limit: number;
5426
+ run: (value: value, index: number) => Promise<result>;
5427
+ }): Promise<result[]>;
5428
+ //#endregion
4947
5429
  //#region src/utils/poll.d.ts
4948
5430
  /**
4949
5431
  * Polls a function at a specified interval.
@@ -4959,8 +5441,19 @@ declare function poll<data>(fn: ({
4959
5441
  interval: () => Promise<number>;
4960
5442
  }): () => boolean;
4961
5443
  declare namespace Random_d_exports {
4962
- export { address, bool, bytes, float, hex, int, seed, withSeed };
5444
+ export { SeededRng, address, bool, bytes, createRng, float, hex, int, seed, withSeed };
4963
5445
  }
5446
+ /** Isolated RNG instance with convenience methods. */
5447
+ interface SeededRng {
5448
+ float(): number;
5449
+ int(maxExclusive: number, min?: number): number;
5450
+ bool(probability?: number): boolean;
5451
+ }
5452
+ /**
5453
+ * Creates an isolated seeded RNG instance — safe for concurrent use.
5454
+ * @param seed - Seed string used to derive the initial RNG state.
5455
+ */
5456
+ declare function createRng(seed: string): SeededRng;
4964
5457
  /**
4965
5458
  * Runs a function with a deterministic RNG derived from the given seed.
4966
5459
  */
@@ -4997,15 +5490,24 @@ declare function address(): Address;
4997
5490
  //#region src/utils/retry.d.ts
4998
5491
  declare const retry: <T>(fn: () => Promise<T>, attempts?: number, delayMs?: number) => Promise<T>;
4999
5492
  declare namespace time_d_exports {
5000
- export { max, now };
5493
+ export { max$1 as max, now };
5001
5494
  }
5002
5495
  declare function now(): number;
5003
- declare function max(): number;
5496
+ declare function max$1(): number;
5497
+ //#endregion
5498
+ //#region src/utils/trim.d.ts
5499
+ /**
5500
+ * Keep the last `keep` entries from an array.
5501
+ * @param array - Source array.
5502
+ * @param keep - Number of entries to keep.
5503
+ * @returns Trimmed copy.
5504
+ */
5505
+ declare const trimTail: <entry>(array: readonly entry[], keep: number) => entry[];
5004
5506
  //#endregion
5005
5507
  //#region src/utils/wait.d.ts
5006
5508
  declare function wait(time: number): Promise<unknown>;
5007
5509
  declare namespace index_d_exports$2 {
5008
- 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 };
5510
+ 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, mapWithConcurrency, max$2 as max, min, poll, retry, stringifyBigint, toSnakeCase$1 as toSnakeCase, trimTail, wait };
5009
5511
  }
5010
5512
  //#endregion
5011
5513
  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, Id_d_exports as Id, 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 };