afp-sdk 0.2.0__py3-none-any.whl → 0.2.2__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/bindings/__init__.py CHANGED
@@ -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
 
afp/bindings/facade.py CHANGED
@@ -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)