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
|
@@ -7,6 +7,7 @@ import typing
|
|
|
7
7
|
import eth_typing
|
|
8
8
|
import hexbytes
|
|
9
9
|
import web3
|
|
10
|
+
from web3 import types
|
|
10
11
|
from web3.contract import contract
|
|
11
12
|
|
|
12
13
|
|
|
@@ -35,12 +36,15 @@ class MarkPriceTrackerFacet:
|
|
|
35
36
|
def valuation(
|
|
36
37
|
self,
|
|
37
38
|
product_id: hexbytes.HexBytes,
|
|
39
|
+
block_identifier: types.BlockIdentifier = "latest",
|
|
38
40
|
) -> int:
|
|
39
41
|
"""Binding for `valuation` on the MarkPriceTrackerFacet contract.
|
|
40
42
|
|
|
41
43
|
Parameters
|
|
42
44
|
----------
|
|
43
45
|
product_id : hexbytes.HexBytes
|
|
46
|
+
block_identifier : web3.types.BlockIdentifier
|
|
47
|
+
The block identifier, defaults to the latest block.
|
|
44
48
|
|
|
45
49
|
Returns
|
|
46
50
|
-------
|
|
@@ -48,7 +52,7 @@ class MarkPriceTrackerFacet:
|
|
|
48
52
|
"""
|
|
49
53
|
return_value = self._contract.functions.valuation(
|
|
50
54
|
product_id,
|
|
51
|
-
).call()
|
|
55
|
+
).call(block_identifier=block_identifier)
|
|
52
56
|
return int(return_value)
|
|
53
57
|
|
|
54
58
|
def valuation_after_trade(
|
|
@@ -56,6 +60,7 @@ class MarkPriceTrackerFacet:
|
|
|
56
60
|
product_id: hexbytes.HexBytes,
|
|
57
61
|
price: int,
|
|
58
62
|
quantity: int,
|
|
63
|
+
block_identifier: types.BlockIdentifier = "latest",
|
|
59
64
|
) -> int:
|
|
60
65
|
"""Binding for `valuationAfterTrade` on the MarkPriceTrackerFacet contract.
|
|
61
66
|
|
|
@@ -64,6 +69,8 @@ class MarkPriceTrackerFacet:
|
|
|
64
69
|
product_id : hexbytes.HexBytes
|
|
65
70
|
price : int
|
|
66
71
|
quantity : int
|
|
72
|
+
block_identifier : web3.types.BlockIdentifier
|
|
73
|
+
The block identifier, defaults to the latest block.
|
|
67
74
|
|
|
68
75
|
Returns
|
|
69
76
|
-------
|
|
@@ -73,7 +80,7 @@ class MarkPriceTrackerFacet:
|
|
|
73
80
|
product_id,
|
|
74
81
|
price,
|
|
75
82
|
quantity,
|
|
76
|
-
).call()
|
|
83
|
+
).call(block_identifier=block_identifier)
|
|
77
84
|
return int(return_value)
|
|
78
85
|
|
|
79
86
|
|
|
@@ -81,31 +88,82 @@ ABI = typing.cast(
|
|
|
81
88
|
eth_typing.ABI,
|
|
82
89
|
[
|
|
83
90
|
{
|
|
91
|
+
"type": "function",
|
|
92
|
+
"name": "valuation",
|
|
84
93
|
"inputs": [
|
|
85
|
-
{"
|
|
94
|
+
{"name": "productId", "type": "bytes32", "internalType": "bytes32"}
|
|
86
95
|
],
|
|
87
|
-
"name": "
|
|
88
|
-
"
|
|
96
|
+
"outputs": [{"name": "", "type": "int256", "internalType": "int256"}],
|
|
97
|
+
"stateMutability": "view",
|
|
89
98
|
},
|
|
90
99
|
{
|
|
100
|
+
"type": "function",
|
|
101
|
+
"name": "valuationAfterTrade",
|
|
91
102
|
"inputs": [
|
|
92
|
-
{"
|
|
103
|
+
{"name": "productId", "type": "bytes32", "internalType": "bytes32"},
|
|
104
|
+
{"name": "price", "type": "int256", "internalType": "int256"},
|
|
105
|
+
{"name": "quantity", "type": "uint256", "internalType": "uint256"},
|
|
93
106
|
],
|
|
94
|
-
"name": "
|
|
95
|
-
"outputs": [{"internalType": "uint256", "name": "", "type": "uint256"}],
|
|
107
|
+
"outputs": [{"name": "", "type": "int256", "internalType": "int256"}],
|
|
96
108
|
"stateMutability": "view",
|
|
97
|
-
"type": "function",
|
|
98
109
|
},
|
|
110
|
+
{"type": "error", "name": "EVWMA_NotInitialized", "inputs": []},
|
|
99
111
|
{
|
|
112
|
+
"type": "error",
|
|
113
|
+
"name": "InvalidFieldAccess",
|
|
100
114
|
"inputs": [
|
|
101
|
-
{
|
|
102
|
-
|
|
103
|
-
|
|
115
|
+
{
|
|
116
|
+
"name": "productType",
|
|
117
|
+
"type": "uint8",
|
|
118
|
+
"internalType": "enum ProductType",
|
|
119
|
+
},
|
|
120
|
+
{"name": "field", "type": "string", "internalType": "string"},
|
|
121
|
+
],
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
"type": "error",
|
|
125
|
+
"name": "PRBMath_MulDiv18_Overflow",
|
|
126
|
+
"inputs": [
|
|
127
|
+
{"name": "x", "type": "uint256", "internalType": "uint256"},
|
|
128
|
+
{"name": "y", "type": "uint256", "internalType": "uint256"},
|
|
129
|
+
],
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
"type": "error",
|
|
133
|
+
"name": "PRBMath_MulDiv_Overflow",
|
|
134
|
+
"inputs": [
|
|
135
|
+
{"name": "x", "type": "uint256", "internalType": "uint256"},
|
|
136
|
+
{"name": "y", "type": "uint256", "internalType": "uint256"},
|
|
137
|
+
{"name": "denominator", "type": "uint256", "internalType": "uint256"},
|
|
138
|
+
],
|
|
139
|
+
},
|
|
140
|
+
{"type": "error", "name": "PRBMath_SD59x18_Div_InputTooSmall", "inputs": []},
|
|
141
|
+
{
|
|
142
|
+
"type": "error",
|
|
143
|
+
"name": "PRBMath_SD59x18_Div_Overflow",
|
|
144
|
+
"inputs": [
|
|
145
|
+
{"name": "x", "type": "int256", "internalType": "SD59x18"},
|
|
146
|
+
{"name": "y", "type": "int256", "internalType": "SD59x18"},
|
|
147
|
+
],
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
"type": "error",
|
|
151
|
+
"name": "PRBMath_SD59x18_Exp2_InputTooBig",
|
|
152
|
+
"inputs": [{"name": "x", "type": "int256", "internalType": "SD59x18"}],
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
"type": "error",
|
|
156
|
+
"name": "PRBMath_SD59x18_Exp_InputTooBig",
|
|
157
|
+
"inputs": [{"name": "x", "type": "int256", "internalType": "SD59x18"}],
|
|
158
|
+
},
|
|
159
|
+
{"type": "error", "name": "PRBMath_SD59x18_Mul_InputTooSmall", "inputs": []},
|
|
160
|
+
{
|
|
161
|
+
"type": "error",
|
|
162
|
+
"name": "PRBMath_SD59x18_Mul_Overflow",
|
|
163
|
+
"inputs": [
|
|
164
|
+
{"name": "x", "type": "int256", "internalType": "SD59x18"},
|
|
165
|
+
{"name": "y", "type": "int256", "internalType": "SD59x18"},
|
|
104
166
|
],
|
|
105
|
-
"name": "valuationAfterTrade",
|
|
106
|
-
"outputs": [{"internalType": "uint256", "name": "", "type": "uint256"}],
|
|
107
|
-
"stateMutability": "view",
|
|
108
|
-
"type": "function",
|
|
109
167
|
},
|
|
110
168
|
],
|
|
111
169
|
)
|