@morpho-dev/router 0.8.0 → 0.10.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.
- package/dist/cli.js +2417 -975
- package/dist/drizzle/migrations/0026_add-receiver-if-maker-is-seller.sql +1 -0
- package/dist/drizzle/migrations/0027_debt-to-transfers.sql +239 -0
- package/dist/drizzle/migrations/0028_obligation_id_and_keys.sql +247 -0
- package/dist/drizzle/migrations/0029_collateral-positions.sql +248 -0
- package/dist/drizzle/migrations/0030_remove_chain_id_from_offer.sql +37 -0
- package/dist/drizzle/migrations/meta/0026_snapshot.json +1454 -0
- package/dist/drizzle/migrations/meta/0027_snapshot.json +1581 -0
- package/dist/drizzle/migrations/meta/0028_snapshot.json +1632 -0
- package/dist/drizzle/migrations/meta/0029_snapshot.json +1619 -0
- package/dist/drizzle/migrations/meta/0030_snapshot.json +1652 -0
- package/dist/drizzle/migrations/meta/_journal.json +35 -0
- package/dist/evm/bytecode/morpho.txt +1 -1
- package/dist/index.browser.d.mts +561 -317
- package/dist/index.browser.d.mts.map +1 -1
- package/dist/index.browser.d.ts +557 -313
- package/dist/index.browser.d.ts.map +1 -1
- package/dist/index.browser.js +4032 -3816
- package/dist/index.browser.js.map +1 -1
- package/dist/index.browser.mjs +4026 -3816
- package/dist/index.browser.mjs.map +1 -1
- package/dist/index.node.d.mts +1067 -447
- package/dist/index.node.d.mts.map +1 -1
- package/dist/index.node.d.ts +1067 -447
- package/dist/index.node.d.ts.map +1 -1
- package/dist/index.node.js +2466 -1195
- package/dist/index.node.js.map +1 -1
- package/dist/index.node.mjs +2439 -1174
- package/dist/index.node.mjs.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
CREATE TYPE "router_v1.11"."position_type" AS ENUM('erc20', 'vault_v1', 'debtOf', 'collateralOf');--> statement-breakpoint
|
|
2
|
+
CREATE TYPE "router_v1.11"."status_code" AS ENUM('VALID', 'SIMULATION_ERROR');--> statement-breakpoint
|
|
3
|
+
CREATE TABLE "router_v1.11"."callbacks" (
|
|
4
|
+
"id" varchar(66) PRIMARY KEY NOT NULL,
|
|
5
|
+
"position_chain_id" bigint NOT NULL,
|
|
6
|
+
"position_contract" varchar(42) NOT NULL,
|
|
7
|
+
"position_user" varchar(42) NOT NULL,
|
|
8
|
+
"position_type_id" integer NOT NULL,
|
|
9
|
+
"amount" numeric(78, 0)
|
|
10
|
+
);
|
|
11
|
+
--> statement-breakpoint
|
|
12
|
+
CREATE TABLE "router_v1.11"."chains" (
|
|
13
|
+
"chain_id" bigint NOT NULL,
|
|
14
|
+
"block_number" bigint NOT NULL,
|
|
15
|
+
"epoch" numeric(78, 0) DEFAULT '0' NOT NULL,
|
|
16
|
+
"updated_at" timestamp DEFAULT now() NOT NULL
|
|
17
|
+
);
|
|
18
|
+
--> statement-breakpoint
|
|
19
|
+
CREATE TABLE "router_v1.11"."collectors" (
|
|
20
|
+
"chain_id" bigint NOT NULL,
|
|
21
|
+
"name" text NOT NULL,
|
|
22
|
+
"block_number" bigint NOT NULL,
|
|
23
|
+
"epoch" numeric(78, 0) DEFAULT '0' NOT NULL,
|
|
24
|
+
"updated_at" timestamp DEFAULT now() NOT NULL
|
|
25
|
+
);
|
|
26
|
+
--> statement-breakpoint
|
|
27
|
+
CREATE TABLE "router_v1.11"."consumed_events" (
|
|
28
|
+
"event_id" varchar(128) PRIMARY KEY NOT NULL,
|
|
29
|
+
"chain_id" bigint NOT NULL,
|
|
30
|
+
"maker" varchar(42) NOT NULL,
|
|
31
|
+
"group" varchar(66) NOT NULL,
|
|
32
|
+
"amount" numeric(78, 0) NOT NULL,
|
|
33
|
+
"block_number" bigint NOT NULL,
|
|
34
|
+
"created_at" timestamp DEFAULT now() NOT NULL
|
|
35
|
+
);
|
|
36
|
+
--> statement-breakpoint
|
|
37
|
+
CREATE TABLE "router_v1.11"."groups" (
|
|
38
|
+
"chain_id" bigint NOT NULL,
|
|
39
|
+
"maker" varchar(42) NOT NULL,
|
|
40
|
+
"group" varchar(66) NOT NULL,
|
|
41
|
+
"consumed" numeric(78, 0) NOT NULL,
|
|
42
|
+
"block_number" bigint NOT NULL,
|
|
43
|
+
"updated_at" timestamp DEFAULT now() NOT NULL,
|
|
44
|
+
CONSTRAINT "groups_pk" PRIMARY KEY("chain_id","maker","group")
|
|
45
|
+
);
|
|
46
|
+
--> statement-breakpoint
|
|
47
|
+
CREATE TABLE "router_v1.11"."lots" (
|
|
48
|
+
"chain_id" bigint NOT NULL,
|
|
49
|
+
"user" varchar(42) NOT NULL,
|
|
50
|
+
"contract" varchar(42) NOT NULL,
|
|
51
|
+
"group" varchar(66) NOT NULL,
|
|
52
|
+
"obligation_id" varchar(66) NOT NULL,
|
|
53
|
+
"lower" numeric(78, 0) NOT NULL,
|
|
54
|
+
"upper" numeric(78, 0) NOT NULL,
|
|
55
|
+
CONSTRAINT "lots_pk" PRIMARY KEY("chain_id","user","contract","group","obligation_id")
|
|
56
|
+
);
|
|
57
|
+
--> statement-breakpoint
|
|
58
|
+
CREATE TABLE "router_v1.11"."lots_positions" (
|
|
59
|
+
"chain_id" bigint NOT NULL,
|
|
60
|
+
"contract" varchar(42) NOT NULL,
|
|
61
|
+
"user" varchar(42) NOT NULL,
|
|
62
|
+
"position_type_id" integer NOT NULL,
|
|
63
|
+
CONSTRAINT "lots_positions_pk" PRIMARY KEY("chain_id","contract","user")
|
|
64
|
+
);
|
|
65
|
+
--> statement-breakpoint
|
|
66
|
+
CREATE TABLE "router_v1.11"."merkle_paths" (
|
|
67
|
+
"offer_hash" varchar(66) PRIMARY KEY NOT NULL,
|
|
68
|
+
"tree_root" varchar(66) NOT NULL,
|
|
69
|
+
"proof_nodes" text NOT NULL,
|
|
70
|
+
"created_at" timestamp DEFAULT now() NOT NULL
|
|
71
|
+
);
|
|
72
|
+
--> statement-breakpoint
|
|
73
|
+
CREATE TABLE "router_v1.11"."obligation_collaterals_v2" (
|
|
74
|
+
"obligation_key" varchar(66) NOT NULL,
|
|
75
|
+
"asset" varchar(42) NOT NULL,
|
|
76
|
+
"oracle_address" varchar(42) NOT NULL,
|
|
77
|
+
"lltv" bigint NOT NULL,
|
|
78
|
+
"collateral_index" integer NOT NULL,
|
|
79
|
+
"updated_at" timestamp DEFAULT now() NOT NULL,
|
|
80
|
+
CONSTRAINT "obligation_collaterals_v2_pk" PRIMARY KEY("obligation_key","asset")
|
|
81
|
+
);
|
|
82
|
+
--> statement-breakpoint
|
|
83
|
+
CREATE TABLE "router_v1.11"."obligation_id_keys" (
|
|
84
|
+
"obligation_id" varchar(66) PRIMARY KEY NOT NULL,
|
|
85
|
+
"obligation_key" varchar(66) NOT NULL,
|
|
86
|
+
"chain_id" bigint NOT NULL,
|
|
87
|
+
"morpho_v2" varchar(42) NOT NULL
|
|
88
|
+
);
|
|
89
|
+
--> statement-breakpoint
|
|
90
|
+
CREATE TABLE "router_v1.11"."obligations" (
|
|
91
|
+
"obligation_key" varchar(66) PRIMARY KEY NOT NULL,
|
|
92
|
+
"loan_token" varchar(42) NOT NULL,
|
|
93
|
+
"maturity" integer NOT NULL
|
|
94
|
+
);
|
|
95
|
+
--> statement-breakpoint
|
|
96
|
+
CREATE TABLE "router_v1.11"."offers" (
|
|
97
|
+
"hash" varchar(66) PRIMARY KEY NOT NULL,
|
|
98
|
+
"obligation_id" varchar(66) NOT NULL,
|
|
99
|
+
"assets" numeric(78, 0) NOT NULL,
|
|
100
|
+
"obligation_units" numeric(78, 0) DEFAULT '0' NOT NULL,
|
|
101
|
+
"obligation_shares" numeric(78, 0) DEFAULT '0' NOT NULL,
|
|
102
|
+
"tick" integer NOT NULL,
|
|
103
|
+
"maturity" integer NOT NULL,
|
|
104
|
+
"expiry" integer NOT NULL,
|
|
105
|
+
"start" integer NOT NULL,
|
|
106
|
+
"group_chain_id" bigint NOT NULL,
|
|
107
|
+
"group_maker" varchar(42) NOT NULL,
|
|
108
|
+
"group_group" varchar(66) NOT NULL,
|
|
109
|
+
"session" varchar(66) NOT NULL,
|
|
110
|
+
"buy" boolean NOT NULL,
|
|
111
|
+
"callback_address" varchar(42) NOT NULL,
|
|
112
|
+
"callback_data" text NOT NULL,
|
|
113
|
+
"receiver_if_maker_is_seller" varchar(42),
|
|
114
|
+
"block_number" bigint NOT NULL,
|
|
115
|
+
"updated_at" timestamp DEFAULT now() NOT NULL
|
|
116
|
+
);
|
|
117
|
+
--> statement-breakpoint
|
|
118
|
+
CREATE TABLE "router_v1.11"."offers_callbacks" (
|
|
119
|
+
"offer_hash" varchar(66) NOT NULL,
|
|
120
|
+
"callback_id" varchar(66),
|
|
121
|
+
CONSTRAINT "offers_callbacks_pk" PRIMARY KEY("offer_hash","callback_id")
|
|
122
|
+
);
|
|
123
|
+
--> statement-breakpoint
|
|
124
|
+
CREATE TABLE "router_v1.11"."offsets" (
|
|
125
|
+
"chain_id" bigint NOT NULL,
|
|
126
|
+
"user" varchar(42) NOT NULL,
|
|
127
|
+
"contract" varchar(42) NOT NULL,
|
|
128
|
+
"group" varchar(66) NOT NULL,
|
|
129
|
+
"obligation_id" varchar(66) NOT NULL,
|
|
130
|
+
"value" numeric(78, 0) NOT NULL,
|
|
131
|
+
CONSTRAINT "offsets_pk" PRIMARY KEY("chain_id","user","contract","group","obligation_id")
|
|
132
|
+
);
|
|
133
|
+
--> statement-breakpoint
|
|
134
|
+
CREATE TABLE "router_v1.11"."oracles" (
|
|
135
|
+
"chain_id" bigint NOT NULL,
|
|
136
|
+
"address" varchar(42) NOT NULL,
|
|
137
|
+
"price" numeric(78, 0),
|
|
138
|
+
"block_number" bigint NOT NULL,
|
|
139
|
+
"updated_at" timestamp DEFAULT now() NOT NULL,
|
|
140
|
+
CONSTRAINT "oracles_pk" PRIMARY KEY("chain_id","address")
|
|
141
|
+
);
|
|
142
|
+
--> statement-breakpoint
|
|
143
|
+
CREATE TABLE "router_v1.11"."position_types" (
|
|
144
|
+
"id" serial PRIMARY KEY NOT NULL,
|
|
145
|
+
"type" "router_v1.11"."position_type" NOT NULL
|
|
146
|
+
);
|
|
147
|
+
--> statement-breakpoint
|
|
148
|
+
CREATE TABLE "router_v1.11"."positions" (
|
|
149
|
+
"chain_id" bigint NOT NULL,
|
|
150
|
+
"contract" varchar(66) NOT NULL,
|
|
151
|
+
"user" varchar(42) NOT NULL,
|
|
152
|
+
"position_type_id" integer NOT NULL,
|
|
153
|
+
"balance" numeric(78, 0),
|
|
154
|
+
"asset" varchar(42) NOT NULL,
|
|
155
|
+
"block_number" bigint NOT NULL,
|
|
156
|
+
"updated_at" timestamp DEFAULT now() NOT NULL,
|
|
157
|
+
CONSTRAINT "positions_pk" PRIMARY KEY("chain_id","contract","user","position_type_id","asset")
|
|
158
|
+
);
|
|
159
|
+
--> statement-breakpoint
|
|
160
|
+
CREATE TABLE "router_v1.11"."status" (
|
|
161
|
+
"id" serial PRIMARY KEY NOT NULL,
|
|
162
|
+
"code" "router_v1.11"."status_code",
|
|
163
|
+
CONSTRAINT "status_code_unique" UNIQUE("code")
|
|
164
|
+
);
|
|
165
|
+
--> statement-breakpoint
|
|
166
|
+
CREATE TABLE "router_v1.11"."transfers" (
|
|
167
|
+
"event_id" varchar(128) PRIMARY KEY NOT NULL,
|
|
168
|
+
"chain_id" bigint NOT NULL,
|
|
169
|
+
"contract" varchar(66) NOT NULL,
|
|
170
|
+
"from" varchar(42) NOT NULL,
|
|
171
|
+
"to" varchar(42) NOT NULL,
|
|
172
|
+
"value" numeric(78, 0) NOT NULL,
|
|
173
|
+
"position_type_id" integer NOT NULL,
|
|
174
|
+
"asset" varchar(42) NOT NULL,
|
|
175
|
+
"block_number" bigint NOT NULL,
|
|
176
|
+
"created_at" timestamp DEFAULT now() NOT NULL
|
|
177
|
+
);
|
|
178
|
+
--> statement-breakpoint
|
|
179
|
+
CREATE TABLE "router_v1.11"."trees" (
|
|
180
|
+
"root" varchar(66) PRIMARY KEY NOT NULL,
|
|
181
|
+
"root_signature" varchar(132) NOT NULL,
|
|
182
|
+
"created_at" timestamp DEFAULT now() NOT NULL
|
|
183
|
+
);
|
|
184
|
+
--> statement-breakpoint
|
|
185
|
+
CREATE TABLE "router_v1.11"."validations" (
|
|
186
|
+
"offer_hash" varchar(66) PRIMARY KEY NOT NULL,
|
|
187
|
+
"status_id" integer NOT NULL,
|
|
188
|
+
"updated_at" timestamp DEFAULT now() NOT NULL
|
|
189
|
+
);
|
|
190
|
+
--> statement-breakpoint
|
|
191
|
+
DROP TABLE "router_v1.10"."callbacks" CASCADE;--> statement-breakpoint
|
|
192
|
+
DROP TABLE "router_v1.10"."chains" CASCADE;--> statement-breakpoint
|
|
193
|
+
DROP TABLE "router_v1.10"."collectors" CASCADE;--> statement-breakpoint
|
|
194
|
+
DROP TABLE "router_v1.10"."consumed_events" CASCADE;--> statement-breakpoint
|
|
195
|
+
DROP TABLE "router_v1.10"."groups" CASCADE;--> statement-breakpoint
|
|
196
|
+
DROP TABLE "router_v1.10"."lots" CASCADE;--> statement-breakpoint
|
|
197
|
+
DROP TABLE "router_v1.10"."lots_positions" CASCADE;--> statement-breakpoint
|
|
198
|
+
DROP TABLE "router_v1.10"."merkle_paths" CASCADE;--> statement-breakpoint
|
|
199
|
+
DROP TABLE "router_v1.10"."obligation_collaterals_v2" CASCADE;--> statement-breakpoint
|
|
200
|
+
DROP TABLE "router_v1.10"."obligation_id_keys" CASCADE;--> statement-breakpoint
|
|
201
|
+
DROP TABLE "router_v1.10"."obligations" CASCADE;--> statement-breakpoint
|
|
202
|
+
DROP TABLE "router_v1.10"."offers" CASCADE;--> statement-breakpoint
|
|
203
|
+
DROP TABLE "router_v1.10"."offers_callbacks" CASCADE;--> statement-breakpoint
|
|
204
|
+
DROP TABLE "router_v1.10"."offsets" CASCADE;--> statement-breakpoint
|
|
205
|
+
DROP TABLE "router_v1.10"."oracles" CASCADE;--> statement-breakpoint
|
|
206
|
+
DROP TABLE "router_v1.10"."position_types" CASCADE;--> statement-breakpoint
|
|
207
|
+
DROP TABLE "router_v1.10"."positions" CASCADE;--> statement-breakpoint
|
|
208
|
+
DROP TABLE "router_v1.10"."status" CASCADE;--> statement-breakpoint
|
|
209
|
+
DROP TABLE "router_v1.10"."transfers" CASCADE;--> statement-breakpoint
|
|
210
|
+
DROP TABLE "router_v1.10"."trees" CASCADE;--> statement-breakpoint
|
|
211
|
+
DROP TABLE "router_v1.10"."validations" CASCADE;--> statement-breakpoint
|
|
212
|
+
CREATE UNIQUE INDEX "chains_chain_id_idx" ON "router_v1.11"."chains" USING btree ("chain_id");--> statement-breakpoint
|
|
213
|
+
ALTER TABLE "router_v1.11"."callbacks" ADD CONSTRAINT "callbacks_position_type_id_position_types_id_fk" FOREIGN KEY ("position_type_id") REFERENCES "router_v1.11"."position_types"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
|
214
|
+
ALTER TABLE "router_v1.11"."collectors" ADD CONSTRAINT "collectors_chain_id_chains_chain_id_fk" FOREIGN KEY ("chain_id") REFERENCES "router_v1.11"."chains"("chain_id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
|
215
|
+
ALTER TABLE "router_v1.11"."consumed_events" ADD CONSTRAINT "consumed_events_groups_fk" FOREIGN KEY ("chain_id","maker","group") REFERENCES "router_v1.11"."groups"("chain_id","maker","group") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
216
|
+
ALTER TABLE "router_v1.11"."lots" ADD CONSTRAINT "lots_lots_positions_fk" FOREIGN KEY ("chain_id","contract","user") REFERENCES "router_v1.11"."lots_positions"("chain_id","contract","user") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
217
|
+
ALTER TABLE "router_v1.11"."lots" ADD CONSTRAINT "lots_groups_fk" FOREIGN KEY ("chain_id","user","group") REFERENCES "router_v1.11"."groups"("chain_id","maker","group") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
218
|
+
ALTER TABLE "router_v1.11"."lots_positions" ADD CONSTRAINT "lots_positions_position_type_id_position_types_id_fk" FOREIGN KEY ("position_type_id") REFERENCES "router_v1.11"."position_types"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
|
219
|
+
ALTER TABLE "router_v1.11"."merkle_paths" ADD CONSTRAINT "merkle_paths_offer_hash_offers_hash_fk" FOREIGN KEY ("offer_hash") REFERENCES "router_v1.11"."offers"("hash") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
220
|
+
ALTER TABLE "router_v1.11"."merkle_paths" ADD CONSTRAINT "merkle_paths_tree_root_trees_root_fk" FOREIGN KEY ("tree_root") REFERENCES "router_v1.11"."trees"("root") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
221
|
+
ALTER TABLE "router_v1.11"."obligation_collaterals_v2" ADD CONSTRAINT "obligation_collaterals_v2_obligation_key_obligations_obligation_key_fk" FOREIGN KEY ("obligation_key") REFERENCES "router_v1.11"."obligations"("obligation_key") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
222
|
+
ALTER TABLE "router_v1.11"."obligation_id_keys" ADD CONSTRAINT "obligation_id_keys_obligation_key_obligations_obligation_key_fk" FOREIGN KEY ("obligation_key") REFERENCES "router_v1.11"."obligations"("obligation_key") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
223
|
+
ALTER TABLE "router_v1.11"."offers" ADD CONSTRAINT "offers_obligation_id_obligation_id_keys_obligation_id_fk" FOREIGN KEY ("obligation_id") REFERENCES "router_v1.11"."obligation_id_keys"("obligation_id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
224
|
+
ALTER TABLE "router_v1.11"."offers" ADD CONSTRAINT "offers_groups_fk" FOREIGN KEY ("group_chain_id","group_maker","group_group") REFERENCES "router_v1.11"."groups"("chain_id","maker","group") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
225
|
+
ALTER TABLE "router_v1.11"."offers_callbacks" ADD CONSTRAINT "offers_callbacks_offer_hash_offers_hash_fk" FOREIGN KEY ("offer_hash") REFERENCES "router_v1.11"."offers"("hash") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
226
|
+
ALTER TABLE "router_v1.11"."offsets" ADD CONSTRAINT "offsets_lots_positions_fk" FOREIGN KEY ("chain_id","contract","user") REFERENCES "router_v1.11"."lots_positions"("chain_id","contract","user") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
227
|
+
ALTER TABLE "router_v1.11"."positions" ADD CONSTRAINT "positions_position_type_id_position_types_id_fk" FOREIGN KEY ("position_type_id") REFERENCES "router_v1.11"."position_types"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
|
228
|
+
ALTER TABLE "router_v1.11"."transfers" ADD CONSTRAINT "transfers_position_type_id_position_types_id_fk" FOREIGN KEY ("position_type_id") REFERENCES "router_v1.11"."position_types"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
|
229
|
+
ALTER TABLE "router_v1.11"."transfers" ADD CONSTRAINT "transfers_positions_from_fk" FOREIGN KEY ("chain_id","contract","from","position_type_id","asset") REFERENCES "router_v1.11"."positions"("chain_id","contract","user","position_type_id","asset") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
230
|
+
ALTER TABLE "router_v1.11"."transfers" ADD CONSTRAINT "transfers_positions_to_fk" FOREIGN KEY ("chain_id","contract","to","position_type_id","asset") REFERENCES "router_v1.11"."positions"("chain_id","contract","user","position_type_id","asset") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
231
|
+
ALTER TABLE "router_v1.11"."validations" ADD CONSTRAINT "validations_offer_hash_offers_hash_fk" FOREIGN KEY ("offer_hash") REFERENCES "router_v1.11"."offers"("hash") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
232
|
+
ALTER TABLE "router_v1.11"."validations" ADD CONSTRAINT "validations_status_id_status_id_fk" FOREIGN KEY ("status_id") REFERENCES "router_v1.11"."status"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
|
233
|
+
CREATE UNIQUE INDEX "collectors_chain_name_idx" ON "router_v1.11"."collectors" USING btree ("chain_id","name");--> statement-breakpoint
|
|
234
|
+
CREATE INDEX "consumed_events_group_idx" ON "router_v1.11"."consumed_events" USING btree ("chain_id","maker","group");--> statement-breakpoint
|
|
235
|
+
CREATE INDEX "consumed_events_block_number_idx" ON "router_v1.11"."consumed_events" USING btree ("block_number");--> statement-breakpoint
|
|
236
|
+
CREATE INDEX "groups_chain_id_maker_group_consumed_idx" ON "router_v1.11"."groups" USING btree ("chain_id","maker","group","consumed");--> statement-breakpoint
|
|
237
|
+
CREATE INDEX "merkle_paths_tree_root_idx" ON "router_v1.11"."merkle_paths" USING btree ("tree_root");--> statement-breakpoint
|
|
238
|
+
CREATE INDEX "obligation_collaterals_v2_obligation_key_idx" ON "router_v1.11"."obligation_collaterals_v2" USING btree ("obligation_key");--> statement-breakpoint
|
|
239
|
+
CREATE INDEX "obligation_collaterals_v2_oracle_address_idx" ON "router_v1.11"."obligation_collaterals_v2" USING btree ("oracle_address");--> statement-breakpoint
|
|
240
|
+
CREATE INDEX "obligation_id_keys_obligation_key_idx" ON "router_v1.11"."obligation_id_keys" USING btree ("obligation_key");--> statement-breakpoint
|
|
241
|
+
CREATE INDEX "obligation_id_keys_chain_id_idx" ON "router_v1.11"."obligation_id_keys" USING btree ("chain_id");--> statement-breakpoint
|
|
242
|
+
CREATE INDEX "offers_group_fk_idx" ON "router_v1.11"."offers" USING btree ("group_chain_id","group_maker","group_group");--> statement-breakpoint
|
|
243
|
+
CREATE INDEX "offers_group_and_hash_idx" ON "router_v1.11"."offers" USING btree ("group_chain_id","group_maker","group_group","hash");--> statement-breakpoint
|
|
244
|
+
CREATE INDEX "offers_obligation_id_side_idx" ON "router_v1.11"."offers" USING btree ("obligation_id","buy");--> statement-breakpoint
|
|
245
|
+
CREATE INDEX "transfers_chain_contract_user_idx" ON "router_v1.11"."transfers" USING btree ("chain_id","contract","from","to","block_number");--> statement-breakpoint
|
|
246
|
+
CREATE INDEX "transfers_chain_type_block_idx" ON "router_v1.11"."transfers" USING btree ("chain_id","position_type_id","block_number");--> statement-breakpoint
|
|
247
|
+
DROP TYPE "router_v1.10"."position_type";--> statement-breakpoint
|
|
248
|
+
DROP TYPE "router_v1.10"."status_code";
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
ALTER TABLE "router_v1.11"."merkle_paths" DROP CONSTRAINT "merkle_paths_offer_hash_offers_hash_fk";
|
|
2
|
+
--> statement-breakpoint
|
|
3
|
+
ALTER TABLE "router_v1.11"."offers_callbacks" DROP CONSTRAINT "offers_callbacks_offer_hash_offers_hash_fk";
|
|
4
|
+
--> statement-breakpoint
|
|
5
|
+
ALTER TABLE "router_v1.11"."validations" DROP CONSTRAINT "validations_offer_hash_offers_hash_fk";
|
|
6
|
+
--> statement-breakpoint
|
|
7
|
+
ALTER TABLE "router_v1.11"."merkle_paths" ADD COLUMN "obligation_id" varchar(66);--> statement-breakpoint
|
|
8
|
+
ALTER TABLE "router_v1.11"."offers_callbacks" ADD COLUMN "obligation_id" varchar(66);--> statement-breakpoint
|
|
9
|
+
ALTER TABLE "router_v1.11"."validations" ADD COLUMN "obligation_id" varchar(66);--> statement-breakpoint
|
|
10
|
+
--> statement-breakpoint
|
|
11
|
+
UPDATE "router_v1.11"."merkle_paths" AS "mp"
|
|
12
|
+
SET "obligation_id" = "offers"."obligation_id"
|
|
13
|
+
FROM "router_v1.11"."offers"
|
|
14
|
+
WHERE "mp"."offer_hash" = "offers"."hash";--> statement-breakpoint
|
|
15
|
+
UPDATE "router_v1.11"."offers_callbacks" AS "oc"
|
|
16
|
+
SET "obligation_id" = "offers"."obligation_id"
|
|
17
|
+
FROM "router_v1.11"."offers"
|
|
18
|
+
WHERE "oc"."offer_hash" = "offers"."hash";--> statement-breakpoint
|
|
19
|
+
UPDATE "router_v1.11"."validations" AS "v"
|
|
20
|
+
SET "obligation_id" = "offers"."obligation_id"
|
|
21
|
+
FROM "router_v1.11"."offers"
|
|
22
|
+
WHERE "v"."offer_hash" = "offers"."hash";--> statement-breakpoint
|
|
23
|
+
ALTER TABLE "router_v1.11"."merkle_paths" ALTER COLUMN "obligation_id" SET NOT NULL;--> statement-breakpoint
|
|
24
|
+
ALTER TABLE "router_v1.11"."offers_callbacks" ALTER COLUMN "obligation_id" SET NOT NULL;--> statement-breakpoint
|
|
25
|
+
ALTER TABLE "router_v1.11"."validations" ALTER COLUMN "obligation_id" SET NOT NULL;--> statement-breakpoint
|
|
26
|
+
ALTER TABLE "router_v1.11"."merkle_paths" DROP CONSTRAINT IF EXISTS "merkle_paths_pkey";--> statement-breakpoint
|
|
27
|
+
ALTER TABLE "router_v1.11"."offers" DROP CONSTRAINT IF EXISTS "offers_pkey";--> statement-breakpoint
|
|
28
|
+
ALTER TABLE "router_v1.11"."validations" DROP CONSTRAINT IF EXISTS "validations_pkey";--> statement-breakpoint
|
|
29
|
+
ALTER TABLE "router_v1.11"."merkle_paths" ADD CONSTRAINT "merkle_paths_pk" PRIMARY KEY("offer_hash","obligation_id");--> statement-breakpoint
|
|
30
|
+
ALTER TABLE "router_v1.11"."offers" ADD CONSTRAINT "offers_pk" PRIMARY KEY("hash","obligation_id");--> statement-breakpoint
|
|
31
|
+
ALTER TABLE "router_v1.11"."validations" ADD CONSTRAINT "validations_pk" PRIMARY KEY("offer_hash","obligation_id");--> statement-breakpoint
|
|
32
|
+
ALTER TABLE "router_v1.11"."merkle_paths" ADD CONSTRAINT "merkle_paths_offer_fk" FOREIGN KEY ("offer_hash","obligation_id") REFERENCES "router_v1.11"."offers"("hash","obligation_id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
33
|
+
ALTER TABLE "router_v1.11"."offers_callbacks" ADD CONSTRAINT "offers_callbacks_offer_fk" FOREIGN KEY ("offer_hash","obligation_id") REFERENCES "router_v1.11"."offers"("hash","obligation_id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
34
|
+
ALTER TABLE "router_v1.11"."validations" ADD CONSTRAINT "validations_offer_fk" FOREIGN KEY ("offer_hash","obligation_id") REFERENCES "router_v1.11"."offers"("hash","obligation_id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
35
|
+
ALTER TABLE "router_v1.11"."offers_callbacks" DROP CONSTRAINT "offers_callbacks_pk";
|
|
36
|
+
--> statement-breakpoint
|
|
37
|
+
ALTER TABLE "router_v1.11"."offers_callbacks" ADD CONSTRAINT "offers_callbacks_pk" PRIMARY KEY("offer_hash","obligation_id","callback_id");
|