nado-protocol 0.1.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.
- nado_protocol/__init__.py +0 -0
- nado_protocol/client/__init__.py +200 -0
- nado_protocol/client/apis/__init__.py +26 -0
- nado_protocol/client/apis/base.py +42 -0
- nado_protocol/client/apis/market/__init__.py +23 -0
- nado_protocol/client/apis/market/execute.py +192 -0
- nado_protocol/client/apis/market/query.py +310 -0
- nado_protocol/client/apis/perp/__init__.py +18 -0
- nado_protocol/client/apis/perp/query.py +30 -0
- nado_protocol/client/apis/rewards/__init__.py +6 -0
- nado_protocol/client/apis/rewards/execute.py +131 -0
- nado_protocol/client/apis/rewards/query.py +12 -0
- nado_protocol/client/apis/spot/__init__.py +23 -0
- nado_protocol/client/apis/spot/base.py +32 -0
- nado_protocol/client/apis/spot/execute.py +117 -0
- nado_protocol/client/apis/spot/query.py +79 -0
- nado_protocol/client/apis/subaccount/__init__.py +24 -0
- nado_protocol/client/apis/subaccount/execute.py +54 -0
- nado_protocol/client/apis/subaccount/query.py +145 -0
- nado_protocol/client/context.py +90 -0
- nado_protocol/contracts/__init__.py +377 -0
- nado_protocol/contracts/abis/Endpoint.json +636 -0
- nado_protocol/contracts/abis/FQuerier.json +1909 -0
- nado_protocol/contracts/abis/IClearinghouse.json +876 -0
- nado_protocol/contracts/abis/IERC20.json +185 -0
- nado_protocol/contracts/abis/IEndpoint.json +250 -0
- nado_protocol/contracts/abis/IFoundationRewardsAirdrop.json +76 -0
- nado_protocol/contracts/abis/IOffchainBook.json +536 -0
- nado_protocol/contracts/abis/IPerpEngine.json +931 -0
- nado_protocol/contracts/abis/IProductEngine.json +352 -0
- nado_protocol/contracts/abis/ISpotEngine.json +813 -0
- nado_protocol/contracts/abis/IStaking.json +288 -0
- nado_protocol/contracts/abis/IVrtxAirdrop.json +138 -0
- nado_protocol/contracts/abis/MockERC20.json +311 -0
- nado_protocol/contracts/deployments/deployment.test.json +18 -0
- nado_protocol/contracts/eip712/__init__.py +16 -0
- nado_protocol/contracts/eip712/domain.py +36 -0
- nado_protocol/contracts/eip712/sign.py +79 -0
- nado_protocol/contracts/eip712/types.py +154 -0
- nado_protocol/contracts/loader.py +55 -0
- nado_protocol/contracts/types.py +141 -0
- nado_protocol/engine_client/__init__.py +35 -0
- nado_protocol/engine_client/execute.py +416 -0
- nado_protocol/engine_client/query.py +481 -0
- nado_protocol/engine_client/types/__init__.py +113 -0
- nado_protocol/engine_client/types/execute.py +680 -0
- nado_protocol/engine_client/types/models.py +247 -0
- nado_protocol/engine_client/types/query.py +516 -0
- nado_protocol/engine_client/types/stream.py +6 -0
- nado_protocol/indexer_client/__init__.py +28 -0
- nado_protocol/indexer_client/query.py +466 -0
- nado_protocol/indexer_client/types/__init__.py +122 -0
- nado_protocol/indexer_client/types/models.py +364 -0
- nado_protocol/indexer_client/types/query.py +819 -0
- nado_protocol/trigger_client/__init__.py +17 -0
- nado_protocol/trigger_client/execute.py +118 -0
- nado_protocol/trigger_client/query.py +61 -0
- nado_protocol/trigger_client/types/__init__.py +7 -0
- nado_protocol/trigger_client/types/execute.py +89 -0
- nado_protocol/trigger_client/types/models.py +44 -0
- nado_protocol/trigger_client/types/query.py +77 -0
- nado_protocol/utils/__init__.py +37 -0
- nado_protocol/utils/backend.py +111 -0
- nado_protocol/utils/bytes32.py +159 -0
- nado_protocol/utils/enum.py +6 -0
- nado_protocol/utils/exceptions.py +58 -0
- nado_protocol/utils/execute.py +403 -0
- nado_protocol/utils/expiration.py +45 -0
- nado_protocol/utils/interest.py +66 -0
- nado_protocol/utils/math.py +67 -0
- nado_protocol/utils/model.py +79 -0
- nado_protocol/utils/nonce.py +33 -0
- nado_protocol/utils/subaccount.py +18 -0
- nado_protocol/utils/time.py +21 -0
- nado_protocol-0.1.0.dist-info/METADATA +157 -0
- nado_protocol-0.1.0.dist-info/RECORD +78 -0
- nado_protocol-0.1.0.dist-info/WHEEL +4 -0
- nado_protocol-0.1.0.dist-info/entry_points.txt +11 -0
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
from typing import Optional, Union
|
|
2
|
+
from typing import Annotated
|
|
3
|
+
from nado_protocol.utils.enum import StrEnum
|
|
4
|
+
from nado_protocol.utils.model import NadoBaseModel
|
|
5
|
+
from pydantic import conlist
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class ResponseStatus(StrEnum):
|
|
9
|
+
SUCCESS = "success"
|
|
10
|
+
FAILURE = "failure"
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class EngineStatus(StrEnum):
|
|
14
|
+
ACTIVE = "active"
|
|
15
|
+
FAILED = "failed"
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class MintLp(NadoBaseModel):
|
|
19
|
+
product_id: int
|
|
20
|
+
subaccount: str
|
|
21
|
+
amount_base: str
|
|
22
|
+
quote_amount_low: str
|
|
23
|
+
quote_amount_high: str
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class BurnLp(NadoBaseModel):
|
|
27
|
+
product_id: int
|
|
28
|
+
subaccount: str
|
|
29
|
+
amount_lp: str
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class ApplyDelta(NadoBaseModel):
|
|
33
|
+
product_id: int
|
|
34
|
+
subaccount: str
|
|
35
|
+
amount_delta: str
|
|
36
|
+
v_quote_delta: str
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
class MintLpTx(NadoBaseModel):
|
|
40
|
+
mint_lp: MintLp
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
class BurnLpTx(NadoBaseModel):
|
|
44
|
+
burn_lp: BurnLp
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
class ApplyDeltaTx(NadoBaseModel):
|
|
48
|
+
apply_delta: ApplyDelta
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
class SubaccountHealth(NadoBaseModel):
|
|
52
|
+
assets: str
|
|
53
|
+
liabilities: str
|
|
54
|
+
health: str
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
class SpotLpBalance(NadoBaseModel):
|
|
58
|
+
amount: str
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
class SpotBalance(NadoBaseModel):
|
|
62
|
+
amount: str
|
|
63
|
+
last_cumulative_multiplier_x18: str
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
class SpotProductBalance(NadoBaseModel):
|
|
67
|
+
product_id: int
|
|
68
|
+
lp_balance: SpotLpBalance
|
|
69
|
+
balance: SpotBalance
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
class PerpLpBalance(NadoBaseModel):
|
|
73
|
+
amount: str
|
|
74
|
+
last_cumulative_funding_x18: str
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
class PerpBalance(NadoBaseModel):
|
|
78
|
+
amount: str
|
|
79
|
+
v_quote_balance: str
|
|
80
|
+
last_cumulative_funding_x18: str
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
class PerpProductBalance(NadoBaseModel):
|
|
84
|
+
product_id: int
|
|
85
|
+
lp_balance: PerpLpBalance
|
|
86
|
+
balance: PerpBalance
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
class ProductRisk(NadoBaseModel):
|
|
90
|
+
long_weight_initial_x18: str
|
|
91
|
+
short_weight_initial_x18: str
|
|
92
|
+
long_weight_maintenance_x18: str
|
|
93
|
+
short_weight_maintenance_x18: str
|
|
94
|
+
large_position_penalty_x18: str
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
class ProductBookInfo(NadoBaseModel):
|
|
98
|
+
size_increment: str
|
|
99
|
+
price_increment_x18: str
|
|
100
|
+
min_size: str
|
|
101
|
+
collected_fees: str
|
|
102
|
+
lp_spread_x18: str
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
class BaseProduct(NadoBaseModel):
|
|
106
|
+
product_id: int
|
|
107
|
+
oracle_price_x18: str
|
|
108
|
+
risk: ProductRisk
|
|
109
|
+
book_info: ProductBookInfo
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
class BaseProductLpState(NadoBaseModel):
|
|
113
|
+
supply: str
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
class SpotProductConfig(NadoBaseModel):
|
|
117
|
+
token: str
|
|
118
|
+
interest_inflection_util_x18: str
|
|
119
|
+
interest_floor_x18: str
|
|
120
|
+
interest_small_cap_x18: str
|
|
121
|
+
interest_large_cap_x18: str
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
class SpotProductState(NadoBaseModel):
|
|
125
|
+
cumulative_deposits_multiplier_x18: str
|
|
126
|
+
cumulative_borrows_multiplier_x18: str
|
|
127
|
+
total_deposits_normalized: str
|
|
128
|
+
total_borrows_normalized: str
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
class SpotProductLpAmount(NadoBaseModel):
|
|
132
|
+
amount: str
|
|
133
|
+
last_cumulative_multiplier_x18: str
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
class SpotProductLpState(BaseProductLpState):
|
|
137
|
+
quote: SpotProductLpAmount
|
|
138
|
+
base: SpotProductLpAmount
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
class SpotProduct(BaseProduct):
|
|
142
|
+
config: SpotProductConfig
|
|
143
|
+
state: SpotProductState
|
|
144
|
+
lp_state: SpotProductLpState
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
class PerpProductState(NadoBaseModel):
|
|
148
|
+
cumulative_funding_long_x18: str
|
|
149
|
+
cumulative_funding_short_x18: str
|
|
150
|
+
available_settle: str
|
|
151
|
+
open_interest: str
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
class PerpProductLpState(BaseProductLpState):
|
|
155
|
+
last_cumulative_funding_x18: str
|
|
156
|
+
cumulative_funding_per_lp_x18: str
|
|
157
|
+
base: str
|
|
158
|
+
quote: str
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
class PerpProduct(BaseProduct):
|
|
162
|
+
state: PerpProductState
|
|
163
|
+
lp_state: PerpProductLpState
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
class MaxOrderSizeDirection(StrEnum):
|
|
167
|
+
LONG = "long"
|
|
168
|
+
SHORT = "short"
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
class ProductSymbol(NadoBaseModel):
|
|
172
|
+
product_id: int
|
|
173
|
+
symbol: str
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
class SymbolData(NadoBaseModel):
|
|
177
|
+
type: str
|
|
178
|
+
product_id: str
|
|
179
|
+
symbol: str
|
|
180
|
+
price_increment_x18: str
|
|
181
|
+
size_increment: str
|
|
182
|
+
min_size: str
|
|
183
|
+
min_depth_x18: str
|
|
184
|
+
max_spread_rate_x18: str
|
|
185
|
+
maker_fee_rate_x18: str
|
|
186
|
+
taker_fee_rate_x18: str
|
|
187
|
+
long_weight_initial_x18: str
|
|
188
|
+
long_weight_maintenance_x18: str
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
class SubaccountPosition(NadoBaseModel):
|
|
192
|
+
balance: Union[PerpProductBalance, SpotProductBalance]
|
|
193
|
+
product: Union[PerpProduct, SpotProduct]
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
# (price, amount)
|
|
197
|
+
MarketLiquidity = Annotated[list, conlist(str, min_items=2, max_items=2)]
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
class Asset(NadoBaseModel):
|
|
201
|
+
product_id: int
|
|
202
|
+
ticker_id: Optional[str]
|
|
203
|
+
market_type: Optional[str]
|
|
204
|
+
name: str
|
|
205
|
+
symbol: str
|
|
206
|
+
maker_fee: Optional[float]
|
|
207
|
+
taker_fee: Optional[float]
|
|
208
|
+
can_withdraw: bool
|
|
209
|
+
can_deposit: bool
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
class MarketPair(NadoBaseModel):
|
|
213
|
+
ticker_id: str
|
|
214
|
+
base: str
|
|
215
|
+
quote: str
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
class SpotApr(NadoBaseModel):
|
|
219
|
+
name: str
|
|
220
|
+
symbol: str
|
|
221
|
+
product_id: int
|
|
222
|
+
deposit_apr: float
|
|
223
|
+
borrow_apr: float
|
|
224
|
+
tvl: float
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
class Orderbook(NadoBaseModel):
|
|
228
|
+
ticker_id: str
|
|
229
|
+
timestamp: int
|
|
230
|
+
bids: list[MarketLiquidity]
|
|
231
|
+
asks: list[MarketLiquidity]
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
class MarketType(StrEnum):
|
|
235
|
+
SPOT = "spot"
|
|
236
|
+
PERP = "perp"
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
class IsolatedPosition(NadoBaseModel):
|
|
240
|
+
subaccount: str
|
|
241
|
+
quote_balance: SpotProductBalance
|
|
242
|
+
base_balance: PerpProductBalance
|
|
243
|
+
quote_product: SpotProduct
|
|
244
|
+
base_product: PerpProduct
|
|
245
|
+
healths: list[SubaccountHealth]
|
|
246
|
+
quote_healths: list
|
|
247
|
+
base_healths: list
|