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,617 @@
1
+ """MarginAccountRegistry contract binding and data structures."""
2
+
3
+ # This module has been generated using pyabigen v0.2.16
4
+
5
+ import typing
6
+
7
+ import eth_typing
8
+ import hexbytes
9
+ import web3
10
+ from web3.contract import contract
11
+
12
+
13
+ class MarginAccountRegistry:
14
+ """MarginAccountRegistry contract binding.
15
+
16
+ Parameters
17
+ ----------
18
+ w3 : web3.Web3
19
+ address : eth_typing.ChecksumAddress
20
+ The address of a deployed MarginAccountRegistry contract.
21
+ """
22
+
23
+ _contract: contract.Contract
24
+
25
+ def __init__(
26
+ self,
27
+ w3: web3.Web3,
28
+ address: eth_typing.ChecksumAddress,
29
+ ):
30
+ self._contract = w3.eth.contract(
31
+ address=address,
32
+ abi=ABI,
33
+ )
34
+
35
+ @property
36
+ def Initialized(self) -> contract.ContractEvent:
37
+ """Binding for `event Initialized` on the MarginAccountRegistry contract."""
38
+ return self._contract.events.Initialized
39
+
40
+ @property
41
+ def MarginAccountCreated(self) -> contract.ContractEvent:
42
+ """Binding for `event MarginAccountCreated` on the MarginAccountRegistry contract."""
43
+ return self._contract.events.MarginAccountCreated
44
+
45
+ @property
46
+ def OwnershipTransferred(self) -> contract.ContractEvent:
47
+ """Binding for `event OwnershipTransferred` on the MarginAccountRegistry contract."""
48
+ return self._contract.events.OwnershipTransferred
49
+
50
+ @property
51
+ def Upgraded(self) -> contract.ContractEvent:
52
+ """Binding for `event Upgraded` on the MarginAccountRegistry contract."""
53
+ return self._contract.events.Upgraded
54
+
55
+ def upgrade_interface_version(
56
+ self,
57
+ ) -> str:
58
+ """Binding for `UPGRADE_INTERFACE_VERSION` on the MarginAccountRegistry contract.
59
+
60
+ Returns
61
+ -------
62
+ str
63
+ """
64
+ return_value = self._contract.functions.UPGRADE_INTERFACE_VERSION().call()
65
+ return str(return_value)
66
+
67
+ def clearing(
68
+ self,
69
+ ) -> eth_typing.ChecksumAddress:
70
+ """Binding for `clearing` on the MarginAccountRegistry contract.
71
+
72
+ Returns
73
+ -------
74
+ eth_typing.ChecksumAddress
75
+ """
76
+ return_value = self._contract.functions.clearing().call()
77
+ return eth_typing.ChecksumAddress(return_value)
78
+
79
+ def get_admin(
80
+ self,
81
+ ) -> eth_typing.ChecksumAddress:
82
+ """Binding for `getAdmin` on the MarginAccountRegistry contract.
83
+
84
+ Returns
85
+ -------
86
+ eth_typing.ChecksumAddress
87
+ """
88
+ return_value = self._contract.functions.getAdmin().call()
89
+ return eth_typing.ChecksumAddress(return_value)
90
+
91
+ def get_margin_account(
92
+ self,
93
+ collateral_asset: eth_typing.ChecksumAddress,
94
+ ) -> eth_typing.ChecksumAddress:
95
+ """Binding for `getMarginAccount` on the MarginAccountRegistry contract.
96
+
97
+ Parameters
98
+ ----------
99
+ collateral_asset : eth_typing.ChecksumAddress
100
+
101
+ Returns
102
+ -------
103
+ eth_typing.ChecksumAddress
104
+ """
105
+ return_value = self._contract.functions.getMarginAccount(
106
+ collateral_asset,
107
+ ).call()
108
+ return eth_typing.ChecksumAddress(return_value)
109
+
110
+ def initialize(
111
+ self,
112
+ _clearing: eth_typing.ChecksumAddress,
113
+ _valuation: eth_typing.ChecksumAddress,
114
+ _product_registry: eth_typing.ChecksumAddress,
115
+ beacon_: eth_typing.ChecksumAddress,
116
+ ) -> contract.ContractFunction:
117
+ """Binding for `initialize` on the MarginAccountRegistry contract.
118
+
119
+ Parameters
120
+ ----------
121
+ _clearing : eth_typing.ChecksumAddress
122
+ _valuation : eth_typing.ChecksumAddress
123
+ _product_registry : eth_typing.ChecksumAddress
124
+ beacon_ : eth_typing.ChecksumAddress
125
+
126
+ Returns
127
+ -------
128
+ web3.contract.contract.ContractFunction
129
+ A contract function instance to be sent in a transaction.
130
+ """
131
+ return self._contract.functions.initialize(
132
+ _clearing,
133
+ _valuation,
134
+ _product_registry,
135
+ beacon_,
136
+ )
137
+
138
+ def initialize_margin_account(
139
+ self,
140
+ collateral_asset: eth_typing.ChecksumAddress,
141
+ ) -> contract.ContractFunction:
142
+ """Binding for `initializeMarginAccount` on the MarginAccountRegistry contract.
143
+
144
+ Parameters
145
+ ----------
146
+ collateral_asset : eth_typing.ChecksumAddress
147
+
148
+ Returns
149
+ -------
150
+ web3.contract.contract.ContractFunction
151
+ A contract function instance to be sent in a transaction.
152
+ """
153
+ return self._contract.functions.initializeMarginAccount(
154
+ collateral_asset,
155
+ )
156
+
157
+ def is_admin_active(
158
+ self,
159
+ ) -> bool:
160
+ """Binding for `isAdminActive` on the MarginAccountRegistry contract.
161
+
162
+ Returns
163
+ -------
164
+ bool
165
+ """
166
+ return_value = self._contract.functions.isAdminActive().call()
167
+ return bool(return_value)
168
+
169
+ def margin_accounts(
170
+ self,
171
+ key0: eth_typing.ChecksumAddress,
172
+ ) -> eth_typing.ChecksumAddress:
173
+ """Binding for `marginAccounts` on the MarginAccountRegistry contract.
174
+
175
+ Parameters
176
+ ----------
177
+ key0 : eth_typing.ChecksumAddress
178
+
179
+ Returns
180
+ -------
181
+ eth_typing.ChecksumAddress
182
+ """
183
+ return_value = self._contract.functions.marginAccounts(
184
+ key0,
185
+ ).call()
186
+ return eth_typing.ChecksumAddress(return_value)
187
+
188
+ def owner(
189
+ self,
190
+ ) -> eth_typing.ChecksumAddress:
191
+ """Binding for `owner` on the MarginAccountRegistry contract.
192
+
193
+ Returns
194
+ -------
195
+ eth_typing.ChecksumAddress
196
+ """
197
+ return_value = self._contract.functions.owner().call()
198
+ return eth_typing.ChecksumAddress(return_value)
199
+
200
+ def product_registry(
201
+ self,
202
+ ) -> eth_typing.ChecksumAddress:
203
+ """Binding for `productRegistry` on the MarginAccountRegistry contract.
204
+
205
+ Returns
206
+ -------
207
+ eth_typing.ChecksumAddress
208
+ """
209
+ return_value = self._contract.functions.productRegistry().call()
210
+ return eth_typing.ChecksumAddress(return_value)
211
+
212
+ def proxiable_uuid(
213
+ self,
214
+ ) -> hexbytes.HexBytes:
215
+ """Binding for `proxiableUUID` on the MarginAccountRegistry contract.
216
+
217
+ Returns
218
+ -------
219
+ hexbytes.HexBytes
220
+ """
221
+ return_value = self._contract.functions.proxiableUUID().call()
222
+ return hexbytes.HexBytes(return_value)
223
+
224
+ def renounce_ownership(
225
+ self,
226
+ ) -> contract.ContractFunction:
227
+ """Binding for `renounceOwnership` on the MarginAccountRegistry contract.
228
+
229
+ Returns
230
+ -------
231
+ web3.contract.contract.ContractFunction
232
+ A contract function instance to be sent in a transaction.
233
+ """
234
+ return self._contract.functions.renounceOwnership()
235
+
236
+ def set_active(
237
+ self,
238
+ active: bool,
239
+ ) -> contract.ContractFunction:
240
+ """Binding for `setActive` on the MarginAccountRegistry contract.
241
+
242
+ Parameters
243
+ ----------
244
+ active : bool
245
+
246
+ Returns
247
+ -------
248
+ web3.contract.contract.ContractFunction
249
+ A contract function instance to be sent in a transaction.
250
+ """
251
+ return self._contract.functions.setActive(
252
+ active,
253
+ )
254
+
255
+ def set_admin(
256
+ self,
257
+ new_admin: eth_typing.ChecksumAddress,
258
+ ) -> contract.ContractFunction:
259
+ """Binding for `setAdmin` on the MarginAccountRegistry contract.
260
+
261
+ Parameters
262
+ ----------
263
+ new_admin : eth_typing.ChecksumAddress
264
+
265
+ Returns
266
+ -------
267
+ web3.contract.contract.ContractFunction
268
+ A contract function instance to be sent in a transaction.
269
+ """
270
+ return self._contract.functions.setAdmin(
271
+ new_admin,
272
+ )
273
+
274
+ def transfer_ownership(
275
+ self,
276
+ new_owner: eth_typing.ChecksumAddress,
277
+ ) -> contract.ContractFunction:
278
+ """Binding for `transferOwnership` on the MarginAccountRegistry contract.
279
+
280
+ Parameters
281
+ ----------
282
+ new_owner : eth_typing.ChecksumAddress
283
+
284
+ Returns
285
+ -------
286
+ web3.contract.contract.ContractFunction
287
+ A contract function instance to be sent in a transaction.
288
+ """
289
+ return self._contract.functions.transferOwnership(
290
+ new_owner,
291
+ )
292
+
293
+ def upgrade_to_and_call(
294
+ self,
295
+ new_implementation: eth_typing.ChecksumAddress,
296
+ data: hexbytes.HexBytes,
297
+ ) -> contract.ContractFunction:
298
+ """Binding for `upgradeToAndCall` on the MarginAccountRegistry contract.
299
+
300
+ Parameters
301
+ ----------
302
+ new_implementation : eth_typing.ChecksumAddress
303
+ data : hexbytes.HexBytes
304
+
305
+ Returns
306
+ -------
307
+ web3.contract.contract.ContractFunction
308
+ A contract function instance to be sent in a transaction.
309
+ """
310
+ return self._contract.functions.upgradeToAndCall(
311
+ new_implementation,
312
+ data,
313
+ )
314
+
315
+ def valuation(
316
+ self,
317
+ ) -> eth_typing.ChecksumAddress:
318
+ """Binding for `valuation` on the MarginAccountRegistry contract.
319
+
320
+ Returns
321
+ -------
322
+ eth_typing.ChecksumAddress
323
+ """
324
+ return_value = self._contract.functions.valuation().call()
325
+ return eth_typing.ChecksumAddress(return_value)
326
+
327
+
328
+ ABI = typing.cast(
329
+ eth_typing.ABI,
330
+ [
331
+ {
332
+ "inputs": [
333
+ {"internalType": "address", "name": "target", "type": "address"}
334
+ ],
335
+ "name": "AddressEmptyCode",
336
+ "type": "error",
337
+ },
338
+ {
339
+ "inputs": [
340
+ {"internalType": "bytes4", "name": "selector", "type": "bytes4"},
341
+ {"internalType": "address", "name": "sender", "type": "address"},
342
+ ],
343
+ "name": "AdminControlledNotAuthorized",
344
+ "type": "error",
345
+ },
346
+ {
347
+ "inputs": [
348
+ {"internalType": "string", "name": "parameter", "type": "string"}
349
+ ],
350
+ "name": "AlreadyExists",
351
+ "type": "error",
352
+ },
353
+ {
354
+ "inputs": [
355
+ {"internalType": "address", "name": "implementation", "type": "address"}
356
+ ],
357
+ "name": "ERC1967InvalidImplementation",
358
+ "type": "error",
359
+ },
360
+ {"inputs": [], "name": "ERC1967NonPayable", "type": "error"},
361
+ {"inputs": [], "name": "FailedCall", "type": "error"},
362
+ {"inputs": [], "name": "InvalidInitialization", "type": "error"},
363
+ {"inputs": [], "name": "NotInitialized", "type": "error"},
364
+ {"inputs": [], "name": "NotInitializing", "type": "error"},
365
+ {
366
+ "inputs": [{"internalType": "address", "name": "owner", "type": "address"}],
367
+ "name": "OwnableInvalidOwner",
368
+ "type": "error",
369
+ },
370
+ {
371
+ "inputs": [
372
+ {"internalType": "address", "name": "account", "type": "address"}
373
+ ],
374
+ "name": "OwnableUnauthorizedAccount",
375
+ "type": "error",
376
+ },
377
+ {"inputs": [], "name": "UUPSUnauthorizedCallContext", "type": "error"},
378
+ {
379
+ "inputs": [{"internalType": "bytes32", "name": "slot", "type": "bytes32"}],
380
+ "name": "UUPSUnsupportedProxiableUUID",
381
+ "type": "error",
382
+ },
383
+ {
384
+ "anonymous": False,
385
+ "inputs": [
386
+ {
387
+ "indexed": False,
388
+ "internalType": "uint64",
389
+ "name": "version",
390
+ "type": "uint64",
391
+ }
392
+ ],
393
+ "name": "Initialized",
394
+ "type": "event",
395
+ },
396
+ {
397
+ "anonymous": False,
398
+ "inputs": [
399
+ {
400
+ "indexed": True,
401
+ "internalType": "address",
402
+ "name": "collateralAsset",
403
+ "type": "address",
404
+ },
405
+ {
406
+ "indexed": True,
407
+ "internalType": "address",
408
+ "name": "marginAccount",
409
+ "type": "address",
410
+ },
411
+ ],
412
+ "name": "MarginAccountCreated",
413
+ "type": "event",
414
+ },
415
+ {
416
+ "anonymous": False,
417
+ "inputs": [
418
+ {
419
+ "indexed": True,
420
+ "internalType": "address",
421
+ "name": "previousOwner",
422
+ "type": "address",
423
+ },
424
+ {
425
+ "indexed": True,
426
+ "internalType": "address",
427
+ "name": "newOwner",
428
+ "type": "address",
429
+ },
430
+ ],
431
+ "name": "OwnershipTransferred",
432
+ "type": "event",
433
+ },
434
+ {
435
+ "anonymous": False,
436
+ "inputs": [
437
+ {
438
+ "indexed": True,
439
+ "internalType": "address",
440
+ "name": "implementation",
441
+ "type": "address",
442
+ }
443
+ ],
444
+ "name": "Upgraded",
445
+ "type": "event",
446
+ },
447
+ {
448
+ "inputs": [],
449
+ "name": "UPGRADE_INTERFACE_VERSION",
450
+ "outputs": [{"internalType": "string", "name": "", "type": "string"}],
451
+ "stateMutability": "view",
452
+ "type": "function",
453
+ },
454
+ {
455
+ "inputs": [],
456
+ "name": "clearing",
457
+ "outputs": [{"internalType": "address", "name": "", "type": "address"}],
458
+ "stateMutability": "view",
459
+ "type": "function",
460
+ },
461
+ {
462
+ "inputs": [],
463
+ "name": "getAdmin",
464
+ "outputs": [{"internalType": "address", "name": "", "type": "address"}],
465
+ "stateMutability": "view",
466
+ "type": "function",
467
+ },
468
+ {
469
+ "inputs": [
470
+ {
471
+ "internalType": "address",
472
+ "name": "collateralAsset",
473
+ "type": "address",
474
+ }
475
+ ],
476
+ "name": "getMarginAccount",
477
+ "outputs": [
478
+ {
479
+ "internalType": "contract IMarginAccount",
480
+ "name": "",
481
+ "type": "address",
482
+ }
483
+ ],
484
+ "stateMutability": "view",
485
+ "type": "function",
486
+ },
487
+ {
488
+ "inputs": [
489
+ {"internalType": "address", "name": "_clearing", "type": "address"},
490
+ {"internalType": "address", "name": "_valuation", "type": "address"},
491
+ {
492
+ "internalType": "address",
493
+ "name": "_productRegistry",
494
+ "type": "address",
495
+ },
496
+ {"internalType": "address", "name": "beacon_", "type": "address"},
497
+ ],
498
+ "name": "initialize",
499
+ "outputs": [],
500
+ "stateMutability": "nonpayable",
501
+ "type": "function",
502
+ },
503
+ {
504
+ "inputs": [
505
+ {
506
+ "internalType": "address",
507
+ "name": "collateralAsset",
508
+ "type": "address",
509
+ }
510
+ ],
511
+ "name": "initializeMarginAccount",
512
+ "outputs": [
513
+ {
514
+ "internalType": "contract IMarginAccount",
515
+ "name": "",
516
+ "type": "address",
517
+ }
518
+ ],
519
+ "stateMutability": "nonpayable",
520
+ "type": "function",
521
+ },
522
+ {
523
+ "inputs": [],
524
+ "name": "isAdminActive",
525
+ "outputs": [{"internalType": "bool", "name": "", "type": "bool"}],
526
+ "stateMutability": "view",
527
+ "type": "function",
528
+ },
529
+ {
530
+ "inputs": [{"internalType": "address", "name": "", "type": "address"}],
531
+ "name": "marginAccounts",
532
+ "outputs": [
533
+ {
534
+ "internalType": "contract IMarginAccount",
535
+ "name": "",
536
+ "type": "address",
537
+ }
538
+ ],
539
+ "stateMutability": "view",
540
+ "type": "function",
541
+ },
542
+ {
543
+ "inputs": [],
544
+ "name": "owner",
545
+ "outputs": [{"internalType": "address", "name": "", "type": "address"}],
546
+ "stateMutability": "view",
547
+ "type": "function",
548
+ },
549
+ {
550
+ "inputs": [],
551
+ "name": "productRegistry",
552
+ "outputs": [{"internalType": "address", "name": "", "type": "address"}],
553
+ "stateMutability": "view",
554
+ "type": "function",
555
+ },
556
+ {
557
+ "inputs": [],
558
+ "name": "proxiableUUID",
559
+ "outputs": [{"internalType": "bytes32", "name": "", "type": "bytes32"}],
560
+ "stateMutability": "view",
561
+ "type": "function",
562
+ },
563
+ {
564
+ "inputs": [],
565
+ "name": "renounceOwnership",
566
+ "outputs": [],
567
+ "stateMutability": "nonpayable",
568
+ "type": "function",
569
+ },
570
+ {
571
+ "inputs": [{"internalType": "bool", "name": "active", "type": "bool"}],
572
+ "name": "setActive",
573
+ "outputs": [],
574
+ "stateMutability": "nonpayable",
575
+ "type": "function",
576
+ },
577
+ {
578
+ "inputs": [
579
+ {"internalType": "address", "name": "newAdmin", "type": "address"}
580
+ ],
581
+ "name": "setAdmin",
582
+ "outputs": [],
583
+ "stateMutability": "nonpayable",
584
+ "type": "function",
585
+ },
586
+ {
587
+ "inputs": [
588
+ {"internalType": "address", "name": "newOwner", "type": "address"}
589
+ ],
590
+ "name": "transferOwnership",
591
+ "outputs": [],
592
+ "stateMutability": "nonpayable",
593
+ "type": "function",
594
+ },
595
+ {
596
+ "inputs": [
597
+ {
598
+ "internalType": "address",
599
+ "name": "newImplementation",
600
+ "type": "address",
601
+ },
602
+ {"internalType": "bytes", "name": "data", "type": "bytes"},
603
+ ],
604
+ "name": "upgradeToAndCall",
605
+ "outputs": [],
606
+ "stateMutability": "payable",
607
+ "type": "function",
608
+ },
609
+ {
610
+ "inputs": [],
611
+ "name": "valuation",
612
+ "outputs": [{"internalType": "address", "name": "", "type": "address"}],
613
+ "stateMutability": "view",
614
+ "type": "function",
615
+ },
616
+ ],
617
+ )