afp-sdk 0.2.0__py3-none-any.whl → 0.2.2__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.
@@ -0,0 +1,1171 @@
1
+ """SystemViewer contract binding and data structures."""
2
+
3
+ # This module has been generated using pyabigen v0.2.16
4
+
5
+ import typing
6
+ from dataclasses import dataclass
7
+
8
+ import eth_typing
9
+ import hexbytes
10
+ import web3
11
+ from web3.contract import contract
12
+
13
+ from .margin_account import Settlement, PositionData
14
+ from .product_registry import (
15
+ OracleSpecification,
16
+ Product,
17
+ ProductMetadata,
18
+ ProductState,
19
+ )
20
+
21
+
22
+ @dataclass
23
+ class UserMarginAccountData:
24
+ """Port of `struct UserMarginAccountData` on the ISystemViewer contract."""
25
+
26
+ collateral_asset: eth_typing.ChecksumAddress
27
+ margin_account_id: eth_typing.ChecksumAddress
28
+ mae: int
29
+ mmu: int
30
+ positions: typing.List[PositionData]
31
+
32
+
33
+ class SystemViewer:
34
+ """SystemViewer contract binding.
35
+
36
+ Parameters
37
+ ----------
38
+ w3 : web3.Web3
39
+ address : eth_typing.ChecksumAddress
40
+ The address of a deployed SystemViewer contract.
41
+ """
42
+
43
+ _contract: contract.Contract
44
+
45
+ def __init__(
46
+ self,
47
+ w3: web3.Web3,
48
+ address: eth_typing.ChecksumAddress,
49
+ ):
50
+ self._contract = w3.eth.contract(
51
+ address=address,
52
+ abi=ABI,
53
+ )
54
+
55
+ @property
56
+ def Initialized(self) -> contract.ContractEvent:
57
+ """Binding for `event Initialized` on the SystemViewer contract."""
58
+ return self._contract.events.Initialized
59
+
60
+ @property
61
+ def OwnershipTransferred(self) -> contract.ContractEvent:
62
+ """Binding for `event OwnershipTransferred` on the SystemViewer contract."""
63
+ return self._contract.events.OwnershipTransferred
64
+
65
+ @property
66
+ def Upgraded(self) -> contract.ContractEvent:
67
+ """Binding for `event Upgraded` on the SystemViewer contract."""
68
+ return self._contract.events.Upgraded
69
+
70
+ def upgrade_interface_version(
71
+ self,
72
+ ) -> str:
73
+ """Binding for `UPGRADE_INTERFACE_VERSION` on the SystemViewer contract.
74
+
75
+ Returns
76
+ -------
77
+ str
78
+ """
79
+ return_value = self._contract.functions.UPGRADE_INTERFACE_VERSION().call()
80
+ return str(return_value)
81
+
82
+ def clearing(
83
+ self,
84
+ ) -> eth_typing.ChecksumAddress:
85
+ """Binding for `clearing` on the SystemViewer contract.
86
+
87
+ Returns
88
+ -------
89
+ eth_typing.ChecksumAddress
90
+ """
91
+ return_value = self._contract.functions.clearing().call()
92
+ return eth_typing.ChecksumAddress(return_value)
93
+
94
+ def initialize(
95
+ self,
96
+ _clearing: eth_typing.ChecksumAddress,
97
+ _product_registry: eth_typing.ChecksumAddress,
98
+ _margin_account_registry: eth_typing.ChecksumAddress,
99
+ ) -> contract.ContractFunction:
100
+ """Binding for `initialize` on the SystemViewer contract.
101
+
102
+ Parameters
103
+ ----------
104
+ _clearing : eth_typing.ChecksumAddress
105
+ _product_registry : eth_typing.ChecksumAddress
106
+ _margin_account_registry : eth_typing.ChecksumAddress
107
+
108
+ Returns
109
+ -------
110
+ web3.contract.contract.ContractFunction
111
+ A contract function instance to be sent in a transaction.
112
+ """
113
+ return self._contract.functions.initialize(
114
+ _clearing,
115
+ _product_registry,
116
+ _margin_account_registry,
117
+ )
118
+
119
+ def mae_by_collateral_asset(
120
+ self,
121
+ collateral_asset: eth_typing.ChecksumAddress,
122
+ accounts: typing.List[eth_typing.ChecksumAddress],
123
+ ) -> typing.List[int]:
124
+ """Binding for `maeByCollateralAsset` on the SystemViewer contract.
125
+
126
+ Parameters
127
+ ----------
128
+ collateral_asset : eth_typing.ChecksumAddress
129
+ accounts : typing.List[eth_typing.ChecksumAddress]
130
+
131
+ Returns
132
+ -------
133
+ typing.List[int]
134
+ """
135
+ return_value = self._contract.functions.maeByCollateralAsset(
136
+ collateral_asset,
137
+ accounts,
138
+ ).call()
139
+ return [int(return_value_elem) for return_value_elem in return_value]
140
+
141
+ def mae_by_collateral_assets(
142
+ self,
143
+ collateral_assets: typing.List[eth_typing.ChecksumAddress],
144
+ accounts: typing.List[eth_typing.ChecksumAddress],
145
+ ) -> typing.List[int]:
146
+ """Binding for `maeByCollateralAssets` on the SystemViewer contract.
147
+
148
+ Parameters
149
+ ----------
150
+ collateral_assets : typing.List[eth_typing.ChecksumAddress]
151
+ accounts : typing.List[eth_typing.ChecksumAddress]
152
+
153
+ Returns
154
+ -------
155
+ typing.List[int]
156
+ """
157
+ return_value = self._contract.functions.maeByCollateralAssets(
158
+ collateral_assets,
159
+ accounts,
160
+ ).call()
161
+ return [int(return_value_elem) for return_value_elem in return_value]
162
+
163
+ def mae_checks_by_collateral_asset(
164
+ self,
165
+ collateral_asset: eth_typing.ChecksumAddress,
166
+ accounts: typing.List[eth_typing.ChecksumAddress],
167
+ settlements: typing.List[Settlement],
168
+ ) -> typing.Tuple[typing.List[bool], typing.List[int], typing.List[int]]:
169
+ """Binding for `maeChecksByCollateralAsset` on the SystemViewer contract.
170
+
171
+ Parameters
172
+ ----------
173
+ collateral_asset : eth_typing.ChecksumAddress
174
+ accounts : typing.List[eth_typing.ChecksumAddress]
175
+ settlements : typing.List[Settlement]
176
+
177
+ Returns
178
+ -------
179
+ typing.List[bool]
180
+ typing.List[int]
181
+ typing.List[int]
182
+ """
183
+ return_value = self._contract.functions.maeChecksByCollateralAsset(
184
+ collateral_asset,
185
+ accounts,
186
+ [(item.position_id, item.quantity, item.price) for item in settlements],
187
+ ).call()
188
+ return (
189
+ [bool(return_value0_elem) for return_value0_elem in return_value[0]],
190
+ [int(return_value1_elem) for return_value1_elem in return_value[1]],
191
+ [int(return_value2_elem) for return_value2_elem in return_value[2]],
192
+ )
193
+
194
+ def margin_account_registry(
195
+ self,
196
+ ) -> eth_typing.ChecksumAddress:
197
+ """Binding for `marginAccountRegistry` on the SystemViewer contract.
198
+
199
+ Returns
200
+ -------
201
+ eth_typing.ChecksumAddress
202
+ """
203
+ return_value = self._contract.functions.marginAccountRegistry().call()
204
+ return eth_typing.ChecksumAddress(return_value)
205
+
206
+ def owner(
207
+ self,
208
+ ) -> eth_typing.ChecksumAddress:
209
+ """Binding for `owner` on the SystemViewer contract.
210
+
211
+ Returns
212
+ -------
213
+ eth_typing.ChecksumAddress
214
+ """
215
+ return_value = self._contract.functions.owner().call()
216
+ return eth_typing.ChecksumAddress(return_value)
217
+
218
+ def positions_by_collateral_asset(
219
+ self,
220
+ collateral_asset: eth_typing.ChecksumAddress,
221
+ accounts: typing.List[eth_typing.ChecksumAddress],
222
+ ) -> typing.List[typing.List[PositionData]]:
223
+ """Binding for `positionsByCollateralAsset` on the SystemViewer contract.
224
+
225
+ Parameters
226
+ ----------
227
+ collateral_asset : eth_typing.ChecksumAddress
228
+ accounts : typing.List[eth_typing.ChecksumAddress]
229
+
230
+ Returns
231
+ -------
232
+ typing.List[typing.List[PositionData]]
233
+ """
234
+ return_value = self._contract.functions.positionsByCollateralAsset(
235
+ collateral_asset,
236
+ accounts,
237
+ ).call()
238
+ return [
239
+ [
240
+ PositionData(
241
+ hexbytes.HexBytes(return_value_elem[0]),
242
+ int(return_value_elem[1]),
243
+ int(return_value_elem[2]),
244
+ int(return_value_elem[3]),
245
+ int(return_value_elem[4]),
246
+ )
247
+ for return_value_elem in return_value_list0
248
+ ]
249
+ for return_value_list0 in return_value
250
+ ]
251
+
252
+ def positions_by_collateral_assets(
253
+ self,
254
+ collateral_assets: typing.List[eth_typing.ChecksumAddress],
255
+ accounts: typing.List[eth_typing.ChecksumAddress],
256
+ ) -> typing.List[typing.List[PositionData]]:
257
+ """Binding for `positionsByCollateralAssets` on the SystemViewer contract.
258
+
259
+ Parameters
260
+ ----------
261
+ collateral_assets : typing.List[eth_typing.ChecksumAddress]
262
+ accounts : typing.List[eth_typing.ChecksumAddress]
263
+
264
+ Returns
265
+ -------
266
+ typing.List[typing.List[PositionData]]
267
+ """
268
+ return_value = self._contract.functions.positionsByCollateralAssets(
269
+ collateral_assets,
270
+ accounts,
271
+ ).call()
272
+ return [
273
+ [
274
+ PositionData(
275
+ hexbytes.HexBytes(return_value_elem[0]),
276
+ int(return_value_elem[1]),
277
+ int(return_value_elem[2]),
278
+ int(return_value_elem[3]),
279
+ int(return_value_elem[4]),
280
+ )
281
+ for return_value_elem in return_value_list0
282
+ ]
283
+ for return_value_list0 in return_value
284
+ ]
285
+
286
+ def product_details(
287
+ self,
288
+ product_ids: typing.List[hexbytes.HexBytes],
289
+ ) -> typing.List[Product]:
290
+ """Binding for `productDetails` on the SystemViewer contract.
291
+
292
+ Parameters
293
+ ----------
294
+ product_ids : typing.List[hexbytes.HexBytes]
295
+
296
+ Returns
297
+ -------
298
+ typing.List[Product]
299
+ """
300
+ return_value = self._contract.functions.productDetails(
301
+ product_ids,
302
+ ).call()
303
+ 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]),
309
+ ),
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]),
316
+ ),
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
+ int(return_value_elem[12]),
328
+ str(return_value_elem[13]),
329
+ )
330
+ for return_value_elem in return_value
331
+ ]
332
+
333
+ def product_registry(
334
+ self,
335
+ ) -> eth_typing.ChecksumAddress:
336
+ """Binding for `productRegistry` on the SystemViewer contract.
337
+
338
+ Returns
339
+ -------
340
+ eth_typing.ChecksumAddress
341
+ """
342
+ return_value = self._contract.functions.productRegistry().call()
343
+ return eth_typing.ChecksumAddress(return_value)
344
+
345
+ def product_states(
346
+ self,
347
+ product_ids: typing.List[hexbytes.HexBytes],
348
+ ) -> typing.List[ProductState]:
349
+ """Binding for `productStates` on the SystemViewer contract.
350
+
351
+ Parameters
352
+ ----------
353
+ product_ids : typing.List[hexbytes.HexBytes]
354
+
355
+ Returns
356
+ -------
357
+ typing.List[ProductState]
358
+ """
359
+ return_value = self._contract.functions.productStates(
360
+ product_ids,
361
+ ).call()
362
+ return [ProductState(return_value_elem) for return_value_elem in return_value]
363
+
364
+ def proxiable_uuid(
365
+ self,
366
+ ) -> hexbytes.HexBytes:
367
+ """Binding for `proxiableUUID` on the SystemViewer contract.
368
+
369
+ Returns
370
+ -------
371
+ hexbytes.HexBytes
372
+ """
373
+ return_value = self._contract.functions.proxiableUUID().call()
374
+ return hexbytes.HexBytes(return_value)
375
+
376
+ def renounce_ownership(
377
+ self,
378
+ ) -> contract.ContractFunction:
379
+ """Binding for `renounceOwnership` on the SystemViewer contract.
380
+
381
+ Returns
382
+ -------
383
+ web3.contract.contract.ContractFunction
384
+ A contract function instance to be sent in a transaction.
385
+ """
386
+ return self._contract.functions.renounceOwnership()
387
+
388
+ def transfer_ownership(
389
+ self,
390
+ new_owner: eth_typing.ChecksumAddress,
391
+ ) -> contract.ContractFunction:
392
+ """Binding for `transferOwnership` on the SystemViewer contract.
393
+
394
+ Parameters
395
+ ----------
396
+ new_owner : eth_typing.ChecksumAddress
397
+
398
+ Returns
399
+ -------
400
+ web3.contract.contract.ContractFunction
401
+ A contract function instance to be sent in a transaction.
402
+ """
403
+ return self._contract.functions.transferOwnership(
404
+ new_owner,
405
+ )
406
+
407
+ def upgrade_to_and_call(
408
+ self,
409
+ new_implementation: eth_typing.ChecksumAddress,
410
+ data: hexbytes.HexBytes,
411
+ ) -> contract.ContractFunction:
412
+ """Binding for `upgradeToAndCall` on the SystemViewer contract.
413
+
414
+ Parameters
415
+ ----------
416
+ new_implementation : eth_typing.ChecksumAddress
417
+ data : hexbytes.HexBytes
418
+
419
+ Returns
420
+ -------
421
+ web3.contract.contract.ContractFunction
422
+ A contract function instance to be sent in a transaction.
423
+ """
424
+ return self._contract.functions.upgradeToAndCall(
425
+ new_implementation,
426
+ data,
427
+ )
428
+
429
+ def user_margin_data_by_collateral_asset(
430
+ self,
431
+ collateral_asset: eth_typing.ChecksumAddress,
432
+ accounts: typing.List[eth_typing.ChecksumAddress],
433
+ ) -> typing.List[UserMarginAccountData]:
434
+ """Binding for `userMarginDataByCollateralAsset` on the SystemViewer contract.
435
+
436
+ Parameters
437
+ ----------
438
+ collateral_asset : eth_typing.ChecksumAddress
439
+ accounts : typing.List[eth_typing.ChecksumAddress]
440
+
441
+ Returns
442
+ -------
443
+ typing.List[UserMarginAccountData]
444
+ """
445
+ return_value = self._contract.functions.userMarginDataByCollateralAsset(
446
+ collateral_asset,
447
+ accounts,
448
+ ).call()
449
+ return [
450
+ UserMarginAccountData(
451
+ eth_typing.ChecksumAddress(return_value_elem[0]),
452
+ eth_typing.ChecksumAddress(return_value_elem[1]),
453
+ int(return_value_elem[2]),
454
+ int(return_value_elem[3]),
455
+ [
456
+ PositionData(
457
+ hexbytes.HexBytes(return_value_elem4_elem[0]),
458
+ int(return_value_elem4_elem[1]),
459
+ int(return_value_elem4_elem[2]),
460
+ int(return_value_elem4_elem[3]),
461
+ int(return_value_elem4_elem[4]),
462
+ )
463
+ for return_value_elem4_elem in return_value_elem[4]
464
+ ],
465
+ )
466
+ for return_value_elem in return_value
467
+ ]
468
+
469
+ def user_margin_data_by_collateral_assets(
470
+ self,
471
+ collateral_assets: typing.List[eth_typing.ChecksumAddress],
472
+ accounts: typing.List[eth_typing.ChecksumAddress],
473
+ ) -> typing.List[UserMarginAccountData]:
474
+ """Binding for `userMarginDataByCollateralAssets` on the SystemViewer contract.
475
+
476
+ Parameters
477
+ ----------
478
+ collateral_assets : typing.List[eth_typing.ChecksumAddress]
479
+ accounts : typing.List[eth_typing.ChecksumAddress]
480
+
481
+ Returns
482
+ -------
483
+ typing.List[UserMarginAccountData]
484
+ """
485
+ return_value = self._contract.functions.userMarginDataByCollateralAssets(
486
+ collateral_assets,
487
+ accounts,
488
+ ).call()
489
+ return [
490
+ UserMarginAccountData(
491
+ eth_typing.ChecksumAddress(return_value_elem[0]),
492
+ eth_typing.ChecksumAddress(return_value_elem[1]),
493
+ int(return_value_elem[2]),
494
+ int(return_value_elem[3]),
495
+ [
496
+ PositionData(
497
+ hexbytes.HexBytes(return_value_elem4_elem[0]),
498
+ int(return_value_elem4_elem[1]),
499
+ int(return_value_elem4_elem[2]),
500
+ int(return_value_elem4_elem[3]),
501
+ int(return_value_elem4_elem[4]),
502
+ )
503
+ for return_value_elem4_elem in return_value_elem[4]
504
+ ],
505
+ )
506
+ for return_value_elem in return_value
507
+ ]
508
+
509
+ def valuations(
510
+ self,
511
+ product_ids: typing.List[hexbytes.HexBytes],
512
+ ) -> typing.List[int]:
513
+ """Binding for `valuations` on the SystemViewer contract.
514
+
515
+ Parameters
516
+ ----------
517
+ product_ids : typing.List[hexbytes.HexBytes]
518
+
519
+ Returns
520
+ -------
521
+ typing.List[int]
522
+ """
523
+ return_value = self._contract.functions.valuations(
524
+ product_ids,
525
+ ).call()
526
+ return [int(return_value_elem) for return_value_elem in return_value]
527
+
528
+
529
+ ABI = typing.cast(
530
+ eth_typing.ABI,
531
+ [
532
+ {
533
+ "inputs": [
534
+ {"internalType": "address", "name": "target", "type": "address"}
535
+ ],
536
+ "name": "AddressEmptyCode",
537
+ "type": "error",
538
+ },
539
+ {
540
+ "inputs": [
541
+ {"internalType": "address", "name": "implementation", "type": "address"}
542
+ ],
543
+ "name": "ERC1967InvalidImplementation",
544
+ "type": "error",
545
+ },
546
+ {"inputs": [], "name": "ERC1967NonPayable", "type": "error"},
547
+ {"inputs": [], "name": "FailedCall", "type": "error"},
548
+ {"inputs": [], "name": "InvalidInitialization", "type": "error"},
549
+ {
550
+ "inputs": [{"internalType": "string", "name": "reason", "type": "string"}],
551
+ "name": "InvalidParameters",
552
+ "type": "error",
553
+ },
554
+ {"inputs": [], "name": "NotInitializing", "type": "error"},
555
+ {
556
+ "inputs": [{"internalType": "address", "name": "owner", "type": "address"}],
557
+ "name": "OwnableInvalidOwner",
558
+ "type": "error",
559
+ },
560
+ {
561
+ "inputs": [
562
+ {"internalType": "address", "name": "account", "type": "address"}
563
+ ],
564
+ "name": "OwnableUnauthorizedAccount",
565
+ "type": "error",
566
+ },
567
+ {"inputs": [], "name": "UUPSUnauthorizedCallContext", "type": "error"},
568
+ {
569
+ "inputs": [{"internalType": "bytes32", "name": "slot", "type": "bytes32"}],
570
+ "name": "UUPSUnsupportedProxiableUUID",
571
+ "type": "error",
572
+ },
573
+ {
574
+ "anonymous": False,
575
+ "inputs": [
576
+ {
577
+ "indexed": False,
578
+ "internalType": "uint64",
579
+ "name": "version",
580
+ "type": "uint64",
581
+ }
582
+ ],
583
+ "name": "Initialized",
584
+ "type": "event",
585
+ },
586
+ {
587
+ "anonymous": False,
588
+ "inputs": [
589
+ {
590
+ "indexed": True,
591
+ "internalType": "address",
592
+ "name": "previousOwner",
593
+ "type": "address",
594
+ },
595
+ {
596
+ "indexed": True,
597
+ "internalType": "address",
598
+ "name": "newOwner",
599
+ "type": "address",
600
+ },
601
+ ],
602
+ "name": "OwnershipTransferred",
603
+ "type": "event",
604
+ },
605
+ {
606
+ "anonymous": False,
607
+ "inputs": [
608
+ {
609
+ "indexed": True,
610
+ "internalType": "address",
611
+ "name": "implementation",
612
+ "type": "address",
613
+ }
614
+ ],
615
+ "name": "Upgraded",
616
+ "type": "event",
617
+ },
618
+ {
619
+ "inputs": [],
620
+ "name": "UPGRADE_INTERFACE_VERSION",
621
+ "outputs": [{"internalType": "string", "name": "", "type": "string"}],
622
+ "stateMutability": "view",
623
+ "type": "function",
624
+ },
625
+ {
626
+ "inputs": [],
627
+ "name": "clearing",
628
+ "outputs": [
629
+ {
630
+ "internalType": "contract IClearingDiamond",
631
+ "name": "",
632
+ "type": "address",
633
+ }
634
+ ],
635
+ "stateMutability": "view",
636
+ "type": "function",
637
+ },
638
+ {
639
+ "inputs": [
640
+ {
641
+ "internalType": "contract IClearingDiamond",
642
+ "name": "_clearing",
643
+ "type": "address",
644
+ },
645
+ {
646
+ "internalType": "contract IProductRegistry",
647
+ "name": "_productRegistry",
648
+ "type": "address",
649
+ },
650
+ {
651
+ "internalType": "contract IMarginAccountRegistry",
652
+ "name": "_marginAccountRegistry",
653
+ "type": "address",
654
+ },
655
+ ],
656
+ "name": "initialize",
657
+ "outputs": [],
658
+ "stateMutability": "nonpayable",
659
+ "type": "function",
660
+ },
661
+ {
662
+ "inputs": [
663
+ {
664
+ "internalType": "address",
665
+ "name": "collateralAsset",
666
+ "type": "address",
667
+ },
668
+ {"internalType": "address[]", "name": "accounts", "type": "address[]"},
669
+ ],
670
+ "name": "maeByCollateralAsset",
671
+ "outputs": [
672
+ {"internalType": "int256[]", "name": "results", "type": "int256[]"}
673
+ ],
674
+ "stateMutability": "view",
675
+ "type": "function",
676
+ },
677
+ {
678
+ "inputs": [
679
+ {
680
+ "internalType": "address[]",
681
+ "name": "collateralAssets",
682
+ "type": "address[]",
683
+ },
684
+ {"internalType": "address[]", "name": "accounts", "type": "address[]"},
685
+ ],
686
+ "name": "maeByCollateralAssets",
687
+ "outputs": [
688
+ {"internalType": "int256[]", "name": "results", "type": "int256[]"}
689
+ ],
690
+ "stateMutability": "view",
691
+ "type": "function",
692
+ },
693
+ {
694
+ "inputs": [
695
+ {
696
+ "internalType": "address",
697
+ "name": "collateralAsset",
698
+ "type": "address",
699
+ },
700
+ {"internalType": "address[]", "name": "accounts", "type": "address[]"},
701
+ {
702
+ "components": [
703
+ {
704
+ "internalType": "bytes32",
705
+ "name": "positionId",
706
+ "type": "bytes32",
707
+ },
708
+ {
709
+ "internalType": "int256",
710
+ "name": "quantity",
711
+ "type": "int256",
712
+ },
713
+ {"internalType": "uint256", "name": "price", "type": "uint256"},
714
+ ],
715
+ "internalType": "struct IMarginAccount.Settlement[]",
716
+ "name": "settlements",
717
+ "type": "tuple[]",
718
+ },
719
+ ],
720
+ "name": "maeChecksByCollateralAsset",
721
+ "outputs": [
722
+ {"internalType": "bool[]", "name": "results", "type": "bool[]"},
723
+ {"internalType": "int256[]", "name": "maeAfter", "type": "int256[]"},
724
+ {"internalType": "uint256[]", "name": "mmuAfter", "type": "uint256[]"},
725
+ ],
726
+ "stateMutability": "view",
727
+ "type": "function",
728
+ },
729
+ {
730
+ "inputs": [],
731
+ "name": "marginAccountRegistry",
732
+ "outputs": [
733
+ {
734
+ "internalType": "contract IMarginAccountRegistry",
735
+ "name": "",
736
+ "type": "address",
737
+ }
738
+ ],
739
+ "stateMutability": "view",
740
+ "type": "function",
741
+ },
742
+ {
743
+ "inputs": [],
744
+ "name": "owner",
745
+ "outputs": [{"internalType": "address", "name": "", "type": "address"}],
746
+ "stateMutability": "view",
747
+ "type": "function",
748
+ },
749
+ {
750
+ "inputs": [
751
+ {
752
+ "internalType": "address",
753
+ "name": "collateralAsset",
754
+ "type": "address",
755
+ },
756
+ {"internalType": "address[]", "name": "accounts", "type": "address[]"},
757
+ ],
758
+ "name": "positionsByCollateralAsset",
759
+ "outputs": [
760
+ {
761
+ "components": [
762
+ {
763
+ "internalType": "bytes32",
764
+ "name": "positionId",
765
+ "type": "bytes32",
766
+ },
767
+ {
768
+ "internalType": "int256",
769
+ "name": "quantity",
770
+ "type": "int256",
771
+ },
772
+ {
773
+ "internalType": "int256",
774
+ "name": "costBasis",
775
+ "type": "int256",
776
+ },
777
+ {
778
+ "internalType": "uint256",
779
+ "name": "maintenanceMargin",
780
+ "type": "uint256",
781
+ },
782
+ {"internalType": "int256", "name": "pnl", "type": "int256"},
783
+ ],
784
+ "internalType": "struct IMarginAccount.PositionData[][]",
785
+ "name": "results",
786
+ "type": "tuple[][]",
787
+ }
788
+ ],
789
+ "stateMutability": "view",
790
+ "type": "function",
791
+ },
792
+ {
793
+ "inputs": [
794
+ {
795
+ "internalType": "address[]",
796
+ "name": "collateralAssets",
797
+ "type": "address[]",
798
+ },
799
+ {"internalType": "address[]", "name": "accounts", "type": "address[]"},
800
+ ],
801
+ "name": "positionsByCollateralAssets",
802
+ "outputs": [
803
+ {
804
+ "components": [
805
+ {
806
+ "internalType": "bytes32",
807
+ "name": "positionId",
808
+ "type": "bytes32",
809
+ },
810
+ {
811
+ "internalType": "int256",
812
+ "name": "quantity",
813
+ "type": "int256",
814
+ },
815
+ {
816
+ "internalType": "int256",
817
+ "name": "costBasis",
818
+ "type": "int256",
819
+ },
820
+ {
821
+ "internalType": "uint256",
822
+ "name": "maintenanceMargin",
823
+ "type": "uint256",
824
+ },
825
+ {"internalType": "int256", "name": "pnl", "type": "int256"},
826
+ ],
827
+ "internalType": "struct IMarginAccount.PositionData[][]",
828
+ "name": "results",
829
+ "type": "tuple[][]",
830
+ }
831
+ ],
832
+ "stateMutability": "view",
833
+ "type": "function",
834
+ },
835
+ {
836
+ "inputs": [
837
+ {"internalType": "bytes32[]", "name": "productIds", "type": "bytes32[]"}
838
+ ],
839
+ "name": "productDetails",
840
+ "outputs": [
841
+ {
842
+ "components": [
843
+ {
844
+ "components": [
845
+ {
846
+ "internalType": "address",
847
+ "name": "builder",
848
+ "type": "address",
849
+ },
850
+ {
851
+ "internalType": "string",
852
+ "name": "symbol",
853
+ "type": "string",
854
+ },
855
+ {
856
+ "internalType": "string",
857
+ "name": "description",
858
+ "type": "string",
859
+ },
860
+ ],
861
+ "internalType": "struct IProductRegistry.ProductMetadata",
862
+ "name": "metadata",
863
+ "type": "tuple",
864
+ },
865
+ {
866
+ "components": [
867
+ {
868
+ "internalType": "address",
869
+ "name": "oracleAddress",
870
+ "type": "address",
871
+ },
872
+ {
873
+ "internalType": "uint8",
874
+ "name": "fsvDecimals",
875
+ "type": "uint8",
876
+ },
877
+ {
878
+ "internalType": "int256",
879
+ "name": "fspAlpha",
880
+ "type": "int256",
881
+ },
882
+ {
883
+ "internalType": "int256",
884
+ "name": "fspBeta",
885
+ "type": "int256",
886
+ },
887
+ {
888
+ "internalType": "bytes",
889
+ "name": "fsvCalldata",
890
+ "type": "bytes",
891
+ },
892
+ ],
893
+ "internalType": "struct IProductRegistry.OracleSpecification",
894
+ "name": "oracleSpec",
895
+ "type": "tuple",
896
+ },
897
+ {
898
+ "internalType": "string",
899
+ "name": "priceQuotation",
900
+ "type": "string",
901
+ },
902
+ {
903
+ "internalType": "address",
904
+ "name": "collateralAsset",
905
+ "type": "address",
906
+ },
907
+ {
908
+ "internalType": "uint256",
909
+ "name": "startTime",
910
+ "type": "uint256",
911
+ },
912
+ {
913
+ "internalType": "uint256",
914
+ "name": "earliestFSPSubmissionTime",
915
+ "type": "uint256",
916
+ },
917
+ {
918
+ "internalType": "uint256",
919
+ "name": "unitValue",
920
+ "type": "uint256",
921
+ },
922
+ {
923
+ "internalType": "uint16",
924
+ "name": "initialMarginRequirement",
925
+ "type": "uint16",
926
+ },
927
+ {
928
+ "internalType": "uint16",
929
+ "name": "maintenanceMarginRequirement",
930
+ "type": "uint16",
931
+ },
932
+ {
933
+ "internalType": "uint64",
934
+ "name": "offerPriceBuffer",
935
+ "type": "uint64",
936
+ },
937
+ {
938
+ "internalType": "uint64",
939
+ "name": "auctionBounty",
940
+ "type": "uint64",
941
+ },
942
+ {
943
+ "internalType": "uint32",
944
+ "name": "tradeoutInterval",
945
+ "type": "uint32",
946
+ },
947
+ {"internalType": "uint8", "name": "tickSize", "type": "uint8"},
948
+ {
949
+ "internalType": "string",
950
+ "name": "extendedMetadata",
951
+ "type": "string",
952
+ },
953
+ ],
954
+ "internalType": "struct IProductRegistry.Product[]",
955
+ "name": "details",
956
+ "type": "tuple[]",
957
+ }
958
+ ],
959
+ "stateMutability": "view",
960
+ "type": "function",
961
+ },
962
+ {
963
+ "inputs": [],
964
+ "name": "productRegistry",
965
+ "outputs": [
966
+ {
967
+ "internalType": "contract IProductRegistry",
968
+ "name": "",
969
+ "type": "address",
970
+ }
971
+ ],
972
+ "stateMutability": "view",
973
+ "type": "function",
974
+ },
975
+ {
976
+ "inputs": [
977
+ {"internalType": "bytes32[]", "name": "productIds", "type": "bytes32[]"}
978
+ ],
979
+ "name": "productStates",
980
+ "outputs": [
981
+ {
982
+ "internalType": "enum ProductState[]",
983
+ "name": "states",
984
+ "type": "uint8[]",
985
+ }
986
+ ],
987
+ "stateMutability": "view",
988
+ "type": "function",
989
+ },
990
+ {
991
+ "inputs": [],
992
+ "name": "proxiableUUID",
993
+ "outputs": [{"internalType": "bytes32", "name": "", "type": "bytes32"}],
994
+ "stateMutability": "view",
995
+ "type": "function",
996
+ },
997
+ {
998
+ "inputs": [],
999
+ "name": "renounceOwnership",
1000
+ "outputs": [],
1001
+ "stateMutability": "nonpayable",
1002
+ "type": "function",
1003
+ },
1004
+ {
1005
+ "inputs": [
1006
+ {"internalType": "address", "name": "newOwner", "type": "address"}
1007
+ ],
1008
+ "name": "transferOwnership",
1009
+ "outputs": [],
1010
+ "stateMutability": "nonpayable",
1011
+ "type": "function",
1012
+ },
1013
+ {
1014
+ "inputs": [
1015
+ {
1016
+ "internalType": "address",
1017
+ "name": "newImplementation",
1018
+ "type": "address",
1019
+ },
1020
+ {"internalType": "bytes", "name": "data", "type": "bytes"},
1021
+ ],
1022
+ "name": "upgradeToAndCall",
1023
+ "outputs": [],
1024
+ "stateMutability": "payable",
1025
+ "type": "function",
1026
+ },
1027
+ {
1028
+ "inputs": [
1029
+ {
1030
+ "internalType": "address",
1031
+ "name": "collateralAsset",
1032
+ "type": "address",
1033
+ },
1034
+ {"internalType": "address[]", "name": "accounts", "type": "address[]"},
1035
+ ],
1036
+ "name": "userMarginDataByCollateralAsset",
1037
+ "outputs": [
1038
+ {
1039
+ "components": [
1040
+ {
1041
+ "internalType": "address",
1042
+ "name": "collateralAsset",
1043
+ "type": "address",
1044
+ },
1045
+ {
1046
+ "internalType": "address",
1047
+ "name": "marginAccountId",
1048
+ "type": "address",
1049
+ },
1050
+ {"internalType": "int256", "name": "mae", "type": "int256"},
1051
+ {"internalType": "uint256", "name": "mmu", "type": "uint256"},
1052
+ {
1053
+ "components": [
1054
+ {
1055
+ "internalType": "bytes32",
1056
+ "name": "positionId",
1057
+ "type": "bytes32",
1058
+ },
1059
+ {
1060
+ "internalType": "int256",
1061
+ "name": "quantity",
1062
+ "type": "int256",
1063
+ },
1064
+ {
1065
+ "internalType": "int256",
1066
+ "name": "costBasis",
1067
+ "type": "int256",
1068
+ },
1069
+ {
1070
+ "internalType": "uint256",
1071
+ "name": "maintenanceMargin",
1072
+ "type": "uint256",
1073
+ },
1074
+ {
1075
+ "internalType": "int256",
1076
+ "name": "pnl",
1077
+ "type": "int256",
1078
+ },
1079
+ ],
1080
+ "internalType": "struct IMarginAccount.PositionData[]",
1081
+ "name": "positions",
1082
+ "type": "tuple[]",
1083
+ },
1084
+ ],
1085
+ "internalType": "struct ISystemViewer.UserMarginAccountData[]",
1086
+ "name": "data",
1087
+ "type": "tuple[]",
1088
+ }
1089
+ ],
1090
+ "stateMutability": "view",
1091
+ "type": "function",
1092
+ },
1093
+ {
1094
+ "inputs": [
1095
+ {
1096
+ "internalType": "address[]",
1097
+ "name": "collateralAssets",
1098
+ "type": "address[]",
1099
+ },
1100
+ {"internalType": "address[]", "name": "accounts", "type": "address[]"},
1101
+ ],
1102
+ "name": "userMarginDataByCollateralAssets",
1103
+ "outputs": [
1104
+ {
1105
+ "components": [
1106
+ {
1107
+ "internalType": "address",
1108
+ "name": "collateralAsset",
1109
+ "type": "address",
1110
+ },
1111
+ {
1112
+ "internalType": "address",
1113
+ "name": "marginAccountId",
1114
+ "type": "address",
1115
+ },
1116
+ {"internalType": "int256", "name": "mae", "type": "int256"},
1117
+ {"internalType": "uint256", "name": "mmu", "type": "uint256"},
1118
+ {
1119
+ "components": [
1120
+ {
1121
+ "internalType": "bytes32",
1122
+ "name": "positionId",
1123
+ "type": "bytes32",
1124
+ },
1125
+ {
1126
+ "internalType": "int256",
1127
+ "name": "quantity",
1128
+ "type": "int256",
1129
+ },
1130
+ {
1131
+ "internalType": "int256",
1132
+ "name": "costBasis",
1133
+ "type": "int256",
1134
+ },
1135
+ {
1136
+ "internalType": "uint256",
1137
+ "name": "maintenanceMargin",
1138
+ "type": "uint256",
1139
+ },
1140
+ {
1141
+ "internalType": "int256",
1142
+ "name": "pnl",
1143
+ "type": "int256",
1144
+ },
1145
+ ],
1146
+ "internalType": "struct IMarginAccount.PositionData[]",
1147
+ "name": "positions",
1148
+ "type": "tuple[]",
1149
+ },
1150
+ ],
1151
+ "internalType": "struct ISystemViewer.UserMarginAccountData[]",
1152
+ "name": "data",
1153
+ "type": "tuple[]",
1154
+ }
1155
+ ],
1156
+ "stateMutability": "view",
1157
+ "type": "function",
1158
+ },
1159
+ {
1160
+ "inputs": [
1161
+ {"internalType": "bytes32[]", "name": "productIds", "type": "bytes32[]"}
1162
+ ],
1163
+ "name": "valuations",
1164
+ "outputs": [
1165
+ {"internalType": "uint256[]", "name": "prices", "type": "uint256[]"}
1166
+ ],
1167
+ "stateMutability": "view",
1168
+ "type": "function",
1169
+ },
1170
+ ],
1171
+ )