@morpho-dev/router 0.2.0 → 0.3.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 (68) hide show
  1. package/README.md +3 -3
  2. package/dist/chunk-jass6xSI.mjs +13 -0
  3. package/dist/cli.js +7202 -7027
  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/migrations/0015_add-lots-table.sql +12 -0
  19. package/dist/drizzle/migrations/0016_merkle-metadata.sql +26 -0
  20. package/dist/drizzle/{router_v1.5/meta/0008_snapshot.json → migrations/meta/0000_snapshot.json} +50 -50
  21. package/dist/drizzle/{router_v1.5/meta/0006_snapshot.json → migrations/meta/0001_snapshot.json} +150 -62
  22. package/dist/drizzle/migrations/meta/0002_snapshot.json +1752 -0
  23. package/dist/drizzle/migrations/meta/0003_snapshot.json +1752 -0
  24. package/dist/drizzle/{router_v1.5/meta/0007_snapshot.json → migrations/meta/0004_snapshot.json} +57 -67
  25. package/dist/drizzle/{router_v1.5 → migrations}/meta/0005_snapshot.json +181 -70
  26. package/dist/drizzle/{router_v1.5/meta/0004_snapshot.json → migrations/meta/0006_snapshot.json} +466 -62
  27. package/dist/drizzle/migrations/meta/0008_snapshot.json +1955 -0
  28. package/dist/drizzle/migrations/meta/0009_snapshot.json +2078 -0
  29. package/dist/drizzle/migrations/meta/0010_snapshot.json +2084 -0
  30. package/dist/drizzle/{router_v1.5/meta/0003_snapshot.json → migrations/meta/0013_snapshot.json} +535 -708
  31. package/dist/drizzle/migrations/meta/0014_snapshot.json +1290 -0
  32. package/dist/drizzle/{router_v1.5/meta/0001_snapshot.json → migrations/meta/0015_snapshot.json} +580 -619
  33. package/dist/drizzle/{router_v1.5/meta/0002_snapshot.json → migrations/meta/0016_snapshot.json} +714 -646
  34. package/dist/drizzle/migrations/meta/_journal.json +118 -0
  35. package/dist/index.browser.d.mts +3008 -0
  36. package/dist/index.browser.d.mts.map +1 -0
  37. package/dist/index.browser.d.ts +2418 -1818
  38. package/dist/index.browser.d.ts.map +1 -0
  39. package/dist/index.browser.js +4099 -2890
  40. package/dist/index.browser.js.map +1 -1
  41. package/dist/index.browser.mjs +3903 -2841
  42. package/dist/index.browser.mjs.map +1 -1
  43. package/dist/index.node.d.mts +5657 -0
  44. package/dist/index.node.d.mts.map +1 -0
  45. package/dist/index.node.d.ts +4965 -4426
  46. package/dist/index.node.d.ts.map +1 -0
  47. package/dist/index.node.js +8465 -7154
  48. package/dist/index.node.js.map +1 -1
  49. package/dist/index.node.mjs +8205 -7105
  50. package/dist/index.node.mjs.map +1 -1
  51. package/package.json +16 -7
  52. package/dist/cli.js.map +0 -1
  53. package/dist/drizzle/VERSION.ts +0 -3
  54. package/dist/drizzle/drizzle.config.ts +0 -18
  55. package/dist/drizzle/index.ts +0 -2
  56. package/dist/drizzle/router_v1.5/0000_add_block_number_to_liquidity_graph_and_offer_liquidity_pools_relation.sql +0 -122
  57. package/dist/drizzle/router_v1.5/0001_create_new_relations_to_prepare_new_liquidity_model.sql +0 -55
  58. package/dist/drizzle/router_v1.5/0002_add_new_offer_status_relation.sql +0 -9
  59. package/dist/drizzle/router_v1.5/0003_insert-status-code.sql +0 -1
  60. package/dist/drizzle/router_v1.5/0004_add_index_for_fast_book_lookup.sql +0 -3
  61. package/dist/drizzle/router_v1.5/0005_add_group_consumed_events_table.sql +0 -12
  62. package/dist/drizzle/router_v1.5/0007_update_index_for_fast_book_lookup.sql +0 -5
  63. package/dist/drizzle/router_v1.5/0008_rename_consumed_events_table.sql +0 -8
  64. package/dist/drizzle/router_v1.5/meta/0000_snapshot.json +0 -1028
  65. package/dist/drizzle/router_v1.5/meta/_journal.json +0 -69
  66. package/dist/drizzle/schema.ts +0 -363
  67. package/dist/index.browser.d.cts +0 -2403
  68. 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": "b68d3094-8a97-406e-9a3a-7380ee60ec28",
3
+ "prevId": "3157ba1a-2669-43a5-b783-ee4508042d9f",
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,7 +344,41 @@
270
344
  "default": "now()"
271
345
  }
272
346
  },
273
- "indexes": {},
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
+ },
274
382
  "foreignKeys": {},
275
383
  "compositePrimaryKeys": {
276
384
  "groups_pk": {
@@ -283,100 +391,74 @@
283
391
  "checkConstraints": {},
284
392
  "isRLSEnabled": false
285
393
  },
286
- "router_v1.5.liquidity_links": {
287
- "name": "liquidity_links",
288
- "schema": "router_v1.5",
394
+ "router_v1.6.lots": {
395
+ "name": "lots",
396
+ "schema": "router_v1.6",
289
397
  "columns": {
290
- "parent_pool_id": {
291
- "name": "parent_pool_id",
292
- "type": "varchar(255)",
398
+ "chain_id": {
399
+ "name": "chain_id",
400
+ "type": "bigint",
293
401
  "primaryKey": false,
294
402
  "notNull": true
295
403
  },
296
- "child_pool_id": {
297
- "name": "child_pool_id",
298
- "type": "varchar(255)",
404
+ "user": {
405
+ "name": "user",
406
+ "type": "varchar(42)",
299
407
  "primaryKey": false,
300
408
  "notNull": true
301
409
  },
302
- "priority": {
303
- "name": "priority",
304
- "type": "integer",
410
+ "contract": {
411
+ "name": "contract",
412
+ "type": "varchar(42)",
305
413
  "primaryKey": false,
306
414
  "notNull": true
307
415
  },
308
- "block_number": {
309
- "name": "block_number",
310
- "type": "bigint",
416
+ "group": {
417
+ "name": "group",
418
+ "type": "varchar(66)",
311
419
  "primaryKey": false,
312
420
  "notNull": true
313
421
  },
314
- "updated_at": {
315
- "name": "updated_at",
316
- "type": "timestamp",
422
+ "lower": {
423
+ "name": "lower",
424
+ "type": "numeric(78, 0)",
317
425
  "primaryKey": false,
318
- "notNull": true,
319
- "default": "now()"
320
- }
321
- },
322
- "indexes": {
323
- "liquidity_links_parent_pool_id_idx": {
324
- "name": "liquidity_links_parent_pool_id_idx",
325
- "columns": [
326
- {
327
- "expression": "parent_pool_id",
328
- "isExpression": false,
329
- "asc": true,
330
- "nulls": "last"
331
- }
332
- ],
333
- "isUnique": false,
334
- "concurrently": false,
335
- "method": "btree",
336
- "with": {}
426
+ "notNull": true
337
427
  },
338
- "liquidity_links_child_pool_id_idx": {
339
- "name": "liquidity_links_child_pool_id_idx",
340
- "columns": [
341
- {
342
- "expression": "child_pool_id",
343
- "isExpression": false,
344
- "asc": true,
345
- "nulls": "last"
346
- }
347
- ],
348
- "isUnique": false,
349
- "concurrently": false,
350
- "method": "btree",
351
- "with": {}
428
+ "upper": {
429
+ "name": "upper",
430
+ "type": "numeric(78, 0)",
431
+ "primaryKey": false,
432
+ "notNull": true
352
433
  }
353
434
  },
435
+ "indexes": {},
354
436
  "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"],
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"],
362
444
  "onDelete": "cascade",
363
445
  "onUpdate": "no action"
364
446
  },
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"],
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"],
372
454
  "onDelete": "cascade",
373
455
  "onUpdate": "no action"
374
456
  }
375
457
  },
376
458
  "compositePrimaryKeys": {
377
- "liquidity_links_pk": {
378
- "name": "liquidity_links_pk",
379
- "columns": ["parent_pool_id", "priority"]
459
+ "lots_pk": {
460
+ "name": "lots_pk",
461
+ "columns": ["chain_id", "user", "contract", "group"]
380
462
  }
381
463
  },
382
464
  "uniqueConstraints": {},
@@ -384,79 +466,42 @@
384
466
  "checkConstraints": {},
385
467
  "isRLSEnabled": false
386
468
  },
387
- "router_v1.5.liquidity_pools": {
388
- "name": "liquidity_pools",
389
- "schema": "router_v1.5",
469
+ "router_v1.6.merkle_paths": {
470
+ "name": "merkle_paths",
471
+ "schema": "router_v1.6",
390
472
  "columns": {
391
- "id": {
392
- "name": "id",
393
- "type": "varchar(255)",
473
+ "offer_hash": {
474
+ "name": "offer_hash",
475
+ "type": "varchar(66)",
394
476
  "primaryKey": true,
395
477
  "notNull": true
396
478
  },
397
- "amount": {
398
- "name": "amount",
399
- "type": "numeric(78, 0)",
479
+ "tree_root": {
480
+ "name": "tree_root",
481
+ "type": "varchar(66)",
400
482
  "primaryKey": false,
401
483
  "notNull": true
402
484
  },
403
- "block_number": {
404
- "name": "block_number",
405
- "type": "bigint",
485
+ "proof_nodes": {
486
+ "name": "proof_nodes",
487
+ "type": "text",
406
488
  "primaryKey": false,
407
489
  "notNull": true
408
490
  },
409
- "updated_at": {
410
- "name": "updated_at",
491
+ "created_at": {
492
+ "name": "created_at",
411
493
  "type": "timestamp",
412
494
  "primaryKey": false,
413
495
  "notNull": true,
414
496
  "default": "now()"
415
497
  }
416
498
  },
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
499
  "indexes": {
455
- "obligation_collaterals_obligation_id_idx": {
456
- "name": "obligation_collaterals_obligation_id_idx",
500
+ "merkle_paths_tree_root_idx": {
501
+ "name": "merkle_paths_tree_root_idx",
457
502
  "columns": [
458
503
  {
459
- "expression": "obligation_id",
504
+ "expression": "tree_root",
460
505
  "isExpression": false,
461
506
  "asc": true,
462
507
  "nulls": "last"
@@ -469,31 +514,36 @@
469
514
  }
470
515
  },
471
516
  "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"],
517
+ "merkle_paths_offer_hash_offers_hash_fk": {
518
+ "name": "merkle_paths_offer_hash_offers_hash_fk",
519
+ "tableFrom": "merkle_paths",
520
+ "tableTo": "offers",
521
+ "schemaTo": "router_v1.6",
522
+ "columnsFrom": ["offer_hash"],
523
+ "columnsTo": ["hash"],
524
+ "onDelete": "cascade",
525
+ "onUpdate": "no action"
526
+ },
527
+ "merkle_paths_tree_root_trees_root_fk": {
528
+ "name": "merkle_paths_tree_root_trees_root_fk",
529
+ "tableFrom": "merkle_paths",
530
+ "tableTo": "trees",
531
+ "schemaTo": "router_v1.6",
532
+ "columnsFrom": ["tree_root"],
533
+ "columnsTo": ["root"],
479
534
  "onDelete": "cascade",
480
535
  "onUpdate": "no action"
481
536
  }
482
537
  },
483
- "compositePrimaryKeys": {
484
- "obligation_collaterals_pk": {
485
- "name": "obligation_collaterals_pk",
486
- "columns": ["obligation_id", "asset"]
487
- }
488
- },
538
+ "compositePrimaryKeys": {},
489
539
  "uniqueConstraints": {},
490
540
  "policies": {},
491
541
  "checkConstraints": {},
492
542
  "isRLSEnabled": false
493
543
  },
494
- "router_v1.5.obligation_collaterals_v2": {
544
+ "router_v1.6.obligation_collaterals_v2": {
495
545
  "name": "obligation_collaterals_v2",
496
- "schema": "router_v1.5",
546
+ "schema": "router_v1.6",
497
547
  "columns": {
498
548
  "obligation_id": {
499
549
  "name": "obligation_id",
@@ -582,7 +632,7 @@
582
632
  "name": "obligation_collaterals_v2_obligation_id_obligations_obligation_id_fk",
583
633
  "tableFrom": "obligation_collaterals_v2",
584
634
  "tableTo": "obligations",
585
- "schemaTo": "router_v1.5",
635
+ "schemaTo": "router_v1.6",
586
636
  "columnsFrom": ["obligation_id"],
587
637
  "columnsTo": ["obligation_id"],
588
638
  "onDelete": "cascade",
@@ -592,7 +642,7 @@
592
642
  "name": "obligation_collaterals_v2_oracles_fk",
593
643
  "tableFrom": "obligation_collaterals_v2",
594
644
  "tableTo": "oracles",
595
- "schemaTo": "router_v1.5",
645
+ "schemaTo": "router_v1.6",
596
646
  "columnsFrom": ["oracle_chain_id", "oracle_address"],
597
647
  "columnsTo": ["chain_id", "address"],
598
648
  "onDelete": "no action",
@@ -610,9 +660,9 @@
610
660
  "checkConstraints": {},
611
661
  "isRLSEnabled": false
612
662
  },
613
- "router_v1.5.obligations": {
663
+ "router_v1.6.obligations": {
614
664
  "name": "obligations",
615
- "schema": "router_v1.5",
665
+ "schema": "router_v1.6",
616
666
  "columns": {
617
667
  "obligation_id": {
618
668
  "name": "obligation_id",
@@ -647,206 +697,73 @@
647
697
  "checkConstraints": {},
648
698
  "isRLSEnabled": false
649
699
  },
650
- "router_v1.5.offer_liquidity_pools": {
651
- "name": "offer_liquidity_pools",
652
- "schema": "router_v1.5",
700
+ "router_v1.6.offers": {
701
+ "name": "offers",
702
+ "schema": "router_v1.6",
653
703
  "columns": {
654
- "offer_hash": {
655
- "name": "offer_hash",
704
+ "hash": {
705
+ "name": "hash",
706
+ "type": "varchar(66)",
707
+ "primaryKey": true,
708
+ "notNull": true
709
+ },
710
+ "obligation_id": {
711
+ "name": "obligation_id",
656
712
  "type": "varchar(66)",
657
713
  "primaryKey": false,
658
714
  "notNull": true
659
715
  },
660
- "pool_id": {
661
- "name": "pool_id",
662
- "type": "varchar(255)",
716
+ "assets": {
717
+ "name": "assets",
718
+ "type": "numeric(78, 0)",
663
719
  "primaryKey": false,
664
720
  "notNull": true
665
721
  },
666
- "amount": {
667
- "name": "amount",
722
+ "rate": {
723
+ "name": "rate",
668
724
  "type": "numeric(78, 0)",
669
725
  "primaryKey": false,
670
726
  "notNull": true
671
727
  },
672
- "block_number": {
673
- "name": "block_number",
674
- "type": "bigint",
728
+ "maturity": {
729
+ "name": "maturity",
730
+ "type": "integer",
675
731
  "primaryKey": false,
676
732
  "notNull": true
677
733
  },
678
- "updated_at": {
679
- "name": "updated_at",
680
- "type": "timestamp",
734
+ "expiry": {
735
+ "name": "expiry",
736
+ "type": "integer",
681
737
  "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
738
  "notNull": true
745
739
  },
746
- "status_id": {
747
- "name": "status_id",
748
- "type": "serial",
740
+ "start": {
741
+ "name": "start",
742
+ "type": "integer",
749
743
  "primaryKey": false,
750
744
  "notNull": true
751
745
  },
752
- "block_number": {
753
- "name": "block_number",
746
+ "group_chain_id": {
747
+ "name": "group_chain_id",
754
748
  "type": "bigint",
755
749
  "primaryKey": false,
756
750
  "notNull": true
757
751
  },
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",
752
+ "group_maker": {
753
+ "name": "group_maker",
813
754
  "type": "varchar(42)",
814
755
  "primaryKey": false,
815
756
  "notNull": true
816
757
  },
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",
758
+ "group_group": {
759
+ "name": "group_group",
760
+ "type": "varchar(66)",
844
761
  "primaryKey": false,
845
762
  "notNull": true
846
763
  },
847
764
  "nonce": {
848
765
  "name": "nonce",
849
- "type": "bigint",
766
+ "type": "varchar(66)",
850
767
  "primaryKey": false,
851
768
  "notNull": true
852
769
  },
@@ -856,18 +773,6 @@
856
773
  "primaryKey": false,
857
774
  "notNull": true
858
775
  },
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
776
  "callback_address": {
872
777
  "name": "callback_address",
873
778
  "type": "varchar(42)",
@@ -880,68 +785,38 @@
880
785
  "primaryKey": false,
881
786
  "notNull": true
882
787
  },
883
- "callback_gas_limit": {
884
- "name": "callback_gas_limit",
788
+ "block_number": {
789
+ "name": "block_number",
885
790
  "type": "bigint",
886
791
  "primaryKey": false,
887
792
  "notNull": true
888
793
  },
889
- "signature": {
890
- "name": "signature",
891
- "type": "varchar(132)",
892
- "primaryKey": false,
893
- "notNull": false
894
- },
895
- "created_at": {
896
- "name": "created_at",
794
+ "updated_at": {
795
+ "name": "updated_at",
897
796
  "type": "timestamp",
898
797
  "primaryKey": false,
899
798
  "notNull": true,
900
799
  "default": "now()"
901
- },
902
- "block_number": {
903
- "name": "block_number",
904
- "type": "bigint",
905
- "primaryKey": false,
906
- "notNull": true
907
800
  }
908
801
  },
909
802
  "indexes": {
910
- "offers_obligation_id_idx": {
911
- "name": "offers_obligation_id_idx",
803
+ "offers_group_fk_idx": {
804
+ "name": "offers_group_fk_idx",
912
805
  "columns": [
913
806
  {
914
- "expression": "obligation_id",
807
+ "expression": "group_chain_id",
915
808
  "isExpression": false,
916
809
  "asc": true,
917
810
  "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": [
811
+ },
928
812
  {
929
- "expression": "offering",
813
+ "expression": "group_maker",
930
814
  "isExpression": false,
931
815
  "asc": true,
932
816
  "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": [
817
+ },
943
818
  {
944
- "expression": "buy",
819
+ "expression": "group_group",
945
820
  "isExpression": false,
946
821
  "asc": true,
947
822
  "nulls": "last"
@@ -952,56 +827,29 @@
952
827
  "method": "btree",
953
828
  "with": {}
954
829
  },
955
- "offers_chain_id_idx": {
956
- "name": "offers_chain_id_idx",
830
+ "offers_group_and_hash_idx": {
831
+ "name": "offers_group_and_hash_idx",
957
832
  "columns": [
958
833
  {
959
- "expression": "chain_id",
834
+ "expression": "group_chain_id",
960
835
  "isExpression": false,
961
836
  "asc": true,
962
837
  "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": [
838
+ },
973
839
  {
974
- "expression": "loan_token",
840
+ "expression": "group_maker",
975
841
  "isExpression": false,
976
842
  "asc": true,
977
843
  "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": [
844
+ },
988
845
  {
989
- "expression": "maturity",
846
+ "expression": "group_group",
990
847
  "isExpression": false,
991
848
  "asc": true,
992
849
  "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": [
850
+ },
1003
851
  {
1004
- "expression": "expiry",
852
+ "expression": "hash",
1005
853
  "isExpression": false,
1006
854
  "asc": true,
1007
855
  "nulls": "last"
@@ -1012,79 +860,49 @@
1012
860
  "method": "btree",
1013
861
  "with": {}
1014
862
  },
1015
- "offers_rate_idx": {
1016
- "name": "offers_rate_idx",
863
+ "offers_group_winner_sell_side_idx": {
864
+ "name": "offers_group_winner_sell_side_idx",
1017
865
  "columns": [
1018
866
  {
1019
- "expression": "rate",
867
+ "expression": "group_chain_id",
1020
868
  "isExpression": false,
1021
869
  "asc": true,
1022
870
  "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": [
871
+ },
1033
872
  {
1034
- "expression": "assets",
873
+ "expression": "group_maker",
1035
874
  "isExpression": false,
1036
875
  "asc": true,
1037
876
  "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": [
877
+ },
1048
878
  {
1049
- "expression": "created_at",
879
+ "expression": "group_group",
1050
880
  "isExpression": false,
1051
881
  "asc": true,
1052
882
  "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": [
883
+ },
1063
884
  {
1064
- "expression": "block_number",
1065
- "isExpression": false,
885
+ "expression": "\"rate\" desc",
1066
886
  "asc": true,
887
+ "isExpression": true,
1067
888
  "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": [
889
+ },
1078
890
  {
1079
- "expression": "rate",
1080
- "isExpression": false,
891
+ "expression": "\"block_number\" asc",
1081
892
  "asc": true,
893
+ "isExpression": true,
1082
894
  "nulls": "last"
1083
895
  },
1084
896
  {
1085
- "expression": "hash",
1086
- "isExpression": false,
897
+ "expression": "\"assets\" desc",
1087
898
  "asc": true,
899
+ "isExpression": true,
900
+ "nulls": "last"
901
+ },
902
+ {
903
+ "expression": "\"hash\" asc",
904
+ "asc": true,
905
+ "isExpression": true,
1088
906
  "nulls": "last"
1089
907
  }
1090
908
  ],
@@ -1093,61 +911,49 @@
1093
911
  "method": "btree",
1094
912
  "with": {}
1095
913
  },
1096
- "offers_maturity_hash_idx": {
1097
- "name": "offers_maturity_hash_idx",
914
+ "offers_group_winner_buy_side_idx": {
915
+ "name": "offers_group_winner_buy_side_idx",
1098
916
  "columns": [
1099
917
  {
1100
- "expression": "maturity",
918
+ "expression": "group_chain_id",
1101
919
  "isExpression": false,
1102
920
  "asc": true,
1103
921
  "nulls": "last"
1104
922
  },
1105
923
  {
1106
- "expression": "hash",
924
+ "expression": "group_maker",
1107
925
  "isExpression": false,
1108
926
  "asc": true,
1109
927
  "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": [
928
+ },
1120
929
  {
1121
- "expression": "expiry",
930
+ "expression": "group_group",
1122
931
  "isExpression": false,
1123
932
  "asc": true,
1124
933
  "nulls": "last"
1125
934
  },
1126
935
  {
1127
- "expression": "hash",
1128
- "isExpression": false,
936
+ "expression": "\"rate\" asc",
1129
937
  "asc": true,
938
+ "isExpression": true,
1130
939
  "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": [
940
+ },
1141
941
  {
1142
- "expression": "assets",
1143
- "isExpression": false,
942
+ "expression": "\"block_number\" asc",
1144
943
  "asc": true,
944
+ "isExpression": true,
1145
945
  "nulls": "last"
1146
946
  },
1147
947
  {
1148
- "expression": "hash",
1149
- "isExpression": false,
948
+ "expression": "\"assets\" desc",
1150
949
  "asc": true,
950
+ "isExpression": true,
951
+ "nulls": "last"
952
+ },
953
+ {
954
+ "expression": "\"hash\" asc",
955
+ "asc": true,
956
+ "isExpression": true,
1151
957
  "nulls": "last"
1152
958
  }
1153
959
  ],
@@ -1156,31 +962,19 @@
1156
962
  "method": "btree",
1157
963
  "with": {}
1158
964
  },
1159
- "offers_rate_created_at_assets_hash_idx": {
1160
- "name": "offers_rate_created_at_assets_hash_idx",
965
+ "offers_obligation_id_side_idx": {
966
+ "name": "offers_obligation_id_side_idx",
1161
967
  "columns": [
1162
968
  {
1163
- "expression": "rate",
969
+ "expression": "obligation_id",
1164
970
  "isExpression": false,
1165
971
  "asc": true,
1166
972
  "nulls": "last"
1167
973
  },
1168
974
  {
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",
975
+ "expression": "buy",
976
+ "isExpression": false,
1182
977
  "asc": true,
1183
- "isExpression": true,
1184
978
  "nulls": "last"
1185
979
  }
1186
980
  ],
@@ -1190,109 +984,356 @@
1190
984
  "with": {}
1191
985
  }
1192
986
  },
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"
987
+ "foreignKeys": {
988
+ "offers_obligation_id_obligations_obligation_id_fk": {
989
+ "name": "offers_obligation_id_obligations_obligation_id_fk",
990
+ "tableFrom": "offers",
991
+ "tableTo": "obligations",
992
+ "schemaTo": "router_v1.6",
993
+ "columnsFrom": ["obligation_id"],
994
+ "columnsTo": ["obligation_id"],
995
+ "onDelete": "cascade",
996
+ "onUpdate": "no action"
997
+ },
998
+ "offers_groups_fk": {
999
+ "name": "offers_groups_fk",
1000
+ "tableFrom": "offers",
1001
+ "tableTo": "groups",
1002
+ "schemaTo": "router_v1.6",
1003
+ "columnsFrom": ["group_chain_id", "group_maker", "group_group"],
1004
+ "columnsTo": ["chain_id", "maker", "group"],
1005
+ "onDelete": "cascade",
1006
+ "onUpdate": "no action"
1007
+ }
1008
+ },
1009
+ "compositePrimaryKeys": {},
1010
+ "uniqueConstraints": {},
1011
+ "policies": {},
1012
+ "checkConstraints": {},
1013
+ "isRLSEnabled": false
1014
+ },
1015
+ "router_v1.6.offers_callbacks": {
1016
+ "name": "offers_callbacks",
1017
+ "schema": "router_v1.6",
1018
+ "columns": {
1019
+ "offer_hash": {
1020
+ "name": "offer_hash",
1021
+ "type": "varchar(66)",
1022
+ "primaryKey": false,
1023
+ "notNull": true
1024
+ },
1025
+ "callback_id": {
1026
+ "name": "callback_id",
1027
+ "type": "varchar(66)",
1028
+ "primaryKey": false,
1029
+ "notNull": false
1030
+ }
1031
+ },
1032
+ "indexes": {},
1033
+ "foreignKeys": {
1034
+ "offers_callbacks_offer_hash_offers_hash_fk": {
1035
+ "name": "offers_callbacks_offer_hash_offers_hash_fk",
1036
+ "tableFrom": "offers_callbacks",
1037
+ "tableTo": "offers",
1038
+ "schemaTo": "router_v1.6",
1039
+ "columnsFrom": ["offer_hash"],
1040
+ "columnsTo": ["hash"],
1041
+ "onDelete": "cascade",
1042
+ "onUpdate": "no action"
1043
+ }
1044
+ },
1045
+ "compositePrimaryKeys": {
1046
+ "offers_callbacks_pk": {
1047
+ "name": "offers_callbacks_pk",
1048
+ "columns": ["offer_hash", "callback_id"]
1049
+ }
1050
+ },
1051
+ "uniqueConstraints": {},
1052
+ "policies": {},
1053
+ "checkConstraints": {},
1054
+ "isRLSEnabled": false
1055
+ },
1056
+ "router_v1.6.offsets": {
1057
+ "name": "offsets",
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
+ "user": {
1067
+ "name": "user",
1068
+ "type": "varchar(42)",
1069
+ "primaryKey": false,
1070
+ "notNull": true
1071
+ },
1072
+ "contract": {
1073
+ "name": "contract",
1074
+ "type": "varchar(42)",
1075
+ "primaryKey": false,
1076
+ "notNull": true
1077
+ },
1078
+ "group": {
1079
+ "name": "group",
1080
+ "type": "varchar(66)",
1081
+ "primaryKey": false,
1082
+ "notNull": true
1083
+ },
1084
+ "value": {
1085
+ "name": "value",
1086
+ "type": "numeric(78, 0)",
1087
+ "primaryKey": false,
1088
+ "notNull": true
1089
+ }
1090
+ },
1091
+ "indexes": {},
1092
+ "foreignKeys": {
1093
+ "offsets_positions_fk": {
1094
+ "name": "offsets_positions_fk",
1095
+ "tableFrom": "offsets",
1096
+ "tableTo": "positions",
1097
+ "schemaTo": "router_v1.6",
1098
+ "columnsFrom": ["chain_id", "contract", "user"],
1099
+ "columnsTo": ["chain_id", "contract", "user"],
1100
+ "onDelete": "cascade",
1101
+ "onUpdate": "no action"
1102
+ }
1103
+ },
1104
+ "compositePrimaryKeys": {
1105
+ "offsets_pk": {
1106
+ "name": "offsets_pk",
1107
+ "columns": ["chain_id", "user", "contract", "group"]
1108
+ }
1109
+ },
1110
+ "uniqueConstraints": {},
1111
+ "policies": {},
1112
+ "checkConstraints": {},
1113
+ "isRLSEnabled": false
1114
+ },
1115
+ "router_v1.6.oracles": {
1116
+ "name": "oracles",
1117
+ "schema": "router_v1.6",
1118
+ "columns": {
1119
+ "chain_id": {
1120
+ "name": "chain_id",
1121
+ "type": "bigint",
1122
+ "primaryKey": false,
1123
+ "notNull": true
1124
+ },
1125
+ "address": {
1126
+ "name": "address",
1127
+ "type": "varchar(42)",
1128
+ "primaryKey": false,
1129
+ "notNull": true
1130
+ },
1131
+ "price": {
1132
+ "name": "price",
1133
+ "type": "numeric(78, 0)",
1134
+ "primaryKey": false,
1135
+ "notNull": false
1136
+ },
1137
+ "block_number": {
1138
+ "name": "block_number",
1139
+ "type": "bigint",
1140
+ "primaryKey": false,
1141
+ "notNull": true
1142
+ },
1143
+ "updated_at": {
1144
+ "name": "updated_at",
1145
+ "type": "timestamp",
1146
+ "primaryKey": false,
1147
+ "notNull": true,
1148
+ "default": "now()"
1149
+ }
1150
+ },
1151
+ "indexes": {},
1152
+ "foreignKeys": {},
1153
+ "compositePrimaryKeys": {
1154
+ "oracles_pk": {
1155
+ "name": "oracles_pk",
1156
+ "columns": ["chain_id", "address"]
1203
1157
  }
1204
1158
  },
1205
- "compositePrimaryKeys": {},
1206
1159
  "uniqueConstraints": {},
1207
1160
  "policies": {},
1208
1161
  "checkConstraints": {},
1209
1162
  "isRLSEnabled": false
1210
1163
  },
1211
- "router_v1.5.offers_v2": {
1212
- "name": "offers_v2",
1213
- "schema": "router_v1.5",
1164
+ "router_v1.6.position_types": {
1165
+ "name": "position_types",
1166
+ "schema": "router_v1.6",
1214
1167
  "columns": {
1215
- "hash": {
1216
- "name": "hash",
1217
- "type": "varchar(66)",
1168
+ "id": {
1169
+ "name": "id",
1170
+ "type": "serial",
1218
1171
  "primaryKey": true,
1219
1172
  "notNull": true
1220
1173
  },
1221
- "obligation_id": {
1222
- "name": "obligation_id",
1223
- "type": "varchar(66)",
1174
+ "type": {
1175
+ "name": "type",
1176
+ "type": "position_type",
1177
+ "typeSchema": "router_v1.6",
1224
1178
  "primaryKey": false,
1225
1179
  "notNull": true
1226
- },
1227
- "assets": {
1228
- "name": "assets",
1229
- "type": "numeric(78, 0)",
1180
+ }
1181
+ },
1182
+ "indexes": {},
1183
+ "foreignKeys": {},
1184
+ "compositePrimaryKeys": {},
1185
+ "uniqueConstraints": {},
1186
+ "policies": {},
1187
+ "checkConstraints": {},
1188
+ "isRLSEnabled": false
1189
+ },
1190
+ "router_v1.6.positions": {
1191
+ "name": "positions",
1192
+ "schema": "router_v1.6",
1193
+ "columns": {
1194
+ "chain_id": {
1195
+ "name": "chain_id",
1196
+ "type": "bigint",
1230
1197
  "primaryKey": false,
1231
1198
  "notNull": true
1232
1199
  },
1233
- "rate": {
1234
- "name": "rate",
1235
- "type": "numeric(78, 0)",
1200
+ "contract": {
1201
+ "name": "contract",
1202
+ "type": "varchar(42)",
1236
1203
  "primaryKey": false,
1237
1204
  "notNull": true
1238
1205
  },
1239
- "maturity": {
1240
- "name": "maturity",
1241
- "type": "integer",
1206
+ "user": {
1207
+ "name": "user",
1208
+ "type": "varchar(42)",
1242
1209
  "primaryKey": false,
1243
1210
  "notNull": true
1244
1211
  },
1245
- "expiry": {
1246
- "name": "expiry",
1212
+ "position_type_id": {
1213
+ "name": "position_type_id",
1247
1214
  "type": "integer",
1248
1215
  "primaryKey": false,
1249
1216
  "notNull": true
1250
1217
  },
1251
- "start": {
1252
- "name": "start",
1253
- "type": "integer",
1218
+ "balance": {
1219
+ "name": "balance",
1220
+ "type": "numeric(78, 0)",
1254
1221
  "primaryKey": false,
1255
- "notNull": true
1222
+ "notNull": false
1256
1223
  },
1257
- "group_chain_id": {
1258
- "name": "group_chain_id",
1224
+ "asset": {
1225
+ "name": "asset",
1226
+ "type": "varchar(42)",
1227
+ "primaryKey": false,
1228
+ "notNull": false
1229
+ },
1230
+ "block_number": {
1231
+ "name": "block_number",
1259
1232
  "type": "bigint",
1260
1233
  "primaryKey": false,
1261
1234
  "notNull": true
1262
1235
  },
1263
- "group_maker": {
1264
- "name": "group_maker",
1265
- "type": "varchar(42)",
1236
+ "updated_at": {
1237
+ "name": "updated_at",
1238
+ "type": "timestamp",
1266
1239
  "primaryKey": false,
1240
+ "notNull": true,
1241
+ "default": "now()"
1242
+ }
1243
+ },
1244
+ "indexes": {},
1245
+ "foreignKeys": {
1246
+ "positions_position_type_id_position_types_id_fk": {
1247
+ "name": "positions_position_type_id_position_types_id_fk",
1248
+ "tableFrom": "positions",
1249
+ "tableTo": "position_types",
1250
+ "schemaTo": "router_v1.6",
1251
+ "columnsFrom": ["position_type_id"],
1252
+ "columnsTo": ["id"],
1253
+ "onDelete": "no action",
1254
+ "onUpdate": "no action"
1255
+ }
1256
+ },
1257
+ "compositePrimaryKeys": {
1258
+ "positions_pk": {
1259
+ "name": "positions_pk",
1260
+ "columns": ["chain_id", "contract", "user"]
1261
+ }
1262
+ },
1263
+ "uniqueConstraints": {},
1264
+ "policies": {},
1265
+ "checkConstraints": {},
1266
+ "isRLSEnabled": false
1267
+ },
1268
+ "router_v1.6.status": {
1269
+ "name": "status",
1270
+ "schema": "router_v1.6",
1271
+ "columns": {
1272
+ "id": {
1273
+ "name": "id",
1274
+ "type": "serial",
1275
+ "primaryKey": true,
1267
1276
  "notNull": true
1268
1277
  },
1269
- "group_group": {
1270
- "name": "group_group",
1271
- "type": "varchar(66)",
1278
+ "code": {
1279
+ "name": "code",
1280
+ "type": "status_code",
1281
+ "typeSchema": "router_v1.6",
1282
+ "primaryKey": false,
1283
+ "notNull": false
1284
+ }
1285
+ },
1286
+ "indexes": {},
1287
+ "foreignKeys": {},
1288
+ "compositePrimaryKeys": {},
1289
+ "uniqueConstraints": {
1290
+ "status_code_unique": {
1291
+ "name": "status_code_unique",
1292
+ "nullsNotDistinct": false,
1293
+ "columns": ["code"]
1294
+ }
1295
+ },
1296
+ "policies": {},
1297
+ "checkConstraints": {},
1298
+ "isRLSEnabled": false
1299
+ },
1300
+ "router_v1.6.transfers": {
1301
+ "name": "transfers",
1302
+ "schema": "router_v1.6",
1303
+ "columns": {
1304
+ "event_id": {
1305
+ "name": "event_id",
1306
+ "type": "varchar(128)",
1307
+ "primaryKey": true,
1308
+ "notNull": true
1309
+ },
1310
+ "chain_id": {
1311
+ "name": "chain_id",
1312
+ "type": "bigint",
1272
1313
  "primaryKey": false,
1273
1314
  "notNull": true
1274
1315
  },
1275
- "nonce": {
1276
- "name": "nonce",
1277
- "type": "varchar(66)",
1316
+ "contract": {
1317
+ "name": "contract",
1318
+ "type": "varchar(42)",
1278
1319
  "primaryKey": false,
1279
1320
  "notNull": true
1280
1321
  },
1281
- "buy": {
1282
- "name": "buy",
1283
- "type": "boolean",
1322
+ "from": {
1323
+ "name": "from",
1324
+ "type": "varchar(42)",
1284
1325
  "primaryKey": false,
1285
1326
  "notNull": true
1286
1327
  },
1287
- "callback_address": {
1288
- "name": "callback_address",
1328
+ "to": {
1329
+ "name": "to",
1289
1330
  "type": "varchar(42)",
1290
1331
  "primaryKey": false,
1291
1332
  "notNull": true
1292
1333
  },
1293
- "callback_data": {
1294
- "name": "callback_data",
1295
- "type": "text",
1334
+ "value": {
1335
+ "name": "value",
1336
+ "type": "numeric(78, 0)",
1296
1337
  "primaryKey": false,
1297
1338
  "notNull": true
1298
1339
  },
@@ -1302,8 +1343,8 @@
1302
1343
  "primaryKey": false,
1303
1344
  "notNull": true
1304
1345
  },
1305
- "updated_at": {
1306
- "name": "updated_at",
1346
+ "created_at": {
1347
+ "name": "created_at",
1307
1348
  "type": "timestamp",
1308
1349
  "primaryKey": false,
1309
1350
  "notNull": true,
@@ -1311,23 +1352,35 @@
1311
1352
  }
1312
1353
  },
1313
1354
  "indexes": {
1314
- "offers_v2_group_fk_idx": {
1315
- "name": "offers_v2_group_fk_idx",
1355
+ "transfers_chain_contract_user_idx": {
1356
+ "name": "transfers_chain_contract_user_idx",
1316
1357
  "columns": [
1317
1358
  {
1318
- "expression": "group_chain_id",
1359
+ "expression": "chain_id",
1319
1360
  "isExpression": false,
1320
1361
  "asc": true,
1321
1362
  "nulls": "last"
1322
1363
  },
1323
1364
  {
1324
- "expression": "group_maker",
1365
+ "expression": "contract",
1325
1366
  "isExpression": false,
1326
1367
  "asc": true,
1327
1368
  "nulls": "last"
1328
1369
  },
1329
1370
  {
1330
- "expression": "group_group",
1371
+ "expression": "from",
1372
+ "isExpression": false,
1373
+ "asc": true,
1374
+ "nulls": "last"
1375
+ },
1376
+ {
1377
+ "expression": "to",
1378
+ "isExpression": false,
1379
+ "asc": true,
1380
+ "nulls": "last"
1381
+ },
1382
+ {
1383
+ "expression": "block_number",
1331
1384
  "isExpression": false,
1332
1385
  "asc": true,
1333
1386
  "nulls": "last"
@@ -1340,23 +1393,23 @@
1340
1393
  }
1341
1394
  },
1342
1395
  "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"],
1396
+ "transfers_positions_from_fk": {
1397
+ "name": "transfers_positions_from_fk",
1398
+ "tableFrom": "transfers",
1399
+ "tableTo": "positions",
1400
+ "schemaTo": "router_v1.6",
1401
+ "columnsFrom": ["chain_id", "contract", "from"],
1402
+ "columnsTo": ["chain_id", "contract", "user"],
1350
1403
  "onDelete": "cascade",
1351
1404
  "onUpdate": "no action"
1352
1405
  },
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"],
1406
+ "transfers_positions_to_fk": {
1407
+ "name": "transfers_positions_to_fk",
1408
+ "tableFrom": "transfers",
1409
+ "tableTo": "positions",
1410
+ "schemaTo": "router_v1.6",
1411
+ "columnsFrom": ["chain_id", "contract", "to"],
1412
+ "columnsTo": ["chain_id", "contract", "user"],
1360
1413
  "onDelete": "cascade",
1361
1414
  "onUpdate": "no action"
1362
1415
  }
@@ -1367,30 +1420,24 @@
1367
1420
  "checkConstraints": {},
1368
1421
  "isRLSEnabled": false
1369
1422
  },
1370
- "router_v1.5.oracles": {
1371
- "name": "oracles",
1372
- "schema": "router_v1.5",
1423
+ "router_v1.6.trees": {
1424
+ "name": "trees",
1425
+ "schema": "router_v1.6",
1373
1426
  "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,
1427
+ "root": {
1428
+ "name": "root",
1429
+ "type": "varchar(66)",
1430
+ "primaryKey": true,
1384
1431
  "notNull": true
1385
1432
  },
1386
- "block_number": {
1387
- "name": "block_number",
1388
- "type": "bigint",
1433
+ "root_signature": {
1434
+ "name": "root_signature",
1435
+ "type": "varchar(132)",
1389
1436
  "primaryKey": false,
1390
1437
  "notNull": true
1391
1438
  },
1392
- "updated_at": {
1393
- "name": "updated_at",
1439
+ "created_at": {
1440
+ "name": "created_at",
1394
1441
  "type": "timestamp",
1395
1442
  "primaryKey": false,
1396
1443
  "notNull": true,
@@ -1399,55 +1446,76 @@
1399
1446
  },
1400
1447
  "indexes": {},
1401
1448
  "foreignKeys": {},
1402
- "compositePrimaryKeys": {
1403
- "oracles_pk": {
1404
- "name": "oracles_pk",
1405
- "columns": ["chain_id", "address"]
1406
- }
1407
- },
1449
+ "compositePrimaryKeys": {},
1408
1450
  "uniqueConstraints": {},
1409
1451
  "policies": {},
1410
1452
  "checkConstraints": {},
1411
1453
  "isRLSEnabled": false
1412
1454
  },
1413
- "router_v1.5.status": {
1414
- "name": "status",
1415
- "schema": "router_v1.5",
1455
+ "router_v1.6.validations": {
1456
+ "name": "validations",
1457
+ "schema": "router_v1.6",
1416
1458
  "columns": {
1417
- "id": {
1418
- "name": "id",
1419
- "type": "serial",
1459
+ "offer_hash": {
1460
+ "name": "offer_hash",
1461
+ "type": "varchar(66)",
1420
1462
  "primaryKey": true,
1421
1463
  "notNull": true
1422
1464
  },
1423
- "code": {
1424
- "name": "code",
1425
- "type": "status_code",
1426
- "typeSchema": "router_v1.5",
1465
+ "status_id": {
1466
+ "name": "status_id",
1467
+ "type": "integer",
1427
1468
  "primaryKey": false,
1428
- "notNull": false
1469
+ "notNull": true
1470
+ },
1471
+ "updated_at": {
1472
+ "name": "updated_at",
1473
+ "type": "timestamp",
1474
+ "primaryKey": false,
1475
+ "notNull": true,
1476
+ "default": "now()"
1429
1477
  }
1430
1478
  },
1431
1479
  "indexes": {},
1432
- "foreignKeys": {},
1433
- "compositePrimaryKeys": {},
1434
- "uniqueConstraints": {
1435
- "status_code_unique": {
1436
- "name": "status_code_unique",
1437
- "nullsNotDistinct": false,
1438
- "columns": ["code"]
1480
+ "foreignKeys": {
1481
+ "validations_offer_hash_offers_hash_fk": {
1482
+ "name": "validations_offer_hash_offers_hash_fk",
1483
+ "tableFrom": "validations",
1484
+ "tableTo": "offers",
1485
+ "schemaTo": "router_v1.6",
1486
+ "columnsFrom": ["offer_hash"],
1487
+ "columnsTo": ["hash"],
1488
+ "onDelete": "cascade",
1489
+ "onUpdate": "no action"
1490
+ },
1491
+ "validations_status_id_status_id_fk": {
1492
+ "name": "validations_status_id_status_id_fk",
1493
+ "tableFrom": "validations",
1494
+ "tableTo": "status",
1495
+ "schemaTo": "router_v1.6",
1496
+ "columnsFrom": ["status_id"],
1497
+ "columnsTo": ["id"],
1498
+ "onDelete": "no action",
1499
+ "onUpdate": "no action"
1439
1500
  }
1440
1501
  },
1502
+ "compositePrimaryKeys": {},
1503
+ "uniqueConstraints": {},
1441
1504
  "policies": {},
1442
1505
  "checkConstraints": {},
1443
1506
  "isRLSEnabled": false
1444
1507
  }
1445
1508
  },
1446
1509
  "enums": {
1447
- "router_v1.5.status_code": {
1510
+ "router_v1.6.position_type": {
1511
+ "name": "position_type",
1512
+ "schema": "router_v1.6",
1513
+ "values": ["erc20", "vault_v1"]
1514
+ },
1515
+ "router_v1.6.status_code": {
1448
1516
  "name": "status_code",
1449
- "schema": "router_v1.5",
1450
- "values": ["VALID", "NOT_ENOUGH_LIQUIDITY"]
1517
+ "schema": "router_v1.6",
1518
+ "values": ["VALID", "SIMULATION_ERROR"]
1451
1519
  }
1452
1520
  },
1453
1521
  "schemas": {},