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