afp-sdk 0.2.1__tar.gz → 0.2.2__tar.gz
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_sdk-0.2.1 → afp_sdk-0.2.2}/.env.template +1 -0
- {afp_sdk-0.2.1 → afp_sdk-0.2.2}/CHANGELOG.md +11 -0
- {afp_sdk-0.2.1 → afp_sdk-0.2.2}/PKG-INFO +1 -1
- {afp_sdk-0.2.1 → afp_sdk-0.2.2}/afp/bindings/__init__.py +4 -0
- {afp_sdk-0.2.1 → afp_sdk-0.2.2}/afp/bindings/auctioneer_facet.py +1 -7
- {afp_sdk-0.2.1 → afp_sdk-0.2.2}/afp/bindings/clearing_facet.py +4 -9
- {afp_sdk-0.2.1 → afp_sdk-0.2.2}/afp/bindings/facade.py +13 -0
- {afp_sdk-0.2.1 → afp_sdk-0.2.2}/afp/bindings/system_viewer.py +7 -71
- {afp_sdk-0.2.1 → afp_sdk-0.2.2}/afp/bindings/trading_protocol.py +1 -48
- {afp_sdk-0.2.1 → afp_sdk-0.2.2}/afp/config.py +3 -0
- {afp_sdk-0.2.1 → afp_sdk-0.2.2}/pyproject.toml +1 -1
- {afp_sdk-0.2.1 → afp_sdk-0.2.2}/uv.lock +1 -1
- {afp_sdk-0.2.1 → afp_sdk-0.2.2}/.envrc +0 -0
- {afp_sdk-0.2.1 → afp_sdk-0.2.2}/LICENSE +0 -0
- {afp_sdk-0.2.1 → afp_sdk-0.2.2}/README.md +0 -0
- {afp_sdk-0.2.1 → afp_sdk-0.2.2}/afp/__init__.py +0 -0
- {afp_sdk-0.2.1 → afp_sdk-0.2.2}/afp/api/__init__.py +0 -0
- {afp_sdk-0.2.1 → afp_sdk-0.2.2}/afp/api/admin.py +0 -0
- {afp_sdk-0.2.1 → afp_sdk-0.2.2}/afp/api/base.py +0 -0
- {afp_sdk-0.2.1 → afp_sdk-0.2.2}/afp/api/builder.py +0 -0
- {afp_sdk-0.2.1 → afp_sdk-0.2.2}/afp/api/clearing.py +0 -0
- {afp_sdk-0.2.1 → afp_sdk-0.2.2}/afp/api/liquidation.py +0 -0
- {afp_sdk-0.2.1 → afp_sdk-0.2.2}/afp/api/trading.py +0 -0
- {afp_sdk-0.2.1 → afp_sdk-0.2.2}/afp/bindings/bankruptcy_facet.py +0 -0
- {afp_sdk-0.2.1 → afp_sdk-0.2.2}/afp/bindings/erc20.py +0 -0
- {afp_sdk-0.2.1 → afp_sdk-0.2.2}/afp/bindings/final_settlement_facet.py +0 -0
- {afp_sdk-0.2.1 → afp_sdk-0.2.2}/afp/bindings/margin_account.py +0 -0
- {afp_sdk-0.2.1 → afp_sdk-0.2.2}/afp/bindings/margin_account_registry.py +0 -0
- {afp_sdk-0.2.1 → afp_sdk-0.2.2}/afp/bindings/mark_price_tracker_facet.py +0 -0
- {afp_sdk-0.2.1 → afp_sdk-0.2.2}/afp/bindings/oracle_provider.py +0 -0
- {afp_sdk-0.2.1 → afp_sdk-0.2.2}/afp/bindings/product_registry.py +0 -0
- {afp_sdk-0.2.1 → afp_sdk-0.2.2}/afp/decorators.py +0 -0
- {afp_sdk-0.2.1 → afp_sdk-0.2.2}/afp/enums.py +0 -0
- {afp_sdk-0.2.1 → afp_sdk-0.2.2}/afp/exceptions.py +0 -0
- {afp_sdk-0.2.1 → afp_sdk-0.2.2}/afp/exchange.py +0 -0
- {afp_sdk-0.2.1 → afp_sdk-0.2.2}/afp/py.typed +0 -0
- {afp_sdk-0.2.1 → afp_sdk-0.2.2}/afp/schemas.py +0 -0
- {afp_sdk-0.2.1 → afp_sdk-0.2.2}/afp/signing.py +0 -0
- {afp_sdk-0.2.1 → afp_sdk-0.2.2}/afp/validators.py +0 -0
- {afp_sdk-0.2.1 → afp_sdk-0.2.2}/devenv.lock +0 -0
- {afp_sdk-0.2.1 → afp_sdk-0.2.2}/devenv.nix +0 -0
- {afp_sdk-0.2.1 → afp_sdk-0.2.2}/devenv.yaml +0 -0
- {afp_sdk-0.2.1 → afp_sdk-0.2.2}/examples/cancel_order.py +0 -0
- {afp_sdk-0.2.1 → afp_sdk-0.2.2}/examples/create_product.py +0 -0
- {afp_sdk-0.2.1 → afp_sdk-0.2.2}/examples/execute_trade.py +0 -0
- {afp_sdk-0.2.1 → afp_sdk-0.2.2}/tests/__init__.py +0 -0
- {afp_sdk-0.2.1 → afp_sdk-0.2.2}/tests/test_decorators.py +0 -0
- {afp_sdk-0.2.1 → afp_sdk-0.2.2}/tests/test_hashing.py +0 -0
- {afp_sdk-0.2.1 → afp_sdk-0.2.2}/tests/test_login.py +0 -0
- {afp_sdk-0.2.1 → afp_sdk-0.2.2}/tests/test_schemas.py +0 -0
- {afp_sdk-0.2.1 → afp_sdk-0.2.2}/tests/test_validators.py +0 -0
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
## [v0.2.2] - 2025-09-03
|
|
2
|
+
|
|
3
|
+
### Added
|
|
4
|
+
|
|
5
|
+
- Add public facade for SystemViewer contract binding ([#16](https://github.com/autonity/afp-sdk/pull/16))
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
|
|
9
|
+
- Remove duplicates of ports of Solidity data structures ([#16](https://github.com/autonity/afp-sdk/pull/16))
|
|
10
|
+
|
|
1
11
|
## [v0.2.1] - 2025-09-02
|
|
2
12
|
|
|
3
13
|
### Added
|
|
@@ -35,6 +45,7 @@
|
|
|
35
45
|
|
|
36
46
|
_First release._
|
|
37
47
|
|
|
48
|
+
[v0.2.2]: https://github.com/autonity/afp-sdk/releases/tag/v0.2.2
|
|
38
49
|
[v0.2.1]: https://github.com/autonity/afp-sdk/releases/tag/v0.2.1
|
|
39
50
|
[v0.2.0]: https://github.com/autonity/afp-sdk/releases/tag/v0.2.0
|
|
40
51
|
[v0.1.2]: https://github.com/autonity/afp-sdk/releases/tag/v0.1.2
|
|
@@ -8,6 +8,7 @@ from .facade import (
|
|
|
8
8
|
MarginAccountRegistry,
|
|
9
9
|
OracleProvider,
|
|
10
10
|
ProductRegistry,
|
|
11
|
+
SystemViewer,
|
|
11
12
|
)
|
|
12
13
|
from .margin_account import MarginAccount, PositionData, Settlement
|
|
13
14
|
from .product_registry import (
|
|
@@ -16,6 +17,7 @@ from .product_registry import (
|
|
|
16
17
|
ProductMetadata,
|
|
17
18
|
ProductState,
|
|
18
19
|
)
|
|
20
|
+
from .system_viewer import UserMarginAccountData
|
|
19
21
|
from .trading_protocol import TradingProtocol
|
|
20
22
|
|
|
21
23
|
__all__ = (
|
|
@@ -25,6 +27,7 @@ __all__ = (
|
|
|
25
27
|
"MarginAccountRegistry",
|
|
26
28
|
"OracleProvider",
|
|
27
29
|
"ProductRegistry",
|
|
30
|
+
"SystemViewer",
|
|
28
31
|
"TradingProtocol",
|
|
29
32
|
# Structures
|
|
30
33
|
"AuctionConfig",
|
|
@@ -42,6 +45,7 @@ __all__ = (
|
|
|
42
45
|
"ProductMetadata",
|
|
43
46
|
"Settlement",
|
|
44
47
|
"Trade",
|
|
48
|
+
"UserMarginAccountData",
|
|
45
49
|
# Enumerations
|
|
46
50
|
"ProductState",
|
|
47
51
|
"Side",
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
# This module has been generated using pyabigen v0.2.16
|
|
4
4
|
|
|
5
|
-
import enum
|
|
6
5
|
import typing
|
|
7
6
|
from dataclasses import dataclass
|
|
8
7
|
|
|
@@ -11,12 +10,7 @@ import hexbytes
|
|
|
11
10
|
import web3
|
|
12
11
|
from web3.contract import contract
|
|
13
12
|
|
|
14
|
-
|
|
15
|
-
class Side(enum.IntEnum):
|
|
16
|
-
"""Port of `enum Side` on the AuctioneerFacet contract."""
|
|
17
|
-
|
|
18
|
-
BID = 0
|
|
19
|
-
ASK = 1
|
|
13
|
+
from .clearing_facet import Side
|
|
20
14
|
|
|
21
15
|
|
|
22
16
|
@dataclass
|
|
@@ -11,6 +11,9 @@ import hexbytes
|
|
|
11
11
|
import web3
|
|
12
12
|
from web3.contract import contract
|
|
13
13
|
|
|
14
|
+
if typing.TYPE_CHECKING:
|
|
15
|
+
from .auctioneer_facet import AuctionConfig
|
|
16
|
+
|
|
14
17
|
|
|
15
18
|
class Side(enum.IntEnum):
|
|
16
19
|
"""Port of `enum Side` on the ClearingFacet contract."""
|
|
@@ -19,14 +22,6 @@ class Side(enum.IntEnum):
|
|
|
19
22
|
ASK = 1
|
|
20
23
|
|
|
21
24
|
|
|
22
|
-
@dataclass
|
|
23
|
-
class AuctionConfig:
|
|
24
|
-
"""Port of `struct AuctionConfig` on the IAuctioneer contract."""
|
|
25
|
-
|
|
26
|
-
restoration_buffer: int
|
|
27
|
-
liquidation_duration: int
|
|
28
|
-
|
|
29
|
-
|
|
30
25
|
@dataclass
|
|
31
26
|
class ClearingConfig:
|
|
32
27
|
"""Port of `struct ClearingConfig` on the IClearing contract."""
|
|
@@ -38,7 +33,7 @@ class ClearingConfig:
|
|
|
38
33
|
class Config:
|
|
39
34
|
"""Port of `struct Config` on the IClearing contract."""
|
|
40
35
|
|
|
41
|
-
auction_config: AuctionConfig
|
|
36
|
+
auction_config: "AuctionConfig"
|
|
42
37
|
clearing_config: ClearingConfig
|
|
43
38
|
|
|
44
39
|
|
|
@@ -12,6 +12,7 @@ from . import (
|
|
|
12
12
|
mark_price_tracker_facet,
|
|
13
13
|
oracle_provider,
|
|
14
14
|
product_registry,
|
|
15
|
+
system_viewer,
|
|
15
16
|
)
|
|
16
17
|
|
|
17
18
|
# In order to include a facet in the ClearingDiamond facade:
|
|
@@ -85,3 +86,15 @@ class ProductRegistry(product_registry.ProductRegistry):
|
|
|
85
86
|
|
|
86
87
|
def __init__(self, w3: Web3):
|
|
87
88
|
super().__init__(w3, config.PRODUCT_REGISTRY_ADDRESS)
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
class SystemViewer(system_viewer.SystemViewer):
|
|
92
|
+
"""SystemViewer contract binding.
|
|
93
|
+
|
|
94
|
+
Parameters
|
|
95
|
+
----------
|
|
96
|
+
w3 : web3.Web3
|
|
97
|
+
"""
|
|
98
|
+
|
|
99
|
+
def __init__(self, w3: Web3):
|
|
100
|
+
super().__init__(w3, config.SYSTEM_VIEWER_ADDRESS)
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
# This module has been generated using pyabigen v0.2.16
|
|
4
4
|
|
|
5
|
-
import enum
|
|
6
5
|
import typing
|
|
7
6
|
from dataclasses import dataclass
|
|
8
7
|
|
|
@@ -11,76 +10,13 @@ import hexbytes
|
|
|
11
10
|
import web3
|
|
12
11
|
from web3.contract import contract
|
|
13
12
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
TRADEOUT = 3
|
|
22
|
-
FINAL_SETTLEMENT = 4
|
|
23
|
-
EXPIRED = 5
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
@dataclass
|
|
27
|
-
class Settlement:
|
|
28
|
-
"""Port of `struct Settlement` on the IMarginAccount contract."""
|
|
29
|
-
|
|
30
|
-
position_id: hexbytes.HexBytes
|
|
31
|
-
quantity: int
|
|
32
|
-
price: int
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
@dataclass
|
|
36
|
-
class PositionData:
|
|
37
|
-
"""Port of `struct PositionData` on the IMarginAccount contract."""
|
|
38
|
-
|
|
39
|
-
position_id: hexbytes.HexBytes
|
|
40
|
-
quantity: int
|
|
41
|
-
cost_basis: int
|
|
42
|
-
maintenance_margin: int
|
|
43
|
-
pnl: int
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
@dataclass
|
|
47
|
-
class ProductMetadata:
|
|
48
|
-
"""Port of `struct ProductMetadata` on the IProductRegistry contract."""
|
|
49
|
-
|
|
50
|
-
builder: eth_typing.ChecksumAddress
|
|
51
|
-
symbol: str
|
|
52
|
-
description: str
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
@dataclass
|
|
56
|
-
class OracleSpecification:
|
|
57
|
-
"""Port of `struct OracleSpecification` on the IProductRegistry contract."""
|
|
58
|
-
|
|
59
|
-
oracle_address: eth_typing.ChecksumAddress
|
|
60
|
-
fsv_decimals: int
|
|
61
|
-
fsp_alpha: int
|
|
62
|
-
fsp_beta: int
|
|
63
|
-
fsv_calldata: hexbytes.HexBytes
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
@dataclass
|
|
67
|
-
class Product:
|
|
68
|
-
"""Port of `struct Product` on the IProductRegistry contract."""
|
|
69
|
-
|
|
70
|
-
metadata: ProductMetadata
|
|
71
|
-
oracle_spec: OracleSpecification
|
|
72
|
-
price_quotation: str
|
|
73
|
-
collateral_asset: eth_typing.ChecksumAddress
|
|
74
|
-
start_time: int
|
|
75
|
-
earliest_fsp_submission_time: int
|
|
76
|
-
unit_value: int
|
|
77
|
-
initial_margin_requirement: int
|
|
78
|
-
maintenance_margin_requirement: int
|
|
79
|
-
offer_price_buffer: int
|
|
80
|
-
auction_bounty: int
|
|
81
|
-
tradeout_interval: int
|
|
82
|
-
tick_size: int
|
|
83
|
-
extended_metadata: str
|
|
13
|
+
from .margin_account import Settlement, PositionData
|
|
14
|
+
from .product_registry import (
|
|
15
|
+
OracleSpecification,
|
|
16
|
+
Product,
|
|
17
|
+
ProductMetadata,
|
|
18
|
+
ProductState,
|
|
19
|
+
)
|
|
84
20
|
|
|
85
21
|
|
|
86
22
|
@dataclass
|
|
@@ -2,61 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
# This module has been generated using pyabigen v0.2.16
|
|
4
4
|
|
|
5
|
-
import enum
|
|
6
5
|
import typing
|
|
7
|
-
from dataclasses import dataclass
|
|
8
6
|
|
|
9
7
|
import eth_typing
|
|
10
8
|
import hexbytes
|
|
11
9
|
import web3
|
|
12
10
|
from web3.contract import contract
|
|
13
11
|
|
|
14
|
-
|
|
15
|
-
class Side(enum.IntEnum):
|
|
16
|
-
"""Port of `enum Side` on the TradingProtocol contract."""
|
|
17
|
-
|
|
18
|
-
BID = 0
|
|
19
|
-
ASK = 1
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
@dataclass
|
|
23
|
-
class IntentData:
|
|
24
|
-
"""Port of `struct IntentData` on the IClearing contract."""
|
|
25
|
-
|
|
26
|
-
nonce: int
|
|
27
|
-
trading_protocol_id: eth_typing.ChecksumAddress
|
|
28
|
-
product_id: hexbytes.HexBytes
|
|
29
|
-
limit_price: int
|
|
30
|
-
quantity: int
|
|
31
|
-
max_trading_fee_rate: int
|
|
32
|
-
good_until: int
|
|
33
|
-
side: Side
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
@dataclass
|
|
37
|
-
class Intent:
|
|
38
|
-
"""Port of `struct Intent` on the IClearing contract."""
|
|
39
|
-
|
|
40
|
-
margin_account_id: eth_typing.ChecksumAddress
|
|
41
|
-
intent_account_id: eth_typing.ChecksumAddress
|
|
42
|
-
hash: hexbytes.HexBytes
|
|
43
|
-
data: IntentData
|
|
44
|
-
signature: hexbytes.HexBytes
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
@dataclass
|
|
48
|
-
class Trade:
|
|
49
|
-
"""Port of `struct Trade` on the IClearing contract."""
|
|
50
|
-
|
|
51
|
-
product_id: hexbytes.HexBytes
|
|
52
|
-
protocol_id: eth_typing.ChecksumAddress
|
|
53
|
-
trade_id: int
|
|
54
|
-
price: int
|
|
55
|
-
timestamp: int
|
|
56
|
-
accounts: typing.List[eth_typing.ChecksumAddress]
|
|
57
|
-
quantities: typing.List[int]
|
|
58
|
-
fee_rates: typing.List[int]
|
|
59
|
-
intents: typing.List[Intent]
|
|
12
|
+
from .clearing_facet import Trade
|
|
60
13
|
|
|
61
14
|
|
|
62
15
|
class TradingProtocol:
|
|
@@ -36,3 +36,6 @@ PRODUCT_REGISTRY_ADDRESS = Web3.to_checksum_address(
|
|
|
36
36
|
"AFP_PRODUCT_REGISTRY_ADDRESS", "0x9b92EAC112c996a513e515Cf8c3BDd83619F730D"
|
|
37
37
|
)
|
|
38
38
|
)
|
|
39
|
+
SYSTEM_VIEWER_ADDRESS = Web3.to_checksum_address(
|
|
40
|
+
os.getenv("AFP_SYSTEM_VIEWER_ADDRESS", "0xcB3F71Db710544283a1FfB38FE1bEC554d0634A5")
|
|
41
|
+
)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|