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,111 @@
1
+ """MarkPriceTrackerFacet 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 MarkPriceTrackerFacet:
14
+ """MarkPriceTrackerFacet contract binding.
15
+
16
+ Parameters
17
+ ----------
18
+ w3 : web3.Web3
19
+ address : eth_typing.ChecksumAddress
20
+ The address of a deployed MarkPriceTrackerFacet 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
+ def valuation(
36
+ self,
37
+ product_id: hexbytes.HexBytes,
38
+ ) -> int:
39
+ """Binding for `valuation` on the MarkPriceTrackerFacet contract.
40
+
41
+ Parameters
42
+ ----------
43
+ product_id : hexbytes.HexBytes
44
+
45
+ Returns
46
+ -------
47
+ int
48
+ """
49
+ return_value = self._contract.functions.valuation(
50
+ product_id,
51
+ ).call()
52
+ return int(return_value)
53
+
54
+ def valuation_after_trade(
55
+ self,
56
+ product_id: hexbytes.HexBytes,
57
+ price: int,
58
+ quantity: int,
59
+ ) -> int:
60
+ """Binding for `valuationAfterTrade` on the MarkPriceTrackerFacet contract.
61
+
62
+ Parameters
63
+ ----------
64
+ product_id : hexbytes.HexBytes
65
+ price : int
66
+ quantity : int
67
+
68
+ Returns
69
+ -------
70
+ int
71
+ """
72
+ return_value = self._contract.functions.valuationAfterTrade(
73
+ product_id,
74
+ price,
75
+ quantity,
76
+ ).call()
77
+ return int(return_value)
78
+
79
+
80
+ ABI = typing.cast(
81
+ eth_typing.ABI,
82
+ [
83
+ {
84
+ "inputs": [
85
+ {"internalType": "bytes32", "name": "productId", "type": "bytes32"}
86
+ ],
87
+ "name": "NoTradeData",
88
+ "type": "error",
89
+ },
90
+ {
91
+ "inputs": [
92
+ {"internalType": "bytes32", "name": "productId", "type": "bytes32"}
93
+ ],
94
+ "name": "valuation",
95
+ "outputs": [{"internalType": "uint256", "name": "", "type": "uint256"}],
96
+ "stateMutability": "view",
97
+ "type": "function",
98
+ },
99
+ {
100
+ "inputs": [
101
+ {"internalType": "bytes32", "name": "productId", "type": "bytes32"},
102
+ {"internalType": "uint256", "name": "price", "type": "uint256"},
103
+ {"internalType": "uint256", "name": "quantity", "type": "uint256"},
104
+ ],
105
+ "name": "valuationAfterTrade",
106
+ "outputs": [{"internalType": "uint256", "name": "", "type": "uint256"}],
107
+ "stateMutability": "view",
108
+ "type": "function",
109
+ },
110
+ ],
111
+ )
@@ -0,0 +1,539 @@
1
+ """OracleProvider 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 OracleProvider:
14
+ """OracleProvider contract binding.
15
+
16
+ Parameters
17
+ ----------
18
+ w3 : web3.Web3
19
+ address : eth_typing.ChecksumAddress
20
+ The address of a deployed OracleProvider 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 OracleProvider contract."""
38
+ return self._contract.events.Initialized
39
+
40
+ @property
41
+ def OwnershipTransferred(self) -> contract.ContractEvent:
42
+ """Binding for `event OwnershipTransferred` on the OracleProvider contract."""
43
+ return self._contract.events.OwnershipTransferred
44
+
45
+ @property
46
+ def PriceSubmitted(self) -> contract.ContractEvent:
47
+ """Binding for `event PriceSubmitted` on the OracleProvider contract."""
48
+ return self._contract.events.PriceSubmitted
49
+
50
+ @property
51
+ def Upgraded(self) -> contract.ContractEvent:
52
+ """Binding for `event Upgraded` on the OracleProvider 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 OracleProvider 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 get_admin(
68
+ self,
69
+ ) -> eth_typing.ChecksumAddress:
70
+ """Binding for `getAdmin` on the OracleProvider contract.
71
+
72
+ Returns
73
+ -------
74
+ eth_typing.ChecksumAddress
75
+ """
76
+ return_value = self._contract.functions.getAdmin().call()
77
+ return eth_typing.ChecksumAddress(return_value)
78
+
79
+ def initialize(
80
+ self,
81
+ _product_registry: eth_typing.ChecksumAddress,
82
+ ) -> contract.ContractFunction:
83
+ """Binding for `initialize` on the OracleProvider contract.
84
+
85
+ Parameters
86
+ ----------
87
+ _product_registry : eth_typing.ChecksumAddress
88
+
89
+ Returns
90
+ -------
91
+ web3.contract.contract.ContractFunction
92
+ A contract function instance to be sent in a transaction.
93
+ """
94
+ return self._contract.functions.initialize(
95
+ _product_registry,
96
+ )
97
+
98
+ def is_admin_active(
99
+ self,
100
+ ) -> bool:
101
+ """Binding for `isAdminActive` on the OracleProvider contract.
102
+
103
+ Returns
104
+ -------
105
+ bool
106
+ """
107
+ return_value = self._contract.functions.isAdminActive().call()
108
+ return bool(return_value)
109
+
110
+ def owner(
111
+ self,
112
+ ) -> eth_typing.ChecksumAddress:
113
+ """Binding for `owner` on the OracleProvider contract.
114
+
115
+ Returns
116
+ -------
117
+ eth_typing.ChecksumAddress
118
+ """
119
+ return_value = self._contract.functions.owner().call()
120
+ return eth_typing.ChecksumAddress(return_value)
121
+
122
+ def product_registry(
123
+ self,
124
+ ) -> eth_typing.ChecksumAddress:
125
+ """Binding for `productRegistry` on the OracleProvider contract.
126
+
127
+ Returns
128
+ -------
129
+ eth_typing.ChecksumAddress
130
+ """
131
+ return_value = self._contract.functions.productRegistry().call()
132
+ return eth_typing.ChecksumAddress(return_value)
133
+
134
+ def proxiable_uuid(
135
+ self,
136
+ ) -> hexbytes.HexBytes:
137
+ """Binding for `proxiableUUID` on the OracleProvider contract.
138
+
139
+ Returns
140
+ -------
141
+ hexbytes.HexBytes
142
+ """
143
+ return_value = self._contract.functions.proxiableUUID().call()
144
+ return hexbytes.HexBytes(return_value)
145
+
146
+ def renounce_ownership(
147
+ self,
148
+ ) -> contract.ContractFunction:
149
+ """Binding for `renounceOwnership` on the OracleProvider contract.
150
+
151
+ Returns
152
+ -------
153
+ web3.contract.contract.ContractFunction
154
+ A contract function instance to be sent in a transaction.
155
+ """
156
+ return self._contract.functions.renounceOwnership()
157
+
158
+ def resolve(
159
+ self,
160
+ product_id: hexbytes.HexBytes,
161
+ key1: hexbytes.HexBytes,
162
+ ) -> int:
163
+ """Binding for `resolve` on the OracleProvider contract.
164
+
165
+ Parameters
166
+ ----------
167
+ product_id : hexbytes.HexBytes
168
+ key1 : hexbytes.HexBytes
169
+
170
+ Returns
171
+ -------
172
+ int
173
+ """
174
+ return_value = self._contract.functions.resolve(
175
+ product_id,
176
+ key1,
177
+ ).call()
178
+ return int(return_value)
179
+
180
+ def set_active(
181
+ self,
182
+ active: bool,
183
+ ) -> contract.ContractFunction:
184
+ """Binding for `setActive` on the OracleProvider contract.
185
+
186
+ Parameters
187
+ ----------
188
+ active : bool
189
+
190
+ Returns
191
+ -------
192
+ web3.contract.contract.ContractFunction
193
+ A contract function instance to be sent in a transaction.
194
+ """
195
+ return self._contract.functions.setActive(
196
+ active,
197
+ )
198
+
199
+ def set_admin(
200
+ self,
201
+ admin: eth_typing.ChecksumAddress,
202
+ ) -> contract.ContractFunction:
203
+ """Binding for `setAdmin` on the OracleProvider contract.
204
+
205
+ Parameters
206
+ ----------
207
+ admin : eth_typing.ChecksumAddress
208
+
209
+ Returns
210
+ -------
211
+ web3.contract.contract.ContractFunction
212
+ A contract function instance to be sent in a transaction.
213
+ """
214
+ return self._contract.functions.setAdmin(
215
+ admin,
216
+ )
217
+
218
+ def submit(
219
+ self,
220
+ key: hexbytes.HexBytes,
221
+ fsp: int,
222
+ ) -> contract.ContractFunction:
223
+ """Binding for `submit` on the OracleProvider contract.
224
+
225
+ Parameters
226
+ ----------
227
+ key : hexbytes.HexBytes
228
+ fsp : int
229
+
230
+ Returns
231
+ -------
232
+ web3.contract.contract.ContractFunction
233
+ A contract function instance to be sent in a transaction.
234
+ """
235
+ return self._contract.functions.submit(
236
+ key,
237
+ fsp,
238
+ )
239
+
240
+ def transfer_ownership(
241
+ self,
242
+ new_owner: eth_typing.ChecksumAddress,
243
+ ) -> contract.ContractFunction:
244
+ """Binding for `transferOwnership` on the OracleProvider contract.
245
+
246
+ Parameters
247
+ ----------
248
+ new_owner : eth_typing.ChecksumAddress
249
+
250
+ Returns
251
+ -------
252
+ web3.contract.contract.ContractFunction
253
+ A contract function instance to be sent in a transaction.
254
+ """
255
+ return self._contract.functions.transferOwnership(
256
+ new_owner,
257
+ )
258
+
259
+ def upgrade_to_and_call(
260
+ self,
261
+ new_implementation: eth_typing.ChecksumAddress,
262
+ data: hexbytes.HexBytes,
263
+ ) -> contract.ContractFunction:
264
+ """Binding for `upgradeToAndCall` on the OracleProvider contract.
265
+
266
+ Parameters
267
+ ----------
268
+ new_implementation : eth_typing.ChecksumAddress
269
+ data : hexbytes.HexBytes
270
+
271
+ Returns
272
+ -------
273
+ web3.contract.contract.ContractFunction
274
+ A contract function instance to be sent in a transaction.
275
+ """
276
+ return self._contract.functions.upgradeToAndCall(
277
+ new_implementation,
278
+ data,
279
+ )
280
+
281
+
282
+ ABI = typing.cast(
283
+ eth_typing.ABI,
284
+ [
285
+ {
286
+ "inputs": [
287
+ {"internalType": "address", "name": "target", "type": "address"}
288
+ ],
289
+ "name": "AddressEmptyCode",
290
+ "type": "error",
291
+ },
292
+ {
293
+ "inputs": [
294
+ {"internalType": "bytes4", "name": "selector", "type": "bytes4"},
295
+ {"internalType": "address", "name": "sender", "type": "address"},
296
+ ],
297
+ "name": "AdminControlledNotAuthorized",
298
+ "type": "error",
299
+ },
300
+ {
301
+ "inputs": [
302
+ {"internalType": "address", "name": "implementation", "type": "address"}
303
+ ],
304
+ "name": "ERC1967InvalidImplementation",
305
+ "type": "error",
306
+ },
307
+ {"inputs": [], "name": "ERC1967NonPayable", "type": "error"},
308
+ {
309
+ "inputs": [
310
+ {"internalType": "bytes32", "name": "productId", "type": "bytes32"}
311
+ ],
312
+ "name": "FSPNotFound",
313
+ "type": "error",
314
+ },
315
+ {"inputs": [], "name": "FailedCall", "type": "error"},
316
+ {"inputs": [], "name": "InvalidInitialization", "type": "error"},
317
+ {
318
+ "inputs": [
319
+ {"internalType": "enum ProductState", "name": "state", "type": "uint8"}
320
+ ],
321
+ "name": "InvalidProductState",
322
+ "type": "error",
323
+ },
324
+ {"inputs": [], "name": "NotInitializing", "type": "error"},
325
+ {
326
+ "inputs": [{"internalType": "address", "name": "owner", "type": "address"}],
327
+ "name": "OwnableInvalidOwner",
328
+ "type": "error",
329
+ },
330
+ {
331
+ "inputs": [
332
+ {"internalType": "address", "name": "account", "type": "address"}
333
+ ],
334
+ "name": "OwnableUnauthorizedAccount",
335
+ "type": "error",
336
+ },
337
+ {"inputs": [], "name": "UUPSUnauthorizedCallContext", "type": "error"},
338
+ {
339
+ "inputs": [{"internalType": "bytes32", "name": "slot", "type": "bytes32"}],
340
+ "name": "UUPSUnsupportedProxiableUUID",
341
+ "type": "error",
342
+ },
343
+ {
344
+ "anonymous": False,
345
+ "inputs": [
346
+ {
347
+ "indexed": False,
348
+ "internalType": "uint64",
349
+ "name": "version",
350
+ "type": "uint64",
351
+ }
352
+ ],
353
+ "name": "Initialized",
354
+ "type": "event",
355
+ },
356
+ {
357
+ "anonymous": False,
358
+ "inputs": [
359
+ {
360
+ "indexed": True,
361
+ "internalType": "address",
362
+ "name": "previousOwner",
363
+ "type": "address",
364
+ },
365
+ {
366
+ "indexed": True,
367
+ "internalType": "address",
368
+ "name": "newOwner",
369
+ "type": "address",
370
+ },
371
+ ],
372
+ "name": "OwnershipTransferred",
373
+ "type": "event",
374
+ },
375
+ {
376
+ "anonymous": False,
377
+ "inputs": [
378
+ {
379
+ "indexed": True,
380
+ "internalType": "bytes32",
381
+ "name": "key",
382
+ "type": "bytes32",
383
+ },
384
+ {
385
+ "indexed": False,
386
+ "internalType": "int256",
387
+ "name": "fsp",
388
+ "type": "int256",
389
+ },
390
+ {
391
+ "indexed": False,
392
+ "internalType": "address",
393
+ "name": "submitter",
394
+ "type": "address",
395
+ },
396
+ ],
397
+ "name": "PriceSubmitted",
398
+ "type": "event",
399
+ },
400
+ {
401
+ "anonymous": False,
402
+ "inputs": [
403
+ {
404
+ "indexed": True,
405
+ "internalType": "address",
406
+ "name": "implementation",
407
+ "type": "address",
408
+ }
409
+ ],
410
+ "name": "Upgraded",
411
+ "type": "event",
412
+ },
413
+ {
414
+ "inputs": [],
415
+ "name": "UPGRADE_INTERFACE_VERSION",
416
+ "outputs": [{"internalType": "string", "name": "", "type": "string"}],
417
+ "stateMutability": "view",
418
+ "type": "function",
419
+ },
420
+ {
421
+ "inputs": [],
422
+ "name": "getAdmin",
423
+ "outputs": [{"internalType": "address", "name": "", "type": "address"}],
424
+ "stateMutability": "view",
425
+ "type": "function",
426
+ },
427
+ {
428
+ "inputs": [
429
+ {
430
+ "internalType": "address",
431
+ "name": "_productRegistry",
432
+ "type": "address",
433
+ }
434
+ ],
435
+ "name": "initialize",
436
+ "outputs": [],
437
+ "stateMutability": "nonpayable",
438
+ "type": "function",
439
+ },
440
+ {
441
+ "inputs": [],
442
+ "name": "isAdminActive",
443
+ "outputs": [{"internalType": "bool", "name": "", "type": "bool"}],
444
+ "stateMutability": "view",
445
+ "type": "function",
446
+ },
447
+ {
448
+ "inputs": [],
449
+ "name": "owner",
450
+ "outputs": [{"internalType": "address", "name": "", "type": "address"}],
451
+ "stateMutability": "view",
452
+ "type": "function",
453
+ },
454
+ {
455
+ "inputs": [],
456
+ "name": "productRegistry",
457
+ "outputs": [
458
+ {
459
+ "internalType": "contract IProductRegistry",
460
+ "name": "",
461
+ "type": "address",
462
+ }
463
+ ],
464
+ "stateMutability": "view",
465
+ "type": "function",
466
+ },
467
+ {
468
+ "inputs": [],
469
+ "name": "proxiableUUID",
470
+ "outputs": [{"internalType": "bytes32", "name": "", "type": "bytes32"}],
471
+ "stateMutability": "view",
472
+ "type": "function",
473
+ },
474
+ {
475
+ "inputs": [],
476
+ "name": "renounceOwnership",
477
+ "outputs": [],
478
+ "stateMutability": "nonpayable",
479
+ "type": "function",
480
+ },
481
+ {
482
+ "inputs": [
483
+ {"internalType": "bytes32", "name": "productId", "type": "bytes32"},
484
+ {"internalType": "bytes", "name": "", "type": "bytes"},
485
+ ],
486
+ "name": "resolve",
487
+ "outputs": [{"internalType": "int256", "name": "", "type": "int256"}],
488
+ "stateMutability": "view",
489
+ "type": "function",
490
+ },
491
+ {
492
+ "inputs": [{"internalType": "bool", "name": "active", "type": "bool"}],
493
+ "name": "setActive",
494
+ "outputs": [],
495
+ "stateMutability": "nonpayable",
496
+ "type": "function",
497
+ },
498
+ {
499
+ "inputs": [{"internalType": "address", "name": "admin", "type": "address"}],
500
+ "name": "setAdmin",
501
+ "outputs": [],
502
+ "stateMutability": "nonpayable",
503
+ "type": "function",
504
+ },
505
+ {
506
+ "inputs": [
507
+ {"internalType": "bytes32", "name": "key", "type": "bytes32"},
508
+ {"internalType": "int256", "name": "fsp", "type": "int256"},
509
+ ],
510
+ "name": "submit",
511
+ "outputs": [],
512
+ "stateMutability": "nonpayable",
513
+ "type": "function",
514
+ },
515
+ {
516
+ "inputs": [
517
+ {"internalType": "address", "name": "newOwner", "type": "address"}
518
+ ],
519
+ "name": "transferOwnership",
520
+ "outputs": [],
521
+ "stateMutability": "nonpayable",
522
+ "type": "function",
523
+ },
524
+ {
525
+ "inputs": [
526
+ {
527
+ "internalType": "address",
528
+ "name": "newImplementation",
529
+ "type": "address",
530
+ },
531
+ {"internalType": "bytes", "name": "data", "type": "bytes"},
532
+ ],
533
+ "name": "upgradeToAndCall",
534
+ "outputs": [],
535
+ "stateMutability": "payable",
536
+ "type": "function",
537
+ },
538
+ ],
539
+ )