@morpho-dev/router 0.2.0 → 0.2.1

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 (65) hide show
  1. package/README.md +3 -3
  2. package/dist/chunk-jass6xSI.mjs +13 -0
  3. package/dist/cli.js +6566 -7032
  4. package/dist/drizzle/migrations/0000_setup_single_migration_folder.sql +204 -0
  5. package/dist/drizzle/{router_v1.5/0006_add-trigger-for-consumed-events.sql → migrations/0001_add-trigger-for-consumed-events.sql} +6 -6
  6. package/dist/drizzle/migrations/0002_insert-status-code.sql +1 -0
  7. package/dist/drizzle/migrations/0003_update-triggers-for-consumed-events.sql +3 -0
  8. package/dist/drizzle/migrations/0004_drop-status-offers-foreign-key-constraint.sql +1 -0
  9. package/dist/drizzle/migrations/0005_add-index-to-boost-group-query-and-offer-hash.sql +1 -0
  10. package/dist/drizzle/migrations/0006_add-callbacks-and-positions-relations.sql +37 -0
  11. package/dist/drizzle/migrations/0008_validation.sql +15 -0
  12. package/dist/drizzle/migrations/0009_add-transfers-table.sql +14 -0
  13. package/dist/drizzle/migrations/0010_add-price.sql +1 -0
  14. package/dist/drizzle/migrations/0011_nullable-callback-amount.sql +1 -0
  15. package/dist/drizzle/migrations/0012_add-position-asset.sql +1 -0
  16. package/dist/drizzle/migrations/0013_remove-depecrated-domains.sql +13 -0
  17. package/dist/drizzle/migrations/0014_rename-offers-v2-into-offers.sql +23 -0
  18. package/dist/drizzle/{router_v1.5/meta/0008_snapshot.json → migrations/meta/0000_snapshot.json} +50 -50
  19. package/dist/drizzle/{router_v1.5/meta/0006_snapshot.json → migrations/meta/0001_snapshot.json} +150 -62
  20. package/dist/drizzle/migrations/meta/0002_snapshot.json +1752 -0
  21. package/dist/drizzle/migrations/meta/0003_snapshot.json +1752 -0
  22. package/dist/drizzle/{router_v1.5/meta/0007_snapshot.json → migrations/meta/0004_snapshot.json} +57 -67
  23. package/dist/drizzle/{router_v1.5 → migrations}/meta/0005_snapshot.json +181 -70
  24. package/dist/drizzle/{router_v1.5/meta/0004_snapshot.json → migrations/meta/0006_snapshot.json} +466 -62
  25. package/dist/drizzle/migrations/meta/0008_snapshot.json +1955 -0
  26. package/dist/drizzle/migrations/meta/0009_snapshot.json +2078 -0
  27. package/dist/drizzle/migrations/meta/0010_snapshot.json +2084 -0
  28. package/dist/drizzle/{router_v1.5/meta/0001_snapshot.json → migrations/meta/0013_snapshot.json} +492 -606
  29. package/dist/drizzle/{router_v1.5/meta/0002_snapshot.json → migrations/meta/0014_snapshot.json} +538 -711
  30. package/dist/drizzle/migrations/meta/_journal.json +104 -0
  31. package/dist/index.browser.d.mts +2794 -0
  32. package/dist/index.browser.d.mts.map +1 -0
  33. package/dist/index.browser.d.ts +2127 -1737
  34. package/dist/index.browser.d.ts.map +1 -0
  35. package/dist/index.browser.js +3789 -2911
  36. package/dist/index.browser.js.map +1 -1
  37. package/dist/index.browser.mjs +3581 -2850
  38. package/dist/index.browser.mjs.map +1 -1
  39. package/dist/index.node.d.mts +4987 -0
  40. package/dist/index.node.d.mts.map +1 -0
  41. package/dist/index.node.d.ts +4279 -4410
  42. package/dist/index.node.d.ts.map +1 -0
  43. package/dist/index.node.js +7742 -7158
  44. package/dist/index.node.js.map +1 -1
  45. package/dist/index.node.mjs +7479 -7106
  46. package/dist/index.node.mjs.map +1 -1
  47. package/package.json +16 -6
  48. package/dist/cli.js.map +0 -1
  49. package/dist/drizzle/VERSION.ts +0 -3
  50. package/dist/drizzle/drizzle.config.ts +0 -18
  51. package/dist/drizzle/index.ts +0 -2
  52. package/dist/drizzle/router_v1.5/0000_add_block_number_to_liquidity_graph_and_offer_liquidity_pools_relation.sql +0 -122
  53. package/dist/drizzle/router_v1.5/0001_create_new_relations_to_prepare_new_liquidity_model.sql +0 -55
  54. package/dist/drizzle/router_v1.5/0002_add_new_offer_status_relation.sql +0 -9
  55. package/dist/drizzle/router_v1.5/0003_insert-status-code.sql +0 -1
  56. package/dist/drizzle/router_v1.5/0004_add_index_for_fast_book_lookup.sql +0 -3
  57. package/dist/drizzle/router_v1.5/0005_add_group_consumed_events_table.sql +0 -12
  58. package/dist/drizzle/router_v1.5/0007_update_index_for_fast_book_lookup.sql +0 -5
  59. package/dist/drizzle/router_v1.5/0008_rename_consumed_events_table.sql +0 -8
  60. package/dist/drizzle/router_v1.5/meta/0000_snapshot.json +0 -1028
  61. package/dist/drizzle/router_v1.5/meta/0003_snapshot.json +0 -1463
  62. package/dist/drizzle/router_v1.5/meta/_journal.json +0 -69
  63. package/dist/drizzle/schema.ts +0 -363
  64. package/dist/index.browser.d.cts +0 -2403
  65. package/dist/index.node.d.cts +0 -5119
@@ -1,12 +1,66 @@
1
1
  {
2
- "id": "e727a4ad-079c-4533-a86c-decd25a74e04",
3
- "prevId": "b1fce416-5707-4ab1-8125-c465e47cd17b",
2
+ "id": "4808e28b-98ab-4a0b-a0cb-0cb669f14291",
3
+ "prevId": "338470f8-fb65-4e1b-b42f-8e414a3826f3",
4
4
  "version": "7",
5
5
  "dialect": "postgresql",
6
6
  "tables": {
7
- "router_v1.5.chains": {
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": {
8
62
  "name": "chains",
9
- "schema": "router_v1.5",
63
+ "schema": "router_v1.6",
10
64
  "columns": {
11
65
  "chain_id": {
12
66
  "name": "chain_id",
@@ -65,9 +119,9 @@
65
119
  "checkConstraints": {},
66
120
  "isRLSEnabled": false
67
121
  },
68
- "router_v1.5.collectors": {
122
+ "router_v1.6.collectors": {
69
123
  "name": "collectors",
70
- "schema": "router_v1.5",
124
+ "schema": "router_v1.6",
71
125
  "columns": {
72
126
  "chain_id": {
73
127
  "name": "chain_id",
@@ -138,13 +192,13 @@
138
192
  "checkConstraints": {},
139
193
  "isRLSEnabled": false
140
194
  },
141
- "router_v1.5.consumed_per_user_and_nonce": {
142
- "name": "consumed_per_user_and_nonce",
143
- "schema": "router_v1.5",
195
+ "router_v1.6.consumed_events": {
196
+ "name": "consumed_events",
197
+ "schema": "router_v1.6",
144
198
  "columns": {
145
- "id": {
146
- "name": "id",
147
- "type": "varchar(255)",
199
+ "event_id": {
200
+ "name": "event_id",
201
+ "type": "varchar(128)",
148
202
  "primaryKey": true,
149
203
  "notNull": true
150
204
  },
@@ -154,20 +208,20 @@
154
208
  "primaryKey": false,
155
209
  "notNull": true
156
210
  },
157
- "offering": {
158
- "name": "offering",
211
+ "maker": {
212
+ "name": "maker",
159
213
  "type": "varchar(42)",
160
214
  "primaryKey": false,
161
215
  "notNull": true
162
216
  },
163
- "nonce": {
164
- "name": "nonce",
165
- "type": "bigint",
217
+ "group": {
218
+ "name": "group",
219
+ "type": "varchar(66)",
166
220
  "primaryKey": false,
167
221
  "notNull": true
168
222
  },
169
- "consumed": {
170
- "name": "consumed",
223
+ "amount": {
224
+ "name": "amount",
171
225
  "type": "numeric(78, 0)",
172
226
  "primaryKey": false,
173
227
  "notNull": true
@@ -187,8 +241,8 @@
187
241
  }
188
242
  },
189
243
  "indexes": {
190
- "consumed_per_user_and_nonce_chain_id_offering_nonce_block_number_idx": {
191
- "name": "consumed_per_user_and_nonce_chain_id_offering_nonce_block_number_idx",
244
+ "consumed_events_group_idx": {
245
+ "name": "consumed_events_group_idx",
192
246
  "columns": [
193
247
  {
194
248
  "expression": "chain_id",
@@ -197,21 +251,30 @@
197
251
  "nulls": "last"
198
252
  },
199
253
  {
200
- "expression": "offering",
254
+ "expression": "maker",
201
255
  "isExpression": false,
202
256
  "asc": true,
203
257
  "nulls": "last"
204
258
  },
205
259
  {
206
- "expression": "nonce",
260
+ "expression": "group",
207
261
  "isExpression": false,
208
262
  "asc": true,
209
263
  "nulls": "last"
210
- },
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": [
211
274
  {
212
- "expression": "\"block_number\" desc",
275
+ "expression": "block_number",
276
+ "isExpression": false,
213
277
  "asc": true,
214
- "isExpression": true,
215
278
  "nulls": "last"
216
279
  }
217
280
  ],
@@ -221,16 +284,27 @@
221
284
  "with": {}
222
285
  }
223
286
  },
224
- "foreignKeys": {},
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
+ },
225
299
  "compositePrimaryKeys": {},
226
300
  "uniqueConstraints": {},
227
301
  "policies": {},
228
302
  "checkConstraints": {},
229
303
  "isRLSEnabled": false
230
304
  },
231
- "router_v1.5.groups": {
305
+ "router_v1.6.groups": {
232
306
  "name": "groups",
233
- "schema": "router_v1.5",
307
+ "schema": "router_v1.6",
234
308
  "columns": {
235
309
  "chain_id": {
236
310
  "name": "chain_id",
@@ -270,193 +344,30 @@
270
344
  "default": "now()"
271
345
  }
272
346
  },
273
- "indexes": {},
274
- "foreignKeys": {},
275
- "compositePrimaryKeys": {
276
- "groups_pk": {
277
- "name": "groups_pk",
278
- "columns": ["chain_id", "maker", "group"]
279
- }
280
- },
281
- "uniqueConstraints": {},
282
- "policies": {},
283
- "checkConstraints": {},
284
- "isRLSEnabled": false
285
- },
286
- "router_v1.5.liquidity_links": {
287
- "name": "liquidity_links",
288
- "schema": "router_v1.5",
289
- "columns": {
290
- "parent_pool_id": {
291
- "name": "parent_pool_id",
292
- "type": "varchar(255)",
293
- "primaryKey": false,
294
- "notNull": true
295
- },
296
- "child_pool_id": {
297
- "name": "child_pool_id",
298
- "type": "varchar(255)",
299
- "primaryKey": false,
300
- "notNull": true
301
- },
302
- "priority": {
303
- "name": "priority",
304
- "type": "integer",
305
- "primaryKey": false,
306
- "notNull": true
307
- },
308
- "block_number": {
309
- "name": "block_number",
310
- "type": "bigint",
311
- "primaryKey": false,
312
- "notNull": true
313
- },
314
- "updated_at": {
315
- "name": "updated_at",
316
- "type": "timestamp",
317
- "primaryKey": false,
318
- "notNull": true,
319
- "default": "now()"
320
- }
321
- },
322
347
  "indexes": {
323
- "liquidity_links_parent_pool_id_idx": {
324
- "name": "liquidity_links_parent_pool_id_idx",
348
+ "groups_chain_id_maker_group_consumed_idx": {
349
+ "name": "groups_chain_id_maker_group_consumed_idx",
325
350
  "columns": [
326
351
  {
327
- "expression": "parent_pool_id",
352
+ "expression": "chain_id",
328
353
  "isExpression": false,
329
354
  "asc": true,
330
355
  "nulls": "last"
331
- }
332
- ],
333
- "isUnique": false,
334
- "concurrently": false,
335
- "method": "btree",
336
- "with": {}
337
- },
338
- "liquidity_links_child_pool_id_idx": {
339
- "name": "liquidity_links_child_pool_id_idx",
340
- "columns": [
356
+ },
341
357
  {
342
- "expression": "child_pool_id",
358
+ "expression": "maker",
343
359
  "isExpression": false,
344
360
  "asc": true,
345
361
  "nulls": "last"
346
- }
347
- ],
348
- "isUnique": false,
349
- "concurrently": false,
350
- "method": "btree",
351
- "with": {}
352
- }
353
- },
354
- "foreignKeys": {
355
- "liquidity_links_parent_pool_id_liquidity_pools_id_fk": {
356
- "name": "liquidity_links_parent_pool_id_liquidity_pools_id_fk",
357
- "tableFrom": "liquidity_links",
358
- "tableTo": "liquidity_pools",
359
- "schemaTo": "router_v1.5",
360
- "columnsFrom": ["parent_pool_id"],
361
- "columnsTo": ["id"],
362
- "onDelete": "cascade",
363
- "onUpdate": "no action"
364
- },
365
- "liquidity_links_child_pool_id_liquidity_pools_id_fk": {
366
- "name": "liquidity_links_child_pool_id_liquidity_pools_id_fk",
367
- "tableFrom": "liquidity_links",
368
- "tableTo": "liquidity_pools",
369
- "schemaTo": "router_v1.5",
370
- "columnsFrom": ["child_pool_id"],
371
- "columnsTo": ["id"],
372
- "onDelete": "cascade",
373
- "onUpdate": "no action"
374
- }
375
- },
376
- "compositePrimaryKeys": {
377
- "liquidity_links_pk": {
378
- "name": "liquidity_links_pk",
379
- "columns": ["parent_pool_id", "priority"]
380
- }
381
- },
382
- "uniqueConstraints": {},
383
- "policies": {},
384
- "checkConstraints": {},
385
- "isRLSEnabled": false
386
- },
387
- "router_v1.5.liquidity_pools": {
388
- "name": "liquidity_pools",
389
- "schema": "router_v1.5",
390
- "columns": {
391
- "id": {
392
- "name": "id",
393
- "type": "varchar(255)",
394
- "primaryKey": true,
395
- "notNull": true
396
- },
397
- "amount": {
398
- "name": "amount",
399
- "type": "numeric(78, 0)",
400
- "primaryKey": false,
401
- "notNull": true
402
- },
403
- "block_number": {
404
- "name": "block_number",
405
- "type": "bigint",
406
- "primaryKey": false,
407
- "notNull": true
408
- },
409
- "updated_at": {
410
- "name": "updated_at",
411
- "type": "timestamp",
412
- "primaryKey": false,
413
- "notNull": true,
414
- "default": "now()"
415
- }
416
- },
417
- "indexes": {},
418
- "foreignKeys": {},
419
- "compositePrimaryKeys": {},
420
- "uniqueConstraints": {},
421
- "policies": {},
422
- "checkConstraints": {},
423
- "isRLSEnabled": false
424
- },
425
- "router_v1.5.obligation_collaterals": {
426
- "name": "obligation_collaterals",
427
- "schema": "router_v1.5",
428
- "columns": {
429
- "obligation_id": {
430
- "name": "obligation_id",
431
- "type": "varchar(66)",
432
- "primaryKey": false,
433
- "notNull": true
434
- },
435
- "asset": {
436
- "name": "asset",
437
- "type": "varchar(42)",
438
- "primaryKey": false,
439
- "notNull": true
440
- },
441
- "oracle": {
442
- "name": "oracle",
443
- "type": "varchar(42)",
444
- "primaryKey": false,
445
- "notNull": true
446
- },
447
- "lltv": {
448
- "name": "lltv",
449
- "type": "bigint",
450
- "primaryKey": false,
451
- "notNull": true
452
- }
453
- },
454
- "indexes": {
455
- "obligation_collaterals_obligation_id_idx": {
456
- "name": "obligation_collaterals_obligation_id_idx",
457
- "columns": [
362
+ },
458
363
  {
459
- "expression": "obligation_id",
364
+ "expression": "group",
365
+ "isExpression": false,
366
+ "asc": true,
367
+ "nulls": "last"
368
+ },
369
+ {
370
+ "expression": "consumed",
460
371
  "isExpression": false,
461
372
  "asc": true,
462
373
  "nulls": "last"
@@ -468,22 +379,11 @@
468
379
  "with": {}
469
380
  }
470
381
  },
471
- "foreignKeys": {
472
- "obligation_collaterals_obligation_id_obligations_obligation_id_fk": {
473
- "name": "obligation_collaterals_obligation_id_obligations_obligation_id_fk",
474
- "tableFrom": "obligation_collaterals",
475
- "tableTo": "obligations",
476
- "schemaTo": "router_v1.5",
477
- "columnsFrom": ["obligation_id"],
478
- "columnsTo": ["obligation_id"],
479
- "onDelete": "cascade",
480
- "onUpdate": "no action"
481
- }
482
- },
382
+ "foreignKeys": {},
483
383
  "compositePrimaryKeys": {
484
- "obligation_collaterals_pk": {
485
- "name": "obligation_collaterals_pk",
486
- "columns": ["obligation_id", "asset"]
384
+ "groups_pk": {
385
+ "name": "groups_pk",
386
+ "columns": ["chain_id", "maker", "group"]
487
387
  }
488
388
  },
489
389
  "uniqueConstraints": {},
@@ -491,9 +391,9 @@
491
391
  "checkConstraints": {},
492
392
  "isRLSEnabled": false
493
393
  },
494
- "router_v1.5.obligation_collaterals_v2": {
394
+ "router_v1.6.obligation_collaterals_v2": {
495
395
  "name": "obligation_collaterals_v2",
496
- "schema": "router_v1.5",
396
+ "schema": "router_v1.6",
497
397
  "columns": {
498
398
  "obligation_id": {
499
399
  "name": "obligation_id",
@@ -582,7 +482,7 @@
582
482
  "name": "obligation_collaterals_v2_obligation_id_obligations_obligation_id_fk",
583
483
  "tableFrom": "obligation_collaterals_v2",
584
484
  "tableTo": "obligations",
585
- "schemaTo": "router_v1.5",
485
+ "schemaTo": "router_v1.6",
586
486
  "columnsFrom": ["obligation_id"],
587
487
  "columnsTo": ["obligation_id"],
588
488
  "onDelete": "cascade",
@@ -592,7 +492,7 @@
592
492
  "name": "obligation_collaterals_v2_oracles_fk",
593
493
  "tableFrom": "obligation_collaterals_v2",
594
494
  "tableTo": "oracles",
595
- "schemaTo": "router_v1.5",
495
+ "schemaTo": "router_v1.6",
596
496
  "columnsFrom": ["oracle_chain_id", "oracle_address"],
597
497
  "columnsTo": ["chain_id", "address"],
598
498
  "onDelete": "no action",
@@ -610,9 +510,9 @@
610
510
  "checkConstraints": {},
611
511
  "isRLSEnabled": false
612
512
  },
613
- "router_v1.5.obligations": {
513
+ "router_v1.6.obligations": {
614
514
  "name": "obligations",
615
- "schema": "router_v1.5",
515
+ "schema": "router_v1.6",
616
516
  "columns": {
617
517
  "obligation_id": {
618
518
  "name": "obligation_id",
@@ -647,206 +547,73 @@
647
547
  "checkConstraints": {},
648
548
  "isRLSEnabled": false
649
549
  },
650
- "router_v1.5.offer_liquidity_pools": {
651
- "name": "offer_liquidity_pools",
652
- "schema": "router_v1.5",
550
+ "router_v1.6.offers": {
551
+ "name": "offers",
552
+ "schema": "router_v1.6",
653
553
  "columns": {
654
- "offer_hash": {
655
- "name": "offer_hash",
554
+ "hash": {
555
+ "name": "hash",
556
+ "type": "varchar(66)",
557
+ "primaryKey": true,
558
+ "notNull": true
559
+ },
560
+ "obligation_id": {
561
+ "name": "obligation_id",
656
562
  "type": "varchar(66)",
657
563
  "primaryKey": false,
658
564
  "notNull": true
659
565
  },
660
- "pool_id": {
661
- "name": "pool_id",
662
- "type": "varchar(255)",
566
+ "assets": {
567
+ "name": "assets",
568
+ "type": "numeric(78, 0)",
663
569
  "primaryKey": false,
664
570
  "notNull": true
665
571
  },
666
- "amount": {
667
- "name": "amount",
572
+ "rate": {
573
+ "name": "rate",
668
574
  "type": "numeric(78, 0)",
669
575
  "primaryKey": false,
670
576
  "notNull": true
671
577
  },
672
- "block_number": {
673
- "name": "block_number",
674
- "type": "bigint",
578
+ "maturity": {
579
+ "name": "maturity",
580
+ "type": "integer",
675
581
  "primaryKey": false,
676
582
  "notNull": true
677
583
  },
678
- "updated_at": {
679
- "name": "updated_at",
680
- "type": "timestamp",
584
+ "expiry": {
585
+ "name": "expiry",
586
+ "type": "integer",
681
587
  "primaryKey": false,
682
- "notNull": true,
683
- "default": "now()"
684
- }
685
- },
686
- "indexes": {
687
- "offer_liquidity_pools_pool_id_idx": {
688
- "name": "offer_liquidity_pools_pool_id_idx",
689
- "columns": [
690
- {
691
- "expression": "pool_id",
692
- "isExpression": false,
693
- "asc": true,
694
- "nulls": "last"
695
- }
696
- ],
697
- "isUnique": false,
698
- "concurrently": false,
699
- "method": "btree",
700
- "with": {}
701
- }
702
- },
703
- "foreignKeys": {
704
- "offer_liquidity_pools_offer_hash_offers_hash_fk": {
705
- "name": "offer_liquidity_pools_offer_hash_offers_hash_fk",
706
- "tableFrom": "offer_liquidity_pools",
707
- "tableTo": "offers",
708
- "schemaTo": "router_v1.5",
709
- "columnsFrom": ["offer_hash"],
710
- "columnsTo": ["hash"],
711
- "onDelete": "cascade",
712
- "onUpdate": "no action"
713
- },
714
- "offer_liquidity_pools_pool_id_liquidity_pools_id_fk": {
715
- "name": "offer_liquidity_pools_pool_id_liquidity_pools_id_fk",
716
- "tableFrom": "offer_liquidity_pools",
717
- "tableTo": "liquidity_pools",
718
- "schemaTo": "router_v1.5",
719
- "columnsFrom": ["pool_id"],
720
- "columnsTo": ["id"],
721
- "onDelete": "cascade",
722
- "onUpdate": "no action"
723
- }
724
- },
725
- "compositePrimaryKeys": {
726
- "offer_liquidity_pools_pk": {
727
- "name": "offer_liquidity_pools_pk",
728
- "columns": ["offer_hash", "pool_id"]
729
- }
730
- },
731
- "uniqueConstraints": {},
732
- "policies": {},
733
- "checkConstraints": {},
734
- "isRLSEnabled": false
735
- },
736
- "router_v1.5.offer_status": {
737
- "name": "offer_status",
738
- "schema": "router_v1.5",
739
- "columns": {
740
- "offer_hash": {
741
- "name": "offer_hash",
742
- "type": "varchar(66)",
743
- "primaryKey": true,
744
588
  "notNull": true
745
589
  },
746
- "status_id": {
747
- "name": "status_id",
748
- "type": "serial",
590
+ "start": {
591
+ "name": "start",
592
+ "type": "integer",
749
593
  "primaryKey": false,
750
594
  "notNull": true
751
595
  },
752
- "block_number": {
753
- "name": "block_number",
596
+ "group_chain_id": {
597
+ "name": "group_chain_id",
754
598
  "type": "bigint",
755
599
  "primaryKey": false,
756
600
  "notNull": true
757
601
  },
758
- "updated_at": {
759
- "name": "updated_at",
760
- "type": "timestamp",
761
- "primaryKey": false,
762
- "notNull": true,
763
- "default": "now()"
764
- }
765
- },
766
- "indexes": {},
767
- "foreignKeys": {
768
- "offer_status_offer_hash_offers_v2_hash_fk": {
769
- "name": "offer_status_offer_hash_offers_v2_hash_fk",
770
- "tableFrom": "offer_status",
771
- "tableTo": "offers_v2",
772
- "schemaTo": "router_v1.5",
773
- "columnsFrom": ["offer_hash"],
774
- "columnsTo": ["hash"],
775
- "onDelete": "cascade",
776
- "onUpdate": "no action"
777
- },
778
- "offer_status_status_id_status_id_fk": {
779
- "name": "offer_status_status_id_status_id_fk",
780
- "tableFrom": "offer_status",
781
- "tableTo": "status",
782
- "schemaTo": "router_v1.5",
783
- "columnsFrom": ["status_id"],
784
- "columnsTo": ["id"],
785
- "onDelete": "cascade",
786
- "onUpdate": "no action"
787
- }
788
- },
789
- "compositePrimaryKeys": {},
790
- "uniqueConstraints": {},
791
- "policies": {},
792
- "checkConstraints": {},
793
- "isRLSEnabled": false
794
- },
795
- "router_v1.5.offers": {
796
- "name": "offers",
797
- "schema": "router_v1.5",
798
- "columns": {
799
- "hash": {
800
- "name": "hash",
801
- "type": "varchar(66)",
802
- "primaryKey": true,
803
- "notNull": true
804
- },
805
- "obligation_id": {
806
- "name": "obligation_id",
807
- "type": "varchar(66)",
808
- "primaryKey": false,
809
- "notNull": true
810
- },
811
- "offering": {
812
- "name": "offering",
602
+ "group_maker": {
603
+ "name": "group_maker",
813
604
  "type": "varchar(42)",
814
605
  "primaryKey": false,
815
606
  "notNull": true
816
607
  },
817
- "assets": {
818
- "name": "assets",
819
- "type": "numeric(78, 0)",
820
- "primaryKey": false,
821
- "notNull": true
822
- },
823
- "rate": {
824
- "name": "rate",
825
- "type": "bigint",
826
- "primaryKey": false,
827
- "notNull": true
828
- },
829
- "maturity": {
830
- "name": "maturity",
831
- "type": "integer",
832
- "primaryKey": false,
833
- "notNull": true
834
- },
835
- "expiry": {
836
- "name": "expiry",
837
- "type": "integer",
838
- "primaryKey": false,
839
- "notNull": true
840
- },
841
- "start": {
842
- "name": "start",
843
- "type": "integer",
608
+ "group_group": {
609
+ "name": "group_group",
610
+ "type": "varchar(66)",
844
611
  "primaryKey": false,
845
612
  "notNull": true
846
613
  },
847
614
  "nonce": {
848
615
  "name": "nonce",
849
- "type": "bigint",
616
+ "type": "varchar(66)",
850
617
  "primaryKey": false,
851
618
  "notNull": true
852
619
  },
@@ -856,18 +623,6 @@
856
623
  "primaryKey": false,
857
624
  "notNull": true
858
625
  },
859
- "chain_id": {
860
- "name": "chain_id",
861
- "type": "bigint",
862
- "primaryKey": false,
863
- "notNull": true
864
- },
865
- "loan_token": {
866
- "name": "loan_token",
867
- "type": "varchar(42)",
868
- "primaryKey": false,
869
- "notNull": true
870
- },
871
626
  "callback_address": {
872
627
  "name": "callback_address",
873
628
  "type": "varchar(42)",
@@ -880,68 +635,38 @@
880
635
  "primaryKey": false,
881
636
  "notNull": true
882
637
  },
883
- "callback_gas_limit": {
884
- "name": "callback_gas_limit",
638
+ "block_number": {
639
+ "name": "block_number",
885
640
  "type": "bigint",
886
641
  "primaryKey": false,
887
642
  "notNull": true
888
643
  },
889
- "signature": {
890
- "name": "signature",
891
- "type": "varchar(132)",
892
- "primaryKey": false,
893
- "notNull": false
894
- },
895
- "created_at": {
896
- "name": "created_at",
644
+ "updated_at": {
645
+ "name": "updated_at",
897
646
  "type": "timestamp",
898
647
  "primaryKey": false,
899
648
  "notNull": true,
900
649
  "default": "now()"
901
- },
902
- "block_number": {
903
- "name": "block_number",
904
- "type": "bigint",
905
- "primaryKey": false,
906
- "notNull": true
907
650
  }
908
651
  },
909
652
  "indexes": {
910
- "offers_obligation_id_idx": {
911
- "name": "offers_obligation_id_idx",
653
+ "offers_group_fk_idx": {
654
+ "name": "offers_group_fk_idx",
912
655
  "columns": [
913
656
  {
914
- "expression": "obligation_id",
657
+ "expression": "group_chain_id",
915
658
  "isExpression": false,
916
659
  "asc": true,
917
660
  "nulls": "last"
918
- }
919
- ],
920
- "isUnique": false,
921
- "concurrently": false,
922
- "method": "btree",
923
- "with": {}
924
- },
925
- "offers_offering_idx": {
926
- "name": "offers_offering_idx",
927
- "columns": [
661
+ },
928
662
  {
929
- "expression": "offering",
663
+ "expression": "group_maker",
930
664
  "isExpression": false,
931
665
  "asc": true,
932
666
  "nulls": "last"
933
- }
934
- ],
935
- "isUnique": false,
936
- "concurrently": false,
937
- "method": "btree",
938
- "with": {}
939
- },
940
- "offers_buy_idx": {
941
- "name": "offers_buy_idx",
942
- "columns": [
667
+ },
943
668
  {
944
- "expression": "buy",
669
+ "expression": "group_group",
945
670
  "isExpression": false,
946
671
  "asc": true,
947
672
  "nulls": "last"
@@ -952,56 +677,29 @@
952
677
  "method": "btree",
953
678
  "with": {}
954
679
  },
955
- "offers_chain_id_idx": {
956
- "name": "offers_chain_id_idx",
680
+ "offers_group_and_hash_idx": {
681
+ "name": "offers_group_and_hash_idx",
957
682
  "columns": [
958
683
  {
959
- "expression": "chain_id",
684
+ "expression": "group_chain_id",
960
685
  "isExpression": false,
961
686
  "asc": true,
962
687
  "nulls": "last"
963
- }
964
- ],
965
- "isUnique": false,
966
- "concurrently": false,
967
- "method": "btree",
968
- "with": {}
969
- },
970
- "offers_loan_token_idx": {
971
- "name": "offers_loan_token_idx",
972
- "columns": [
688
+ },
973
689
  {
974
- "expression": "loan_token",
690
+ "expression": "group_maker",
975
691
  "isExpression": false,
976
692
  "asc": true,
977
693
  "nulls": "last"
978
- }
979
- ],
980
- "isUnique": false,
981
- "concurrently": false,
982
- "method": "btree",
983
- "with": {}
984
- },
985
- "offers_maturity_idx": {
986
- "name": "offers_maturity_idx",
987
- "columns": [
694
+ },
988
695
  {
989
- "expression": "maturity",
696
+ "expression": "group_group",
990
697
  "isExpression": false,
991
698
  "asc": true,
992
699
  "nulls": "last"
993
- }
994
- ],
995
- "isUnique": false,
996
- "concurrently": false,
997
- "method": "btree",
998
- "with": {}
999
- },
1000
- "offers_expiry_idx": {
1001
- "name": "offers_expiry_idx",
1002
- "columns": [
700
+ },
1003
701
  {
1004
- "expression": "expiry",
702
+ "expression": "hash",
1005
703
  "isExpression": false,
1006
704
  "asc": true,
1007
705
  "nulls": "last"
@@ -1012,79 +710,49 @@
1012
710
  "method": "btree",
1013
711
  "with": {}
1014
712
  },
1015
- "offers_rate_idx": {
1016
- "name": "offers_rate_idx",
713
+ "offers_group_winner_sell_side_idx": {
714
+ "name": "offers_group_winner_sell_side_idx",
1017
715
  "columns": [
1018
716
  {
1019
- "expression": "rate",
717
+ "expression": "group_chain_id",
1020
718
  "isExpression": false,
1021
719
  "asc": true,
1022
720
  "nulls": "last"
1023
- }
1024
- ],
1025
- "isUnique": false,
1026
- "concurrently": false,
1027
- "method": "btree",
1028
- "with": {}
1029
- },
1030
- "offers_assets_idx": {
1031
- "name": "offers_assets_idx",
1032
- "columns": [
721
+ },
1033
722
  {
1034
- "expression": "assets",
723
+ "expression": "group_maker",
1035
724
  "isExpression": false,
1036
725
  "asc": true,
1037
726
  "nulls": "last"
1038
- }
1039
- ],
1040
- "isUnique": false,
1041
- "concurrently": false,
1042
- "method": "btree",
1043
- "with": {}
1044
- },
1045
- "offers_created_at_idx": {
1046
- "name": "offers_created_at_idx",
1047
- "columns": [
727
+ },
1048
728
  {
1049
- "expression": "created_at",
729
+ "expression": "group_group",
1050
730
  "isExpression": false,
1051
731
  "asc": true,
1052
732
  "nulls": "last"
1053
- }
1054
- ],
1055
- "isUnique": false,
1056
- "concurrently": false,
1057
- "method": "btree",
1058
- "with": {}
1059
- },
1060
- "offers_block_number_idx": {
1061
- "name": "offers_block_number_idx",
1062
- "columns": [
733
+ },
1063
734
  {
1064
- "expression": "block_number",
1065
- "isExpression": false,
735
+ "expression": "\"rate\" desc",
1066
736
  "asc": true,
737
+ "isExpression": true,
1067
738
  "nulls": "last"
1068
- }
1069
- ],
1070
- "isUnique": false,
1071
- "concurrently": false,
1072
- "method": "btree",
1073
- "with": {}
1074
- },
1075
- "offers_rate_hash_idx": {
1076
- "name": "offers_rate_hash_idx",
1077
- "columns": [
739
+ },
1078
740
  {
1079
- "expression": "rate",
1080
- "isExpression": false,
741
+ "expression": "\"block_number\" asc",
1081
742
  "asc": true,
743
+ "isExpression": true,
1082
744
  "nulls": "last"
1083
745
  },
1084
746
  {
1085
- "expression": "hash",
1086
- "isExpression": false,
747
+ "expression": "\"assets\" desc",
748
+ "asc": true,
749
+ "isExpression": true,
750
+ "nulls": "last"
751
+ },
752
+ {
753
+ "expression": "\"hash\" asc",
1087
754
  "asc": true,
755
+ "isExpression": true,
1088
756
  "nulls": "last"
1089
757
  }
1090
758
  ],
@@ -1093,61 +761,49 @@
1093
761
  "method": "btree",
1094
762
  "with": {}
1095
763
  },
1096
- "offers_maturity_hash_idx": {
1097
- "name": "offers_maturity_hash_idx",
764
+ "offers_group_winner_buy_side_idx": {
765
+ "name": "offers_group_winner_buy_side_idx",
1098
766
  "columns": [
1099
767
  {
1100
- "expression": "maturity",
768
+ "expression": "group_chain_id",
1101
769
  "isExpression": false,
1102
770
  "asc": true,
1103
771
  "nulls": "last"
1104
772
  },
1105
773
  {
1106
- "expression": "hash",
774
+ "expression": "group_maker",
1107
775
  "isExpression": false,
1108
776
  "asc": true,
1109
777
  "nulls": "last"
1110
- }
1111
- ],
1112
- "isUnique": false,
1113
- "concurrently": false,
1114
- "method": "btree",
1115
- "with": {}
1116
- },
1117
- "offers_expiry_hash_idx": {
1118
- "name": "offers_expiry_hash_idx",
1119
- "columns": [
778
+ },
1120
779
  {
1121
- "expression": "expiry",
780
+ "expression": "group_group",
1122
781
  "isExpression": false,
1123
782
  "asc": true,
1124
783
  "nulls": "last"
1125
784
  },
1126
785
  {
1127
- "expression": "hash",
1128
- "isExpression": false,
786
+ "expression": "\"rate\" asc",
1129
787
  "asc": true,
788
+ "isExpression": true,
1130
789
  "nulls": "last"
1131
- }
1132
- ],
1133
- "isUnique": false,
1134
- "concurrently": false,
1135
- "method": "btree",
1136
- "with": {}
1137
- },
1138
- "offers_assets_hash_idx": {
1139
- "name": "offers_assets_hash_idx",
1140
- "columns": [
790
+ },
1141
791
  {
1142
- "expression": "assets",
1143
- "isExpression": false,
792
+ "expression": "\"block_number\" asc",
1144
793
  "asc": true,
794
+ "isExpression": true,
1145
795
  "nulls": "last"
1146
796
  },
1147
797
  {
1148
- "expression": "hash",
1149
- "isExpression": false,
798
+ "expression": "\"assets\" desc",
799
+ "asc": true,
800
+ "isExpression": true,
801
+ "nulls": "last"
802
+ },
803
+ {
804
+ "expression": "\"hash\" asc",
1150
805
  "asc": true,
806
+ "isExpression": true,
1151
807
  "nulls": "last"
1152
808
  }
1153
809
  ],
@@ -1156,31 +812,19 @@
1156
812
  "method": "btree",
1157
813
  "with": {}
1158
814
  },
1159
- "offers_rate_created_at_assets_hash_idx": {
1160
- "name": "offers_rate_created_at_assets_hash_idx",
815
+ "offers_obligation_id_side_idx": {
816
+ "name": "offers_obligation_id_side_idx",
1161
817
  "columns": [
1162
818
  {
1163
- "expression": "rate",
819
+ "expression": "obligation_id",
1164
820
  "isExpression": false,
1165
821
  "asc": true,
1166
822
  "nulls": "last"
1167
823
  },
1168
824
  {
1169
- "expression": "\"created_at\" asc",
1170
- "asc": true,
1171
- "isExpression": true,
1172
- "nulls": "last"
1173
- },
1174
- {
1175
- "expression": "\"assets\" desc",
1176
- "asc": true,
1177
- "isExpression": true,
1178
- "nulls": "last"
1179
- },
1180
- {
1181
- "expression": "\"hash\" asc",
825
+ "expression": "buy",
826
+ "isExpression": false,
1182
827
  "asc": true,
1183
- "isExpression": true,
1184
828
  "nulls": "last"
1185
829
  }
1186
830
  ],
@@ -1190,109 +834,297 @@
1190
834
  "with": {}
1191
835
  }
1192
836
  },
1193
- "foreignKeys": {
1194
- "offers_obligation_id_obligations_obligation_id_fk": {
1195
- "name": "offers_obligation_id_obligations_obligation_id_fk",
1196
- "tableFrom": "offers",
1197
- "tableTo": "obligations",
1198
- "schemaTo": "router_v1.5",
1199
- "columnsFrom": ["obligation_id"],
1200
- "columnsTo": ["obligation_id"],
1201
- "onDelete": "cascade",
1202
- "onUpdate": "no action"
837
+ "foreignKeys": {
838
+ "offers_obligation_id_obligations_obligation_id_fk": {
839
+ "name": "offers_obligation_id_obligations_obligation_id_fk",
840
+ "tableFrom": "offers",
841
+ "tableTo": "obligations",
842
+ "schemaTo": "router_v1.6",
843
+ "columnsFrom": ["obligation_id"],
844
+ "columnsTo": ["obligation_id"],
845
+ "onDelete": "cascade",
846
+ "onUpdate": "no action"
847
+ },
848
+ "offers_groups_fk": {
849
+ "name": "offers_groups_fk",
850
+ "tableFrom": "offers",
851
+ "tableTo": "groups",
852
+ "schemaTo": "router_v1.6",
853
+ "columnsFrom": ["group_chain_id", "group_maker", "group_group"],
854
+ "columnsTo": ["chain_id", "maker", "group"],
855
+ "onDelete": "cascade",
856
+ "onUpdate": "no action"
857
+ }
858
+ },
859
+ "compositePrimaryKeys": {},
860
+ "uniqueConstraints": {},
861
+ "policies": {},
862
+ "checkConstraints": {},
863
+ "isRLSEnabled": false
864
+ },
865
+ "router_v1.6.offers_callbacks": {
866
+ "name": "offers_callbacks",
867
+ "schema": "router_v1.6",
868
+ "columns": {
869
+ "offer_hash": {
870
+ "name": "offer_hash",
871
+ "type": "varchar(66)",
872
+ "primaryKey": false,
873
+ "notNull": true
874
+ },
875
+ "callback_id": {
876
+ "name": "callback_id",
877
+ "type": "varchar(66)",
878
+ "primaryKey": false,
879
+ "notNull": false
880
+ }
881
+ },
882
+ "indexes": {},
883
+ "foreignKeys": {
884
+ "offers_callbacks_offer_hash_offers_hash_fk": {
885
+ "name": "offers_callbacks_offer_hash_offers_hash_fk",
886
+ "tableFrom": "offers_callbacks",
887
+ "tableTo": "offers",
888
+ "schemaTo": "router_v1.6",
889
+ "columnsFrom": ["offer_hash"],
890
+ "columnsTo": ["hash"],
891
+ "onDelete": "cascade",
892
+ "onUpdate": "no action"
893
+ }
894
+ },
895
+ "compositePrimaryKeys": {
896
+ "offers_callbacks_pk": {
897
+ "name": "offers_callbacks_pk",
898
+ "columns": ["offer_hash", "callback_id"]
899
+ }
900
+ },
901
+ "uniqueConstraints": {},
902
+ "policies": {},
903
+ "checkConstraints": {},
904
+ "isRLSEnabled": false
905
+ },
906
+ "router_v1.6.oracles": {
907
+ "name": "oracles",
908
+ "schema": "router_v1.6",
909
+ "columns": {
910
+ "chain_id": {
911
+ "name": "chain_id",
912
+ "type": "bigint",
913
+ "primaryKey": false,
914
+ "notNull": true
915
+ },
916
+ "address": {
917
+ "name": "address",
918
+ "type": "varchar(42)",
919
+ "primaryKey": false,
920
+ "notNull": true
921
+ },
922
+ "price": {
923
+ "name": "price",
924
+ "type": "numeric(78, 0)",
925
+ "primaryKey": false,
926
+ "notNull": false
927
+ },
928
+ "block_number": {
929
+ "name": "block_number",
930
+ "type": "bigint",
931
+ "primaryKey": false,
932
+ "notNull": true
933
+ },
934
+ "updated_at": {
935
+ "name": "updated_at",
936
+ "type": "timestamp",
937
+ "primaryKey": false,
938
+ "notNull": true,
939
+ "default": "now()"
940
+ }
941
+ },
942
+ "indexes": {},
943
+ "foreignKeys": {},
944
+ "compositePrimaryKeys": {
945
+ "oracles_pk": {
946
+ "name": "oracles_pk",
947
+ "columns": ["chain_id", "address"]
1203
948
  }
1204
949
  },
1205
- "compositePrimaryKeys": {},
1206
950
  "uniqueConstraints": {},
1207
951
  "policies": {},
1208
952
  "checkConstraints": {},
1209
953
  "isRLSEnabled": false
1210
954
  },
1211
- "router_v1.5.offers_v2": {
1212
- "name": "offers_v2",
1213
- "schema": "router_v1.5",
955
+ "router_v1.6.position_types": {
956
+ "name": "position_types",
957
+ "schema": "router_v1.6",
1214
958
  "columns": {
1215
- "hash": {
1216
- "name": "hash",
1217
- "type": "varchar(66)",
959
+ "id": {
960
+ "name": "id",
961
+ "type": "serial",
1218
962
  "primaryKey": true,
1219
963
  "notNull": true
1220
964
  },
1221
- "obligation_id": {
1222
- "name": "obligation_id",
1223
- "type": "varchar(66)",
965
+ "type": {
966
+ "name": "type",
967
+ "type": "position_type",
968
+ "typeSchema": "router_v1.6",
1224
969
  "primaryKey": false,
1225
970
  "notNull": true
1226
- },
1227
- "assets": {
1228
- "name": "assets",
1229
- "type": "numeric(78, 0)",
971
+ }
972
+ },
973
+ "indexes": {},
974
+ "foreignKeys": {},
975
+ "compositePrimaryKeys": {},
976
+ "uniqueConstraints": {},
977
+ "policies": {},
978
+ "checkConstraints": {},
979
+ "isRLSEnabled": false
980
+ },
981
+ "router_v1.6.positions": {
982
+ "name": "positions",
983
+ "schema": "router_v1.6",
984
+ "columns": {
985
+ "chain_id": {
986
+ "name": "chain_id",
987
+ "type": "bigint",
1230
988
  "primaryKey": false,
1231
989
  "notNull": true
1232
990
  },
1233
- "rate": {
1234
- "name": "rate",
1235
- "type": "numeric(78, 0)",
991
+ "contract": {
992
+ "name": "contract",
993
+ "type": "varchar(42)",
1236
994
  "primaryKey": false,
1237
995
  "notNull": true
1238
996
  },
1239
- "maturity": {
1240
- "name": "maturity",
1241
- "type": "integer",
997
+ "user": {
998
+ "name": "user",
999
+ "type": "varchar(42)",
1242
1000
  "primaryKey": false,
1243
1001
  "notNull": true
1244
1002
  },
1245
- "expiry": {
1246
- "name": "expiry",
1003
+ "position_type_id": {
1004
+ "name": "position_type_id",
1247
1005
  "type": "integer",
1248
1006
  "primaryKey": false,
1249
1007
  "notNull": true
1250
1008
  },
1251
- "start": {
1252
- "name": "start",
1253
- "type": "integer",
1009
+ "balance": {
1010
+ "name": "balance",
1011
+ "type": "numeric(78, 0)",
1254
1012
  "primaryKey": false,
1255
- "notNull": true
1013
+ "notNull": false
1256
1014
  },
1257
- "group_chain_id": {
1258
- "name": "group_chain_id",
1015
+ "asset": {
1016
+ "name": "asset",
1017
+ "type": "varchar(42)",
1018
+ "primaryKey": false,
1019
+ "notNull": false
1020
+ },
1021
+ "block_number": {
1022
+ "name": "block_number",
1259
1023
  "type": "bigint",
1260
1024
  "primaryKey": false,
1261
1025
  "notNull": true
1262
1026
  },
1263
- "group_maker": {
1264
- "name": "group_maker",
1265
- "type": "varchar(42)",
1027
+ "updated_at": {
1028
+ "name": "updated_at",
1029
+ "type": "timestamp",
1266
1030
  "primaryKey": false,
1031
+ "notNull": true,
1032
+ "default": "now()"
1033
+ }
1034
+ },
1035
+ "indexes": {},
1036
+ "foreignKeys": {
1037
+ "positions_position_type_id_position_types_id_fk": {
1038
+ "name": "positions_position_type_id_position_types_id_fk",
1039
+ "tableFrom": "positions",
1040
+ "tableTo": "position_types",
1041
+ "schemaTo": "router_v1.6",
1042
+ "columnsFrom": ["position_type_id"],
1043
+ "columnsTo": ["id"],
1044
+ "onDelete": "no action",
1045
+ "onUpdate": "no action"
1046
+ }
1047
+ },
1048
+ "compositePrimaryKeys": {
1049
+ "positions_pk": {
1050
+ "name": "positions_pk",
1051
+ "columns": ["chain_id", "contract", "user"]
1052
+ }
1053
+ },
1054
+ "uniqueConstraints": {},
1055
+ "policies": {},
1056
+ "checkConstraints": {},
1057
+ "isRLSEnabled": false
1058
+ },
1059
+ "router_v1.6.status": {
1060
+ "name": "status",
1061
+ "schema": "router_v1.6",
1062
+ "columns": {
1063
+ "id": {
1064
+ "name": "id",
1065
+ "type": "serial",
1066
+ "primaryKey": true,
1267
1067
  "notNull": true
1268
1068
  },
1269
- "group_group": {
1270
- "name": "group_group",
1271
- "type": "varchar(66)",
1069
+ "code": {
1070
+ "name": "code",
1071
+ "type": "status_code",
1072
+ "typeSchema": "router_v1.6",
1073
+ "primaryKey": false,
1074
+ "notNull": false
1075
+ }
1076
+ },
1077
+ "indexes": {},
1078
+ "foreignKeys": {},
1079
+ "compositePrimaryKeys": {},
1080
+ "uniqueConstraints": {
1081
+ "status_code_unique": {
1082
+ "name": "status_code_unique",
1083
+ "nullsNotDistinct": false,
1084
+ "columns": ["code"]
1085
+ }
1086
+ },
1087
+ "policies": {},
1088
+ "checkConstraints": {},
1089
+ "isRLSEnabled": false
1090
+ },
1091
+ "router_v1.6.transfers": {
1092
+ "name": "transfers",
1093
+ "schema": "router_v1.6",
1094
+ "columns": {
1095
+ "event_id": {
1096
+ "name": "event_id",
1097
+ "type": "varchar(128)",
1098
+ "primaryKey": true,
1099
+ "notNull": true
1100
+ },
1101
+ "chain_id": {
1102
+ "name": "chain_id",
1103
+ "type": "bigint",
1272
1104
  "primaryKey": false,
1273
1105
  "notNull": true
1274
1106
  },
1275
- "nonce": {
1276
- "name": "nonce",
1277
- "type": "varchar(66)",
1107
+ "contract": {
1108
+ "name": "contract",
1109
+ "type": "varchar(42)",
1278
1110
  "primaryKey": false,
1279
1111
  "notNull": true
1280
1112
  },
1281
- "buy": {
1282
- "name": "buy",
1283
- "type": "boolean",
1113
+ "from": {
1114
+ "name": "from",
1115
+ "type": "varchar(42)",
1284
1116
  "primaryKey": false,
1285
1117
  "notNull": true
1286
1118
  },
1287
- "callback_address": {
1288
- "name": "callback_address",
1119
+ "to": {
1120
+ "name": "to",
1289
1121
  "type": "varchar(42)",
1290
1122
  "primaryKey": false,
1291
1123
  "notNull": true
1292
1124
  },
1293
- "callback_data": {
1294
- "name": "callback_data",
1295
- "type": "text",
1125
+ "value": {
1126
+ "name": "value",
1127
+ "type": "numeric(78, 0)",
1296
1128
  "primaryKey": false,
1297
1129
  "notNull": true
1298
1130
  },
@@ -1302,8 +1134,8 @@
1302
1134
  "primaryKey": false,
1303
1135
  "notNull": true
1304
1136
  },
1305
- "updated_at": {
1306
- "name": "updated_at",
1137
+ "created_at": {
1138
+ "name": "created_at",
1307
1139
  "type": "timestamp",
1308
1140
  "primaryKey": false,
1309
1141
  "notNull": true,
@@ -1311,23 +1143,35 @@
1311
1143
  }
1312
1144
  },
1313
1145
  "indexes": {
1314
- "offers_v2_group_fk_idx": {
1315
- "name": "offers_v2_group_fk_idx",
1146
+ "transfers_chain_contract_user_idx": {
1147
+ "name": "transfers_chain_contract_user_idx",
1316
1148
  "columns": [
1317
1149
  {
1318
- "expression": "group_chain_id",
1150
+ "expression": "chain_id",
1319
1151
  "isExpression": false,
1320
1152
  "asc": true,
1321
1153
  "nulls": "last"
1322
1154
  },
1323
1155
  {
1324
- "expression": "group_maker",
1156
+ "expression": "contract",
1325
1157
  "isExpression": false,
1326
1158
  "asc": true,
1327
1159
  "nulls": "last"
1328
1160
  },
1329
1161
  {
1330
- "expression": "group_group",
1162
+ "expression": "from",
1163
+ "isExpression": false,
1164
+ "asc": true,
1165
+ "nulls": "last"
1166
+ },
1167
+ {
1168
+ "expression": "to",
1169
+ "isExpression": false,
1170
+ "asc": true,
1171
+ "nulls": "last"
1172
+ },
1173
+ {
1174
+ "expression": "block_number",
1331
1175
  "isExpression": false,
1332
1176
  "asc": true,
1333
1177
  "nulls": "last"
@@ -1340,23 +1184,23 @@
1340
1184
  }
1341
1185
  },
1342
1186
  "foreignKeys": {
1343
- "offers_v2_obligation_id_obligations_obligation_id_fk": {
1344
- "name": "offers_v2_obligation_id_obligations_obligation_id_fk",
1345
- "tableFrom": "offers_v2",
1346
- "tableTo": "obligations",
1347
- "schemaTo": "router_v1.5",
1348
- "columnsFrom": ["obligation_id"],
1349
- "columnsTo": ["obligation_id"],
1187
+ "transfers_positions_from_fk": {
1188
+ "name": "transfers_positions_from_fk",
1189
+ "tableFrom": "transfers",
1190
+ "tableTo": "positions",
1191
+ "schemaTo": "router_v1.6",
1192
+ "columnsFrom": ["chain_id", "contract", "from"],
1193
+ "columnsTo": ["chain_id", "contract", "user"],
1350
1194
  "onDelete": "cascade",
1351
1195
  "onUpdate": "no action"
1352
1196
  },
1353
- "offers_v2_groups_fk": {
1354
- "name": "offers_v2_groups_fk",
1355
- "tableFrom": "offers_v2",
1356
- "tableTo": "groups",
1357
- "schemaTo": "router_v1.5",
1358
- "columnsFrom": ["group_chain_id", "group_maker", "group_group"],
1359
- "columnsTo": ["chain_id", "maker", "group"],
1197
+ "transfers_positions_to_fk": {
1198
+ "name": "transfers_positions_to_fk",
1199
+ "tableFrom": "transfers",
1200
+ "tableTo": "positions",
1201
+ "schemaTo": "router_v1.6",
1202
+ "columnsFrom": ["chain_id", "contract", "to"],
1203
+ "columnsTo": ["chain_id", "contract", "user"],
1360
1204
  "onDelete": "cascade",
1361
1205
  "onUpdate": "no action"
1362
1206
  }
@@ -1367,25 +1211,19 @@
1367
1211
  "checkConstraints": {},
1368
1212
  "isRLSEnabled": false
1369
1213
  },
1370
- "router_v1.5.oracles": {
1371
- "name": "oracles",
1372
- "schema": "router_v1.5",
1214
+ "router_v1.6.validations": {
1215
+ "name": "validations",
1216
+ "schema": "router_v1.6",
1373
1217
  "columns": {
1374
- "chain_id": {
1375
- "name": "chain_id",
1376
- "type": "bigint",
1377
- "primaryKey": false,
1378
- "notNull": true
1379
- },
1380
- "address": {
1381
- "name": "address",
1382
- "type": "varchar(42)",
1383
- "primaryKey": false,
1218
+ "offer_hash": {
1219
+ "name": "offer_hash",
1220
+ "type": "varchar(66)",
1221
+ "primaryKey": true,
1384
1222
  "notNull": true
1385
1223
  },
1386
- "block_number": {
1387
- "name": "block_number",
1388
- "type": "bigint",
1224
+ "status_id": {
1225
+ "name": "status_id",
1226
+ "type": "integer",
1389
1227
  "primaryKey": false,
1390
1228
  "notNull": true
1391
1229
  },
@@ -1398,56 +1236,45 @@
1398
1236
  }
1399
1237
  },
1400
1238
  "indexes": {},
1401
- "foreignKeys": {},
1402
- "compositePrimaryKeys": {
1403
- "oracles_pk": {
1404
- "name": "oracles_pk",
1405
- "columns": ["chain_id", "address"]
1406
- }
1407
- },
1408
- "uniqueConstraints": {},
1409
- "policies": {},
1410
- "checkConstraints": {},
1411
- "isRLSEnabled": false
1412
- },
1413
- "router_v1.5.status": {
1414
- "name": "status",
1415
- "schema": "router_v1.5",
1416
- "columns": {
1417
- "id": {
1418
- "name": "id",
1419
- "type": "serial",
1420
- "primaryKey": true,
1421
- "notNull": true
1239
+ "foreignKeys": {
1240
+ "validations_offer_hash_offers_hash_fk": {
1241
+ "name": "validations_offer_hash_offers_hash_fk",
1242
+ "tableFrom": "validations",
1243
+ "tableTo": "offers",
1244
+ "schemaTo": "router_v1.6",
1245
+ "columnsFrom": ["offer_hash"],
1246
+ "columnsTo": ["hash"],
1247
+ "onDelete": "cascade",
1248
+ "onUpdate": "no action"
1422
1249
  },
1423
- "code": {
1424
- "name": "code",
1425
- "type": "status_code",
1426
- "typeSchema": "router_v1.5",
1427
- "primaryKey": false,
1428
- "notNull": false
1250
+ "validations_status_id_status_id_fk": {
1251
+ "name": "validations_status_id_status_id_fk",
1252
+ "tableFrom": "validations",
1253
+ "tableTo": "status",
1254
+ "schemaTo": "router_v1.6",
1255
+ "columnsFrom": ["status_id"],
1256
+ "columnsTo": ["id"],
1257
+ "onDelete": "no action",
1258
+ "onUpdate": "no action"
1429
1259
  }
1430
1260
  },
1431
- "indexes": {},
1432
- "foreignKeys": {},
1433
1261
  "compositePrimaryKeys": {},
1434
- "uniqueConstraints": {
1435
- "status_code_unique": {
1436
- "name": "status_code_unique",
1437
- "nullsNotDistinct": false,
1438
- "columns": ["code"]
1439
- }
1440
- },
1262
+ "uniqueConstraints": {},
1441
1263
  "policies": {},
1442
1264
  "checkConstraints": {},
1443
1265
  "isRLSEnabled": false
1444
1266
  }
1445
1267
  },
1446
1268
  "enums": {
1447
- "router_v1.5.status_code": {
1269
+ "router_v1.6.position_type": {
1270
+ "name": "position_type",
1271
+ "schema": "router_v1.6",
1272
+ "values": ["erc20", "vault_v1"]
1273
+ },
1274
+ "router_v1.6.status_code": {
1448
1275
  "name": "status_code",
1449
- "schema": "router_v1.5",
1450
- "values": ["VALID", "NOT_ENOUGH_LIQUIDITY"]
1276
+ "schema": "router_v1.6",
1277
+ "values": ["VALID", "SIMULATION_ERROR"]
1451
1278
  }
1452
1279
  },
1453
1280
  "schemas": {},