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.
- afp/__init__.py +10 -0
- afp/api/__init__.py +0 -0
- afp/api/admin.py +55 -0
- afp/api/base.py +76 -0
- afp/api/builder.py +201 -0
- afp/api/clearing.py +377 -0
- afp/api/liquidation.py +167 -0
- afp/api/trading.py +342 -0
- afp/bindings/__init__.py +48 -0
- afp/bindings/auctioneer_facet.py +758 -0
- afp/bindings/bankruptcy_facet.py +355 -0
- afp/bindings/clearing_facet.py +1019 -0
- afp/bindings/erc20.py +379 -0
- afp/bindings/facade.py +87 -0
- afp/bindings/final_settlement_facet.py +268 -0
- afp/bindings/margin_account.py +1355 -0
- afp/bindings/margin_account_registry.py +617 -0
- afp/bindings/mark_price_tracker_facet.py +111 -0
- afp/bindings/oracle_provider.py +539 -0
- afp/bindings/product_registry.py +1302 -0
- afp/bindings/trading_protocol.py +1181 -0
- afp/config.py +38 -0
- afp/decorators.py +74 -0
- afp/enums.py +27 -0
- afp/exceptions.py +26 -0
- afp/exchange.py +151 -0
- afp/py.typed +0 -0
- afp/schemas.py +207 -0
- afp/signing.py +69 -0
- afp/validators.py +43 -0
- afp_sdk-0.1.0.dist-info/METADATA +180 -0
- afp_sdk-0.1.0.dist-info/RECORD +34 -0
- afp_sdk-0.1.0.dist-info/WHEEL +4 -0
- afp_sdk-0.1.0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
"""FinalSettlementFacet 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 FinalSettlementFacet:
|
|
14
|
+
"""FinalSettlementFacet contract binding.
|
|
15
|
+
|
|
16
|
+
Parameters
|
|
17
|
+
----------
|
|
18
|
+
w3 : web3.Web3
|
|
19
|
+
address : eth_typing.ChecksumAddress
|
|
20
|
+
The address of a deployed FinalSettlementFacet 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 closeout_fee_rate(
|
|
36
|
+
self,
|
|
37
|
+
) -> int:
|
|
38
|
+
"""Binding for `CLOSEOUT_FEE_RATE` on the FinalSettlementFacet contract.
|
|
39
|
+
|
|
40
|
+
Returns
|
|
41
|
+
-------
|
|
42
|
+
int
|
|
43
|
+
"""
|
|
44
|
+
return_value = self._contract.functions.CLOSEOUT_FEE_RATE().call()
|
|
45
|
+
return int(return_value)
|
|
46
|
+
|
|
47
|
+
def closeout_reward_rate(
|
|
48
|
+
self,
|
|
49
|
+
) -> int:
|
|
50
|
+
"""Binding for `CLOSEOUT_REWARD_RATE` on the FinalSettlementFacet contract.
|
|
51
|
+
|
|
52
|
+
Returns
|
|
53
|
+
-------
|
|
54
|
+
int
|
|
55
|
+
"""
|
|
56
|
+
return_value = self._contract.functions.CLOSEOUT_REWARD_RATE().call()
|
|
57
|
+
return int(return_value)
|
|
58
|
+
|
|
59
|
+
def finalize_fsp(
|
|
60
|
+
self,
|
|
61
|
+
product_id: hexbytes.HexBytes,
|
|
62
|
+
) -> contract.ContractFunction:
|
|
63
|
+
"""Binding for `finalizeFsp` on the FinalSettlementFacet contract.
|
|
64
|
+
|
|
65
|
+
Parameters
|
|
66
|
+
----------
|
|
67
|
+
product_id : hexbytes.HexBytes
|
|
68
|
+
|
|
69
|
+
Returns
|
|
70
|
+
-------
|
|
71
|
+
web3.contract.contract.ContractFunction
|
|
72
|
+
A contract function instance to be sent in a transaction.
|
|
73
|
+
"""
|
|
74
|
+
return self._contract.functions.finalizeFsp(
|
|
75
|
+
product_id,
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
def get_fsp(
|
|
79
|
+
self,
|
|
80
|
+
product_id: hexbytes.HexBytes,
|
|
81
|
+
) -> typing.Tuple[int, bool]:
|
|
82
|
+
"""Binding for `getFsp` on the FinalSettlementFacet contract.
|
|
83
|
+
|
|
84
|
+
Parameters
|
|
85
|
+
----------
|
|
86
|
+
product_id : hexbytes.HexBytes
|
|
87
|
+
|
|
88
|
+
Returns
|
|
89
|
+
-------
|
|
90
|
+
int
|
|
91
|
+
bool
|
|
92
|
+
"""
|
|
93
|
+
return_value = self._contract.functions.getFsp(
|
|
94
|
+
product_id,
|
|
95
|
+
).call()
|
|
96
|
+
return (
|
|
97
|
+
int(return_value[0]),
|
|
98
|
+
bool(return_value[1]),
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
def initiate_final_settlement(
|
|
102
|
+
self,
|
|
103
|
+
product_id: hexbytes.HexBytes,
|
|
104
|
+
accounts: typing.List[eth_typing.ChecksumAddress],
|
|
105
|
+
) -> contract.ContractFunction:
|
|
106
|
+
"""Binding for `initiateFinalSettlement` on the FinalSettlementFacet contract.
|
|
107
|
+
|
|
108
|
+
Parameters
|
|
109
|
+
----------
|
|
110
|
+
product_id : hexbytes.HexBytes
|
|
111
|
+
accounts : typing.List[eth_typing.ChecksumAddress]
|
|
112
|
+
|
|
113
|
+
Returns
|
|
114
|
+
-------
|
|
115
|
+
web3.contract.contract.ContractFunction
|
|
116
|
+
A contract function instance to be sent in a transaction.
|
|
117
|
+
"""
|
|
118
|
+
return self._contract.functions.initiateFinalSettlement(
|
|
119
|
+
product_id,
|
|
120
|
+
accounts,
|
|
121
|
+
)
|
|
122
|
+
|
|
123
|
+
def open_interest(
|
|
124
|
+
self,
|
|
125
|
+
product_id: hexbytes.HexBytes,
|
|
126
|
+
) -> int:
|
|
127
|
+
"""Binding for `openInterest` on the FinalSettlementFacet contract.
|
|
128
|
+
|
|
129
|
+
Parameters
|
|
130
|
+
----------
|
|
131
|
+
product_id : hexbytes.HexBytes
|
|
132
|
+
|
|
133
|
+
Returns
|
|
134
|
+
-------
|
|
135
|
+
int
|
|
136
|
+
"""
|
|
137
|
+
return_value = self._contract.functions.openInterest(
|
|
138
|
+
product_id,
|
|
139
|
+
).call()
|
|
140
|
+
return int(return_value)
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
ABI = typing.cast(
|
|
144
|
+
eth_typing.ABI,
|
|
145
|
+
[
|
|
146
|
+
{
|
|
147
|
+
"inputs": [
|
|
148
|
+
{"internalType": "bytes32", "name": "productId", "type": "bytes32"}
|
|
149
|
+
],
|
|
150
|
+
"name": "FSPAlreadyFinalized",
|
|
151
|
+
"type": "error",
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
"inputs": [
|
|
155
|
+
{"internalType": "bytes32", "name": "productId", "type": "bytes32"}
|
|
156
|
+
],
|
|
157
|
+
"name": "FSPNotFound",
|
|
158
|
+
"type": "error",
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
"inputs": [
|
|
162
|
+
{"internalType": "bytes32", "name": "productId", "type": "bytes32"},
|
|
163
|
+
{"internalType": "uint256", "name": "currentTime", "type": "uint256"},
|
|
164
|
+
{
|
|
165
|
+
"internalType": "uint256",
|
|
166
|
+
"name": "earliestFSPSubmissionTime",
|
|
167
|
+
"type": "uint256",
|
|
168
|
+
},
|
|
169
|
+
],
|
|
170
|
+
"name": "FSPTimeNotReached",
|
|
171
|
+
"type": "error",
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
"inputs": [
|
|
175
|
+
{"internalType": "address", "name": "fspAccount", "type": "address"}
|
|
176
|
+
],
|
|
177
|
+
"name": "InvalidFSPAccount",
|
|
178
|
+
"type": "error",
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
"inputs": [
|
|
182
|
+
{"internalType": "address", "name": "oracleAddress", "type": "address"}
|
|
183
|
+
],
|
|
184
|
+
"name": "InvalidOracleAddress",
|
|
185
|
+
"type": "error",
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
"inputs": [
|
|
189
|
+
{"internalType": "string", "name": "paramName", "type": "string"}
|
|
190
|
+
],
|
|
191
|
+
"name": "InvalidParameter",
|
|
192
|
+
"type": "error",
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
"inputs": [
|
|
196
|
+
{"internalType": "int256", "name": "checksum", "type": "int256"},
|
|
197
|
+
{
|
|
198
|
+
"internalType": "int256",
|
|
199
|
+
"name": "expectedChecksum",
|
|
200
|
+
"type": "int256",
|
|
201
|
+
},
|
|
202
|
+
],
|
|
203
|
+
"name": "MismatchedFSPAccountQuantities",
|
|
204
|
+
"type": "error",
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
"inputs": [
|
|
208
|
+
{"internalType": "bytes32", "name": "productId", "type": "bytes32"}
|
|
209
|
+
],
|
|
210
|
+
"name": "ProductNotInFinalSettlement",
|
|
211
|
+
"type": "error",
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
"inputs": [],
|
|
215
|
+
"name": "CLOSEOUT_FEE_RATE",
|
|
216
|
+
"outputs": [{"internalType": "uint256", "name": "", "type": "uint256"}],
|
|
217
|
+
"stateMutability": "pure",
|
|
218
|
+
"type": "function",
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
"inputs": [],
|
|
222
|
+
"name": "CLOSEOUT_REWARD_RATE",
|
|
223
|
+
"outputs": [{"internalType": "uint256", "name": "", "type": "uint256"}],
|
|
224
|
+
"stateMutability": "pure",
|
|
225
|
+
"type": "function",
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
"inputs": [
|
|
229
|
+
{"internalType": "bytes32", "name": "productID", "type": "bytes32"}
|
|
230
|
+
],
|
|
231
|
+
"name": "finalizeFsp",
|
|
232
|
+
"outputs": [{"internalType": "uint256", "name": "", "type": "uint256"}],
|
|
233
|
+
"stateMutability": "nonpayable",
|
|
234
|
+
"type": "function",
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
"inputs": [
|
|
238
|
+
{"internalType": "bytes32", "name": "productId", "type": "bytes32"}
|
|
239
|
+
],
|
|
240
|
+
"name": "getFsp",
|
|
241
|
+
"outputs": [
|
|
242
|
+
{"internalType": "uint256", "name": "fsp", "type": "uint256"},
|
|
243
|
+
{"internalType": "bool", "name": "finalized", "type": "bool"},
|
|
244
|
+
],
|
|
245
|
+
"stateMutability": "view",
|
|
246
|
+
"type": "function",
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
"inputs": [
|
|
250
|
+
{"internalType": "bytes32", "name": "productID", "type": "bytes32"},
|
|
251
|
+
{"internalType": "address[]", "name": "accounts", "type": "address[]"},
|
|
252
|
+
],
|
|
253
|
+
"name": "initiateFinalSettlement",
|
|
254
|
+
"outputs": [],
|
|
255
|
+
"stateMutability": "nonpayable",
|
|
256
|
+
"type": "function",
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
"inputs": [
|
|
260
|
+
{"internalType": "bytes32", "name": "productId", "type": "bytes32"}
|
|
261
|
+
],
|
|
262
|
+
"name": "openInterest",
|
|
263
|
+
"outputs": [{"internalType": "uint256", "name": "", "type": "uint256"}],
|
|
264
|
+
"stateMutability": "view",
|
|
265
|
+
"type": "function",
|
|
266
|
+
},
|
|
267
|
+
],
|
|
268
|
+
)
|