afp-sdk 0.5.4__py3-none-any.whl → 0.6.1__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 +4 -1
- afp/afp.py +11 -0
- afp/api/admin.py +1 -1
- afp/api/base.py +11 -2
- afp/api/margin_account.py +12 -148
- afp/api/product.py +302 -148
- afp/api/trading.py +10 -19
- afp/auth.py +14 -0
- afp/bindings/__init__.py +30 -16
- afp/bindings/admin_facet.py +890 -0
- afp/bindings/clearing_facet.py +356 -773
- afp/bindings/facade.py +9 -6
- afp/bindings/final_settlement_facet.py +258 -99
- afp/bindings/margin_account.py +524 -839
- afp/bindings/margin_account_facet.py +722 -0
- afp/bindings/margin_account_registry.py +184 -310
- afp/bindings/mark_price_tracker_facet.py +74 -16
- afp/bindings/product_registry.py +1577 -541
- afp/bindings/product_registry_facet.py +1467 -0
- afp/bindings/system_viewer.py +592 -369
- afp/bindings/types.py +223 -0
- afp/config.py +4 -0
- afp/constants.py +49 -6
- afp/decorators.py +25 -3
- afp/dtos.py +142 -0
- afp/exceptions.py +10 -0
- afp/exchange.py +10 -8
- afp/hashing.py +7 -5
- afp/ipfs.py +245 -0
- afp/json-schemas/bafyreiaw34o6l3rmatabzbds2i2myazdw2yolevcpsoyd2i2g3ms7wa2eq.json +1 -0
- afp/json-schemas/bafyreibnfg6nq74dvpkre5rakkccij7iadp5rxpim7omsatjnrpmj3y7v4.json +1 -0
- afp/json-schemas/bafyreicgr6dfo5yduixjkcifghiulskfegwojvuwodtouvivl362zndhxe.json +1 -0
- afp/json-schemas/bafyreicheoypx6synljushh7mq2572iyhlolf4nake2p5dwobgnj3r5eua.json +1 -0
- afp/json-schemas/bafyreid35a67db4sqh4fs6boddyt2xvscbqy6nqvsp5jjur56qhkw4ixre.json +1 -0
- afp/json-schemas/bafyreidzs7okcpqiss6ztftltyptqwnw5e5opsy5yntospekjha4kpykaa.json +1 -0
- afp/json-schemas/bafyreifcec2km7hxwq6oqzjlspni2mgipetjb7pqtaewh2efislzoctboi.json +1 -0
- afp/json-schemas/bafyreihn3oiaxffe4e2w7pwtreadpw3obfd7gqlogbcxm56jc2hzfvco74.json +1 -0
- afp/json-schemas/bafyreihur3dzwhja6uxsbcw6eeoj3xmmc4e3zkmyzpot5v5dleevxe5zam.json +1 -0
- afp/schemas.py +236 -177
- afp/types.py +169 -0
- afp/validators.py +218 -8
- {afp_sdk-0.5.4.dist-info → afp_sdk-0.6.1.dist-info}/METADATA +76 -11
- afp_sdk-0.6.1.dist-info/RECORD +50 -0
- afp/bindings/auctioneer_facet.py +0 -752
- afp/bindings/bankruptcy_facet.py +0 -391
- afp/bindings/trading_protocol.py +0 -1158
- afp_sdk-0.5.4.dist-info/RECORD +0 -37
- {afp_sdk-0.5.4.dist-info → afp_sdk-0.6.1.dist-info}/WHEEL +0 -0
- {afp_sdk-0.5.4.dist-info → afp_sdk-0.6.1.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,722 @@
|
|
|
1
|
+
"""MarginAccountFacet 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 import types
|
|
11
|
+
from web3.contract import contract
|
|
12
|
+
|
|
13
|
+
from .types import Settlement, MarginData, PositionData
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class MarginAccountFacet:
|
|
17
|
+
"""MarginAccountFacet contract binding.
|
|
18
|
+
|
|
19
|
+
Parameters
|
|
20
|
+
----------
|
|
21
|
+
w3 : web3.Web3
|
|
22
|
+
address : eth_typing.ChecksumAddress
|
|
23
|
+
The address of a deployed MarginAccountFacet contract.
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
_contract: contract.Contract
|
|
27
|
+
|
|
28
|
+
def __init__(
|
|
29
|
+
self,
|
|
30
|
+
w3: web3.Web3,
|
|
31
|
+
address: eth_typing.ChecksumAddress,
|
|
32
|
+
):
|
|
33
|
+
self._contract = w3.eth.contract(
|
|
34
|
+
address=address,
|
|
35
|
+
abi=ABI,
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
@property
|
|
39
|
+
def PositionUpdated(self) -> contract.ContractEvent:
|
|
40
|
+
"""Binding for `event PositionUpdated` on the MarginAccountFacet contract."""
|
|
41
|
+
return self._contract.events.PositionUpdated
|
|
42
|
+
|
|
43
|
+
def authorize(
|
|
44
|
+
self,
|
|
45
|
+
owner: eth_typing.ChecksumAddress,
|
|
46
|
+
intent_account: eth_typing.ChecksumAddress,
|
|
47
|
+
) -> contract.ContractFunction:
|
|
48
|
+
"""Binding for `authorize` on the MarginAccountFacet contract.
|
|
49
|
+
|
|
50
|
+
Parameters
|
|
51
|
+
----------
|
|
52
|
+
owner : eth_typing.ChecksumAddress
|
|
53
|
+
intent_account : eth_typing.ChecksumAddress
|
|
54
|
+
|
|
55
|
+
Returns
|
|
56
|
+
-------
|
|
57
|
+
web3.contract.contract.ContractFunction
|
|
58
|
+
A contract function instance to be sent in a transaction.
|
|
59
|
+
"""
|
|
60
|
+
return self._contract.functions.authorize(
|
|
61
|
+
owner,
|
|
62
|
+
intent_account,
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
def collateral(
|
|
66
|
+
self,
|
|
67
|
+
block_identifier: types.BlockIdentifier = "latest",
|
|
68
|
+
) -> eth_typing.ChecksumAddress:
|
|
69
|
+
"""Binding for `collateral` on the MarginAccountFacet contract.
|
|
70
|
+
|
|
71
|
+
Parameters
|
|
72
|
+
----------
|
|
73
|
+
block_identifier : web3.types.BlockIdentifier
|
|
74
|
+
The block identifier, defaults to the latest block.
|
|
75
|
+
|
|
76
|
+
Returns
|
|
77
|
+
-------
|
|
78
|
+
eth_typing.ChecksumAddress
|
|
79
|
+
"""
|
|
80
|
+
return_value = self._contract.functions.collateral().call(
|
|
81
|
+
block_identifier=block_identifier
|
|
82
|
+
)
|
|
83
|
+
return eth_typing.ChecksumAddress(return_value)
|
|
84
|
+
|
|
85
|
+
def deposit(
|
|
86
|
+
self,
|
|
87
|
+
owner: eth_typing.ChecksumAddress,
|
|
88
|
+
amount: int,
|
|
89
|
+
) -> contract.ContractFunction:
|
|
90
|
+
"""Binding for `deposit` on the MarginAccountFacet contract.
|
|
91
|
+
|
|
92
|
+
Parameters
|
|
93
|
+
----------
|
|
94
|
+
owner : eth_typing.ChecksumAddress
|
|
95
|
+
amount : int
|
|
96
|
+
|
|
97
|
+
Returns
|
|
98
|
+
-------
|
|
99
|
+
web3.contract.contract.ContractFunction
|
|
100
|
+
A contract function instance to be sent in a transaction.
|
|
101
|
+
"""
|
|
102
|
+
return self._contract.functions.deposit(
|
|
103
|
+
owner,
|
|
104
|
+
amount,
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
def estimate_additional_margin(
|
|
108
|
+
self,
|
|
109
|
+
margin_account_id: eth_typing.ChecksumAddress,
|
|
110
|
+
settlement: Settlement,
|
|
111
|
+
block_identifier: types.BlockIdentifier = "latest",
|
|
112
|
+
) -> int:
|
|
113
|
+
"""Binding for `estimateAdditionalMargin` on the MarginAccountFacet contract.
|
|
114
|
+
|
|
115
|
+
Parameters
|
|
116
|
+
----------
|
|
117
|
+
margin_account_id : eth_typing.ChecksumAddress
|
|
118
|
+
settlement : Settlement
|
|
119
|
+
block_identifier : web3.types.BlockIdentifier
|
|
120
|
+
The block identifier, defaults to the latest block.
|
|
121
|
+
|
|
122
|
+
Returns
|
|
123
|
+
-------
|
|
124
|
+
int
|
|
125
|
+
"""
|
|
126
|
+
return_value = self._contract.functions.estimateAdditionalMargin(
|
|
127
|
+
margin_account_id,
|
|
128
|
+
(settlement.product_id, settlement.quantity, settlement.price),
|
|
129
|
+
).call(block_identifier=block_identifier)
|
|
130
|
+
return int(return_value)
|
|
131
|
+
|
|
132
|
+
def is_authorized(
|
|
133
|
+
self,
|
|
134
|
+
margin_account_id: eth_typing.ChecksumAddress,
|
|
135
|
+
intent_account: eth_typing.ChecksumAddress,
|
|
136
|
+
block_identifier: types.BlockIdentifier = "latest",
|
|
137
|
+
) -> bool:
|
|
138
|
+
"""Binding for `isAuthorized` on the MarginAccountFacet contract.
|
|
139
|
+
|
|
140
|
+
Parameters
|
|
141
|
+
----------
|
|
142
|
+
margin_account_id : eth_typing.ChecksumAddress
|
|
143
|
+
intent_account : eth_typing.ChecksumAddress
|
|
144
|
+
block_identifier : web3.types.BlockIdentifier
|
|
145
|
+
The block identifier, defaults to the latest block.
|
|
146
|
+
|
|
147
|
+
Returns
|
|
148
|
+
-------
|
|
149
|
+
bool
|
|
150
|
+
"""
|
|
151
|
+
return_value = self._contract.functions.isAuthorized(
|
|
152
|
+
margin_account_id,
|
|
153
|
+
intent_account,
|
|
154
|
+
).call(block_identifier=block_identifier)
|
|
155
|
+
return bool(return_value)
|
|
156
|
+
|
|
157
|
+
def mae_check(
|
|
158
|
+
self,
|
|
159
|
+
margin_account_id: eth_typing.ChecksumAddress,
|
|
160
|
+
settlement: Settlement,
|
|
161
|
+
block_identifier: types.BlockIdentifier = "latest",
|
|
162
|
+
) -> bool:
|
|
163
|
+
"""Binding for `maeCheck` on the MarginAccountFacet contract.
|
|
164
|
+
|
|
165
|
+
Parameters
|
|
166
|
+
----------
|
|
167
|
+
margin_account_id : eth_typing.ChecksumAddress
|
|
168
|
+
settlement : Settlement
|
|
169
|
+
block_identifier : web3.types.BlockIdentifier
|
|
170
|
+
The block identifier, defaults to the latest block.
|
|
171
|
+
|
|
172
|
+
Returns
|
|
173
|
+
-------
|
|
174
|
+
bool
|
|
175
|
+
"""
|
|
176
|
+
return_value = self._contract.functions.maeCheck(
|
|
177
|
+
margin_account_id,
|
|
178
|
+
(settlement.product_id, settlement.quantity, settlement.price),
|
|
179
|
+
).call(block_identifier=block_identifier)
|
|
180
|
+
return bool(return_value)
|
|
181
|
+
|
|
182
|
+
def margin_data(
|
|
183
|
+
self,
|
|
184
|
+
margin_account_id: eth_typing.ChecksumAddress,
|
|
185
|
+
block_identifier: types.BlockIdentifier = "latest",
|
|
186
|
+
) -> MarginData:
|
|
187
|
+
"""Binding for `marginData` on the MarginAccountFacet contract.
|
|
188
|
+
|
|
189
|
+
Parameters
|
|
190
|
+
----------
|
|
191
|
+
margin_account_id : eth_typing.ChecksumAddress
|
|
192
|
+
block_identifier : web3.types.BlockIdentifier
|
|
193
|
+
The block identifier, defaults to the latest block.
|
|
194
|
+
|
|
195
|
+
Returns
|
|
196
|
+
-------
|
|
197
|
+
MarginData
|
|
198
|
+
"""
|
|
199
|
+
return_value = self._contract.functions.marginData(
|
|
200
|
+
margin_account_id,
|
|
201
|
+
).call(block_identifier=block_identifier)
|
|
202
|
+
return MarginData(
|
|
203
|
+
int(return_value[0]),
|
|
204
|
+
int(return_value[1]),
|
|
205
|
+
int(return_value[2]),
|
|
206
|
+
int(return_value[3]),
|
|
207
|
+
)
|
|
208
|
+
|
|
209
|
+
def position(
|
|
210
|
+
self,
|
|
211
|
+
margin_account_id: eth_typing.ChecksumAddress,
|
|
212
|
+
product_id: hexbytes.HexBytes,
|
|
213
|
+
block_identifier: types.BlockIdentifier = "latest",
|
|
214
|
+
) -> PositionData:
|
|
215
|
+
"""Binding for `position` on the MarginAccountFacet contract.
|
|
216
|
+
|
|
217
|
+
Parameters
|
|
218
|
+
----------
|
|
219
|
+
margin_account_id : eth_typing.ChecksumAddress
|
|
220
|
+
product_id : hexbytes.HexBytes
|
|
221
|
+
block_identifier : web3.types.BlockIdentifier
|
|
222
|
+
The block identifier, defaults to the latest block.
|
|
223
|
+
|
|
224
|
+
Returns
|
|
225
|
+
-------
|
|
226
|
+
PositionData
|
|
227
|
+
"""
|
|
228
|
+
return_value = self._contract.functions.position(
|
|
229
|
+
margin_account_id,
|
|
230
|
+
product_id,
|
|
231
|
+
).call(block_identifier=block_identifier)
|
|
232
|
+
return PositionData(
|
|
233
|
+
hexbytes.HexBytes(return_value[0]),
|
|
234
|
+
int(return_value[1]),
|
|
235
|
+
int(return_value[2]),
|
|
236
|
+
int(return_value[3]),
|
|
237
|
+
int(return_value[4]),
|
|
238
|
+
)
|
|
239
|
+
|
|
240
|
+
def products_by_margin_account(
|
|
241
|
+
self,
|
|
242
|
+
margin_account_id: eth_typing.ChecksumAddress,
|
|
243
|
+
block_identifier: types.BlockIdentifier = "latest",
|
|
244
|
+
) -> typing.List[hexbytes.HexBytes]:
|
|
245
|
+
"""Binding for `products` on the MarginAccountFacet contract.
|
|
246
|
+
|
|
247
|
+
Parameters
|
|
248
|
+
----------
|
|
249
|
+
margin_account_id : eth_typing.ChecksumAddress
|
|
250
|
+
block_identifier : web3.types.BlockIdentifier
|
|
251
|
+
The block identifier, defaults to the latest block.
|
|
252
|
+
|
|
253
|
+
Returns
|
|
254
|
+
-------
|
|
255
|
+
typing.List[hexbytes.HexBytes]
|
|
256
|
+
"""
|
|
257
|
+
return_value = self._contract.functions.products(
|
|
258
|
+
margin_account_id,
|
|
259
|
+
).call(block_identifier=block_identifier)
|
|
260
|
+
return [
|
|
261
|
+
hexbytes.HexBytes(return_value_elem) for return_value_elem in return_value
|
|
262
|
+
]
|
|
263
|
+
|
|
264
|
+
def revoke(
|
|
265
|
+
self,
|
|
266
|
+
owner: eth_typing.ChecksumAddress,
|
|
267
|
+
intent_account: eth_typing.ChecksumAddress,
|
|
268
|
+
) -> contract.ContractFunction:
|
|
269
|
+
"""Binding for `revoke` on the MarginAccountFacet contract.
|
|
270
|
+
|
|
271
|
+
Parameters
|
|
272
|
+
----------
|
|
273
|
+
owner : eth_typing.ChecksumAddress
|
|
274
|
+
intent_account : eth_typing.ChecksumAddress
|
|
275
|
+
|
|
276
|
+
Returns
|
|
277
|
+
-------
|
|
278
|
+
web3.contract.contract.ContractFunction
|
|
279
|
+
A contract function instance to be sent in a transaction.
|
|
280
|
+
"""
|
|
281
|
+
return self._contract.functions.revoke(
|
|
282
|
+
owner,
|
|
283
|
+
intent_account,
|
|
284
|
+
)
|
|
285
|
+
|
|
286
|
+
def state_after_settlement(
|
|
287
|
+
self,
|
|
288
|
+
margin_account_id: eth_typing.ChecksumAddress,
|
|
289
|
+
settlement: Settlement,
|
|
290
|
+
block_identifier: types.BlockIdentifier = "latest",
|
|
291
|
+
) -> typing.Tuple[int, int]:
|
|
292
|
+
"""Binding for `stateAfterSettlement` on the MarginAccountFacet contract.
|
|
293
|
+
|
|
294
|
+
Parameters
|
|
295
|
+
----------
|
|
296
|
+
margin_account_id : eth_typing.ChecksumAddress
|
|
297
|
+
settlement : Settlement
|
|
298
|
+
block_identifier : web3.types.BlockIdentifier
|
|
299
|
+
The block identifier, defaults to the latest block.
|
|
300
|
+
|
|
301
|
+
Returns
|
|
302
|
+
-------
|
|
303
|
+
int
|
|
304
|
+
int
|
|
305
|
+
"""
|
|
306
|
+
return_value = self._contract.functions.stateAfterSettlement(
|
|
307
|
+
margin_account_id,
|
|
308
|
+
(settlement.product_id, settlement.quantity, settlement.price),
|
|
309
|
+
).call(block_identifier=block_identifier)
|
|
310
|
+
return (
|
|
311
|
+
int(return_value[0]),
|
|
312
|
+
int(return_value[1]),
|
|
313
|
+
)
|
|
314
|
+
|
|
315
|
+
def withdraw(
|
|
316
|
+
self,
|
|
317
|
+
owner: eth_typing.ChecksumAddress,
|
|
318
|
+
amount: int,
|
|
319
|
+
) -> contract.ContractFunction:
|
|
320
|
+
"""Binding for `withdraw` on the MarginAccountFacet contract.
|
|
321
|
+
|
|
322
|
+
Parameters
|
|
323
|
+
----------
|
|
324
|
+
owner : eth_typing.ChecksumAddress
|
|
325
|
+
amount : int
|
|
326
|
+
|
|
327
|
+
Returns
|
|
328
|
+
-------
|
|
329
|
+
web3.contract.contract.ContractFunction
|
|
330
|
+
A contract function instance to be sent in a transaction.
|
|
331
|
+
"""
|
|
332
|
+
return self._contract.functions.withdraw(
|
|
333
|
+
owner,
|
|
334
|
+
amount,
|
|
335
|
+
)
|
|
336
|
+
|
|
337
|
+
|
|
338
|
+
ABI = typing.cast(
|
|
339
|
+
eth_typing.ABI,
|
|
340
|
+
[
|
|
341
|
+
{
|
|
342
|
+
"type": "function",
|
|
343
|
+
"name": "authorize",
|
|
344
|
+
"inputs": [
|
|
345
|
+
{"name": "owner", "type": "address", "internalType": "address"},
|
|
346
|
+
{"name": "intentAccount", "type": "address", "internalType": "address"},
|
|
347
|
+
],
|
|
348
|
+
"outputs": [],
|
|
349
|
+
"stateMutability": "nonpayable",
|
|
350
|
+
},
|
|
351
|
+
{
|
|
352
|
+
"type": "function",
|
|
353
|
+
"name": "collateral",
|
|
354
|
+
"inputs": [],
|
|
355
|
+
"outputs": [{"name": "", "type": "address", "internalType": "address"}],
|
|
356
|
+
"stateMutability": "view",
|
|
357
|
+
},
|
|
358
|
+
{
|
|
359
|
+
"type": "function",
|
|
360
|
+
"name": "deposit",
|
|
361
|
+
"inputs": [
|
|
362
|
+
{"name": "owner", "type": "address", "internalType": "address"},
|
|
363
|
+
{"name": "amount", "type": "uint256", "internalType": "uint256"},
|
|
364
|
+
],
|
|
365
|
+
"outputs": [],
|
|
366
|
+
"stateMutability": "nonpayable",
|
|
367
|
+
},
|
|
368
|
+
{
|
|
369
|
+
"type": "function",
|
|
370
|
+
"name": "estimateAdditionalMargin",
|
|
371
|
+
"inputs": [
|
|
372
|
+
{
|
|
373
|
+
"name": "marginAccountId",
|
|
374
|
+
"type": "address",
|
|
375
|
+
"internalType": "address",
|
|
376
|
+
},
|
|
377
|
+
{
|
|
378
|
+
"name": "settlement",
|
|
379
|
+
"type": "tuple",
|
|
380
|
+
"internalType": "struct Settlement",
|
|
381
|
+
"components": [
|
|
382
|
+
{
|
|
383
|
+
"name": "productId",
|
|
384
|
+
"type": "bytes32",
|
|
385
|
+
"internalType": "bytes32",
|
|
386
|
+
},
|
|
387
|
+
{
|
|
388
|
+
"name": "quantity",
|
|
389
|
+
"type": "int256",
|
|
390
|
+
"internalType": "int256",
|
|
391
|
+
},
|
|
392
|
+
{"name": "price", "type": "int256", "internalType": "int256"},
|
|
393
|
+
],
|
|
394
|
+
},
|
|
395
|
+
],
|
|
396
|
+
"outputs": [
|
|
397
|
+
{
|
|
398
|
+
"name": "additionalMargin",
|
|
399
|
+
"type": "uint256",
|
|
400
|
+
"internalType": "uint256",
|
|
401
|
+
}
|
|
402
|
+
],
|
|
403
|
+
"stateMutability": "view",
|
|
404
|
+
},
|
|
405
|
+
{
|
|
406
|
+
"type": "function",
|
|
407
|
+
"name": "isAuthorized",
|
|
408
|
+
"inputs": [
|
|
409
|
+
{
|
|
410
|
+
"name": "marginAccountId",
|
|
411
|
+
"type": "address",
|
|
412
|
+
"internalType": "address",
|
|
413
|
+
},
|
|
414
|
+
{"name": "intentAccount", "type": "address", "internalType": "address"},
|
|
415
|
+
],
|
|
416
|
+
"outputs": [{"name": "", "type": "bool", "internalType": "bool"}],
|
|
417
|
+
"stateMutability": "view",
|
|
418
|
+
},
|
|
419
|
+
{
|
|
420
|
+
"type": "function",
|
|
421
|
+
"name": "maeCheck",
|
|
422
|
+
"inputs": [
|
|
423
|
+
{
|
|
424
|
+
"name": "marginAccountId",
|
|
425
|
+
"type": "address",
|
|
426
|
+
"internalType": "address",
|
|
427
|
+
},
|
|
428
|
+
{
|
|
429
|
+
"name": "settlement",
|
|
430
|
+
"type": "tuple",
|
|
431
|
+
"internalType": "struct Settlement",
|
|
432
|
+
"components": [
|
|
433
|
+
{
|
|
434
|
+
"name": "productId",
|
|
435
|
+
"type": "bytes32",
|
|
436
|
+
"internalType": "bytes32",
|
|
437
|
+
},
|
|
438
|
+
{
|
|
439
|
+
"name": "quantity",
|
|
440
|
+
"type": "int256",
|
|
441
|
+
"internalType": "int256",
|
|
442
|
+
},
|
|
443
|
+
{"name": "price", "type": "int256", "internalType": "int256"},
|
|
444
|
+
],
|
|
445
|
+
},
|
|
446
|
+
],
|
|
447
|
+
"outputs": [
|
|
448
|
+
{"name": "checkPassed", "type": "bool", "internalType": "bool"}
|
|
449
|
+
],
|
|
450
|
+
"stateMutability": "view",
|
|
451
|
+
},
|
|
452
|
+
{
|
|
453
|
+
"type": "function",
|
|
454
|
+
"name": "marginData",
|
|
455
|
+
"inputs": [
|
|
456
|
+
{
|
|
457
|
+
"name": "marginAccountId",
|
|
458
|
+
"type": "address",
|
|
459
|
+
"internalType": "address",
|
|
460
|
+
}
|
|
461
|
+
],
|
|
462
|
+
"outputs": [
|
|
463
|
+
{
|
|
464
|
+
"name": "",
|
|
465
|
+
"type": "tuple",
|
|
466
|
+
"internalType": "struct IMarginAccountFacet.MarginData",
|
|
467
|
+
"components": [
|
|
468
|
+
{"name": "capital", "type": "int256", "internalType": "int256"},
|
|
469
|
+
{"name": "mae", "type": "int256", "internalType": "int256"},
|
|
470
|
+
{"name": "mmu", "type": "uint256", "internalType": "uint256"},
|
|
471
|
+
{"name": "pnl", "type": "int256", "internalType": "int256"},
|
|
472
|
+
],
|
|
473
|
+
}
|
|
474
|
+
],
|
|
475
|
+
"stateMutability": "view",
|
|
476
|
+
},
|
|
477
|
+
{
|
|
478
|
+
"type": "function",
|
|
479
|
+
"name": "position",
|
|
480
|
+
"inputs": [
|
|
481
|
+
{
|
|
482
|
+
"name": "marginAccountId",
|
|
483
|
+
"type": "address",
|
|
484
|
+
"internalType": "address",
|
|
485
|
+
},
|
|
486
|
+
{"name": "productId", "type": "bytes32", "internalType": "bytes32"},
|
|
487
|
+
],
|
|
488
|
+
"outputs": [
|
|
489
|
+
{
|
|
490
|
+
"name": "",
|
|
491
|
+
"type": "tuple",
|
|
492
|
+
"internalType": "struct PositionData",
|
|
493
|
+
"components": [
|
|
494
|
+
{
|
|
495
|
+
"name": "productId",
|
|
496
|
+
"type": "bytes32",
|
|
497
|
+
"internalType": "bytes32",
|
|
498
|
+
},
|
|
499
|
+
{
|
|
500
|
+
"name": "quantity",
|
|
501
|
+
"type": "int256",
|
|
502
|
+
"internalType": "int256",
|
|
503
|
+
},
|
|
504
|
+
{
|
|
505
|
+
"name": "costBasis",
|
|
506
|
+
"type": "int256",
|
|
507
|
+
"internalType": "int256",
|
|
508
|
+
},
|
|
509
|
+
{
|
|
510
|
+
"name": "maintenanceMargin",
|
|
511
|
+
"type": "uint256",
|
|
512
|
+
"internalType": "uint256",
|
|
513
|
+
},
|
|
514
|
+
{"name": "pnl", "type": "int256", "internalType": "int256"},
|
|
515
|
+
],
|
|
516
|
+
}
|
|
517
|
+
],
|
|
518
|
+
"stateMutability": "view",
|
|
519
|
+
},
|
|
520
|
+
{
|
|
521
|
+
"type": "function",
|
|
522
|
+
"name": "products",
|
|
523
|
+
"inputs": [
|
|
524
|
+
{
|
|
525
|
+
"name": "marginAccountId",
|
|
526
|
+
"type": "address",
|
|
527
|
+
"internalType": "address",
|
|
528
|
+
}
|
|
529
|
+
],
|
|
530
|
+
"outputs": [{"name": "", "type": "bytes32[]", "internalType": "bytes32[]"}],
|
|
531
|
+
"stateMutability": "view",
|
|
532
|
+
},
|
|
533
|
+
{
|
|
534
|
+
"type": "function",
|
|
535
|
+
"name": "revoke",
|
|
536
|
+
"inputs": [
|
|
537
|
+
{"name": "owner", "type": "address", "internalType": "address"},
|
|
538
|
+
{"name": "intentAccount", "type": "address", "internalType": "address"},
|
|
539
|
+
],
|
|
540
|
+
"outputs": [],
|
|
541
|
+
"stateMutability": "nonpayable",
|
|
542
|
+
},
|
|
543
|
+
{
|
|
544
|
+
"type": "function",
|
|
545
|
+
"name": "stateAfterSettlement",
|
|
546
|
+
"inputs": [
|
|
547
|
+
{
|
|
548
|
+
"name": "marginAccountId",
|
|
549
|
+
"type": "address",
|
|
550
|
+
"internalType": "address",
|
|
551
|
+
},
|
|
552
|
+
{
|
|
553
|
+
"name": "settlement",
|
|
554
|
+
"type": "tuple",
|
|
555
|
+
"internalType": "struct Settlement",
|
|
556
|
+
"components": [
|
|
557
|
+
{
|
|
558
|
+
"name": "productId",
|
|
559
|
+
"type": "bytes32",
|
|
560
|
+
"internalType": "bytes32",
|
|
561
|
+
},
|
|
562
|
+
{
|
|
563
|
+
"name": "quantity",
|
|
564
|
+
"type": "int256",
|
|
565
|
+
"internalType": "int256",
|
|
566
|
+
},
|
|
567
|
+
{"name": "price", "type": "int256", "internalType": "int256"},
|
|
568
|
+
],
|
|
569
|
+
},
|
|
570
|
+
],
|
|
571
|
+
"outputs": [
|
|
572
|
+
{"name": "maeAfter", "type": "int256", "internalType": "int256"},
|
|
573
|
+
{"name": "mmuAfter", "type": "uint256", "internalType": "uint256"},
|
|
574
|
+
],
|
|
575
|
+
"stateMutability": "view",
|
|
576
|
+
},
|
|
577
|
+
{
|
|
578
|
+
"type": "function",
|
|
579
|
+
"name": "withdraw",
|
|
580
|
+
"inputs": [
|
|
581
|
+
{"name": "owner", "type": "address", "internalType": "address"},
|
|
582
|
+
{"name": "amount", "type": "uint256", "internalType": "uint256"},
|
|
583
|
+
],
|
|
584
|
+
"outputs": [],
|
|
585
|
+
"stateMutability": "nonpayable",
|
|
586
|
+
},
|
|
587
|
+
{
|
|
588
|
+
"type": "event",
|
|
589
|
+
"name": "PositionUpdated",
|
|
590
|
+
"inputs": [
|
|
591
|
+
{
|
|
592
|
+
"name": "marginAccountId",
|
|
593
|
+
"type": "address",
|
|
594
|
+
"indexed": True,
|
|
595
|
+
"internalType": "address",
|
|
596
|
+
},
|
|
597
|
+
{
|
|
598
|
+
"name": "positionId",
|
|
599
|
+
"type": "bytes32",
|
|
600
|
+
"indexed": True,
|
|
601
|
+
"internalType": "bytes32",
|
|
602
|
+
},
|
|
603
|
+
{
|
|
604
|
+
"name": "costBasis",
|
|
605
|
+
"type": "int256",
|
|
606
|
+
"indexed": False,
|
|
607
|
+
"internalType": "int256",
|
|
608
|
+
},
|
|
609
|
+
{
|
|
610
|
+
"name": "price",
|
|
611
|
+
"type": "int256",
|
|
612
|
+
"indexed": False,
|
|
613
|
+
"internalType": "int256",
|
|
614
|
+
},
|
|
615
|
+
{
|
|
616
|
+
"name": "quantity",
|
|
617
|
+
"type": "int256",
|
|
618
|
+
"indexed": False,
|
|
619
|
+
"internalType": "int256",
|
|
620
|
+
},
|
|
621
|
+
{
|
|
622
|
+
"name": "id",
|
|
623
|
+
"type": "uint256",
|
|
624
|
+
"indexed": False,
|
|
625
|
+
"internalType": "uint256",
|
|
626
|
+
},
|
|
627
|
+
],
|
|
628
|
+
"anonymous": False,
|
|
629
|
+
},
|
|
630
|
+
{"type": "error", "name": "EVWMA_NotInitialized", "inputs": []},
|
|
631
|
+
{
|
|
632
|
+
"type": "error",
|
|
633
|
+
"name": "InsufficientBalance",
|
|
634
|
+
"inputs": [
|
|
635
|
+
{"name": "account", "type": "address", "internalType": "address"},
|
|
636
|
+
{"name": "balance", "type": "uint256", "internalType": "uint256"},
|
|
637
|
+
{"name": "required", "type": "uint256", "internalType": "uint256"},
|
|
638
|
+
],
|
|
639
|
+
},
|
|
640
|
+
{
|
|
641
|
+
"type": "error",
|
|
642
|
+
"name": "InvalidFieldAccess",
|
|
643
|
+
"inputs": [
|
|
644
|
+
{
|
|
645
|
+
"name": "productType",
|
|
646
|
+
"type": "uint8",
|
|
647
|
+
"internalType": "enum ProductType",
|
|
648
|
+
},
|
|
649
|
+
{"name": "field", "type": "string", "internalType": "string"},
|
|
650
|
+
],
|
|
651
|
+
},
|
|
652
|
+
{
|
|
653
|
+
"type": "error",
|
|
654
|
+
"name": "NotFound",
|
|
655
|
+
"inputs": [
|
|
656
|
+
{"name": "parameter", "type": "string", "internalType": "string"}
|
|
657
|
+
],
|
|
658
|
+
},
|
|
659
|
+
{
|
|
660
|
+
"type": "error",
|
|
661
|
+
"name": "PRBMath_MulDiv18_Overflow",
|
|
662
|
+
"inputs": [
|
|
663
|
+
{"name": "x", "type": "uint256", "internalType": "uint256"},
|
|
664
|
+
{"name": "y", "type": "uint256", "internalType": "uint256"},
|
|
665
|
+
],
|
|
666
|
+
},
|
|
667
|
+
{
|
|
668
|
+
"type": "error",
|
|
669
|
+
"name": "PRBMath_MulDiv_Overflow",
|
|
670
|
+
"inputs": [
|
|
671
|
+
{"name": "x", "type": "uint256", "internalType": "uint256"},
|
|
672
|
+
{"name": "y", "type": "uint256", "internalType": "uint256"},
|
|
673
|
+
{"name": "denominator", "type": "uint256", "internalType": "uint256"},
|
|
674
|
+
],
|
|
675
|
+
},
|
|
676
|
+
{"type": "error", "name": "PRBMath_SD59x18_Div_InputTooSmall", "inputs": []},
|
|
677
|
+
{
|
|
678
|
+
"type": "error",
|
|
679
|
+
"name": "PRBMath_SD59x18_Div_Overflow",
|
|
680
|
+
"inputs": [
|
|
681
|
+
{"name": "x", "type": "int256", "internalType": "SD59x18"},
|
|
682
|
+
{"name": "y", "type": "int256", "internalType": "SD59x18"},
|
|
683
|
+
],
|
|
684
|
+
},
|
|
685
|
+
{
|
|
686
|
+
"type": "error",
|
|
687
|
+
"name": "PRBMath_SD59x18_Exp2_InputTooBig",
|
|
688
|
+
"inputs": [{"name": "x", "type": "int256", "internalType": "SD59x18"}],
|
|
689
|
+
},
|
|
690
|
+
{
|
|
691
|
+
"type": "error",
|
|
692
|
+
"name": "PRBMath_SD59x18_Exp_InputTooBig",
|
|
693
|
+
"inputs": [{"name": "x", "type": "int256", "internalType": "SD59x18"}],
|
|
694
|
+
},
|
|
695
|
+
{"type": "error", "name": "PRBMath_SD59x18_Mul_InputTooSmall", "inputs": []},
|
|
696
|
+
{
|
|
697
|
+
"type": "error",
|
|
698
|
+
"name": "PRBMath_SD59x18_Mul_Overflow",
|
|
699
|
+
"inputs": [
|
|
700
|
+
{"name": "x", "type": "int256", "internalType": "SD59x18"},
|
|
701
|
+
{"name": "y", "type": "int256", "internalType": "SD59x18"},
|
|
702
|
+
],
|
|
703
|
+
},
|
|
704
|
+
{
|
|
705
|
+
"type": "error",
|
|
706
|
+
"name": "SafeCastOverflowedIntToUint",
|
|
707
|
+
"inputs": [{"name": "value", "type": "int256", "internalType": "int256"}],
|
|
708
|
+
},
|
|
709
|
+
{
|
|
710
|
+
"type": "error",
|
|
711
|
+
"name": "SafeCastOverflowedUintToInt",
|
|
712
|
+
"inputs": [{"name": "value", "type": "uint256", "internalType": "uint256"}],
|
|
713
|
+
},
|
|
714
|
+
{
|
|
715
|
+
"type": "error",
|
|
716
|
+
"name": "Unauthorized",
|
|
717
|
+
"inputs": [
|
|
718
|
+
{"name": "account", "type": "address", "internalType": "address"}
|
|
719
|
+
],
|
|
720
|
+
},
|
|
721
|
+
],
|
|
722
|
+
)
|