@morpho-dev/router 0.7.1 → 0.8.0

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