@morpho-org/midnight-sdk 0.1.0 → 1.0.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 (118) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +56 -46
  3. package/lib/cjs/abis.d.ts +1185 -996
  4. package/lib/cjs/abis.js +1445 -1211
  5. package/lib/cjs/api/MidnightApi.d.ts +22 -16
  6. package/lib/cjs/api/MidnightApi.js +22 -16
  7. package/lib/cjs/api/helpers.js +6 -3
  8. package/lib/cjs/api/types.d.ts +35 -9
  9. package/lib/cjs/constants.d.ts +12 -11
  10. package/lib/cjs/constants.js +14 -12
  11. package/lib/cjs/errors.d.ts +74 -1
  12. package/lib/cjs/errors.js +94 -3
  13. package/lib/cjs/fetch/Market.js +0 -1
  14. package/lib/cjs/fetch/index.d.ts +0 -1
  15. package/lib/cjs/fetch/index.js +0 -1
  16. package/lib/cjs/index.d.ts +1 -1
  17. package/lib/cjs/index.js +2 -23
  18. package/lib/cjs/market/Market.d.ts +99 -33
  19. package/lib/cjs/market/Market.js +137 -28
  20. package/lib/cjs/market/MarketUtils.d.ts +61 -41
  21. package/lib/cjs/market/MarketUtils.js +108 -48
  22. package/lib/cjs/market/Position.d.ts +16 -11
  23. package/lib/cjs/market/Position.js +18 -12
  24. package/lib/cjs/market/PositionUtils.d.ts +6 -4
  25. package/lib/cjs/market/PositionUtils.js +9 -6
  26. package/lib/cjs/math/TickLib.d.ts +22 -0
  27. package/lib/cjs/math/TickLib.js +30 -0
  28. package/lib/cjs/math/index.d.ts +0 -1
  29. package/lib/cjs/math/index.js +0 -1
  30. package/lib/cjs/offers/Offer.d.ts +217 -11
  31. package/lib/cjs/offers/Offer.js +215 -7
  32. package/lib/cjs/offers/OfferUtils.d.ts +245 -139
  33. package/lib/cjs/offers/OfferUtils.js +304 -36
  34. package/lib/cjs/queries/GetPosition.d.ts +1 -1
  35. package/lib/cjs/queries/GetPosition.js +1 -1
  36. package/lib/cjs/signatures/EcrecoverRatifierUtils.d.ts +66 -38
  37. package/lib/cjs/signatures/EcrecoverRatifierUtils.js +147 -79
  38. package/lib/cjs/signatures/Group.d.ts +12 -4
  39. package/lib/cjs/signatures/Group.js +12 -4
  40. package/lib/cjs/signatures/GroupUtils.d.ts +12 -4
  41. package/lib/cjs/signatures/GroupUtils.js +6 -2
  42. package/lib/cjs/signatures/Payload.d.ts +277 -277
  43. package/lib/cjs/signatures/Payload.js +517 -534
  44. package/lib/cjs/signatures/RatifierUtils.d.ts +57 -0
  45. package/lib/cjs/signatures/RatifierUtils.js +94 -0
  46. package/lib/cjs/signatures/SetterRatifierUtils.d.ts +21 -13
  47. package/lib/cjs/signatures/SetterRatifierUtils.js +25 -20
  48. package/lib/cjs/signatures/Tree.d.ts +28 -16
  49. package/lib/cjs/signatures/Tree.js +25 -13
  50. package/lib/cjs/signatures/TreeUtils.d.ts +181 -62
  51. package/lib/cjs/signatures/TreeUtils.js +73 -76
  52. package/lib/cjs/signatures/index.d.ts +1 -0
  53. package/lib/cjs/signatures/index.js +3 -0
  54. package/lib/cjs/signatures/offerStructInternal.d.ts +14 -0
  55. package/lib/cjs/signatures/offerStructInternal.js +72 -0
  56. package/lib/esm/abis.d.ts +1185 -996
  57. package/lib/esm/abis.js +1445 -1211
  58. package/lib/esm/api/MidnightApi.d.ts +22 -16
  59. package/lib/esm/api/MidnightApi.js +23 -17
  60. package/lib/esm/api/helpers.js +6 -3
  61. package/lib/esm/api/types.d.ts +35 -9
  62. package/lib/esm/constants.d.ts +12 -11
  63. package/lib/esm/constants.js +13 -11
  64. package/lib/esm/errors.d.ts +74 -1
  65. package/lib/esm/errors.js +89 -2
  66. package/lib/esm/fetch/Market.js +0 -1
  67. package/lib/esm/fetch/index.d.ts +0 -1
  68. package/lib/esm/fetch/index.js +0 -1
  69. package/lib/esm/index.d.ts +1 -1
  70. package/lib/esm/index.js +1 -1
  71. package/lib/esm/market/Market.d.ts +99 -33
  72. package/lib/esm/market/Market.js +137 -28
  73. package/lib/esm/market/MarketUtils.d.ts +61 -41
  74. package/lib/esm/market/MarketUtils.js +109 -49
  75. package/lib/esm/market/Position.d.ts +16 -11
  76. package/lib/esm/market/Position.js +19 -13
  77. package/lib/esm/market/PositionUtils.d.ts +6 -4
  78. package/lib/esm/market/PositionUtils.js +9 -6
  79. package/lib/esm/math/TickLib.d.ts +22 -0
  80. package/lib/esm/math/TickLib.js +31 -1
  81. package/lib/esm/math/index.d.ts +0 -1
  82. package/lib/esm/math/index.js +0 -1
  83. package/lib/esm/offers/Offer.d.ts +217 -11
  84. package/lib/esm/offers/Offer.js +216 -8
  85. package/lib/esm/offers/OfferUtils.d.ts +245 -139
  86. package/lib/esm/offers/OfferUtils.js +306 -38
  87. package/lib/esm/queries/GetPosition.d.ts +1 -1
  88. package/lib/esm/queries/GetPosition.js +1 -1
  89. package/lib/esm/signatures/EcrecoverRatifierUtils.d.ts +66 -38
  90. package/lib/esm/signatures/EcrecoverRatifierUtils.js +149 -81
  91. package/lib/esm/signatures/Group.d.ts +12 -4
  92. package/lib/esm/signatures/Group.js +12 -4
  93. package/lib/esm/signatures/GroupUtils.d.ts +12 -4
  94. package/lib/esm/signatures/GroupUtils.js +6 -2
  95. package/lib/esm/signatures/Payload.d.ts +277 -277
  96. package/lib/esm/signatures/Payload.js +517 -531
  97. package/lib/esm/signatures/RatifierUtils.d.ts +57 -0
  98. package/lib/esm/signatures/RatifierUtils.js +94 -0
  99. package/lib/esm/signatures/SetterRatifierUtils.d.ts +21 -13
  100. package/lib/esm/signatures/SetterRatifierUtils.js +25 -20
  101. package/lib/esm/signatures/Tree.d.ts +28 -16
  102. package/lib/esm/signatures/Tree.js +25 -13
  103. package/lib/esm/signatures/TreeUtils.d.ts +181 -62
  104. package/lib/esm/signatures/TreeUtils.js +75 -78
  105. package/lib/esm/signatures/index.d.ts +1 -0
  106. package/lib/esm/signatures/index.js +1 -0
  107. package/lib/esm/signatures/offerStructInternal.d.ts +14 -0
  108. package/lib/esm/signatures/offerStructInternal.js +67 -0
  109. package/package.json +28 -32
  110. package/src/index.ts +1 -1
  111. package/lib/cjs/fetch/Offer.d.ts +0 -74
  112. package/lib/cjs/fetch/Offer.js +0 -119
  113. package/lib/cjs/math/ConsumableUnitsLib.d.ts +0 -57
  114. package/lib/cjs/math/ConsumableUnitsLib.js +0 -77
  115. package/lib/esm/fetch/Offer.d.ts +0 -74
  116. package/lib/esm/fetch/Offer.js +0 -116
  117. package/lib/esm/math/ConsumableUnitsLib.d.ts +0 -57
  118. package/lib/esm/math/ConsumableUnitsLib.js +0 -74
package/lib/cjs/abis.js CHANGED
@@ -4,8 +4,8 @@ exports.setterRatifierAbi = exports.ecrecoverRatifierAbi = exports.midnightBundl
4
4
  /**
5
5
  * Pinned ABI JSON for the core Midnight contract.
6
6
  *
7
- * Source: `morpho-org/midnight` commit `615fcfa12f725df3a16d65b2c2209272eff5bc10`,
8
- * `src/interfaces/IMidnight.sol`, Forge artifact `out/src/interfaces/IMidnight.sol/IMidnight.json`.
7
+ * Source: `morpho-org/midnight` commit `336b924a2bb378d810ef6d35b6dd3486759af8bd`,
8
+ * `src/interfaces/IMidnight.sol`, Forge artifact `out/IMidnight.sol/IMidnight.json`.
9
9
  *
10
10
  * @example
11
11
  * ```ts
@@ -16,2408 +16,2500 @@ exports.setterRatifierAbi = exports.ecrecoverRatifierAbi = exports.midnightBundl
16
16
  */
17
17
  exports.midnightAbi = [
18
18
  {
19
- inputs: [],
20
- name: "AlreadyConsumed",
21
- type: "error",
22
- },
23
- {
24
- inputs: [],
25
- name: "BuyerGatedFromIncreasingCredit",
26
- type: "error",
27
- },
28
- {
29
- inputs: [],
30
- name: "CannotIncreaseDebtPostMaturity",
31
- type: "error",
32
- },
33
- {
34
- inputs: [],
35
- name: "CollateralParamsNotSorted",
36
- type: "error",
37
- },
38
- {
39
- inputs: [],
40
- name: "ConsumedAssets",
41
- type: "error",
42
- },
43
- {
44
- inputs: [],
45
- name: "ConsumedUnits",
46
- type: "error",
47
- },
48
- {
49
- inputs: [],
50
- name: "ContinuousFeeAboveMax",
51
- type: "error",
52
- },
53
- {
54
- inputs: [],
55
- name: "ContinuousFeeAboveOfferCap",
56
- type: "error",
57
- },
58
- {
59
- inputs: [],
60
- name: "FeeNotMultipleOfFeeCbp",
61
- type: "error",
62
- },
63
- {
64
- inputs: [],
65
- name: "InconsistentInput",
66
- type: "error",
67
- },
68
- {
69
- inputs: [],
70
- name: "InvalidFeeIndex",
71
- type: "error",
72
- },
73
- {
74
- inputs: [],
75
- name: "InvalidLltv",
76
- type: "error",
77
- },
78
- {
79
- inputs: [],
80
- name: "InvalidMaxLif",
81
- type: "error",
82
- },
83
- {
84
- inputs: [],
85
- name: "InvalidOfferCaps",
86
- type: "error",
87
- },
88
- {
89
- inputs: [],
90
- name: "InvalidTickSpacing",
91
- type: "error",
92
- },
93
- {
94
- inputs: [],
95
- name: "LiquidatorGatedFromLiquidating",
96
- type: "error",
97
- },
98
- {
99
- inputs: [],
100
- name: "LltvNotAllowed",
101
- type: "error",
102
- },
103
- {
104
- inputs: [],
105
- name: "MakerCreditOrDebtIncreased",
106
- type: "error",
107
- },
108
- {
109
- inputs: [],
110
- name: "MarketLossFactorMaxedOut",
111
- type: "error",
112
- },
113
- {
114
- inputs: [],
115
- name: "MarketNotCreated",
116
- type: "error",
117
- },
118
- {
119
- inputs: [],
120
- name: "MaturityTooFar",
121
- type: "error",
122
- },
123
- {
124
- inputs: [],
125
- name: "NoCollateralParams",
126
- type: "error",
127
- },
128
- {
129
- inputs: [],
130
- name: "NotBorrower",
131
- type: "error",
132
- },
133
- {
134
- inputs: [],
135
- name: "NotLiquidatable",
136
- type: "error",
137
- },
138
- {
139
- inputs: [],
140
- name: "OfferExpired",
141
- type: "error",
142
- },
143
- {
144
- inputs: [],
145
- name: "OfferNotStarted",
146
- type: "error",
147
- },
148
- {
149
- inputs: [],
150
- name: "OnlyFeeClaimer",
151
- type: "error",
152
- },
153
- {
154
- inputs: [],
155
- name: "OnlyFeeSetter",
156
- type: "error",
157
- },
158
- {
159
- inputs: [],
160
- name: "OnlyRoleSetter",
161
- type: "error",
162
- },
163
- {
164
- inputs: [],
165
- name: "OnlyTickSpacingSetter",
166
- type: "error",
167
- },
168
- {
169
- inputs: [],
170
- name: "RatifierFailed",
171
- type: "error",
172
- },
173
- {
174
- inputs: [],
175
- name: "RatifierUnauthorized",
176
- type: "error",
177
- },
178
- {
179
- inputs: [],
180
- name: "RecoveryCloseFactorConditionsViolated",
181
- type: "error",
182
- },
183
- {
184
- inputs: [],
185
- name: "SelfTake",
186
- type: "error",
187
- },
188
- {
189
- inputs: [],
190
- name: "SellerGatedFromIncreasingDebt",
191
- type: "error",
192
- },
193
- {
194
- inputs: [],
195
- name: "SellerIsLiquidatable",
196
- type: "error",
197
- },
198
- {
199
- inputs: [],
200
- name: "SettlementFeeAboveMax",
201
- type: "error",
202
- },
203
- {
204
- inputs: [],
205
- name: "TakerUnauthorized",
206
- type: "error",
207
- },
208
- {
209
- inputs: [],
210
- name: "TickNotAccessible",
211
- type: "error",
212
- },
213
- {
214
- inputs: [],
215
- name: "TooManyActivatedCollaterals",
216
- type: "error",
217
- },
218
- {
219
- inputs: [],
220
- name: "TooManyCollateralParams",
221
- type: "error",
222
- },
223
- {
224
- inputs: [],
225
- name: "Unauthorized",
226
- type: "error",
227
- },
228
- {
229
- inputs: [],
230
- name: "UnhealthyBorrower",
231
- type: "error",
232
- },
233
- {
234
- inputs: [],
235
- name: "UnusedReceiverMustBeZero",
236
- type: "error",
237
- },
238
- {
239
- inputs: [],
240
- name: "WrongBuyCallbackReturnValue",
241
- type: "error",
242
- },
243
- {
244
- inputs: [],
245
- name: "WrongFlashLoanCallbackReturnValue",
246
- type: "error",
247
- },
248
- {
249
- inputs: [],
250
- name: "WrongLiquidateCallbackReturnValue",
251
- type: "error",
252
- },
253
- {
254
- inputs: [],
255
- name: "WrongRepayCallbackReturnValue",
256
- type: "error",
257
- },
258
- {
259
- inputs: [],
260
- name: "WrongSellCallbackReturnValue",
261
- type: "error",
262
- },
263
- {
264
- inputs: [],
265
- name: "INITIAL_CHAIN_ID",
266
- outputs: [
267
- {
268
- internalType: "uint256",
269
- name: "",
270
- type: "uint256",
271
- },
272
- ],
273
- stateMutability: "view",
274
- type: "function",
275
- },
276
- {
277
- inputs: [
278
- {
279
- internalType: "uint256",
280
- name: "lltv",
281
- type: "uint256",
282
- },
283
- ],
284
- name: "addLltv",
285
- outputs: [],
286
- stateMutability: "nonpayable",
287
- type: "function",
288
- },
289
- {
290
- inputs: [
291
- {
292
- internalType: "uint256",
293
- name: "lltv",
294
- type: "uint256",
295
- },
296
- ],
297
- name: "isLltvAllowed",
298
- outputs: [
299
- {
300
- internalType: "bool",
301
- name: "",
302
- type: "bool",
303
- },
304
- ],
305
- stateMutability: "view",
306
19
  type: "function",
307
- },
308
- {
20
+ name: "claimContinuousFee",
309
21
  inputs: [
310
22
  {
23
+ name: "market",
24
+ type: "tuple",
25
+ internalType: "struct Market",
311
26
  components: [
312
27
  {
28
+ name: "chainId",
29
+ type: "uint256",
30
+ internalType: "uint256",
31
+ },
32
+ {
33
+ name: "midnight",
34
+ type: "address",
313
35
  internalType: "address",
36
+ },
37
+ {
314
38
  name: "loanToken",
315
39
  type: "address",
40
+ internalType: "address",
316
41
  },
317
42
  {
43
+ name: "collateralParams",
44
+ type: "tuple[]",
45
+ internalType: "struct CollateralParams[]",
318
46
  components: [
319
47
  {
320
- internalType: "address",
321
48
  name: "token",
322
49
  type: "address",
50
+ internalType: "address",
323
51
  },
324
52
  {
325
- internalType: "uint256",
326
53
  name: "lltv",
327
54
  type: "uint256",
55
+ internalType: "uint256",
328
56
  },
329
57
  {
330
- internalType: "uint256",
331
- name: "maxLif",
58
+ name: "liquidationCursor",
332
59
  type: "uint256",
60
+ internalType: "uint256",
333
61
  },
334
62
  {
335
- internalType: "address",
336
63
  name: "oracle",
337
64
  type: "address",
65
+ internalType: "address",
338
66
  },
339
67
  ],
340
- internalType: "struct CollateralParams[]",
341
- name: "collateralParams",
342
- type: "tuple[]",
343
68
  },
344
69
  {
345
- internalType: "uint256",
346
70
  name: "maturity",
347
71
  type: "uint256",
72
+ internalType: "uint256",
348
73
  },
349
74
  {
350
- internalType: "uint256",
351
75
  name: "rcfThreshold",
352
76
  type: "uint256",
77
+ internalType: "uint256",
353
78
  },
354
79
  {
355
- internalType: "address",
356
80
  name: "enterGate",
357
81
  type: "address",
82
+ internalType: "address",
358
83
  },
359
84
  {
360
- internalType: "address",
361
85
  name: "liquidatorGate",
362
86
  type: "address",
87
+ internalType: "address",
363
88
  },
364
89
  ],
365
- internalType: "struct Market",
366
- name: "market",
367
- type: "tuple",
368
90
  },
369
91
  {
370
- internalType: "uint256",
371
92
  name: "amount",
372
93
  type: "uint256",
94
+ internalType: "uint256",
373
95
  },
374
96
  {
375
- internalType: "address",
376
97
  name: "receiver",
377
98
  type: "address",
99
+ internalType: "address",
378
100
  },
379
101
  ],
380
- name: "claimContinuousFee",
381
102
  outputs: [],
382
103
  stateMutability: "nonpayable",
383
- type: "function",
384
104
  },
385
105
  {
106
+ type: "function",
107
+ name: "claimSettlementFee",
386
108
  inputs: [
387
109
  {
388
- internalType: "address",
389
110
  name: "token",
390
111
  type: "address",
112
+ internalType: "address",
391
113
  },
392
114
  {
393
- internalType: "uint256",
394
115
  name: "amount",
395
116
  type: "uint256",
117
+ internalType: "uint256",
396
118
  },
397
119
  {
398
- internalType: "address",
399
120
  name: "receiver",
400
121
  type: "address",
122
+ internalType: "address",
401
123
  },
402
124
  ],
403
- name: "claimSettlementFee",
404
125
  outputs: [],
405
126
  stateMutability: "nonpayable",
406
- type: "function",
407
127
  },
408
128
  {
129
+ type: "function",
130
+ name: "claimableSettlementFee",
409
131
  inputs: [
410
132
  {
411
- internalType: "address",
412
133
  name: "token",
413
134
  type: "address",
135
+ internalType: "address",
414
136
  },
415
137
  ],
416
- name: "claimableSettlementFee",
417
138
  outputs: [
418
139
  {
419
- internalType: "uint256",
420
140
  name: "",
421
141
  type: "uint256",
142
+ internalType: "uint256",
422
143
  },
423
144
  ],
424
145
  stateMutability: "view",
425
- type: "function",
426
146
  },
427
147
  {
148
+ type: "function",
149
+ name: "collateral",
428
150
  inputs: [
429
151
  {
430
- internalType: "bytes32",
431
152
  name: "id",
432
153
  type: "bytes32",
154
+ internalType: "bytes32",
433
155
  },
434
156
  {
435
- internalType: "address",
436
157
  name: "user",
437
158
  type: "address",
159
+ internalType: "address",
438
160
  },
439
161
  {
440
- internalType: "uint256",
441
162
  name: "index",
442
163
  type: "uint256",
164
+ internalType: "uint256",
443
165
  },
444
166
  ],
445
- name: "collateral",
446
167
  outputs: [
447
168
  {
448
- internalType: "uint128",
449
169
  name: "",
450
170
  type: "uint128",
171
+ internalType: "uint128",
451
172
  },
452
173
  ],
453
174
  stateMutability: "view",
454
- type: "function",
455
175
  },
456
176
  {
177
+ type: "function",
178
+ name: "collateralBitmap",
457
179
  inputs: [
458
180
  {
459
- internalType: "bytes32",
460
181
  name: "id",
461
182
  type: "bytes32",
183
+ internalType: "bytes32",
462
184
  },
463
185
  {
464
- internalType: "address",
465
186
  name: "user",
466
187
  type: "address",
188
+ internalType: "address",
467
189
  },
468
190
  ],
469
- name: "collateralBitmap",
470
191
  outputs: [
471
192
  {
472
- internalType: "uint128",
473
193
  name: "",
474
194
  type: "uint128",
195
+ internalType: "uint128",
475
196
  },
476
197
  ],
477
198
  stateMutability: "view",
199
+ },
200
+ {
478
201
  type: "function",
202
+ name: "configurator",
203
+ inputs: [],
204
+ outputs: [
205
+ {
206
+ name: "",
207
+ type: "address",
208
+ internalType: "address",
209
+ },
210
+ ],
211
+ stateMutability: "view",
479
212
  },
480
213
  {
214
+ type: "function",
215
+ name: "consumed",
481
216
  inputs: [
482
217
  {
483
- internalType: "address",
484
218
  name: "user",
485
219
  type: "address",
220
+ internalType: "address",
486
221
  },
487
222
  {
488
- internalType: "bytes32",
489
223
  name: "group",
490
224
  type: "bytes32",
225
+ internalType: "bytes32",
491
226
  },
492
227
  ],
493
- name: "consumed",
494
228
  outputs: [
495
229
  {
496
- internalType: "uint256",
497
230
  name: "",
498
- type: "uint256",
231
+ type: "uint128",
232
+ internalType: "uint128",
499
233
  },
500
234
  ],
501
235
  stateMutability: "view",
502
- type: "function",
503
236
  },
504
237
  {
238
+ type: "function",
239
+ name: "continuousFee",
505
240
  inputs: [
506
241
  {
507
- internalType: "bytes32",
508
242
  name: "id",
509
243
  type: "bytes32",
244
+ internalType: "bytes32",
510
245
  },
511
246
  ],
512
- name: "continuousFee",
513
247
  outputs: [
514
248
  {
515
- internalType: "uint32",
516
249
  name: "",
517
250
  type: "uint32",
251
+ internalType: "uint32",
518
252
  },
519
253
  ],
520
254
  stateMutability: "view",
521
- type: "function",
522
255
  },
523
256
  {
257
+ type: "function",
258
+ name: "continuousFeeCredit",
524
259
  inputs: [
525
260
  {
526
- internalType: "bytes32",
527
261
  name: "id",
528
262
  type: "bytes32",
263
+ internalType: "bytes32",
529
264
  },
530
265
  ],
531
- name: "continuousFeeCredit",
532
266
  outputs: [
533
267
  {
534
- internalType: "uint128",
535
268
  name: "",
536
269
  type: "uint128",
270
+ internalType: "uint128",
537
271
  },
538
272
  ],
539
273
  stateMutability: "view",
540
- type: "function",
541
274
  },
542
275
  {
276
+ type: "function",
277
+ name: "credit",
543
278
  inputs: [
544
279
  {
545
- internalType: "bytes32",
546
280
  name: "id",
547
281
  type: "bytes32",
282
+ internalType: "bytes32",
548
283
  },
549
284
  {
550
- internalType: "address",
551
285
  name: "user",
552
286
  type: "address",
287
+ internalType: "address",
553
288
  },
554
289
  ],
555
- name: "credit",
556
290
  outputs: [
557
291
  {
558
- internalType: "uint128",
559
292
  name: "",
560
293
  type: "uint128",
294
+ internalType: "uint128",
561
295
  },
562
296
  ],
563
297
  stateMutability: "view",
564
- type: "function",
565
298
  },
566
299
  {
300
+ type: "function",
301
+ name: "debt",
567
302
  inputs: [
568
303
  {
569
- internalType: "bytes32",
570
304
  name: "id",
571
305
  type: "bytes32",
306
+ internalType: "bytes32",
572
307
  },
573
308
  {
574
- internalType: "address",
575
309
  name: "user",
576
310
  type: "address",
311
+ internalType: "address",
577
312
  },
578
313
  ],
579
- name: "debt",
580
314
  outputs: [
581
315
  {
582
- internalType: "uint128",
583
316
  name: "",
584
317
  type: "uint128",
318
+ internalType: "uint128",
585
319
  },
586
320
  ],
587
321
  stateMutability: "view",
588
- type: "function",
589
322
  },
590
323
  {
324
+ type: "function",
325
+ name: "defaultContinuousFee",
591
326
  inputs: [
592
327
  {
593
- internalType: "address",
594
328
  name: "loanToken",
595
329
  type: "address",
330
+ internalType: "address",
596
331
  },
597
332
  ],
598
- name: "defaultContinuousFee",
599
333
  outputs: [
600
334
  {
601
- internalType: "uint32",
602
335
  name: "",
603
336
  type: "uint32",
337
+ internalType: "uint32",
604
338
  },
605
339
  ],
606
340
  stateMutability: "view",
607
- type: "function",
608
341
  },
609
342
  {
343
+ type: "function",
344
+ name: "defaultSettlementFeeCbp",
610
345
  inputs: [
611
346
  {
612
- internalType: "address",
613
347
  name: "loanToken",
614
348
  type: "address",
349
+ internalType: "address",
615
350
  },
616
351
  {
617
- internalType: "uint256",
618
352
  name: "index",
619
353
  type: "uint256",
354
+ internalType: "uint256",
620
355
  },
621
356
  ],
622
- name: "defaultSettlementFeeCbp",
623
357
  outputs: [
624
358
  {
625
- internalType: "uint16",
626
359
  name: "",
627
360
  type: "uint16",
361
+ internalType: "uint16",
628
362
  },
629
363
  ],
630
364
  stateMutability: "view",
365
+ },
366
+ {
367
+ type: "function",
368
+ name: "enableLiquidationCursor",
369
+ inputs: [
370
+ {
371
+ name: "liquidationCursor",
372
+ type: "uint256",
373
+ internalType: "uint256",
374
+ },
375
+ ],
376
+ outputs: [],
377
+ stateMutability: "nonpayable",
378
+ },
379
+ {
631
380
  type: "function",
381
+ name: "enableLltv",
382
+ inputs: [
383
+ {
384
+ name: "lltv",
385
+ type: "uint256",
386
+ internalType: "uint256",
387
+ },
388
+ ],
389
+ outputs: [],
390
+ stateMutability: "nonpayable",
632
391
  },
633
392
  {
634
- inputs: [],
393
+ type: "function",
635
394
  name: "feeClaimer",
395
+ inputs: [],
636
396
  outputs: [
637
397
  {
638
- internalType: "address",
639
398
  name: "",
640
399
  type: "address",
400
+ internalType: "address",
641
401
  },
642
402
  ],
643
403
  stateMutability: "view",
644
- type: "function",
645
404
  },
646
405
  {
647
- inputs: [],
406
+ type: "function",
648
407
  name: "feeSetter",
408
+ inputs: [],
649
409
  outputs: [
650
410
  {
651
- internalType: "address",
652
411
  name: "",
653
412
  type: "address",
413
+ internalType: "address",
654
414
  },
655
415
  ],
656
416
  stateMutability: "view",
657
- type: "function",
658
417
  },
659
418
  {
419
+ type: "function",
420
+ name: "flashLoan",
660
421
  inputs: [
661
422
  {
662
- internalType: "address[]",
663
423
  name: "tokens",
664
424
  type: "address[]",
425
+ internalType: "address[]",
665
426
  },
666
427
  {
667
- internalType: "uint256[]",
668
428
  name: "assets",
669
429
  type: "uint256[]",
430
+ internalType: "uint256[]",
670
431
  },
671
432
  {
672
- internalType: "address",
673
433
  name: "callback",
674
434
  type: "address",
435
+ internalType: "address",
675
436
  },
676
437
  {
677
- internalType: "bytes",
678
438
  name: "data",
679
439
  type: "bytes",
440
+ internalType: "bytes",
680
441
  },
681
442
  ],
682
- name: "flashLoan",
683
443
  outputs: [],
684
444
  stateMutability: "nonpayable",
685
- type: "function",
686
445
  },
687
446
  {
447
+ type: "function",
448
+ name: "isAuthorized",
688
449
  inputs: [
689
450
  {
690
- internalType: "address",
691
451
  name: "authorizer",
692
452
  type: "address",
453
+ internalType: "address",
693
454
  },
694
455
  {
695
- internalType: "address",
696
456
  name: "authorized",
697
457
  type: "address",
458
+ internalType: "address",
698
459
  },
699
460
  ],
700
- name: "isAuthorized",
701
461
  outputs: [
702
462
  {
703
- internalType: "bool",
704
463
  name: "",
705
464
  type: "bool",
465
+ internalType: "bool",
706
466
  },
707
467
  ],
708
468
  stateMutability: "view",
709
- type: "function",
710
469
  },
711
470
  {
471
+ type: "function",
472
+ name: "isHealthy",
712
473
  inputs: [
713
474
  {
475
+ name: "market",
476
+ type: "tuple",
477
+ internalType: "struct Market",
714
478
  components: [
715
479
  {
480
+ name: "chainId",
481
+ type: "uint256",
482
+ internalType: "uint256",
483
+ },
484
+ {
485
+ name: "midnight",
486
+ type: "address",
716
487
  internalType: "address",
488
+ },
489
+ {
717
490
  name: "loanToken",
718
491
  type: "address",
492
+ internalType: "address",
719
493
  },
720
494
  {
495
+ name: "collateralParams",
496
+ type: "tuple[]",
497
+ internalType: "struct CollateralParams[]",
721
498
  components: [
722
499
  {
723
- internalType: "address",
724
500
  name: "token",
725
501
  type: "address",
502
+ internalType: "address",
726
503
  },
727
504
  {
728
- internalType: "uint256",
729
505
  name: "lltv",
730
506
  type: "uint256",
507
+ internalType: "uint256",
731
508
  },
732
509
  {
733
- internalType: "uint256",
734
- name: "maxLif",
510
+ name: "liquidationCursor",
735
511
  type: "uint256",
512
+ internalType: "uint256",
736
513
  },
737
514
  {
738
- internalType: "address",
739
515
  name: "oracle",
740
516
  type: "address",
517
+ internalType: "address",
741
518
  },
742
519
  ],
743
- internalType: "struct CollateralParams[]",
744
- name: "collateralParams",
745
- type: "tuple[]",
746
520
  },
747
521
  {
748
- internalType: "uint256",
749
522
  name: "maturity",
750
523
  type: "uint256",
524
+ internalType: "uint256",
751
525
  },
752
526
  {
753
- internalType: "uint256",
754
527
  name: "rcfThreshold",
755
528
  type: "uint256",
529
+ internalType: "uint256",
756
530
  },
757
531
  {
758
- internalType: "address",
759
532
  name: "enterGate",
760
533
  type: "address",
534
+ internalType: "address",
761
535
  },
762
536
  {
763
- internalType: "address",
764
537
  name: "liquidatorGate",
765
538
  type: "address",
539
+ internalType: "address",
766
540
  },
767
541
  ],
768
- internalType: "struct Market",
769
- name: "market",
770
- type: "tuple",
771
542
  },
772
543
  {
773
- internalType: "bytes32",
774
544
  name: "id",
775
545
  type: "bytes32",
546
+ internalType: "bytes32",
776
547
  },
777
548
  {
778
- internalType: "address",
779
549
  name: "borrower",
780
550
  type: "address",
551
+ internalType: "address",
781
552
  },
782
553
  ],
783
- name: "isHealthy",
784
554
  outputs: [
785
555
  {
556
+ name: "",
557
+ type: "bool",
786
558
  internalType: "bool",
559
+ },
560
+ ],
561
+ stateMutability: "view",
562
+ },
563
+ {
564
+ type: "function",
565
+ name: "isLiquidationCursorEnabled",
566
+ inputs: [
567
+ {
568
+ name: "liquidationCursor",
569
+ type: "uint256",
570
+ internalType: "uint256",
571
+ },
572
+ ],
573
+ outputs: [
574
+ {
787
575
  name: "",
788
576
  type: "bool",
577
+ internalType: "bool",
789
578
  },
790
579
  ],
791
580
  stateMutability: "view",
581
+ },
582
+ {
792
583
  type: "function",
584
+ name: "isLltvEnabled",
585
+ inputs: [
586
+ {
587
+ name: "lltv",
588
+ type: "uint256",
589
+ internalType: "uint256",
590
+ },
591
+ ],
592
+ outputs: [
593
+ {
594
+ name: "",
595
+ type: "bool",
596
+ internalType: "bool",
597
+ },
598
+ ],
599
+ stateMutability: "view",
793
600
  },
794
601
  {
602
+ type: "function",
603
+ name: "lastAccrual",
795
604
  inputs: [
796
605
  {
797
- internalType: "bytes32",
798
606
  name: "id",
799
607
  type: "bytes32",
608
+ internalType: "bytes32",
800
609
  },
801
610
  {
802
- internalType: "address",
803
611
  name: "user",
804
612
  type: "address",
613
+ internalType: "address",
805
614
  },
806
615
  ],
807
- name: "lastAccrual",
808
616
  outputs: [
809
617
  {
810
- internalType: "uint128",
811
618
  name: "",
812
619
  type: "uint128",
620
+ internalType: "uint128",
813
621
  },
814
622
  ],
815
623
  stateMutability: "view",
816
- type: "function",
817
624
  },
818
625
  {
626
+ type: "function",
627
+ name: "lastLossFactor",
819
628
  inputs: [
820
629
  {
821
- internalType: "bytes32",
822
630
  name: "id",
823
631
  type: "bytes32",
632
+ internalType: "bytes32",
824
633
  },
825
634
  {
826
- internalType: "address",
827
635
  name: "user",
828
636
  type: "address",
637
+ internalType: "address",
829
638
  },
830
639
  ],
831
- name: "lastLossFactor",
832
640
  outputs: [
833
641
  {
834
- internalType: "uint128",
835
642
  name: "",
836
643
  type: "uint128",
644
+ internalType: "uint128",
837
645
  },
838
646
  ],
839
647
  stateMutability: "view",
840
- type: "function",
841
648
  },
842
649
  {
650
+ type: "function",
651
+ name: "liquidate",
843
652
  inputs: [
844
653
  {
654
+ name: "market",
655
+ type: "tuple",
656
+ internalType: "struct Market",
845
657
  components: [
846
658
  {
659
+ name: "chainId",
660
+ type: "uint256",
661
+ internalType: "uint256",
662
+ },
663
+ {
664
+ name: "midnight",
665
+ type: "address",
847
666
  internalType: "address",
667
+ },
668
+ {
848
669
  name: "loanToken",
849
670
  type: "address",
671
+ internalType: "address",
850
672
  },
851
673
  {
674
+ name: "collateralParams",
675
+ type: "tuple[]",
676
+ internalType: "struct CollateralParams[]",
852
677
  components: [
853
678
  {
854
- internalType: "address",
855
679
  name: "token",
856
680
  type: "address",
681
+ internalType: "address",
857
682
  },
858
683
  {
859
- internalType: "uint256",
860
684
  name: "lltv",
861
685
  type: "uint256",
686
+ internalType: "uint256",
862
687
  },
863
688
  {
864
- internalType: "uint256",
865
- name: "maxLif",
689
+ name: "liquidationCursor",
866
690
  type: "uint256",
691
+ internalType: "uint256",
867
692
  },
868
693
  {
869
- internalType: "address",
870
694
  name: "oracle",
871
695
  type: "address",
696
+ internalType: "address",
872
697
  },
873
698
  ],
874
- internalType: "struct CollateralParams[]",
875
- name: "collateralParams",
876
- type: "tuple[]",
877
699
  },
878
700
  {
879
- internalType: "uint256",
880
701
  name: "maturity",
881
702
  type: "uint256",
703
+ internalType: "uint256",
882
704
  },
883
705
  {
884
- internalType: "uint256",
885
706
  name: "rcfThreshold",
886
707
  type: "uint256",
708
+ internalType: "uint256",
887
709
  },
888
710
  {
889
- internalType: "address",
890
711
  name: "enterGate",
891
712
  type: "address",
713
+ internalType: "address",
892
714
  },
893
715
  {
894
- internalType: "address",
895
716
  name: "liquidatorGate",
896
717
  type: "address",
718
+ internalType: "address",
897
719
  },
898
720
  ],
899
- internalType: "struct Market",
900
- name: "market",
901
- type: "tuple",
902
721
  },
903
722
  {
904
- internalType: "uint256",
905
723
  name: "collateralIndex",
906
724
  type: "uint256",
725
+ internalType: "uint256",
907
726
  },
908
727
  {
909
- internalType: "uint256",
910
728
  name: "seizedAssets",
911
729
  type: "uint256",
730
+ internalType: "uint256",
912
731
  },
913
732
  {
914
- internalType: "uint256",
915
733
  name: "repaidUnits",
916
734
  type: "uint256",
735
+ internalType: "uint256",
917
736
  },
918
737
  {
919
- internalType: "address",
920
738
  name: "borrower",
921
739
  type: "address",
740
+ internalType: "address",
922
741
  },
923
742
  {
924
- internalType: "bool",
925
743
  name: "postMaturityMode",
926
744
  type: "bool",
745
+ internalType: "bool",
927
746
  },
928
747
  {
929
- internalType: "address",
930
748
  name: "receiver",
931
749
  type: "address",
750
+ internalType: "address",
932
751
  },
933
752
  {
934
- internalType: "address",
935
753
  name: "callback",
936
754
  type: "address",
755
+ internalType: "address",
937
756
  },
938
757
  {
939
- internalType: "bytes",
940
758
  name: "data",
941
759
  type: "bytes",
760
+ internalType: "bytes",
942
761
  },
943
762
  ],
944
- name: "liquidate",
945
763
  outputs: [
946
764
  {
947
- internalType: "uint256",
948
765
  name: "outputSeizedAssets",
949
766
  type: "uint256",
767
+ internalType: "uint256",
950
768
  },
951
769
  {
952
- internalType: "uint256",
953
770
  name: "outputRepaidUnits",
954
771
  type: "uint256",
772
+ internalType: "uint256",
955
773
  },
956
774
  ],
957
775
  stateMutability: "nonpayable",
958
- type: "function",
959
776
  },
960
777
  {
778
+ type: "function",
779
+ name: "liquidationLocked",
961
780
  inputs: [
962
781
  {
963
- internalType: "bytes32",
964
782
  name: "id",
965
783
  type: "bytes32",
784
+ internalType: "bytes32",
966
785
  },
967
786
  {
968
- internalType: "address",
969
787
  name: "user",
970
788
  type: "address",
789
+ internalType: "address",
971
790
  },
972
791
  ],
973
- name: "liquidationLocked",
974
792
  outputs: [
975
793
  {
976
- internalType: "bool",
977
794
  name: "",
978
795
  type: "bool",
796
+ internalType: "bool",
979
797
  },
980
798
  ],
981
799
  stateMutability: "view",
982
- type: "function",
983
800
  },
984
801
  {
802
+ type: "function",
803
+ name: "lossFactor",
985
804
  inputs: [
986
805
  {
987
- internalType: "bytes32",
988
806
  name: "id",
989
807
  type: "bytes32",
808
+ internalType: "bytes32",
990
809
  },
991
810
  ],
992
- name: "lossFactor",
993
811
  outputs: [
994
812
  {
995
- internalType: "uint128",
996
813
  name: "",
997
814
  type: "uint128",
815
+ internalType: "uint128",
998
816
  },
999
817
  ],
1000
818
  stateMutability: "view",
1001
- type: "function",
1002
819
  },
1003
820
  {
821
+ type: "function",
822
+ name: "marketState",
1004
823
  inputs: [
1005
824
  {
1006
- internalType: "bytes32",
1007
825
  name: "id",
1008
826
  type: "bytes32",
827
+ internalType: "bytes32",
1009
828
  },
1010
829
  ],
1011
- name: "marketState",
1012
830
  outputs: [
1013
831
  {
1014
- internalType: "uint128",
1015
832
  name: "totalUnits",
1016
833
  type: "uint128",
834
+ internalType: "uint128",
1017
835
  },
1018
836
  {
1019
- internalType: "uint128",
1020
837
  name: "lossFactor",
1021
838
  type: "uint128",
839
+ internalType: "uint128",
1022
840
  },
1023
841
  {
1024
- internalType: "uint128",
1025
842
  name: "withdrawable",
1026
843
  type: "uint128",
844
+ internalType: "uint128",
1027
845
  },
1028
846
  {
1029
- internalType: "uint128",
1030
847
  name: "continuousFeeCredit",
1031
848
  type: "uint128",
849
+ internalType: "uint128",
1032
850
  },
1033
851
  {
1034
- internalType: "uint16",
1035
852
  name: "settlementFeeCbp0",
1036
853
  type: "uint16",
854
+ internalType: "uint16",
1037
855
  },
1038
856
  {
1039
- internalType: "uint16",
1040
857
  name: "settlementFeeCbp1",
1041
858
  type: "uint16",
859
+ internalType: "uint16",
1042
860
  },
1043
861
  {
1044
- internalType: "uint16",
1045
862
  name: "settlementFeeCbp2",
1046
863
  type: "uint16",
864
+ internalType: "uint16",
1047
865
  },
1048
866
  {
1049
- internalType: "uint16",
1050
867
  name: "settlementFeeCbp3",
1051
868
  type: "uint16",
869
+ internalType: "uint16",
1052
870
  },
1053
871
  {
1054
- internalType: "uint16",
1055
872
  name: "settlementFeeCbp4",
1056
873
  type: "uint16",
874
+ internalType: "uint16",
1057
875
  },
1058
876
  {
1059
- internalType: "uint16",
1060
877
  name: "settlementFeeCbp5",
1061
878
  type: "uint16",
879
+ internalType: "uint16",
1062
880
  },
1063
881
  {
1064
- internalType: "uint16",
1065
882
  name: "settlementFeeCbp6",
1066
883
  type: "uint16",
884
+ internalType: "uint16",
1067
885
  },
1068
886
  {
1069
- internalType: "uint32",
1070
887
  name: "continuousFee",
1071
888
  type: "uint32",
889
+ internalType: "uint32",
1072
890
  },
1073
891
  {
1074
- internalType: "uint8",
1075
892
  name: "tickSpacing",
1076
893
  type: "uint8",
894
+ internalType: "uint8",
1077
895
  },
1078
896
  ],
1079
897
  stateMutability: "view",
1080
- type: "function",
1081
898
  },
1082
899
  {
900
+ type: "function",
901
+ name: "multicall",
1083
902
  inputs: [
1084
903
  {
1085
- internalType: "bytes[]",
1086
904
  name: "calls",
1087
905
  type: "bytes[]",
906
+ internalType: "bytes[]",
1088
907
  },
1089
908
  ],
1090
- name: "multicall",
1091
909
  outputs: [],
1092
910
  stateMutability: "nonpayable",
1093
- type: "function",
1094
911
  },
1095
912
  {
913
+ type: "function",
914
+ name: "pendingFee",
1096
915
  inputs: [
1097
916
  {
1098
- internalType: "bytes32",
1099
917
  name: "id",
1100
918
  type: "bytes32",
919
+ internalType: "bytes32",
1101
920
  },
1102
921
  {
1103
- internalType: "address",
1104
922
  name: "user",
1105
923
  type: "address",
924
+ internalType: "address",
1106
925
  },
1107
926
  ],
1108
- name: "pendingFee",
1109
927
  outputs: [
1110
928
  {
1111
- internalType: "uint128",
1112
929
  name: "",
1113
930
  type: "uint128",
931
+ internalType: "uint128",
1114
932
  },
1115
933
  ],
1116
934
  stateMutability: "view",
1117
- type: "function",
1118
935
  },
1119
936
  {
937
+ type: "function",
938
+ name: "position",
1120
939
  inputs: [
1121
940
  {
1122
- internalType: "bytes32",
1123
941
  name: "id",
1124
942
  type: "bytes32",
943
+ internalType: "bytes32",
1125
944
  },
1126
945
  {
1127
- internalType: "address",
1128
946
  name: "user",
1129
947
  type: "address",
948
+ internalType: "address",
1130
949
  },
1131
950
  ],
1132
- name: "position",
1133
951
  outputs: [
1134
952
  {
1135
- internalType: "uint128",
1136
953
  name: "credit",
1137
954
  type: "uint128",
955
+ internalType: "uint128",
1138
956
  },
1139
957
  {
1140
- internalType: "uint128",
1141
958
  name: "pendingFee",
1142
959
  type: "uint128",
960
+ internalType: "uint128",
1143
961
  },
1144
962
  {
1145
- internalType: "uint128",
1146
963
  name: "lastLossFactor",
1147
964
  type: "uint128",
965
+ internalType: "uint128",
1148
966
  },
1149
967
  {
1150
- internalType: "uint128",
1151
968
  name: "lastAccrual",
1152
969
  type: "uint128",
970
+ internalType: "uint128",
1153
971
  },
1154
972
  {
1155
- internalType: "uint128",
1156
973
  name: "debt",
1157
974
  type: "uint128",
975
+ internalType: "uint128",
1158
976
  },
1159
977
  {
1160
- internalType: "uint128",
1161
978
  name: "collateralBitmap",
1162
979
  type: "uint128",
980
+ internalType: "uint128",
1163
981
  },
1164
982
  ],
1165
983
  stateMutability: "view",
1166
- type: "function",
1167
984
  },
1168
985
  {
986
+ type: "function",
987
+ name: "repay",
1169
988
  inputs: [
1170
989
  {
990
+ name: "market",
991
+ type: "tuple",
992
+ internalType: "struct Market",
1171
993
  components: [
1172
994
  {
995
+ name: "chainId",
996
+ type: "uint256",
997
+ internalType: "uint256",
998
+ },
999
+ {
1000
+ name: "midnight",
1001
+ type: "address",
1173
1002
  internalType: "address",
1003
+ },
1004
+ {
1174
1005
  name: "loanToken",
1175
1006
  type: "address",
1007
+ internalType: "address",
1176
1008
  },
1177
1009
  {
1010
+ name: "collateralParams",
1011
+ type: "tuple[]",
1012
+ internalType: "struct CollateralParams[]",
1178
1013
  components: [
1179
1014
  {
1180
- internalType: "address",
1181
1015
  name: "token",
1182
1016
  type: "address",
1017
+ internalType: "address",
1183
1018
  },
1184
1019
  {
1185
- internalType: "uint256",
1186
1020
  name: "lltv",
1187
1021
  type: "uint256",
1022
+ internalType: "uint256",
1188
1023
  },
1189
1024
  {
1190
- internalType: "uint256",
1191
- name: "maxLif",
1025
+ name: "liquidationCursor",
1192
1026
  type: "uint256",
1027
+ internalType: "uint256",
1193
1028
  },
1194
1029
  {
1195
- internalType: "address",
1196
1030
  name: "oracle",
1197
1031
  type: "address",
1032
+ internalType: "address",
1198
1033
  },
1199
1034
  ],
1200
- internalType: "struct CollateralParams[]",
1201
- name: "collateralParams",
1202
- type: "tuple[]",
1203
1035
  },
1204
1036
  {
1205
- internalType: "uint256",
1206
1037
  name: "maturity",
1207
1038
  type: "uint256",
1039
+ internalType: "uint256",
1208
1040
  },
1209
1041
  {
1210
- internalType: "uint256",
1211
1042
  name: "rcfThreshold",
1212
1043
  type: "uint256",
1044
+ internalType: "uint256",
1213
1045
  },
1214
1046
  {
1215
- internalType: "address",
1216
1047
  name: "enterGate",
1217
1048
  type: "address",
1049
+ internalType: "address",
1218
1050
  },
1219
1051
  {
1220
- internalType: "address",
1221
1052
  name: "liquidatorGate",
1222
1053
  type: "address",
1054
+ internalType: "address",
1223
1055
  },
1224
1056
  ],
1225
- internalType: "struct Market",
1226
- name: "market",
1227
- type: "tuple",
1228
1057
  },
1229
1058
  {
1230
- internalType: "uint256",
1231
1059
  name: "units",
1232
1060
  type: "uint256",
1061
+ internalType: "uint256",
1233
1062
  },
1234
1063
  {
1235
- internalType: "address",
1236
1064
  name: "onBehalf",
1237
1065
  type: "address",
1066
+ internalType: "address",
1238
1067
  },
1239
1068
  {
1240
- internalType: "address",
1241
1069
  name: "callback",
1242
1070
  type: "address",
1071
+ internalType: "address",
1243
1072
  },
1244
1073
  {
1245
- internalType: "bytes",
1246
1074
  name: "data",
1247
1075
  type: "bytes",
1076
+ internalType: "bytes",
1248
1077
  },
1249
1078
  ],
1250
- name: "repay",
1251
1079
  outputs: [],
1252
1080
  stateMutability: "nonpayable",
1253
- type: "function",
1254
1081
  },
1255
1082
  {
1256
- inputs: [],
1257
- name: "roleSetter",
1258
- outputs: [
1083
+ type: "function",
1084
+ name: "setConfigurator",
1085
+ inputs: [
1259
1086
  {
1260
- internalType: "address",
1261
- name: "",
1087
+ name: "newConfigurator",
1262
1088
  type: "address",
1089
+ internalType: "address",
1263
1090
  },
1264
1091
  ],
1265
- stateMutability: "view",
1266
- type: "function",
1092
+ outputs: [],
1093
+ stateMutability: "nonpayable",
1267
1094
  },
1268
1095
  {
1096
+ type: "function",
1097
+ name: "setConsumed",
1269
1098
  inputs: [
1270
1099
  {
1271
- internalType: "bytes32",
1272
1100
  name: "group",
1273
1101
  type: "bytes32",
1102
+ internalType: "bytes32",
1274
1103
  },
1275
1104
  {
1276
- internalType: "uint256",
1277
1105
  name: "amount",
1278
- type: "uint256",
1106
+ type: "uint128",
1107
+ internalType: "uint128",
1279
1108
  },
1280
1109
  {
1281
- internalType: "address",
1282
1110
  name: "onBehalf",
1283
1111
  type: "address",
1112
+ internalType: "address",
1284
1113
  },
1285
1114
  ],
1286
- name: "setConsumed",
1287
1115
  outputs: [],
1288
1116
  stateMutability: "nonpayable",
1289
- type: "function",
1290
1117
  },
1291
1118
  {
1119
+ type: "function",
1120
+ name: "setDefaultContinuousFee",
1292
1121
  inputs: [
1293
1122
  {
1294
- internalType: "address",
1295
1123
  name: "loanToken",
1296
1124
  type: "address",
1125
+ internalType: "address",
1297
1126
  },
1298
1127
  {
1299
- internalType: "uint256",
1300
1128
  name: "newContinuousFee",
1301
1129
  type: "uint256",
1130
+ internalType: "uint256",
1302
1131
  },
1303
1132
  ],
1304
- name: "setDefaultContinuousFee",
1305
1133
  outputs: [],
1306
1134
  stateMutability: "nonpayable",
1307
- type: "function",
1308
1135
  },
1309
1136
  {
1137
+ type: "function",
1138
+ name: "setDefaultSettlementFee",
1310
1139
  inputs: [
1311
1140
  {
1312
- internalType: "address",
1313
1141
  name: "loanToken",
1314
1142
  type: "address",
1143
+ internalType: "address",
1315
1144
  },
1316
1145
  {
1317
- internalType: "uint256",
1318
1146
  name: "index",
1319
1147
  type: "uint256",
1148
+ internalType: "uint256",
1320
1149
  },
1321
1150
  {
1322
- internalType: "uint256",
1323
1151
  name: "newSettlementFee",
1324
1152
  type: "uint256",
1153
+ internalType: "uint256",
1325
1154
  },
1326
1155
  ],
1327
- name: "setDefaultSettlementFee",
1328
1156
  outputs: [],
1329
1157
  stateMutability: "nonpayable",
1330
- type: "function",
1331
1158
  },
1332
1159
  {
1160
+ type: "function",
1161
+ name: "setFeeClaimer",
1333
1162
  inputs: [
1334
1163
  {
1335
- internalType: "address",
1336
1164
  name: "newFeeClaimer",
1337
1165
  type: "address",
1166
+ internalType: "address",
1338
1167
  },
1339
1168
  ],
1340
- name: "setFeeClaimer",
1341
1169
  outputs: [],
1342
1170
  stateMutability: "nonpayable",
1343
- type: "function",
1344
1171
  },
1345
1172
  {
1173
+ type: "function",
1174
+ name: "setFeeSetter",
1346
1175
  inputs: [
1347
1176
  {
1348
- internalType: "address",
1349
1177
  name: "newFeeSetter",
1350
1178
  type: "address",
1179
+ internalType: "address",
1351
1180
  },
1352
1181
  ],
1353
- name: "setFeeSetter",
1354
1182
  outputs: [],
1355
1183
  stateMutability: "nonpayable",
1356
- type: "function",
1357
1184
  },
1358
1185
  {
1186
+ type: "function",
1187
+ name: "setIsAuthorized",
1359
1188
  inputs: [
1360
1189
  {
1361
- internalType: "address",
1362
1190
  name: "authorized",
1363
1191
  type: "address",
1192
+ internalType: "address",
1364
1193
  },
1365
1194
  {
1366
- internalType: "bool",
1367
1195
  name: "newIsAuthorized",
1368
1196
  type: "bool",
1197
+ internalType: "bool",
1369
1198
  },
1370
1199
  {
1371
- internalType: "address",
1372
1200
  name: "onBehalf",
1373
1201
  type: "address",
1202
+ internalType: "address",
1374
1203
  },
1375
1204
  ],
1376
- name: "setIsAuthorized",
1377
1205
  outputs: [],
1378
1206
  stateMutability: "nonpayable",
1379
- type: "function",
1380
1207
  },
1381
1208
  {
1209
+ type: "function",
1210
+ name: "setMarketContinuousFee",
1382
1211
  inputs: [
1383
1212
  {
1384
- internalType: "bytes32",
1385
1213
  name: "id",
1386
1214
  type: "bytes32",
1215
+ internalType: "bytes32",
1387
1216
  },
1388
1217
  {
1389
- internalType: "uint256",
1390
1218
  name: "newContinuousFee",
1391
1219
  type: "uint256",
1220
+ internalType: "uint256",
1392
1221
  },
1393
1222
  ],
1394
- name: "setMarketContinuousFee",
1395
1223
  outputs: [],
1396
1224
  stateMutability: "nonpayable",
1397
- type: "function",
1398
1225
  },
1399
1226
  {
1227
+ type: "function",
1228
+ name: "setMarketSettlementFee",
1400
1229
  inputs: [
1401
1230
  {
1402
- internalType: "bytes32",
1403
1231
  name: "id",
1404
1232
  type: "bytes32",
1233
+ internalType: "bytes32",
1405
1234
  },
1406
1235
  {
1407
- internalType: "uint256",
1408
1236
  name: "index",
1409
1237
  type: "uint256",
1238
+ internalType: "uint256",
1410
1239
  },
1411
1240
  {
1412
- internalType: "uint256",
1413
1241
  name: "newSettlementFee",
1414
1242
  type: "uint256",
1243
+ internalType: "uint256",
1415
1244
  },
1416
1245
  ],
1417
- name: "setMarketSettlementFee",
1418
1246
  outputs: [],
1419
1247
  stateMutability: "nonpayable",
1420
- type: "function",
1421
1248
  },
1422
1249
  {
1250
+ type: "function",
1251
+ name: "setMarketTickSpacing",
1423
1252
  inputs: [
1424
1253
  {
1425
- internalType: "bytes32",
1426
1254
  name: "id",
1427
1255
  type: "bytes32",
1256
+ internalType: "bytes32",
1428
1257
  },
1429
1258
  {
1430
- internalType: "uint256",
1431
1259
  name: "newTickSpacing",
1432
1260
  type: "uint256",
1261
+ internalType: "uint256",
1433
1262
  },
1434
1263
  ],
1435
- name: "setMarketTickSpacing",
1436
1264
  outputs: [],
1437
1265
  stateMutability: "nonpayable",
1438
- type: "function",
1439
1266
  },
1440
1267
  {
1441
- inputs: [
1442
- {
1443
- internalType: "address",
1444
- name: "newRoleSetter",
1445
- type: "address",
1446
- },
1447
- ],
1448
- name: "setRoleSetter",
1449
- outputs: [],
1450
- stateMutability: "nonpayable",
1451
1268
  type: "function",
1452
- },
1453
- {
1269
+ name: "setTickSpacingSetter",
1454
1270
  inputs: [
1455
1271
  {
1456
- internalType: "address",
1457
1272
  name: "newTickSpacingSetter",
1458
1273
  type: "address",
1274
+ internalType: "address",
1459
1275
  },
1460
1276
  ],
1461
- name: "setTickSpacingSetter",
1462
1277
  outputs: [],
1463
1278
  stateMutability: "nonpayable",
1464
- type: "function",
1465
1279
  },
1466
1280
  {
1281
+ type: "function",
1282
+ name: "settlementFee",
1467
1283
  inputs: [
1468
1284
  {
1469
- internalType: "bytes32",
1470
1285
  name: "id",
1471
1286
  type: "bytes32",
1287
+ internalType: "bytes32",
1472
1288
  },
1473
1289
  {
1474
- internalType: "uint256",
1475
1290
  name: "timeToMaturity",
1476
1291
  type: "uint256",
1292
+ internalType: "uint256",
1477
1293
  },
1478
1294
  ],
1479
- name: "settlementFee",
1480
1295
  outputs: [
1481
1296
  {
1482
- internalType: "uint256",
1483
1297
  name: "",
1484
1298
  type: "uint256",
1299
+ internalType: "uint256",
1485
1300
  },
1486
1301
  ],
1487
1302
  stateMutability: "view",
1488
- type: "function",
1489
1303
  },
1490
1304
  {
1305
+ type: "function",
1306
+ name: "settlementFeeCbps",
1491
1307
  inputs: [
1492
1308
  {
1493
- internalType: "bytes32",
1494
1309
  name: "id",
1495
1310
  type: "bytes32",
1311
+ internalType: "bytes32",
1496
1312
  },
1497
1313
  ],
1498
- name: "settlementFeeCbps",
1499
1314
  outputs: [
1500
1315
  {
1501
- internalType: "uint16[7]",
1502
1316
  name: "",
1503
1317
  type: "uint16[7]",
1318
+ internalType: "uint16[7]",
1504
1319
  },
1505
1320
  ],
1506
1321
  stateMutability: "view",
1507
- type: "function",
1508
1322
  },
1509
1323
  {
1324
+ type: "function",
1325
+ name: "supplyCollateral",
1510
1326
  inputs: [
1511
1327
  {
1328
+ name: "market",
1329
+ type: "tuple",
1330
+ internalType: "struct Market",
1512
1331
  components: [
1513
1332
  {
1333
+ name: "chainId",
1334
+ type: "uint256",
1335
+ internalType: "uint256",
1336
+ },
1337
+ {
1338
+ name: "midnight",
1339
+ type: "address",
1514
1340
  internalType: "address",
1341
+ },
1342
+ {
1515
1343
  name: "loanToken",
1516
1344
  type: "address",
1345
+ internalType: "address",
1517
1346
  },
1518
1347
  {
1348
+ name: "collateralParams",
1349
+ type: "tuple[]",
1350
+ internalType: "struct CollateralParams[]",
1519
1351
  components: [
1520
1352
  {
1521
- internalType: "address",
1522
1353
  name: "token",
1523
1354
  type: "address",
1355
+ internalType: "address",
1524
1356
  },
1525
1357
  {
1526
- internalType: "uint256",
1527
1358
  name: "lltv",
1528
1359
  type: "uint256",
1360
+ internalType: "uint256",
1529
1361
  },
1530
1362
  {
1531
- internalType: "uint256",
1532
- name: "maxLif",
1363
+ name: "liquidationCursor",
1533
1364
  type: "uint256",
1365
+ internalType: "uint256",
1534
1366
  },
1535
1367
  {
1536
- internalType: "address",
1537
1368
  name: "oracle",
1538
1369
  type: "address",
1370
+ internalType: "address",
1539
1371
  },
1540
1372
  ],
1541
- internalType: "struct CollateralParams[]",
1542
- name: "collateralParams",
1543
- type: "tuple[]",
1544
1373
  },
1545
1374
  {
1546
- internalType: "uint256",
1547
1375
  name: "maturity",
1548
1376
  type: "uint256",
1377
+ internalType: "uint256",
1549
1378
  },
1550
1379
  {
1551
- internalType: "uint256",
1552
1380
  name: "rcfThreshold",
1553
1381
  type: "uint256",
1382
+ internalType: "uint256",
1554
1383
  },
1555
1384
  {
1556
- internalType: "address",
1557
1385
  name: "enterGate",
1558
1386
  type: "address",
1387
+ internalType: "address",
1559
1388
  },
1560
1389
  {
1561
- internalType: "address",
1562
1390
  name: "liquidatorGate",
1563
1391
  type: "address",
1392
+ internalType: "address",
1564
1393
  },
1565
1394
  ],
1566
- internalType: "struct Market",
1567
- name: "market",
1568
- type: "tuple",
1569
1395
  },
1570
1396
  {
1571
- internalType: "uint256",
1572
1397
  name: "collateralIndex",
1573
1398
  type: "uint256",
1399
+ internalType: "uint256",
1574
1400
  },
1575
1401
  {
1576
- internalType: "uint256",
1577
1402
  name: "assets",
1578
1403
  type: "uint256",
1404
+ internalType: "uint256",
1579
1405
  },
1580
1406
  {
1581
- internalType: "address",
1582
1407
  name: "onBehalf",
1583
1408
  type: "address",
1409
+ internalType: "address",
1584
1410
  },
1585
1411
  ],
1586
- name: "supplyCollateral",
1587
1412
  outputs: [],
1588
1413
  stateMutability: "nonpayable",
1589
- type: "function",
1590
1414
  },
1591
1415
  {
1416
+ type: "function",
1417
+ name: "take",
1592
1418
  inputs: [
1593
1419
  {
1420
+ name: "offer",
1421
+ type: "tuple",
1422
+ internalType: "struct Offer",
1594
1423
  components: [
1595
1424
  {
1425
+ name: "market",
1426
+ type: "tuple",
1427
+ internalType: "struct Market",
1596
1428
  components: [
1597
1429
  {
1430
+ name: "chainId",
1431
+ type: "uint256",
1432
+ internalType: "uint256",
1433
+ },
1434
+ {
1435
+ name: "midnight",
1436
+ type: "address",
1598
1437
  internalType: "address",
1438
+ },
1439
+ {
1599
1440
  name: "loanToken",
1600
1441
  type: "address",
1442
+ internalType: "address",
1601
1443
  },
1602
1444
  {
1445
+ name: "collateralParams",
1446
+ type: "tuple[]",
1447
+ internalType: "struct CollateralParams[]",
1603
1448
  components: [
1604
1449
  {
1605
- internalType: "address",
1606
1450
  name: "token",
1607
1451
  type: "address",
1452
+ internalType: "address",
1608
1453
  },
1609
1454
  {
1610
- internalType: "uint256",
1611
1455
  name: "lltv",
1612
1456
  type: "uint256",
1457
+ internalType: "uint256",
1613
1458
  },
1614
1459
  {
1615
- internalType: "uint256",
1616
- name: "maxLif",
1460
+ name: "liquidationCursor",
1617
1461
  type: "uint256",
1462
+ internalType: "uint256",
1618
1463
  },
1619
1464
  {
1620
- internalType: "address",
1621
1465
  name: "oracle",
1622
1466
  type: "address",
1467
+ internalType: "address",
1623
1468
  },
1624
1469
  ],
1625
- internalType: "struct CollateralParams[]",
1626
- name: "collateralParams",
1627
- type: "tuple[]",
1628
1470
  },
1629
1471
  {
1630
- internalType: "uint256",
1631
1472
  name: "maturity",
1632
1473
  type: "uint256",
1474
+ internalType: "uint256",
1633
1475
  },
1634
1476
  {
1635
- internalType: "uint256",
1636
1477
  name: "rcfThreshold",
1637
1478
  type: "uint256",
1479
+ internalType: "uint256",
1638
1480
  },
1639
1481
  {
1640
- internalType: "address",
1641
1482
  name: "enterGate",
1642
1483
  type: "address",
1484
+ internalType: "address",
1643
1485
  },
1644
1486
  {
1645
- internalType: "address",
1646
1487
  name: "liquidatorGate",
1647
1488
  type: "address",
1489
+ internalType: "address",
1648
1490
  },
1649
1491
  ],
1650
- internalType: "struct Market",
1651
- name: "market",
1652
- type: "tuple",
1653
1492
  },
1654
1493
  {
1655
- internalType: "bool",
1656
1494
  name: "buy",
1657
1495
  type: "bool",
1496
+ internalType: "bool",
1658
1497
  },
1659
1498
  {
1660
- internalType: "address",
1661
1499
  name: "maker",
1662
1500
  type: "address",
1501
+ internalType: "address",
1663
1502
  },
1664
1503
  {
1665
- internalType: "uint256",
1666
1504
  name: "start",
1667
1505
  type: "uint256",
1506
+ internalType: "uint256",
1668
1507
  },
1669
1508
  {
1670
- internalType: "uint256",
1671
1509
  name: "expiry",
1672
1510
  type: "uint256",
1511
+ internalType: "uint256",
1673
1512
  },
1674
1513
  {
1675
- internalType: "uint256",
1676
1514
  name: "tick",
1677
1515
  type: "uint256",
1516
+ internalType: "uint256",
1678
1517
  },
1679
1518
  {
1680
- internalType: "bytes32",
1681
1519
  name: "group",
1682
1520
  type: "bytes32",
1521
+ internalType: "bytes32",
1683
1522
  },
1684
1523
  {
1685
- internalType: "address",
1686
1524
  name: "callback",
1687
1525
  type: "address",
1526
+ internalType: "address",
1688
1527
  },
1689
1528
  {
1690
- internalType: "bytes",
1691
1529
  name: "callbackData",
1692
1530
  type: "bytes",
1531
+ internalType: "bytes",
1693
1532
  },
1694
1533
  {
1695
- internalType: "address",
1696
1534
  name: "receiverIfMakerIsSeller",
1697
1535
  type: "address",
1536
+ internalType: "address",
1698
1537
  },
1699
1538
  {
1700
- internalType: "address",
1701
1539
  name: "ratifier",
1702
1540
  type: "address",
1541
+ internalType: "address",
1703
1542
  },
1704
1543
  {
1705
- internalType: "bool",
1706
1544
  name: "reduceOnly",
1707
1545
  type: "bool",
1546
+ internalType: "bool",
1708
1547
  },
1709
1548
  {
1710
- internalType: "uint256",
1711
1549
  name: "maxUnits",
1712
- type: "uint256",
1550
+ type: "uint128",
1551
+ internalType: "uint128",
1713
1552
  },
1714
1553
  {
1715
- internalType: "uint256",
1716
1554
  name: "maxAssets",
1717
- type: "uint256",
1555
+ type: "uint128",
1556
+ internalType: "uint128",
1718
1557
  },
1719
1558
  {
1720
- internalType: "uint256",
1721
1559
  name: "continuousFeeCap",
1722
1560
  type: "uint256",
1561
+ internalType: "uint256",
1723
1562
  },
1724
1563
  ],
1725
- internalType: "struct Offer",
1726
- name: "offer",
1727
- type: "tuple",
1728
1564
  },
1729
1565
  {
1730
- internalType: "bytes",
1731
1566
  name: "ratifierData",
1732
1567
  type: "bytes",
1568
+ internalType: "bytes",
1733
1569
  },
1734
1570
  {
1735
- internalType: "uint256",
1736
1571
  name: "units",
1737
1572
  type: "uint256",
1573
+ internalType: "uint256",
1738
1574
  },
1739
1575
  {
1740
- internalType: "address",
1741
1576
  name: "taker",
1742
1577
  type: "address",
1578
+ internalType: "address",
1743
1579
  },
1744
1580
  {
1745
- internalType: "address",
1746
1581
  name: "receiverIfTakerIsSeller",
1747
1582
  type: "address",
1583
+ internalType: "address",
1748
1584
  },
1749
1585
  {
1750
- internalType: "address",
1751
1586
  name: "takerCallback",
1752
1587
  type: "address",
1588
+ internalType: "address",
1753
1589
  },
1754
1590
  {
1755
- internalType: "bytes",
1756
1591
  name: "takerCallbackData",
1757
1592
  type: "bytes",
1593
+ internalType: "bytes",
1758
1594
  },
1759
1595
  ],
1760
- name: "take",
1761
1596
  outputs: [
1762
1597
  {
1763
- internalType: "uint256",
1764
1598
  name: "buyerAssets",
1765
1599
  type: "uint256",
1600
+ internalType: "uint256",
1766
1601
  },
1767
1602
  {
1768
- internalType: "uint256",
1769
1603
  name: "sellerAssets",
1770
1604
  type: "uint256",
1605
+ internalType: "uint256",
1771
1606
  },
1772
1607
  ],
1773
1608
  stateMutability: "nonpayable",
1774
- type: "function",
1775
1609
  },
1776
1610
  {
1611
+ type: "function",
1612
+ name: "tickSpacing",
1777
1613
  inputs: [
1778
1614
  {
1779
- internalType: "bytes32",
1780
1615
  name: "id",
1781
1616
  type: "bytes32",
1617
+ internalType: "bytes32",
1782
1618
  },
1783
1619
  ],
1784
- name: "tickSpacing",
1785
1620
  outputs: [
1786
1621
  {
1787
- internalType: "uint8",
1788
1622
  name: "",
1789
1623
  type: "uint8",
1624
+ internalType: "uint8",
1790
1625
  },
1791
1626
  ],
1792
1627
  stateMutability: "view",
1793
- type: "function",
1794
1628
  },
1795
1629
  {
1796
- inputs: [],
1630
+ type: "function",
1797
1631
  name: "tickSpacingSetter",
1632
+ inputs: [],
1798
1633
  outputs: [
1799
1634
  {
1800
- internalType: "address",
1801
1635
  name: "",
1802
1636
  type: "address",
1637
+ internalType: "address",
1803
1638
  },
1804
1639
  ],
1805
1640
  stateMutability: "view",
1806
- type: "function",
1807
1641
  },
1808
1642
  {
1643
+ type: "function",
1644
+ name: "toMarket",
1809
1645
  inputs: [
1810
1646
  {
1647
+ name: "id",
1648
+ type: "bytes32",
1649
+ internalType: "bytes32",
1650
+ },
1651
+ ],
1652
+ outputs: [
1653
+ {
1654
+ name: "",
1655
+ type: "tuple",
1656
+ internalType: "struct Market",
1811
1657
  components: [
1812
1658
  {
1659
+ name: "chainId",
1660
+ type: "uint256",
1661
+ internalType: "uint256",
1662
+ },
1663
+ {
1664
+ name: "midnight",
1665
+ type: "address",
1813
1666
  internalType: "address",
1667
+ },
1668
+ {
1814
1669
  name: "loanToken",
1815
1670
  type: "address",
1671
+ internalType: "address",
1816
1672
  },
1817
1673
  {
1674
+ name: "collateralParams",
1675
+ type: "tuple[]",
1676
+ internalType: "struct CollateralParams[]",
1818
1677
  components: [
1819
1678
  {
1820
- internalType: "address",
1821
1679
  name: "token",
1822
1680
  type: "address",
1681
+ internalType: "address",
1823
1682
  },
1824
1683
  {
1825
- internalType: "uint256",
1826
1684
  name: "lltv",
1827
1685
  type: "uint256",
1686
+ internalType: "uint256",
1828
1687
  },
1829
1688
  {
1830
- internalType: "uint256",
1831
- name: "maxLif",
1689
+ name: "liquidationCursor",
1832
1690
  type: "uint256",
1691
+ internalType: "uint256",
1833
1692
  },
1834
1693
  {
1835
- internalType: "address",
1836
1694
  name: "oracle",
1837
1695
  type: "address",
1696
+ internalType: "address",
1838
1697
  },
1839
1698
  ],
1840
- internalType: "struct CollateralParams[]",
1699
+ },
1700
+ {
1701
+ name: "maturity",
1702
+ type: "uint256",
1703
+ internalType: "uint256",
1704
+ },
1705
+ {
1706
+ name: "rcfThreshold",
1707
+ type: "uint256",
1708
+ internalType: "uint256",
1709
+ },
1710
+ {
1711
+ name: "enterGate",
1712
+ type: "address",
1713
+ internalType: "address",
1714
+ },
1715
+ {
1716
+ name: "liquidatorGate",
1717
+ type: "address",
1718
+ internalType: "address",
1719
+ },
1720
+ ],
1721
+ },
1722
+ ],
1723
+ stateMutability: "view",
1724
+ },
1725
+ {
1726
+ type: "function",
1727
+ name: "totalUnits",
1728
+ inputs: [
1729
+ {
1730
+ name: "id",
1731
+ type: "bytes32",
1732
+ internalType: "bytes32",
1733
+ },
1734
+ ],
1735
+ outputs: [
1736
+ {
1737
+ name: "",
1738
+ type: "uint128",
1739
+ internalType: "uint128",
1740
+ },
1741
+ ],
1742
+ stateMutability: "view",
1743
+ },
1744
+ {
1745
+ type: "function",
1746
+ name: "touchMarket",
1747
+ inputs: [
1748
+ {
1749
+ name: "market",
1750
+ type: "tuple",
1751
+ internalType: "struct Market",
1752
+ components: [
1753
+ {
1754
+ name: "chainId",
1755
+ type: "uint256",
1756
+ internalType: "uint256",
1757
+ },
1758
+ {
1759
+ name: "midnight",
1760
+ type: "address",
1761
+ internalType: "address",
1762
+ },
1763
+ {
1764
+ name: "loanToken",
1765
+ type: "address",
1766
+ internalType: "address",
1767
+ },
1768
+ {
1841
1769
  name: "collateralParams",
1842
1770
  type: "tuple[]",
1771
+ internalType: "struct CollateralParams[]",
1772
+ components: [
1773
+ {
1774
+ name: "token",
1775
+ type: "address",
1776
+ internalType: "address",
1777
+ },
1778
+ {
1779
+ name: "lltv",
1780
+ type: "uint256",
1781
+ internalType: "uint256",
1782
+ },
1783
+ {
1784
+ name: "liquidationCursor",
1785
+ type: "uint256",
1786
+ internalType: "uint256",
1787
+ },
1788
+ {
1789
+ name: "oracle",
1790
+ type: "address",
1791
+ internalType: "address",
1792
+ },
1793
+ ],
1843
1794
  },
1844
1795
  {
1845
- internalType: "uint256",
1846
1796
  name: "maturity",
1847
1797
  type: "uint256",
1798
+ internalType: "uint256",
1848
1799
  },
1849
1800
  {
1850
- internalType: "uint256",
1851
1801
  name: "rcfThreshold",
1852
1802
  type: "uint256",
1803
+ internalType: "uint256",
1853
1804
  },
1854
1805
  {
1855
- internalType: "address",
1856
1806
  name: "enterGate",
1857
1807
  type: "address",
1808
+ internalType: "address",
1858
1809
  },
1859
1810
  {
1860
- internalType: "address",
1861
1811
  name: "liquidatorGate",
1862
1812
  type: "address",
1813
+ internalType: "address",
1863
1814
  },
1864
1815
  ],
1865
- internalType: "struct Market",
1866
- name: "market",
1867
- type: "tuple",
1868
1816
  },
1869
1817
  ],
1870
- name: "toId",
1871
1818
  outputs: [
1872
1819
  {
1873
- internalType: "bytes32",
1874
1820
  name: "",
1875
1821
  type: "bytes32",
1822
+ internalType: "bytes32",
1876
1823
  },
1877
1824
  ],
1878
- stateMutability: "view",
1879
- type: "function",
1825
+ stateMutability: "nonpayable",
1880
1826
  },
1881
1827
  {
1828
+ type: "function",
1829
+ name: "updatePosition",
1882
1830
  inputs: [
1883
1831
  {
1884
- internalType: "bytes32",
1885
- name: "id",
1886
- type: "bytes32",
1887
- },
1888
- ],
1889
- name: "toMarket",
1890
- outputs: [
1891
- {
1832
+ name: "market",
1833
+ type: "tuple",
1834
+ internalType: "struct Market",
1892
1835
  components: [
1893
1836
  {
1837
+ name: "chainId",
1838
+ type: "uint256",
1839
+ internalType: "uint256",
1840
+ },
1841
+ {
1842
+ name: "midnight",
1843
+ type: "address",
1894
1844
  internalType: "address",
1845
+ },
1846
+ {
1895
1847
  name: "loanToken",
1896
1848
  type: "address",
1849
+ internalType: "address",
1897
1850
  },
1898
1851
  {
1852
+ name: "collateralParams",
1853
+ type: "tuple[]",
1854
+ internalType: "struct CollateralParams[]",
1899
1855
  components: [
1900
1856
  {
1901
- internalType: "address",
1902
1857
  name: "token",
1903
1858
  type: "address",
1859
+ internalType: "address",
1904
1860
  },
1905
1861
  {
1906
- internalType: "uint256",
1907
1862
  name: "lltv",
1908
1863
  type: "uint256",
1864
+ internalType: "uint256",
1909
1865
  },
1910
1866
  {
1911
- internalType: "uint256",
1912
- name: "maxLif",
1867
+ name: "liquidationCursor",
1913
1868
  type: "uint256",
1869
+ internalType: "uint256",
1914
1870
  },
1915
1871
  {
1916
- internalType: "address",
1917
1872
  name: "oracle",
1918
1873
  type: "address",
1874
+ internalType: "address",
1919
1875
  },
1920
1876
  ],
1921
- internalType: "struct CollateralParams[]",
1922
- name: "collateralParams",
1923
- type: "tuple[]",
1924
1877
  },
1925
1878
  {
1926
- internalType: "uint256",
1927
1879
  name: "maturity",
1928
1880
  type: "uint256",
1881
+ internalType: "uint256",
1929
1882
  },
1930
1883
  {
1931
- internalType: "uint256",
1932
1884
  name: "rcfThreshold",
1933
1885
  type: "uint256",
1886
+ internalType: "uint256",
1934
1887
  },
1935
1888
  {
1936
- internalType: "address",
1937
1889
  name: "enterGate",
1938
1890
  type: "address",
1891
+ internalType: "address",
1939
1892
  },
1940
1893
  {
1941
- internalType: "address",
1942
1894
  name: "liquidatorGate",
1943
1895
  type: "address",
1896
+ internalType: "address",
1944
1897
  },
1945
1898
  ],
1946
- internalType: "struct Market",
1947
- name: "",
1948
- type: "tuple",
1949
1899
  },
1950
- ],
1951
- stateMutability: "view",
1952
- type: "function",
1953
- },
1954
- {
1955
- inputs: [
1956
1900
  {
1957
- internalType: "bytes32",
1958
- name: "id",
1959
- type: "bytes32",
1901
+ name: "user",
1902
+ type: "address",
1903
+ internalType: "address",
1960
1904
  },
1961
1905
  ],
1962
- name: "totalUnits",
1963
1906
  outputs: [
1964
1907
  {
1908
+ name: "newCredit",
1909
+ type: "uint128",
1965
1910
  internalType: "uint128",
1966
- name: "",
1911
+ },
1912
+ {
1913
+ name: "newPendingFee",
1967
1914
  type: "uint128",
1915
+ internalType: "uint128",
1916
+ },
1917
+ {
1918
+ name: "accruedFee",
1919
+ type: "uint128",
1920
+ internalType: "uint128",
1968
1921
  },
1969
1922
  ],
1970
- stateMutability: "view",
1971
- type: "function",
1923
+ stateMutability: "nonpayable",
1972
1924
  },
1973
1925
  {
1926
+ type: "function",
1927
+ name: "updatePositionView",
1974
1928
  inputs: [
1975
1929
  {
1930
+ name: "market",
1931
+ type: "tuple",
1932
+ internalType: "struct Market",
1976
1933
  components: [
1977
1934
  {
1935
+ name: "chainId",
1936
+ type: "uint256",
1937
+ internalType: "uint256",
1938
+ },
1939
+ {
1940
+ name: "midnight",
1941
+ type: "address",
1978
1942
  internalType: "address",
1943
+ },
1944
+ {
1979
1945
  name: "loanToken",
1980
1946
  type: "address",
1947
+ internalType: "address",
1981
1948
  },
1982
1949
  {
1950
+ name: "collateralParams",
1951
+ type: "tuple[]",
1952
+ internalType: "struct CollateralParams[]",
1983
1953
  components: [
1984
1954
  {
1985
- internalType: "address",
1986
1955
  name: "token",
1987
1956
  type: "address",
1957
+ internalType: "address",
1988
1958
  },
1989
1959
  {
1990
- internalType: "uint256",
1991
1960
  name: "lltv",
1992
1961
  type: "uint256",
1962
+ internalType: "uint256",
1993
1963
  },
1994
1964
  {
1995
- internalType: "uint256",
1996
- name: "maxLif",
1965
+ name: "liquidationCursor",
1997
1966
  type: "uint256",
1967
+ internalType: "uint256",
1998
1968
  },
1999
1969
  {
2000
- internalType: "address",
2001
1970
  name: "oracle",
2002
1971
  type: "address",
1972
+ internalType: "address",
2003
1973
  },
2004
1974
  ],
2005
- internalType: "struct CollateralParams[]",
2006
- name: "collateralParams",
2007
- type: "tuple[]",
2008
1975
  },
2009
1976
  {
2010
- internalType: "uint256",
2011
1977
  name: "maturity",
2012
1978
  type: "uint256",
1979
+ internalType: "uint256",
2013
1980
  },
2014
1981
  {
2015
- internalType: "uint256",
2016
1982
  name: "rcfThreshold",
2017
1983
  type: "uint256",
1984
+ internalType: "uint256",
2018
1985
  },
2019
1986
  {
2020
- internalType: "address",
2021
1987
  name: "enterGate",
2022
1988
  type: "address",
1989
+ internalType: "address",
2023
1990
  },
2024
1991
  {
2025
- internalType: "address",
2026
1992
  name: "liquidatorGate",
2027
1993
  type: "address",
1994
+ internalType: "address",
2028
1995
  },
2029
1996
  ],
2030
- internalType: "struct Market",
2031
- name: "market",
2032
- type: "tuple",
1997
+ },
1998
+ {
1999
+ name: "id",
2000
+ type: "bytes32",
2001
+ internalType: "bytes32",
2002
+ },
2003
+ {
2004
+ name: "user",
2005
+ type: "address",
2006
+ internalType: "address",
2033
2007
  },
2034
2008
  ],
2035
- name: "touchMarket",
2036
2009
  outputs: [
2037
2010
  {
2038
- internalType: "bytes32",
2039
- name: "",
2040
- type: "bytes32",
2011
+ name: "newCredit",
2012
+ type: "uint128",
2013
+ internalType: "uint128",
2014
+ },
2015
+ {
2016
+ name: "newPendingFee",
2017
+ type: "uint128",
2018
+ internalType: "uint128",
2019
+ },
2020
+ {
2021
+ name: "accruedFee",
2022
+ type: "uint128",
2023
+ internalType: "uint128",
2041
2024
  },
2042
2025
  ],
2043
- stateMutability: "nonpayable",
2044
- type: "function",
2026
+ stateMutability: "view",
2045
2027
  },
2046
2028
  {
2029
+ type: "function",
2030
+ name: "withdraw",
2047
2031
  inputs: [
2048
2032
  {
2033
+ name: "market",
2034
+ type: "tuple",
2035
+ internalType: "struct Market",
2049
2036
  components: [
2050
2037
  {
2038
+ name: "chainId",
2039
+ type: "uint256",
2040
+ internalType: "uint256",
2041
+ },
2042
+ {
2043
+ name: "midnight",
2044
+ type: "address",
2051
2045
  internalType: "address",
2046
+ },
2047
+ {
2052
2048
  name: "loanToken",
2053
2049
  type: "address",
2050
+ internalType: "address",
2054
2051
  },
2055
2052
  {
2053
+ name: "collateralParams",
2054
+ type: "tuple[]",
2055
+ internalType: "struct CollateralParams[]",
2056
2056
  components: [
2057
2057
  {
2058
- internalType: "address",
2059
2058
  name: "token",
2060
2059
  type: "address",
2060
+ internalType: "address",
2061
2061
  },
2062
2062
  {
2063
- internalType: "uint256",
2064
2063
  name: "lltv",
2065
2064
  type: "uint256",
2065
+ internalType: "uint256",
2066
2066
  },
2067
2067
  {
2068
- internalType: "uint256",
2069
- name: "maxLif",
2068
+ name: "liquidationCursor",
2070
2069
  type: "uint256",
2070
+ internalType: "uint256",
2071
2071
  },
2072
2072
  {
2073
- internalType: "address",
2074
2073
  name: "oracle",
2075
2074
  type: "address",
2075
+ internalType: "address",
2076
2076
  },
2077
2077
  ],
2078
- internalType: "struct CollateralParams[]",
2079
- name: "collateralParams",
2080
- type: "tuple[]",
2081
2078
  },
2082
2079
  {
2083
- internalType: "uint256",
2084
2080
  name: "maturity",
2085
2081
  type: "uint256",
2082
+ internalType: "uint256",
2086
2083
  },
2087
2084
  {
2088
- internalType: "uint256",
2089
2085
  name: "rcfThreshold",
2090
2086
  type: "uint256",
2087
+ internalType: "uint256",
2091
2088
  },
2092
2089
  {
2093
- internalType: "address",
2094
2090
  name: "enterGate",
2095
2091
  type: "address",
2092
+ internalType: "address",
2096
2093
  },
2097
2094
  {
2098
- internalType: "address",
2099
2095
  name: "liquidatorGate",
2100
2096
  type: "address",
2097
+ internalType: "address",
2101
2098
  },
2102
2099
  ],
2103
- internalType: "struct Market",
2104
- name: "market",
2105
- type: "tuple",
2106
- },
2107
- {
2108
- internalType: "address",
2109
- name: "user",
2110
- type: "address",
2111
2100
  },
2112
- ],
2113
- name: "updatePosition",
2114
- outputs: [
2115
2101
  {
2116
- internalType: "uint128",
2117
- name: "newCredit",
2118
- type: "uint128",
2102
+ name: "units",
2103
+ type: "uint256",
2104
+ internalType: "uint256",
2119
2105
  },
2120
2106
  {
2121
- internalType: "uint128",
2122
- name: "newPendingFee",
2123
- type: "uint128",
2107
+ name: "onBehalf",
2108
+ type: "address",
2109
+ internalType: "address",
2124
2110
  },
2125
2111
  {
2126
- internalType: "uint128",
2127
- name: "accruedFee",
2128
- type: "uint128",
2112
+ name: "receiver",
2113
+ type: "address",
2114
+ internalType: "address",
2129
2115
  },
2130
2116
  ],
2117
+ outputs: [],
2131
2118
  stateMutability: "nonpayable",
2132
- type: "function",
2133
2119
  },
2134
2120
  {
2121
+ type: "function",
2122
+ name: "withdrawCollateral",
2135
2123
  inputs: [
2136
2124
  {
2125
+ name: "market",
2126
+ type: "tuple",
2127
+ internalType: "struct Market",
2137
2128
  components: [
2138
2129
  {
2130
+ name: "chainId",
2131
+ type: "uint256",
2132
+ internalType: "uint256",
2133
+ },
2134
+ {
2135
+ name: "midnight",
2136
+ type: "address",
2139
2137
  internalType: "address",
2138
+ },
2139
+ {
2140
2140
  name: "loanToken",
2141
2141
  type: "address",
2142
+ internalType: "address",
2142
2143
  },
2143
2144
  {
2145
+ name: "collateralParams",
2146
+ type: "tuple[]",
2147
+ internalType: "struct CollateralParams[]",
2144
2148
  components: [
2145
2149
  {
2146
- internalType: "address",
2147
2150
  name: "token",
2148
2151
  type: "address",
2152
+ internalType: "address",
2149
2153
  },
2150
2154
  {
2151
- internalType: "uint256",
2152
2155
  name: "lltv",
2153
2156
  type: "uint256",
2157
+ internalType: "uint256",
2154
2158
  },
2155
2159
  {
2156
- internalType: "uint256",
2157
- name: "maxLif",
2160
+ name: "liquidationCursor",
2158
2161
  type: "uint256",
2162
+ internalType: "uint256",
2159
2163
  },
2160
2164
  {
2161
- internalType: "address",
2162
2165
  name: "oracle",
2163
2166
  type: "address",
2167
+ internalType: "address",
2164
2168
  },
2165
2169
  ],
2166
- internalType: "struct CollateralParams[]",
2167
- name: "collateralParams",
2168
- type: "tuple[]",
2169
2170
  },
2170
2171
  {
2171
- internalType: "uint256",
2172
2172
  name: "maturity",
2173
2173
  type: "uint256",
2174
+ internalType: "uint256",
2174
2175
  },
2175
2176
  {
2176
- internalType: "uint256",
2177
2177
  name: "rcfThreshold",
2178
2178
  type: "uint256",
2179
+ internalType: "uint256",
2179
2180
  },
2180
2181
  {
2181
- internalType: "address",
2182
2182
  name: "enterGate",
2183
2183
  type: "address",
2184
+ internalType: "address",
2184
2185
  },
2185
2186
  {
2186
- internalType: "address",
2187
2187
  name: "liquidatorGate",
2188
2188
  type: "address",
2189
+ internalType: "address",
2189
2190
  },
2190
2191
  ],
2191
- internalType: "struct Market",
2192
- name: "market",
2193
- type: "tuple",
2194
2192
  },
2195
2193
  {
2196
- internalType: "bytes32",
2197
- name: "id",
2198
- type: "bytes32",
2194
+ name: "collateralIndex",
2195
+ type: "uint256",
2196
+ internalType: "uint256",
2197
+ },
2198
+ {
2199
+ name: "assets",
2200
+ type: "uint256",
2201
+ internalType: "uint256",
2199
2202
  },
2200
2203
  {
2204
+ name: "onBehalf",
2205
+ type: "address",
2201
2206
  internalType: "address",
2202
- name: "user",
2207
+ },
2208
+ {
2209
+ name: "receiver",
2203
2210
  type: "address",
2211
+ internalType: "address",
2204
2212
  },
2205
2213
  ],
2206
- name: "updatePositionView",
2207
- outputs: [
2214
+ outputs: [],
2215
+ stateMutability: "nonpayable",
2216
+ },
2217
+ {
2218
+ type: "function",
2219
+ name: "withdrawable",
2220
+ inputs: [
2208
2221
  {
2209
- internalType: "uint128",
2210
- name: "newCredit",
2211
- type: "uint128",
2222
+ name: "id",
2223
+ type: "bytes32",
2224
+ internalType: "bytes32",
2212
2225
  },
2226
+ ],
2227
+ outputs: [
2213
2228
  {
2214
- internalType: "uint128",
2215
- name: "newPendingFee",
2229
+ name: "",
2216
2230
  type: "uint128",
2217
- },
2218
- {
2219
2231
  internalType: "uint128",
2220
- name: "accruedFee",
2221
- type: "uint128",
2222
2232
  },
2223
2233
  ],
2224
2234
  stateMutability: "view",
2225
- type: "function",
2226
2235
  },
2227
2236
  {
2228
- inputs: [
2229
- {
2230
- components: [
2231
- {
2232
- internalType: "address",
2233
- name: "loanToken",
2234
- type: "address",
2235
- },
2236
- {
2237
- components: [
2238
- {
2239
- internalType: "address",
2240
- name: "token",
2241
- type: "address",
2242
- },
2243
- {
2244
- internalType: "uint256",
2245
- name: "lltv",
2246
- type: "uint256",
2247
- },
2248
- {
2249
- internalType: "uint256",
2250
- name: "maxLif",
2251
- type: "uint256",
2252
- },
2253
- {
2254
- internalType: "address",
2255
- name: "oracle",
2256
- type: "address",
2257
- },
2258
- ],
2259
- internalType: "struct CollateralParams[]",
2260
- name: "collateralParams",
2261
- type: "tuple[]",
2262
- },
2263
- {
2264
- internalType: "uint256",
2265
- name: "maturity",
2266
- type: "uint256",
2267
- },
2268
- {
2269
- internalType: "uint256",
2270
- name: "rcfThreshold",
2271
- type: "uint256",
2272
- },
2273
- {
2274
- internalType: "address",
2275
- name: "enterGate",
2276
- type: "address",
2277
- },
2278
- {
2279
- internalType: "address",
2280
- name: "liquidatorGate",
2281
- type: "address",
2282
- },
2283
- ],
2284
- internalType: "struct Market",
2285
- name: "market",
2286
- type: "tuple",
2287
- },
2288
- {
2289
- internalType: "uint256",
2290
- name: "units",
2291
- type: "uint256",
2292
- },
2293
- {
2294
- internalType: "address",
2295
- name: "onBehalf",
2296
- type: "address",
2297
- },
2298
- {
2299
- internalType: "address",
2300
- name: "receiver",
2301
- type: "address",
2302
- },
2303
- ],
2304
- name: "withdraw",
2305
- outputs: [],
2306
- stateMutability: "nonpayable",
2307
- type: "function",
2237
+ type: "error",
2238
+ name: "AlreadyConsumed",
2239
+ inputs: [],
2240
+ },
2241
+ {
2242
+ type: "error",
2243
+ name: "BuyerGatedFromIncreasingCredit",
2244
+ inputs: [],
2245
+ },
2246
+ {
2247
+ type: "error",
2248
+ name: "CannotIncreaseDebtPostMaturity",
2249
+ inputs: [],
2250
+ },
2251
+ {
2252
+ type: "error",
2253
+ name: "CollateralParamsNotSorted",
2254
+ inputs: [],
2255
+ },
2256
+ {
2257
+ type: "error",
2258
+ name: "ConsumedAssets",
2259
+ inputs: [],
2260
+ },
2261
+ {
2262
+ type: "error",
2263
+ name: "ConsumedUnits",
2264
+ inputs: [],
2265
+ },
2266
+ {
2267
+ type: "error",
2268
+ name: "ContinuousFeeAboveMax",
2269
+ inputs: [],
2270
+ },
2271
+ {
2272
+ type: "error",
2273
+ name: "ContinuousFeeAboveOfferCap",
2274
+ inputs: [],
2275
+ },
2276
+ {
2277
+ type: "error",
2278
+ name: "FeeNotMultipleOfFeeCbp",
2279
+ inputs: [],
2280
+ },
2281
+ {
2282
+ type: "error",
2283
+ name: "InconsistentInput",
2284
+ inputs: [],
2285
+ },
2286
+ {
2287
+ type: "error",
2288
+ name: "InvalidChainId",
2289
+ inputs: [],
2290
+ },
2291
+ {
2292
+ type: "error",
2293
+ name: "InvalidFeeIndex",
2294
+ inputs: [],
2295
+ },
2296
+ {
2297
+ type: "error",
2298
+ name: "InvalidLiquidationCursor",
2299
+ inputs: [],
2300
+ },
2301
+ {
2302
+ type: "error",
2303
+ name: "InvalidLltv",
2304
+ inputs: [],
2305
+ },
2306
+ {
2307
+ type: "error",
2308
+ name: "InvalidMaxLif",
2309
+ inputs: [],
2310
+ },
2311
+ {
2312
+ type: "error",
2313
+ name: "InvalidMidnight",
2314
+ inputs: [],
2315
+ },
2316
+ {
2317
+ type: "error",
2318
+ name: "InvalidOfferCaps",
2319
+ inputs: [],
2320
+ },
2321
+ {
2322
+ type: "error",
2323
+ name: "InvalidTickSpacing",
2324
+ inputs: [],
2325
+ },
2326
+ {
2327
+ type: "error",
2328
+ name: "LiquidationCursorNotEnabled",
2329
+ inputs: [],
2330
+ },
2331
+ {
2332
+ type: "error",
2333
+ name: "LiquidatorGatedFromLiquidating",
2334
+ inputs: [],
2335
+ },
2336
+ {
2337
+ type: "error",
2338
+ name: "LltvNotEnabled",
2339
+ inputs: [],
2340
+ },
2341
+ {
2342
+ type: "error",
2343
+ name: "MakerCreditOrDebtIncreased",
2344
+ inputs: [],
2345
+ },
2346
+ {
2347
+ type: "error",
2348
+ name: "MarketLossFactorMaxedOut",
2349
+ inputs: [],
2350
+ },
2351
+ {
2352
+ type: "error",
2353
+ name: "MarketNotCreated",
2354
+ inputs: [],
2355
+ },
2356
+ {
2357
+ type: "error",
2358
+ name: "MaturityTooFar",
2359
+ inputs: [],
2360
+ },
2361
+ {
2362
+ type: "error",
2363
+ name: "MaxLifTooHigh",
2364
+ inputs: [],
2365
+ },
2366
+ {
2367
+ type: "error",
2368
+ name: "NoCollateralParams",
2369
+ inputs: [],
2370
+ },
2371
+ {
2372
+ type: "error",
2373
+ name: "NotBorrower",
2374
+ inputs: [],
2375
+ },
2376
+ {
2377
+ type: "error",
2378
+ name: "NotLiquidatable",
2379
+ inputs: [],
2380
+ },
2381
+ {
2382
+ type: "error",
2383
+ name: "OfferExpired",
2384
+ inputs: [],
2385
+ },
2386
+ {
2387
+ type: "error",
2388
+ name: "OfferNotStarted",
2389
+ inputs: [],
2390
+ },
2391
+ {
2392
+ type: "error",
2393
+ name: "OnlyConfigurator",
2394
+ inputs: [],
2395
+ },
2396
+ {
2397
+ type: "error",
2398
+ name: "OnlyFeeClaimer",
2399
+ inputs: [],
2400
+ },
2401
+ {
2402
+ type: "error",
2403
+ name: "OnlyFeeSetter",
2404
+ inputs: [],
2405
+ },
2406
+ {
2407
+ type: "error",
2408
+ name: "OnlyTickSpacingSetter",
2409
+ inputs: [],
2410
+ },
2411
+ {
2412
+ type: "error",
2413
+ name: "RatifierFailed",
2414
+ inputs: [],
2415
+ },
2416
+ {
2417
+ type: "error",
2418
+ name: "RatifierUnauthorized",
2419
+ inputs: [],
2420
+ },
2421
+ {
2422
+ type: "error",
2423
+ name: "RecoveryCloseFactorConditionsViolated",
2424
+ inputs: [],
2425
+ },
2426
+ {
2427
+ type: "error",
2428
+ name: "SelfTake",
2429
+ inputs: [],
2430
+ },
2431
+ {
2432
+ type: "error",
2433
+ name: "SellerGatedFromIncreasingDebt",
2434
+ inputs: [],
2435
+ },
2436
+ {
2437
+ type: "error",
2438
+ name: "SellerIsLiquidatable",
2439
+ inputs: [],
2440
+ },
2441
+ {
2442
+ type: "error",
2443
+ name: "SettlementFeeAboveMax",
2444
+ inputs: [],
2445
+ },
2446
+ {
2447
+ type: "error",
2448
+ name: "TakerUnauthorized",
2449
+ inputs: [],
2450
+ },
2451
+ {
2452
+ type: "error",
2453
+ name: "TickNotAccessible",
2454
+ inputs: [],
2308
2455
  },
2309
2456
  {
2310
- inputs: [
2311
- {
2312
- components: [
2313
- {
2314
- internalType: "address",
2315
- name: "loanToken",
2316
- type: "address",
2317
- },
2318
- {
2319
- components: [
2320
- {
2321
- internalType: "address",
2322
- name: "token",
2323
- type: "address",
2324
- },
2325
- {
2326
- internalType: "uint256",
2327
- name: "lltv",
2328
- type: "uint256",
2329
- },
2330
- {
2331
- internalType: "uint256",
2332
- name: "maxLif",
2333
- type: "uint256",
2334
- },
2335
- {
2336
- internalType: "address",
2337
- name: "oracle",
2338
- type: "address",
2339
- },
2340
- ],
2341
- internalType: "struct CollateralParams[]",
2342
- name: "collateralParams",
2343
- type: "tuple[]",
2344
- },
2345
- {
2346
- internalType: "uint256",
2347
- name: "maturity",
2348
- type: "uint256",
2349
- },
2350
- {
2351
- internalType: "uint256",
2352
- name: "rcfThreshold",
2353
- type: "uint256",
2354
- },
2355
- {
2356
- internalType: "address",
2357
- name: "enterGate",
2358
- type: "address",
2359
- },
2360
- {
2361
- internalType: "address",
2362
- name: "liquidatorGate",
2363
- type: "address",
2364
- },
2365
- ],
2366
- internalType: "struct Market",
2367
- name: "market",
2368
- type: "tuple",
2369
- },
2370
- {
2371
- internalType: "uint256",
2372
- name: "collateralIndex",
2373
- type: "uint256",
2374
- },
2375
- {
2376
- internalType: "uint256",
2377
- name: "assets",
2378
- type: "uint256",
2379
- },
2380
- {
2381
- internalType: "address",
2382
- name: "onBehalf",
2383
- type: "address",
2384
- },
2385
- {
2386
- internalType: "address",
2387
- name: "receiver",
2388
- type: "address",
2389
- },
2390
- ],
2391
- name: "withdrawCollateral",
2392
- outputs: [],
2393
- stateMutability: "nonpayable",
2394
- type: "function",
2457
+ type: "error",
2458
+ name: "TooManyActivatedCollaterals",
2459
+ inputs: [],
2395
2460
  },
2396
2461
  {
2397
- inputs: [
2398
- {
2399
- internalType: "bytes32",
2400
- name: "id",
2401
- type: "bytes32",
2402
- },
2403
- ],
2404
- name: "withdrawable",
2405
- outputs: [
2406
- {
2407
- internalType: "uint128",
2408
- name: "",
2409
- type: "uint128",
2410
- },
2411
- ],
2412
- stateMutability: "view",
2413
- type: "function",
2462
+ type: "error",
2463
+ name: "TooManyCollateralParams",
2464
+ inputs: [],
2465
+ },
2466
+ {
2467
+ type: "error",
2468
+ name: "Unauthorized",
2469
+ inputs: [],
2470
+ },
2471
+ {
2472
+ type: "error",
2473
+ name: "UnhealthyBorrower",
2474
+ inputs: [],
2475
+ },
2476
+ {
2477
+ type: "error",
2478
+ name: "UnusedReceiverMustBeZero",
2479
+ inputs: [],
2480
+ },
2481
+ {
2482
+ type: "error",
2483
+ name: "WrongBuyCallbackReturnValue",
2484
+ inputs: [],
2485
+ },
2486
+ {
2487
+ type: "error",
2488
+ name: "WrongFlashLoanCallbackReturnValue",
2489
+ inputs: [],
2490
+ },
2491
+ {
2492
+ type: "error",
2493
+ name: "WrongLiquidateCallbackReturnValue",
2494
+ inputs: [],
2495
+ },
2496
+ {
2497
+ type: "error",
2498
+ name: "WrongRepayCallbackReturnValue",
2499
+ inputs: [],
2500
+ },
2501
+ {
2502
+ type: "error",
2503
+ name: "WrongSellCallbackReturnValue",
2504
+ inputs: [],
2414
2505
  },
2415
2506
  ];
2416
2507
  /**
2417
- * Pinned ABI JSON for the MidnightBundles.
2508
+ * ABI JSON for the Midnight Bundles periphery used by app-compatible taker and repay flows.
2418
2509
  *
2419
- * Source: `morpho-org/midnight` commit `615fcfa12f725df3a16d65b2c2209272eff5bc10`,
2420
- * `src/periphery/interfaces/IMidnightBundles.sol`, Forge artifact `out/src/periphery/interfaces/IMidnightBundles.sol/IMidnightBundles.json`.
2510
+ * Source: `morpho-org/bundles` commit `34a12c68c2e638ae872f525a8226dbc92ccd1a30`,
2511
+ * `src/midnight/interfaces/IMidnightBundlesV1.sol`, adapted to the current
2512
+ * `morpho-org/midnight` `Market` and `Offer` struct fields exported by this package.
2421
2513
  *
2422
2514
  * @example
2423
2515
  * ```ts
@@ -2429,65 +2521,62 @@ exports.midnightAbi = [
2429
2521
  exports.midnightBundlesAbi = [
2430
2522
  {
2431
2523
  inputs: [],
2432
- name: "ApproveReturnedFalse",
2524
+ name: "ContinuousFeeAboveMax",
2433
2525
  type: "error",
2434
2526
  },
2435
2527
  {
2436
2528
  inputs: [],
2437
- name: "InconsistentMarket",
2529
+ name: "DeadlinePassed",
2438
2530
  type: "error",
2439
2531
  },
2440
2532
  {
2441
2533
  inputs: [],
2442
- name: "InconsistentSide",
2534
+ name: "InconsistentMarket",
2443
2535
  type: "error",
2444
2536
  },
2445
2537
  {
2446
2538
  inputs: [],
2447
- name: "OutOfOffers",
2539
+ name: "InconsistentSide",
2448
2540
  type: "error",
2449
2541
  },
2450
2542
  {
2451
2543
  inputs: [],
2452
- name: "PctExceeded",
2544
+ name: "NotReduceOnly",
2453
2545
  type: "error",
2454
2546
  },
2455
2547
  {
2456
2548
  inputs: [],
2457
- name: "SellerAssetsTooLow",
2549
+ name: "OutOfOffers",
2458
2550
  type: "error",
2459
2551
  },
2460
2552
  {
2461
2553
  inputs: [],
2462
- name: "Unauthorized",
2554
+ name: "PctExceeded",
2463
2555
  type: "error",
2464
2556
  },
2465
2557
  {
2466
2558
  inputs: [],
2467
- name: "UnitsTooHigh",
2559
+ name: "SellerAssetsTooLow",
2468
2560
  type: "error",
2469
2561
  },
2470
2562
  {
2471
2563
  inputs: [],
2472
- name: "UnitsTooLow",
2564
+ name: "Unauthorized",
2473
2565
  type: "error",
2474
2566
  },
2475
- {
2476
- inputs: [],
2477
- name: "MIDNIGHT",
2478
- outputs: [
2479
- {
2480
- internalType: "address",
2481
- name: "",
2482
- type: "address",
2483
- },
2484
- ],
2485
- stateMutability: "view",
2486
- type: "function",
2567
+ {
2568
+ inputs: [],
2569
+ name: "UnitsTooHigh",
2570
+ type: "error",
2571
+ },
2572
+ {
2573
+ inputs: [],
2574
+ name: "UnitsTooLow",
2575
+ type: "error",
2487
2576
  },
2488
2577
  {
2489
2578
  inputs: [],
2490
- name: "PERMIT2",
2579
+ name: "MIDNIGHT",
2491
2580
  outputs: [
2492
2581
  {
2493
2582
  internalType: "address",
@@ -2515,6 +2604,11 @@ exports.midnightBundlesAbi = [
2515
2604
  name: "taker",
2516
2605
  type: "address",
2517
2606
  },
2607
+ {
2608
+ internalType: "bool",
2609
+ name: "reduceOnly",
2610
+ type: "bool",
2611
+ },
2518
2612
  {
2519
2613
  components: [
2520
2614
  {
@@ -2538,6 +2632,16 @@ exports.midnightBundlesAbi = [
2538
2632
  components: [
2539
2633
  {
2540
2634
  components: [
2635
+ {
2636
+ internalType: "uint256",
2637
+ name: "chainId",
2638
+ type: "uint256",
2639
+ },
2640
+ {
2641
+ internalType: "address",
2642
+ name: "midnight",
2643
+ type: "address",
2644
+ },
2541
2645
  {
2542
2646
  internalType: "address",
2543
2647
  name: "loanToken",
@@ -2557,7 +2661,7 @@ exports.midnightBundlesAbi = [
2557
2661
  },
2558
2662
  {
2559
2663
  internalType: "uint256",
2560
- name: "maxLif",
2664
+ name: "liquidationCursor",
2561
2665
  type: "uint256",
2562
2666
  },
2563
2667
  {
@@ -2651,14 +2755,14 @@ exports.midnightBundlesAbi = [
2651
2755
  type: "bool",
2652
2756
  },
2653
2757
  {
2654
- internalType: "uint256",
2758
+ internalType: "uint128",
2655
2759
  name: "maxUnits",
2656
- type: "uint256",
2760
+ type: "uint128",
2657
2761
  },
2658
2762
  {
2659
- internalType: "uint256",
2763
+ internalType: "uint128",
2660
2764
  name: "maxAssets",
2661
- type: "uint256",
2765
+ type: "uint128",
2662
2766
  },
2663
2767
  {
2664
2768
  internalType: "uint256",
@@ -2681,8 +2785,8 @@ exports.midnightBundlesAbi = [
2681
2785
  type: "uint256",
2682
2786
  },
2683
2787
  ],
2684
- internalType: "struct Take[]",
2685
- name: "takes",
2788
+ internalType: "struct OfferFill[]",
2789
+ name: "offerFills",
2686
2790
  type: "tuple[]",
2687
2791
  },
2688
2792
  {
@@ -2717,8 +2821,18 @@ exports.midnightBundlesAbi = [
2717
2821
  name: "referralFeeRecipient",
2718
2822
  type: "address",
2719
2823
  },
2824
+ {
2825
+ internalType: "uint256",
2826
+ name: "maxContinuousFee",
2827
+ type: "uint256",
2828
+ },
2829
+ {
2830
+ internalType: "uint256",
2831
+ name: "deadline",
2832
+ type: "uint256",
2833
+ },
2720
2834
  ],
2721
- name: "buyWithAssetsTargetAndWithdrawCollateral",
2835
+ name: "midnightBundlesV1BuyWithAssetsTargetAndWithdrawCollateral",
2722
2836
  outputs: [],
2723
2837
  stateMutability: "nonpayable",
2724
2838
  type: "function",
@@ -2740,6 +2854,11 @@ exports.midnightBundlesAbi = [
2740
2854
  name: "taker",
2741
2855
  type: "address",
2742
2856
  },
2857
+ {
2858
+ internalType: "bool",
2859
+ name: "reduceOnly",
2860
+ type: "bool",
2861
+ },
2743
2862
  {
2744
2863
  components: [
2745
2864
  {
@@ -2763,6 +2882,16 @@ exports.midnightBundlesAbi = [
2763
2882
  components: [
2764
2883
  {
2765
2884
  components: [
2885
+ {
2886
+ internalType: "uint256",
2887
+ name: "chainId",
2888
+ type: "uint256",
2889
+ },
2890
+ {
2891
+ internalType: "address",
2892
+ name: "midnight",
2893
+ type: "address",
2894
+ },
2766
2895
  {
2767
2896
  internalType: "address",
2768
2897
  name: "loanToken",
@@ -2782,7 +2911,7 @@ exports.midnightBundlesAbi = [
2782
2911
  },
2783
2912
  {
2784
2913
  internalType: "uint256",
2785
- name: "maxLif",
2914
+ name: "liquidationCursor",
2786
2915
  type: "uint256",
2787
2916
  },
2788
2917
  {
@@ -2876,14 +3005,14 @@ exports.midnightBundlesAbi = [
2876
3005
  type: "bool",
2877
3006
  },
2878
3007
  {
2879
- internalType: "uint256",
3008
+ internalType: "uint128",
2880
3009
  name: "maxUnits",
2881
- type: "uint256",
3010
+ type: "uint128",
2882
3011
  },
2883
3012
  {
2884
- internalType: "uint256",
3013
+ internalType: "uint128",
2885
3014
  name: "maxAssets",
2886
- type: "uint256",
3015
+ type: "uint128",
2887
3016
  },
2888
3017
  {
2889
3018
  internalType: "uint256",
@@ -2906,8 +3035,8 @@ exports.midnightBundlesAbi = [
2906
3035
  type: "uint256",
2907
3036
  },
2908
3037
  ],
2909
- internalType: "struct Take[]",
2910
- name: "takes",
3038
+ internalType: "struct OfferFill[]",
3039
+ name: "offerFills",
2911
3040
  type: "tuple[]",
2912
3041
  },
2913
3042
  {
@@ -2942,8 +3071,18 @@ exports.midnightBundlesAbi = [
2942
3071
  name: "referralFeeRecipient",
2943
3072
  type: "address",
2944
3073
  },
3074
+ {
3075
+ internalType: "uint256",
3076
+ name: "maxContinuousFee",
3077
+ type: "uint256",
3078
+ },
3079
+ {
3080
+ internalType: "uint256",
3081
+ name: "deadline",
3082
+ type: "uint256",
3083
+ },
2945
3084
  ],
2946
- name: "buyWithUnitsTargetAndWithdrawCollateral",
3085
+ name: "midnightBundlesV1BuyWithUnitsTargetAndWithdrawCollateral",
2947
3086
  outputs: [],
2948
3087
  stateMutability: "nonpayable",
2949
3088
  type: "function",
@@ -2952,6 +3091,16 @@ exports.midnightBundlesAbi = [
2952
3091
  inputs: [
2953
3092
  {
2954
3093
  components: [
3094
+ {
3095
+ internalType: "uint256",
3096
+ name: "chainId",
3097
+ type: "uint256",
3098
+ },
3099
+ {
3100
+ internalType: "address",
3101
+ name: "midnight",
3102
+ type: "address",
3103
+ },
2955
3104
  {
2956
3105
  internalType: "address",
2957
3106
  name: "loanToken",
@@ -2971,7 +3120,7 @@ exports.midnightBundlesAbi = [
2971
3120
  },
2972
3121
  {
2973
3122
  internalType: "uint256",
2974
- name: "maxLif",
3123
+ name: "liquidationCursor",
2975
3124
  type: "uint256",
2976
3125
  },
2977
3126
  {
@@ -3068,8 +3217,13 @@ exports.midnightBundlesAbi = [
3068
3217
  name: "referralFeeRecipient",
3069
3218
  type: "address",
3070
3219
  },
3220
+ {
3221
+ internalType: "uint256",
3222
+ name: "deadline",
3223
+ type: "uint256",
3224
+ },
3071
3225
  ],
3072
- name: "repayAndWithdrawCollateral",
3226
+ name: "midnightBundlesV1RepayAndWithdrawCollateral",
3073
3227
  outputs: [],
3074
3228
  stateMutability: "nonpayable",
3075
3229
  type: "function",
@@ -3091,9 +3245,14 @@ exports.midnightBundlesAbi = [
3091
3245
  name: "taker",
3092
3246
  type: "address",
3093
3247
  },
3248
+ {
3249
+ internalType: "bool",
3250
+ name: "reduceOnly",
3251
+ type: "bool",
3252
+ },
3094
3253
  {
3095
3254
  internalType: "address",
3096
- name: "receiverIfTakerIsSeller",
3255
+ name: "receiver",
3097
3256
  type: "address",
3098
3257
  },
3099
3258
  {
@@ -3136,6 +3295,16 @@ exports.midnightBundlesAbi = [
3136
3295
  components: [
3137
3296
  {
3138
3297
  components: [
3298
+ {
3299
+ internalType: "uint256",
3300
+ name: "chainId",
3301
+ type: "uint256",
3302
+ },
3303
+ {
3304
+ internalType: "address",
3305
+ name: "midnight",
3306
+ type: "address",
3307
+ },
3139
3308
  {
3140
3309
  internalType: "address",
3141
3310
  name: "loanToken",
@@ -3155,7 +3324,7 @@ exports.midnightBundlesAbi = [
3155
3324
  },
3156
3325
  {
3157
3326
  internalType: "uint256",
3158
- name: "maxLif",
3327
+ name: "liquidationCursor",
3159
3328
  type: "uint256",
3160
3329
  },
3161
3330
  {
@@ -3249,14 +3418,14 @@ exports.midnightBundlesAbi = [
3249
3418
  type: "bool",
3250
3419
  },
3251
3420
  {
3252
- internalType: "uint256",
3421
+ internalType: "uint128",
3253
3422
  name: "maxUnits",
3254
- type: "uint256",
3423
+ type: "uint128",
3255
3424
  },
3256
3425
  {
3257
- internalType: "uint256",
3426
+ internalType: "uint128",
3258
3427
  name: "maxAssets",
3259
- type: "uint256",
3428
+ type: "uint128",
3260
3429
  },
3261
3430
  {
3262
3431
  internalType: "uint256",
@@ -3279,8 +3448,8 @@ exports.midnightBundlesAbi = [
3279
3448
  type: "uint256",
3280
3449
  },
3281
3450
  ],
3282
- internalType: "struct Take[]",
3283
- name: "takes",
3451
+ internalType: "struct OfferFill[]",
3452
+ name: "offerFills",
3284
3453
  type: "tuple[]",
3285
3454
  },
3286
3455
  {
@@ -3293,8 +3462,18 @@ exports.midnightBundlesAbi = [
3293
3462
  name: "referralFeeRecipient",
3294
3463
  type: "address",
3295
3464
  },
3465
+ {
3466
+ internalType: "uint256",
3467
+ name: "maxContinuousFee",
3468
+ type: "uint256",
3469
+ },
3470
+ {
3471
+ internalType: "uint256",
3472
+ name: "deadline",
3473
+ type: "uint256",
3474
+ },
3296
3475
  ],
3297
- name: "supplyCollateralAndSellWithAssetsTarget",
3476
+ name: "midnightBundlesV1SupplyCollateralAndSellWithAssetsTarget",
3298
3477
  outputs: [],
3299
3478
  stateMutability: "nonpayable",
3300
3479
  type: "function",
@@ -3316,9 +3495,14 @@ exports.midnightBundlesAbi = [
3316
3495
  name: "taker",
3317
3496
  type: "address",
3318
3497
  },
3498
+ {
3499
+ internalType: "bool",
3500
+ name: "reduceOnly",
3501
+ type: "bool",
3502
+ },
3319
3503
  {
3320
3504
  internalType: "address",
3321
- name: "receiverIfTakerIsSeller",
3505
+ name: "receiver",
3322
3506
  type: "address",
3323
3507
  },
3324
3508
  {
@@ -3361,6 +3545,16 @@ exports.midnightBundlesAbi = [
3361
3545
  components: [
3362
3546
  {
3363
3547
  components: [
3548
+ {
3549
+ internalType: "uint256",
3550
+ name: "chainId",
3551
+ type: "uint256",
3552
+ },
3553
+ {
3554
+ internalType: "address",
3555
+ name: "midnight",
3556
+ type: "address",
3557
+ },
3364
3558
  {
3365
3559
  internalType: "address",
3366
3560
  name: "loanToken",
@@ -3380,7 +3574,7 @@ exports.midnightBundlesAbi = [
3380
3574
  },
3381
3575
  {
3382
3576
  internalType: "uint256",
3383
- name: "maxLif",
3577
+ name: "liquidationCursor",
3384
3578
  type: "uint256",
3385
3579
  },
3386
3580
  {
@@ -3474,14 +3668,14 @@ exports.midnightBundlesAbi = [
3474
3668
  type: "bool",
3475
3669
  },
3476
3670
  {
3477
- internalType: "uint256",
3671
+ internalType: "uint128",
3478
3672
  name: "maxUnits",
3479
- type: "uint256",
3673
+ type: "uint128",
3480
3674
  },
3481
3675
  {
3482
- internalType: "uint256",
3676
+ internalType: "uint128",
3483
3677
  name: "maxAssets",
3484
- type: "uint256",
3678
+ type: "uint128",
3485
3679
  },
3486
3680
  {
3487
3681
  internalType: "uint256",
@@ -3504,8 +3698,8 @@ exports.midnightBundlesAbi = [
3504
3698
  type: "uint256",
3505
3699
  },
3506
3700
  ],
3507
- internalType: "struct Take[]",
3508
- name: "takes",
3701
+ internalType: "struct OfferFill[]",
3702
+ name: "offerFills",
3509
3703
  type: "tuple[]",
3510
3704
  },
3511
3705
  {
@@ -3518,8 +3712,18 @@ exports.midnightBundlesAbi = [
3518
3712
  name: "referralFeeRecipient",
3519
3713
  type: "address",
3520
3714
  },
3715
+ {
3716
+ internalType: "uint256",
3717
+ name: "maxContinuousFee",
3718
+ type: "uint256",
3719
+ },
3720
+ {
3721
+ internalType: "uint256",
3722
+ name: "deadline",
3723
+ type: "uint256",
3724
+ },
3521
3725
  ],
3522
- name: "supplyCollateralAndSellWithUnitsTarget",
3726
+ name: "midnightBundlesV1SupplyCollateralAndSellWithUnitsTarget",
3523
3727
  outputs: [],
3524
3728
  stateMutability: "nonpayable",
3525
3729
  type: "function",
@@ -3528,8 +3732,8 @@ exports.midnightBundlesAbi = [
3528
3732
  /**
3529
3733
  * Pinned ABI JSON for the EcrecoverRatifier.
3530
3734
  *
3531
- * Source: `morpho-org/midnight` commit `615fcfa12f725df3a16d65b2c2209272eff5bc10`,
3532
- * `src/ratifiers/interfaces/IEcrecoverRatifier.sol`, Forge artifact `out/src/ratifiers/interfaces/IEcrecoverRatifier.sol/IEcrecoverRatifier.json`.
3735
+ * Source: `morpho-org/midnight` commit `336b924a2bb378d810ef6d35b6dd3486759af8bd`,
3736
+ * `src/ratifiers/interfaces/IEcrecoverRatifier.sol`, Forge artifact `out/IEcrecoverRatifier.sol/IEcrecoverRatifier.json`.
3533
3737
  *
3534
3738
  * @example
3535
3739
  * ```ts
@@ -3540,534 +3744,564 @@ exports.midnightBundlesAbi = [
3540
3744
  */
3541
3745
  exports.ecrecoverRatifierAbi = [
3542
3746
  {
3543
- inputs: [],
3544
- name: "InvalidProof",
3545
- type: "error",
3546
- },
3547
- {
3548
- inputs: [],
3549
- name: "InvalidSignature",
3550
- type: "error",
3551
- },
3552
- {
3553
- inputs: [],
3554
- name: "RootCanceled",
3555
- type: "error",
3556
- },
3557
- {
3558
- inputs: [],
3559
- name: "Unauthorized",
3560
- type: "error",
3561
- },
3562
- {
3563
- anonymous: false,
3564
- inputs: [
3565
- {
3566
- indexed: true,
3567
- internalType: "address",
3568
- name: "caller",
3569
- type: "address",
3570
- },
3571
- {
3572
- indexed: true,
3573
- internalType: "address",
3574
- name: "maker",
3575
- type: "address",
3576
- },
3577
- {
3578
- indexed: true,
3579
- internalType: "bytes32",
3580
- name: "root",
3581
- type: "bytes32",
3582
- },
3583
- ],
3584
- name: "CancelRoot",
3585
- type: "event",
3586
- },
3587
- {
3588
- inputs: [],
3747
+ type: "function",
3589
3748
  name: "MIDNIGHT",
3749
+ inputs: [],
3590
3750
  outputs: [
3591
3751
  {
3592
- internalType: "address",
3593
3752
  name: "",
3594
3753
  type: "address",
3754
+ internalType: "address",
3595
3755
  },
3596
3756
  ],
3597
3757
  stateMutability: "view",
3598
- type: "function",
3599
3758
  },
3600
3759
  {
3760
+ type: "function",
3761
+ name: "cancelRoot",
3601
3762
  inputs: [
3602
3763
  {
3603
- internalType: "address",
3604
3764
  name: "maker",
3605
3765
  type: "address",
3766
+ internalType: "address",
3606
3767
  },
3607
3768
  {
3608
- internalType: "bytes32",
3609
3769
  name: "root",
3610
3770
  type: "bytes32",
3771
+ internalType: "bytes32",
3611
3772
  },
3612
3773
  ],
3613
- name: "cancelRoot",
3614
3774
  outputs: [],
3615
3775
  stateMutability: "nonpayable",
3616
- type: "function",
3617
3776
  },
3618
3777
  {
3778
+ type: "function",
3779
+ name: "isRatified",
3619
3780
  inputs: [
3620
3781
  {
3782
+ name: "offer",
3783
+ type: "tuple",
3784
+ internalType: "struct Offer",
3621
3785
  components: [
3622
3786
  {
3787
+ name: "market",
3788
+ type: "tuple",
3789
+ internalType: "struct Market",
3623
3790
  components: [
3624
3791
  {
3792
+ name: "chainId",
3793
+ type: "uint256",
3794
+ internalType: "uint256",
3795
+ },
3796
+ {
3797
+ name: "midnight",
3798
+ type: "address",
3625
3799
  internalType: "address",
3800
+ },
3801
+ {
3626
3802
  name: "loanToken",
3627
3803
  type: "address",
3804
+ internalType: "address",
3628
3805
  },
3629
3806
  {
3807
+ name: "collateralParams",
3808
+ type: "tuple[]",
3809
+ internalType: "struct CollateralParams[]",
3630
3810
  components: [
3631
3811
  {
3632
- internalType: "address",
3633
3812
  name: "token",
3634
3813
  type: "address",
3814
+ internalType: "address",
3635
3815
  },
3636
3816
  {
3637
- internalType: "uint256",
3638
3817
  name: "lltv",
3639
3818
  type: "uint256",
3819
+ internalType: "uint256",
3640
3820
  },
3641
3821
  {
3642
- internalType: "uint256",
3643
- name: "maxLif",
3822
+ name: "liquidationCursor",
3644
3823
  type: "uint256",
3824
+ internalType: "uint256",
3645
3825
  },
3646
3826
  {
3647
- internalType: "address",
3648
3827
  name: "oracle",
3649
3828
  type: "address",
3829
+ internalType: "address",
3650
3830
  },
3651
3831
  ],
3652
- internalType: "struct CollateralParams[]",
3653
- name: "collateralParams",
3654
- type: "tuple[]",
3655
3832
  },
3656
3833
  {
3657
- internalType: "uint256",
3658
3834
  name: "maturity",
3659
3835
  type: "uint256",
3836
+ internalType: "uint256",
3660
3837
  },
3661
3838
  {
3662
- internalType: "uint256",
3663
3839
  name: "rcfThreshold",
3664
3840
  type: "uint256",
3841
+ internalType: "uint256",
3665
3842
  },
3666
3843
  {
3667
- internalType: "address",
3668
3844
  name: "enterGate",
3669
3845
  type: "address",
3846
+ internalType: "address",
3670
3847
  },
3671
3848
  {
3672
- internalType: "address",
3673
3849
  name: "liquidatorGate",
3674
3850
  type: "address",
3851
+ internalType: "address",
3675
3852
  },
3676
3853
  ],
3677
- internalType: "struct Market",
3678
- name: "market",
3679
- type: "tuple",
3680
3854
  },
3681
3855
  {
3682
- internalType: "bool",
3683
3856
  name: "buy",
3684
3857
  type: "bool",
3858
+ internalType: "bool",
3685
3859
  },
3686
3860
  {
3687
- internalType: "address",
3688
3861
  name: "maker",
3689
3862
  type: "address",
3863
+ internalType: "address",
3690
3864
  },
3691
3865
  {
3692
- internalType: "uint256",
3693
3866
  name: "start",
3694
3867
  type: "uint256",
3868
+ internalType: "uint256",
3695
3869
  },
3696
3870
  {
3697
- internalType: "uint256",
3698
3871
  name: "expiry",
3699
3872
  type: "uint256",
3873
+ internalType: "uint256",
3700
3874
  },
3701
3875
  {
3702
- internalType: "uint256",
3703
3876
  name: "tick",
3704
3877
  type: "uint256",
3878
+ internalType: "uint256",
3705
3879
  },
3706
3880
  {
3707
- internalType: "bytes32",
3708
3881
  name: "group",
3709
3882
  type: "bytes32",
3883
+ internalType: "bytes32",
3710
3884
  },
3711
3885
  {
3712
- internalType: "address",
3713
3886
  name: "callback",
3714
3887
  type: "address",
3888
+ internalType: "address",
3715
3889
  },
3716
3890
  {
3717
- internalType: "bytes",
3718
3891
  name: "callbackData",
3719
3892
  type: "bytes",
3893
+ internalType: "bytes",
3720
3894
  },
3721
3895
  {
3722
- internalType: "address",
3723
3896
  name: "receiverIfMakerIsSeller",
3724
3897
  type: "address",
3898
+ internalType: "address",
3725
3899
  },
3726
3900
  {
3727
- internalType: "address",
3728
3901
  name: "ratifier",
3729
3902
  type: "address",
3903
+ internalType: "address",
3730
3904
  },
3731
3905
  {
3732
- internalType: "bool",
3733
3906
  name: "reduceOnly",
3734
3907
  type: "bool",
3908
+ internalType: "bool",
3735
3909
  },
3736
3910
  {
3737
- internalType: "uint256",
3738
3911
  name: "maxUnits",
3739
- type: "uint256",
3912
+ type: "uint128",
3913
+ internalType: "uint128",
3740
3914
  },
3741
3915
  {
3742
- internalType: "uint256",
3743
3916
  name: "maxAssets",
3744
- type: "uint256",
3917
+ type: "uint128",
3918
+ internalType: "uint128",
3745
3919
  },
3746
3920
  {
3747
- internalType: "uint256",
3748
3921
  name: "continuousFeeCap",
3749
3922
  type: "uint256",
3923
+ internalType: "uint256",
3750
3924
  },
3751
3925
  ],
3752
- internalType: "struct Offer",
3753
- name: "offer",
3754
- type: "tuple",
3755
3926
  },
3756
3927
  {
3757
- internalType: "bytes",
3758
3928
  name: "ratifierData",
3759
3929
  type: "bytes",
3930
+ internalType: "bytes",
3931
+ },
3932
+ {
3933
+ name: "taker",
3934
+ type: "address",
3935
+ internalType: "address",
3760
3936
  },
3761
3937
  ],
3762
- name: "isRatified",
3763
3938
  outputs: [
3764
3939
  {
3765
- internalType: "bytes32",
3766
3940
  name: "",
3767
3941
  type: "bytes32",
3942
+ internalType: "bytes32",
3768
3943
  },
3769
3944
  ],
3770
3945
  stateMutability: "view",
3771
- type: "function",
3772
3946
  },
3773
3947
  {
3948
+ type: "function",
3949
+ name: "isRootCanceled",
3774
3950
  inputs: [
3775
3951
  {
3776
- internalType: "address",
3777
3952
  name: "maker",
3778
3953
  type: "address",
3954
+ internalType: "address",
3779
3955
  },
3780
3956
  {
3781
- internalType: "bytes32",
3782
3957
  name: "root",
3783
3958
  type: "bytes32",
3959
+ internalType: "bytes32",
3784
3960
  },
3785
3961
  ],
3786
- name: "isRootCanceled",
3787
3962
  outputs: [
3788
3963
  {
3789
- internalType: "bool",
3790
3964
  name: "",
3791
3965
  type: "bool",
3966
+ internalType: "bool",
3792
3967
  },
3793
3968
  ],
3794
3969
  stateMutability: "view",
3795
- type: "function",
3796
- },
3797
- ];
3798
- /**
3799
- * Pinned ABI JSON for the SetterRatifier.
3800
- *
3801
- * Source: `morpho-org/midnight` commit `615fcfa12f725df3a16d65b2c2209272eff5bc10`,
3802
- * `src/ratifiers/interfaces/ISetterRatifier.sol`, Forge artifact `out/src/ratifiers/interfaces/ISetterRatifier.sol/ISetterRatifier.json`.
3803
- *
3804
- * @example
3805
- * ```ts
3806
- * import { setterRatifierAbi } from "@morpho-org/midnight-sdk";
3807
- *
3808
- * console.log(setterRatifierAbi.length);
3809
- * ```
3810
- */
3811
- exports.setterRatifierAbi = [
3812
- {
3813
- inputs: [],
3814
- name: "InvalidProof",
3815
- type: "error",
3816
- },
3817
- {
3818
- inputs: [],
3819
- name: "NotRatified",
3820
- type: "error",
3821
- },
3822
- {
3823
- inputs: [],
3824
- name: "Unauthorized",
3825
- type: "error",
3826
3970
  },
3827
3971
  {
3828
- anonymous: false,
3972
+ type: "event",
3973
+ name: "CancelRoot",
3829
3974
  inputs: [
3830
3975
  {
3831
- indexed: true,
3832
- internalType: "address",
3833
3976
  name: "caller",
3834
3977
  type: "address",
3835
- },
3836
- {
3837
3978
  indexed: true,
3838
3979
  internalType: "address",
3980
+ },
3981
+ {
3839
3982
  name: "maker",
3840
3983
  type: "address",
3984
+ indexed: true,
3985
+ internalType: "address",
3841
3986
  },
3842
3987
  {
3843
- indexed: true,
3844
- internalType: "bytes32",
3845
3988
  name: "root",
3846
3989
  type: "bytes32",
3847
- },
3848
- {
3849
- indexed: false,
3850
- internalType: "bool",
3851
- name: "newIsRootRatified",
3852
- type: "bool",
3990
+ indexed: true,
3991
+ internalType: "bytes32",
3853
3992
  },
3854
3993
  ],
3855
- name: "SetIsRootRatified",
3856
- type: "event",
3994
+ anonymous: false,
3995
+ },
3996
+ {
3997
+ type: "error",
3998
+ name: "InvalidProof",
3999
+ inputs: [],
4000
+ },
4001
+ {
4002
+ type: "error",
4003
+ name: "InvalidSignature",
4004
+ inputs: [],
3857
4005
  },
3858
4006
  {
4007
+ type: "error",
4008
+ name: "RootCanceled",
4009
+ inputs: [],
4010
+ },
4011
+ {
4012
+ type: "error",
4013
+ name: "Unauthorized",
3859
4014
  inputs: [],
4015
+ },
4016
+ ];
4017
+ /**
4018
+ * Pinned ABI JSON for the SetterRatifier.
4019
+ *
4020
+ * Source: `morpho-org/midnight` commit `336b924a2bb378d810ef6d35b6dd3486759af8bd`,
4021
+ * `src/ratifiers/interfaces/ISetterRatifier.sol`, Forge artifact `out/ISetterRatifier.sol/ISetterRatifier.json`.
4022
+ *
4023
+ * @example
4024
+ * ```ts
4025
+ * import { setterRatifierAbi } from "@morpho-org/midnight-sdk";
4026
+ *
4027
+ * console.log(setterRatifierAbi.length);
4028
+ * ```
4029
+ */
4030
+ exports.setterRatifierAbi = [
4031
+ {
4032
+ type: "function",
3860
4033
  name: "MIDNIGHT",
4034
+ inputs: [],
3861
4035
  outputs: [
3862
4036
  {
3863
- internalType: "address",
3864
4037
  name: "",
3865
4038
  type: "address",
4039
+ internalType: "address",
3866
4040
  },
3867
4041
  ],
3868
4042
  stateMutability: "view",
3869
- type: "function",
3870
4043
  },
3871
4044
  {
4045
+ type: "function",
4046
+ name: "isRatified",
3872
4047
  inputs: [
3873
4048
  {
4049
+ name: "offer",
4050
+ type: "tuple",
4051
+ internalType: "struct Offer",
3874
4052
  components: [
3875
4053
  {
4054
+ name: "market",
4055
+ type: "tuple",
4056
+ internalType: "struct Market",
3876
4057
  components: [
3877
4058
  {
4059
+ name: "chainId",
4060
+ type: "uint256",
4061
+ internalType: "uint256",
4062
+ },
4063
+ {
4064
+ name: "midnight",
4065
+ type: "address",
3878
4066
  internalType: "address",
4067
+ },
4068
+ {
3879
4069
  name: "loanToken",
3880
4070
  type: "address",
4071
+ internalType: "address",
3881
4072
  },
3882
4073
  {
4074
+ name: "collateralParams",
4075
+ type: "tuple[]",
4076
+ internalType: "struct CollateralParams[]",
3883
4077
  components: [
3884
4078
  {
3885
- internalType: "address",
3886
4079
  name: "token",
3887
4080
  type: "address",
4081
+ internalType: "address",
3888
4082
  },
3889
4083
  {
3890
- internalType: "uint256",
3891
4084
  name: "lltv",
3892
4085
  type: "uint256",
4086
+ internalType: "uint256",
3893
4087
  },
3894
4088
  {
3895
- internalType: "uint256",
3896
- name: "maxLif",
4089
+ name: "liquidationCursor",
3897
4090
  type: "uint256",
4091
+ internalType: "uint256",
3898
4092
  },
3899
4093
  {
3900
- internalType: "address",
3901
4094
  name: "oracle",
3902
4095
  type: "address",
4096
+ internalType: "address",
3903
4097
  },
3904
4098
  ],
3905
- internalType: "struct CollateralParams[]",
3906
- name: "collateralParams",
3907
- type: "tuple[]",
3908
4099
  },
3909
4100
  {
3910
- internalType: "uint256",
3911
4101
  name: "maturity",
3912
4102
  type: "uint256",
4103
+ internalType: "uint256",
3913
4104
  },
3914
4105
  {
3915
- internalType: "uint256",
3916
4106
  name: "rcfThreshold",
3917
4107
  type: "uint256",
4108
+ internalType: "uint256",
3918
4109
  },
3919
4110
  {
3920
- internalType: "address",
3921
4111
  name: "enterGate",
3922
4112
  type: "address",
4113
+ internalType: "address",
3923
4114
  },
3924
4115
  {
3925
- internalType: "address",
3926
4116
  name: "liquidatorGate",
3927
4117
  type: "address",
4118
+ internalType: "address",
3928
4119
  },
3929
4120
  ],
3930
- internalType: "struct Market",
3931
- name: "market",
3932
- type: "tuple",
3933
4121
  },
3934
4122
  {
3935
- internalType: "bool",
3936
4123
  name: "buy",
3937
4124
  type: "bool",
4125
+ internalType: "bool",
3938
4126
  },
3939
4127
  {
3940
- internalType: "address",
3941
4128
  name: "maker",
3942
4129
  type: "address",
4130
+ internalType: "address",
3943
4131
  },
3944
4132
  {
3945
- internalType: "uint256",
3946
4133
  name: "start",
3947
4134
  type: "uint256",
4135
+ internalType: "uint256",
3948
4136
  },
3949
4137
  {
3950
- internalType: "uint256",
3951
4138
  name: "expiry",
3952
4139
  type: "uint256",
4140
+ internalType: "uint256",
3953
4141
  },
3954
4142
  {
3955
- internalType: "uint256",
3956
4143
  name: "tick",
3957
4144
  type: "uint256",
4145
+ internalType: "uint256",
3958
4146
  },
3959
4147
  {
3960
- internalType: "bytes32",
3961
4148
  name: "group",
3962
4149
  type: "bytes32",
4150
+ internalType: "bytes32",
3963
4151
  },
3964
4152
  {
3965
- internalType: "address",
3966
4153
  name: "callback",
3967
4154
  type: "address",
4155
+ internalType: "address",
3968
4156
  },
3969
4157
  {
3970
- internalType: "bytes",
3971
4158
  name: "callbackData",
3972
4159
  type: "bytes",
4160
+ internalType: "bytes",
3973
4161
  },
3974
4162
  {
3975
- internalType: "address",
3976
4163
  name: "receiverIfMakerIsSeller",
3977
4164
  type: "address",
4165
+ internalType: "address",
3978
4166
  },
3979
4167
  {
3980
- internalType: "address",
3981
4168
  name: "ratifier",
3982
4169
  type: "address",
4170
+ internalType: "address",
3983
4171
  },
3984
4172
  {
3985
- internalType: "bool",
3986
4173
  name: "reduceOnly",
3987
4174
  type: "bool",
4175
+ internalType: "bool",
3988
4176
  },
3989
4177
  {
3990
- internalType: "uint256",
3991
4178
  name: "maxUnits",
3992
- type: "uint256",
4179
+ type: "uint128",
4180
+ internalType: "uint128",
3993
4181
  },
3994
4182
  {
3995
- internalType: "uint256",
3996
4183
  name: "maxAssets",
3997
- type: "uint256",
4184
+ type: "uint128",
4185
+ internalType: "uint128",
3998
4186
  },
3999
4187
  {
4000
- internalType: "uint256",
4001
4188
  name: "continuousFeeCap",
4002
4189
  type: "uint256",
4190
+ internalType: "uint256",
4003
4191
  },
4004
4192
  ],
4005
- internalType: "struct Offer",
4006
- name: "offer",
4007
- type: "tuple",
4008
4193
  },
4009
4194
  {
4010
- internalType: "bytes",
4011
4195
  name: "ratifierData",
4012
4196
  type: "bytes",
4197
+ internalType: "bytes",
4198
+ },
4199
+ {
4200
+ name: "taker",
4201
+ type: "address",
4202
+ internalType: "address",
4013
4203
  },
4014
4204
  ],
4015
- name: "isRatified",
4016
4205
  outputs: [
4017
4206
  {
4018
- internalType: "bytes32",
4019
4207
  name: "",
4020
4208
  type: "bytes32",
4209
+ internalType: "bytes32",
4021
4210
  },
4022
4211
  ],
4023
4212
  stateMutability: "view",
4024
- type: "function",
4025
4213
  },
4026
4214
  {
4215
+ type: "function",
4216
+ name: "isRootRatified",
4027
4217
  inputs: [
4028
4218
  {
4029
- internalType: "address",
4030
4219
  name: "maker",
4031
4220
  type: "address",
4221
+ internalType: "address",
4032
4222
  },
4033
4223
  {
4034
- internalType: "bytes32",
4035
4224
  name: "root",
4036
4225
  type: "bytes32",
4226
+ internalType: "bytes32",
4037
4227
  },
4038
4228
  ],
4039
- name: "isRootRatified",
4040
4229
  outputs: [
4041
4230
  {
4042
- internalType: "bool",
4043
4231
  name: "",
4044
4232
  type: "bool",
4233
+ internalType: "bool",
4045
4234
  },
4046
4235
  ],
4047
4236
  stateMutability: "view",
4048
- type: "function",
4049
4237
  },
4050
4238
  {
4239
+ type: "function",
4240
+ name: "setIsRootRatified",
4051
4241
  inputs: [
4052
4242
  {
4053
- internalType: "address",
4054
4243
  name: "maker",
4055
4244
  type: "address",
4245
+ internalType: "address",
4056
4246
  },
4057
4247
  {
4058
- internalType: "bytes32",
4059
4248
  name: "root",
4060
4249
  type: "bytes32",
4250
+ internalType: "bytes32",
4061
4251
  },
4062
4252
  {
4063
- internalType: "bool",
4064
4253
  name: "newIsRootRatified",
4065
4254
  type: "bool",
4255
+ internalType: "bool",
4066
4256
  },
4067
4257
  ],
4068
- name: "setIsRootRatified",
4069
4258
  outputs: [],
4070
4259
  stateMutability: "nonpayable",
4071
- type: "function",
4260
+ },
4261
+ {
4262
+ type: "event",
4263
+ name: "SetIsRootRatified",
4264
+ inputs: [
4265
+ {
4266
+ name: "caller",
4267
+ type: "address",
4268
+ indexed: true,
4269
+ internalType: "address",
4270
+ },
4271
+ {
4272
+ name: "maker",
4273
+ type: "address",
4274
+ indexed: true,
4275
+ internalType: "address",
4276
+ },
4277
+ {
4278
+ name: "root",
4279
+ type: "bytes32",
4280
+ indexed: true,
4281
+ internalType: "bytes32",
4282
+ },
4283
+ {
4284
+ name: "newIsRootRatified",
4285
+ type: "bool",
4286
+ indexed: false,
4287
+ internalType: "bool",
4288
+ },
4289
+ ],
4290
+ anonymous: false,
4291
+ },
4292
+ {
4293
+ type: "error",
4294
+ name: "InvalidProof",
4295
+ inputs: [],
4296
+ },
4297
+ {
4298
+ type: "error",
4299
+ name: "NotRatified",
4300
+ inputs: [],
4301
+ },
4302
+ {
4303
+ type: "error",
4304
+ name: "Unauthorized",
4305
+ inputs: [],
4072
4306
  },
4073
4307
  ];