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.
Files changed (78) hide show
  1. nado_protocol/__init__.py +0 -0
  2. nado_protocol/client/__init__.py +200 -0
  3. nado_protocol/client/apis/__init__.py +26 -0
  4. nado_protocol/client/apis/base.py +42 -0
  5. nado_protocol/client/apis/market/__init__.py +23 -0
  6. nado_protocol/client/apis/market/execute.py +192 -0
  7. nado_protocol/client/apis/market/query.py +310 -0
  8. nado_protocol/client/apis/perp/__init__.py +18 -0
  9. nado_protocol/client/apis/perp/query.py +30 -0
  10. nado_protocol/client/apis/rewards/__init__.py +6 -0
  11. nado_protocol/client/apis/rewards/execute.py +131 -0
  12. nado_protocol/client/apis/rewards/query.py +12 -0
  13. nado_protocol/client/apis/spot/__init__.py +23 -0
  14. nado_protocol/client/apis/spot/base.py +32 -0
  15. nado_protocol/client/apis/spot/execute.py +117 -0
  16. nado_protocol/client/apis/spot/query.py +79 -0
  17. nado_protocol/client/apis/subaccount/__init__.py +24 -0
  18. nado_protocol/client/apis/subaccount/execute.py +54 -0
  19. nado_protocol/client/apis/subaccount/query.py +145 -0
  20. nado_protocol/client/context.py +90 -0
  21. nado_protocol/contracts/__init__.py +377 -0
  22. nado_protocol/contracts/abis/Endpoint.json +636 -0
  23. nado_protocol/contracts/abis/FQuerier.json +1909 -0
  24. nado_protocol/contracts/abis/IClearinghouse.json +876 -0
  25. nado_protocol/contracts/abis/IERC20.json +185 -0
  26. nado_protocol/contracts/abis/IEndpoint.json +250 -0
  27. nado_protocol/contracts/abis/IFoundationRewardsAirdrop.json +76 -0
  28. nado_protocol/contracts/abis/IOffchainBook.json +536 -0
  29. nado_protocol/contracts/abis/IPerpEngine.json +931 -0
  30. nado_protocol/contracts/abis/IProductEngine.json +352 -0
  31. nado_protocol/contracts/abis/ISpotEngine.json +813 -0
  32. nado_protocol/contracts/abis/IStaking.json +288 -0
  33. nado_protocol/contracts/abis/IVrtxAirdrop.json +138 -0
  34. nado_protocol/contracts/abis/MockERC20.json +311 -0
  35. nado_protocol/contracts/deployments/deployment.test.json +18 -0
  36. nado_protocol/contracts/eip712/__init__.py +16 -0
  37. nado_protocol/contracts/eip712/domain.py +36 -0
  38. nado_protocol/contracts/eip712/sign.py +79 -0
  39. nado_protocol/contracts/eip712/types.py +154 -0
  40. nado_protocol/contracts/loader.py +55 -0
  41. nado_protocol/contracts/types.py +141 -0
  42. nado_protocol/engine_client/__init__.py +35 -0
  43. nado_protocol/engine_client/execute.py +416 -0
  44. nado_protocol/engine_client/query.py +481 -0
  45. nado_protocol/engine_client/types/__init__.py +113 -0
  46. nado_protocol/engine_client/types/execute.py +680 -0
  47. nado_protocol/engine_client/types/models.py +247 -0
  48. nado_protocol/engine_client/types/query.py +516 -0
  49. nado_protocol/engine_client/types/stream.py +6 -0
  50. nado_protocol/indexer_client/__init__.py +28 -0
  51. nado_protocol/indexer_client/query.py +466 -0
  52. nado_protocol/indexer_client/types/__init__.py +122 -0
  53. nado_protocol/indexer_client/types/models.py +364 -0
  54. nado_protocol/indexer_client/types/query.py +819 -0
  55. nado_protocol/trigger_client/__init__.py +17 -0
  56. nado_protocol/trigger_client/execute.py +118 -0
  57. nado_protocol/trigger_client/query.py +61 -0
  58. nado_protocol/trigger_client/types/__init__.py +7 -0
  59. nado_protocol/trigger_client/types/execute.py +89 -0
  60. nado_protocol/trigger_client/types/models.py +44 -0
  61. nado_protocol/trigger_client/types/query.py +77 -0
  62. nado_protocol/utils/__init__.py +37 -0
  63. nado_protocol/utils/backend.py +111 -0
  64. nado_protocol/utils/bytes32.py +159 -0
  65. nado_protocol/utils/enum.py +6 -0
  66. nado_protocol/utils/exceptions.py +58 -0
  67. nado_protocol/utils/execute.py +403 -0
  68. nado_protocol/utils/expiration.py +45 -0
  69. nado_protocol/utils/interest.py +66 -0
  70. nado_protocol/utils/math.py +67 -0
  71. nado_protocol/utils/model.py +79 -0
  72. nado_protocol/utils/nonce.py +33 -0
  73. nado_protocol/utils/subaccount.py +18 -0
  74. nado_protocol/utils/time.py +21 -0
  75. nado_protocol-0.1.0.dist-info/METADATA +157 -0
  76. nado_protocol-0.1.0.dist-info/RECORD +78 -0
  77. nado_protocol-0.1.0.dist-info/WHEEL +4 -0
  78. nado_protocol-0.1.0.dist-info/entry_points.txt +11 -0
@@ -0,0 +1,364 @@
1
+ from enum import IntEnum
2
+ from nado_protocol.utils.enum import StrEnum
3
+
4
+ from typing import Any, Optional, Union
5
+ from nado_protocol.engine_client.types.models import (
6
+ PerpProduct,
7
+ PerpProductBalance,
8
+ SpotProduct,
9
+ SpotProductBalance,
10
+ )
11
+
12
+ from nado_protocol.utils.model import NadoBaseModel
13
+
14
+
15
+ class IndexerEventType(StrEnum):
16
+ LIQUIDATE_SUBACCOUNT = "liquidate_subaccount"
17
+ DEPOSIT_COLLATERAL = "deposit_collateral"
18
+ WITHDRAW_COLLATERAL = "withdraw_collateral"
19
+ SETTLE_PNL = "settle_pnl"
20
+ MATCH_ORDERS = "match_orders"
21
+ MATCH_ORDER_A_M_M = "match_order_a_m_m"
22
+ SWAP_AMM = "swap_a_m_m"
23
+ MINT_LP = "mint_lp"
24
+ BURN_LP = "burn_lp"
25
+ MANUAL_ASSERT = "manual_assert"
26
+ LINK_SIGNER = "link_signer"
27
+ TRANSFER_QUOTE = "transfer_quote"
28
+ CREATE_ISOLATED_SUBACCOUNT = "create_isolated_subaccount"
29
+
30
+
31
+ class IndexerCandlesticksGranularity(IntEnum):
32
+ ONE_MINUTE = 60
33
+ FIVE_MINUTES = 300
34
+ FIFTEEN_MINUTES = 900
35
+ ONE_HOUR = 3600
36
+ TWO_HOURS = 7200
37
+ FOUR_HOURS = 14400
38
+ ONE_DAY = 86400
39
+ ONE_WEEK = 604800
40
+ FOUR_WEEKS = 2419200
41
+
42
+
43
+ class IndexerBaseModel(NadoBaseModel):
44
+ submission_idx: str
45
+ timestamp: Optional[str]
46
+
47
+
48
+ class IndexerBaseOrder(NadoBaseModel):
49
+ sender: str
50
+ priceX18: str
51
+ amount: str
52
+ expiration: Union[str, int]
53
+ nonce: Union[str, int]
54
+
55
+
56
+ class IndexerOrderFill(IndexerBaseModel):
57
+ digest: str
58
+ base_filled: str
59
+ quote_filled: str
60
+ fee: str
61
+
62
+
63
+ class IndexerHistoricalOrder(IndexerOrderFill):
64
+ subaccount: str
65
+ product_id: int
66
+ amount: str
67
+ price_x18: str
68
+ expiration: str
69
+ nonce: str
70
+ isolated: bool
71
+
72
+
73
+ class IndexerSignedOrder(NadoBaseModel):
74
+ order: IndexerBaseOrder
75
+ signature: str
76
+
77
+
78
+ class IndexerMatch(IndexerOrderFill):
79
+ order: IndexerBaseOrder
80
+ cumulative_fee: str
81
+ cumulative_base_filled: str
82
+ cumulative_quote_filled: str
83
+ isolated: bool
84
+
85
+
86
+ class IndexerMatchOrdersTxData(NadoBaseModel):
87
+ product_id: int
88
+ amm: bool
89
+ taker: IndexerSignedOrder
90
+ maker: IndexerSignedOrder
91
+
92
+
93
+ class IndexerMatchOrdersTx(NadoBaseModel):
94
+ match_orders: IndexerMatchOrdersTxData
95
+
96
+
97
+ class IndexerWithdrawCollateralTxData(NadoBaseModel):
98
+ sender: str
99
+ product_id: int
100
+ amount: str
101
+ nonce: int
102
+
103
+
104
+ class IndexerWithdrawCollateralTx(NadoBaseModel):
105
+ withdraw_collateral: IndexerWithdrawCollateralTxData
106
+
107
+
108
+ class IndexerLiquidateSubaccountTxData(NadoBaseModel):
109
+ sender: str
110
+ liquidatee: str
111
+ mode: int
112
+ health_group: int
113
+ amount: str
114
+ nonce: int
115
+
116
+
117
+ class IndexerLiquidateSubaccountTx(NadoBaseModel):
118
+ liquidate_subaccount: IndexerLiquidateSubaccountTxData
119
+
120
+
121
+ class IndexerMintLpTxData(NadoBaseModel):
122
+ sender: str
123
+ product_id: int
124
+ amount_base: str
125
+ quote_amount_low: str
126
+ quote_amount_high: str
127
+ nonce: int
128
+
129
+
130
+ class IndexerMintLpTx(NadoBaseModel):
131
+ mint_lp: IndexerMintLpTxData
132
+
133
+
134
+ class IndexerBurnLpTxData(NadoBaseModel):
135
+ sender: str
136
+ product_id: int
137
+ amount: str
138
+ nonce: int
139
+
140
+
141
+ class IndexerBurnLpTx(NadoBaseModel):
142
+ burn_lp: IndexerBurnLpTxData
143
+
144
+
145
+ IndexerTxData = Union[
146
+ IndexerMatchOrdersTx,
147
+ IndexerWithdrawCollateralTx,
148
+ IndexerLiquidateSubaccountTx,
149
+ IndexerMintLpTx,
150
+ IndexerBurnLpTx,
151
+ ]
152
+
153
+
154
+ class IndexerTx(IndexerBaseModel):
155
+ tx: Union[IndexerTxData, Any]
156
+
157
+
158
+ class IndexerSpotProductBalanceData(NadoBaseModel):
159
+ spot: SpotProductBalance
160
+
161
+
162
+ class IndexerPerpProductBalanceData(NadoBaseModel):
163
+ perp: PerpProductBalance
164
+
165
+
166
+ IndexerProductBalanceData = Union[
167
+ IndexerSpotProductBalanceData, IndexerPerpProductBalanceData
168
+ ]
169
+
170
+
171
+ class IndexerSpotProductData(NadoBaseModel):
172
+ spot: SpotProduct
173
+
174
+
175
+ class IndexerPerpProductData(NadoBaseModel):
176
+ perp: PerpProduct
177
+
178
+
179
+ IndexerProductData = Union[IndexerSpotProductData, IndexerPerpProductData]
180
+
181
+
182
+ class IndexerEventTrackedData(NadoBaseModel):
183
+ net_interest_unrealized: str
184
+ net_interest_cumulative: str
185
+ net_funding_unrealized: str
186
+ net_funding_cumulative: str
187
+ net_entry_unrealized: str
188
+ net_entry_cumulative: str
189
+ net_entry_lp_unrealized: str
190
+ net_entry_lp_cumulative: str
191
+
192
+
193
+ class IndexerEvent(IndexerBaseModel, IndexerEventTrackedData):
194
+ subaccount: str
195
+ product_id: int
196
+ event_type: IndexerEventType
197
+ product: IndexerProductData
198
+ pre_balance: IndexerProductBalanceData
199
+ post_balance: IndexerProductBalanceData
200
+ isolated: bool
201
+ isolated_product_id: Optional[int]
202
+
203
+
204
+ class IndexerProduct(IndexerBaseModel):
205
+ product_id: int
206
+ product: IndexerProductData
207
+
208
+
209
+ class IndexerMarketSnapshot(NadoBaseModel):
210
+ timestamp: int
211
+ cumulative_users: int
212
+ daily_active_users: int
213
+ tvl: str
214
+
215
+ # product_id -> cumulative_metric
216
+ cumulative_trades: dict
217
+ cumulative_volumes: dict
218
+ cumulative_trade_sizes: dict
219
+ cumulative_sequencer_fees: dict
220
+ cumulative_maker_fees: dict
221
+ cumulative_liquidation_amounts: dict
222
+ open_interests: dict
223
+ total_deposits: dict
224
+ total_borrows: dict
225
+ funding_rates: dict
226
+ deposit_rates: dict
227
+ borrow_rates: dict
228
+ cumulative_inflows: dict
229
+ cumulative_outflows: dict
230
+
231
+
232
+ class IndexerCandlestick(IndexerBaseModel):
233
+ product_id: int
234
+ granularity: int
235
+ open_x18: str
236
+ high_x18: str
237
+ low_x18: str
238
+ close_x18: str
239
+ volume: str
240
+
241
+
242
+ class IndexerOraclePrice(NadoBaseModel):
243
+ product_id: int
244
+ oracle_price_x18: str
245
+ update_time: str
246
+
247
+
248
+ class IndexerAddressReward(NadoBaseModel):
249
+ product_id: int
250
+ q_score: str
251
+ sum_q_min: str
252
+ uptime: int
253
+ maker_volume: str
254
+ taker_volume: str
255
+ maker_fee: str
256
+ taker_fee: str
257
+ maker_tokens: str
258
+ taker_tokens: str
259
+ taker_referral_tokens: str
260
+ rebates: str
261
+
262
+
263
+ class IndexerGlobalRewards(NadoBaseModel):
264
+ product_id: int
265
+ reward_coefficient: str
266
+ q_scores: str
267
+ maker_volumes: str
268
+ taker_volumes: str
269
+ maker_fees: str
270
+ taker_fees: str
271
+ maker_tokens: str
272
+ taker_tokens: str
273
+
274
+
275
+ class IndexerTokenReward(NadoBaseModel):
276
+ epoch: int
277
+ start_time: str
278
+ period: str
279
+ address_rewards: list[IndexerAddressReward]
280
+ global_rewards: list[IndexerGlobalRewards]
281
+
282
+
283
+ class IndexerMarketMakerData(NadoBaseModel):
284
+ timestamp: str
285
+ maker_fee: str
286
+ uptime: str
287
+ sum_q_min: str
288
+ q_score: str
289
+ maker_share: str
290
+ expected_maker_reward: str
291
+
292
+
293
+ class IndexerMarketMaker(NadoBaseModel):
294
+ address: str
295
+ data: list[IndexerMarketMakerData]
296
+
297
+
298
+ class IndexerLiquidatableAccount(NadoBaseModel):
299
+ subaccount: str
300
+ update_time: int
301
+
302
+
303
+ class IndexerSubaccount(NadoBaseModel):
304
+ id: str
305
+ subaccount: str
306
+
307
+
308
+ class IndexerMerkleProof(NadoBaseModel):
309
+ total_amount: str
310
+ proof: list[str]
311
+
312
+
313
+ class IndexerPayment(NadoBaseModel):
314
+ product_id: int
315
+ idx: str
316
+ timestamp: str
317
+ amount: str
318
+ balance_amount: str
319
+ rate_x18: str
320
+ oracle_price_x18: str
321
+
322
+
323
+ class IndexerTickerInfo(NadoBaseModel):
324
+ ticker_id: str
325
+ base_currency: str
326
+ quote_currency: str
327
+ last_price: float
328
+ base_volume: float
329
+ quote_volume: float
330
+ price_change_percent_24h: float
331
+
332
+
333
+ class IndexerPerpContractInfo(IndexerTickerInfo):
334
+ product_type: str
335
+ contract_price: float
336
+ contract_price_currency: str
337
+ open_interest: float
338
+ open_interest_usd: float
339
+ index_price: float
340
+ mark_price: float
341
+ funding_rate: float
342
+ next_funding_rate_timestamp: int
343
+
344
+
345
+ class IndexerTradeInfo(NadoBaseModel):
346
+ ticker_id: str
347
+ # submission_idx
348
+ trade_id: int
349
+ price: float
350
+ base_filled: float
351
+ quote_filled: float
352
+ timestamp: int
353
+ # side
354
+ trade_type: str
355
+
356
+
357
+ class MarketType(StrEnum):
358
+ SPOT = "spot"
359
+ PERP = "perp"
360
+
361
+
362
+ class VrtxTokenQueryType(StrEnum):
363
+ TOTAL_SUPPLY = "total_supply"
364
+ CIRCULATING_SUPPLY = "circulating_supply"