@morpho-dev/router 0.10.0 → 0.11.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.
@@ -233,17 +233,17 @@ declare const MorphoV2: readonly [{
233
233
  readonly type: "function";
234
234
  readonly stateMutability: "view";
235
235
  readonly inputs: readonly [{
236
- readonly type: "bytes32";
236
+ readonly type: "bytes20";
237
237
  readonly name: "id";
238
238
  }, {
239
239
  readonly type: "address";
240
240
  readonly name: "user";
241
241
  }, {
242
- readonly type: "address";
243
- readonly name: "collateralToken";
242
+ readonly type: "uint256";
243
+ readonly name: "collateralIndex";
244
244
  }];
245
245
  readonly outputs: readonly [{
246
- readonly type: "uint256";
246
+ readonly type: "uint128";
247
247
  }];
248
248
  }, {
249
249
  readonly name: "consume";
@@ -276,7 +276,7 @@ declare const MorphoV2: readonly [{
276
276
  readonly type: "function";
277
277
  readonly stateMutability: "view";
278
278
  readonly inputs: readonly [{
279
- readonly type: "bytes32";
279
+ readonly type: "bytes20";
280
280
  readonly name: "id";
281
281
  }, {
282
282
  readonly type: "address";
@@ -312,7 +312,7 @@ declare const MorphoV2: readonly [{
312
312
  readonly type: "function";
313
313
  readonly stateMutability: "view";
314
314
  readonly inputs: readonly [{
315
- readonly type: "bytes32";
315
+ readonly type: "bytes20";
316
316
  readonly name: "id";
317
317
  }];
318
318
  readonly outputs: readonly [{
@@ -361,10 +361,13 @@ declare const MorphoV2: readonly [{
361
361
  }, {
362
362
  readonly type: "uint256";
363
363
  readonly name: "maturity";
364
+ }, {
365
+ readonly type: "uint256";
366
+ readonly name: "minCollatValue";
364
367
  }];
365
368
  readonly name: "obligation";
366
369
  }, {
367
- readonly type: "bytes32";
370
+ readonly type: "bytes20";
368
371
  readonly name: "id";
369
372
  }, {
370
373
  readonly type: "address";
@@ -398,21 +401,20 @@ declare const MorphoV2: readonly [{
398
401
  }, {
399
402
  readonly type: "uint256";
400
403
  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
404
  }, {
409
405
  readonly type: "uint256";
410
- readonly name: "repaid";
411
- }, {
412
- readonly type: "uint256";
413
- readonly name: "seized";
406
+ readonly name: "minCollatValue";
414
407
  }];
415
- readonly name: "seizures";
408
+ readonly name: "obligation";
409
+ }, {
410
+ readonly type: "uint256";
411
+ readonly name: "collateralIndex";
412
+ }, {
413
+ readonly type: "uint256";
414
+ readonly name: "seizedAssets";
415
+ }, {
416
+ readonly type: "uint256";
417
+ readonly name: "repaidUnits";
416
418
  }, {
417
419
  readonly type: "address";
418
420
  readonly name: "borrower";
@@ -421,17 +423,9 @@ declare const MorphoV2: readonly [{
421
423
  readonly name: "data";
422
424
  }];
423
425
  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
- }];
426
+ readonly type: "uint256";
427
+ }, {
428
+ readonly type: "uint256";
435
429
  }];
436
430
  }, {
437
431
  readonly name: "multicall";
@@ -447,7 +441,7 @@ declare const MorphoV2: readonly [{
447
441
  readonly type: "function";
448
442
  readonly stateMutability: "view";
449
443
  readonly inputs: readonly [{
450
- readonly type: "bytes32";
444
+ readonly type: "bytes20";
451
445
  readonly name: "id";
452
446
  }];
453
447
  readonly outputs: readonly [{
@@ -458,7 +452,7 @@ declare const MorphoV2: readonly [{
458
452
  readonly type: "function";
459
453
  readonly stateMutability: "view";
460
454
  readonly inputs: readonly [{
461
- readonly type: "bytes32";
455
+ readonly type: "bytes20";
462
456
  readonly name: "id";
463
457
  }];
464
458
  readonly outputs: readonly [{
@@ -473,6 +467,9 @@ declare const MorphoV2: readonly [{
473
467
  }, {
474
468
  readonly type: "bool";
475
469
  readonly name: "created";
470
+ }, {
471
+ readonly type: "uint16[6]";
472
+ readonly name: "fees";
476
473
  }];
477
474
  }, {
478
475
  readonly name: "owner";
@@ -507,6 +504,9 @@ declare const MorphoV2: readonly [{
507
504
  }, {
508
505
  readonly type: "uint256";
509
506
  readonly name: "maturity";
507
+ }, {
508
+ readonly type: "uint256";
509
+ readonly name: "minCollatValue";
510
510
  }];
511
511
  readonly name: "obligation";
512
512
  }, {
@@ -557,7 +557,7 @@ declare const MorphoV2: readonly [{
557
557
  readonly type: "function";
558
558
  readonly stateMutability: "nonpayable";
559
559
  readonly inputs: readonly [{
560
- readonly type: "bytes32";
560
+ readonly type: "bytes20";
561
561
  readonly name: "id";
562
562
  }, {
563
563
  readonly type: "uint256";
@@ -590,7 +590,7 @@ declare const MorphoV2: readonly [{
590
590
  readonly type: "function";
591
591
  readonly stateMutability: "view";
592
592
  readonly inputs: readonly [{
593
- readonly type: "bytes32";
593
+ readonly type: "bytes20";
594
594
  readonly name: "id";
595
595
  }, {
596
596
  readonly type: "address";
@@ -630,11 +630,14 @@ declare const MorphoV2: readonly [{
630
630
  }, {
631
631
  readonly type: "uint256";
632
632
  readonly name: "maturity";
633
+ }, {
634
+ readonly type: "uint256";
635
+ readonly name: "minCollatValue";
633
636
  }];
634
637
  readonly name: "obligation";
635
638
  }, {
636
- readonly type: "address";
637
- readonly name: "collateral";
639
+ readonly type: "uint256";
640
+ readonly name: "collateralIndex";
638
641
  }, {
639
642
  readonly type: "uint256";
640
643
  readonly name: "assets";
@@ -694,6 +697,9 @@ declare const MorphoV2: readonly [{
694
697
  }, {
695
698
  readonly type: "uint256";
696
699
  readonly name: "maturity";
700
+ }, {
701
+ readonly type: "uint256";
702
+ readonly name: "minCollatValue";
697
703
  }];
698
704
  readonly name: "obligation";
699
705
  }, {
@@ -766,12 +772,80 @@ declare const MorphoV2: readonly [{
766
772
  }, {
767
773
  readonly type: "uint256";
768
774
  }];
775
+ }, {
776
+ readonly name: "toId";
777
+ readonly type: "function";
778
+ readonly stateMutability: "view";
779
+ readonly inputs: readonly [{
780
+ readonly type: "tuple";
781
+ readonly components: readonly [{
782
+ readonly type: "address";
783
+ readonly name: "loanToken";
784
+ }, {
785
+ readonly type: "tuple[]";
786
+ readonly components: readonly [{
787
+ readonly type: "address";
788
+ readonly name: "token";
789
+ }, {
790
+ readonly type: "uint256";
791
+ readonly name: "lltv";
792
+ }, {
793
+ readonly type: "address";
794
+ readonly name: "oracle";
795
+ }];
796
+ readonly name: "collaterals";
797
+ }, {
798
+ readonly type: "uint256";
799
+ readonly name: "maturity";
800
+ }, {
801
+ readonly type: "uint256";
802
+ readonly name: "minCollatValue";
803
+ }];
804
+ readonly name: "obligation";
805
+ }];
806
+ readonly outputs: readonly [{
807
+ readonly type: "bytes20";
808
+ }];
809
+ }, {
810
+ readonly name: "toObligation";
811
+ readonly type: "function";
812
+ readonly stateMutability: "view";
813
+ readonly inputs: readonly [{
814
+ readonly type: "bytes20";
815
+ readonly name: "id";
816
+ }];
817
+ readonly outputs: readonly [{
818
+ readonly type: "tuple";
819
+ readonly components: readonly [{
820
+ readonly type: "address";
821
+ readonly name: "loanToken";
822
+ }, {
823
+ readonly type: "tuple[]";
824
+ readonly components: readonly [{
825
+ readonly type: "address";
826
+ readonly name: "token";
827
+ }, {
828
+ readonly type: "uint256";
829
+ readonly name: "lltv";
830
+ }, {
831
+ readonly type: "address";
832
+ readonly name: "oracle";
833
+ }];
834
+ readonly name: "collaterals";
835
+ }, {
836
+ readonly type: "uint256";
837
+ readonly name: "maturity";
838
+ }, {
839
+ readonly type: "uint256";
840
+ readonly name: "minCollatValue";
841
+ }];
842
+ }];
769
843
  }, {
770
844
  readonly name: "totalShares";
771
845
  readonly type: "function";
772
846
  readonly stateMutability: "view";
773
847
  readonly inputs: readonly [{
774
- readonly type: "bytes32";
848
+ readonly type: "bytes20";
775
849
  readonly name: "id";
776
850
  }];
777
851
  readonly outputs: readonly [{
@@ -782,7 +856,7 @@ declare const MorphoV2: readonly [{
782
856
  readonly type: "function";
783
857
  readonly stateMutability: "view";
784
858
  readonly inputs: readonly [{
785
- readonly type: "bytes32";
859
+ readonly type: "bytes20";
786
860
  readonly name: "id";
787
861
  }];
788
862
  readonly outputs: readonly [{
@@ -813,18 +887,21 @@ declare const MorphoV2: readonly [{
813
887
  }, {
814
888
  readonly type: "uint256";
815
889
  readonly name: "maturity";
890
+ }, {
891
+ readonly type: "uint256";
892
+ readonly name: "minCollatValue";
816
893
  }];
817
894
  readonly name: "obligation";
818
895
  }];
819
896
  readonly outputs: readonly [{
820
- readonly type: "bytes32";
897
+ readonly type: "bytes20";
821
898
  }];
822
899
  }, {
823
900
  readonly name: "tradingFee";
824
901
  readonly type: "function";
825
902
  readonly stateMutability: "view";
826
903
  readonly inputs: readonly [{
827
- readonly type: "bytes32";
904
+ readonly type: "bytes20";
828
905
  readonly name: "id";
829
906
  }, {
830
907
  readonly type: "uint256";
@@ -866,6 +943,9 @@ declare const MorphoV2: readonly [{
866
943
  }, {
867
944
  readonly type: "uint256";
868
945
  readonly name: "maturity";
946
+ }, {
947
+ readonly type: "uint256";
948
+ readonly name: "minCollatValue";
869
949
  }];
870
950
  readonly name: "obligation";
871
951
  }, {
@@ -911,11 +991,14 @@ declare const MorphoV2: readonly [{
911
991
  }, {
912
992
  readonly type: "uint256";
913
993
  readonly name: "maturity";
994
+ }, {
995
+ readonly type: "uint256";
996
+ readonly name: "minCollatValue";
914
997
  }];
915
998
  readonly name: "obligation";
916
999
  }, {
917
- readonly type: "address";
918
- readonly name: "collateral";
1000
+ readonly type: "uint256";
1001
+ readonly name: "collateralIndex";
919
1002
  }, {
920
1003
  readonly type: "uint256";
921
1004
  readonly name: "assets";
@@ -932,7 +1015,7 @@ declare const MorphoV2: readonly [{
932
1015
  readonly type: "function";
933
1016
  readonly stateMutability: "view";
934
1017
  readonly inputs: readonly [{
935
- readonly type: "bytes32";
1018
+ readonly type: "bytes20";
936
1019
  readonly name: "id";
937
1020
  }];
938
1021
  readonly outputs: readonly [{
@@ -984,29 +1067,22 @@ declare const MorphoV2: readonly [{
984
1067
  readonly name: "caller";
985
1068
  readonly indexed: true;
986
1069
  }, {
987
- readonly type: "bytes32";
988
- readonly name: "id";
1070
+ readonly type: "bytes20";
1071
+ readonly name: "id_";
989
1072
  readonly indexed: true;
990
1073
  }, {
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";
1074
+ readonly type: "uint256";
1075
+ readonly name: "collateralIndex";
1076
+ }, {
1077
+ readonly type: "uint256";
1078
+ readonly name: "seizedAssets";
1079
+ }, {
1080
+ readonly type: "uint256";
1081
+ readonly name: "repaidUnits";
1003
1082
  }, {
1004
1083
  readonly type: "address";
1005
1084
  readonly name: "borrower";
1006
1085
  readonly indexed: true;
1007
- }, {
1008
- readonly type: "uint256";
1009
- readonly name: "totalRepaid";
1010
1086
  }, {
1011
1087
  readonly type: "uint256";
1012
1088
  readonly name: "badDebt";
@@ -1015,8 +1091,8 @@ declare const MorphoV2: readonly [{
1015
1091
  readonly name: "ObligationCreated";
1016
1092
  readonly type: "event";
1017
1093
  readonly inputs: readonly [{
1018
- readonly type: "bytes32";
1019
- readonly name: "id";
1094
+ readonly type: "bytes20";
1095
+ readonly name: "id_";
1020
1096
  readonly indexed: true;
1021
1097
  }, {
1022
1098
  readonly type: "tuple";
@@ -1039,6 +1115,9 @@ declare const MorphoV2: readonly [{
1039
1115
  }, {
1040
1116
  readonly type: "uint256";
1041
1117
  readonly name: "maturity";
1118
+ }, {
1119
+ readonly type: "uint256";
1120
+ readonly name: "minCollatValue";
1042
1121
  }];
1043
1122
  readonly name: "obligation";
1044
1123
  }];
@@ -1050,8 +1129,8 @@ declare const MorphoV2: readonly [{
1050
1129
  readonly name: "caller";
1051
1130
  readonly indexed: true;
1052
1131
  }, {
1053
- readonly type: "bytes32";
1054
- readonly name: "id";
1132
+ readonly type: "bytes20";
1133
+ readonly name: "id_";
1055
1134
  readonly indexed: true;
1056
1135
  }, {
1057
1136
  readonly type: "uint256";
@@ -1088,8 +1167,8 @@ declare const MorphoV2: readonly [{
1088
1167
  readonly name: "SetObligationTradingFee";
1089
1168
  readonly type: "event";
1090
1169
  readonly inputs: readonly [{
1091
- readonly type: "bytes32";
1092
- readonly name: "id";
1170
+ readonly type: "bytes20";
1171
+ readonly name: "id_";
1093
1172
  readonly indexed: true;
1094
1173
  }, {
1095
1174
  readonly type: "uint256";
@@ -1133,8 +1212,8 @@ declare const MorphoV2: readonly [{
1133
1212
  readonly type: "address";
1134
1213
  readonly name: "caller";
1135
1214
  }, {
1136
- readonly type: "bytes32";
1137
- readonly name: "id";
1215
+ readonly type: "bytes20";
1216
+ readonly name: "id_";
1138
1217
  readonly indexed: true;
1139
1218
  }, {
1140
1219
  readonly type: "address";
@@ -1155,8 +1234,8 @@ declare const MorphoV2: readonly [{
1155
1234
  readonly type: "address";
1156
1235
  readonly name: "caller";
1157
1236
  }, {
1158
- readonly type: "bytes32";
1159
- readonly name: "id";
1237
+ readonly type: "bytes20";
1238
+ readonly name: "id_";
1160
1239
  readonly indexed: true;
1161
1240
  }, {
1162
1241
  readonly type: "address";
@@ -1204,8 +1283,8 @@ declare const MorphoV2: readonly [{
1204
1283
  readonly type: "address";
1205
1284
  readonly name: "caller";
1206
1285
  }, {
1207
- readonly type: "bytes32";
1208
- readonly name: "id";
1286
+ readonly type: "bytes20";
1287
+ readonly name: "id_";
1209
1288
  readonly indexed: true;
1210
1289
  }, {
1211
1290
  readonly type: "uint256";
@@ -1229,8 +1308,8 @@ declare const MorphoV2: readonly [{
1229
1308
  readonly type: "address";
1230
1309
  readonly name: "caller";
1231
1310
  }, {
1232
- readonly type: "bytes32";
1233
- readonly name: "id";
1311
+ readonly type: "bytes20";
1312
+ readonly name: "id_";
1234
1313
  readonly indexed: true;
1235
1314
  }, {
1236
1315
  readonly type: "address";
@@ -1374,7 +1453,7 @@ declare const Morpho: readonly [{
1374
1453
  readonly stateMutability: "view";
1375
1454
  }];
1376
1455
  declare namespace Callback_d_exports {
1377
- export { Callback, Type$1 as Type, isEmptyCallback };
1456
+ export { Callback, CallbackType, Type$1 as Type, isEmptyCallback };
1378
1457
  }
1379
1458
  type Callback = {
1380
1459
  type: Type$1.BuyWithEmptyCallback;
@@ -1385,6 +1464,9 @@ declare enum Type$1 {
1385
1464
  BuyWithEmptyCallback = "buy_with_empty_callback",
1386
1465
  SellWithEmptyCallback = "sell_with_empty_callback"
1387
1466
  }
1467
+ declare enum CallbackType {
1468
+ Empty = "empty"
1469
+ }
1388
1470
  declare const isEmptyCallback: (offer: Offer) => boolean;
1389
1471
  declare namespace Errors_d_exports {
1390
1472
  export { BaseError, GlobalErrorType, ReorgError };
@@ -1419,7 +1501,7 @@ declare class ReorgError extends BaseError {
1419
1501
  constructor(blockNumber: number);
1420
1502
  }
1421
1503
  declare namespace Chain_d_exports {
1422
- export { Chain$1 as Chain, ChainId, Id, InvalidBatchSizeError, InvalidBlockRangeError, InvalidBlockWindowError, MissingBlockNumberError, Name, chainIds, chainNames, chains, getChain, getWhitelistedChains, streamLogs };
1504
+ export { Chain$1 as Chain, ChainId, Id, InvalidBatchSizeError, InvalidBlockRangeError, InvalidBlockWindowError, MissingBlockNumberError, Name, UnrecoverableLogsResponseSizeError, chainIds, chainNames, chains, getChain, getWhitelistedChains, streamLogs };
1423
1505
  }
1424
1506
  type Chain$1 = Compute<Omit<Chain<ChainFormatters, {
1425
1507
  morpho: ChainContract;
@@ -1478,6 +1560,8 @@ declare function streamLogs<abiEvent extends AbiEvent | undefined = undefined>(p
1478
1560
  }, void, void>;
1479
1561
  declare class InvalidBlockRangeError extends BaseError {
1480
1562
  name: string;
1563
+ readonly fromBlock: bigint;
1564
+ readonly toBlock: bigint;
1481
1565
  constructor(fromBlock: bigint, toBlock: bigint);
1482
1566
  }
1483
1567
  declare class InvalidBlockWindowError extends BaseError {
@@ -1492,6 +1576,10 @@ declare class MissingBlockNumberError extends BaseError {
1492
1576
  name: string;
1493
1577
  constructor();
1494
1578
  }
1579
+ declare class UnrecoverableLogsResponseSizeError extends BaseError<Error> {
1580
+ name: string;
1581
+ constructor(blockNumber: bigint, cause?: unknown);
1582
+ }
1495
1583
  declare namespace ChainRegistry_d_exports {
1496
1584
  export { ChainRegistry, create$1 as create };
1497
1585
  }
@@ -1749,7 +1837,8 @@ declare namespace Obligation_d_exports {
1749
1837
  type Obligation$1 = {
1750
1838
  /** The token that is being borrowed for this obligation. */loanToken: Address; /** The exact set of collaterals required to borrow the loan token. */
1751
1839
  collaterals: Collateral[]; /** The maturity of the obligation. */
1752
- maturity: Maturity;
1840
+ maturity: Maturity; /** Minimum collateral value (quoted in loan token) to maintain on collateral updates. */
1841
+ minCollatValue: bigint;
1753
1842
  };
1754
1843
  declare const ObligationSchema: z$1.ZodObject<{
1755
1844
  loanToken: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
@@ -1759,6 +1848,7 @@ declare const ObligationSchema: z$1.ZodObject<{
1759
1848
  lltv: z$1.ZodPipe<z$1.ZodBigInt, z$1.ZodTransform<LLTV, bigint>>;
1760
1849
  }, z$1.core.$strip>>;
1761
1850
  maturity: z$1.ZodPipe<z$1.ZodNumber, z$1.ZodTransform<Maturity, number>>;
1851
+ minCollatValue: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodBigInt>>;
1762
1852
  }, z$1.core.$strip>;
1763
1853
  declare const abi: readonly [{
1764
1854
  readonly type: "address";
@@ -1779,6 +1869,9 @@ declare const abi: readonly [{
1779
1869
  }, {
1780
1870
  readonly type: "uint256";
1781
1871
  readonly name: "maturity";
1872
+ }, {
1873
+ readonly type: "uint256";
1874
+ readonly name: "minCollatValue";
1782
1875
  }];
1783
1876
  declare const tupleAbi: readonly [{
1784
1877
  readonly type: "tuple";
@@ -1801,6 +1894,9 @@ declare const tupleAbi: readonly [{
1801
1894
  }, {
1802
1895
  readonly type: "uint256";
1803
1896
  readonly name: "maturity";
1897
+ }, {
1898
+ readonly type: "uint256";
1899
+ readonly name: "minCollatValue";
1804
1900
  }];
1805
1901
  }];
1806
1902
  /**
@@ -1830,7 +1926,8 @@ declare namespace from$11 {
1830
1926
  type Parameters = {
1831
1927
  /** 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
1928
  collaterals: from$13.Parameters[] | readonly from$13.Parameters[]; /** The maturity of the obligation. */
1833
- maturity: from$12.Parameters;
1929
+ maturity: from$12.Parameters; /** Minimum collateral value (quoted in loan token). @default 0 */
1930
+ minCollatValue?: bigint;
1834
1931
  };
1835
1932
  type ReturnType = Obligation$1;
1836
1933
  type ErrorType = InvalidObligationError;
@@ -1843,13 +1940,17 @@ declare namespace from$11 {
1843
1940
  */
1844
1941
  declare function fromSnakeCase$2(input: fromSnakeCase$2.Parameters): fromSnakeCase$2.ReturnType;
1845
1942
  declare namespace fromSnakeCase$2 {
1846
- type Parameters = Snake<Obligation$1>;
1943
+ type SnakeCaseParameters = Omit<Obligation$1, "minCollatValue"> & {
1944
+ minCollatValue?: bigint;
1945
+ };
1946
+ type Parameters = Snake<SnakeCaseParameters>;
1847
1947
  type ReturnType = Obligation$1;
1848
1948
  type ErrorType = InvalidObligationError;
1849
1949
  }
1850
1950
  /**
1851
1951
  * Calculates a canonical key for an obligation payload.
1852
- * The key is computed as keccak256(abi.encode(loanToken, collaterals, maturity)).
1952
+ * The key is computed as keccak256(abi.encode(loanToken, collaterals, maturity, minCollatValue)).
1953
+ * If omitted, `minCollatValue` defaults to `0`.
1853
1954
  * @throws If the collaterals are not sorted alphabetically by address. {@link CollateralsAreNotSortedError}
1854
1955
  * @param parameters - {@link key.Parameters}
1855
1956
  * @returns The obligation key as a 32-byte hex string. {@link key.ReturnType}
@@ -1871,6 +1972,7 @@ declare namespace key$1 {
1871
1972
  oracle: Address;
1872
1973
  }[];
1873
1974
  maturity: number;
1975
+ minCollatValue?: bigint;
1874
1976
  };
1875
1977
  type ReturnType = Hex;
1876
1978
  type ErrorType = CollateralsAreNotSortedError;
@@ -1915,7 +2017,7 @@ type Obligation = Obligation$1;
1915
2017
  /**
1916
2018
  * Builds the same creation code as `IdLib.creationCode` in Solidity.
1917
2019
  *
1918
- * Layout: `prefix (11 bytes) + chainId (32 bytes) + morphoV2 (20 bytes) + abi.encode(obligation)`.
2020
+ * Layout: `prefix (11 bytes) + abi.encode(obligation)`.
1919
2021
  *
1920
2022
  * @param parameters - {@link creationCode.Parameters}
1921
2023
  * @returns The CREATE2 init code bytes. {@link creationCode.ReturnType}
@@ -1930,7 +2032,10 @@ declare namespace creationCode {
1930
2032
  type ReturnType = Hex;
1931
2033
  }
1932
2034
  /**
1933
- * Computes the same id as `IdLib.toId` in Solidity.
2035
+ * Computes the same id as `IdLib.toId` in Solidity using the CREATE2 preimage:
2036
+ * `keccak256(0xff ++ morphoV2 ++ chainId ++ keccak256(creationCode))`,
2037
+ * then truncates to the lower 20 bytes.
2038
+ *
1934
2039
  * @param parameters - {@link toId.Parameters}
1935
2040
  * @returns The obligation id. {@link toId.ReturnType}
1936
2041
  */
@@ -2209,7 +2314,7 @@ declare function hash(offer: Offer): Hex;
2209
2314
  * The id is computed with {@link Id.toId}.
2210
2315
  * @param offer - The offer to calculate the obligation id for.
2211
2316
  * @param parameters - The chain context used by the onchain id function.
2212
- * @returns The obligation id as a 32-byte hex string.
2317
+ * @returns The obligation id as a 20-byte hex string.
2213
2318
  */
2214
2319
  declare function obligationId(offer: Offer, parameters: obligationId.Parameters): obligationId.ReturnType;
2215
2320
  declare namespace obligationId {
@@ -2241,10 +2346,10 @@ declare const takeEvent: {
2241
2346
  readonly indexed: false;
2242
2347
  readonly internalType: "address";
2243
2348
  }, {
2244
- readonly name: "id";
2245
- readonly type: "bytes32";
2349
+ readonly name: "id_";
2350
+ readonly type: "bytes20";
2246
2351
  readonly indexed: true;
2247
- readonly internalType: "bytes32";
2352
+ readonly internalType: "bytes20";
2248
2353
  }, {
2249
2354
  readonly name: "maker";
2250
2355
  readonly type: "address";
@@ -2344,10 +2449,10 @@ declare const repayEvent: {
2344
2449
  readonly indexed: true;
2345
2450
  readonly internalType: "address";
2346
2451
  }, {
2347
- readonly name: "id";
2348
- readonly type: "bytes32";
2452
+ readonly name: "id_";
2453
+ readonly type: "bytes20";
2349
2454
  readonly indexed: true;
2350
- readonly internalType: "bytes32";
2455
+ readonly internalType: "bytes20";
2351
2456
  }, {
2352
2457
  readonly name: "obligationUnits";
2353
2458
  readonly type: "uint256";
@@ -2373,38 +2478,30 @@ declare const liquidateEvent: {
2373
2478
  readonly indexed: true;
2374
2479
  readonly internalType: "address";
2375
2480
  }, {
2376
- readonly name: "id";
2377
- readonly type: "bytes32";
2481
+ readonly name: "id_";
2482
+ readonly type: "bytes20";
2378
2483
  readonly indexed: true;
2379
- readonly internalType: "bytes32";
2484
+ readonly internalType: "bytes20";
2380
2485
  }, {
2381
- readonly name: "seizures";
2382
- readonly type: "tuple[]";
2486
+ readonly name: "collateralIndex";
2487
+ readonly type: "uint256";
2383
2488
  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
- }];
2489
+ readonly internalType: "uint256";
2398
2490
  }, {
2399
- readonly name: "borrower";
2400
- readonly type: "address";
2401
- readonly indexed: true;
2402
- readonly internalType: "address";
2491
+ readonly name: "seizedAssets";
2492
+ readonly type: "uint256";
2493
+ readonly indexed: false;
2494
+ readonly internalType: "uint256";
2403
2495
  }, {
2404
- readonly name: "totalRepaid";
2496
+ readonly name: "repaidUnits";
2405
2497
  readonly type: "uint256";
2406
2498
  readonly indexed: false;
2407
2499
  readonly internalType: "uint256";
2500
+ }, {
2501
+ readonly name: "borrower";
2502
+ readonly type: "address";
2503
+ readonly indexed: true;
2504
+ readonly internalType: "address";
2408
2505
  }, {
2409
2506
  readonly name: "badDebt";
2410
2507
  readonly type: "uint256";
@@ -2425,10 +2522,10 @@ declare const supplyCollateralEvent: {
2425
2522
  readonly indexed: false;
2426
2523
  readonly internalType: "address";
2427
2524
  }, {
2428
- readonly name: "id";
2429
- readonly type: "bytes32";
2525
+ readonly name: "id_";
2526
+ readonly type: "bytes20";
2430
2527
  readonly indexed: true;
2431
- readonly internalType: "bytes32";
2528
+ readonly internalType: "bytes20";
2432
2529
  }, {
2433
2530
  readonly name: "collateral";
2434
2531
  readonly type: "address";
@@ -2459,10 +2556,10 @@ declare const withdrawCollateralEvent: {
2459
2556
  readonly indexed: false;
2460
2557
  readonly internalType: "address";
2461
2558
  }, {
2462
- readonly name: "id";
2463
- readonly type: "bytes32";
2559
+ readonly name: "id_";
2560
+ readonly type: "bytes20";
2464
2561
  readonly indexed: true;
2465
- readonly internalType: "bytes32";
2562
+ readonly internalType: "bytes20";
2466
2563
  }, {
2467
2564
  readonly name: "collateral";
2468
2565
  readonly type: "address";
@@ -3867,7 +3964,7 @@ interface components {
3867
3964
  * "receiver_if_maker_is_seller": "0x7b093658BE7f90B63D7c359e8f408e503c2D9401"
3868
3965
  * },
3869
3966
  * "offer_hash": "0xac4bd8318ec914f89f8af913f162230575b0ac0696a19256bc12138c5cfe1427",
3870
- * "obligation_id": "0x25690ae1aee324a005be565f3bcdd16dbf8daf7969b26c181c8b8f467dad9abc",
3967
+ * "obligation_id": "0x25690ae1aee324a005be565f3bcdd16dbf8daf79",
3871
3968
  * "chain_id": 1,
3872
3969
  * "consumed": "0",
3873
3970
  * "takeable": "369216000000000000000000",
@@ -3913,7 +4010,7 @@ interface components {
3913
4010
  * }
3914
4011
  */
3915
4012
  offer: components["schemas"]["OfferDataResponse"]; /** @example 0xac4bd8318ec914f89f8af913f162230575b0ac0696a19256bc12138c5cfe1427 */
3916
- offer_hash: string; /** @example 0x25690ae1aee324a005be565f3bcdd16dbf8daf7969b26c181c8b8f467dad9abc */
4013
+ offer_hash: string; /** @example 0x25690ae1aee324a005be565f3bcdd16dbf8daf79 */
3917
4014
  obligation_id: string; /** @example 1 */
3918
4015
  chain_id: number; /** @example 0 */
3919
4016
  consumed: string; /** @example 369216000000000000000000 */
@@ -4111,7 +4208,7 @@ interface components {
4111
4208
  * "chain_id": 1,
4112
4209
  * "contract": "0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078",
4113
4210
  * "user": "0x7b093658BE7f90B63D7c359e8f408e503c2D9401",
4114
- * "obligation_id": "0x12590ae1aee324a005be565f3bcdd16dbf8daf7969b26c181c8b8f467dad9f67",
4211
+ * "obligation_id": "0x12590ae1aee324a005be565f3bcdd16dbf8daf79",
4115
4212
  * "reserved": "200000000000000000000",
4116
4213
  * "block_number": 21345678
4117
4214
  * }
@@ -4125,7 +4222,7 @@ interface components {
4125
4222
  user: string;
4126
4223
  /**
4127
4224
  * @description Obligation id this reserved amount belongs to, or null if no lots exist.
4128
- * @example 0x12590ae1aee324a005be565f3bcdd16dbf8daf7969b26c181c8b8f467dad9f67
4225
+ * @example 0x12590ae1aee324a005be565f3bcdd16dbf8daf79
4129
4226
  */
4130
4227
  obligation_id: string | null; /** @example 200000000000000000000 */
4131
4228
  reserved: string; /** @example 21345678 */
@@ -4292,6 +4389,33 @@ declare class UsersController {
4292
4389
  }
4293
4390
  declare const OpenApi: () => Promise<OpenAPIDocument>;
4294
4391
  //#endregion
4392
+ //#region src/database/domains/Groups.d.ts
4393
+ type GroupInput = {
4394
+ chainId: Id;
4395
+ maker: Address;
4396
+ group: Hex;
4397
+ blockNumber: number;
4398
+ consumed?: bigint;
4399
+ };
4400
+ type GroupKey = {
4401
+ chainId: Id;
4402
+ maker: Address;
4403
+ group: Hex;
4404
+ };
4405
+ type GroupsDomain = {
4406
+ /**
4407
+ * Insert groups (insert-only).
4408
+ * @param groups - Groups to insert. {@link GroupInput}
4409
+ */
4410
+ create: (groups: GroupInput[]) => Promise<void>;
4411
+ /**
4412
+ * Check which groups already exist in the database.
4413
+ * @param groups - Group keys to check. {@link GroupKey}
4414
+ * @returns The subset of input groups that exist in the database.
4415
+ */
4416
+ exists: (groups: GroupKey[]) => Promise<GroupKey[]>;
4417
+ };
4418
+ //#endregion
4295
4419
  //#region src/database/domains/Positions.d.ts
4296
4420
  type PaginationParams = {
4297
4421
  /** Cursor string returned by a previous call, for pagination */cursor?: string; /** Page size; defaults to {@link DEFAULT_LIMIT} */
@@ -4374,6 +4498,10 @@ declare const schemas: {
4374
4498
  loan_token: "loan_token";
4375
4499
  collateral_token: "collateral_token";
4376
4500
  oracle: "oracle";
4501
+ group_consistency: "group_consistency";
4502
+ group_immutability: "group_immutability";
4503
+ max_collaterals: "max_collaterals";
4504
+ min_duration: "min_duration";
4377
4505
  }>>>>;
4378
4506
  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
4507
  }, z$1.core.$strip>;
@@ -4660,6 +4788,22 @@ type ConfigRule = {
4660
4788
  type: "oracle";
4661
4789
  chain_id: Id;
4662
4790
  address: Address;
4791
+ } | {
4792
+ type: "group_consistency";
4793
+ chain_id: Id;
4794
+ description: string;
4795
+ } | {
4796
+ type: "group_immutability";
4797
+ chain_id: Id;
4798
+ description: string;
4799
+ } | {
4800
+ type: "max_collaterals";
4801
+ chain_id: Id;
4802
+ max: number;
4803
+ } | {
4804
+ type: "min_duration";
4805
+ chain_id: Id;
4806
+ min_seconds: number;
4663
4807
  };
4664
4808
  type ValidationIssue = {
4665
4809
  index: number;
@@ -4753,9 +4897,12 @@ declare function create(parameters: GatekeeperParameters): Gatekeeper;
4753
4897
  declare const morphoRules: (parameters: {
4754
4898
  chains: Chain$1[];
4755
4899
  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">)[];
4900
+ db?: {
4901
+ groups: GroupsDomain;
4902
+ };
4903
+ }) => Rule<Offer, string>[];
4757
4904
  declare namespace Rules_d_exports {
4758
- export { amountMutualExclusivity, callback, collateralToken, loanToken, maturity, oracle, sameMaker };
4905
+ export { amountMutualExclusivity, callback, collateralToken, groupConsistency, groupImmutability, loanToken, maturity, maxCollaterals, minDuration, oracle, sameMaker };
4759
4906
  }
4760
4907
  declare const maturity: ({
4761
4908
  maturities
@@ -4815,7 +4962,46 @@ declare const sameMaker: () => Rule<Offer, "mixed_maker">;
4815
4962
  * At most one of (assets, obligationUnits, obligationShares) can be non-zero.
4816
4963
  * Matches contract requirement: `atMostOneNonZero(offer.assets, offer.obligationUnits, offer.obligationShares)`.
4817
4964
  */
4965
+ /**
4966
+ * A validation rule that checks if the offer duration (expiry - start) meets a minimum threshold.
4967
+ * @param minSeconds - Minimum required duration in seconds.
4968
+ * @returns The issue that was found. If the offer is valid, this will be undefined.
4969
+ */
4970
+ declare const minDuration: ({
4971
+ minSeconds
4972
+ }: {
4973
+ minSeconds: number;
4974
+ }) => Rule<Offer, "min_duration">;
4975
+ /**
4976
+ * A validation rule that checks if an offer exceeds the maximum number of collaterals.
4977
+ * The contract enforces this limit; this rule rejects early to avoid on-chain reverts.
4978
+ * @param max - Maximum allowed collaterals per offer.
4979
+ * @returns The issue that was found. If the offer is valid, this will be undefined.
4980
+ */
4981
+ declare const maxCollaterals: ({
4982
+ max
4983
+ }: {
4984
+ max: number;
4985
+ }) => Rule<Offer, "max_collaterals">;
4818
4986
  declare const amountMutualExclusivity: () => Rule<Offer, "amount_mutual_exclusivity">;
4987
+ /**
4988
+ * A batch validation rule that ensures all offers within the same group are consistent.
4989
+ * All offers sharing the same group must have the same loan token, assets amount, and side (buy/sell).
4990
+ */
4991
+ declare const groupConsistency: () => Rule<Offer, "group_consistency">;
4992
+ /**
4993
+ * A batch validation rule that prevents adding offers to groups that already exist in the database.
4994
+ * Groups are immutable after creation — new offers cannot be added to an existing group.
4995
+ */
4996
+ declare const groupImmutability: ({
4997
+ db,
4998
+ chainId
4999
+ }: {
5000
+ db: {
5001
+ groups: GroupsDomain;
5002
+ };
5003
+ chainId: Id;
5004
+ }) => Rule<Offer, "group_immutability">;
4819
5005
  //#endregion
4820
5006
  //#region src/mempool/MempoolEVMClient.d.ts
4821
5007
  declare function from(parameters: from.Parameters): from.ReturnType;
@@ -4877,7 +5063,7 @@ declare namespace connect {
4877
5063
  }
4878
5064
  //#endregion
4879
5065
  //#region src/utils/BigMath.d.ts
4880
- declare function max$1(a: bigint, b: bigint): bigint;
5066
+ declare function max$2(a: bigint, b: bigint): bigint;
4881
5067
  declare function min(a: bigint, b: bigint): bigint;
4882
5068
  /**
4883
5069
  * Checks if at most one of the given values is non-zero.
@@ -4997,15 +5183,15 @@ declare function address(): Address;
4997
5183
  //#region src/utils/retry.d.ts
4998
5184
  declare const retry: <T>(fn: () => Promise<T>, attempts?: number, delayMs?: number) => Promise<T>;
4999
5185
  declare namespace time_d_exports {
5000
- export { max, now };
5186
+ export { max$1 as max, now };
5001
5187
  }
5002
5188
  declare function now(): number;
5003
- declare function max(): number;
5189
+ declare function max$1(): number;
5004
5190
  //#endregion
5005
5191
  //#region src/utils/wait.d.ts
5006
5192
  declare function wait(time: number): Promise<unknown>;
5007
5193
  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 };
5194
+ 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$2 as max, min, poll, retry, stringifyBigint, toSnakeCase$1 as toSnakeCase, wait };
5009
5195
  }
5010
5196
  //#endregion
5011
5197
  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 };