afp-sdk 0.5.4__py3-none-any.whl → 0.6.1__py3-none-any.whl

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 (49) hide show
  1. afp/__init__.py +4 -1
  2. afp/afp.py +11 -0
  3. afp/api/admin.py +1 -1
  4. afp/api/base.py +11 -2
  5. afp/api/margin_account.py +12 -148
  6. afp/api/product.py +302 -148
  7. afp/api/trading.py +10 -19
  8. afp/auth.py +14 -0
  9. afp/bindings/__init__.py +30 -16
  10. afp/bindings/admin_facet.py +890 -0
  11. afp/bindings/clearing_facet.py +356 -773
  12. afp/bindings/facade.py +9 -6
  13. afp/bindings/final_settlement_facet.py +258 -99
  14. afp/bindings/margin_account.py +524 -839
  15. afp/bindings/margin_account_facet.py +722 -0
  16. afp/bindings/margin_account_registry.py +184 -310
  17. afp/bindings/mark_price_tracker_facet.py +74 -16
  18. afp/bindings/product_registry.py +1577 -541
  19. afp/bindings/product_registry_facet.py +1467 -0
  20. afp/bindings/system_viewer.py +592 -369
  21. afp/bindings/types.py +223 -0
  22. afp/config.py +4 -0
  23. afp/constants.py +49 -6
  24. afp/decorators.py +25 -3
  25. afp/dtos.py +142 -0
  26. afp/exceptions.py +10 -0
  27. afp/exchange.py +10 -8
  28. afp/hashing.py +7 -5
  29. afp/ipfs.py +245 -0
  30. afp/json-schemas/bafyreiaw34o6l3rmatabzbds2i2myazdw2yolevcpsoyd2i2g3ms7wa2eq.json +1 -0
  31. afp/json-schemas/bafyreibnfg6nq74dvpkre5rakkccij7iadp5rxpim7omsatjnrpmj3y7v4.json +1 -0
  32. afp/json-schemas/bafyreicgr6dfo5yduixjkcifghiulskfegwojvuwodtouvivl362zndhxe.json +1 -0
  33. afp/json-schemas/bafyreicheoypx6synljushh7mq2572iyhlolf4nake2p5dwobgnj3r5eua.json +1 -0
  34. afp/json-schemas/bafyreid35a67db4sqh4fs6boddyt2xvscbqy6nqvsp5jjur56qhkw4ixre.json +1 -0
  35. afp/json-schemas/bafyreidzs7okcpqiss6ztftltyptqwnw5e5opsy5yntospekjha4kpykaa.json +1 -0
  36. afp/json-schemas/bafyreifcec2km7hxwq6oqzjlspni2mgipetjb7pqtaewh2efislzoctboi.json +1 -0
  37. afp/json-schemas/bafyreihn3oiaxffe4e2w7pwtreadpw3obfd7gqlogbcxm56jc2hzfvco74.json +1 -0
  38. afp/json-schemas/bafyreihur3dzwhja6uxsbcw6eeoj3xmmc4e3zkmyzpot5v5dleevxe5zam.json +1 -0
  39. afp/schemas.py +236 -177
  40. afp/types.py +169 -0
  41. afp/validators.py +218 -8
  42. {afp_sdk-0.5.4.dist-info → afp_sdk-0.6.1.dist-info}/METADATA +76 -11
  43. afp_sdk-0.6.1.dist-info/RECORD +50 -0
  44. afp/bindings/auctioneer_facet.py +0 -752
  45. afp/bindings/bankruptcy_facet.py +0 -391
  46. afp/bindings/trading_protocol.py +0 -1158
  47. afp_sdk-0.5.4.dist-info/RECORD +0 -37
  48. {afp_sdk-0.5.4.dist-info → afp_sdk-0.6.1.dist-info}/WHEEL +0 -0
  49. {afp_sdk-0.5.4.dist-info → afp_sdk-0.6.1.dist-info}/licenses/LICENSE +0 -0
@@ -2,21 +2,97 @@
2
2
 
3
3
  # This module has been generated using pyabigen v0.2.16
4
4
 
5
+ import enum
5
6
  import typing
6
7
  from dataclasses import dataclass
7
8
 
8
9
  import eth_typing
9
10
  import hexbytes
10
11
  import web3
12
+ from web3 import types
11
13
  from web3.contract import contract
12
14
 
13
- from .margin_account import Settlement, PositionData
14
- from .product_registry import (
15
- OracleSpecification,
16
- Product,
17
- ProductMetadata,
18
- ProductState,
19
- )
15
+
16
+ class ProductState(enum.IntEnum):
17
+ """Port of `enum ProductState` on the SystemViewer contract."""
18
+
19
+ NOT_EXIST = 0
20
+ PENDING = 1
21
+ LIVE = 2
22
+ TRADEOUT = 3
23
+ FINAL_SETTLEMENT = 4
24
+ EXPIRED = 5
25
+
26
+
27
+ @dataclass
28
+ class Settlement:
29
+ """Port of `struct Settlement` on the SystemViewer contract."""
30
+
31
+ product_id: hexbytes.HexBytes
32
+ quantity: int
33
+ price: int
34
+
35
+
36
+ @dataclass
37
+ class PositionData:
38
+ """Port of `struct PositionData` on the SystemViewer contract."""
39
+
40
+ product_id: hexbytes.HexBytes
41
+ quantity: int
42
+ cost_basis: int
43
+ maintenance_margin: int
44
+ pnl: int
45
+
46
+
47
+ @dataclass
48
+ class ProductMetadata:
49
+ """Port of `struct ProductMetadata` on the SystemViewer contract."""
50
+
51
+ builder: eth_typing.ChecksumAddress
52
+ symbol: str
53
+ description: str
54
+
55
+
56
+ @dataclass
57
+ class OracleSpecification:
58
+ """Port of `struct OracleSpecification` on the SystemViewer contract."""
59
+
60
+ oracle_address: eth_typing.ChecksumAddress
61
+ fsv_decimals: int
62
+ fsp_alpha: int
63
+ fsp_beta: int
64
+ fsv_calldata: hexbytes.HexBytes
65
+
66
+
67
+ @dataclass
68
+ class BaseProduct:
69
+ """Port of `struct BaseProduct` on the SystemViewer contract."""
70
+
71
+ metadata: ProductMetadata
72
+ oracle_spec: OracleSpecification
73
+ collateral_asset: eth_typing.ChecksumAddress
74
+ start_time: int
75
+ point_value: int
76
+ price_decimals: int
77
+ extended_metadata: str
78
+
79
+
80
+ @dataclass
81
+ class ExpirySpecification:
82
+ """Port of `struct ExpirySpecification` on the SystemViewer contract."""
83
+
84
+ earliest_fsp_submission_time: int
85
+ tradeout_interval: int
86
+
87
+
88
+ @dataclass
89
+ class PredictionProductV1:
90
+ """Port of `struct PredictionProductV1` on the SystemViewer contract."""
91
+
92
+ base: BaseProduct
93
+ expiry_spec: ExpirySpecification
94
+ max_price: int
95
+ min_price: int
20
96
 
21
97
 
22
98
  @dataclass
@@ -69,26 +145,42 @@ class SystemViewer:
69
145
 
70
146
  def upgrade_interface_version(
71
147
  self,
148
+ block_identifier: types.BlockIdentifier = "latest",
72
149
  ) -> str:
73
150
  """Binding for `UPGRADE_INTERFACE_VERSION` on the SystemViewer contract.
74
151
 
152
+ Parameters
153
+ ----------
154
+ block_identifier : web3.types.BlockIdentifier
155
+ The block identifier, defaults to the latest block.
156
+
75
157
  Returns
76
158
  -------
77
159
  str
78
160
  """
79
- return_value = self._contract.functions.UPGRADE_INTERFACE_VERSION().call()
161
+ return_value = self._contract.functions.UPGRADE_INTERFACE_VERSION().call(
162
+ block_identifier=block_identifier
163
+ )
80
164
  return str(return_value)
81
165
 
82
166
  def clearing(
83
167
  self,
168
+ block_identifier: types.BlockIdentifier = "latest",
84
169
  ) -> eth_typing.ChecksumAddress:
85
170
  """Binding for `clearing` on the SystemViewer contract.
86
171
 
172
+ Parameters
173
+ ----------
174
+ block_identifier : web3.types.BlockIdentifier
175
+ The block identifier, defaults to the latest block.
176
+
87
177
  Returns
88
178
  -------
89
179
  eth_typing.ChecksumAddress
90
180
  """
91
- return_value = self._contract.functions.clearing().call()
181
+ return_value = self._contract.functions.clearing().call(
182
+ block_identifier=block_identifier
183
+ )
92
184
  return eth_typing.ChecksumAddress(return_value)
93
185
 
94
186
  def initialize(
@@ -120,6 +212,7 @@ class SystemViewer:
120
212
  self,
121
213
  collateral_asset: eth_typing.ChecksumAddress,
122
214
  accounts: typing.List[eth_typing.ChecksumAddress],
215
+ block_identifier: types.BlockIdentifier = "latest",
123
216
  ) -> typing.List[int]:
124
217
  """Binding for `maeByCollateralAsset` on the SystemViewer contract.
125
218
 
@@ -127,6 +220,8 @@ class SystemViewer:
127
220
  ----------
128
221
  collateral_asset : eth_typing.ChecksumAddress
129
222
  accounts : typing.List[eth_typing.ChecksumAddress]
223
+ block_identifier : web3.types.BlockIdentifier
224
+ The block identifier, defaults to the latest block.
130
225
 
131
226
  Returns
132
227
  -------
@@ -135,13 +230,14 @@ class SystemViewer:
135
230
  return_value = self._contract.functions.maeByCollateralAsset(
136
231
  collateral_asset,
137
232
  accounts,
138
- ).call()
233
+ ).call(block_identifier=block_identifier)
139
234
  return [int(return_value_elem) for return_value_elem in return_value]
140
235
 
141
236
  def mae_by_collateral_assets(
142
237
  self,
143
238
  collateral_assets: typing.List[eth_typing.ChecksumAddress],
144
239
  accounts: typing.List[eth_typing.ChecksumAddress],
240
+ block_identifier: types.BlockIdentifier = "latest",
145
241
  ) -> typing.List[int]:
146
242
  """Binding for `maeByCollateralAssets` on the SystemViewer contract.
147
243
 
@@ -149,6 +245,8 @@ class SystemViewer:
149
245
  ----------
150
246
  collateral_assets : typing.List[eth_typing.ChecksumAddress]
151
247
  accounts : typing.List[eth_typing.ChecksumAddress]
248
+ block_identifier : web3.types.BlockIdentifier
249
+ The block identifier, defaults to the latest block.
152
250
 
153
251
  Returns
154
252
  -------
@@ -157,22 +255,23 @@ class SystemViewer:
157
255
  return_value = self._contract.functions.maeByCollateralAssets(
158
256
  collateral_assets,
159
257
  accounts,
160
- ).call()
258
+ ).call(block_identifier=block_identifier)
161
259
  return [int(return_value_elem) for return_value_elem in return_value]
162
260
 
163
- def mae_checks_by_collateral_asset(
261
+ def mae_checks(
164
262
  self,
165
- collateral_asset: eth_typing.ChecksumAddress,
166
263
  accounts: typing.List[eth_typing.ChecksumAddress],
167
264
  settlements: typing.List[Settlement],
265
+ block_identifier: types.BlockIdentifier = "latest",
168
266
  ) -> typing.Tuple[typing.List[bool], typing.List[int], typing.List[int]]:
169
- """Binding for `maeChecksByCollateralAsset` on the SystemViewer contract.
267
+ """Binding for `maeChecks` on the SystemViewer contract.
170
268
 
171
269
  Parameters
172
270
  ----------
173
- collateral_asset : eth_typing.ChecksumAddress
174
271
  accounts : typing.List[eth_typing.ChecksumAddress]
175
272
  settlements : typing.List[Settlement]
273
+ block_identifier : web3.types.BlockIdentifier
274
+ The block identifier, defaults to the latest block.
176
275
 
177
276
  Returns
178
277
  -------
@@ -180,11 +279,10 @@ class SystemViewer:
180
279
  typing.List[int]
181
280
  typing.List[int]
182
281
  """
183
- return_value = self._contract.functions.maeChecksByCollateralAsset(
184
- collateral_asset,
282
+ return_value = self._contract.functions.maeChecks(
185
283
  accounts,
186
- [(item.position_id, item.quantity, item.price) for item in settlements],
187
- ).call()
284
+ [(item.product_id, item.quantity, item.price) for item in settlements],
285
+ ).call(block_identifier=block_identifier)
188
286
  return (
189
287
  [bool(return_value0_elem) for return_value0_elem in return_value[0]],
190
288
  [int(return_value1_elem) for return_value1_elem in return_value[1]],
@@ -193,32 +291,99 @@ class SystemViewer:
193
291
 
194
292
  def margin_account_registry(
195
293
  self,
294
+ block_identifier: types.BlockIdentifier = "latest",
196
295
  ) -> eth_typing.ChecksumAddress:
197
296
  """Binding for `marginAccountRegistry` on the SystemViewer contract.
198
297
 
298
+ Parameters
299
+ ----------
300
+ block_identifier : web3.types.BlockIdentifier
301
+ The block identifier, defaults to the latest block.
302
+
199
303
  Returns
200
304
  -------
201
305
  eth_typing.ChecksumAddress
202
306
  """
203
- return_value = self._contract.functions.marginAccountRegistry().call()
307
+ return_value = self._contract.functions.marginAccountRegistry().call(
308
+ block_identifier=block_identifier
309
+ )
204
310
  return eth_typing.ChecksumAddress(return_value)
205
311
 
206
312
  def owner(
207
313
  self,
314
+ block_identifier: types.BlockIdentifier = "latest",
208
315
  ) -> eth_typing.ChecksumAddress:
209
316
  """Binding for `owner` on the SystemViewer contract.
210
317
 
318
+ Parameters
319
+ ----------
320
+ block_identifier : web3.types.BlockIdentifier
321
+ The block identifier, defaults to the latest block.
322
+
211
323
  Returns
212
324
  -------
213
325
  eth_typing.ChecksumAddress
214
326
  """
215
- return_value = self._contract.functions.owner().call()
327
+ return_value = self._contract.functions.owner().call(
328
+ block_identifier=block_identifier
329
+ )
216
330
  return eth_typing.ChecksumAddress(return_value)
217
331
 
332
+ def position_quantities_by_product_id(
333
+ self,
334
+ product_id: hexbytes.HexBytes,
335
+ accounts: typing.List[eth_typing.ChecksumAddress],
336
+ block_identifier: types.BlockIdentifier = "latest",
337
+ ) -> typing.List[int]:
338
+ """Binding for `positionQuantitiesByProductId` on the SystemViewer contract.
339
+
340
+ Parameters
341
+ ----------
342
+ product_id : hexbytes.HexBytes
343
+ accounts : typing.List[eth_typing.ChecksumAddress]
344
+ block_identifier : web3.types.BlockIdentifier
345
+ The block identifier, defaults to the latest block.
346
+
347
+ Returns
348
+ -------
349
+ typing.List[int]
350
+ """
351
+ return_value = self._contract.functions.positionQuantitiesByProductId(
352
+ product_id,
353
+ accounts,
354
+ ).call(block_identifier=block_identifier)
355
+ return [int(return_value_elem) for return_value_elem in return_value]
356
+
357
+ def position_quantities_by_product_ids(
358
+ self,
359
+ product_ids: typing.List[hexbytes.HexBytes],
360
+ accounts: typing.List[eth_typing.ChecksumAddress],
361
+ block_identifier: types.BlockIdentifier = "latest",
362
+ ) -> typing.List[int]:
363
+ """Binding for `positionQuantitiesByProductIds` on the SystemViewer contract.
364
+
365
+ Parameters
366
+ ----------
367
+ product_ids : typing.List[hexbytes.HexBytes]
368
+ accounts : typing.List[eth_typing.ChecksumAddress]
369
+ block_identifier : web3.types.BlockIdentifier
370
+ The block identifier, defaults to the latest block.
371
+
372
+ Returns
373
+ -------
374
+ typing.List[int]
375
+ """
376
+ return_value = self._contract.functions.positionQuantitiesByProductIds(
377
+ product_ids,
378
+ accounts,
379
+ ).call(block_identifier=block_identifier)
380
+ return [int(return_value_elem) for return_value_elem in return_value]
381
+
218
382
  def positions_by_collateral_asset(
219
383
  self,
220
384
  collateral_asset: eth_typing.ChecksumAddress,
221
385
  accounts: typing.List[eth_typing.ChecksumAddress],
386
+ block_identifier: types.BlockIdentifier = "latest",
222
387
  ) -> typing.List[typing.List[PositionData]]:
223
388
  """Binding for `positionsByCollateralAsset` on the SystemViewer contract.
224
389
 
@@ -226,6 +391,8 @@ class SystemViewer:
226
391
  ----------
227
392
  collateral_asset : eth_typing.ChecksumAddress
228
393
  accounts : typing.List[eth_typing.ChecksumAddress]
394
+ block_identifier : web3.types.BlockIdentifier
395
+ The block identifier, defaults to the latest block.
229
396
 
230
397
  Returns
231
398
  -------
@@ -234,7 +401,7 @@ class SystemViewer:
234
401
  return_value = self._contract.functions.positionsByCollateralAsset(
235
402
  collateral_asset,
236
403
  accounts,
237
- ).call()
404
+ ).call(block_identifier=block_identifier)
238
405
  return [
239
406
  [
240
407
  PositionData(
@@ -253,6 +420,7 @@ class SystemViewer:
253
420
  self,
254
421
  collateral_assets: typing.List[eth_typing.ChecksumAddress],
255
422
  accounts: typing.List[eth_typing.ChecksumAddress],
423
+ block_identifier: types.BlockIdentifier = "latest",
256
424
  ) -> typing.List[typing.List[PositionData]]:
257
425
  """Binding for `positionsByCollateralAssets` on the SystemViewer contract.
258
426
 
@@ -260,6 +428,8 @@ class SystemViewer:
260
428
  ----------
261
429
  collateral_assets : typing.List[eth_typing.ChecksumAddress]
262
430
  accounts : typing.List[eth_typing.ChecksumAddress]
431
+ block_identifier : web3.types.BlockIdentifier
432
+ The block identifier, defaults to the latest block.
263
433
 
264
434
  Returns
265
435
  -------
@@ -268,7 +438,7 @@ class SystemViewer:
268
438
  return_value = self._contract.functions.positionsByCollateralAssets(
269
439
  collateral_assets,
270
440
  accounts,
271
- ).call()
441
+ ).call(block_identifier=block_identifier)
272
442
  return [
273
443
  [
274
444
  PositionData(
@@ -286,70 +456,85 @@ class SystemViewer:
286
456
  def product_details(
287
457
  self,
288
458
  product_ids: typing.List[hexbytes.HexBytes],
289
- ) -> typing.List[Product]:
459
+ block_identifier: types.BlockIdentifier = "latest",
460
+ ) -> typing.List[PredictionProductV1]:
290
461
  """Binding for `productDetails` on the SystemViewer contract.
291
462
 
292
463
  Parameters
293
464
  ----------
294
465
  product_ids : typing.List[hexbytes.HexBytes]
466
+ block_identifier : web3.types.BlockIdentifier
467
+ The block identifier, defaults to the latest block.
295
468
 
296
469
  Returns
297
470
  -------
298
- typing.List[Product]
471
+ typing.List[PredictionProductV1]
299
472
  """
300
473
  return_value = self._contract.functions.productDetails(
301
474
  product_ids,
302
- ).call()
475
+ ).call(block_identifier=block_identifier)
303
476
  return [
304
- Product(
305
- ProductMetadata(
306
- eth_typing.ChecksumAddress(return_value_elem[0][0]),
307
- str(return_value_elem[0][1]),
308
- str(return_value_elem[0][2]),
477
+ PredictionProductV1(
478
+ BaseProduct(
479
+ ProductMetadata(
480
+ eth_typing.ChecksumAddress(return_value_elem[0][0][0]),
481
+ str(return_value_elem[0][0][1]),
482
+ str(return_value_elem[0][0][2]),
483
+ ),
484
+ OracleSpecification(
485
+ eth_typing.ChecksumAddress(return_value_elem[0][1][0]),
486
+ int(return_value_elem[0][1][1]),
487
+ int(return_value_elem[0][1][2]),
488
+ int(return_value_elem[0][1][3]),
489
+ hexbytes.HexBytes(return_value_elem[0][1][4]),
490
+ ),
491
+ eth_typing.ChecksumAddress(return_value_elem[0][2]),
492
+ int(return_value_elem[0][3]),
493
+ int(return_value_elem[0][4]),
494
+ int(return_value_elem[0][5]),
495
+ str(return_value_elem[0][6]),
309
496
  ),
310
- OracleSpecification(
311
- eth_typing.ChecksumAddress(return_value_elem[1][0]),
312
- int(return_value_elem[1][1]),
313
- int(return_value_elem[1][2]),
314
- int(return_value_elem[1][3]),
315
- hexbytes.HexBytes(return_value_elem[1][4]),
497
+ ExpirySpecification(
498
+ int(return_value_elem[1][0]), int(return_value_elem[1][1])
316
499
  ),
317
- str(return_value_elem[2]),
318
- eth_typing.ChecksumAddress(return_value_elem[3]),
319
- int(return_value_elem[4]),
320
- int(return_value_elem[5]),
321
- int(return_value_elem[6]),
322
- int(return_value_elem[7]),
323
- int(return_value_elem[8]),
324
- int(return_value_elem[9]),
325
- int(return_value_elem[10]),
326
- int(return_value_elem[11]),
327
- str(return_value_elem[12]),
500
+ int(return_value_elem[2]),
501
+ int(return_value_elem[3]),
328
502
  )
329
503
  for return_value_elem in return_value
330
504
  ]
331
505
 
332
506
  def product_registry(
333
507
  self,
508
+ block_identifier: types.BlockIdentifier = "latest",
334
509
  ) -> eth_typing.ChecksumAddress:
335
510
  """Binding for `productRegistry` on the SystemViewer contract.
336
511
 
512
+ Parameters
513
+ ----------
514
+ block_identifier : web3.types.BlockIdentifier
515
+ The block identifier, defaults to the latest block.
516
+
337
517
  Returns
338
518
  -------
339
519
  eth_typing.ChecksumAddress
340
520
  """
341
- return_value = self._contract.functions.productRegistry().call()
521
+ return_value = self._contract.functions.productRegistry().call(
522
+ block_identifier=block_identifier
523
+ )
342
524
  return eth_typing.ChecksumAddress(return_value)
343
525
 
344
526
  def product_states(
345
527
  self,
346
528
  product_ids: typing.List[hexbytes.HexBytes],
529
+ block_identifier: types.BlockIdentifier = "latest",
347
530
  ) -> typing.List[ProductState]:
348
531
  """Binding for `productStates` on the SystemViewer contract.
349
532
 
350
533
  Parameters
351
534
  ----------
352
535
  product_ids : typing.List[hexbytes.HexBytes]
536
+ block_identifier : web3.types.BlockIdentifier
537
+ The block identifier, defaults to the latest block.
353
538
 
354
539
  Returns
355
540
  -------
@@ -357,19 +542,27 @@ class SystemViewer:
357
542
  """
358
543
  return_value = self._contract.functions.productStates(
359
544
  product_ids,
360
- ).call()
545
+ ).call(block_identifier=block_identifier)
361
546
  return [ProductState(return_value_elem) for return_value_elem in return_value]
362
547
 
363
548
  def proxiable_uuid(
364
549
  self,
550
+ block_identifier: types.BlockIdentifier = "latest",
365
551
  ) -> hexbytes.HexBytes:
366
552
  """Binding for `proxiableUUID` on the SystemViewer contract.
367
553
 
554
+ Parameters
555
+ ----------
556
+ block_identifier : web3.types.BlockIdentifier
557
+ The block identifier, defaults to the latest block.
558
+
368
559
  Returns
369
560
  -------
370
561
  hexbytes.HexBytes
371
562
  """
372
- return_value = self._contract.functions.proxiableUUID().call()
563
+ return_value = self._contract.functions.proxiableUUID().call(
564
+ block_identifier=block_identifier
565
+ )
373
566
  return hexbytes.HexBytes(return_value)
374
567
 
375
568
  def renounce_ownership(
@@ -429,6 +622,7 @@ class SystemViewer:
429
622
  self,
430
623
  collateral_asset: eth_typing.ChecksumAddress,
431
624
  accounts: typing.List[eth_typing.ChecksumAddress],
625
+ block_identifier: types.BlockIdentifier = "latest",
432
626
  ) -> typing.List[UserMarginAccountData]:
433
627
  """Binding for `userMarginDataByCollateralAsset` on the SystemViewer contract.
434
628
 
@@ -436,6 +630,8 @@ class SystemViewer:
436
630
  ----------
437
631
  collateral_asset : eth_typing.ChecksumAddress
438
632
  accounts : typing.List[eth_typing.ChecksumAddress]
633
+ block_identifier : web3.types.BlockIdentifier
634
+ The block identifier, defaults to the latest block.
439
635
 
440
636
  Returns
441
637
  -------
@@ -444,7 +640,7 @@ class SystemViewer:
444
640
  return_value = self._contract.functions.userMarginDataByCollateralAsset(
445
641
  collateral_asset,
446
642
  accounts,
447
- ).call()
643
+ ).call(block_identifier=block_identifier)
448
644
  return [
449
645
  UserMarginAccountData(
450
646
  eth_typing.ChecksumAddress(return_value_elem[0]),
@@ -469,6 +665,7 @@ class SystemViewer:
469
665
  self,
470
666
  collateral_assets: typing.List[eth_typing.ChecksumAddress],
471
667
  accounts: typing.List[eth_typing.ChecksumAddress],
668
+ block_identifier: types.BlockIdentifier = "latest",
472
669
  ) -> typing.List[UserMarginAccountData]:
473
670
  """Binding for `userMarginDataByCollateralAssets` on the SystemViewer contract.
474
671
 
@@ -476,6 +673,8 @@ class SystemViewer:
476
673
  ----------
477
674
  collateral_assets : typing.List[eth_typing.ChecksumAddress]
478
675
  accounts : typing.List[eth_typing.ChecksumAddress]
676
+ block_identifier : web3.types.BlockIdentifier
677
+ The block identifier, defaults to the latest block.
479
678
 
480
679
  Returns
481
680
  -------
@@ -484,7 +683,7 @@ class SystemViewer:
484
683
  return_value = self._contract.functions.userMarginDataByCollateralAssets(
485
684
  collateral_assets,
486
685
  accounts,
487
- ).call()
686
+ ).call(block_identifier=block_identifier)
488
687
  return [
489
688
  UserMarginAccountData(
490
689
  eth_typing.ChecksumAddress(return_value_elem[0]),
@@ -508,12 +707,15 @@ class SystemViewer:
508
707
  def valuations(
509
708
  self,
510
709
  product_ids: typing.List[hexbytes.HexBytes],
710
+ block_identifier: types.BlockIdentifier = "latest",
511
711
  ) -> typing.List[int]:
512
712
  """Binding for `valuations` on the SystemViewer contract.
513
713
 
514
714
  Parameters
515
715
  ----------
516
716
  product_ids : typing.List[hexbytes.HexBytes]
717
+ block_identifier : web3.types.BlockIdentifier
718
+ The block identifier, defaults to the latest block.
517
719
 
518
720
  Returns
519
721
  -------
@@ -521,7 +723,7 @@ class SystemViewer:
521
723
  """
522
724
  return_value = self._contract.functions.valuations(
523
725
  product_ids,
524
- ).call()
726
+ ).call(block_identifier=block_identifier)
525
727
  return [int(return_value_elem) for return_value_elem in return_value]
526
728
 
527
729
 
@@ -529,637 +731,658 @@ ABI = typing.cast(
529
731
  eth_typing.ABI,
530
732
  [
531
733
  {
532
- "inputs": [
533
- {"internalType": "address", "name": "target", "type": "address"}
534
- ],
535
- "name": "AddressEmptyCode",
536
- "type": "error",
537
- },
538
- {
539
- "inputs": [
540
- {"internalType": "address", "name": "implementation", "type": "address"}
541
- ],
542
- "name": "ERC1967InvalidImplementation",
543
- "type": "error",
544
- },
545
- {"inputs": [], "name": "ERC1967NonPayable", "type": "error"},
546
- {"inputs": [], "name": "FailedCall", "type": "error"},
547
- {"inputs": [], "name": "InvalidInitialization", "type": "error"},
548
- {
549
- "inputs": [{"internalType": "string", "name": "reason", "type": "string"}],
550
- "name": "InvalidParameters",
551
- "type": "error",
552
- },
553
- {"inputs": [], "name": "NotInitializing", "type": "error"},
554
- {
555
- "inputs": [{"internalType": "address", "name": "owner", "type": "address"}],
556
- "name": "OwnableInvalidOwner",
557
- "type": "error",
558
- },
559
- {
560
- "inputs": [
561
- {"internalType": "address", "name": "account", "type": "address"}
562
- ],
563
- "name": "OwnableUnauthorizedAccount",
564
- "type": "error",
565
- },
566
- {"inputs": [], "name": "UUPSUnauthorizedCallContext", "type": "error"},
567
- {
568
- "inputs": [{"internalType": "bytes32", "name": "slot", "type": "bytes32"}],
569
- "name": "UUPSUnsupportedProxiableUUID",
570
- "type": "error",
571
- },
572
- {
573
- "anonymous": False,
574
- "inputs": [
575
- {
576
- "indexed": False,
577
- "internalType": "uint64",
578
- "name": "version",
579
- "type": "uint64",
580
- }
581
- ],
582
- "name": "Initialized",
583
- "type": "event",
584
- },
585
- {
586
- "anonymous": False,
587
- "inputs": [
588
- {
589
- "indexed": True,
590
- "internalType": "address",
591
- "name": "previousOwner",
592
- "type": "address",
593
- },
594
- {
595
- "indexed": True,
596
- "internalType": "address",
597
- "name": "newOwner",
598
- "type": "address",
599
- },
600
- ],
601
- "name": "OwnershipTransferred",
602
- "type": "event",
603
- },
604
- {
605
- "anonymous": False,
606
- "inputs": [
607
- {
608
- "indexed": True,
609
- "internalType": "address",
610
- "name": "implementation",
611
- "type": "address",
612
- }
613
- ],
614
- "name": "Upgraded",
615
- "type": "event",
616
- },
617
- {
618
- "inputs": [],
734
+ "type": "function",
619
735
  "name": "UPGRADE_INTERFACE_VERSION",
620
- "outputs": [{"internalType": "string", "name": "", "type": "string"}],
736
+ "inputs": [],
737
+ "outputs": [{"name": "", "type": "string", "internalType": "string"}],
621
738
  "stateMutability": "view",
622
- "type": "function",
623
739
  },
624
740
  {
625
- "inputs": [],
741
+ "type": "function",
626
742
  "name": "clearing",
627
- "outputs": [
628
- {
629
- "internalType": "contract IClearingDiamond",
630
- "name": "",
631
- "type": "address",
632
- }
633
- ],
743
+ "inputs": [],
744
+ "outputs": [{"name": "", "type": "address", "internalType": "address"}],
634
745
  "stateMutability": "view",
635
- "type": "function",
636
746
  },
637
747
  {
748
+ "type": "function",
749
+ "name": "initialize",
638
750
  "inputs": [
751
+ {"name": "_clearing", "type": "address", "internalType": "address"},
639
752
  {
640
- "internalType": "contract IClearingDiamond",
641
- "name": "_clearing",
642
- "type": "address",
643
- },
644
- {
645
- "internalType": "contract IProductRegistry",
646
753
  "name": "_productRegistry",
647
754
  "type": "address",
755
+ "internalType": "contract IProductRegistry",
648
756
  },
649
757
  {
650
- "internalType": "contract IMarginAccountRegistry",
651
758
  "name": "_marginAccountRegistry",
652
759
  "type": "address",
760
+ "internalType": "contract IMarginAccountRegistry",
653
761
  },
654
762
  ],
655
- "name": "initialize",
656
763
  "outputs": [],
657
764
  "stateMutability": "nonpayable",
658
- "type": "function",
659
765
  },
660
766
  {
767
+ "type": "function",
768
+ "name": "maeByCollateralAsset",
661
769
  "inputs": [
662
770
  {
663
- "internalType": "address",
664
771
  "name": "collateralAsset",
665
772
  "type": "address",
773
+ "internalType": "address",
666
774
  },
667
- {"internalType": "address[]", "name": "accounts", "type": "address[]"},
775
+ {"name": "accounts", "type": "address[]", "internalType": "address[]"},
668
776
  ],
669
- "name": "maeByCollateralAsset",
670
777
  "outputs": [
671
- {"internalType": "int256[]", "name": "results", "type": "int256[]"}
778
+ {"name": "results", "type": "int256[]", "internalType": "int256[]"}
672
779
  ],
673
780
  "stateMutability": "view",
674
- "type": "function",
675
781
  },
676
782
  {
783
+ "type": "function",
784
+ "name": "maeByCollateralAssets",
677
785
  "inputs": [
678
786
  {
679
- "internalType": "address[]",
680
787
  "name": "collateralAssets",
681
788
  "type": "address[]",
789
+ "internalType": "address[]",
682
790
  },
683
- {"internalType": "address[]", "name": "accounts", "type": "address[]"},
791
+ {"name": "accounts", "type": "address[]", "internalType": "address[]"},
684
792
  ],
685
- "name": "maeByCollateralAssets",
686
793
  "outputs": [
687
- {"internalType": "int256[]", "name": "results", "type": "int256[]"}
794
+ {"name": "results", "type": "int256[]", "internalType": "int256[]"}
688
795
  ],
689
796
  "stateMutability": "view",
690
- "type": "function",
691
797
  },
692
798
  {
799
+ "type": "function",
800
+ "name": "maeChecks",
693
801
  "inputs": [
802
+ {"name": "accounts", "type": "address[]", "internalType": "address[]"},
694
803
  {
695
- "internalType": "address",
696
- "name": "collateralAsset",
697
- "type": "address",
698
- },
699
- {"internalType": "address[]", "name": "accounts", "type": "address[]"},
700
- {
804
+ "name": "settlements",
805
+ "type": "tuple[]",
806
+ "internalType": "struct Settlement[]",
701
807
  "components": [
702
808
  {
703
- "internalType": "bytes32",
704
- "name": "positionId",
809
+ "name": "productId",
705
810
  "type": "bytes32",
811
+ "internalType": "bytes32",
706
812
  },
707
813
  {
708
- "internalType": "int256",
709
814
  "name": "quantity",
710
815
  "type": "int256",
816
+ "internalType": "int256",
711
817
  },
712
- {"internalType": "uint256", "name": "price", "type": "uint256"},
818
+ {"name": "price", "type": "int256", "internalType": "int256"},
713
819
  ],
714
- "internalType": "struct IMarginAccount.Settlement[]",
715
- "name": "settlements",
716
- "type": "tuple[]",
717
820
  },
718
821
  ],
719
- "name": "maeChecksByCollateralAsset",
720
822
  "outputs": [
721
- {"internalType": "bool[]", "name": "results", "type": "bool[]"},
722
- {"internalType": "int256[]", "name": "maeAfter", "type": "int256[]"},
723
- {"internalType": "uint256[]", "name": "mmuAfter", "type": "uint256[]"},
823
+ {"name": "results", "type": "bool[]", "internalType": "bool[]"},
824
+ {"name": "maeAfter", "type": "int256[]", "internalType": "int256[]"},
825
+ {"name": "mmuAfter", "type": "uint256[]", "internalType": "uint256[]"},
724
826
  ],
725
827
  "stateMutability": "view",
726
- "type": "function",
727
828
  },
728
829
  {
729
- "inputs": [],
830
+ "type": "function",
730
831
  "name": "marginAccountRegistry",
832
+ "inputs": [],
731
833
  "outputs": [
732
834
  {
733
- "internalType": "contract IMarginAccountRegistry",
734
835
  "name": "",
735
836
  "type": "address",
837
+ "internalType": "contract IMarginAccountRegistry",
736
838
  }
737
839
  ],
738
840
  "stateMutability": "view",
739
- "type": "function",
740
841
  },
741
842
  {
742
- "inputs": [],
843
+ "type": "function",
743
844
  "name": "owner",
744
- "outputs": [{"internalType": "address", "name": "", "type": "address"}],
845
+ "inputs": [],
846
+ "outputs": [{"name": "", "type": "address", "internalType": "address"}],
745
847
  "stateMutability": "view",
848
+ },
849
+ {
746
850
  "type": "function",
851
+ "name": "positionQuantitiesByProductId",
852
+ "inputs": [
853
+ {"name": "productId", "type": "bytes32", "internalType": "bytes32"},
854
+ {"name": "accounts", "type": "address[]", "internalType": "address[]"},
855
+ ],
856
+ "outputs": [
857
+ {"name": "quantity", "type": "int256[]", "internalType": "int256[]"}
858
+ ],
859
+ "stateMutability": "view",
747
860
  },
748
861
  {
862
+ "type": "function",
863
+ "name": "positionQuantitiesByProductIds",
864
+ "inputs": [
865
+ {
866
+ "name": "productIds",
867
+ "type": "bytes32[]",
868
+ "internalType": "bytes32[]",
869
+ },
870
+ {"name": "accounts", "type": "address[]", "internalType": "address[]"},
871
+ ],
872
+ "outputs": [
873
+ {"name": "quantity", "type": "int256[]", "internalType": "int256[]"}
874
+ ],
875
+ "stateMutability": "view",
876
+ },
877
+ {
878
+ "type": "function",
879
+ "name": "positionsByCollateralAsset",
749
880
  "inputs": [
750
881
  {
751
- "internalType": "address",
752
882
  "name": "collateralAsset",
753
883
  "type": "address",
884
+ "internalType": "address",
754
885
  },
755
- {"internalType": "address[]", "name": "accounts", "type": "address[]"},
886
+ {"name": "accounts", "type": "address[]", "internalType": "address[]"},
756
887
  ],
757
- "name": "positionsByCollateralAsset",
758
888
  "outputs": [
759
889
  {
890
+ "name": "results",
891
+ "type": "tuple[][]",
892
+ "internalType": "struct PositionData[][]",
760
893
  "components": [
761
894
  {
762
- "internalType": "bytes32",
763
- "name": "positionId",
895
+ "name": "productId",
764
896
  "type": "bytes32",
897
+ "internalType": "bytes32",
765
898
  },
766
899
  {
767
- "internalType": "int256",
768
900
  "name": "quantity",
769
901
  "type": "int256",
902
+ "internalType": "int256",
770
903
  },
771
904
  {
772
- "internalType": "int256",
773
905
  "name": "costBasis",
774
906
  "type": "int256",
907
+ "internalType": "int256",
775
908
  },
776
909
  {
777
- "internalType": "uint256",
778
910
  "name": "maintenanceMargin",
779
911
  "type": "uint256",
912
+ "internalType": "uint256",
780
913
  },
781
- {"internalType": "int256", "name": "pnl", "type": "int256"},
914
+ {"name": "pnl", "type": "int256", "internalType": "int256"},
782
915
  ],
783
- "internalType": "struct IMarginAccount.PositionData[][]",
784
- "name": "results",
785
- "type": "tuple[][]",
786
916
  }
787
917
  ],
788
918
  "stateMutability": "view",
789
- "type": "function",
790
919
  },
791
920
  {
921
+ "type": "function",
922
+ "name": "positionsByCollateralAssets",
792
923
  "inputs": [
793
924
  {
794
- "internalType": "address[]",
795
925
  "name": "collateralAssets",
796
926
  "type": "address[]",
927
+ "internalType": "address[]",
797
928
  },
798
- {"internalType": "address[]", "name": "accounts", "type": "address[]"},
929
+ {"name": "accounts", "type": "address[]", "internalType": "address[]"},
799
930
  ],
800
- "name": "positionsByCollateralAssets",
801
931
  "outputs": [
802
932
  {
933
+ "name": "results",
934
+ "type": "tuple[][]",
935
+ "internalType": "struct PositionData[][]",
803
936
  "components": [
804
937
  {
805
- "internalType": "bytes32",
806
- "name": "positionId",
938
+ "name": "productId",
807
939
  "type": "bytes32",
940
+ "internalType": "bytes32",
808
941
  },
809
942
  {
810
- "internalType": "int256",
811
943
  "name": "quantity",
812
944
  "type": "int256",
945
+ "internalType": "int256",
813
946
  },
814
947
  {
815
- "internalType": "int256",
816
948
  "name": "costBasis",
817
949
  "type": "int256",
950
+ "internalType": "int256",
818
951
  },
819
952
  {
820
- "internalType": "uint256",
821
953
  "name": "maintenanceMargin",
822
954
  "type": "uint256",
955
+ "internalType": "uint256",
823
956
  },
824
- {"internalType": "int256", "name": "pnl", "type": "int256"},
957
+ {"name": "pnl", "type": "int256", "internalType": "int256"},
825
958
  ],
826
- "internalType": "struct IMarginAccount.PositionData[][]",
827
- "name": "results",
828
- "type": "tuple[][]",
829
959
  }
830
960
  ],
831
961
  "stateMutability": "view",
832
- "type": "function",
833
962
  },
834
963
  {
964
+ "type": "function",
965
+ "name": "productDetails",
835
966
  "inputs": [
836
- {"internalType": "bytes32[]", "name": "productIds", "type": "bytes32[]"}
967
+ {"name": "productIds", "type": "bytes32[]", "internalType": "bytes32[]"}
837
968
  ],
838
- "name": "productDetails",
839
969
  "outputs": [
840
970
  {
971
+ "name": "details",
972
+ "type": "tuple[]",
973
+ "internalType": "struct PredictionProductV1[]",
841
974
  "components": [
842
975
  {
976
+ "name": "base",
977
+ "type": "tuple",
978
+ "internalType": "struct BaseProduct",
843
979
  "components": [
844
980
  {
845
- "internalType": "address",
846
- "name": "builder",
847
- "type": "address",
981
+ "name": "metadata",
982
+ "type": "tuple",
983
+ "internalType": "struct ProductMetadata",
984
+ "components": [
985
+ {
986
+ "name": "builder",
987
+ "type": "address",
988
+ "internalType": "address",
989
+ },
990
+ {
991
+ "name": "symbol",
992
+ "type": "string",
993
+ "internalType": "string",
994
+ },
995
+ {
996
+ "name": "description",
997
+ "type": "string",
998
+ "internalType": "string",
999
+ },
1000
+ ],
848
1001
  },
849
1002
  {
850
- "internalType": "string",
851
- "name": "symbol",
852
- "type": "string",
1003
+ "name": "oracleSpec",
1004
+ "type": "tuple",
1005
+ "internalType": "struct OracleSpecification",
1006
+ "components": [
1007
+ {
1008
+ "name": "oracleAddress",
1009
+ "type": "address",
1010
+ "internalType": "address",
1011
+ },
1012
+ {
1013
+ "name": "fsvDecimals",
1014
+ "type": "uint8",
1015
+ "internalType": "uint8",
1016
+ },
1017
+ {
1018
+ "name": "fspAlpha",
1019
+ "type": "int256",
1020
+ "internalType": "int256",
1021
+ },
1022
+ {
1023
+ "name": "fspBeta",
1024
+ "type": "int256",
1025
+ "internalType": "int256",
1026
+ },
1027
+ {
1028
+ "name": "fsvCalldata",
1029
+ "type": "bytes",
1030
+ "internalType": "bytes",
1031
+ },
1032
+ ],
853
1033
  },
854
1034
  {
855
- "internalType": "string",
856
- "name": "description",
857
- "type": "string",
858
- },
859
- ],
860
- "internalType": "struct IProductRegistry.ProductMetadata",
861
- "name": "metadata",
862
- "type": "tuple",
863
- },
864
- {
865
- "components": [
866
- {
867
- "internalType": "address",
868
- "name": "oracleAddress",
1035
+ "name": "collateralAsset",
869
1036
  "type": "address",
1037
+ "internalType": "address",
870
1038
  },
871
1039
  {
872
- "internalType": "uint8",
873
- "name": "fsvDecimals",
874
- "type": "uint8",
1040
+ "name": "startTime",
1041
+ "type": "uint256",
1042
+ "internalType": "uint256",
875
1043
  },
876
1044
  {
877
- "internalType": "int256",
878
- "name": "fspAlpha",
879
- "type": "int256",
1045
+ "name": "pointValue",
1046
+ "type": "uint256",
1047
+ "internalType": "uint256",
880
1048
  },
881
1049
  {
882
- "internalType": "int256",
883
- "name": "fspBeta",
884
- "type": "int256",
1050
+ "name": "priceDecimals",
1051
+ "type": "uint8",
1052
+ "internalType": "uint8",
885
1053
  },
886
1054
  {
887
- "internalType": "bytes",
888
- "name": "fsvCalldata",
889
- "type": "bytes",
1055
+ "name": "extendedMetadata",
1056
+ "type": "string",
1057
+ "internalType": "string",
890
1058
  },
891
1059
  ],
892
- "internalType": "struct IProductRegistry.OracleSpecification",
893
- "name": "oracleSpec",
894
- "type": "tuple",
895
- },
896
- {
897
- "internalType": "string",
898
- "name": "priceQuotation",
899
- "type": "string",
900
1060
  },
901
1061
  {
902
- "internalType": "address",
903
- "name": "collateralAsset",
904
- "type": "address",
905
- },
906
- {
907
- "internalType": "uint256",
908
- "name": "startTime",
909
- "type": "uint256",
910
- },
911
- {
912
- "internalType": "uint256",
913
- "name": "earliestFSPSubmissionTime",
914
- "type": "uint256",
915
- },
916
- {
917
- "internalType": "uint256",
918
- "name": "unitValue",
919
- "type": "uint256",
920
- },
921
- {
922
- "internalType": "uint16",
923
- "name": "initialMarginRequirement",
924
- "type": "uint16",
925
- },
926
- {
927
- "internalType": "uint16",
928
- "name": "maintenanceMarginRequirement",
929
- "type": "uint16",
930
- },
931
- {
932
- "internalType": "uint64",
933
- "name": "auctionBounty",
934
- "type": "uint64",
1062
+ "name": "expirySpec",
1063
+ "type": "tuple",
1064
+ "internalType": "struct ExpirySpecification",
1065
+ "components": [
1066
+ {
1067
+ "name": "earliestFSPSubmissionTime",
1068
+ "type": "uint256",
1069
+ "internalType": "uint256",
1070
+ },
1071
+ {
1072
+ "name": "tradeoutInterval",
1073
+ "type": "uint256",
1074
+ "internalType": "uint256",
1075
+ },
1076
+ ],
935
1077
  },
936
1078
  {
937
- "internalType": "uint32",
938
- "name": "tradeoutInterval",
939
- "type": "uint32",
1079
+ "name": "maxPrice",
1080
+ "type": "int256",
1081
+ "internalType": "int256",
940
1082
  },
941
- {"internalType": "uint8", "name": "tickSize", "type": "uint8"},
942
1083
  {
943
- "internalType": "string",
944
- "name": "extendedMetadata",
945
- "type": "string",
1084
+ "name": "minPrice",
1085
+ "type": "int256",
1086
+ "internalType": "int256",
946
1087
  },
947
1088
  ],
948
- "internalType": "struct IProductRegistry.Product[]",
949
- "name": "details",
950
- "type": "tuple[]",
951
1089
  }
952
1090
  ],
953
1091
  "stateMutability": "view",
954
- "type": "function",
955
1092
  },
956
1093
  {
957
- "inputs": [],
1094
+ "type": "function",
958
1095
  "name": "productRegistry",
1096
+ "inputs": [],
959
1097
  "outputs": [
960
1098
  {
961
- "internalType": "contract IProductRegistry",
962
1099
  "name": "",
963
1100
  "type": "address",
1101
+ "internalType": "contract IProductRegistry",
964
1102
  }
965
1103
  ],
966
1104
  "stateMutability": "view",
967
- "type": "function",
968
1105
  },
969
1106
  {
1107
+ "type": "function",
1108
+ "name": "productStates",
970
1109
  "inputs": [
971
- {"internalType": "bytes32[]", "name": "productIds", "type": "bytes32[]"}
1110
+ {"name": "productIds", "type": "bytes32[]", "internalType": "bytes32[]"}
972
1111
  ],
973
- "name": "productStates",
974
1112
  "outputs": [
975
1113
  {
976
- "internalType": "enum ProductState[]",
977
1114
  "name": "states",
978
1115
  "type": "uint8[]",
1116
+ "internalType": "enum ProductState[]",
979
1117
  }
980
1118
  ],
981
1119
  "stateMutability": "view",
982
- "type": "function",
983
1120
  },
984
1121
  {
985
- "inputs": [],
1122
+ "type": "function",
986
1123
  "name": "proxiableUUID",
987
- "outputs": [{"internalType": "bytes32", "name": "", "type": "bytes32"}],
1124
+ "inputs": [],
1125
+ "outputs": [{"name": "", "type": "bytes32", "internalType": "bytes32"}],
988
1126
  "stateMutability": "view",
989
- "type": "function",
990
1127
  },
991
1128
  {
992
- "inputs": [],
1129
+ "type": "function",
993
1130
  "name": "renounceOwnership",
1131
+ "inputs": [],
994
1132
  "outputs": [],
995
1133
  "stateMutability": "nonpayable",
996
- "type": "function",
997
1134
  },
998
1135
  {
1136
+ "type": "function",
1137
+ "name": "transferOwnership",
999
1138
  "inputs": [
1000
- {"internalType": "address", "name": "newOwner", "type": "address"}
1139
+ {"name": "newOwner", "type": "address", "internalType": "address"}
1001
1140
  ],
1002
- "name": "transferOwnership",
1003
1141
  "outputs": [],
1004
1142
  "stateMutability": "nonpayable",
1005
- "type": "function",
1006
1143
  },
1007
1144
  {
1145
+ "type": "function",
1146
+ "name": "upgradeToAndCall",
1008
1147
  "inputs": [
1009
1148
  {
1010
- "internalType": "address",
1011
1149
  "name": "newImplementation",
1012
1150
  "type": "address",
1151
+ "internalType": "address",
1013
1152
  },
1014
- {"internalType": "bytes", "name": "data", "type": "bytes"},
1153
+ {"name": "data", "type": "bytes", "internalType": "bytes"},
1015
1154
  ],
1016
- "name": "upgradeToAndCall",
1017
1155
  "outputs": [],
1018
1156
  "stateMutability": "payable",
1019
- "type": "function",
1020
1157
  },
1021
1158
  {
1159
+ "type": "function",
1160
+ "name": "userMarginDataByCollateralAsset",
1022
1161
  "inputs": [
1023
1162
  {
1024
- "internalType": "address",
1025
1163
  "name": "collateralAsset",
1026
1164
  "type": "address",
1165
+ "internalType": "address",
1027
1166
  },
1028
- {"internalType": "address[]", "name": "accounts", "type": "address[]"},
1167
+ {"name": "accounts", "type": "address[]", "internalType": "address[]"},
1029
1168
  ],
1030
- "name": "userMarginDataByCollateralAsset",
1031
1169
  "outputs": [
1032
1170
  {
1171
+ "name": "data",
1172
+ "type": "tuple[]",
1173
+ "internalType": "struct ISystemViewer.UserMarginAccountData[]",
1033
1174
  "components": [
1034
1175
  {
1035
- "internalType": "address",
1036
1176
  "name": "collateralAsset",
1037
1177
  "type": "address",
1178
+ "internalType": "address",
1038
1179
  },
1039
1180
  {
1040
- "internalType": "address",
1041
1181
  "name": "marginAccountId",
1042
1182
  "type": "address",
1183
+ "internalType": "address",
1043
1184
  },
1044
- {"internalType": "int256", "name": "mae", "type": "int256"},
1045
- {"internalType": "uint256", "name": "mmu", "type": "uint256"},
1185
+ {"name": "mae", "type": "int256", "internalType": "int256"},
1186
+ {"name": "mmu", "type": "uint256", "internalType": "uint256"},
1046
1187
  {
1188
+ "name": "positions",
1189
+ "type": "tuple[]",
1190
+ "internalType": "struct PositionData[]",
1047
1191
  "components": [
1048
1192
  {
1049
- "internalType": "bytes32",
1050
- "name": "positionId",
1193
+ "name": "productId",
1051
1194
  "type": "bytes32",
1195
+ "internalType": "bytes32",
1052
1196
  },
1053
1197
  {
1054
- "internalType": "int256",
1055
1198
  "name": "quantity",
1056
1199
  "type": "int256",
1200
+ "internalType": "int256",
1057
1201
  },
1058
1202
  {
1059
- "internalType": "int256",
1060
1203
  "name": "costBasis",
1061
1204
  "type": "int256",
1205
+ "internalType": "int256",
1062
1206
  },
1063
1207
  {
1064
- "internalType": "uint256",
1065
1208
  "name": "maintenanceMargin",
1066
1209
  "type": "uint256",
1210
+ "internalType": "uint256",
1067
1211
  },
1068
1212
  {
1069
- "internalType": "int256",
1070
1213
  "name": "pnl",
1071
1214
  "type": "int256",
1215
+ "internalType": "int256",
1072
1216
  },
1073
1217
  ],
1074
- "internalType": "struct IMarginAccount.PositionData[]",
1075
- "name": "positions",
1076
- "type": "tuple[]",
1077
1218
  },
1078
1219
  ],
1079
- "internalType": "struct ISystemViewer.UserMarginAccountData[]",
1080
- "name": "data",
1081
- "type": "tuple[]",
1082
1220
  }
1083
1221
  ],
1084
1222
  "stateMutability": "view",
1085
- "type": "function",
1086
1223
  },
1087
1224
  {
1225
+ "type": "function",
1226
+ "name": "userMarginDataByCollateralAssets",
1088
1227
  "inputs": [
1089
1228
  {
1090
- "internalType": "address[]",
1091
1229
  "name": "collateralAssets",
1092
1230
  "type": "address[]",
1231
+ "internalType": "address[]",
1093
1232
  },
1094
- {"internalType": "address[]", "name": "accounts", "type": "address[]"},
1233
+ {"name": "accounts", "type": "address[]", "internalType": "address[]"},
1095
1234
  ],
1096
- "name": "userMarginDataByCollateralAssets",
1097
1235
  "outputs": [
1098
1236
  {
1237
+ "name": "data",
1238
+ "type": "tuple[]",
1239
+ "internalType": "struct ISystemViewer.UserMarginAccountData[]",
1099
1240
  "components": [
1100
1241
  {
1101
- "internalType": "address",
1102
1242
  "name": "collateralAsset",
1103
1243
  "type": "address",
1244
+ "internalType": "address",
1104
1245
  },
1105
1246
  {
1106
- "internalType": "address",
1107
1247
  "name": "marginAccountId",
1108
1248
  "type": "address",
1249
+ "internalType": "address",
1109
1250
  },
1110
- {"internalType": "int256", "name": "mae", "type": "int256"},
1111
- {"internalType": "uint256", "name": "mmu", "type": "uint256"},
1251
+ {"name": "mae", "type": "int256", "internalType": "int256"},
1252
+ {"name": "mmu", "type": "uint256", "internalType": "uint256"},
1112
1253
  {
1254
+ "name": "positions",
1255
+ "type": "tuple[]",
1256
+ "internalType": "struct PositionData[]",
1113
1257
  "components": [
1114
1258
  {
1115
- "internalType": "bytes32",
1116
- "name": "positionId",
1259
+ "name": "productId",
1117
1260
  "type": "bytes32",
1261
+ "internalType": "bytes32",
1118
1262
  },
1119
1263
  {
1120
- "internalType": "int256",
1121
1264
  "name": "quantity",
1122
1265
  "type": "int256",
1266
+ "internalType": "int256",
1123
1267
  },
1124
1268
  {
1125
- "internalType": "int256",
1126
1269
  "name": "costBasis",
1127
1270
  "type": "int256",
1271
+ "internalType": "int256",
1128
1272
  },
1129
1273
  {
1130
- "internalType": "uint256",
1131
1274
  "name": "maintenanceMargin",
1132
1275
  "type": "uint256",
1276
+ "internalType": "uint256",
1133
1277
  },
1134
1278
  {
1135
- "internalType": "int256",
1136
1279
  "name": "pnl",
1137
1280
  "type": "int256",
1281
+ "internalType": "int256",
1138
1282
  },
1139
1283
  ],
1140
- "internalType": "struct IMarginAccount.PositionData[]",
1141
- "name": "positions",
1142
- "type": "tuple[]",
1143
1284
  },
1144
1285
  ],
1145
- "internalType": "struct ISystemViewer.UserMarginAccountData[]",
1146
- "name": "data",
1147
- "type": "tuple[]",
1148
1286
  }
1149
1287
  ],
1150
1288
  "stateMutability": "view",
1151
- "type": "function",
1152
1289
  },
1153
1290
  {
1291
+ "type": "function",
1292
+ "name": "valuations",
1154
1293
  "inputs": [
1155
- {"internalType": "bytes32[]", "name": "productIds", "type": "bytes32[]"}
1294
+ {"name": "productIds", "type": "bytes32[]", "internalType": "bytes32[]"}
1156
1295
  ],
1157
- "name": "valuations",
1158
1296
  "outputs": [
1159
- {"internalType": "uint256[]", "name": "prices", "type": "uint256[]"}
1297
+ {"name": "prices", "type": "int256[]", "internalType": "int256[]"}
1160
1298
  ],
1161
1299
  "stateMutability": "view",
1162
- "type": "function",
1300
+ },
1301
+ {
1302
+ "type": "event",
1303
+ "name": "Initialized",
1304
+ "inputs": [
1305
+ {
1306
+ "name": "version",
1307
+ "type": "uint64",
1308
+ "indexed": False,
1309
+ "internalType": "uint64",
1310
+ }
1311
+ ],
1312
+ "anonymous": False,
1313
+ },
1314
+ {
1315
+ "type": "event",
1316
+ "name": "OwnershipTransferred",
1317
+ "inputs": [
1318
+ {
1319
+ "name": "previousOwner",
1320
+ "type": "address",
1321
+ "indexed": True,
1322
+ "internalType": "address",
1323
+ },
1324
+ {
1325
+ "name": "newOwner",
1326
+ "type": "address",
1327
+ "indexed": True,
1328
+ "internalType": "address",
1329
+ },
1330
+ ],
1331
+ "anonymous": False,
1332
+ },
1333
+ {
1334
+ "type": "event",
1335
+ "name": "Upgraded",
1336
+ "inputs": [
1337
+ {
1338
+ "name": "implementation",
1339
+ "type": "address",
1340
+ "indexed": True,
1341
+ "internalType": "address",
1342
+ }
1343
+ ],
1344
+ "anonymous": False,
1345
+ },
1346
+ {
1347
+ "type": "error",
1348
+ "name": "AddressEmptyCode",
1349
+ "inputs": [
1350
+ {"name": "target", "type": "address", "internalType": "address"}
1351
+ ],
1352
+ },
1353
+ {
1354
+ "type": "error",
1355
+ "name": "ERC1967InvalidImplementation",
1356
+ "inputs": [
1357
+ {"name": "implementation", "type": "address", "internalType": "address"}
1358
+ ],
1359
+ },
1360
+ {"type": "error", "name": "ERC1967NonPayable", "inputs": []},
1361
+ {"type": "error", "name": "FailedCall", "inputs": []},
1362
+ {"type": "error", "name": "InvalidInitialization", "inputs": []},
1363
+ {
1364
+ "type": "error",
1365
+ "name": "InvalidParameters",
1366
+ "inputs": [{"name": "reason", "type": "string", "internalType": "string"}],
1367
+ },
1368
+ {"type": "error", "name": "NotInitializing", "inputs": []},
1369
+ {
1370
+ "type": "error",
1371
+ "name": "OwnableInvalidOwner",
1372
+ "inputs": [{"name": "owner", "type": "address", "internalType": "address"}],
1373
+ },
1374
+ {
1375
+ "type": "error",
1376
+ "name": "OwnableUnauthorizedAccount",
1377
+ "inputs": [
1378
+ {"name": "account", "type": "address", "internalType": "address"}
1379
+ ],
1380
+ },
1381
+ {"type": "error", "name": "UUPSUnauthorizedCallContext", "inputs": []},
1382
+ {
1383
+ "type": "error",
1384
+ "name": "UUPSUnsupportedProxiableUUID",
1385
+ "inputs": [{"name": "slot", "type": "bytes32", "internalType": "bytes32"}],
1163
1386
  },
1164
1387
  ],
1165
1388
  )