@morpho-org/midnight-sdk 0.1.0 → 1.1.1

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