@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": "b1fce416-5707-4ab1-8125-c465e47cd17b",
3
- "prevId": "ebc5db1e-f7e2-4441-b9c0-4789d0715e09",
2
+ "id": "3157ba1a-2669-43a5-b783-ee4508042d9f",
3
+ "prevId": "4808e28b-98ab-4a0b-a0cb-0cb669f14291",
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,76 +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
+ },
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
+ },
341
369
  {
342
- "expression": "child_pool_id",
370
+ "expression": "consumed",
343
371
  "isExpression": false,
344
372
  "asc": true,
345
373
  "nulls": "last"
@@ -351,32 +379,11 @@
351
379
  "with": {}
352
380
  }
353
381
  },
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
- },
382
+ "foreignKeys": {},
376
383
  "compositePrimaryKeys": {
377
- "liquidity_links_pk": {
378
- "name": "liquidity_links_pk",
379
- "columns": ["parent_pool_id", "priority"]
384
+ "groups_pk": {
385
+ "name": "groups_pk",
386
+ "columns": ["chain_id", "maker", "group"]
380
387
  }
381
388
  },
382
389
  "uniqueConstraints": {},
@@ -384,106 +391,74 @@
384
391
  "checkConstraints": {},
385
392
  "isRLSEnabled": false
386
393
  },
387
- "router_v1.5.liquidity_pools": {
388
- "name": "liquidity_pools",
389
- "schema": "router_v1.5",
394
+ "router_v1.6.lots": {
395
+ "name": "lots",
396
+ "schema": "router_v1.6",
390
397
  "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)",
398
+ "chain_id": {
399
+ "name": "chain_id",
400
+ "type": "bigint",
400
401
  "primaryKey": false,
401
402
  "notNull": true
402
403
  },
403
- "block_number": {
404
- "name": "block_number",
405
- "type": "bigint",
404
+ "user": {
405
+ "name": "user",
406
+ "type": "varchar(42)",
406
407
  "primaryKey": false,
407
408
  "notNull": true
408
409
  },
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)",
410
+ "contract": {
411
+ "name": "contract",
412
+ "type": "varchar(42)",
432
413
  "primaryKey": false,
433
414
  "notNull": true
434
415
  },
435
- "asset": {
436
- "name": "asset",
437
- "type": "varchar(42)",
416
+ "group": {
417
+ "name": "group",
418
+ "type": "varchar(66)",
438
419
  "primaryKey": false,
439
420
  "notNull": true
440
421
  },
441
- "oracle": {
442
- "name": "oracle",
443
- "type": "varchar(42)",
422
+ "lower": {
423
+ "name": "lower",
424
+ "type": "numeric(78, 0)",
444
425
  "primaryKey": false,
445
426
  "notNull": true
446
427
  },
447
- "lltv": {
448
- "name": "lltv",
449
- "type": "bigint",
428
+ "upper": {
429
+ "name": "upper",
430
+ "type": "numeric(78, 0)",
450
431
  "primaryKey": false,
451
432
  "notNull": true
452
433
  }
453
434
  },
454
- "indexes": {
455
- "obligation_collaterals_obligation_id_idx": {
456
- "name": "obligation_collaterals_obligation_id_idx",
457
- "columns": [
458
- {
459
- "expression": "obligation_id",
460
- "isExpression": false,
461
- "asc": true,
462
- "nulls": "last"
463
- }
464
- ],
465
- "isUnique": false,
466
- "concurrently": false,
467
- "method": "btree",
468
- "with": {}
469
- }
470
- },
435
+ "indexes": {},
471
436
  "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"],
437
+ "lots_positions_fk": {
438
+ "name": "lots_positions_fk",
439
+ "tableFrom": "lots",
440
+ "tableTo": "positions",
441
+ "schemaTo": "router_v1.6",
442
+ "columnsFrom": ["chain_id", "contract", "user"],
443
+ "columnsTo": ["chain_id", "contract", "user"],
444
+ "onDelete": "cascade",
445
+ "onUpdate": "no action"
446
+ },
447
+ "lots_groups_fk": {
448
+ "name": "lots_groups_fk",
449
+ "tableFrom": "lots",
450
+ "tableTo": "groups",
451
+ "schemaTo": "router_v1.6",
452
+ "columnsFrom": ["chain_id", "user", "group"],
453
+ "columnsTo": ["chain_id", "maker", "group"],
479
454
  "onDelete": "cascade",
480
455
  "onUpdate": "no action"
481
456
  }
482
457
  },
483
458
  "compositePrimaryKeys": {
484
- "obligation_collaterals_pk": {
485
- "name": "obligation_collaterals_pk",
486
- "columns": ["obligation_id", "asset"]
459
+ "lots_pk": {
460
+ "name": "lots_pk",
461
+ "columns": ["chain_id", "user", "contract", "group"]
487
462
  }
488
463
  },
489
464
  "uniqueConstraints": {},
@@ -491,9 +466,9 @@
491
466
  "checkConstraints": {},
492
467
  "isRLSEnabled": false
493
468
  },
494
- "router_v1.5.obligation_collaterals_v2": {
469
+ "router_v1.6.obligation_collaterals_v2": {
495
470
  "name": "obligation_collaterals_v2",
496
- "schema": "router_v1.5",
471
+ "schema": "router_v1.6",
497
472
  "columns": {
498
473
  "obligation_id": {
499
474
  "name": "obligation_id",
@@ -582,7 +557,7 @@
582
557
  "name": "obligation_collaterals_v2_obligation_id_obligations_obligation_id_fk",
583
558
  "tableFrom": "obligation_collaterals_v2",
584
559
  "tableTo": "obligations",
585
- "schemaTo": "router_v1.5",
560
+ "schemaTo": "router_v1.6",
586
561
  "columnsFrom": ["obligation_id"],
587
562
  "columnsTo": ["obligation_id"],
588
563
  "onDelete": "cascade",
@@ -592,7 +567,7 @@
592
567
  "name": "obligation_collaterals_v2_oracles_fk",
593
568
  "tableFrom": "obligation_collaterals_v2",
594
569
  "tableTo": "oracles",
595
- "schemaTo": "router_v1.5",
570
+ "schemaTo": "router_v1.6",
596
571
  "columnsFrom": ["oracle_chain_id", "oracle_address"],
597
572
  "columnsTo": ["chain_id", "address"],
598
573
  "onDelete": "no action",
@@ -610,9 +585,9 @@
610
585
  "checkConstraints": {},
611
586
  "isRLSEnabled": false
612
587
  },
613
- "router_v1.5.obligations": {
588
+ "router_v1.6.obligations": {
614
589
  "name": "obligations",
615
- "schema": "router_v1.5",
590
+ "schema": "router_v1.6",
616
591
  "columns": {
617
592
  "obligation_id": {
618
593
  "name": "obligation_id",
@@ -647,147 +622,73 @@
647
622
  "checkConstraints": {},
648
623
  "isRLSEnabled": false
649
624
  },
650
- "router_v1.5.offer_liquidity_pools": {
651
- "name": "offer_liquidity_pools",
652
- "schema": "router_v1.5",
625
+ "router_v1.6.offers": {
626
+ "name": "offers",
627
+ "schema": "router_v1.6",
653
628
  "columns": {
654
- "offer_hash": {
655
- "name": "offer_hash",
629
+ "hash": {
630
+ "name": "hash",
631
+ "type": "varchar(66)",
632
+ "primaryKey": true,
633
+ "notNull": true
634
+ },
635
+ "obligation_id": {
636
+ "name": "obligation_id",
656
637
  "type": "varchar(66)",
657
638
  "primaryKey": false,
658
639
  "notNull": true
659
640
  },
660
- "pool_id": {
661
- "name": "pool_id",
662
- "type": "varchar(255)",
641
+ "assets": {
642
+ "name": "assets",
643
+ "type": "numeric(78, 0)",
663
644
  "primaryKey": false,
664
645
  "notNull": true
665
646
  },
666
- "amount": {
667
- "name": "amount",
647
+ "rate": {
648
+ "name": "rate",
668
649
  "type": "numeric(78, 0)",
669
650
  "primaryKey": false,
670
651
  "notNull": true
671
652
  },
672
- "block_number": {
673
- "name": "block_number",
674
- "type": "bigint",
653
+ "maturity": {
654
+ "name": "maturity",
655
+ "type": "integer",
675
656
  "primaryKey": false,
676
657
  "notNull": true
677
658
  },
678
- "updated_at": {
679
- "name": "updated_at",
680
- "type": "timestamp",
681
- "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.offers": {
737
- "name": "offers",
738
- "schema": "router_v1.5",
739
- "columns": {
740
- "hash": {
741
- "name": "hash",
742
- "type": "varchar(66)",
743
- "primaryKey": true,
744
- "notNull": true
745
- },
746
- "obligation_id": {
747
- "name": "obligation_id",
748
- "type": "varchar(66)",
749
- "primaryKey": false,
750
- "notNull": true
751
- },
752
- "offering": {
753
- "name": "offering",
754
- "type": "varchar(42)",
659
+ "expiry": {
660
+ "name": "expiry",
661
+ "type": "integer",
755
662
  "primaryKey": false,
756
663
  "notNull": true
757
664
  },
758
- "assets": {
759
- "name": "assets",
760
- "type": "numeric(78, 0)",
665
+ "start": {
666
+ "name": "start",
667
+ "type": "integer",
761
668
  "primaryKey": false,
762
669
  "notNull": true
763
670
  },
764
- "rate": {
765
- "name": "rate",
671
+ "group_chain_id": {
672
+ "name": "group_chain_id",
766
673
  "type": "bigint",
767
674
  "primaryKey": false,
768
675
  "notNull": true
769
676
  },
770
- "maturity": {
771
- "name": "maturity",
772
- "type": "integer",
773
- "primaryKey": false,
774
- "notNull": true
775
- },
776
- "expiry": {
777
- "name": "expiry",
778
- "type": "integer",
677
+ "group_maker": {
678
+ "name": "group_maker",
679
+ "type": "varchar(42)",
779
680
  "primaryKey": false,
780
681
  "notNull": true
781
682
  },
782
- "start": {
783
- "name": "start",
784
- "type": "integer",
683
+ "group_group": {
684
+ "name": "group_group",
685
+ "type": "varchar(66)",
785
686
  "primaryKey": false,
786
687
  "notNull": true
787
688
  },
788
689
  "nonce": {
789
690
  "name": "nonce",
790
- "type": "bigint",
691
+ "type": "varchar(66)",
791
692
  "primaryKey": false,
792
693
  "notNull": true
793
694
  },
@@ -797,18 +698,6 @@
797
698
  "primaryKey": false,
798
699
  "notNull": true
799
700
  },
800
- "chain_id": {
801
- "name": "chain_id",
802
- "type": "bigint",
803
- "primaryKey": false,
804
- "notNull": true
805
- },
806
- "loan_token": {
807
- "name": "loan_token",
808
- "type": "varchar(42)",
809
- "primaryKey": false,
810
- "notNull": true
811
- },
812
701
  "callback_address": {
813
702
  "name": "callback_address",
814
703
  "type": "varchar(42)",
@@ -821,83 +710,38 @@
821
710
  "primaryKey": false,
822
711
  "notNull": true
823
712
  },
824
- "callback_gas_limit": {
825
- "name": "callback_gas_limit",
713
+ "block_number": {
714
+ "name": "block_number",
826
715
  "type": "bigint",
827
716
  "primaryKey": false,
828
717
  "notNull": true
829
718
  },
830
- "signature": {
831
- "name": "signature",
832
- "type": "varchar(132)",
833
- "primaryKey": false,
834
- "notNull": false
835
- },
836
- "created_at": {
837
- "name": "created_at",
719
+ "updated_at": {
720
+ "name": "updated_at",
838
721
  "type": "timestamp",
839
722
  "primaryKey": false,
840
723
  "notNull": true,
841
724
  "default": "now()"
842
- },
843
- "block_number": {
844
- "name": "block_number",
845
- "type": "bigint",
846
- "primaryKey": false,
847
- "notNull": true
848
725
  }
849
726
  },
850
727
  "indexes": {
851
- "offers_obligation_id_idx": {
852
- "name": "offers_obligation_id_idx",
853
- "columns": [
854
- {
855
- "expression": "obligation_id",
856
- "isExpression": false,
857
- "asc": true,
858
- "nulls": "last"
859
- }
860
- ],
861
- "isUnique": false,
862
- "concurrently": false,
863
- "method": "btree",
864
- "with": {}
865
- },
866
- "offers_offering_idx": {
867
- "name": "offers_offering_idx",
728
+ "offers_group_fk_idx": {
729
+ "name": "offers_group_fk_idx",
868
730
  "columns": [
869
731
  {
870
- "expression": "offering",
732
+ "expression": "group_chain_id",
871
733
  "isExpression": false,
872
734
  "asc": true,
873
735
  "nulls": "last"
874
- }
875
- ],
876
- "isUnique": false,
877
- "concurrently": false,
878
- "method": "btree",
879
- "with": {}
880
- },
881
- "offers_buy_idx": {
882
- "name": "offers_buy_idx",
883
- "columns": [
736
+ },
884
737
  {
885
- "expression": "buy",
738
+ "expression": "group_maker",
886
739
  "isExpression": false,
887
740
  "asc": true,
888
741
  "nulls": "last"
889
- }
890
- ],
891
- "isUnique": false,
892
- "concurrently": false,
893
- "method": "btree",
894
- "with": {}
895
- },
896
- "offers_chain_id_idx": {
897
- "name": "offers_chain_id_idx",
898
- "columns": [
742
+ },
899
743
  {
900
- "expression": "chain_id",
744
+ "expression": "group_group",
901
745
  "isExpression": false,
902
746
  "asc": true,
903
747
  "nulls": "last"
@@ -908,56 +752,29 @@
908
752
  "method": "btree",
909
753
  "with": {}
910
754
  },
911
- "offers_loan_token_idx": {
912
- "name": "offers_loan_token_idx",
755
+ "offers_group_and_hash_idx": {
756
+ "name": "offers_group_and_hash_idx",
913
757
  "columns": [
914
758
  {
915
- "expression": "loan_token",
759
+ "expression": "group_chain_id",
916
760
  "isExpression": false,
917
761
  "asc": true,
918
762
  "nulls": "last"
919
- }
920
- ],
921
- "isUnique": false,
922
- "concurrently": false,
923
- "method": "btree",
924
- "with": {}
925
- },
926
- "offers_maturity_idx": {
927
- "name": "offers_maturity_idx",
928
- "columns": [
763
+ },
929
764
  {
930
- "expression": "maturity",
765
+ "expression": "group_maker",
931
766
  "isExpression": false,
932
767
  "asc": true,
933
768
  "nulls": "last"
934
- }
935
- ],
936
- "isUnique": false,
937
- "concurrently": false,
938
- "method": "btree",
939
- "with": {}
940
- },
941
- "offers_expiry_idx": {
942
- "name": "offers_expiry_idx",
943
- "columns": [
769
+ },
944
770
  {
945
- "expression": "expiry",
771
+ "expression": "group_group",
946
772
  "isExpression": false,
947
773
  "asc": true,
948
774
  "nulls": "last"
949
- }
950
- ],
951
- "isUnique": false,
952
- "concurrently": false,
953
- "method": "btree",
954
- "with": {}
955
- },
956
- "offers_rate_idx": {
957
- "name": "offers_rate_idx",
958
- "columns": [
775
+ },
959
776
  {
960
- "expression": "rate",
777
+ "expression": "hash",
961
778
  "isExpression": false,
962
779
  "asc": true,
963
780
  "nulls": "last"
@@ -968,85 +785,49 @@
968
785
  "method": "btree",
969
786
  "with": {}
970
787
  },
971
- "offers_assets_idx": {
972
- "name": "offers_assets_idx",
788
+ "offers_group_winner_sell_side_idx": {
789
+ "name": "offers_group_winner_sell_side_idx",
973
790
  "columns": [
974
791
  {
975
- "expression": "assets",
792
+ "expression": "group_chain_id",
976
793
  "isExpression": false,
977
794
  "asc": true,
978
795
  "nulls": "last"
979
- }
980
- ],
981
- "isUnique": false,
982
- "concurrently": false,
983
- "method": "btree",
984
- "with": {}
985
- },
986
- "offers_created_at_idx": {
987
- "name": "offers_created_at_idx",
988
- "columns": [
796
+ },
989
797
  {
990
- "expression": "created_at",
798
+ "expression": "group_maker",
991
799
  "isExpression": false,
992
800
  "asc": true,
993
801
  "nulls": "last"
994
- }
995
- ],
996
- "isUnique": false,
997
- "concurrently": false,
998
- "method": "btree",
999
- "with": {}
1000
- },
1001
- "offers_block_number_idx": {
1002
- "name": "offers_block_number_idx",
1003
- "columns": [
802
+ },
1004
803
  {
1005
- "expression": "block_number",
804
+ "expression": "group_group",
1006
805
  "isExpression": false,
1007
806
  "asc": true,
1008
807
  "nulls": "last"
1009
- }
1010
- ],
1011
- "isUnique": false,
1012
- "concurrently": false,
1013
- "method": "btree",
1014
- "with": {}
1015
- },
1016
- "offers_rate_hash_idx": {
1017
- "name": "offers_rate_hash_idx",
1018
- "columns": [
808
+ },
1019
809
  {
1020
- "expression": "rate",
1021
- "isExpression": false,
810
+ "expression": "\"rate\" desc",
1022
811
  "asc": true,
812
+ "isExpression": true,
1023
813
  "nulls": "last"
1024
814
  },
1025
815
  {
1026
- "expression": "hash",
1027
- "isExpression": false,
816
+ "expression": "\"block_number\" asc",
1028
817
  "asc": true,
818
+ "isExpression": true,
1029
819
  "nulls": "last"
1030
- }
1031
- ],
1032
- "isUnique": false,
1033
- "concurrently": false,
1034
- "method": "btree",
1035
- "with": {}
1036
- },
1037
- "offers_maturity_hash_idx": {
1038
- "name": "offers_maturity_hash_idx",
1039
- "columns": [
820
+ },
1040
821
  {
1041
- "expression": "maturity",
1042
- "isExpression": false,
822
+ "expression": "\"assets\" desc",
1043
823
  "asc": true,
824
+ "isExpression": true,
1044
825
  "nulls": "last"
1045
826
  },
1046
827
  {
1047
- "expression": "hash",
1048
- "isExpression": false,
828
+ "expression": "\"hash\" asc",
1049
829
  "asc": true,
830
+ "isExpression": true,
1050
831
  "nulls": "last"
1051
832
  }
1052
833
  ],
@@ -1055,59 +836,35 @@
1055
836
  "method": "btree",
1056
837
  "with": {}
1057
838
  },
1058
- "offers_expiry_hash_idx": {
1059
- "name": "offers_expiry_hash_idx",
839
+ "offers_group_winner_buy_side_idx": {
840
+ "name": "offers_group_winner_buy_side_idx",
1060
841
  "columns": [
1061
842
  {
1062
- "expression": "expiry",
843
+ "expression": "group_chain_id",
1063
844
  "isExpression": false,
1064
845
  "asc": true,
1065
846
  "nulls": "last"
1066
847
  },
1067
848
  {
1068
- "expression": "hash",
1069
- "isExpression": false,
1070
- "asc": true,
1071
- "nulls": "last"
1072
- }
1073
- ],
1074
- "isUnique": false,
1075
- "concurrently": false,
1076
- "method": "btree",
1077
- "with": {}
1078
- },
1079
- "offers_assets_hash_idx": {
1080
- "name": "offers_assets_hash_idx",
1081
- "columns": [
1082
- {
1083
- "expression": "assets",
849
+ "expression": "group_maker",
1084
850
  "isExpression": false,
1085
851
  "asc": true,
1086
852
  "nulls": "last"
1087
853
  },
1088
854
  {
1089
- "expression": "hash",
855
+ "expression": "group_group",
1090
856
  "isExpression": false,
1091
857
  "asc": true,
1092
858
  "nulls": "last"
1093
- }
1094
- ],
1095
- "isUnique": false,
1096
- "concurrently": false,
1097
- "method": "btree",
1098
- "with": {}
1099
- },
1100
- "offers_rate_created_at_assets_hash_idx": {
1101
- "name": "offers_rate_created_at_assets_hash_idx",
1102
- "columns": [
859
+ },
1103
860
  {
1104
- "expression": "rate",
1105
- "isExpression": false,
861
+ "expression": "\"rate\" asc",
1106
862
  "asc": true,
863
+ "isExpression": true,
1107
864
  "nulls": "last"
1108
865
  },
1109
866
  {
1110
- "expression": "\"created_at\" asc",
867
+ "expression": "\"block_number\" asc",
1111
868
  "asc": true,
1112
869
  "isExpression": true,
1113
870
  "nulls": "last"
@@ -1129,18 +886,49 @@
1129
886
  "concurrently": false,
1130
887
  "method": "btree",
1131
888
  "with": {}
1132
- }
1133
- },
1134
- "foreignKeys": {
1135
- "offers_obligation_id_obligations_obligation_id_fk": {
1136
- "name": "offers_obligation_id_obligations_obligation_id_fk",
1137
- "tableFrom": "offers",
1138
- "tableTo": "obligations",
1139
- "schemaTo": "router_v1.5",
889
+ },
890
+ "offers_obligation_id_side_idx": {
891
+ "name": "offers_obligation_id_side_idx",
892
+ "columns": [
893
+ {
894
+ "expression": "obligation_id",
895
+ "isExpression": false,
896
+ "asc": true,
897
+ "nulls": "last"
898
+ },
899
+ {
900
+ "expression": "buy",
901
+ "isExpression": false,
902
+ "asc": true,
903
+ "nulls": "last"
904
+ }
905
+ ],
906
+ "isUnique": false,
907
+ "concurrently": false,
908
+ "method": "btree",
909
+ "with": {}
910
+ }
911
+ },
912
+ "foreignKeys": {
913
+ "offers_obligation_id_obligations_obligation_id_fk": {
914
+ "name": "offers_obligation_id_obligations_obligation_id_fk",
915
+ "tableFrom": "offers",
916
+ "tableTo": "obligations",
917
+ "schemaTo": "router_v1.6",
1140
918
  "columnsFrom": ["obligation_id"],
1141
919
  "columnsTo": ["obligation_id"],
1142
920
  "onDelete": "cascade",
1143
921
  "onUpdate": "no action"
922
+ },
923
+ "offers_groups_fk": {
924
+ "name": "offers_groups_fk",
925
+ "tableFrom": "offers",
926
+ "tableTo": "groups",
927
+ "schemaTo": "router_v1.6",
928
+ "columnsFrom": ["group_chain_id", "group_maker", "group_group"],
929
+ "columnsTo": ["chain_id", "maker", "group"],
930
+ "onDelete": "cascade",
931
+ "onUpdate": "no action"
1144
932
  }
1145
933
  },
1146
934
  "compositePrimaryKeys": {},
@@ -1149,91 +937,269 @@
1149
937
  "checkConstraints": {},
1150
938
  "isRLSEnabled": false
1151
939
  },
1152
- "router_v1.5.offers_v2": {
1153
- "name": "offers_v2",
1154
- "schema": "router_v1.5",
940
+ "router_v1.6.offers_callbacks": {
941
+ "name": "offers_callbacks",
942
+ "schema": "router_v1.6",
1155
943
  "columns": {
1156
- "hash": {
1157
- "name": "hash",
944
+ "offer_hash": {
945
+ "name": "offer_hash",
1158
946
  "type": "varchar(66)",
1159
- "primaryKey": true,
947
+ "primaryKey": false,
1160
948
  "notNull": true
1161
949
  },
1162
- "obligation_id": {
1163
- "name": "obligation_id",
950
+ "callback_id": {
951
+ "name": "callback_id",
1164
952
  "type": "varchar(66)",
1165
953
  "primaryKey": false,
954
+ "notNull": false
955
+ }
956
+ },
957
+ "indexes": {},
958
+ "foreignKeys": {
959
+ "offers_callbacks_offer_hash_offers_hash_fk": {
960
+ "name": "offers_callbacks_offer_hash_offers_hash_fk",
961
+ "tableFrom": "offers_callbacks",
962
+ "tableTo": "offers",
963
+ "schemaTo": "router_v1.6",
964
+ "columnsFrom": ["offer_hash"],
965
+ "columnsTo": ["hash"],
966
+ "onDelete": "cascade",
967
+ "onUpdate": "no action"
968
+ }
969
+ },
970
+ "compositePrimaryKeys": {
971
+ "offers_callbacks_pk": {
972
+ "name": "offers_callbacks_pk",
973
+ "columns": ["offer_hash", "callback_id"]
974
+ }
975
+ },
976
+ "uniqueConstraints": {},
977
+ "policies": {},
978
+ "checkConstraints": {},
979
+ "isRLSEnabled": false
980
+ },
981
+ "router_v1.6.oracles": {
982
+ "name": "oracles",
983
+ "schema": "router_v1.6",
984
+ "columns": {
985
+ "chain_id": {
986
+ "name": "chain_id",
987
+ "type": "bigint",
988
+ "primaryKey": false,
1166
989
  "notNull": true
1167
990
  },
1168
- "assets": {
1169
- "name": "assets",
1170
- "type": "numeric(78, 0)",
991
+ "address": {
992
+ "name": "address",
993
+ "type": "varchar(42)",
1171
994
  "primaryKey": false,
1172
995
  "notNull": true
1173
996
  },
1174
- "rate": {
1175
- "name": "rate",
997
+ "price": {
998
+ "name": "price",
1176
999
  "type": "numeric(78, 0)",
1177
1000
  "primaryKey": false,
1001
+ "notNull": false
1002
+ },
1003
+ "block_number": {
1004
+ "name": "block_number",
1005
+ "type": "bigint",
1006
+ "primaryKey": false,
1178
1007
  "notNull": true
1179
1008
  },
1180
- "maturity": {
1181
- "name": "maturity",
1182
- "type": "integer",
1009
+ "updated_at": {
1010
+ "name": "updated_at",
1011
+ "type": "timestamp",
1183
1012
  "primaryKey": false,
1013
+ "notNull": true,
1014
+ "default": "now()"
1015
+ }
1016
+ },
1017
+ "indexes": {},
1018
+ "foreignKeys": {},
1019
+ "compositePrimaryKeys": {
1020
+ "oracles_pk": {
1021
+ "name": "oracles_pk",
1022
+ "columns": ["chain_id", "address"]
1023
+ }
1024
+ },
1025
+ "uniqueConstraints": {},
1026
+ "policies": {},
1027
+ "checkConstraints": {},
1028
+ "isRLSEnabled": false
1029
+ },
1030
+ "router_v1.6.position_types": {
1031
+ "name": "position_types",
1032
+ "schema": "router_v1.6",
1033
+ "columns": {
1034
+ "id": {
1035
+ "name": "id",
1036
+ "type": "serial",
1037
+ "primaryKey": true,
1184
1038
  "notNull": true
1185
1039
  },
1186
- "expiry": {
1187
- "name": "expiry",
1188
- "type": "integer",
1040
+ "type": {
1041
+ "name": "type",
1042
+ "type": "position_type",
1043
+ "typeSchema": "router_v1.6",
1044
+ "primaryKey": false,
1045
+ "notNull": true
1046
+ }
1047
+ },
1048
+ "indexes": {},
1049
+ "foreignKeys": {},
1050
+ "compositePrimaryKeys": {},
1051
+ "uniqueConstraints": {},
1052
+ "policies": {},
1053
+ "checkConstraints": {},
1054
+ "isRLSEnabled": false
1055
+ },
1056
+ "router_v1.6.positions": {
1057
+ "name": "positions",
1058
+ "schema": "router_v1.6",
1059
+ "columns": {
1060
+ "chain_id": {
1061
+ "name": "chain_id",
1062
+ "type": "bigint",
1189
1063
  "primaryKey": false,
1190
1064
  "notNull": true
1191
1065
  },
1192
- "start": {
1193
- "name": "start",
1066
+ "contract": {
1067
+ "name": "contract",
1068
+ "type": "varchar(42)",
1069
+ "primaryKey": false,
1070
+ "notNull": true
1071
+ },
1072
+ "user": {
1073
+ "name": "user",
1074
+ "type": "varchar(42)",
1075
+ "primaryKey": false,
1076
+ "notNull": true
1077
+ },
1078
+ "position_type_id": {
1079
+ "name": "position_type_id",
1194
1080
  "type": "integer",
1195
1081
  "primaryKey": false,
1196
1082
  "notNull": true
1197
1083
  },
1198
- "group_chain_id": {
1199
- "name": "group_chain_id",
1084
+ "balance": {
1085
+ "name": "balance",
1086
+ "type": "numeric(78, 0)",
1087
+ "primaryKey": false,
1088
+ "notNull": false
1089
+ },
1090
+ "asset": {
1091
+ "name": "asset",
1092
+ "type": "varchar(42)",
1093
+ "primaryKey": false,
1094
+ "notNull": false
1095
+ },
1096
+ "block_number": {
1097
+ "name": "block_number",
1200
1098
  "type": "bigint",
1201
1099
  "primaryKey": false,
1202
1100
  "notNull": true
1203
1101
  },
1204
- "group_maker": {
1205
- "name": "group_maker",
1206
- "type": "varchar(42)",
1102
+ "updated_at": {
1103
+ "name": "updated_at",
1104
+ "type": "timestamp",
1207
1105
  "primaryKey": false,
1106
+ "notNull": true,
1107
+ "default": "now()"
1108
+ }
1109
+ },
1110
+ "indexes": {},
1111
+ "foreignKeys": {
1112
+ "positions_position_type_id_position_types_id_fk": {
1113
+ "name": "positions_position_type_id_position_types_id_fk",
1114
+ "tableFrom": "positions",
1115
+ "tableTo": "position_types",
1116
+ "schemaTo": "router_v1.6",
1117
+ "columnsFrom": ["position_type_id"],
1118
+ "columnsTo": ["id"],
1119
+ "onDelete": "no action",
1120
+ "onUpdate": "no action"
1121
+ }
1122
+ },
1123
+ "compositePrimaryKeys": {
1124
+ "positions_pk": {
1125
+ "name": "positions_pk",
1126
+ "columns": ["chain_id", "contract", "user"]
1127
+ }
1128
+ },
1129
+ "uniqueConstraints": {},
1130
+ "policies": {},
1131
+ "checkConstraints": {},
1132
+ "isRLSEnabled": false
1133
+ },
1134
+ "router_v1.6.status": {
1135
+ "name": "status",
1136
+ "schema": "router_v1.6",
1137
+ "columns": {
1138
+ "id": {
1139
+ "name": "id",
1140
+ "type": "serial",
1141
+ "primaryKey": true,
1208
1142
  "notNull": true
1209
1143
  },
1210
- "group_group": {
1211
- "name": "group_group",
1212
- "type": "varchar(66)",
1144
+ "code": {
1145
+ "name": "code",
1146
+ "type": "status_code",
1147
+ "typeSchema": "router_v1.6",
1213
1148
  "primaryKey": false,
1149
+ "notNull": false
1150
+ }
1151
+ },
1152
+ "indexes": {},
1153
+ "foreignKeys": {},
1154
+ "compositePrimaryKeys": {},
1155
+ "uniqueConstraints": {
1156
+ "status_code_unique": {
1157
+ "name": "status_code_unique",
1158
+ "nullsNotDistinct": false,
1159
+ "columns": ["code"]
1160
+ }
1161
+ },
1162
+ "policies": {},
1163
+ "checkConstraints": {},
1164
+ "isRLSEnabled": false
1165
+ },
1166
+ "router_v1.6.transfers": {
1167
+ "name": "transfers",
1168
+ "schema": "router_v1.6",
1169
+ "columns": {
1170
+ "event_id": {
1171
+ "name": "event_id",
1172
+ "type": "varchar(128)",
1173
+ "primaryKey": true,
1214
1174
  "notNull": true
1215
1175
  },
1216
- "nonce": {
1217
- "name": "nonce",
1218
- "type": "varchar(66)",
1176
+ "chain_id": {
1177
+ "name": "chain_id",
1178
+ "type": "bigint",
1219
1179
  "primaryKey": false,
1220
1180
  "notNull": true
1221
1181
  },
1222
- "buy": {
1223
- "name": "buy",
1224
- "type": "boolean",
1182
+ "contract": {
1183
+ "name": "contract",
1184
+ "type": "varchar(42)",
1225
1185
  "primaryKey": false,
1226
1186
  "notNull": true
1227
1187
  },
1228
- "callback_address": {
1229
- "name": "callback_address",
1188
+ "from": {
1189
+ "name": "from",
1230
1190
  "type": "varchar(42)",
1231
1191
  "primaryKey": false,
1232
1192
  "notNull": true
1233
1193
  },
1234
- "callback_data": {
1235
- "name": "callback_data",
1236
- "type": "text",
1194
+ "to": {
1195
+ "name": "to",
1196
+ "type": "varchar(42)",
1197
+ "primaryKey": false,
1198
+ "notNull": true
1199
+ },
1200
+ "value": {
1201
+ "name": "value",
1202
+ "type": "numeric(78, 0)",
1237
1203
  "primaryKey": false,
1238
1204
  "notNull": true
1239
1205
  },
@@ -1243,8 +1209,8 @@
1243
1209
  "primaryKey": false,
1244
1210
  "notNull": true
1245
1211
  },
1246
- "updated_at": {
1247
- "name": "updated_at",
1212
+ "created_at": {
1213
+ "name": "created_at",
1248
1214
  "type": "timestamp",
1249
1215
  "primaryKey": false,
1250
1216
  "notNull": true,
@@ -1252,23 +1218,35 @@
1252
1218
  }
1253
1219
  },
1254
1220
  "indexes": {
1255
- "offers_v2_group_fk_idx": {
1256
- "name": "offers_v2_group_fk_idx",
1221
+ "transfers_chain_contract_user_idx": {
1222
+ "name": "transfers_chain_contract_user_idx",
1257
1223
  "columns": [
1258
1224
  {
1259
- "expression": "group_chain_id",
1225
+ "expression": "chain_id",
1260
1226
  "isExpression": false,
1261
1227
  "asc": true,
1262
1228
  "nulls": "last"
1263
1229
  },
1264
1230
  {
1265
- "expression": "group_maker",
1231
+ "expression": "contract",
1266
1232
  "isExpression": false,
1267
1233
  "asc": true,
1268
1234
  "nulls": "last"
1269
1235
  },
1270
1236
  {
1271
- "expression": "group_group",
1237
+ "expression": "from",
1238
+ "isExpression": false,
1239
+ "asc": true,
1240
+ "nulls": "last"
1241
+ },
1242
+ {
1243
+ "expression": "to",
1244
+ "isExpression": false,
1245
+ "asc": true,
1246
+ "nulls": "last"
1247
+ },
1248
+ {
1249
+ "expression": "block_number",
1272
1250
  "isExpression": false,
1273
1251
  "asc": true,
1274
1252
  "nulls": "last"
@@ -1281,23 +1259,23 @@
1281
1259
  }
1282
1260
  },
1283
1261
  "foreignKeys": {
1284
- "offers_v2_obligation_id_obligations_obligation_id_fk": {
1285
- "name": "offers_v2_obligation_id_obligations_obligation_id_fk",
1286
- "tableFrom": "offers_v2",
1287
- "tableTo": "obligations",
1288
- "schemaTo": "router_v1.5",
1289
- "columnsFrom": ["obligation_id"],
1290
- "columnsTo": ["obligation_id"],
1262
+ "transfers_positions_from_fk": {
1263
+ "name": "transfers_positions_from_fk",
1264
+ "tableFrom": "transfers",
1265
+ "tableTo": "positions",
1266
+ "schemaTo": "router_v1.6",
1267
+ "columnsFrom": ["chain_id", "contract", "from"],
1268
+ "columnsTo": ["chain_id", "contract", "user"],
1291
1269
  "onDelete": "cascade",
1292
1270
  "onUpdate": "no action"
1293
1271
  },
1294
- "offers_v2_groups_fk": {
1295
- "name": "offers_v2_groups_fk",
1296
- "tableFrom": "offers_v2",
1297
- "tableTo": "groups",
1298
- "schemaTo": "router_v1.5",
1299
- "columnsFrom": ["group_chain_id", "group_maker", "group_group"],
1300
- "columnsTo": ["chain_id", "maker", "group"],
1272
+ "transfers_positions_to_fk": {
1273
+ "name": "transfers_positions_to_fk",
1274
+ "tableFrom": "transfers",
1275
+ "tableTo": "positions",
1276
+ "schemaTo": "router_v1.6",
1277
+ "columnsFrom": ["chain_id", "contract", "to"],
1278
+ "columnsTo": ["chain_id", "contract", "user"],
1301
1279
  "onDelete": "cascade",
1302
1280
  "onUpdate": "no action"
1303
1281
  }
@@ -1308,25 +1286,19 @@
1308
1286
  "checkConstraints": {},
1309
1287
  "isRLSEnabled": false
1310
1288
  },
1311
- "router_v1.5.oracles": {
1312
- "name": "oracles",
1313
- "schema": "router_v1.5",
1289
+ "router_v1.6.validations": {
1290
+ "name": "validations",
1291
+ "schema": "router_v1.6",
1314
1292
  "columns": {
1315
- "chain_id": {
1316
- "name": "chain_id",
1317
- "type": "bigint",
1318
- "primaryKey": false,
1319
- "notNull": true
1320
- },
1321
- "address": {
1322
- "name": "address",
1323
- "type": "varchar(42)",
1324
- "primaryKey": false,
1293
+ "offer_hash": {
1294
+ "name": "offer_hash",
1295
+ "type": "varchar(66)",
1296
+ "primaryKey": true,
1325
1297
  "notNull": true
1326
1298
  },
1327
- "block_number": {
1328
- "name": "block_number",
1329
- "type": "bigint",
1299
+ "status_id": {
1300
+ "name": "status_id",
1301
+ "type": "integer",
1330
1302
  "primaryKey": false,
1331
1303
  "notNull": true
1332
1304
  },
@@ -1339,56 +1311,45 @@
1339
1311
  }
1340
1312
  },
1341
1313
  "indexes": {},
1342
- "foreignKeys": {},
1343
- "compositePrimaryKeys": {
1344
- "oracles_pk": {
1345
- "name": "oracles_pk",
1346
- "columns": ["chain_id", "address"]
1347
- }
1348
- },
1349
- "uniqueConstraints": {},
1350
- "policies": {},
1351
- "checkConstraints": {},
1352
- "isRLSEnabled": false
1353
- },
1354
- "router_v1.5.status": {
1355
- "name": "status",
1356
- "schema": "router_v1.5",
1357
- "columns": {
1358
- "id": {
1359
- "name": "id",
1360
- "type": "serial",
1361
- "primaryKey": true,
1362
- "notNull": true
1314
+ "foreignKeys": {
1315
+ "validations_offer_hash_offers_hash_fk": {
1316
+ "name": "validations_offer_hash_offers_hash_fk",
1317
+ "tableFrom": "validations",
1318
+ "tableTo": "offers",
1319
+ "schemaTo": "router_v1.6",
1320
+ "columnsFrom": ["offer_hash"],
1321
+ "columnsTo": ["hash"],
1322
+ "onDelete": "cascade",
1323
+ "onUpdate": "no action"
1363
1324
  },
1364
- "code": {
1365
- "name": "code",
1366
- "type": "status_code",
1367
- "typeSchema": "router_v1.5",
1368
- "primaryKey": false,
1369
- "notNull": false
1325
+ "validations_status_id_status_id_fk": {
1326
+ "name": "validations_status_id_status_id_fk",
1327
+ "tableFrom": "validations",
1328
+ "tableTo": "status",
1329
+ "schemaTo": "router_v1.6",
1330
+ "columnsFrom": ["status_id"],
1331
+ "columnsTo": ["id"],
1332
+ "onDelete": "no action",
1333
+ "onUpdate": "no action"
1370
1334
  }
1371
1335
  },
1372
- "indexes": {},
1373
- "foreignKeys": {},
1374
1336
  "compositePrimaryKeys": {},
1375
- "uniqueConstraints": {
1376
- "status_code_unique": {
1377
- "name": "status_code_unique",
1378
- "nullsNotDistinct": false,
1379
- "columns": ["code"]
1380
- }
1381
- },
1337
+ "uniqueConstraints": {},
1382
1338
  "policies": {},
1383
1339
  "checkConstraints": {},
1384
1340
  "isRLSEnabled": false
1385
1341
  }
1386
1342
  },
1387
1343
  "enums": {
1388
- "router_v1.5.status_code": {
1344
+ "router_v1.6.position_type": {
1345
+ "name": "position_type",
1346
+ "schema": "router_v1.6",
1347
+ "values": ["erc20", "vault_v1"]
1348
+ },
1349
+ "router_v1.6.status_code": {
1389
1350
  "name": "status_code",
1390
- "schema": "router_v1.5",
1391
- "values": ["VALID", "NOT_ENOUGH_LIQUIDITY"]
1351
+ "schema": "router_v1.6",
1352
+ "values": ["VALID", "SIMULATION_ERROR"]
1392
1353
  }
1393
1354
  },
1394
1355
  "schemas": {},