afp-sdk 0.5.3__py3-none-any.whl → 0.6.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 +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 +19 -22
- 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 +14 -0
- afp/exchange.py +13 -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 +228 -176
- afp/types.py +169 -0
- afp/validators.py +218 -8
- {afp_sdk-0.5.3.dist-info → afp_sdk-0.6.0.dist-info}/METADATA +73 -10
- afp_sdk-0.6.0.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.3.dist-info/RECORD +0 -37
- {afp_sdk-0.5.3.dist-info → afp_sdk-0.6.0.dist-info}/WHEEL +0 -0
- {afp_sdk-0.5.3.dist-info → afp_sdk-0.6.0.dist-info}/licenses/LICENSE +0 -0
afp/bindings/margin_account.py
CHANGED
|
@@ -3,32 +3,14 @@
|
|
|
3
3
|
# This module has been generated using pyabigen v0.2.16
|
|
4
4
|
|
|
5
5
|
import typing
|
|
6
|
-
from dataclasses import dataclass
|
|
7
6
|
|
|
8
7
|
import eth_typing
|
|
9
8
|
import hexbytes
|
|
10
9
|
import web3
|
|
10
|
+
from web3 import types
|
|
11
11
|
from web3.contract import contract
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
@dataclass
|
|
15
|
-
class Settlement:
|
|
16
|
-
"""Port of `struct Settlement` on the IMarginAccount contract."""
|
|
17
|
-
|
|
18
|
-
position_id: hexbytes.HexBytes
|
|
19
|
-
quantity: int
|
|
20
|
-
price: int
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
@dataclass
|
|
24
|
-
class PositionData:
|
|
25
|
-
"""Port of `struct PositionData` on the IMarginAccount contract."""
|
|
26
|
-
|
|
27
|
-
position_id: hexbytes.HexBytes
|
|
28
|
-
quantity: int
|
|
29
|
-
cost_basis: int
|
|
30
|
-
maintenance_margin: int
|
|
31
|
-
pnl: int
|
|
13
|
+
from .types import PositionData
|
|
32
14
|
|
|
33
15
|
|
|
34
16
|
class MarginAccount:
|
|
@@ -58,16 +40,6 @@ class MarginAccount:
|
|
|
58
40
|
"""Binding for `event Deposit` on the MarginAccount contract."""
|
|
59
41
|
return self._contract.events.Deposit
|
|
60
42
|
|
|
61
|
-
@property
|
|
62
|
-
def FeeCollected(self) -> contract.ContractEvent:
|
|
63
|
-
"""Binding for `event FeeCollected` on the MarginAccount contract."""
|
|
64
|
-
return self._contract.events.FeeCollected
|
|
65
|
-
|
|
66
|
-
@property
|
|
67
|
-
def FeeDispersed(self) -> contract.ContractEvent:
|
|
68
|
-
"""Binding for `event FeeDispersed` on the MarginAccount contract."""
|
|
69
|
-
return self._contract.events.FeeDispersed
|
|
70
|
-
|
|
71
43
|
@property
|
|
72
44
|
def Initialized(self) -> contract.ContractEvent:
|
|
73
45
|
"""Binding for `event Initialized` on the MarginAccount contract."""
|
|
@@ -83,6 +55,11 @@ class MarginAccount:
|
|
|
83
55
|
"""Binding for `event IntentRevoked` on the MarginAccount contract."""
|
|
84
56
|
return self._contract.events.IntentRevoked
|
|
85
57
|
|
|
58
|
+
@property
|
|
59
|
+
def OwnershipTransferred(self) -> contract.ContractEvent:
|
|
60
|
+
"""Binding for `event OwnershipTransferred` on the MarginAccount contract."""
|
|
61
|
+
return self._contract.events.OwnershipTransferred
|
|
62
|
+
|
|
86
63
|
@property
|
|
87
64
|
def PositionUpdated(self) -> contract.ContractEvent:
|
|
88
65
|
"""Binding for `event PositionUpdated` on the MarginAccount contract."""
|
|
@@ -93,176 +70,173 @@ class MarginAccount:
|
|
|
93
70
|
"""Binding for `event Withdraw` on the MarginAccount contract."""
|
|
94
71
|
return self._contract.events.Withdraw
|
|
95
72
|
|
|
96
|
-
def
|
|
73
|
+
def add_allowed(
|
|
97
74
|
self,
|
|
98
|
-
|
|
75
|
+
addr: eth_typing.ChecksumAddress,
|
|
99
76
|
) -> contract.ContractFunction:
|
|
100
|
-
"""Binding for `
|
|
77
|
+
"""Binding for `addAllowed` on the MarginAccount contract.
|
|
101
78
|
|
|
102
79
|
Parameters
|
|
103
80
|
----------
|
|
104
|
-
|
|
81
|
+
addr : eth_typing.ChecksumAddress
|
|
105
82
|
|
|
106
83
|
Returns
|
|
107
84
|
-------
|
|
108
85
|
web3.contract.contract.ContractFunction
|
|
109
86
|
A contract function instance to be sent in a transaction.
|
|
110
87
|
"""
|
|
111
|
-
return self._contract.functions.
|
|
112
|
-
|
|
88
|
+
return self._contract.functions.addAllowed(
|
|
89
|
+
addr,
|
|
113
90
|
)
|
|
114
91
|
|
|
115
|
-
def
|
|
92
|
+
def admin(
|
|
116
93
|
self,
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
"""Binding for `authorized` on the MarginAccount contract.
|
|
94
|
+
block_identifier: types.BlockIdentifier = "latest",
|
|
95
|
+
) -> eth_typing.ChecksumAddress:
|
|
96
|
+
"""Binding for `admin` on the MarginAccount contract.
|
|
121
97
|
|
|
122
98
|
Parameters
|
|
123
99
|
----------
|
|
124
|
-
|
|
125
|
-
|
|
100
|
+
block_identifier : web3.types.BlockIdentifier
|
|
101
|
+
The block identifier, defaults to the latest block.
|
|
126
102
|
|
|
127
103
|
Returns
|
|
128
104
|
-------
|
|
129
|
-
|
|
105
|
+
eth_typing.ChecksumAddress
|
|
130
106
|
"""
|
|
131
|
-
return_value = self._contract.functions.
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
return bool(return_value)
|
|
107
|
+
return_value = self._contract.functions.admin().call(
|
|
108
|
+
block_identifier=block_identifier
|
|
109
|
+
)
|
|
110
|
+
return eth_typing.ChecksumAddress(return_value)
|
|
136
111
|
|
|
137
|
-
def
|
|
112
|
+
def allowed(
|
|
138
113
|
self,
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
) -> typing.Tuple[bool, int, int]:
|
|
143
|
-
"""Binding for `batchMaeCheck` on the MarginAccount contract.
|
|
114
|
+
block_identifier: types.BlockIdentifier = "latest",
|
|
115
|
+
) -> typing.List[eth_typing.ChecksumAddress]:
|
|
116
|
+
"""Binding for `allowed` on the MarginAccount contract.
|
|
144
117
|
|
|
145
118
|
Parameters
|
|
146
119
|
----------
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
mark_price_if_settled : typing.List[int]
|
|
120
|
+
block_identifier : web3.types.BlockIdentifier
|
|
121
|
+
The block identifier, defaults to the latest block.
|
|
150
122
|
|
|
151
123
|
Returns
|
|
152
124
|
-------
|
|
153
|
-
|
|
154
|
-
int
|
|
155
|
-
int
|
|
125
|
+
typing.List[eth_typing.ChecksumAddress]
|
|
156
126
|
"""
|
|
157
|
-
return_value = self._contract.functions.
|
|
158
|
-
|
|
159
|
-
[(item.position_id, item.quantity, item.price) for item in settlements],
|
|
160
|
-
mark_price_if_settled,
|
|
161
|
-
).call()
|
|
162
|
-
return (
|
|
163
|
-
bool(return_value[0]),
|
|
164
|
-
int(return_value[1]),
|
|
165
|
-
int(return_value[2]),
|
|
127
|
+
return_value = self._contract.functions.allowed().call(
|
|
128
|
+
block_identifier=block_identifier
|
|
166
129
|
)
|
|
130
|
+
return [
|
|
131
|
+
eth_typing.ChecksumAddress(return_value_elem)
|
|
132
|
+
for return_value_elem in return_value
|
|
133
|
+
]
|
|
167
134
|
|
|
168
|
-
def
|
|
135
|
+
def authorize(
|
|
169
136
|
self,
|
|
170
|
-
|
|
171
|
-
settlements: typing.List[Settlement],
|
|
137
|
+
intent_account: eth_typing.ChecksumAddress,
|
|
172
138
|
) -> contract.ContractFunction:
|
|
173
|
-
"""Binding for `
|
|
139
|
+
"""Binding for `authorize` on the MarginAccount contract.
|
|
174
140
|
|
|
175
141
|
Parameters
|
|
176
142
|
----------
|
|
177
|
-
|
|
178
|
-
settlements : typing.List[Settlement]
|
|
143
|
+
intent_account : eth_typing.ChecksumAddress
|
|
179
144
|
|
|
180
145
|
Returns
|
|
181
146
|
-------
|
|
182
147
|
web3.contract.contract.ContractFunction
|
|
183
148
|
A contract function instance to be sent in a transaction.
|
|
184
149
|
"""
|
|
185
|
-
return self._contract.functions.
|
|
186
|
-
|
|
187
|
-
[(item.position_id, item.quantity, item.price) for item in settlements],
|
|
150
|
+
return self._contract.functions.authorize(
|
|
151
|
+
intent_account,
|
|
188
152
|
)
|
|
189
153
|
|
|
154
|
+
def authorized(
|
|
155
|
+
self,
|
|
156
|
+
margin_account_id: eth_typing.ChecksumAddress,
|
|
157
|
+
intent_account: eth_typing.ChecksumAddress,
|
|
158
|
+
block_identifier: types.BlockIdentifier = "latest",
|
|
159
|
+
) -> bool:
|
|
160
|
+
"""Binding for `authorized` on the MarginAccount contract.
|
|
161
|
+
|
|
162
|
+
Parameters
|
|
163
|
+
----------
|
|
164
|
+
margin_account_id : eth_typing.ChecksumAddress
|
|
165
|
+
intent_account : eth_typing.ChecksumAddress
|
|
166
|
+
block_identifier : web3.types.BlockIdentifier
|
|
167
|
+
The block identifier, defaults to the latest block.
|
|
168
|
+
|
|
169
|
+
Returns
|
|
170
|
+
-------
|
|
171
|
+
bool
|
|
172
|
+
"""
|
|
173
|
+
return_value = self._contract.functions.authorized(
|
|
174
|
+
margin_account_id,
|
|
175
|
+
intent_account,
|
|
176
|
+
).call(block_identifier=block_identifier)
|
|
177
|
+
return bool(return_value)
|
|
178
|
+
|
|
190
179
|
def capital(
|
|
191
180
|
self,
|
|
192
|
-
|
|
181
|
+
margin_account_id: eth_typing.ChecksumAddress,
|
|
182
|
+
block_identifier: types.BlockIdentifier = "latest",
|
|
193
183
|
) -> int:
|
|
194
184
|
"""Binding for `capital` on the MarginAccount contract.
|
|
195
185
|
|
|
196
186
|
Parameters
|
|
197
187
|
----------
|
|
198
|
-
|
|
188
|
+
margin_account_id : eth_typing.ChecksumAddress
|
|
189
|
+
block_identifier : web3.types.BlockIdentifier
|
|
190
|
+
The block identifier, defaults to the latest block.
|
|
199
191
|
|
|
200
192
|
Returns
|
|
201
193
|
-------
|
|
202
194
|
int
|
|
203
195
|
"""
|
|
204
196
|
return_value = self._contract.functions.capital(
|
|
205
|
-
|
|
206
|
-
).call()
|
|
197
|
+
margin_account_id,
|
|
198
|
+
).call(block_identifier=block_identifier)
|
|
207
199
|
return int(return_value)
|
|
208
200
|
|
|
209
201
|
def clearing(
|
|
210
202
|
self,
|
|
203
|
+
block_identifier: types.BlockIdentifier = "latest",
|
|
211
204
|
) -> eth_typing.ChecksumAddress:
|
|
212
205
|
"""Binding for `clearing` on the MarginAccount contract.
|
|
213
206
|
|
|
207
|
+
Parameters
|
|
208
|
+
----------
|
|
209
|
+
block_identifier : web3.types.BlockIdentifier
|
|
210
|
+
The block identifier, defaults to the latest block.
|
|
211
|
+
|
|
214
212
|
Returns
|
|
215
213
|
-------
|
|
216
214
|
eth_typing.ChecksumAddress
|
|
217
215
|
"""
|
|
218
|
-
return_value = self._contract.functions.clearing().call(
|
|
216
|
+
return_value = self._contract.functions.clearing().call(
|
|
217
|
+
block_identifier=block_identifier
|
|
218
|
+
)
|
|
219
219
|
return eth_typing.ChecksumAddress(return_value)
|
|
220
220
|
|
|
221
221
|
def collateral_asset(
|
|
222
222
|
self,
|
|
223
|
+
block_identifier: types.BlockIdentifier = "latest",
|
|
223
224
|
) -> eth_typing.ChecksumAddress:
|
|
224
225
|
"""Binding for `collateralAsset` on the MarginAccount contract.
|
|
225
226
|
|
|
226
|
-
Returns
|
|
227
|
-
-------
|
|
228
|
-
eth_typing.ChecksumAddress
|
|
229
|
-
"""
|
|
230
|
-
return_value = self._contract.functions.collateralAsset().call()
|
|
231
|
-
return eth_typing.ChecksumAddress(return_value)
|
|
232
|
-
|
|
233
|
-
def collateral_token(
|
|
234
|
-
self,
|
|
235
|
-
) -> eth_typing.ChecksumAddress:
|
|
236
|
-
"""Binding for `collateralToken` on the MarginAccount contract.
|
|
237
|
-
|
|
238
|
-
Returns
|
|
239
|
-
-------
|
|
240
|
-
eth_typing.ChecksumAddress
|
|
241
|
-
"""
|
|
242
|
-
return_value = self._contract.functions.collateralToken().call()
|
|
243
|
-
return eth_typing.ChecksumAddress(return_value)
|
|
244
|
-
|
|
245
|
-
def collect_fee(
|
|
246
|
-
self,
|
|
247
|
-
margin_account: eth_typing.ChecksumAddress,
|
|
248
|
-
capital_amount: int,
|
|
249
|
-
) -> contract.ContractFunction:
|
|
250
|
-
"""Binding for `collectFee` on the MarginAccount contract.
|
|
251
|
-
|
|
252
227
|
Parameters
|
|
253
228
|
----------
|
|
254
|
-
|
|
255
|
-
|
|
229
|
+
block_identifier : web3.types.BlockIdentifier
|
|
230
|
+
The block identifier, defaults to the latest block.
|
|
256
231
|
|
|
257
232
|
Returns
|
|
258
233
|
-------
|
|
259
|
-
|
|
260
|
-
A contract function instance to be sent in a transaction.
|
|
234
|
+
eth_typing.ChecksumAddress
|
|
261
235
|
"""
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
capital_amount,
|
|
236
|
+
return_value = self._contract.functions.collateralAsset().call(
|
|
237
|
+
block_identifier=block_identifier
|
|
265
238
|
)
|
|
239
|
+
return eth_typing.ChecksumAddress(return_value)
|
|
266
240
|
|
|
267
241
|
def deposit(
|
|
268
242
|
self,
|
|
@@ -283,93 +257,37 @@ class MarginAccount:
|
|
|
283
257
|
amount,
|
|
284
258
|
)
|
|
285
259
|
|
|
286
|
-
def
|
|
260
|
+
def deposit_for(
|
|
287
261
|
self,
|
|
288
|
-
|
|
289
|
-
|
|
262
|
+
margin_account_id: eth_typing.ChecksumAddress,
|
|
263
|
+
amount: int,
|
|
290
264
|
) -> contract.ContractFunction:
|
|
291
|
-
"""Binding for `
|
|
265
|
+
"""Binding for `depositFor` on the MarginAccount contract.
|
|
292
266
|
|
|
293
267
|
Parameters
|
|
294
268
|
----------
|
|
295
|
-
|
|
296
|
-
|
|
269
|
+
margin_account_id : eth_typing.ChecksumAddress
|
|
270
|
+
amount : int
|
|
297
271
|
|
|
298
272
|
Returns
|
|
299
273
|
-------
|
|
300
274
|
web3.contract.contract.ContractFunction
|
|
301
275
|
A contract function instance to be sent in a transaction.
|
|
302
276
|
"""
|
|
303
|
-
return self._contract.functions.
|
|
304
|
-
recipients,
|
|
305
|
-
capital_amounts,
|
|
306
|
-
)
|
|
307
|
-
|
|
308
|
-
def estimate_liquidation_price(
|
|
309
|
-
self,
|
|
310
|
-
margin_account_id: eth_typing.ChecksumAddress,
|
|
311
|
-
product_id: hexbytes.HexBytes,
|
|
312
|
-
price: int,
|
|
313
|
-
quantity: int,
|
|
314
|
-
) -> int:
|
|
315
|
-
"""Binding for `estimateLiquidationPrice` on the MarginAccount contract.
|
|
316
|
-
|
|
317
|
-
Parameters
|
|
318
|
-
----------
|
|
319
|
-
margin_account_id : eth_typing.ChecksumAddress
|
|
320
|
-
product_id : hexbytes.HexBytes
|
|
321
|
-
price : int
|
|
322
|
-
quantity : int
|
|
323
|
-
|
|
324
|
-
Returns
|
|
325
|
-
-------
|
|
326
|
-
int
|
|
327
|
-
"""
|
|
328
|
-
return_value = self._contract.functions.estimateLiquidationPrice(
|
|
277
|
+
return self._contract.functions.depositFor(
|
|
329
278
|
margin_account_id,
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
quantity,
|
|
333
|
-
).call()
|
|
334
|
-
return int(return_value)
|
|
335
|
-
|
|
336
|
-
def estimate_liquidation_price_for_position(
|
|
337
|
-
self,
|
|
338
|
-
margin_account_id: eth_typing.ChecksumAddress,
|
|
339
|
-
position_id: hexbytes.HexBytes,
|
|
340
|
-
) -> int:
|
|
341
|
-
"""Binding for `estimateLiquidationPriceForPosition` on the MarginAccount contract.
|
|
342
|
-
|
|
343
|
-
Parameters
|
|
344
|
-
----------
|
|
345
|
-
margin_account_id : eth_typing.ChecksumAddress
|
|
346
|
-
position_id : hexbytes.HexBytes
|
|
347
|
-
|
|
348
|
-
Returns
|
|
349
|
-
-------
|
|
350
|
-
int
|
|
351
|
-
"""
|
|
352
|
-
return_value = self._contract.functions.estimateLiquidationPriceForPosition(
|
|
353
|
-
margin_account_id,
|
|
354
|
-
position_id,
|
|
355
|
-
).call()
|
|
356
|
-
return int(return_value)
|
|
279
|
+
amount,
|
|
280
|
+
)
|
|
357
281
|
|
|
358
282
|
def initialize(
|
|
359
283
|
self,
|
|
360
|
-
|
|
361
|
-
_valuation: eth_typing.ChecksumAddress,
|
|
362
|
-
_product_registry: eth_typing.ChecksumAddress,
|
|
363
|
-
_clearing: eth_typing.ChecksumAddress,
|
|
284
|
+
clearing_: eth_typing.ChecksumAddress,
|
|
364
285
|
) -> contract.ContractFunction:
|
|
365
286
|
"""Binding for `initialize` on the MarginAccount contract.
|
|
366
287
|
|
|
367
288
|
Parameters
|
|
368
289
|
----------
|
|
369
|
-
|
|
370
|
-
_valuation : eth_typing.ChecksumAddress
|
|
371
|
-
_product_registry : eth_typing.ChecksumAddress
|
|
372
|
-
_clearing : eth_typing.ChecksumAddress
|
|
290
|
+
clearing_ : eth_typing.ChecksumAddress
|
|
373
291
|
|
|
374
292
|
Returns
|
|
375
293
|
-------
|
|
@@ -377,209 +295,162 @@ class MarginAccount:
|
|
|
377
295
|
A contract function instance to be sent in a transaction.
|
|
378
296
|
"""
|
|
379
297
|
return self._contract.functions.initialize(
|
|
380
|
-
|
|
381
|
-
_valuation,
|
|
382
|
-
_product_registry,
|
|
383
|
-
_clearing,
|
|
298
|
+
clearing_,
|
|
384
299
|
)
|
|
385
300
|
|
|
386
301
|
def mae(
|
|
387
302
|
self,
|
|
388
|
-
|
|
303
|
+
margin_account_id: eth_typing.ChecksumAddress,
|
|
304
|
+
block_identifier: types.BlockIdentifier = "latest",
|
|
389
305
|
) -> int:
|
|
390
306
|
"""Binding for `mae` on the MarginAccount contract.
|
|
391
307
|
|
|
392
308
|
Parameters
|
|
393
309
|
----------
|
|
394
|
-
|
|
310
|
+
margin_account_id : eth_typing.ChecksumAddress
|
|
311
|
+
block_identifier : web3.types.BlockIdentifier
|
|
312
|
+
The block identifier, defaults to the latest block.
|
|
395
313
|
|
|
396
314
|
Returns
|
|
397
315
|
-------
|
|
398
316
|
int
|
|
399
317
|
"""
|
|
400
318
|
return_value = self._contract.functions.mae(
|
|
401
|
-
|
|
402
|
-
).call()
|
|
319
|
+
margin_account_id,
|
|
320
|
+
).call(block_identifier=block_identifier)
|
|
403
321
|
return int(return_value)
|
|
404
322
|
|
|
405
|
-
def mae_and_mmu_after_batch_trade(
|
|
406
|
-
self,
|
|
407
|
-
margin_account: eth_typing.ChecksumAddress,
|
|
408
|
-
settlements: typing.List[Settlement],
|
|
409
|
-
mark_price_if_settled: typing.List[int],
|
|
410
|
-
) -> typing.Tuple[int, int]:
|
|
411
|
-
"""Binding for `maeAndMmuAfterBatchTrade` on the MarginAccount contract.
|
|
412
|
-
|
|
413
|
-
Parameters
|
|
414
|
-
----------
|
|
415
|
-
margin_account : eth_typing.ChecksumAddress
|
|
416
|
-
settlements : typing.List[Settlement]
|
|
417
|
-
mark_price_if_settled : typing.List[int]
|
|
418
|
-
|
|
419
|
-
Returns
|
|
420
|
-
-------
|
|
421
|
-
int
|
|
422
|
-
int
|
|
423
|
-
"""
|
|
424
|
-
return_value = self._contract.functions.maeAndMmuAfterBatchTrade(
|
|
425
|
-
margin_account,
|
|
426
|
-
[(item.position_id, item.quantity, item.price) for item in settlements],
|
|
427
|
-
mark_price_if_settled,
|
|
428
|
-
).call()
|
|
429
|
-
return (
|
|
430
|
-
int(return_value[0]),
|
|
431
|
-
int(return_value[1]),
|
|
432
|
-
)
|
|
433
|
-
|
|
434
|
-
def mae_check(
|
|
435
|
-
self,
|
|
436
|
-
margin_account: eth_typing.ChecksumAddress,
|
|
437
|
-
settlement: Settlement,
|
|
438
|
-
mark_price_if_settled: int,
|
|
439
|
-
) -> typing.Tuple[bool, int, int]:
|
|
440
|
-
"""Binding for `maeCheck` on the MarginAccount contract.
|
|
441
|
-
|
|
442
|
-
Parameters
|
|
443
|
-
----------
|
|
444
|
-
margin_account : eth_typing.ChecksumAddress
|
|
445
|
-
settlement : Settlement
|
|
446
|
-
mark_price_if_settled : int
|
|
447
|
-
|
|
448
|
-
Returns
|
|
449
|
-
-------
|
|
450
|
-
bool
|
|
451
|
-
int
|
|
452
|
-
int
|
|
453
|
-
"""
|
|
454
|
-
return_value = self._contract.functions.maeCheck(
|
|
455
|
-
margin_account,
|
|
456
|
-
(settlement.position_id, settlement.quantity, settlement.price),
|
|
457
|
-
mark_price_if_settled,
|
|
458
|
-
).call()
|
|
459
|
-
return (
|
|
460
|
-
bool(return_value[0]),
|
|
461
|
-
int(return_value[1]),
|
|
462
|
-
int(return_value[2]),
|
|
463
|
-
)
|
|
464
|
-
|
|
465
323
|
def mma(
|
|
466
324
|
self,
|
|
467
|
-
|
|
325
|
+
margin_account_id: eth_typing.ChecksumAddress,
|
|
326
|
+
block_identifier: types.BlockIdentifier = "latest",
|
|
468
327
|
) -> int:
|
|
469
328
|
"""Binding for `mma` on the MarginAccount contract.
|
|
470
329
|
|
|
471
330
|
Parameters
|
|
472
331
|
----------
|
|
473
|
-
|
|
332
|
+
margin_account_id : eth_typing.ChecksumAddress
|
|
333
|
+
block_identifier : web3.types.BlockIdentifier
|
|
334
|
+
The block identifier, defaults to the latest block.
|
|
474
335
|
|
|
475
336
|
Returns
|
|
476
337
|
-------
|
|
477
338
|
int
|
|
478
339
|
"""
|
|
479
340
|
return_value = self._contract.functions.mma(
|
|
480
|
-
|
|
481
|
-
).call()
|
|
341
|
+
margin_account_id,
|
|
342
|
+
).call(block_identifier=block_identifier)
|
|
482
343
|
return int(return_value)
|
|
483
344
|
|
|
484
345
|
def mmu(
|
|
485
346
|
self,
|
|
486
|
-
|
|
347
|
+
margin_account_id: eth_typing.ChecksumAddress,
|
|
348
|
+
block_identifier: types.BlockIdentifier = "latest",
|
|
487
349
|
) -> int:
|
|
488
350
|
"""Binding for `mmu` on the MarginAccount contract.
|
|
489
351
|
|
|
490
352
|
Parameters
|
|
491
353
|
----------
|
|
492
|
-
|
|
354
|
+
margin_account_id : eth_typing.ChecksumAddress
|
|
355
|
+
block_identifier : web3.types.BlockIdentifier
|
|
356
|
+
The block identifier, defaults to the latest block.
|
|
493
357
|
|
|
494
358
|
Returns
|
|
495
359
|
-------
|
|
496
360
|
int
|
|
497
361
|
"""
|
|
498
362
|
return_value = self._contract.functions.mmu(
|
|
499
|
-
|
|
500
|
-
).call()
|
|
363
|
+
margin_account_id,
|
|
364
|
+
).call(block_identifier=block_identifier)
|
|
501
365
|
return int(return_value)
|
|
502
366
|
|
|
503
|
-
def
|
|
367
|
+
def owner(
|
|
504
368
|
self,
|
|
505
|
-
|
|
506
|
-
) ->
|
|
507
|
-
"""Binding for `
|
|
369
|
+
block_identifier: types.BlockIdentifier = "latest",
|
|
370
|
+
) -> eth_typing.ChecksumAddress:
|
|
371
|
+
"""Binding for `owner` on the MarginAccount contract.
|
|
508
372
|
|
|
509
373
|
Parameters
|
|
510
374
|
----------
|
|
511
|
-
|
|
375
|
+
block_identifier : web3.types.BlockIdentifier
|
|
376
|
+
The block identifier, defaults to the latest block.
|
|
512
377
|
|
|
513
378
|
Returns
|
|
514
379
|
-------
|
|
515
|
-
|
|
380
|
+
eth_typing.ChecksumAddress
|
|
516
381
|
"""
|
|
517
|
-
return_value = self._contract.functions.
|
|
518
|
-
|
|
519
|
-
)
|
|
520
|
-
return
|
|
382
|
+
return_value = self._contract.functions.owner().call(
|
|
383
|
+
block_identifier=block_identifier
|
|
384
|
+
)
|
|
385
|
+
return eth_typing.ChecksumAddress(return_value)
|
|
521
386
|
|
|
522
|
-
def
|
|
387
|
+
def pnl(
|
|
523
388
|
self,
|
|
524
389
|
margin_account_id: eth_typing.ChecksumAddress,
|
|
525
|
-
|
|
390
|
+
block_identifier: types.BlockIdentifier = "latest",
|
|
526
391
|
) -> int:
|
|
527
|
-
"""Binding for `
|
|
392
|
+
"""Binding for `pnl` on the MarginAccount contract.
|
|
528
393
|
|
|
529
394
|
Parameters
|
|
530
395
|
----------
|
|
531
396
|
margin_account_id : eth_typing.ChecksumAddress
|
|
532
|
-
|
|
397
|
+
block_identifier : web3.types.BlockIdentifier
|
|
398
|
+
The block identifier, defaults to the latest block.
|
|
533
399
|
|
|
534
400
|
Returns
|
|
535
401
|
-------
|
|
536
402
|
int
|
|
537
403
|
"""
|
|
538
|
-
return_value = self._contract.functions.
|
|
404
|
+
return_value = self._contract.functions.pnl(
|
|
539
405
|
margin_account_id,
|
|
540
|
-
|
|
541
|
-
).call()
|
|
406
|
+
).call(block_identifier=block_identifier)
|
|
542
407
|
return int(return_value)
|
|
543
408
|
|
|
544
409
|
def position_count(
|
|
545
410
|
self,
|
|
546
|
-
|
|
411
|
+
margin_account_id: eth_typing.ChecksumAddress,
|
|
412
|
+
block_identifier: types.BlockIdentifier = "latest",
|
|
547
413
|
) -> int:
|
|
548
414
|
"""Binding for `positionCount` on the MarginAccount contract.
|
|
549
415
|
|
|
550
416
|
Parameters
|
|
551
417
|
----------
|
|
552
|
-
|
|
418
|
+
margin_account_id : eth_typing.ChecksumAddress
|
|
419
|
+
block_identifier : web3.types.BlockIdentifier
|
|
420
|
+
The block identifier, defaults to the latest block.
|
|
553
421
|
|
|
554
422
|
Returns
|
|
555
423
|
-------
|
|
556
424
|
int
|
|
557
425
|
"""
|
|
558
426
|
return_value = self._contract.functions.positionCount(
|
|
559
|
-
|
|
560
|
-
).call()
|
|
427
|
+
margin_account_id,
|
|
428
|
+
).call(block_identifier=block_identifier)
|
|
561
429
|
return int(return_value)
|
|
562
430
|
|
|
563
431
|
def position_data(
|
|
564
432
|
self,
|
|
565
|
-
|
|
566
|
-
|
|
433
|
+
margin_account_id: eth_typing.ChecksumAddress,
|
|
434
|
+
product_id: hexbytes.HexBytes,
|
|
435
|
+
block_identifier: types.BlockIdentifier = "latest",
|
|
567
436
|
) -> PositionData:
|
|
568
437
|
"""Binding for `positionData` on the MarginAccount contract.
|
|
569
438
|
|
|
570
439
|
Parameters
|
|
571
440
|
----------
|
|
572
|
-
|
|
573
|
-
|
|
441
|
+
margin_account_id : eth_typing.ChecksumAddress
|
|
442
|
+
product_id : hexbytes.HexBytes
|
|
443
|
+
block_identifier : web3.types.BlockIdentifier
|
|
444
|
+
The block identifier, defaults to the latest block.
|
|
574
445
|
|
|
575
446
|
Returns
|
|
576
447
|
-------
|
|
577
448
|
PositionData
|
|
578
449
|
"""
|
|
579
450
|
return_value = self._contract.functions.positionData(
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
).call()
|
|
451
|
+
margin_account_id,
|
|
452
|
+
product_id,
|
|
453
|
+
).call(block_identifier=block_identifier)
|
|
583
454
|
return PositionData(
|
|
584
455
|
hexbytes.HexBytes(return_value[0]),
|
|
585
456
|
int(return_value[1]),
|
|
@@ -591,14 +462,17 @@ class MarginAccount:
|
|
|
591
462
|
def position_pn_l(
|
|
592
463
|
self,
|
|
593
464
|
margin_account: eth_typing.ChecksumAddress,
|
|
594
|
-
|
|
465
|
+
product_id: hexbytes.HexBytes,
|
|
466
|
+
block_identifier: types.BlockIdentifier = "latest",
|
|
595
467
|
) -> int:
|
|
596
468
|
"""Binding for `positionPnL` on the MarginAccount contract.
|
|
597
469
|
|
|
598
470
|
Parameters
|
|
599
471
|
----------
|
|
600
472
|
margin_account : eth_typing.ChecksumAddress
|
|
601
|
-
|
|
473
|
+
product_id : hexbytes.HexBytes
|
|
474
|
+
block_identifier : web3.types.BlockIdentifier
|
|
475
|
+
The block identifier, defaults to the latest block.
|
|
602
476
|
|
|
603
477
|
Returns
|
|
604
478
|
-------
|
|
@@ -606,64 +480,89 @@ class MarginAccount:
|
|
|
606
480
|
"""
|
|
607
481
|
return_value = self._contract.functions.positionPnL(
|
|
608
482
|
margin_account,
|
|
609
|
-
|
|
610
|
-
).call()
|
|
483
|
+
product_id,
|
|
484
|
+
).call(block_identifier=block_identifier)
|
|
611
485
|
return int(return_value)
|
|
612
486
|
|
|
613
487
|
def position_quantity(
|
|
614
488
|
self,
|
|
615
|
-
|
|
616
|
-
|
|
489
|
+
margin_account_id: eth_typing.ChecksumAddress,
|
|
490
|
+
product_id: hexbytes.HexBytes,
|
|
491
|
+
block_identifier: types.BlockIdentifier = "latest",
|
|
617
492
|
) -> int:
|
|
618
493
|
"""Binding for `positionQuantity` on the MarginAccount contract.
|
|
619
494
|
|
|
620
495
|
Parameters
|
|
621
496
|
----------
|
|
622
|
-
|
|
623
|
-
|
|
497
|
+
margin_account_id : eth_typing.ChecksumAddress
|
|
498
|
+
product_id : hexbytes.HexBytes
|
|
499
|
+
block_identifier : web3.types.BlockIdentifier
|
|
500
|
+
The block identifier, defaults to the latest block.
|
|
624
501
|
|
|
625
502
|
Returns
|
|
626
503
|
-------
|
|
627
504
|
int
|
|
628
505
|
"""
|
|
629
506
|
return_value = self._contract.functions.positionQuantity(
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
).call()
|
|
507
|
+
margin_account_id,
|
|
508
|
+
product_id,
|
|
509
|
+
).call(block_identifier=block_identifier)
|
|
633
510
|
return int(return_value)
|
|
634
511
|
|
|
635
512
|
def positions(
|
|
636
513
|
self,
|
|
637
|
-
|
|
514
|
+
margin_account_id: eth_typing.ChecksumAddress,
|
|
515
|
+
block_identifier: types.BlockIdentifier = "latest",
|
|
638
516
|
) -> typing.List[hexbytes.HexBytes]:
|
|
639
517
|
"""Binding for `positions` on the MarginAccount contract.
|
|
640
518
|
|
|
641
519
|
Parameters
|
|
642
520
|
----------
|
|
643
|
-
|
|
521
|
+
margin_account_id : eth_typing.ChecksumAddress
|
|
522
|
+
block_identifier : web3.types.BlockIdentifier
|
|
523
|
+
The block identifier, defaults to the latest block.
|
|
644
524
|
|
|
645
525
|
Returns
|
|
646
526
|
-------
|
|
647
527
|
typing.List[hexbytes.HexBytes]
|
|
648
528
|
"""
|
|
649
529
|
return_value = self._contract.functions.positions(
|
|
650
|
-
|
|
651
|
-
).call()
|
|
530
|
+
margin_account_id,
|
|
531
|
+
).call(block_identifier=block_identifier)
|
|
652
532
|
return [
|
|
653
533
|
hexbytes.HexBytes(return_value_elem) for return_value_elem in return_value
|
|
654
534
|
]
|
|
655
535
|
|
|
656
|
-
def
|
|
536
|
+
def remove_allowed(
|
|
657
537
|
self,
|
|
658
|
-
|
|
659
|
-
|
|
538
|
+
addr: eth_typing.ChecksumAddress,
|
|
539
|
+
) -> contract.ContractFunction:
|
|
540
|
+
"""Binding for `removeAllowed` on the MarginAccount contract.
|
|
541
|
+
|
|
542
|
+
Parameters
|
|
543
|
+
----------
|
|
544
|
+
addr : eth_typing.ChecksumAddress
|
|
660
545
|
|
|
661
546
|
Returns
|
|
662
547
|
-------
|
|
663
|
-
|
|
548
|
+
web3.contract.contract.ContractFunction
|
|
549
|
+
A contract function instance to be sent in a transaction.
|
|
664
550
|
"""
|
|
665
|
-
|
|
666
|
-
|
|
551
|
+
return self._contract.functions.removeAllowed(
|
|
552
|
+
addr,
|
|
553
|
+
)
|
|
554
|
+
|
|
555
|
+
def renounce_ownership(
|
|
556
|
+
self,
|
|
557
|
+
) -> contract.ContractFunction:
|
|
558
|
+
"""Binding for `renounceOwnership` on the MarginAccount contract.
|
|
559
|
+
|
|
560
|
+
Returns
|
|
561
|
+
-------
|
|
562
|
+
web3.contract.contract.ContractFunction
|
|
563
|
+
A contract function instance to be sent in a transaction.
|
|
564
|
+
"""
|
|
565
|
+
return self._contract.functions.renounceOwnership()
|
|
667
566
|
|
|
668
567
|
def revoke_authorization(
|
|
669
568
|
self,
|
|
@@ -684,43 +583,25 @@ class MarginAccount:
|
|
|
684
583
|
intent_account,
|
|
685
584
|
)
|
|
686
585
|
|
|
687
|
-
def
|
|
586
|
+
def transfer_ownership(
|
|
688
587
|
self,
|
|
689
|
-
|
|
690
|
-
intent_account: eth_typing.ChecksumAddress,
|
|
691
|
-
settlement: Settlement,
|
|
588
|
+
new_owner: eth_typing.ChecksumAddress,
|
|
692
589
|
) -> contract.ContractFunction:
|
|
693
|
-
"""Binding for `
|
|
590
|
+
"""Binding for `transferOwnership` on the MarginAccount contract.
|
|
694
591
|
|
|
695
592
|
Parameters
|
|
696
593
|
----------
|
|
697
|
-
|
|
698
|
-
intent_account : eth_typing.ChecksumAddress
|
|
699
|
-
settlement : Settlement
|
|
594
|
+
new_owner : eth_typing.ChecksumAddress
|
|
700
595
|
|
|
701
596
|
Returns
|
|
702
597
|
-------
|
|
703
598
|
web3.contract.contract.ContractFunction
|
|
704
599
|
A contract function instance to be sent in a transaction.
|
|
705
600
|
"""
|
|
706
|
-
return self._contract.functions.
|
|
707
|
-
|
|
708
|
-
intent_account,
|
|
709
|
-
(settlement.position_id, settlement.quantity, settlement.price),
|
|
601
|
+
return self._contract.functions.transferOwnership(
|
|
602
|
+
new_owner,
|
|
710
603
|
)
|
|
711
604
|
|
|
712
|
-
def valuation(
|
|
713
|
-
self,
|
|
714
|
-
) -> eth_typing.ChecksumAddress:
|
|
715
|
-
"""Binding for `valuation` on the MarginAccount contract.
|
|
716
|
-
|
|
717
|
-
Returns
|
|
718
|
-
-------
|
|
719
|
-
eth_typing.ChecksumAddress
|
|
720
|
-
"""
|
|
721
|
-
return_value = self._contract.functions.valuation().call()
|
|
722
|
-
return eth_typing.ChecksumAddress(return_value)
|
|
723
|
-
|
|
724
605
|
def withdraw(
|
|
725
606
|
self,
|
|
726
607
|
amount: int,
|
|
@@ -742,21 +623,24 @@ class MarginAccount:
|
|
|
742
623
|
|
|
743
624
|
def withdrawable(
|
|
744
625
|
self,
|
|
745
|
-
|
|
626
|
+
margin_account_id: eth_typing.ChecksumAddress,
|
|
627
|
+
block_identifier: types.BlockIdentifier = "latest",
|
|
746
628
|
) -> int:
|
|
747
629
|
"""Binding for `withdrawable` on the MarginAccount contract.
|
|
748
630
|
|
|
749
631
|
Parameters
|
|
750
632
|
----------
|
|
751
|
-
|
|
633
|
+
margin_account_id : eth_typing.ChecksumAddress
|
|
634
|
+
block_identifier : web3.types.BlockIdentifier
|
|
635
|
+
The block identifier, defaults to the latest block.
|
|
752
636
|
|
|
753
637
|
Returns
|
|
754
638
|
-------
|
|
755
639
|
int
|
|
756
640
|
"""
|
|
757
641
|
return_value = self._contract.functions.withdrawable(
|
|
758
|
-
|
|
759
|
-
).call()
|
|
642
|
+
margin_account_id,
|
|
643
|
+
).call(block_identifier=block_identifier)
|
|
760
644
|
return int(return_value)
|
|
761
645
|
|
|
762
646
|
|
|
@@ -764,700 +648,501 @@ ABI = typing.cast(
|
|
|
764
648
|
eth_typing.ABI,
|
|
765
649
|
[
|
|
766
650
|
{
|
|
767
|
-
"
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
],
|
|
771
|
-
"
|
|
772
|
-
"type": "error",
|
|
773
|
-
},
|
|
774
|
-
{
|
|
775
|
-
"inputs": [
|
|
776
|
-
{"internalType": "address", "name": "account", "type": "address"},
|
|
777
|
-
{"internalType": "uint256", "name": "balance", "type": "uint256"},
|
|
778
|
-
{"internalType": "uint256", "name": "required", "type": "uint256"},
|
|
779
|
-
],
|
|
780
|
-
"name": "InsufficientBalance",
|
|
781
|
-
"type": "error",
|
|
782
|
-
},
|
|
783
|
-
{"inputs": [], "name": "InvalidInitialization", "type": "error"},
|
|
784
|
-
{
|
|
785
|
-
"inputs": [
|
|
786
|
-
{"internalType": "string", "name": "paramName", "type": "string"}
|
|
787
|
-
],
|
|
788
|
-
"name": "InvalidParameter",
|
|
789
|
-
"type": "error",
|
|
651
|
+
"type": "function",
|
|
652
|
+
"name": "addAllowed",
|
|
653
|
+
"inputs": [{"name": "addr", "type": "address", "internalType": "address"}],
|
|
654
|
+
"outputs": [],
|
|
655
|
+
"stateMutability": "nonpayable",
|
|
790
656
|
},
|
|
791
|
-
{"inputs": [], "name": "NotInitializing", "type": "error"},
|
|
792
657
|
{
|
|
793
|
-
"
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
],
|
|
797
|
-
"
|
|
798
|
-
"type": "error",
|
|
658
|
+
"type": "function",
|
|
659
|
+
"name": "admin",
|
|
660
|
+
"inputs": [],
|
|
661
|
+
"outputs": [{"name": "", "type": "address", "internalType": "address"}],
|
|
662
|
+
"stateMutability": "view",
|
|
799
663
|
},
|
|
800
664
|
{
|
|
801
|
-
"
|
|
802
|
-
"name": "
|
|
803
|
-
"
|
|
665
|
+
"type": "function",
|
|
666
|
+
"name": "allowed",
|
|
667
|
+
"inputs": [],
|
|
668
|
+
"outputs": [{"name": "", "type": "address[]", "internalType": "address[]"}],
|
|
669
|
+
"stateMutability": "view",
|
|
804
670
|
},
|
|
805
671
|
{
|
|
672
|
+
"type": "function",
|
|
673
|
+
"name": "authorize",
|
|
806
674
|
"inputs": [
|
|
807
|
-
{"
|
|
675
|
+
{"name": "intentAccount", "type": "address", "internalType": "address"}
|
|
808
676
|
],
|
|
809
|
-
"
|
|
810
|
-
"
|
|
677
|
+
"outputs": [],
|
|
678
|
+
"stateMutability": "nonpayable",
|
|
811
679
|
},
|
|
812
680
|
{
|
|
813
|
-
"
|
|
681
|
+
"type": "function",
|
|
682
|
+
"name": "authorized",
|
|
814
683
|
"inputs": [
|
|
815
684
|
{
|
|
816
|
-
"
|
|
817
|
-
"internalType": "address",
|
|
818
|
-
"name": "user",
|
|
685
|
+
"name": "marginAccountId",
|
|
819
686
|
"type": "address",
|
|
687
|
+
"internalType": "address",
|
|
820
688
|
},
|
|
821
|
-
{
|
|
822
|
-
"indexed": False,
|
|
823
|
-
"internalType": "uint256",
|
|
824
|
-
"name": "amount",
|
|
825
|
-
"type": "uint256",
|
|
826
|
-
},
|
|
689
|
+
{"name": "intentAccount", "type": "address", "internalType": "address"},
|
|
827
690
|
],
|
|
828
|
-
"name": "
|
|
829
|
-
"
|
|
691
|
+
"outputs": [{"name": "", "type": "bool", "internalType": "bool"}],
|
|
692
|
+
"stateMutability": "view",
|
|
830
693
|
},
|
|
831
694
|
{
|
|
832
|
-
"
|
|
695
|
+
"type": "function",
|
|
696
|
+
"name": "capital",
|
|
833
697
|
"inputs": [
|
|
834
698
|
{
|
|
835
|
-
"
|
|
836
|
-
"internalType": "address",
|
|
837
|
-
"name": "marginAccountID",
|
|
699
|
+
"name": "marginAccountId",
|
|
838
700
|
"type": "address",
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
"indexed": False,
|
|
842
|
-
"internalType": "int256",
|
|
843
|
-
"name": "capitalAmount",
|
|
844
|
-
"type": "int256",
|
|
845
|
-
},
|
|
701
|
+
"internalType": "address",
|
|
702
|
+
}
|
|
846
703
|
],
|
|
847
|
-
"name": "
|
|
848
|
-
"
|
|
704
|
+
"outputs": [{"name": "", "type": "int256", "internalType": "int256"}],
|
|
705
|
+
"stateMutability": "view",
|
|
849
706
|
},
|
|
850
707
|
{
|
|
851
|
-
"
|
|
852
|
-
"
|
|
708
|
+
"type": "function",
|
|
709
|
+
"name": "clearing",
|
|
710
|
+
"inputs": [],
|
|
711
|
+
"outputs": [
|
|
853
712
|
{
|
|
854
|
-
"
|
|
855
|
-
"internalType": "address",
|
|
856
|
-
"name": "recipient",
|
|
713
|
+
"name": "",
|
|
857
714
|
"type": "address",
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
"indexed": False,
|
|
861
|
-
"internalType": "uint256",
|
|
862
|
-
"name": "capitalAmount",
|
|
863
|
-
"type": "uint256",
|
|
864
|
-
},
|
|
715
|
+
"internalType": "contract IMarginAccountFacet",
|
|
716
|
+
}
|
|
865
717
|
],
|
|
866
|
-
"
|
|
867
|
-
"type": "event",
|
|
718
|
+
"stateMutability": "view",
|
|
868
719
|
},
|
|
869
720
|
{
|
|
870
|
-
"
|
|
721
|
+
"type": "function",
|
|
722
|
+
"name": "collateralAsset",
|
|
723
|
+
"inputs": [],
|
|
724
|
+
"outputs": [{"name": "", "type": "address", "internalType": "address"}],
|
|
725
|
+
"stateMutability": "view",
|
|
726
|
+
},
|
|
727
|
+
{
|
|
728
|
+
"type": "function",
|
|
729
|
+
"name": "deposit",
|
|
871
730
|
"inputs": [
|
|
872
|
-
{
|
|
873
|
-
"indexed": False,
|
|
874
|
-
"internalType": "uint64",
|
|
875
|
-
"name": "version",
|
|
876
|
-
"type": "uint64",
|
|
877
|
-
}
|
|
731
|
+
{"name": "amount", "type": "uint256", "internalType": "uint256"}
|
|
878
732
|
],
|
|
879
|
-
"
|
|
880
|
-
"
|
|
733
|
+
"outputs": [],
|
|
734
|
+
"stateMutability": "nonpayable",
|
|
881
735
|
},
|
|
882
736
|
{
|
|
883
|
-
"
|
|
737
|
+
"type": "function",
|
|
738
|
+
"name": "depositFor",
|
|
884
739
|
"inputs": [
|
|
885
740
|
{
|
|
886
|
-
"
|
|
887
|
-
"internalType": "address",
|
|
888
|
-
"name": "marginAccountID",
|
|
741
|
+
"name": "marginAccountId",
|
|
889
742
|
"type": "address",
|
|
890
|
-
},
|
|
891
|
-
{
|
|
892
|
-
"indexed": True,
|
|
893
743
|
"internalType": "address",
|
|
894
|
-
"name": "intentAccount",
|
|
895
|
-
"type": "address",
|
|
896
744
|
},
|
|
745
|
+
{"name": "amount", "type": "uint256", "internalType": "uint256"},
|
|
897
746
|
],
|
|
898
|
-
"
|
|
899
|
-
"
|
|
747
|
+
"outputs": [],
|
|
748
|
+
"stateMutability": "nonpayable",
|
|
900
749
|
},
|
|
901
750
|
{
|
|
902
|
-
"
|
|
751
|
+
"type": "function",
|
|
752
|
+
"name": "initialize",
|
|
753
|
+
"inputs": [
|
|
754
|
+
{"name": "clearing_", "type": "address", "internalType": "address"}
|
|
755
|
+
],
|
|
756
|
+
"outputs": [],
|
|
757
|
+
"stateMutability": "nonpayable",
|
|
758
|
+
},
|
|
759
|
+
{
|
|
760
|
+
"type": "function",
|
|
761
|
+
"name": "mae",
|
|
903
762
|
"inputs": [
|
|
904
763
|
{
|
|
905
|
-
"
|
|
906
|
-
"internalType": "address",
|
|
907
|
-
"name": "marginAccountID",
|
|
764
|
+
"name": "marginAccountId",
|
|
908
765
|
"type": "address",
|
|
909
|
-
},
|
|
910
|
-
{
|
|
911
|
-
"indexed": True,
|
|
912
766
|
"internalType": "address",
|
|
913
|
-
|
|
914
|
-
"type": "address",
|
|
915
|
-
},
|
|
767
|
+
}
|
|
916
768
|
],
|
|
917
|
-
"name": "
|
|
918
|
-
"
|
|
769
|
+
"outputs": [{"name": "", "type": "int256", "internalType": "int256"}],
|
|
770
|
+
"stateMutability": "view",
|
|
919
771
|
},
|
|
920
772
|
{
|
|
921
|
-
"
|
|
773
|
+
"type": "function",
|
|
774
|
+
"name": "mma",
|
|
922
775
|
"inputs": [
|
|
923
776
|
{
|
|
924
|
-
"
|
|
925
|
-
"internalType": "address",
|
|
926
|
-
"name": "marginAccountID",
|
|
777
|
+
"name": "marginAccountId",
|
|
927
778
|
"type": "address",
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
"indexed": True,
|
|
931
|
-
"internalType": "bytes32",
|
|
932
|
-
"name": "positionId",
|
|
933
|
-
"type": "bytes32",
|
|
934
|
-
},
|
|
935
|
-
{
|
|
936
|
-
"indexed": False,
|
|
937
|
-
"internalType": "int256",
|
|
938
|
-
"name": "totalQuantity",
|
|
939
|
-
"type": "int256",
|
|
940
|
-
},
|
|
941
|
-
{
|
|
942
|
-
"indexed": False,
|
|
943
|
-
"internalType": "int256",
|
|
944
|
-
"name": "costBasis",
|
|
945
|
-
"type": "int256",
|
|
946
|
-
},
|
|
947
|
-
{
|
|
948
|
-
"indexed": False,
|
|
949
|
-
"internalType": "uint256",
|
|
950
|
-
"name": "price",
|
|
951
|
-
"type": "uint256",
|
|
952
|
-
},
|
|
953
|
-
{
|
|
954
|
-
"indexed": False,
|
|
955
|
-
"internalType": "int256",
|
|
956
|
-
"name": "quantity",
|
|
957
|
-
"type": "int256",
|
|
958
|
-
},
|
|
779
|
+
"internalType": "address",
|
|
780
|
+
}
|
|
959
781
|
],
|
|
960
|
-
"name": "
|
|
961
|
-
"
|
|
782
|
+
"outputs": [{"name": "", "type": "uint256", "internalType": "uint256"}],
|
|
783
|
+
"stateMutability": "view",
|
|
962
784
|
},
|
|
963
785
|
{
|
|
964
|
-
"
|
|
786
|
+
"type": "function",
|
|
787
|
+
"name": "mmu",
|
|
965
788
|
"inputs": [
|
|
966
789
|
{
|
|
967
|
-
"
|
|
968
|
-
"internalType": "address",
|
|
969
|
-
"name": "user",
|
|
790
|
+
"name": "marginAccountId",
|
|
970
791
|
"type": "address",
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
"indexed": False,
|
|
974
|
-
"internalType": "uint256",
|
|
975
|
-
"name": "amount",
|
|
976
|
-
"type": "uint256",
|
|
977
|
-
},
|
|
792
|
+
"internalType": "address",
|
|
793
|
+
}
|
|
978
794
|
],
|
|
979
|
-
"name": "
|
|
980
|
-
"
|
|
795
|
+
"outputs": [{"name": "", "type": "uint256", "internalType": "uint256"}],
|
|
796
|
+
"stateMutability": "view",
|
|
981
797
|
},
|
|
982
798
|
{
|
|
983
|
-
"inputs": [
|
|
984
|
-
{"internalType": "address", "name": "intentAccount", "type": "address"}
|
|
985
|
-
],
|
|
986
|
-
"name": "authorize",
|
|
987
|
-
"outputs": [],
|
|
988
|
-
"stateMutability": "nonpayable",
|
|
989
799
|
"type": "function",
|
|
800
|
+
"name": "owner",
|
|
801
|
+
"inputs": [],
|
|
802
|
+
"outputs": [{"name": "", "type": "address", "internalType": "address"}],
|
|
803
|
+
"stateMutability": "view",
|
|
990
804
|
},
|
|
991
805
|
{
|
|
806
|
+
"type": "function",
|
|
807
|
+
"name": "pnl",
|
|
992
808
|
"inputs": [
|
|
993
|
-
{
|
|
994
|
-
|
|
809
|
+
{
|
|
810
|
+
"name": "marginAccountId",
|
|
811
|
+
"type": "address",
|
|
812
|
+
"internalType": "address",
|
|
813
|
+
}
|
|
995
814
|
],
|
|
996
|
-
"name": "
|
|
997
|
-
"outputs": [{"internalType": "bool", "name": "", "type": "bool"}],
|
|
815
|
+
"outputs": [{"name": "", "type": "int256", "internalType": "int256"}],
|
|
998
816
|
"stateMutability": "view",
|
|
999
|
-
"type": "function",
|
|
1000
817
|
},
|
|
1001
818
|
{
|
|
819
|
+
"type": "function",
|
|
820
|
+
"name": "positionCount",
|
|
1002
821
|
"inputs": [
|
|
1003
|
-
{"internalType": "address", "name": "marginAccount", "type": "address"},
|
|
1004
822
|
{
|
|
1005
|
-
"
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
"type": "bytes32",
|
|
1010
|
-
},
|
|
1011
|
-
{
|
|
1012
|
-
"internalType": "int256",
|
|
1013
|
-
"name": "quantity",
|
|
1014
|
-
"type": "int256",
|
|
1015
|
-
},
|
|
1016
|
-
{"internalType": "uint256", "name": "price", "type": "uint256"},
|
|
1017
|
-
],
|
|
1018
|
-
"internalType": "struct IMarginAccount.Settlement[]",
|
|
1019
|
-
"name": "settlements",
|
|
1020
|
-
"type": "tuple[]",
|
|
1021
|
-
},
|
|
1022
|
-
{
|
|
1023
|
-
"internalType": "uint256[]",
|
|
1024
|
-
"name": "markPriceIfSettled",
|
|
1025
|
-
"type": "uint256[]",
|
|
1026
|
-
},
|
|
1027
|
-
],
|
|
1028
|
-
"name": "batchMaeCheck",
|
|
1029
|
-
"outputs": [
|
|
1030
|
-
{"internalType": "bool", "name": "checkPassed", "type": "bool"},
|
|
1031
|
-
{"internalType": "int256", "name": "maeAfter", "type": "int256"},
|
|
1032
|
-
{"internalType": "uint256", "name": "mmuAfter", "type": "uint256"},
|
|
823
|
+
"name": "marginAccountId",
|
|
824
|
+
"type": "address",
|
|
825
|
+
"internalType": "address",
|
|
826
|
+
}
|
|
1033
827
|
],
|
|
828
|
+
"outputs": [{"name": "", "type": "uint256", "internalType": "uint256"}],
|
|
1034
829
|
"stateMutability": "view",
|
|
1035
|
-
"type": "function",
|
|
1036
830
|
},
|
|
1037
831
|
{
|
|
832
|
+
"type": "function",
|
|
833
|
+
"name": "positionData",
|
|
1038
834
|
"inputs": [
|
|
1039
835
|
{
|
|
1040
|
-
"
|
|
1041
|
-
"name": "marginAccountID",
|
|
836
|
+
"name": "marginAccountId",
|
|
1042
837
|
"type": "address",
|
|
838
|
+
"internalType": "address",
|
|
1043
839
|
},
|
|
840
|
+
{"name": "productId", "type": "bytes32", "internalType": "bytes32"},
|
|
841
|
+
],
|
|
842
|
+
"outputs": [
|
|
1044
843
|
{
|
|
844
|
+
"name": "",
|
|
845
|
+
"type": "tuple",
|
|
846
|
+
"internalType": "struct PositionData",
|
|
1045
847
|
"components": [
|
|
1046
848
|
{
|
|
1047
|
-
"
|
|
1048
|
-
"name": "positionId",
|
|
849
|
+
"name": "productId",
|
|
1049
850
|
"type": "bytes32",
|
|
851
|
+
"internalType": "bytes32",
|
|
1050
852
|
},
|
|
1051
853
|
{
|
|
1052
|
-
"internalType": "int256",
|
|
1053
854
|
"name": "quantity",
|
|
1054
855
|
"type": "int256",
|
|
856
|
+
"internalType": "int256",
|
|
857
|
+
},
|
|
858
|
+
{
|
|
859
|
+
"name": "costBasis",
|
|
860
|
+
"type": "int256",
|
|
861
|
+
"internalType": "int256",
|
|
862
|
+
},
|
|
863
|
+
{
|
|
864
|
+
"name": "maintenanceMargin",
|
|
865
|
+
"type": "uint256",
|
|
866
|
+
"internalType": "uint256",
|
|
1055
867
|
},
|
|
1056
|
-
{"
|
|
868
|
+
{"name": "pnl", "type": "int256", "internalType": "int256"},
|
|
1057
869
|
],
|
|
1058
|
-
|
|
1059
|
-
"name": "settlements",
|
|
1060
|
-
"type": "tuple[]",
|
|
1061
|
-
},
|
|
870
|
+
}
|
|
1062
871
|
],
|
|
1063
|
-
"
|
|
1064
|
-
"outputs": [{"internalType": "bool", "name": "", "type": "bool"}],
|
|
1065
|
-
"stateMutability": "nonpayable",
|
|
1066
|
-
"type": "function",
|
|
872
|
+
"stateMutability": "view",
|
|
1067
873
|
},
|
|
1068
874
|
{
|
|
875
|
+
"type": "function",
|
|
876
|
+
"name": "positionPnL",
|
|
1069
877
|
"inputs": [
|
|
1070
|
-
{"
|
|
878
|
+
{"name": "marginAccount", "type": "address", "internalType": "address"},
|
|
879
|
+
{"name": "productId", "type": "bytes32", "internalType": "bytes32"},
|
|
1071
880
|
],
|
|
1072
|
-
"name": "
|
|
1073
|
-
"outputs": [{"internalType": "int256", "name": "", "type": "int256"}],
|
|
881
|
+
"outputs": [{"name": "", "type": "int256", "internalType": "int256"}],
|
|
1074
882
|
"stateMutability": "view",
|
|
1075
|
-
"type": "function",
|
|
1076
883
|
},
|
|
1077
884
|
{
|
|
1078
|
-
"inputs": [],
|
|
1079
|
-
"name": "clearing",
|
|
1080
|
-
"outputs": [{"internalType": "address", "name": "", "type": "address"}],
|
|
1081
|
-
"stateMutability": "view",
|
|
1082
885
|
"type": "function",
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
886
|
+
"name": "positionQuantity",
|
|
887
|
+
"inputs": [
|
|
888
|
+
{
|
|
889
|
+
"name": "marginAccountId",
|
|
890
|
+
"type": "address",
|
|
891
|
+
"internalType": "address",
|
|
892
|
+
},
|
|
893
|
+
{"name": "productId", "type": "bytes32", "internalType": "bytes32"},
|
|
894
|
+
],
|
|
895
|
+
"outputs": [{"name": "", "type": "int256", "internalType": "int256"}],
|
|
1088
896
|
"stateMutability": "view",
|
|
1089
|
-
"type": "function",
|
|
1090
897
|
},
|
|
1091
898
|
{
|
|
1092
|
-
"
|
|
1093
|
-
"name": "
|
|
1094
|
-
"
|
|
1095
|
-
{
|
|
899
|
+
"type": "function",
|
|
900
|
+
"name": "positions",
|
|
901
|
+
"inputs": [
|
|
902
|
+
{
|
|
903
|
+
"name": "marginAccountId",
|
|
904
|
+
"type": "address",
|
|
905
|
+
"internalType": "address",
|
|
906
|
+
}
|
|
1096
907
|
],
|
|
908
|
+
"outputs": [{"name": "", "type": "bytes32[]", "internalType": "bytes32[]"}],
|
|
1097
909
|
"stateMutability": "view",
|
|
1098
|
-
"type": "function",
|
|
1099
910
|
},
|
|
1100
911
|
{
|
|
1101
|
-
"
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
],
|
|
1105
|
-
"name": "collectFee",
|
|
912
|
+
"type": "function",
|
|
913
|
+
"name": "removeAllowed",
|
|
914
|
+
"inputs": [{"name": "addr", "type": "address", "internalType": "address"}],
|
|
1106
915
|
"outputs": [],
|
|
1107
916
|
"stateMutability": "nonpayable",
|
|
917
|
+
},
|
|
918
|
+
{
|
|
1108
919
|
"type": "function",
|
|
920
|
+
"name": "renounceOwnership",
|
|
921
|
+
"inputs": [],
|
|
922
|
+
"outputs": [],
|
|
923
|
+
"stateMutability": "nonpayable",
|
|
1109
924
|
},
|
|
1110
925
|
{
|
|
926
|
+
"type": "function",
|
|
927
|
+
"name": "revokeAuthorization",
|
|
1111
928
|
"inputs": [
|
|
1112
|
-
{"
|
|
929
|
+
{"name": "intentAccount", "type": "address", "internalType": "address"}
|
|
1113
930
|
],
|
|
1114
|
-
"name": "deposit",
|
|
1115
931
|
"outputs": [],
|
|
1116
932
|
"stateMutability": "nonpayable",
|
|
1117
|
-
"type": "function",
|
|
1118
933
|
},
|
|
1119
934
|
{
|
|
935
|
+
"type": "function",
|
|
936
|
+
"name": "transferOwnership",
|
|
1120
937
|
"inputs": [
|
|
1121
|
-
{
|
|
1122
|
-
"internalType": "address[]",
|
|
1123
|
-
"name": "recipients",
|
|
1124
|
-
"type": "address[]",
|
|
1125
|
-
},
|
|
1126
|
-
{
|
|
1127
|
-
"internalType": "uint256[]",
|
|
1128
|
-
"name": "capitalAmounts",
|
|
1129
|
-
"type": "uint256[]",
|
|
1130
|
-
},
|
|
938
|
+
{"name": "newOwner", "type": "address", "internalType": "address"}
|
|
1131
939
|
],
|
|
1132
|
-
"name": "disperseFees",
|
|
1133
940
|
"outputs": [],
|
|
1134
941
|
"stateMutability": "nonpayable",
|
|
1135
|
-
"type": "function",
|
|
1136
942
|
},
|
|
1137
943
|
{
|
|
944
|
+
"type": "function",
|
|
945
|
+
"name": "withdraw",
|
|
1138
946
|
"inputs": [
|
|
1139
|
-
{
|
|
1140
|
-
"internalType": "address",
|
|
1141
|
-
"name": "marginAccountId",
|
|
1142
|
-
"type": "address",
|
|
1143
|
-
},
|
|
1144
|
-
{"internalType": "bytes32", "name": "productId", "type": "bytes32"},
|
|
1145
|
-
{"internalType": "uint256", "name": "price", "type": "uint256"},
|
|
1146
|
-
{"internalType": "int256", "name": "quantity", "type": "int256"},
|
|
947
|
+
{"name": "amount", "type": "uint256", "internalType": "uint256"}
|
|
1147
948
|
],
|
|
1148
|
-
"
|
|
1149
|
-
"
|
|
1150
|
-
"stateMutability": "view",
|
|
1151
|
-
"type": "function",
|
|
949
|
+
"outputs": [],
|
|
950
|
+
"stateMutability": "nonpayable",
|
|
1152
951
|
},
|
|
1153
952
|
{
|
|
953
|
+
"type": "function",
|
|
954
|
+
"name": "withdrawable",
|
|
1154
955
|
"inputs": [
|
|
1155
956
|
{
|
|
1156
|
-
"internalType": "address",
|
|
1157
957
|
"name": "marginAccountId",
|
|
1158
958
|
"type": "address",
|
|
1159
|
-
|
|
1160
|
-
|
|
959
|
+
"internalType": "address",
|
|
960
|
+
}
|
|
1161
961
|
],
|
|
1162
|
-
"name": "
|
|
1163
|
-
"outputs": [{"internalType": "uint256", "name": "", "type": "uint256"}],
|
|
962
|
+
"outputs": [{"name": "", "type": "uint256", "internalType": "uint256"}],
|
|
1164
963
|
"stateMutability": "view",
|
|
1165
|
-
"type": "function",
|
|
1166
964
|
},
|
|
1167
965
|
{
|
|
966
|
+
"type": "event",
|
|
967
|
+
"name": "Deposit",
|
|
1168
968
|
"inputs": [
|
|
1169
969
|
{
|
|
1170
|
-
"
|
|
1171
|
-
"name": "_collateralToken",
|
|
970
|
+
"name": "user",
|
|
1172
971
|
"type": "address",
|
|
972
|
+
"indexed": True,
|
|
973
|
+
"internalType": "address",
|
|
1173
974
|
},
|
|
1174
|
-
{"internalType": "address", "name": "_valuation", "type": "address"},
|
|
1175
975
|
{
|
|
1176
|
-
"
|
|
1177
|
-
"
|
|
1178
|
-
"
|
|
976
|
+
"name": "amount",
|
|
977
|
+
"type": "uint256",
|
|
978
|
+
"indexed": False,
|
|
979
|
+
"internalType": "uint256",
|
|
1179
980
|
},
|
|
1180
|
-
{"internalType": "address", "name": "_clearing", "type": "address"},
|
|
1181
981
|
],
|
|
1182
|
-
"
|
|
1183
|
-
"outputs": [],
|
|
1184
|
-
"stateMutability": "nonpayable",
|
|
1185
|
-
"type": "function",
|
|
982
|
+
"anonymous": False,
|
|
1186
983
|
},
|
|
1187
984
|
{
|
|
985
|
+
"type": "event",
|
|
986
|
+
"name": "Initialized",
|
|
1188
987
|
"inputs": [
|
|
1189
|
-
{
|
|
988
|
+
{
|
|
989
|
+
"name": "version",
|
|
990
|
+
"type": "uint64",
|
|
991
|
+
"indexed": False,
|
|
992
|
+
"internalType": "uint64",
|
|
993
|
+
}
|
|
1190
994
|
],
|
|
1191
|
-
"
|
|
1192
|
-
"outputs": [{"internalType": "int256", "name": "", "type": "int256"}],
|
|
1193
|
-
"stateMutability": "view",
|
|
1194
|
-
"type": "function",
|
|
995
|
+
"anonymous": False,
|
|
1195
996
|
},
|
|
1196
997
|
{
|
|
998
|
+
"type": "event",
|
|
999
|
+
"name": "IntentAuthorized",
|
|
1197
1000
|
"inputs": [
|
|
1198
|
-
{"internalType": "address", "name": "marginAccount", "type": "address"},
|
|
1199
1001
|
{
|
|
1200
|
-
"
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
"type": "bytes32",
|
|
1205
|
-
},
|
|
1206
|
-
{
|
|
1207
|
-
"internalType": "int256",
|
|
1208
|
-
"name": "quantity",
|
|
1209
|
-
"type": "int256",
|
|
1210
|
-
},
|
|
1211
|
-
{"internalType": "uint256", "name": "price", "type": "uint256"},
|
|
1212
|
-
],
|
|
1213
|
-
"internalType": "struct IMarginAccount.Settlement[]",
|
|
1214
|
-
"name": "settlements",
|
|
1215
|
-
"type": "tuple[]",
|
|
1002
|
+
"name": "marginAccountId",
|
|
1003
|
+
"type": "address",
|
|
1004
|
+
"indexed": True,
|
|
1005
|
+
"internalType": "address",
|
|
1216
1006
|
},
|
|
1217
1007
|
{
|
|
1218
|
-
"
|
|
1219
|
-
"
|
|
1220
|
-
"
|
|
1008
|
+
"name": "intentAccount",
|
|
1009
|
+
"type": "address",
|
|
1010
|
+
"indexed": True,
|
|
1011
|
+
"internalType": "address",
|
|
1221
1012
|
},
|
|
1222
1013
|
],
|
|
1223
|
-
"
|
|
1224
|
-
"outputs": [
|
|
1225
|
-
{"internalType": "int256", "name": "maeAfter", "type": "int256"},
|
|
1226
|
-
{"internalType": "uint256", "name": "mmuAfter", "type": "uint256"},
|
|
1227
|
-
],
|
|
1228
|
-
"stateMutability": "view",
|
|
1229
|
-
"type": "function",
|
|
1014
|
+
"anonymous": False,
|
|
1230
1015
|
},
|
|
1231
1016
|
{
|
|
1017
|
+
"type": "event",
|
|
1018
|
+
"name": "IntentRevoked",
|
|
1232
1019
|
"inputs": [
|
|
1233
|
-
{"internalType": "address", "name": "marginAccount", "type": "address"},
|
|
1234
1020
|
{
|
|
1235
|
-
"
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
"type": "bytes32",
|
|
1240
|
-
},
|
|
1241
|
-
{
|
|
1242
|
-
"internalType": "int256",
|
|
1243
|
-
"name": "quantity",
|
|
1244
|
-
"type": "int256",
|
|
1245
|
-
},
|
|
1246
|
-
{"internalType": "uint256", "name": "price", "type": "uint256"},
|
|
1247
|
-
],
|
|
1248
|
-
"internalType": "struct IMarginAccount.Settlement",
|
|
1249
|
-
"name": "settlement",
|
|
1250
|
-
"type": "tuple",
|
|
1021
|
+
"name": "marginAccountId",
|
|
1022
|
+
"type": "address",
|
|
1023
|
+
"indexed": True,
|
|
1024
|
+
"internalType": "address",
|
|
1251
1025
|
},
|
|
1252
1026
|
{
|
|
1253
|
-
"
|
|
1254
|
-
"
|
|
1255
|
-
"
|
|
1027
|
+
"name": "intentAccount",
|
|
1028
|
+
"type": "address",
|
|
1029
|
+
"indexed": True,
|
|
1030
|
+
"internalType": "address",
|
|
1256
1031
|
},
|
|
1257
1032
|
],
|
|
1258
|
-
"
|
|
1259
|
-
"outputs": [
|
|
1260
|
-
{"internalType": "bool", "name": "checkPassed", "type": "bool"},
|
|
1261
|
-
{"internalType": "int256", "name": "maeAfter", "type": "int256"},
|
|
1262
|
-
{"internalType": "uint256", "name": "mmuAfter", "type": "uint256"},
|
|
1263
|
-
],
|
|
1264
|
-
"stateMutability": "view",
|
|
1265
|
-
"type": "function",
|
|
1266
|
-
},
|
|
1267
|
-
{
|
|
1268
|
-
"inputs": [
|
|
1269
|
-
{"internalType": "address", "name": "marginAccount", "type": "address"}
|
|
1270
|
-
],
|
|
1271
|
-
"name": "mma",
|
|
1272
|
-
"outputs": [{"internalType": "uint256", "name": "", "type": "uint256"}],
|
|
1273
|
-
"stateMutability": "view",
|
|
1274
|
-
"type": "function",
|
|
1275
|
-
},
|
|
1276
|
-
{
|
|
1277
|
-
"inputs": [
|
|
1278
|
-
{"internalType": "address", "name": "marginAccount", "type": "address"}
|
|
1279
|
-
],
|
|
1280
|
-
"name": "mmu",
|
|
1281
|
-
"outputs": [{"internalType": "uint256", "name": "", "type": "uint256"}],
|
|
1282
|
-
"stateMutability": "view",
|
|
1283
|
-
"type": "function",
|
|
1284
|
-
},
|
|
1285
|
-
{
|
|
1286
|
-
"inputs": [
|
|
1287
|
-
{"internalType": "address", "name": "marginAccount", "type": "address"}
|
|
1288
|
-
],
|
|
1289
|
-
"name": "pnl",
|
|
1290
|
-
"outputs": [{"internalType": "int256", "name": "", "type": "int256"}],
|
|
1291
|
-
"stateMutability": "view",
|
|
1292
|
-
"type": "function",
|
|
1033
|
+
"anonymous": False,
|
|
1293
1034
|
},
|
|
1294
1035
|
{
|
|
1036
|
+
"type": "event",
|
|
1037
|
+
"name": "OwnershipTransferred",
|
|
1295
1038
|
"inputs": [
|
|
1296
1039
|
{
|
|
1040
|
+
"name": "previousOwner",
|
|
1041
|
+
"type": "address",
|
|
1042
|
+
"indexed": True,
|
|
1297
1043
|
"internalType": "address",
|
|
1298
|
-
|
|
1044
|
+
},
|
|
1045
|
+
{
|
|
1046
|
+
"name": "newOwner",
|
|
1299
1047
|
"type": "address",
|
|
1048
|
+
"indexed": True,
|
|
1049
|
+
"internalType": "address",
|
|
1300
1050
|
},
|
|
1301
|
-
{"internalType": "bytes32", "name": "positionId", "type": "bytes32"},
|
|
1302
|
-
],
|
|
1303
|
-
"name": "positionAge",
|
|
1304
|
-
"outputs": [{"internalType": "uint256", "name": "", "type": "uint256"}],
|
|
1305
|
-
"stateMutability": "view",
|
|
1306
|
-
"type": "function",
|
|
1307
|
-
},
|
|
1308
|
-
{
|
|
1309
|
-
"inputs": [
|
|
1310
|
-
{"internalType": "address", "name": "marginAccount", "type": "address"}
|
|
1311
1051
|
],
|
|
1312
|
-
"
|
|
1313
|
-
"outputs": [{"internalType": "uint256", "name": "", "type": "uint256"}],
|
|
1314
|
-
"stateMutability": "view",
|
|
1315
|
-
"type": "function",
|
|
1052
|
+
"anonymous": False,
|
|
1316
1053
|
},
|
|
1317
1054
|
{
|
|
1055
|
+
"type": "event",
|
|
1056
|
+
"name": "PositionUpdated",
|
|
1318
1057
|
"inputs": [
|
|
1319
|
-
{"internalType": "address", "name": "marginAccount", "type": "address"},
|
|
1320
|
-
{"internalType": "bytes32", "name": "positionId", "type": "bytes32"},
|
|
1321
|
-
],
|
|
1322
|
-
"name": "positionData",
|
|
1323
|
-
"outputs": [
|
|
1324
1058
|
{
|
|
1325
|
-
"
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
"name": "",
|
|
1350
|
-
"type": "
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
],
|
|
1361
|
-
"name": "positionPnL",
|
|
1362
|
-
"outputs": [{"internalType": "int256", "name": "", "type": "int256"}],
|
|
1363
|
-
"stateMutability": "view",
|
|
1364
|
-
"type": "function",
|
|
1365
|
-
},
|
|
1366
|
-
{
|
|
1367
|
-
"inputs": [
|
|
1368
|
-
{"internalType": "address", "name": "marginAccount", "type": "address"},
|
|
1369
|
-
{"internalType": "bytes32", "name": "positionId", "type": "bytes32"},
|
|
1059
|
+
"name": "marginAccountId",
|
|
1060
|
+
"type": "address",
|
|
1061
|
+
"indexed": True,
|
|
1062
|
+
"internalType": "address",
|
|
1063
|
+
},
|
|
1064
|
+
{
|
|
1065
|
+
"name": "productId",
|
|
1066
|
+
"type": "bytes32",
|
|
1067
|
+
"indexed": True,
|
|
1068
|
+
"internalType": "bytes32",
|
|
1069
|
+
},
|
|
1070
|
+
{
|
|
1071
|
+
"name": "totalQuantity",
|
|
1072
|
+
"type": "int256",
|
|
1073
|
+
"indexed": False,
|
|
1074
|
+
"internalType": "int256",
|
|
1075
|
+
},
|
|
1076
|
+
{
|
|
1077
|
+
"name": "costBasis",
|
|
1078
|
+
"type": "int256",
|
|
1079
|
+
"indexed": False,
|
|
1080
|
+
"internalType": "int256",
|
|
1081
|
+
},
|
|
1082
|
+
{
|
|
1083
|
+
"name": "price",
|
|
1084
|
+
"type": "uint256",
|
|
1085
|
+
"indexed": False,
|
|
1086
|
+
"internalType": "uint256",
|
|
1087
|
+
},
|
|
1088
|
+
{
|
|
1089
|
+
"name": "quantity",
|
|
1090
|
+
"type": "int256",
|
|
1091
|
+
"indexed": False,
|
|
1092
|
+
"internalType": "int256",
|
|
1093
|
+
},
|
|
1370
1094
|
],
|
|
1371
|
-
"
|
|
1372
|
-
"outputs": [{"internalType": "int256", "name": "", "type": "int256"}],
|
|
1373
|
-
"stateMutability": "view",
|
|
1374
|
-
"type": "function",
|
|
1095
|
+
"anonymous": False,
|
|
1375
1096
|
},
|
|
1376
1097
|
{
|
|
1098
|
+
"type": "event",
|
|
1099
|
+
"name": "Withdraw",
|
|
1377
1100
|
"inputs": [
|
|
1378
|
-
{"internalType": "address", "name": "marginAccount", "type": "address"}
|
|
1379
|
-
],
|
|
1380
|
-
"name": "positions",
|
|
1381
|
-
"outputs": [{"internalType": "bytes32[]", "name": "", "type": "bytes32[]"}],
|
|
1382
|
-
"stateMutability": "view",
|
|
1383
|
-
"type": "function",
|
|
1384
|
-
},
|
|
1385
|
-
{
|
|
1386
|
-
"inputs": [],
|
|
1387
|
-
"name": "productRegistry",
|
|
1388
|
-
"outputs": [
|
|
1389
1101
|
{
|
|
1390
|
-
"
|
|
1391
|
-
"name": "",
|
|
1102
|
+
"name": "user",
|
|
1392
1103
|
"type": "address",
|
|
1393
|
-
|
|
1104
|
+
"indexed": True,
|
|
1105
|
+
"internalType": "address",
|
|
1106
|
+
},
|
|
1107
|
+
{
|
|
1108
|
+
"name": "amount",
|
|
1109
|
+
"type": "uint256",
|
|
1110
|
+
"indexed": False,
|
|
1111
|
+
"internalType": "uint256",
|
|
1112
|
+
},
|
|
1394
1113
|
],
|
|
1395
|
-
"
|
|
1396
|
-
"type": "function",
|
|
1114
|
+
"anonymous": False,
|
|
1397
1115
|
},
|
|
1116
|
+
{"type": "error", "name": "InvalidInitialization", "inputs": []},
|
|
1117
|
+
{"type": "error", "name": "NotInitializing", "inputs": []},
|
|
1398
1118
|
{
|
|
1399
|
-
"
|
|
1400
|
-
|
|
1401
|
-
],
|
|
1402
|
-
"name": "revokeAuthorization",
|
|
1403
|
-
"outputs": [],
|
|
1404
|
-
"stateMutability": "nonpayable",
|
|
1405
|
-
"type": "function",
|
|
1119
|
+
"type": "error",
|
|
1120
|
+
"name": "OwnableInvalidOwner",
|
|
1121
|
+
"inputs": [{"name": "owner", "type": "address", "internalType": "address"}],
|
|
1406
1122
|
},
|
|
1407
1123
|
{
|
|
1124
|
+
"type": "error",
|
|
1125
|
+
"name": "OwnableUnauthorizedAccount",
|
|
1408
1126
|
"inputs": [
|
|
1409
|
-
{"
|
|
1410
|
-
{"internalType": "address", "name": "intentAccount", "type": "address"},
|
|
1411
|
-
{
|
|
1412
|
-
"components": [
|
|
1413
|
-
{
|
|
1414
|
-
"internalType": "bytes32",
|
|
1415
|
-
"name": "positionId",
|
|
1416
|
-
"type": "bytes32",
|
|
1417
|
-
},
|
|
1418
|
-
{
|
|
1419
|
-
"internalType": "int256",
|
|
1420
|
-
"name": "quantity",
|
|
1421
|
-
"type": "int256",
|
|
1422
|
-
},
|
|
1423
|
-
{"internalType": "uint256", "name": "price", "type": "uint256"},
|
|
1424
|
-
],
|
|
1425
|
-
"internalType": "struct IMarginAccount.Settlement",
|
|
1426
|
-
"name": "settlement",
|
|
1427
|
-
"type": "tuple",
|
|
1428
|
-
},
|
|
1127
|
+
{"name": "account", "type": "address", "internalType": "address"}
|
|
1429
1128
|
],
|
|
1430
|
-
"name": "settle",
|
|
1431
|
-
"outputs": [{"internalType": "bool", "name": "", "type": "bool"}],
|
|
1432
|
-
"stateMutability": "nonpayable",
|
|
1433
|
-
"type": "function",
|
|
1434
1129
|
},
|
|
1435
1130
|
{
|
|
1436
|
-
"
|
|
1437
|
-
"name": "
|
|
1438
|
-
"
|
|
1439
|
-
{"internalType": "contract IValuation", "name": "", "type": "address"}
|
|
1440
|
-
],
|
|
1441
|
-
"stateMutability": "view",
|
|
1442
|
-
"type": "function",
|
|
1131
|
+
"type": "error",
|
|
1132
|
+
"name": "SafeCastOverflowedIntToUint",
|
|
1133
|
+
"inputs": [{"name": "value", "type": "int256", "internalType": "int256"}],
|
|
1443
1134
|
},
|
|
1444
1135
|
{
|
|
1445
|
-
"
|
|
1446
|
-
|
|
1447
|
-
],
|
|
1448
|
-
"name": "withdraw",
|
|
1449
|
-
"outputs": [],
|
|
1450
|
-
"stateMutability": "nonpayable",
|
|
1451
|
-
"type": "function",
|
|
1136
|
+
"type": "error",
|
|
1137
|
+
"name": "SafeERC20FailedOperation",
|
|
1138
|
+
"inputs": [{"name": "token", "type": "address", "internalType": "address"}],
|
|
1452
1139
|
},
|
|
1453
1140
|
{
|
|
1141
|
+
"type": "error",
|
|
1142
|
+
"name": "Unauthorized",
|
|
1454
1143
|
"inputs": [
|
|
1455
|
-
{"
|
|
1144
|
+
{"name": "account", "type": "address", "internalType": "address"}
|
|
1456
1145
|
],
|
|
1457
|
-
"name": "withdrawable",
|
|
1458
|
-
"outputs": [{"internalType": "uint256", "name": "", "type": "uint256"}],
|
|
1459
|
-
"stateMutability": "view",
|
|
1460
|
-
"type": "function",
|
|
1461
1146
|
},
|
|
1462
1147
|
],
|
|
1463
1148
|
)
|