@morpho-dev/router 0.2.1 → 0.4.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 (44) hide show
  1. package/README.md +67 -71
  2. package/dist/cli.js +4224 -1627
  3. package/dist/drizzle/migrations/0015_add-lots-table.sql +12 -0
  4. package/dist/drizzle/migrations/0016_merkle-metadata.sql +26 -0
  5. package/dist/drizzle/migrations/0017_dusty_the_hunter.sql +1 -0
  6. package/dist/drizzle/migrations/0018_add_chain_collector_constraints.sql +3 -0
  7. package/dist/drizzle/migrations/0019_add-obligation-units-shares.sql +2 -0
  8. package/dist/drizzle/migrations/0020_add-session.sql +1 -0
  9. package/dist/drizzle/migrations/0021_drop_chain_collector_epoch_indexes.sql +2 -0
  10. package/dist/drizzle/migrations/0021_migrate-rate-to-price.sql +15 -0
  11. package/dist/drizzle/migrations/0022_consolidate-price.sql +15 -0
  12. package/dist/drizzle/migrations/meta/0015_snapshot.json +1365 -0
  13. package/dist/drizzle/migrations/meta/0016_snapshot.json +1531 -0
  14. package/dist/drizzle/migrations/meta/0017_snapshot.json +1525 -0
  15. package/dist/drizzle/migrations/meta/0018_snapshot.json +1572 -0
  16. package/dist/drizzle/migrations/meta/0019_snapshot.json +1586 -0
  17. package/dist/drizzle/migrations/meta/_journal.json +56 -0
  18. package/dist/evm/bytecode/erc20.txt +1 -0
  19. package/dist/evm/bytecode/factory.txt +1 -0
  20. package/dist/evm/bytecode/mempool.txt +1 -0
  21. package/dist/evm/bytecode/morpho.txt +1 -0
  22. package/dist/evm/bytecode/multicall3.txt +1 -0
  23. package/dist/evm/bytecode/oracle.txt +1 -0
  24. package/dist/evm/bytecode/terms.txt +1 -0
  25. package/dist/evm/bytecode/vault.txt +1 -0
  26. package/dist/evm/bytecode/vaultV1.txt +1 -0
  27. package/dist/index.browser.d.mts +1376 -651
  28. package/dist/index.browser.d.mts.map +1 -1
  29. package/dist/index.browser.d.ts +1375 -654
  30. package/dist/index.browser.d.ts.map +1 -1
  31. package/dist/index.browser.js +2398 -1526
  32. package/dist/index.browser.js.map +1 -1
  33. package/dist/index.browser.mjs +2394 -1522
  34. package/dist/index.browser.mjs.map +1 -1
  35. package/dist/index.node.d.mts +2372 -1039
  36. package/dist/index.node.d.mts.map +1 -1
  37. package/dist/index.node.d.ts +2372 -1039
  38. package/dist/index.node.d.ts.map +1 -1
  39. package/dist/index.node.js +3094 -1399
  40. package/dist/index.node.js.map +1 -1
  41. package/dist/index.node.mjs +3075 -1399
  42. package/dist/index.node.mjs.map +1 -1
  43. package/docs/integrator.md +78 -0
  44. package/package.json +11 -6
@@ -0,0 +1,1365 @@
1
+ {
2
+ "id": "3157ba1a-2669-43a5-b783-ee4508042d9f",
3
+ "prevId": "4808e28b-98ab-4a0b-a0cb-0cb669f14291",
4
+ "version": "7",
5
+ "dialect": "postgresql",
6
+ "tables": {
7
+ "router_v1.6.callbacks": {
8
+ "name": "callbacks",
9
+ "schema": "router_v1.6",
10
+ "columns": {
11
+ "id": {
12
+ "name": "id",
13
+ "type": "varchar(66)",
14
+ "primaryKey": true,
15
+ "notNull": true
16
+ },
17
+ "position_chain_id": {
18
+ "name": "position_chain_id",
19
+ "type": "bigint",
20
+ "primaryKey": false,
21
+ "notNull": true
22
+ },
23
+ "position_contract": {
24
+ "name": "position_contract",
25
+ "type": "varchar(42)",
26
+ "primaryKey": false,
27
+ "notNull": true
28
+ },
29
+ "position_user": {
30
+ "name": "position_user",
31
+ "type": "varchar(42)",
32
+ "primaryKey": false,
33
+ "notNull": true
34
+ },
35
+ "amount": {
36
+ "name": "amount",
37
+ "type": "numeric(78, 0)",
38
+ "primaryKey": false,
39
+ "notNull": false
40
+ }
41
+ },
42
+ "indexes": {},
43
+ "foreignKeys": {
44
+ "callbacks_positions_fk": {
45
+ "name": "callbacks_positions_fk",
46
+ "tableFrom": "callbacks",
47
+ "tableTo": "positions",
48
+ "schemaTo": "router_v1.6",
49
+ "columnsFrom": ["position_chain_id", "position_contract", "position_user"],
50
+ "columnsTo": ["chain_id", "contract", "user"],
51
+ "onDelete": "cascade",
52
+ "onUpdate": "no action"
53
+ }
54
+ },
55
+ "compositePrimaryKeys": {},
56
+ "uniqueConstraints": {},
57
+ "policies": {},
58
+ "checkConstraints": {},
59
+ "isRLSEnabled": false
60
+ },
61
+ "router_v1.6.chains": {
62
+ "name": "chains",
63
+ "schema": "router_v1.6",
64
+ "columns": {
65
+ "chain_id": {
66
+ "name": "chain_id",
67
+ "type": "bigint",
68
+ "primaryKey": false,
69
+ "notNull": true
70
+ },
71
+ "block_number": {
72
+ "name": "block_number",
73
+ "type": "bigint",
74
+ "primaryKey": false,
75
+ "notNull": true
76
+ },
77
+ "epoch": {
78
+ "name": "epoch",
79
+ "type": "numeric(78, 0)",
80
+ "primaryKey": false,
81
+ "notNull": true,
82
+ "default": "'0'"
83
+ },
84
+ "updated_at": {
85
+ "name": "updated_at",
86
+ "type": "timestamp",
87
+ "primaryKey": false,
88
+ "notNull": true,
89
+ "default": "now()"
90
+ }
91
+ },
92
+ "indexes": {
93
+ "chains_id_epoch_idx": {
94
+ "name": "chains_id_epoch_idx",
95
+ "columns": [
96
+ {
97
+ "expression": "chain_id",
98
+ "isExpression": false,
99
+ "asc": true,
100
+ "nulls": "last"
101
+ },
102
+ {
103
+ "expression": "epoch",
104
+ "isExpression": false,
105
+ "asc": true,
106
+ "nulls": "last"
107
+ }
108
+ ],
109
+ "isUnique": true,
110
+ "concurrently": false,
111
+ "method": "btree",
112
+ "with": {}
113
+ }
114
+ },
115
+ "foreignKeys": {},
116
+ "compositePrimaryKeys": {},
117
+ "uniqueConstraints": {},
118
+ "policies": {},
119
+ "checkConstraints": {},
120
+ "isRLSEnabled": false
121
+ },
122
+ "router_v1.6.collectors": {
123
+ "name": "collectors",
124
+ "schema": "router_v1.6",
125
+ "columns": {
126
+ "chain_id": {
127
+ "name": "chain_id",
128
+ "type": "bigint",
129
+ "primaryKey": false,
130
+ "notNull": true
131
+ },
132
+ "name": {
133
+ "name": "name",
134
+ "type": "text",
135
+ "primaryKey": false,
136
+ "notNull": true
137
+ },
138
+ "block_number": {
139
+ "name": "block_number",
140
+ "type": "bigint",
141
+ "primaryKey": false,
142
+ "notNull": true
143
+ },
144
+ "epoch": {
145
+ "name": "epoch",
146
+ "type": "numeric(78, 0)",
147
+ "primaryKey": false,
148
+ "notNull": true,
149
+ "default": "'0'"
150
+ },
151
+ "updated_at": {
152
+ "name": "updated_at",
153
+ "type": "timestamp",
154
+ "primaryKey": false,
155
+ "notNull": true,
156
+ "default": "now()"
157
+ }
158
+ },
159
+ "indexes": {
160
+ "collectors_chain_name_epoch_idx": {
161
+ "name": "collectors_chain_name_epoch_idx",
162
+ "columns": [
163
+ {
164
+ "expression": "chain_id",
165
+ "isExpression": false,
166
+ "asc": true,
167
+ "nulls": "last"
168
+ },
169
+ {
170
+ "expression": "name",
171
+ "isExpression": false,
172
+ "asc": true,
173
+ "nulls": "last"
174
+ },
175
+ {
176
+ "expression": "epoch",
177
+ "isExpression": false,
178
+ "asc": true,
179
+ "nulls": "last"
180
+ }
181
+ ],
182
+ "isUnique": true,
183
+ "concurrently": false,
184
+ "method": "btree",
185
+ "with": {}
186
+ }
187
+ },
188
+ "foreignKeys": {},
189
+ "compositePrimaryKeys": {},
190
+ "uniqueConstraints": {},
191
+ "policies": {},
192
+ "checkConstraints": {},
193
+ "isRLSEnabled": false
194
+ },
195
+ "router_v1.6.consumed_events": {
196
+ "name": "consumed_events",
197
+ "schema": "router_v1.6",
198
+ "columns": {
199
+ "event_id": {
200
+ "name": "event_id",
201
+ "type": "varchar(128)",
202
+ "primaryKey": true,
203
+ "notNull": true
204
+ },
205
+ "chain_id": {
206
+ "name": "chain_id",
207
+ "type": "bigint",
208
+ "primaryKey": false,
209
+ "notNull": true
210
+ },
211
+ "maker": {
212
+ "name": "maker",
213
+ "type": "varchar(42)",
214
+ "primaryKey": false,
215
+ "notNull": true
216
+ },
217
+ "group": {
218
+ "name": "group",
219
+ "type": "varchar(66)",
220
+ "primaryKey": false,
221
+ "notNull": true
222
+ },
223
+ "amount": {
224
+ "name": "amount",
225
+ "type": "numeric(78, 0)",
226
+ "primaryKey": false,
227
+ "notNull": true
228
+ },
229
+ "block_number": {
230
+ "name": "block_number",
231
+ "type": "bigint",
232
+ "primaryKey": false,
233
+ "notNull": true
234
+ },
235
+ "created_at": {
236
+ "name": "created_at",
237
+ "type": "timestamp",
238
+ "primaryKey": false,
239
+ "notNull": true,
240
+ "default": "now()"
241
+ }
242
+ },
243
+ "indexes": {
244
+ "consumed_events_group_idx": {
245
+ "name": "consumed_events_group_idx",
246
+ "columns": [
247
+ {
248
+ "expression": "chain_id",
249
+ "isExpression": false,
250
+ "asc": true,
251
+ "nulls": "last"
252
+ },
253
+ {
254
+ "expression": "maker",
255
+ "isExpression": false,
256
+ "asc": true,
257
+ "nulls": "last"
258
+ },
259
+ {
260
+ "expression": "group",
261
+ "isExpression": false,
262
+ "asc": true,
263
+ "nulls": "last"
264
+ }
265
+ ],
266
+ "isUnique": false,
267
+ "concurrently": false,
268
+ "method": "btree",
269
+ "with": {}
270
+ },
271
+ "consumed_events_block_number_idx": {
272
+ "name": "consumed_events_block_number_idx",
273
+ "columns": [
274
+ {
275
+ "expression": "block_number",
276
+ "isExpression": false,
277
+ "asc": true,
278
+ "nulls": "last"
279
+ }
280
+ ],
281
+ "isUnique": false,
282
+ "concurrently": false,
283
+ "method": "btree",
284
+ "with": {}
285
+ }
286
+ },
287
+ "foreignKeys": {
288
+ "consumed_events_groups_fk": {
289
+ "name": "consumed_events_groups_fk",
290
+ "tableFrom": "consumed_events",
291
+ "tableTo": "groups",
292
+ "schemaTo": "router_v1.6",
293
+ "columnsFrom": ["chain_id", "maker", "group"],
294
+ "columnsTo": ["chain_id", "maker", "group"],
295
+ "onDelete": "cascade",
296
+ "onUpdate": "no action"
297
+ }
298
+ },
299
+ "compositePrimaryKeys": {},
300
+ "uniqueConstraints": {},
301
+ "policies": {},
302
+ "checkConstraints": {},
303
+ "isRLSEnabled": false
304
+ },
305
+ "router_v1.6.groups": {
306
+ "name": "groups",
307
+ "schema": "router_v1.6",
308
+ "columns": {
309
+ "chain_id": {
310
+ "name": "chain_id",
311
+ "type": "bigint",
312
+ "primaryKey": false,
313
+ "notNull": true
314
+ },
315
+ "maker": {
316
+ "name": "maker",
317
+ "type": "varchar(42)",
318
+ "primaryKey": false,
319
+ "notNull": true
320
+ },
321
+ "group": {
322
+ "name": "group",
323
+ "type": "varchar(66)",
324
+ "primaryKey": false,
325
+ "notNull": true
326
+ },
327
+ "consumed": {
328
+ "name": "consumed",
329
+ "type": "numeric(78, 0)",
330
+ "primaryKey": false,
331
+ "notNull": true
332
+ },
333
+ "block_number": {
334
+ "name": "block_number",
335
+ "type": "bigint",
336
+ "primaryKey": false,
337
+ "notNull": true
338
+ },
339
+ "updated_at": {
340
+ "name": "updated_at",
341
+ "type": "timestamp",
342
+ "primaryKey": false,
343
+ "notNull": true,
344
+ "default": "now()"
345
+ }
346
+ },
347
+ "indexes": {
348
+ "groups_chain_id_maker_group_consumed_idx": {
349
+ "name": "groups_chain_id_maker_group_consumed_idx",
350
+ "columns": [
351
+ {
352
+ "expression": "chain_id",
353
+ "isExpression": false,
354
+ "asc": true,
355
+ "nulls": "last"
356
+ },
357
+ {
358
+ "expression": "maker",
359
+ "isExpression": false,
360
+ "asc": true,
361
+ "nulls": "last"
362
+ },
363
+ {
364
+ "expression": "group",
365
+ "isExpression": false,
366
+ "asc": true,
367
+ "nulls": "last"
368
+ },
369
+ {
370
+ "expression": "consumed",
371
+ "isExpression": false,
372
+ "asc": true,
373
+ "nulls": "last"
374
+ }
375
+ ],
376
+ "isUnique": false,
377
+ "concurrently": false,
378
+ "method": "btree",
379
+ "with": {}
380
+ }
381
+ },
382
+ "foreignKeys": {},
383
+ "compositePrimaryKeys": {
384
+ "groups_pk": {
385
+ "name": "groups_pk",
386
+ "columns": ["chain_id", "maker", "group"]
387
+ }
388
+ },
389
+ "uniqueConstraints": {},
390
+ "policies": {},
391
+ "checkConstraints": {},
392
+ "isRLSEnabled": false
393
+ },
394
+ "router_v1.6.lots": {
395
+ "name": "lots",
396
+ "schema": "router_v1.6",
397
+ "columns": {
398
+ "chain_id": {
399
+ "name": "chain_id",
400
+ "type": "bigint",
401
+ "primaryKey": false,
402
+ "notNull": true
403
+ },
404
+ "user": {
405
+ "name": "user",
406
+ "type": "varchar(42)",
407
+ "primaryKey": false,
408
+ "notNull": true
409
+ },
410
+ "contract": {
411
+ "name": "contract",
412
+ "type": "varchar(42)",
413
+ "primaryKey": false,
414
+ "notNull": true
415
+ },
416
+ "group": {
417
+ "name": "group",
418
+ "type": "varchar(66)",
419
+ "primaryKey": false,
420
+ "notNull": true
421
+ },
422
+ "lower": {
423
+ "name": "lower",
424
+ "type": "numeric(78, 0)",
425
+ "primaryKey": false,
426
+ "notNull": true
427
+ },
428
+ "upper": {
429
+ "name": "upper",
430
+ "type": "numeric(78, 0)",
431
+ "primaryKey": false,
432
+ "notNull": true
433
+ }
434
+ },
435
+ "indexes": {},
436
+ "foreignKeys": {
437
+ "lots_positions_fk": {
438
+ "name": "lots_positions_fk",
439
+ "tableFrom": "lots",
440
+ "tableTo": "positions",
441
+ "schemaTo": "router_v1.6",
442
+ "columnsFrom": ["chain_id", "contract", "user"],
443
+ "columnsTo": ["chain_id", "contract", "user"],
444
+ "onDelete": "cascade",
445
+ "onUpdate": "no action"
446
+ },
447
+ "lots_groups_fk": {
448
+ "name": "lots_groups_fk",
449
+ "tableFrom": "lots",
450
+ "tableTo": "groups",
451
+ "schemaTo": "router_v1.6",
452
+ "columnsFrom": ["chain_id", "user", "group"],
453
+ "columnsTo": ["chain_id", "maker", "group"],
454
+ "onDelete": "cascade",
455
+ "onUpdate": "no action"
456
+ }
457
+ },
458
+ "compositePrimaryKeys": {
459
+ "lots_pk": {
460
+ "name": "lots_pk",
461
+ "columns": ["chain_id", "user", "contract", "group"]
462
+ }
463
+ },
464
+ "uniqueConstraints": {},
465
+ "policies": {},
466
+ "checkConstraints": {},
467
+ "isRLSEnabled": false
468
+ },
469
+ "router_v1.6.obligation_collaterals_v2": {
470
+ "name": "obligation_collaterals_v2",
471
+ "schema": "router_v1.6",
472
+ "columns": {
473
+ "obligation_id": {
474
+ "name": "obligation_id",
475
+ "type": "varchar(66)",
476
+ "primaryKey": false,
477
+ "notNull": true
478
+ },
479
+ "asset": {
480
+ "name": "asset",
481
+ "type": "varchar(42)",
482
+ "primaryKey": false,
483
+ "notNull": true
484
+ },
485
+ "oracle_chain_id": {
486
+ "name": "oracle_chain_id",
487
+ "type": "bigint",
488
+ "primaryKey": false,
489
+ "notNull": true
490
+ },
491
+ "oracle_address": {
492
+ "name": "oracle_address",
493
+ "type": "varchar(42)",
494
+ "primaryKey": false,
495
+ "notNull": true
496
+ },
497
+ "lltv": {
498
+ "name": "lltv",
499
+ "type": "bigint",
500
+ "primaryKey": false,
501
+ "notNull": true
502
+ },
503
+ "block_number": {
504
+ "name": "block_number",
505
+ "type": "bigint",
506
+ "primaryKey": false,
507
+ "notNull": true
508
+ },
509
+ "updated_at": {
510
+ "name": "updated_at",
511
+ "type": "timestamp",
512
+ "primaryKey": false,
513
+ "notNull": true,
514
+ "default": "now()"
515
+ }
516
+ },
517
+ "indexes": {
518
+ "obligation_collaterals_v2_obligation_id_idx": {
519
+ "name": "obligation_collaterals_v2_obligation_id_idx",
520
+ "columns": [
521
+ {
522
+ "expression": "obligation_id",
523
+ "isExpression": false,
524
+ "asc": true,
525
+ "nulls": "last"
526
+ }
527
+ ],
528
+ "isUnique": false,
529
+ "concurrently": false,
530
+ "method": "btree",
531
+ "with": {}
532
+ },
533
+ "obligation_collaterals_v2_oracle_fk_idx": {
534
+ "name": "obligation_collaterals_v2_oracle_fk_idx",
535
+ "columns": [
536
+ {
537
+ "expression": "oracle_chain_id",
538
+ "isExpression": false,
539
+ "asc": true,
540
+ "nulls": "last"
541
+ },
542
+ {
543
+ "expression": "oracle_address",
544
+ "isExpression": false,
545
+ "asc": true,
546
+ "nulls": "last"
547
+ }
548
+ ],
549
+ "isUnique": false,
550
+ "concurrently": false,
551
+ "method": "btree",
552
+ "with": {}
553
+ }
554
+ },
555
+ "foreignKeys": {
556
+ "obligation_collaterals_v2_obligation_id_obligations_obligation_id_fk": {
557
+ "name": "obligation_collaterals_v2_obligation_id_obligations_obligation_id_fk",
558
+ "tableFrom": "obligation_collaterals_v2",
559
+ "tableTo": "obligations",
560
+ "schemaTo": "router_v1.6",
561
+ "columnsFrom": ["obligation_id"],
562
+ "columnsTo": ["obligation_id"],
563
+ "onDelete": "cascade",
564
+ "onUpdate": "no action"
565
+ },
566
+ "obligation_collaterals_v2_oracles_fk": {
567
+ "name": "obligation_collaterals_v2_oracles_fk",
568
+ "tableFrom": "obligation_collaterals_v2",
569
+ "tableTo": "oracles",
570
+ "schemaTo": "router_v1.6",
571
+ "columnsFrom": ["oracle_chain_id", "oracle_address"],
572
+ "columnsTo": ["chain_id", "address"],
573
+ "onDelete": "no action",
574
+ "onUpdate": "no action"
575
+ }
576
+ },
577
+ "compositePrimaryKeys": {
578
+ "obligation_collaterals_v2_pk": {
579
+ "name": "obligation_collaterals_v2_pk",
580
+ "columns": ["obligation_id", "asset"]
581
+ }
582
+ },
583
+ "uniqueConstraints": {},
584
+ "policies": {},
585
+ "checkConstraints": {},
586
+ "isRLSEnabled": false
587
+ },
588
+ "router_v1.6.obligations": {
589
+ "name": "obligations",
590
+ "schema": "router_v1.6",
591
+ "columns": {
592
+ "obligation_id": {
593
+ "name": "obligation_id",
594
+ "type": "varchar(66)",
595
+ "primaryKey": true,
596
+ "notNull": true
597
+ },
598
+ "chain_id": {
599
+ "name": "chain_id",
600
+ "type": "bigint",
601
+ "primaryKey": false,
602
+ "notNull": true
603
+ },
604
+ "loan_token": {
605
+ "name": "loan_token",
606
+ "type": "varchar(42)",
607
+ "primaryKey": false,
608
+ "notNull": true
609
+ },
610
+ "maturity": {
611
+ "name": "maturity",
612
+ "type": "integer",
613
+ "primaryKey": false,
614
+ "notNull": true
615
+ }
616
+ },
617
+ "indexes": {},
618
+ "foreignKeys": {},
619
+ "compositePrimaryKeys": {},
620
+ "uniqueConstraints": {},
621
+ "policies": {},
622
+ "checkConstraints": {},
623
+ "isRLSEnabled": false
624
+ },
625
+ "router_v1.6.offers": {
626
+ "name": "offers",
627
+ "schema": "router_v1.6",
628
+ "columns": {
629
+ "hash": {
630
+ "name": "hash",
631
+ "type": "varchar(66)",
632
+ "primaryKey": true,
633
+ "notNull": true
634
+ },
635
+ "obligation_id": {
636
+ "name": "obligation_id",
637
+ "type": "varchar(66)",
638
+ "primaryKey": false,
639
+ "notNull": true
640
+ },
641
+ "assets": {
642
+ "name": "assets",
643
+ "type": "numeric(78, 0)",
644
+ "primaryKey": false,
645
+ "notNull": true
646
+ },
647
+ "rate": {
648
+ "name": "rate",
649
+ "type": "numeric(78, 0)",
650
+ "primaryKey": false,
651
+ "notNull": true
652
+ },
653
+ "maturity": {
654
+ "name": "maturity",
655
+ "type": "integer",
656
+ "primaryKey": false,
657
+ "notNull": true
658
+ },
659
+ "expiry": {
660
+ "name": "expiry",
661
+ "type": "integer",
662
+ "primaryKey": false,
663
+ "notNull": true
664
+ },
665
+ "start": {
666
+ "name": "start",
667
+ "type": "integer",
668
+ "primaryKey": false,
669
+ "notNull": true
670
+ },
671
+ "group_chain_id": {
672
+ "name": "group_chain_id",
673
+ "type": "bigint",
674
+ "primaryKey": false,
675
+ "notNull": true
676
+ },
677
+ "group_maker": {
678
+ "name": "group_maker",
679
+ "type": "varchar(42)",
680
+ "primaryKey": false,
681
+ "notNull": true
682
+ },
683
+ "group_group": {
684
+ "name": "group_group",
685
+ "type": "varchar(66)",
686
+ "primaryKey": false,
687
+ "notNull": true
688
+ },
689
+ "nonce": {
690
+ "name": "nonce",
691
+ "type": "varchar(66)",
692
+ "primaryKey": false,
693
+ "notNull": true
694
+ },
695
+ "buy": {
696
+ "name": "buy",
697
+ "type": "boolean",
698
+ "primaryKey": false,
699
+ "notNull": true
700
+ },
701
+ "callback_address": {
702
+ "name": "callback_address",
703
+ "type": "varchar(42)",
704
+ "primaryKey": false,
705
+ "notNull": true
706
+ },
707
+ "callback_data": {
708
+ "name": "callback_data",
709
+ "type": "text",
710
+ "primaryKey": false,
711
+ "notNull": true
712
+ },
713
+ "block_number": {
714
+ "name": "block_number",
715
+ "type": "bigint",
716
+ "primaryKey": false,
717
+ "notNull": true
718
+ },
719
+ "updated_at": {
720
+ "name": "updated_at",
721
+ "type": "timestamp",
722
+ "primaryKey": false,
723
+ "notNull": true,
724
+ "default": "now()"
725
+ }
726
+ },
727
+ "indexes": {
728
+ "offers_group_fk_idx": {
729
+ "name": "offers_group_fk_idx",
730
+ "columns": [
731
+ {
732
+ "expression": "group_chain_id",
733
+ "isExpression": false,
734
+ "asc": true,
735
+ "nulls": "last"
736
+ },
737
+ {
738
+ "expression": "group_maker",
739
+ "isExpression": false,
740
+ "asc": true,
741
+ "nulls": "last"
742
+ },
743
+ {
744
+ "expression": "group_group",
745
+ "isExpression": false,
746
+ "asc": true,
747
+ "nulls": "last"
748
+ }
749
+ ],
750
+ "isUnique": false,
751
+ "concurrently": false,
752
+ "method": "btree",
753
+ "with": {}
754
+ },
755
+ "offers_group_and_hash_idx": {
756
+ "name": "offers_group_and_hash_idx",
757
+ "columns": [
758
+ {
759
+ "expression": "group_chain_id",
760
+ "isExpression": false,
761
+ "asc": true,
762
+ "nulls": "last"
763
+ },
764
+ {
765
+ "expression": "group_maker",
766
+ "isExpression": false,
767
+ "asc": true,
768
+ "nulls": "last"
769
+ },
770
+ {
771
+ "expression": "group_group",
772
+ "isExpression": false,
773
+ "asc": true,
774
+ "nulls": "last"
775
+ },
776
+ {
777
+ "expression": "hash",
778
+ "isExpression": false,
779
+ "asc": true,
780
+ "nulls": "last"
781
+ }
782
+ ],
783
+ "isUnique": false,
784
+ "concurrently": false,
785
+ "method": "btree",
786
+ "with": {}
787
+ },
788
+ "offers_group_winner_sell_side_idx": {
789
+ "name": "offers_group_winner_sell_side_idx",
790
+ "columns": [
791
+ {
792
+ "expression": "group_chain_id",
793
+ "isExpression": false,
794
+ "asc": true,
795
+ "nulls": "last"
796
+ },
797
+ {
798
+ "expression": "group_maker",
799
+ "isExpression": false,
800
+ "asc": true,
801
+ "nulls": "last"
802
+ },
803
+ {
804
+ "expression": "group_group",
805
+ "isExpression": false,
806
+ "asc": true,
807
+ "nulls": "last"
808
+ },
809
+ {
810
+ "expression": "\"rate\" desc",
811
+ "asc": true,
812
+ "isExpression": true,
813
+ "nulls": "last"
814
+ },
815
+ {
816
+ "expression": "\"block_number\" asc",
817
+ "asc": true,
818
+ "isExpression": true,
819
+ "nulls": "last"
820
+ },
821
+ {
822
+ "expression": "\"assets\" desc",
823
+ "asc": true,
824
+ "isExpression": true,
825
+ "nulls": "last"
826
+ },
827
+ {
828
+ "expression": "\"hash\" asc",
829
+ "asc": true,
830
+ "isExpression": true,
831
+ "nulls": "last"
832
+ }
833
+ ],
834
+ "isUnique": false,
835
+ "concurrently": false,
836
+ "method": "btree",
837
+ "with": {}
838
+ },
839
+ "offers_group_winner_buy_side_idx": {
840
+ "name": "offers_group_winner_buy_side_idx",
841
+ "columns": [
842
+ {
843
+ "expression": "group_chain_id",
844
+ "isExpression": false,
845
+ "asc": true,
846
+ "nulls": "last"
847
+ },
848
+ {
849
+ "expression": "group_maker",
850
+ "isExpression": false,
851
+ "asc": true,
852
+ "nulls": "last"
853
+ },
854
+ {
855
+ "expression": "group_group",
856
+ "isExpression": false,
857
+ "asc": true,
858
+ "nulls": "last"
859
+ },
860
+ {
861
+ "expression": "\"rate\" asc",
862
+ "asc": true,
863
+ "isExpression": true,
864
+ "nulls": "last"
865
+ },
866
+ {
867
+ "expression": "\"block_number\" asc",
868
+ "asc": true,
869
+ "isExpression": true,
870
+ "nulls": "last"
871
+ },
872
+ {
873
+ "expression": "\"assets\" desc",
874
+ "asc": true,
875
+ "isExpression": true,
876
+ "nulls": "last"
877
+ },
878
+ {
879
+ "expression": "\"hash\" asc",
880
+ "asc": true,
881
+ "isExpression": true,
882
+ "nulls": "last"
883
+ }
884
+ ],
885
+ "isUnique": false,
886
+ "concurrently": false,
887
+ "method": "btree",
888
+ "with": {}
889
+ },
890
+ "offers_obligation_id_side_idx": {
891
+ "name": "offers_obligation_id_side_idx",
892
+ "columns": [
893
+ {
894
+ "expression": "obligation_id",
895
+ "isExpression": false,
896
+ "asc": true,
897
+ "nulls": "last"
898
+ },
899
+ {
900
+ "expression": "buy",
901
+ "isExpression": false,
902
+ "asc": true,
903
+ "nulls": "last"
904
+ }
905
+ ],
906
+ "isUnique": false,
907
+ "concurrently": false,
908
+ "method": "btree",
909
+ "with": {}
910
+ }
911
+ },
912
+ "foreignKeys": {
913
+ "offers_obligation_id_obligations_obligation_id_fk": {
914
+ "name": "offers_obligation_id_obligations_obligation_id_fk",
915
+ "tableFrom": "offers",
916
+ "tableTo": "obligations",
917
+ "schemaTo": "router_v1.6",
918
+ "columnsFrom": ["obligation_id"],
919
+ "columnsTo": ["obligation_id"],
920
+ "onDelete": "cascade",
921
+ "onUpdate": "no action"
922
+ },
923
+ "offers_groups_fk": {
924
+ "name": "offers_groups_fk",
925
+ "tableFrom": "offers",
926
+ "tableTo": "groups",
927
+ "schemaTo": "router_v1.6",
928
+ "columnsFrom": ["group_chain_id", "group_maker", "group_group"],
929
+ "columnsTo": ["chain_id", "maker", "group"],
930
+ "onDelete": "cascade",
931
+ "onUpdate": "no action"
932
+ }
933
+ },
934
+ "compositePrimaryKeys": {},
935
+ "uniqueConstraints": {},
936
+ "policies": {},
937
+ "checkConstraints": {},
938
+ "isRLSEnabled": false
939
+ },
940
+ "router_v1.6.offers_callbacks": {
941
+ "name": "offers_callbacks",
942
+ "schema": "router_v1.6",
943
+ "columns": {
944
+ "offer_hash": {
945
+ "name": "offer_hash",
946
+ "type": "varchar(66)",
947
+ "primaryKey": false,
948
+ "notNull": true
949
+ },
950
+ "callback_id": {
951
+ "name": "callback_id",
952
+ "type": "varchar(66)",
953
+ "primaryKey": false,
954
+ "notNull": false
955
+ }
956
+ },
957
+ "indexes": {},
958
+ "foreignKeys": {
959
+ "offers_callbacks_offer_hash_offers_hash_fk": {
960
+ "name": "offers_callbacks_offer_hash_offers_hash_fk",
961
+ "tableFrom": "offers_callbacks",
962
+ "tableTo": "offers",
963
+ "schemaTo": "router_v1.6",
964
+ "columnsFrom": ["offer_hash"],
965
+ "columnsTo": ["hash"],
966
+ "onDelete": "cascade",
967
+ "onUpdate": "no action"
968
+ }
969
+ },
970
+ "compositePrimaryKeys": {
971
+ "offers_callbacks_pk": {
972
+ "name": "offers_callbacks_pk",
973
+ "columns": ["offer_hash", "callback_id"]
974
+ }
975
+ },
976
+ "uniqueConstraints": {},
977
+ "policies": {},
978
+ "checkConstraints": {},
979
+ "isRLSEnabled": false
980
+ },
981
+ "router_v1.6.oracles": {
982
+ "name": "oracles",
983
+ "schema": "router_v1.6",
984
+ "columns": {
985
+ "chain_id": {
986
+ "name": "chain_id",
987
+ "type": "bigint",
988
+ "primaryKey": false,
989
+ "notNull": true
990
+ },
991
+ "address": {
992
+ "name": "address",
993
+ "type": "varchar(42)",
994
+ "primaryKey": false,
995
+ "notNull": true
996
+ },
997
+ "price": {
998
+ "name": "price",
999
+ "type": "numeric(78, 0)",
1000
+ "primaryKey": false,
1001
+ "notNull": false
1002
+ },
1003
+ "block_number": {
1004
+ "name": "block_number",
1005
+ "type": "bigint",
1006
+ "primaryKey": false,
1007
+ "notNull": true
1008
+ },
1009
+ "updated_at": {
1010
+ "name": "updated_at",
1011
+ "type": "timestamp",
1012
+ "primaryKey": false,
1013
+ "notNull": true,
1014
+ "default": "now()"
1015
+ }
1016
+ },
1017
+ "indexes": {},
1018
+ "foreignKeys": {},
1019
+ "compositePrimaryKeys": {
1020
+ "oracles_pk": {
1021
+ "name": "oracles_pk",
1022
+ "columns": ["chain_id", "address"]
1023
+ }
1024
+ },
1025
+ "uniqueConstraints": {},
1026
+ "policies": {},
1027
+ "checkConstraints": {},
1028
+ "isRLSEnabled": false
1029
+ },
1030
+ "router_v1.6.position_types": {
1031
+ "name": "position_types",
1032
+ "schema": "router_v1.6",
1033
+ "columns": {
1034
+ "id": {
1035
+ "name": "id",
1036
+ "type": "serial",
1037
+ "primaryKey": true,
1038
+ "notNull": true
1039
+ },
1040
+ "type": {
1041
+ "name": "type",
1042
+ "type": "position_type",
1043
+ "typeSchema": "router_v1.6",
1044
+ "primaryKey": false,
1045
+ "notNull": true
1046
+ }
1047
+ },
1048
+ "indexes": {},
1049
+ "foreignKeys": {},
1050
+ "compositePrimaryKeys": {},
1051
+ "uniqueConstraints": {},
1052
+ "policies": {},
1053
+ "checkConstraints": {},
1054
+ "isRLSEnabled": false
1055
+ },
1056
+ "router_v1.6.positions": {
1057
+ "name": "positions",
1058
+ "schema": "router_v1.6",
1059
+ "columns": {
1060
+ "chain_id": {
1061
+ "name": "chain_id",
1062
+ "type": "bigint",
1063
+ "primaryKey": false,
1064
+ "notNull": true
1065
+ },
1066
+ "contract": {
1067
+ "name": "contract",
1068
+ "type": "varchar(42)",
1069
+ "primaryKey": false,
1070
+ "notNull": true
1071
+ },
1072
+ "user": {
1073
+ "name": "user",
1074
+ "type": "varchar(42)",
1075
+ "primaryKey": false,
1076
+ "notNull": true
1077
+ },
1078
+ "position_type_id": {
1079
+ "name": "position_type_id",
1080
+ "type": "integer",
1081
+ "primaryKey": false,
1082
+ "notNull": true
1083
+ },
1084
+ "balance": {
1085
+ "name": "balance",
1086
+ "type": "numeric(78, 0)",
1087
+ "primaryKey": false,
1088
+ "notNull": false
1089
+ },
1090
+ "asset": {
1091
+ "name": "asset",
1092
+ "type": "varchar(42)",
1093
+ "primaryKey": false,
1094
+ "notNull": false
1095
+ },
1096
+ "block_number": {
1097
+ "name": "block_number",
1098
+ "type": "bigint",
1099
+ "primaryKey": false,
1100
+ "notNull": true
1101
+ },
1102
+ "updated_at": {
1103
+ "name": "updated_at",
1104
+ "type": "timestamp",
1105
+ "primaryKey": false,
1106
+ "notNull": true,
1107
+ "default": "now()"
1108
+ }
1109
+ },
1110
+ "indexes": {},
1111
+ "foreignKeys": {
1112
+ "positions_position_type_id_position_types_id_fk": {
1113
+ "name": "positions_position_type_id_position_types_id_fk",
1114
+ "tableFrom": "positions",
1115
+ "tableTo": "position_types",
1116
+ "schemaTo": "router_v1.6",
1117
+ "columnsFrom": ["position_type_id"],
1118
+ "columnsTo": ["id"],
1119
+ "onDelete": "no action",
1120
+ "onUpdate": "no action"
1121
+ }
1122
+ },
1123
+ "compositePrimaryKeys": {
1124
+ "positions_pk": {
1125
+ "name": "positions_pk",
1126
+ "columns": ["chain_id", "contract", "user"]
1127
+ }
1128
+ },
1129
+ "uniqueConstraints": {},
1130
+ "policies": {},
1131
+ "checkConstraints": {},
1132
+ "isRLSEnabled": false
1133
+ },
1134
+ "router_v1.6.status": {
1135
+ "name": "status",
1136
+ "schema": "router_v1.6",
1137
+ "columns": {
1138
+ "id": {
1139
+ "name": "id",
1140
+ "type": "serial",
1141
+ "primaryKey": true,
1142
+ "notNull": true
1143
+ },
1144
+ "code": {
1145
+ "name": "code",
1146
+ "type": "status_code",
1147
+ "typeSchema": "router_v1.6",
1148
+ "primaryKey": false,
1149
+ "notNull": false
1150
+ }
1151
+ },
1152
+ "indexes": {},
1153
+ "foreignKeys": {},
1154
+ "compositePrimaryKeys": {},
1155
+ "uniqueConstraints": {
1156
+ "status_code_unique": {
1157
+ "name": "status_code_unique",
1158
+ "nullsNotDistinct": false,
1159
+ "columns": ["code"]
1160
+ }
1161
+ },
1162
+ "policies": {},
1163
+ "checkConstraints": {},
1164
+ "isRLSEnabled": false
1165
+ },
1166
+ "router_v1.6.transfers": {
1167
+ "name": "transfers",
1168
+ "schema": "router_v1.6",
1169
+ "columns": {
1170
+ "event_id": {
1171
+ "name": "event_id",
1172
+ "type": "varchar(128)",
1173
+ "primaryKey": true,
1174
+ "notNull": true
1175
+ },
1176
+ "chain_id": {
1177
+ "name": "chain_id",
1178
+ "type": "bigint",
1179
+ "primaryKey": false,
1180
+ "notNull": true
1181
+ },
1182
+ "contract": {
1183
+ "name": "contract",
1184
+ "type": "varchar(42)",
1185
+ "primaryKey": false,
1186
+ "notNull": true
1187
+ },
1188
+ "from": {
1189
+ "name": "from",
1190
+ "type": "varchar(42)",
1191
+ "primaryKey": false,
1192
+ "notNull": true
1193
+ },
1194
+ "to": {
1195
+ "name": "to",
1196
+ "type": "varchar(42)",
1197
+ "primaryKey": false,
1198
+ "notNull": true
1199
+ },
1200
+ "value": {
1201
+ "name": "value",
1202
+ "type": "numeric(78, 0)",
1203
+ "primaryKey": false,
1204
+ "notNull": true
1205
+ },
1206
+ "block_number": {
1207
+ "name": "block_number",
1208
+ "type": "bigint",
1209
+ "primaryKey": false,
1210
+ "notNull": true
1211
+ },
1212
+ "created_at": {
1213
+ "name": "created_at",
1214
+ "type": "timestamp",
1215
+ "primaryKey": false,
1216
+ "notNull": true,
1217
+ "default": "now()"
1218
+ }
1219
+ },
1220
+ "indexes": {
1221
+ "transfers_chain_contract_user_idx": {
1222
+ "name": "transfers_chain_contract_user_idx",
1223
+ "columns": [
1224
+ {
1225
+ "expression": "chain_id",
1226
+ "isExpression": false,
1227
+ "asc": true,
1228
+ "nulls": "last"
1229
+ },
1230
+ {
1231
+ "expression": "contract",
1232
+ "isExpression": false,
1233
+ "asc": true,
1234
+ "nulls": "last"
1235
+ },
1236
+ {
1237
+ "expression": "from",
1238
+ "isExpression": false,
1239
+ "asc": true,
1240
+ "nulls": "last"
1241
+ },
1242
+ {
1243
+ "expression": "to",
1244
+ "isExpression": false,
1245
+ "asc": true,
1246
+ "nulls": "last"
1247
+ },
1248
+ {
1249
+ "expression": "block_number",
1250
+ "isExpression": false,
1251
+ "asc": true,
1252
+ "nulls": "last"
1253
+ }
1254
+ ],
1255
+ "isUnique": false,
1256
+ "concurrently": false,
1257
+ "method": "btree",
1258
+ "with": {}
1259
+ }
1260
+ },
1261
+ "foreignKeys": {
1262
+ "transfers_positions_from_fk": {
1263
+ "name": "transfers_positions_from_fk",
1264
+ "tableFrom": "transfers",
1265
+ "tableTo": "positions",
1266
+ "schemaTo": "router_v1.6",
1267
+ "columnsFrom": ["chain_id", "contract", "from"],
1268
+ "columnsTo": ["chain_id", "contract", "user"],
1269
+ "onDelete": "cascade",
1270
+ "onUpdate": "no action"
1271
+ },
1272
+ "transfers_positions_to_fk": {
1273
+ "name": "transfers_positions_to_fk",
1274
+ "tableFrom": "transfers",
1275
+ "tableTo": "positions",
1276
+ "schemaTo": "router_v1.6",
1277
+ "columnsFrom": ["chain_id", "contract", "to"],
1278
+ "columnsTo": ["chain_id", "contract", "user"],
1279
+ "onDelete": "cascade",
1280
+ "onUpdate": "no action"
1281
+ }
1282
+ },
1283
+ "compositePrimaryKeys": {},
1284
+ "uniqueConstraints": {},
1285
+ "policies": {},
1286
+ "checkConstraints": {},
1287
+ "isRLSEnabled": false
1288
+ },
1289
+ "router_v1.6.validations": {
1290
+ "name": "validations",
1291
+ "schema": "router_v1.6",
1292
+ "columns": {
1293
+ "offer_hash": {
1294
+ "name": "offer_hash",
1295
+ "type": "varchar(66)",
1296
+ "primaryKey": true,
1297
+ "notNull": true
1298
+ },
1299
+ "status_id": {
1300
+ "name": "status_id",
1301
+ "type": "integer",
1302
+ "primaryKey": false,
1303
+ "notNull": true
1304
+ },
1305
+ "updated_at": {
1306
+ "name": "updated_at",
1307
+ "type": "timestamp",
1308
+ "primaryKey": false,
1309
+ "notNull": true,
1310
+ "default": "now()"
1311
+ }
1312
+ },
1313
+ "indexes": {},
1314
+ "foreignKeys": {
1315
+ "validations_offer_hash_offers_hash_fk": {
1316
+ "name": "validations_offer_hash_offers_hash_fk",
1317
+ "tableFrom": "validations",
1318
+ "tableTo": "offers",
1319
+ "schemaTo": "router_v1.6",
1320
+ "columnsFrom": ["offer_hash"],
1321
+ "columnsTo": ["hash"],
1322
+ "onDelete": "cascade",
1323
+ "onUpdate": "no action"
1324
+ },
1325
+ "validations_status_id_status_id_fk": {
1326
+ "name": "validations_status_id_status_id_fk",
1327
+ "tableFrom": "validations",
1328
+ "tableTo": "status",
1329
+ "schemaTo": "router_v1.6",
1330
+ "columnsFrom": ["status_id"],
1331
+ "columnsTo": ["id"],
1332
+ "onDelete": "no action",
1333
+ "onUpdate": "no action"
1334
+ }
1335
+ },
1336
+ "compositePrimaryKeys": {},
1337
+ "uniqueConstraints": {},
1338
+ "policies": {},
1339
+ "checkConstraints": {},
1340
+ "isRLSEnabled": false
1341
+ }
1342
+ },
1343
+ "enums": {
1344
+ "router_v1.6.position_type": {
1345
+ "name": "position_type",
1346
+ "schema": "router_v1.6",
1347
+ "values": ["erc20", "vault_v1"]
1348
+ },
1349
+ "router_v1.6.status_code": {
1350
+ "name": "status_code",
1351
+ "schema": "router_v1.6",
1352
+ "values": ["VALID", "SIMULATION_ERROR"]
1353
+ }
1354
+ },
1355
+ "schemas": {},
1356
+ "sequences": {},
1357
+ "roles": {},
1358
+ "policies": {},
1359
+ "views": {},
1360
+ "_meta": {
1361
+ "columns": {},
1362
+ "schemas": {},
1363
+ "tables": {}
1364
+ }
1365
+ }