nado-protocol 0.1.1__py3-none-any.whl → 0.1.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.
Files changed (48) hide show
  1. nado_protocol/client/__init__.py +11 -2
  2. nado_protocol/client/apis/market/execute.py +10 -26
  3. nado_protocol/client/apis/market/query.py +2 -2
  4. nado_protocol/client/apis/rewards/execute.py +27 -27
  5. nado_protocol/client/apis/rewards/query.py +5 -4
  6. nado_protocol/client/apis/subaccount/query.py +1 -1
  7. nado_protocol/client/context.py +0 -2
  8. nado_protocol/contracts/__init__.py +41 -33
  9. nado_protocol/contracts/abis/Endpoint.json +151 -228
  10. nado_protocol/contracts/abis/FQuerier.json +91 -508
  11. nado_protocol/contracts/abis/IAirdrop.json +76 -0
  12. nado_protocol/contracts/abis/IClearinghouse.json +277 -390
  13. nado_protocol/contracts/abis/IEndpoint.json +42 -80
  14. nado_protocol/contracts/abis/IPerpEngine.json +69 -422
  15. nado_protocol/contracts/abis/IProductEngine.json +87 -205
  16. nado_protocol/contracts/abis/ISpotEngine.json +173 -362
  17. nado_protocol/contracts/abis/MockERC20.json +1 -1
  18. nado_protocol/contracts/deployments/{deployment.test.json → deployment.testing.json} +2 -5
  19. nado_protocol/contracts/deployments/deployment.testnet.json +15 -0
  20. nado_protocol/contracts/eip712/types.py +15 -20
  21. nado_protocol/contracts/types.py +15 -13
  22. nado_protocol/engine_client/execute.py +18 -39
  23. nado_protocol/engine_client/query.py +1 -1
  24. nado_protocol/engine_client/types/__init__.py +4 -8
  25. nado_protocol/engine_client/types/execute.py +37 -103
  26. nado_protocol/engine_client/types/models.py +3 -59
  27. nado_protocol/engine_client/types/query.py +3 -6
  28. nado_protocol/indexer_client/query.py +4 -9
  29. nado_protocol/indexer_client/types/__init__.py +4 -5
  30. nado_protocol/indexer_client/types/models.py +16 -23
  31. nado_protocol/indexer_client/types/query.py +12 -11
  32. nado_protocol/trigger_client/execute.py +1 -1
  33. nado_protocol/trigger_client/types/execute.py +3 -1
  34. nado_protocol/utils/__init__.py +18 -1
  35. nado_protocol/utils/backend.py +5 -2
  36. nado_protocol/utils/exceptions.py +3 -3
  37. nado_protocol/utils/execute.py +26 -67
  38. nado_protocol/utils/expiration.py +7 -28
  39. nado_protocol/utils/nonce.py +0 -4
  40. nado_protocol/utils/order.py +356 -0
  41. {nado_protocol-0.1.1.dist-info → nado_protocol-0.1.2.dist-info}/METADATA +4 -2
  42. nado_protocol-0.1.2.dist-info/RECORD +78 -0
  43. {nado_protocol-0.1.1.dist-info → nado_protocol-0.1.2.dist-info}/entry_points.txt +0 -1
  44. nado_protocol/contracts/abis/IERC20.json +0 -185
  45. nado_protocol/contracts/abis/IOffchainBook.json +0 -536
  46. nado_protocol/contracts/abis/IVrtxAirdrop.json +0 -138
  47. nado_protocol-0.1.1.dist-info/RECORD +0 -78
  48. {nado_protocol-0.1.1.dist-info → nado_protocol-0.1.2.dist-info}/WHEEL +0 -0
@@ -13,102 +13,35 @@
13
13
  "type": "event"
14
14
  },
15
15
  {
16
+ "anonymous": false,
16
17
  "inputs": [
17
18
  {
18
- "components": [
19
- {
20
- "internalType": "uint32",
21
- "name": "productId",
22
- "type": "uint32"
23
- },
24
- {
25
- "internalType": "bytes32",
26
- "name": "subaccount",
27
- "type": "bytes32"
28
- },
29
- {
30
- "internalType": "int128",
31
- "name": "amountDelta",
32
- "type": "int128"
33
- },
34
- {
35
- "internalType": "int128",
36
- "name": "vQuoteDelta",
37
- "type": "int128"
38
- }
39
- ],
40
- "internalType": "struct IProductEngine.ProductDelta[]",
41
- "name": "deltas",
42
- "type": "tuple[]"
43
- }
44
- ],
45
- "name": "applyDeltas",
46
- "outputs": [],
47
- "stateMutability": "nonpayable",
48
- "type": "function"
49
- },
50
- {
51
- "inputs": [
52
- {
19
+ "indexed": false,
53
20
  "internalType": "uint32",
54
21
  "name": "productId",
55
22
  "type": "uint32"
56
23
  },
57
24
  {
58
- "internalType": "bytes32",
59
- "name": "subaccount",
60
- "type": "bytes32"
61
- },
62
- {
63
- "internalType": "int128",
64
- "name": "amountLp",
65
- "type": "int128"
66
- }
67
- ],
68
- "name": "burnLp",
69
- "outputs": [
70
- {
71
- "internalType": "int128",
72
- "name": "",
73
- "type": "int128"
25
+ "indexed": false,
26
+ "internalType": "uint128",
27
+ "name": "dt",
28
+ "type": "uint128"
74
29
  },
75
30
  {
31
+ "indexed": false,
76
32
  "internalType": "int128",
77
- "name": "",
33
+ "name": "openInterest",
78
34
  "type": "int128"
79
- }
80
- ],
81
- "stateMutability": "nonpayable",
82
- "type": "function"
83
- },
84
- {
85
- "inputs": [
86
- {
87
- "internalType": "bytes32",
88
- "name": "liquidatee",
89
- "type": "bytes32"
90
35
  },
91
36
  {
92
- "internalType": "bytes32",
93
- "name": "liquidator",
94
- "type": "bytes32"
95
- },
96
- {
97
- "internalType": "address",
98
- "name": "feeCalculator",
99
- "type": "address"
100
- }
101
- ],
102
- "name": "decomposeLps",
103
- "outputs": [
104
- {
37
+ "indexed": false,
105
38
  "internalType": "int128",
106
- "name": "",
39
+ "name": "payment",
107
40
  "type": "int128"
108
41
  }
109
42
  ],
110
- "stateMutability": "nonpayable",
111
- "type": "function"
43
+ "name": "FundingPayment",
44
+ "type": "event"
112
45
  },
113
46
  {
114
47
  "inputs": [
@@ -152,24 +85,13 @@
152
85
  "type": "function"
153
86
  },
154
87
  {
155
- "inputs": [
156
- {
157
- "internalType": "uint32",
158
- "name": "productId",
159
- "type": "uint32"
160
- },
161
- {
162
- "internalType": "bytes32",
163
- "name": "subaccount",
164
- "type": "bytes32"
165
- }
166
- ],
167
- "name": "getBalanceAmount",
88
+ "inputs": [],
89
+ "name": "getClearinghouse",
168
90
  "outputs": [
169
91
  {
170
- "internalType": "int128",
92
+ "internalType": "address",
171
93
  "name": "",
172
- "type": "int128"
94
+ "type": "address"
173
95
  }
174
96
  ],
175
97
  "stateMutability": "view",
@@ -177,18 +99,23 @@
177
99
  },
178
100
  {
179
101
  "inputs": [
102
+ {
103
+ "internalType": "bytes32",
104
+ "name": "subaccount",
105
+ "type": "bytes32"
106
+ },
180
107
  {
181
108
  "internalType": "uint32",
182
109
  "name": "productId",
183
110
  "type": "uint32"
184
111
  },
185
112
  {
186
- "internalType": "bytes32",
187
- "name": "subaccount",
188
- "type": "bytes32"
113
+ "internalType": "enum IProductEngine.HealthType",
114
+ "name": "healthType",
115
+ "type": "uint8"
189
116
  }
190
117
  ],
191
- "name": "getBalances",
118
+ "name": "getCoreRisk",
192
119
  "outputs": [
193
120
  {
194
121
  "components": [
@@ -199,33 +126,16 @@
199
126
  },
200
127
  {
201
128
  "internalType": "int128",
202
- "name": "lastCumulativeFundingX18",
203
- "type": "int128"
204
- }
205
- ],
206
- "internalType": "struct IPerpEngine.LpBalance",
207
- "name": "",
208
- "type": "tuple"
209
- },
210
- {
211
- "components": [
212
- {
213
- "internalType": "int128",
214
- "name": "amount",
215
- "type": "int128"
216
- },
217
- {
218
- "internalType": "int128",
219
- "name": "vQuoteBalance",
129
+ "name": "price",
220
130
  "type": "int128"
221
131
  },
222
132
  {
223
133
  "internalType": "int128",
224
- "name": "lastCumulativeFundingX18",
134
+ "name": "longWeight",
225
135
  "type": "int128"
226
136
  }
227
137
  ],
228
- "internalType": "struct IPerpEngine.Balance",
138
+ "internalType": "struct IProductEngine.CoreRisk",
229
139
  "name": "",
230
140
  "type": "tuple"
231
141
  }
@@ -233,19 +143,6 @@
233
143
  "stateMutability": "view",
234
144
  "type": "function"
235
145
  },
236
- {
237
- "inputs": [],
238
- "name": "getClearinghouse",
239
- "outputs": [
240
- {
241
- "internalType": "address",
242
- "name": "",
243
- "type": "address"
244
- }
245
- ],
246
- "stateMutability": "view",
247
- "type": "function"
248
- },
249
146
  {
250
147
  "inputs": [],
251
148
  "name": "getEngineType",
@@ -262,63 +159,22 @@
262
159
  {
263
160
  "inputs": [
264
161
  {
265
- "internalType": "uint32",
266
- "name": "productId",
267
- "type": "uint32"
268
- }
269
- ],
270
- "name": "getLpState",
271
- "outputs": [
272
- {
273
- "components": [
274
- {
275
- "internalType": "int128",
276
- "name": "supply",
277
- "type": "int128"
278
- },
279
- {
280
- "internalType": "int128",
281
- "name": "lastCumulativeFundingX18",
282
- "type": "int128"
283
- },
284
- {
285
- "internalType": "int128",
286
- "name": "cumulativeFundingPerLpX18",
287
- "type": "int128"
288
- },
289
- {
290
- "internalType": "int128",
291
- "name": "base",
292
- "type": "int128"
293
- },
294
- {
295
- "internalType": "int128",
296
- "name": "quote",
297
- "type": "int128"
298
- }
299
- ],
300
- "internalType": "struct IPerpEngine.LpState",
301
- "name": "",
302
- "type": "tuple"
303
- }
304
- ],
305
- "stateMutability": "view",
306
- "type": "function"
307
- },
308
- {
309
- "inputs": [
162
+ "internalType": "bytes32",
163
+ "name": "subaccount",
164
+ "type": "bytes32"
165
+ },
310
166
  {
311
- "internalType": "uint32",
312
- "name": "productId",
313
- "type": "uint32"
167
+ "internalType": "enum IProductEngine.HealthType",
168
+ "name": "healthType",
169
+ "type": "uint8"
314
170
  }
315
171
  ],
316
- "name": "getOrderbook",
172
+ "name": "getHealthContribution",
317
173
  "outputs": [
318
174
  {
319
- "internalType": "address",
175
+ "internalType": "int128",
320
176
  "name": "",
321
- "type": "address"
177
+ "type": "int128"
322
178
  }
323
179
  ],
324
180
  "stateMutability": "view",
@@ -367,116 +223,40 @@
367
223
  "internalType": "uint32",
368
224
  "name": "productId",
369
225
  "type": "uint32"
370
- },
371
- {
372
- "internalType": "bytes32",
373
- "name": "subaccount",
374
- "type": "bytes32"
375
226
  }
376
227
  ],
377
- "name": "getSettlementState",
228
+ "name": "getRisk",
378
229
  "outputs": [
379
- {
380
- "internalType": "int128",
381
- "name": "availableSettle",
382
- "type": "int128"
383
- },
384
230
  {
385
231
  "components": [
386
232
  {
387
233
  "internalType": "int128",
388
- "name": "supply",
234
+ "name": "longWeightInitialX18",
389
235
  "type": "int128"
390
236
  },
391
237
  {
392
238
  "internalType": "int128",
393
- "name": "lastCumulativeFundingX18",
239
+ "name": "shortWeightInitialX18",
394
240
  "type": "int128"
395
241
  },
396
242
  {
397
243
  "internalType": "int128",
398
- "name": "cumulativeFundingPerLpX18",
244
+ "name": "longWeightMaintenanceX18",
399
245
  "type": "int128"
400
246
  },
401
247
  {
402
248
  "internalType": "int128",
403
- "name": "base",
249
+ "name": "shortWeightMaintenanceX18",
404
250
  "type": "int128"
405
251
  },
406
252
  {
407
253
  "internalType": "int128",
408
- "name": "quote",
254
+ "name": "priceX18",
409
255
  "type": "int128"
410
256
  }
411
257
  ],
412
- "internalType": "struct IPerpEngine.LpState",
413
- "name": "lpState",
414
- "type": "tuple"
415
- },
416
- {
417
- "components": [
418
- {
419
- "internalType": "int128",
420
- "name": "amount",
421
- "type": "int128"
422
- },
423
- {
424
- "internalType": "int128",
425
- "name": "lastCumulativeFundingX18",
426
- "type": "int128"
427
- }
428
- ],
429
- "internalType": "struct IPerpEngine.LpBalance",
430
- "name": "lpBalance",
431
- "type": "tuple"
432
- },
433
- {
434
- "components": [
435
- {
436
- "internalType": "int128",
437
- "name": "cumulativeFundingLongX18",
438
- "type": "int128"
439
- },
440
- {
441
- "internalType": "int128",
442
- "name": "cumulativeFundingShortX18",
443
- "type": "int128"
444
- },
445
- {
446
- "internalType": "int128",
447
- "name": "availableSettle",
448
- "type": "int128"
449
- },
450
- {
451
- "internalType": "int128",
452
- "name": "openInterest",
453
- "type": "int128"
454
- }
455
- ],
456
- "internalType": "struct IPerpEngine.State",
457
- "name": "state",
458
- "type": "tuple"
459
- },
460
- {
461
- "components": [
462
- {
463
- "internalType": "int128",
464
- "name": "amount",
465
- "type": "int128"
466
- },
467
- {
468
- "internalType": "int128",
469
- "name": "vQuoteBalance",
470
- "type": "int128"
471
- },
472
- {
473
- "internalType": "int128",
474
- "name": "lastCumulativeFundingX18",
475
- "type": "int128"
476
- }
477
- ],
478
- "internalType": "struct IPerpEngine.Balance",
479
- "name": "balance",
258
+ "internalType": "struct RiskHelper.Risk",
259
+ "name": "",
480
260
  "type": "tuple"
481
261
  }
482
262
  ],
@@ -496,8 +276,13 @@
496
276
  "type": "bytes32"
497
277
  }
498
278
  ],
499
- "name": "getStateAndBalance",
279
+ "name": "getSettlementState",
500
280
  "outputs": [
281
+ {
282
+ "internalType": "int128",
283
+ "name": "availableSettle",
284
+ "type": "int128"
285
+ },
501
286
  {
502
287
  "components": [
503
288
  {
@@ -522,7 +307,7 @@
522
307
  }
523
308
  ],
524
309
  "internalType": "struct IPerpEngine.State",
525
- "name": "",
310
+ "name": "state",
526
311
  "type": "tuple"
527
312
  },
528
313
  {
@@ -544,7 +329,7 @@
544
329
  }
545
330
  ],
546
331
  "internalType": "struct IPerpEngine.Balance",
547
- "name": "",
332
+ "name": "balance",
548
333
  "type": "tuple"
549
334
  }
550
335
  ],
@@ -564,57 +349,8 @@
564
349
  "type": "bytes32"
565
350
  }
566
351
  ],
567
- "name": "getStatesAndBalances",
352
+ "name": "getStateAndBalance",
568
353
  "outputs": [
569
- {
570
- "components": [
571
- {
572
- "internalType": "int128",
573
- "name": "supply",
574
- "type": "int128"
575
- },
576
- {
577
- "internalType": "int128",
578
- "name": "lastCumulativeFundingX18",
579
- "type": "int128"
580
- },
581
- {
582
- "internalType": "int128",
583
- "name": "cumulativeFundingPerLpX18",
584
- "type": "int128"
585
- },
586
- {
587
- "internalType": "int128",
588
- "name": "base",
589
- "type": "int128"
590
- },
591
- {
592
- "internalType": "int128",
593
- "name": "quote",
594
- "type": "int128"
595
- }
596
- ],
597
- "internalType": "struct IPerpEngine.LpState",
598
- "name": "",
599
- "type": "tuple"
600
- },
601
- {
602
- "components": [
603
- {
604
- "internalType": "int128",
605
- "name": "amount",
606
- "type": "int128"
607
- },
608
- {
609
- "internalType": "int128",
610
- "name": "lastCumulativeFundingX18",
611
- "type": "int128"
612
- }
613
- ],
614
- "internalType": "struct IPerpEngine.LpBalance",
615
- "name": "",
616
- "type": "tuple"
617
- },
618
354
  {
619
355
  "components": [
620
356
  {
@@ -668,30 +404,6 @@
668
404
  "stateMutability": "view",
669
405
  "type": "function"
670
406
  },
671
- {
672
- "inputs": [
673
- {
674
- "internalType": "uint32",
675
- "name": "productId",
676
- "type": "uint32"
677
- },
678
- {
679
- "internalType": "bytes32",
680
- "name": "subaccount",
681
- "type": "bytes32"
682
- }
683
- ],
684
- "name": "hasBalance",
685
- "outputs": [
686
- {
687
- "internalType": "bool",
688
- "name": "",
689
- "type": "bool"
690
- }
691
- ],
692
- "stateMutability": "view",
693
- "type": "function"
694
- },
695
407
  {
696
408
  "inputs": [
697
409
  {
@@ -701,22 +413,22 @@
701
413
  },
702
414
  {
703
415
  "internalType": "address",
704
- "name": "_quote",
416
+ "name": "_offchainExchange",
705
417
  "type": "address"
706
418
  },
707
419
  {
708
420
  "internalType": "address",
709
- "name": "_endpoint",
421
+ "name": "_quote",
710
422
  "type": "address"
711
423
  },
712
424
  {
713
425
  "internalType": "address",
714
- "name": "_admin",
426
+ "name": "_endpoint",
715
427
  "type": "address"
716
428
  },
717
429
  {
718
430
  "internalType": "address",
719
- "name": "_fees",
431
+ "name": "_admin",
720
432
  "type": "address"
721
433
  }
722
434
  ],
@@ -738,39 +450,6 @@
738
450
  "stateMutability": "view",
739
451
  "type": "function"
740
452
  },
741
- {
742
- "inputs": [
743
- {
744
- "internalType": "uint32",
745
- "name": "productId",
746
- "type": "uint32"
747
- },
748
- {
749
- "internalType": "bytes32",
750
- "name": "subaccount",
751
- "type": "bytes32"
752
- },
753
- {
754
- "internalType": "int128",
755
- "name": "amountBase",
756
- "type": "int128"
757
- },
758
- {
759
- "internalType": "int128",
760
- "name": "quoteAmountLow",
761
- "type": "int128"
762
- },
763
- {
764
- "internalType": "int128",
765
- "name": "quoteAmountHigh",
766
- "type": "int128"
767
- }
768
- ],
769
- "name": "mintLp",
770
- "outputs": [],
771
- "stateMutability": "nonpayable",
772
- "type": "function"
773
- },
774
453
  {
775
454
  "inputs": [
776
455
  {
@@ -827,29 +506,23 @@
827
506
  "type": "uint32"
828
507
  },
829
508
  {
830
- "internalType": "int128",
831
- "name": "baseDelta",
832
- "type": "int128"
509
+ "internalType": "bytes32",
510
+ "name": "subaccount",
511
+ "type": "bytes32"
833
512
  },
834
513
  {
835
514
  "internalType": "int128",
836
- "name": "quoteDelta",
837
- "type": "int128"
838
- }
839
- ],
840
- "name": "swapLp",
841
- "outputs": [
842
- {
843
- "internalType": "int128",
844
- "name": "",
515
+ "name": "amountDelta",
845
516
  "type": "int128"
846
517
  },
847
518
  {
848
519
  "internalType": "int128",
849
- "name": "",
520
+ "name": "vQuoteDelta",
850
521
  "type": "int128"
851
522
  }
852
523
  ],
524
+ "name": "updateBalance",
525
+ "outputs": [],
853
526
  "stateMutability": "nonpayable",
854
527
  "type": "function"
855
528
  },
@@ -860,40 +533,14 @@
860
533
  "name": "productId",
861
534
  "type": "uint32"
862
535
  },
863
- {
864
- "internalType": "int128",
865
- "name": "amount",
866
- "type": "int128"
867
- },
868
536
  {
869
537
  "internalType": "int128",
870
538
  "name": "priceX18",
871
539
  "type": "int128"
872
- },
873
- {
874
- "internalType": "int128",
875
- "name": "sizeIncrement",
876
- "type": "int128"
877
- },
878
- {
879
- "internalType": "int128",
880
- "name": "lpSpreadX18",
881
- "type": "int128"
882
- }
883
- ],
884
- "name": "swapLp",
885
- "outputs": [
886
- {
887
- "internalType": "int128",
888
- "name": "",
889
- "type": "int128"
890
- },
891
- {
892
- "internalType": "int128",
893
- "name": "",
894
- "type": "int128"
895
540
  }
896
541
  ],
542
+ "name": "updatePrice",
543
+ "outputs": [],
897
544
  "stateMutability": "nonpayable",
898
545
  "type": "function"
899
546
  },
@@ -928,4 +575,4 @@
928
575
  "stateMutability": "nonpayable",
929
576
  "type": "function"
930
577
  }
931
- ]
578
+ ]