nado-protocol 0.1.0__tar.gz → 0.1.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.
Files changed (83) hide show
  1. {nado_protocol-0.1.0 → nado_protocol-0.1.2}/PKG-INFO +4 -2
  2. {nado_protocol-0.1.0 → nado_protocol-0.1.2}/README.md +3 -1
  3. {nado_protocol-0.1.0 → nado_protocol-0.1.2}/nado_protocol/client/__init__.py +11 -2
  4. {nado_protocol-0.1.0 → nado_protocol-0.1.2}/nado_protocol/client/apis/market/execute.py +10 -26
  5. {nado_protocol-0.1.0 → nado_protocol-0.1.2}/nado_protocol/client/apis/market/query.py +2 -2
  6. {nado_protocol-0.1.0 → nado_protocol-0.1.2}/nado_protocol/client/apis/rewards/execute.py +27 -27
  7. nado_protocol-0.1.2/nado_protocol/client/apis/rewards/query.py +13 -0
  8. {nado_protocol-0.1.0 → nado_protocol-0.1.2}/nado_protocol/client/apis/subaccount/query.py +1 -1
  9. {nado_protocol-0.1.0 → nado_protocol-0.1.2}/nado_protocol/client/context.py +0 -2
  10. {nado_protocol-0.1.0 → nado_protocol-0.1.2}/nado_protocol/contracts/__init__.py +41 -33
  11. {nado_protocol-0.1.0 → nado_protocol-0.1.2}/nado_protocol/contracts/abis/Endpoint.json +151 -228
  12. {nado_protocol-0.1.0 → nado_protocol-0.1.2}/nado_protocol/contracts/abis/FQuerier.json +91 -508
  13. nado_protocol-0.1.2/nado_protocol/contracts/abis/IAirdrop.json +76 -0
  14. {nado_protocol-0.1.0 → nado_protocol-0.1.2}/nado_protocol/contracts/abis/IClearinghouse.json +277 -390
  15. {nado_protocol-0.1.0 → nado_protocol-0.1.2}/nado_protocol/contracts/abis/IEndpoint.json +42 -80
  16. {nado_protocol-0.1.0 → nado_protocol-0.1.2}/nado_protocol/contracts/abis/IPerpEngine.json +69 -422
  17. nado_protocol-0.1.2/nado_protocol/contracts/abis/IProductEngine.json +234 -0
  18. {nado_protocol-0.1.0 → nado_protocol-0.1.2}/nado_protocol/contracts/abis/ISpotEngine.json +173 -362
  19. {nado_protocol-0.1.0 → nado_protocol-0.1.2}/nado_protocol/contracts/abis/MockERC20.json +1 -1
  20. nado_protocol-0.1.0/nado_protocol/contracts/deployments/deployment.test.json → nado_protocol-0.1.2/nado_protocol/contracts/deployments/deployment.testing.json +2 -5
  21. nado_protocol-0.1.2/nado_protocol/contracts/deployments/deployment.testnet.json +15 -0
  22. {nado_protocol-0.1.0 → nado_protocol-0.1.2}/nado_protocol/contracts/eip712/types.py +15 -20
  23. {nado_protocol-0.1.0 → nado_protocol-0.1.2}/nado_protocol/contracts/types.py +15 -13
  24. {nado_protocol-0.1.0 → nado_protocol-0.1.2}/nado_protocol/engine_client/execute.py +18 -39
  25. {nado_protocol-0.1.0 → nado_protocol-0.1.2}/nado_protocol/engine_client/query.py +1 -1
  26. {nado_protocol-0.1.0 → nado_protocol-0.1.2}/nado_protocol/engine_client/types/__init__.py +4 -8
  27. {nado_protocol-0.1.0 → nado_protocol-0.1.2}/nado_protocol/engine_client/types/execute.py +37 -103
  28. {nado_protocol-0.1.0 → nado_protocol-0.1.2}/nado_protocol/engine_client/types/models.py +3 -59
  29. {nado_protocol-0.1.0 → nado_protocol-0.1.2}/nado_protocol/engine_client/types/query.py +3 -6
  30. {nado_protocol-0.1.0 → nado_protocol-0.1.2}/nado_protocol/indexer_client/query.py +4 -9
  31. {nado_protocol-0.1.0 → nado_protocol-0.1.2}/nado_protocol/indexer_client/types/__init__.py +4 -5
  32. {nado_protocol-0.1.0 → nado_protocol-0.1.2}/nado_protocol/indexer_client/types/models.py +16 -23
  33. {nado_protocol-0.1.0 → nado_protocol-0.1.2}/nado_protocol/indexer_client/types/query.py +12 -11
  34. {nado_protocol-0.1.0 → nado_protocol-0.1.2}/nado_protocol/trigger_client/execute.py +1 -1
  35. {nado_protocol-0.1.0 → nado_protocol-0.1.2}/nado_protocol/trigger_client/types/execute.py +3 -1
  36. {nado_protocol-0.1.0 → nado_protocol-0.1.2}/nado_protocol/utils/__init__.py +18 -1
  37. {nado_protocol-0.1.0 → nado_protocol-0.1.2}/nado_protocol/utils/backend.py +5 -2
  38. {nado_protocol-0.1.0 → nado_protocol-0.1.2}/nado_protocol/utils/exceptions.py +3 -3
  39. {nado_protocol-0.1.0 → nado_protocol-0.1.2}/nado_protocol/utils/execute.py +26 -67
  40. nado_protocol-0.1.2/nado_protocol/utils/expiration.py +24 -0
  41. {nado_protocol-0.1.0 → nado_protocol-0.1.2}/nado_protocol/utils/nonce.py +0 -4
  42. nado_protocol-0.1.2/nado_protocol/utils/order.py +356 -0
  43. {nado_protocol-0.1.0 → nado_protocol-0.1.2}/pyproject.toml +1 -2
  44. nado_protocol-0.1.0/nado_protocol/client/apis/rewards/query.py +0 -12
  45. nado_protocol-0.1.0/nado_protocol/contracts/abis/IERC20.json +0 -185
  46. nado_protocol-0.1.0/nado_protocol/contracts/abis/IOffchainBook.json +0 -536
  47. nado_protocol-0.1.0/nado_protocol/contracts/abis/IProductEngine.json +0 -352
  48. nado_protocol-0.1.0/nado_protocol/contracts/abis/IVrtxAirdrop.json +0 -138
  49. nado_protocol-0.1.0/nado_protocol/utils/expiration.py +0 -45
  50. {nado_protocol-0.1.0 → nado_protocol-0.1.2}/nado_protocol/__init__.py +0 -0
  51. {nado_protocol-0.1.0 → nado_protocol-0.1.2}/nado_protocol/client/apis/__init__.py +0 -0
  52. {nado_protocol-0.1.0 → nado_protocol-0.1.2}/nado_protocol/client/apis/base.py +0 -0
  53. {nado_protocol-0.1.0 → nado_protocol-0.1.2}/nado_protocol/client/apis/market/__init__.py +0 -0
  54. {nado_protocol-0.1.0 → nado_protocol-0.1.2}/nado_protocol/client/apis/perp/__init__.py +0 -0
  55. {nado_protocol-0.1.0 → nado_protocol-0.1.2}/nado_protocol/client/apis/perp/query.py +0 -0
  56. {nado_protocol-0.1.0 → nado_protocol-0.1.2}/nado_protocol/client/apis/rewards/__init__.py +0 -0
  57. {nado_protocol-0.1.0 → nado_protocol-0.1.2}/nado_protocol/client/apis/spot/__init__.py +0 -0
  58. {nado_protocol-0.1.0 → nado_protocol-0.1.2}/nado_protocol/client/apis/spot/base.py +0 -0
  59. {nado_protocol-0.1.0 → nado_protocol-0.1.2}/nado_protocol/client/apis/spot/execute.py +0 -0
  60. {nado_protocol-0.1.0 → nado_protocol-0.1.2}/nado_protocol/client/apis/spot/query.py +0 -0
  61. {nado_protocol-0.1.0 → nado_protocol-0.1.2}/nado_protocol/client/apis/subaccount/__init__.py +0 -0
  62. {nado_protocol-0.1.0 → nado_protocol-0.1.2}/nado_protocol/client/apis/subaccount/execute.py +0 -0
  63. {nado_protocol-0.1.0 → nado_protocol-0.1.2}/nado_protocol/contracts/abis/IFoundationRewardsAirdrop.json +0 -0
  64. {nado_protocol-0.1.0 → nado_protocol-0.1.2}/nado_protocol/contracts/abis/IStaking.json +0 -0
  65. {nado_protocol-0.1.0 → nado_protocol-0.1.2}/nado_protocol/contracts/eip712/__init__.py +0 -0
  66. {nado_protocol-0.1.0 → nado_protocol-0.1.2}/nado_protocol/contracts/eip712/domain.py +0 -0
  67. {nado_protocol-0.1.0 → nado_protocol-0.1.2}/nado_protocol/contracts/eip712/sign.py +0 -0
  68. {nado_protocol-0.1.0 → nado_protocol-0.1.2}/nado_protocol/contracts/loader.py +0 -0
  69. {nado_protocol-0.1.0 → nado_protocol-0.1.2}/nado_protocol/engine_client/__init__.py +0 -0
  70. {nado_protocol-0.1.0 → nado_protocol-0.1.2}/nado_protocol/engine_client/types/stream.py +0 -0
  71. {nado_protocol-0.1.0 → nado_protocol-0.1.2}/nado_protocol/indexer_client/__init__.py +0 -0
  72. {nado_protocol-0.1.0 → nado_protocol-0.1.2}/nado_protocol/trigger_client/__init__.py +0 -0
  73. {nado_protocol-0.1.0 → nado_protocol-0.1.2}/nado_protocol/trigger_client/query.py +0 -0
  74. {nado_protocol-0.1.0 → nado_protocol-0.1.2}/nado_protocol/trigger_client/types/__init__.py +0 -0
  75. {nado_protocol-0.1.0 → nado_protocol-0.1.2}/nado_protocol/trigger_client/types/models.py +0 -0
  76. {nado_protocol-0.1.0 → nado_protocol-0.1.2}/nado_protocol/trigger_client/types/query.py +0 -0
  77. {nado_protocol-0.1.0 → nado_protocol-0.1.2}/nado_protocol/utils/bytes32.py +0 -0
  78. {nado_protocol-0.1.0 → nado_protocol-0.1.2}/nado_protocol/utils/enum.py +0 -0
  79. {nado_protocol-0.1.0 → nado_protocol-0.1.2}/nado_protocol/utils/interest.py +0 -0
  80. {nado_protocol-0.1.0 → nado_protocol-0.1.2}/nado_protocol/utils/math.py +0 -0
  81. {nado_protocol-0.1.0 → nado_protocol-0.1.2}/nado_protocol/utils/model.py +0 -0
  82. {nado_protocol-0.1.0 → nado_protocol-0.1.2}/nado_protocol/utils/subaccount.py +0 -0
  83. {nado_protocol-0.1.0 → nado_protocol-0.1.2}/nado_protocol/utils/time.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: nado-protocol
3
- Version: 0.1.0
3
+ Version: 0.1.2
4
4
  Summary: Nado Protocol SDK
5
5
  Keywords: nado protocol,nado sdk,nado protocol api
6
6
  Author: Jeury Mejia
@@ -54,6 +54,7 @@ from nado_protocol.engine_client.types.execute import (
54
54
  from nado_protocol.utils.expiration import OrderType, get_expiration_timestamp
55
55
  from nado_protocol.utils.math import to_pow_10, to_x18
56
56
  from nado_protocol.utils.nonce import gen_order_nonce
57
+ from nado_protocol.utils.order import build_appendix
57
58
  ```
58
59
 
59
60
  ### Create the NadoClient providing your private key:
@@ -95,8 +96,9 @@ order = OrderParams(
95
96
  ),
96
97
  priceX18=to_x18(20000),
97
98
  amount=to_pow_10(1, 17),
98
- expiration=get_expiration_timestamp(OrderType.POST_ONLY, int(time.time()) + 40),
99
+ expiration=get_expiration_timestamp(40),
99
100
  nonce=gen_order_nonce(),
101
+ appendix=build_appendix(order_type=OrderType.POST_ONLY)
100
102
  )
101
103
  res = client.market.place_order({"product_id": product_id, "order": order})
102
104
  print("order result:", res.json(indent=2))
@@ -31,6 +31,7 @@ from nado_protocol.engine_client.types.execute import (
31
31
  from nado_protocol.utils.expiration import OrderType, get_expiration_timestamp
32
32
  from nado_protocol.utils.math import to_pow_10, to_x18
33
33
  from nado_protocol.utils.nonce import gen_order_nonce
34
+ from nado_protocol.utils.order import build_appendix
34
35
  ```
35
36
 
36
37
  ### Create the NadoClient providing your private key:
@@ -72,8 +73,9 @@ order = OrderParams(
72
73
  ),
73
74
  priceX18=to_x18(20000),
74
75
  amount=to_pow_10(1, 17),
75
- expiration=get_expiration_timestamp(OrderType.POST_ONLY, int(time.time()) + 40),
76
+ expiration=get_expiration_timestamp(40),
76
77
  nonce=gen_order_nonce(),
78
+ appendix=build_appendix(order_type=OrderType.POST_ONLY)
77
79
  )
78
80
  res = client.market.place_order({"product_id": product_id, "order": order})
79
81
  print("order result:", res.json(indent=2))
@@ -33,6 +33,9 @@ class NadoClientMode(StrEnum):
33
33
  DEVNET = "devnet"
34
34
  TESTING = "testing"
35
35
 
36
+ # testnet
37
+ TESTNET = "testnet" # Ink Sepolia
38
+
36
39
 
37
40
  class NadoClient:
38
41
  """
@@ -125,8 +128,8 @@ def create_nado_client(
125
128
  perp_engine_addr=deployment.perp_engine_addr,
126
129
  spot_engine_addr=deployment.spot_engine_addr,
127
130
  clearinghouse_addr=deployment.clearinghouse_addr,
128
- vrtx_airdrop_addr=deployment.vrtx_airdrop_addr,
129
- vrtx_staking_addr=deployment.vrtx_staking_addr,
131
+ airdrop_addr=deployment.airdrop_addr,
132
+ staking_addr=deployment.staking_addr,
130
133
  foundation_rewards_airdrop_addr=deployment.foundation_rewards_airdrop_addr,
131
134
  )
132
135
  except Exception as e:
@@ -185,6 +188,12 @@ def client_mode_to_setup(
185
188
  NadoBackendURL.DEVNET_TRIGGER.value,
186
189
  NadoNetwork.TESTING.value,
187
190
  ),
191
+ NadoClientMode.TESTNET: (
192
+ NadoBackendURL.TESTNET_GATEWAY.value,
193
+ NadoBackendURL.TESTNET_INDEXER.value,
194
+ NadoBackendURL.TESTNET_TRIGGER.value,
195
+ NadoNetwork.TESTNET.value,
196
+ ),
188
197
  }[client_mode]
189
198
  except KeyError:
190
199
  raise Exception(f"Mode provided `{client_mode}` not supported!")
@@ -1,13 +1,12 @@
1
1
  from nado_protocol.engine_client.types.execute import (
2
- BurnLpParams,
2
+ BurnNlpParams,
3
3
  CancelAndPlaceParams,
4
4
  CancelOrdersParams,
5
5
  CancelProductOrdersParams,
6
6
  ExecuteResponse,
7
- MintLpParams,
7
+ MintNlpParams,
8
8
  PlaceMarketOrderParams,
9
9
  PlaceOrderParams,
10
- PlaceIsolatedOrderParams,
11
10
  )
12
11
  from nado_protocol.client.apis.base import NadoBaseAPI
13
12
  from nado_protocol.trigger_client.types.execute import (
@@ -32,12 +31,12 @@ class MarketExecuteAPI(NadoBaseAPI):
32
31
  This class should not be instantiated directly, it is designed to be used through a NadoClient instance.
33
32
  """
34
33
 
35
- def mint_lp(self, params: MintLpParams) -> ExecuteResponse:
34
+ def mint_nlp(self, params: MintNlpParams) -> ExecuteResponse:
36
35
  """
37
- Mint LP tokens through the engine.
36
+ Mint NLP tokens through the engine.
38
37
 
39
38
  Args:
40
- params (MintLpParams): Parameters required to mint LP tokens.
39
+ params (MintNlpParams): Parameters required to mint NLP tokens.
41
40
 
42
41
  Returns:
43
42
  ExecuteResponse: The response from the engine execution.
@@ -45,14 +44,14 @@ class MarketExecuteAPI(NadoBaseAPI):
45
44
  Raises:
46
45
  Exception: If there is an error during the execution or the response status is not "success".
47
46
  """
48
- return self.context.engine_client.mint_lp(params)
47
+ return self.context.engine_client.mint_nlp(params)
49
48
 
50
- def burn_lp(self, params: BurnLpParams) -> ExecuteResponse:
49
+ def burn_nlp(self, params: BurnNlpParams) -> ExecuteResponse:
51
50
  """
52
- Burn LP tokens through the engine.
51
+ Burn NLP tokens through the engine.
53
52
 
54
53
  Args:
55
- params (BurnLpParams): Parameters required to burn LP tokens.
54
+ params (BurnNlpParams): Parameters required to burn NLP tokens.
56
55
 
57
56
  Returns:
58
57
  ExecuteResponse: The response from the engine execution.
@@ -60,7 +59,7 @@ class MarketExecuteAPI(NadoBaseAPI):
60
59
  Raises:
61
60
  Exception: If there is an error during the execution or the response status is not "success".
62
61
  """
63
- return self.context.engine_client.burn_lp(params)
62
+ return self.context.engine_client.burn_nlp(params)
64
63
 
65
64
  def place_order(self, params: PlaceOrderParams) -> ExecuteResponse:
66
65
  """
@@ -77,21 +76,6 @@ class MarketExecuteAPI(NadoBaseAPI):
77
76
  """
78
77
  return self.context.engine_client.place_order(params)
79
78
 
80
- def place_isolated_order(self, params: PlaceIsolatedOrderParams) -> ExecuteResponse:
81
- """
82
- Places an isolated order through the engine.
83
-
84
- Args:
85
- params (PlaceIsolatedOrderParams): Parameters required to place an isolated order.
86
-
87
- Returns:
88
- ExecuteResponse: The response from the engine execution.
89
-
90
- Raises:
91
- Exception: If there is an error during the execution or the response status is not "success".
92
- """
93
- return self.context.engine_client.place_isolated_order(params)
94
-
95
79
  def place_market_order(self, params: PlaceMarketOrderParams) -> ExecuteResponse:
96
80
  """
97
81
  Places a market order through the engine.
@@ -193,7 +193,7 @@ class MarketQueryAPI(NadoBaseAPI):
193
193
  """
194
194
  return self.context.engine_client.get_max_order_size(params)
195
195
 
196
- def get_max_lp_mintable(
196
+ def get_max_nlp_mintable(
197
197
  self, product_id: int, sender: str, spot_leverage: Optional[bool] = None
198
198
  ) -> MaxLpMintableData:
199
199
  """
@@ -209,7 +209,7 @@ class MarketQueryAPI(NadoBaseAPI):
209
209
  Returns:
210
210
  MaxLpMintableData: Maximum base amount that can be contributed for minting LPs, in string format.
211
211
  """
212
- return self.context.engine_client.get_max_lp_mintable(
212
+ return self.context.engine_client.get_max_nlp_mintable(
213
213
  product_id, sender, spot_leverage
214
214
  )
215
215
 
@@ -2,28 +2,28 @@ from typing import Optional
2
2
  from nado_protocol.contracts.types import (
3
3
  ClaimFoundationRewardsContractParams,
4
4
  ClaimFoundationRewardsProofStruct,
5
- ClaimVrtxContractParams,
6
- ClaimVrtxParams,
5
+ ClaimTokensContractParams,
6
+ ClaimTokensParams,
7
7
  )
8
8
  from nado_protocol.client.apis.base import NadoBaseAPI
9
9
  from eth_account.signers.local import LocalAccount
10
10
 
11
- from nado_protocol.utils.exceptions import InvalidVrtxClaimParams
11
+ from nado_protocol.utils.exceptions import InvalidTokenClaimParams
12
12
 
13
13
 
14
14
  class RewardsExecuteAPI(NadoBaseAPI):
15
- def _validate_claim_params(self, params: ClaimVrtxParams):
16
- p = ClaimVrtxParams.parse_obj(params)
15
+ def _validate_claim_params(self, params: ClaimTokensParams):
16
+ p = ClaimTokensParams.parse_obj(params)
17
17
  if p.amount is None and p.claim_all is None:
18
- raise InvalidVrtxClaimParams()
18
+ raise InvalidTokenClaimParams()
19
19
 
20
- def claim_vrtx(
21
- self, params: ClaimVrtxParams, signer: Optional[LocalAccount] = None
20
+ def claim(
21
+ self, params: ClaimTokensParams, signer: Optional[LocalAccount] = None
22
22
  ) -> str:
23
23
  self._validate_claim_params(params)
24
24
  signer = self._get_signer(signer)
25
- claim_params = self._get_claim_vrtx_contract_params(params, signer)
26
- return self.context.contracts.claim_vrtx(
25
+ claim_params = self._get_claim_tokens_contract_params(params, signer)
26
+ return self.context.contracts.claim(
27
27
  claim_params.epoch,
28
28
  claim_params.amount_to_claim,
29
29
  claim_params.total_claimable_amount,
@@ -31,13 +31,13 @@ class RewardsExecuteAPI(NadoBaseAPI):
31
31
  signer,
32
32
  )
33
33
 
34
- def claim_and_stake_vrtx(
35
- self, params: ClaimVrtxParams, signer: Optional[LocalAccount] = None
34
+ def claim_and_stake(
35
+ self, params: ClaimTokensParams, signer: Optional[LocalAccount] = None
36
36
  ) -> str:
37
37
  self._validate_claim_params(params)
38
38
  signer = self._get_signer(signer)
39
- claim_params = self._get_claim_vrtx_contract_params(params, signer)
40
- return self.context.contracts.claim_and_stake_vrtx(
39
+ claim_params = self._get_claim_tokens_contract_params(params, signer)
40
+ return self.context.contracts.claim_and_stake(
41
41
  claim_params.epoch,
42
42
  claim_params.amount_to_claim,
43
43
  claim_params.total_claimable_amount,
@@ -45,17 +45,17 @@ class RewardsExecuteAPI(NadoBaseAPI):
45
45
  signer,
46
46
  )
47
47
 
48
- def stake_vrtx(self, amount: int, signer: Optional[LocalAccount] = None) -> str:
48
+ def stake(self, amount: int, signer: Optional[LocalAccount] = None) -> str:
49
49
  signer = self._get_signer(signer)
50
- return self.context.contracts.stake_vrtx(amount, signer)
50
+ return self.context.contracts.stake(amount, signer)
51
51
 
52
- def unstake_vrtx(self, amount: int, signer: Optional[LocalAccount] = None) -> str:
52
+ def unstake(self, amount: int, signer: Optional[LocalAccount] = None) -> str:
53
53
  signer = self._get_signer(signer)
54
- return self.context.contracts.unstake_vrtx(amount, signer)
54
+ return self.context.contracts.unstake(amount, signer)
55
55
 
56
- def withdraw_unstaked_vrtx(self, signer: Optional[LocalAccount] = None):
56
+ def withdraw_unstaked(self, signer: Optional[LocalAccount] = None):
57
57
  signer = self._get_signer(signer)
58
- return self.context.contracts.withdraw_unstaked_vrtx(signer)
58
+ return self.context.contracts.withdraw_unstaked(signer)
59
59
 
60
60
  def claim_usdc_rewards(self, signer: Optional[LocalAccount] = None):
61
61
  signer = self._get_signer(signer)
@@ -75,22 +75,22 @@ class RewardsExecuteAPI(NadoBaseAPI):
75
75
  claim_params.claim_proofs, signer
76
76
  )
77
77
 
78
- def _get_claim_vrtx_contract_params(
79
- self, params: ClaimVrtxParams, signer: LocalAccount
80
- ) -> ClaimVrtxContractParams:
81
- epoch_merkle_proofs = self.context.indexer_client.get_vrtx_merkle_proofs(
78
+ def _get_claim_tokens_contract_params(
79
+ self, params: ClaimTokensParams, signer: LocalAccount
80
+ ) -> ClaimTokensContractParams:
81
+ epoch_merkle_proofs = self.context.indexer_client.get_token_merkle_proofs(
82
82
  signer.address
83
83
  ).merkle_proofs[params.epoch]
84
84
  total_claimable_amount = int(epoch_merkle_proofs.total_amount)
85
85
  if params.amount is not None:
86
86
  amount_to_claim = params.amount
87
87
  else:
88
- assert self.context.contracts.vrtx_airdrop is not None
89
- amount_claimed = self.context.contracts.vrtx_airdrop.functions.getClaimed(
88
+ assert self.context.contracts.airdrop is not None
89
+ amount_claimed = self.context.contracts.airdrop.functions.getClaimed(
90
90
  signer.address
91
91
  ).call()
92
92
  amount_to_claim = total_claimable_amount - amount_claimed[params.epoch]
93
- return ClaimVrtxContractParams(
93
+ return ClaimTokensContractParams(
94
94
  epoch=params.epoch,
95
95
  amount_to_claim=amount_to_claim,
96
96
  total_claimable_amount=total_claimable_amount,
@@ -0,0 +1,13 @@
1
+ from nado_protocol.client.apis.base import NadoBaseAPI
2
+
3
+
4
+ class RewardsQueryAPI(NadoBaseAPI):
5
+ # TODO: revise once staking contract is deployed
6
+ def get_claim_and_stake_estimated_tokens(self, wallet: str) -> int:
7
+ """
8
+ Estimates the amount of USDC -> TOKEN swap when claiming + staking USDC rewards
9
+ """
10
+ assert self.context.contracts.staking is not None
11
+ return self.context.contracts.staking.functions.getEstimatedTokensToStake(
12
+ wallet
13
+ ).call()
@@ -59,7 +59,7 @@ class SubaccountQueryAPI(NadoBaseAPI):
59
59
 
60
60
  def get_subaccount_token_rewards(self, address: str) -> IndexerTokenRewardsData:
61
61
  """
62
- Query the $VRTX token rewards accumulated per epoch for a specified wallet from the indexer.
62
+ Query the token rewards accumulated per epoch for a specified wallet from the indexer.
63
63
 
64
64
  Args:
65
65
  address (str): Wallet address to be queried.
@@ -67,7 +67,6 @@ def create_nado_client_context(
67
67
  try:
68
68
  contracts = engine_client.get_contracts()
69
69
  engine_client.endpoint_addr = contracts.endpoint_addr
70
- engine_client.book_addrs = contracts.book_addrs
71
70
  engine_client.chain_id = int(contracts.chain_id)
72
71
 
73
72
  if opts.trigger_endpoint_url is not None:
@@ -75,7 +74,6 @@ def create_nado_client_context(
75
74
  TriggerClientOpts(url=opts.trigger_endpoint_url, signer=signer)
76
75
  )
77
76
  trigger_client.endpoint_addr = contracts.endpoint_addr
78
- trigger_client.book_addrs = contracts.book_addrs
79
77
  trigger_client.chain_id = int(contracts.chain_id)
80
78
  except Exception as e:
81
79
  logging.warning(
@@ -33,11 +33,11 @@ class NadoContractsContext(BaseModel):
33
33
 
34
34
  clearinghouse_addr (Optional[str]): The clearinghouse address. This may be None.
35
35
 
36
- vrtx_airdrop_addr (Optional[str]): The VRTX airdrop address. This may be None.
36
+ airdrop_addr (Optional[str]): The airdrop address. This may be None.
37
37
 
38
- vrtx_staking_addr (Optional[str]): The VRTX staking address. This may be None.
38
+ staking_addr (Optional[str]): The staking address. This may be None.
39
39
 
40
- foundation_rewards_airdrop_addr (Optional[str]): The Foundation Rewards airdrop address of the corresponding chain (e.g: Arb airdrop for Arbitrum). This may be None.
40
+ foundation_rewards_airdrop_addr (Optional[str]): The Foundation Rewards airdrop address of the corresponding chain (e.g: Ink airdrop for Ink). This may be None.
41
41
  """
42
42
 
43
43
  network: Optional[NadoNetwork]
@@ -46,8 +46,8 @@ class NadoContractsContext(BaseModel):
46
46
  spot_engine_addr: Optional[str]
47
47
  perp_engine_addr: Optional[str]
48
48
  clearinghouse_addr: Optional[str]
49
- vrtx_airdrop_addr: Optional[str]
50
- vrtx_staking_addr: Optional[str]
49
+ airdrop_addr: Optional[str]
50
+ staking_addr: Optional[str]
51
51
  foundation_rewards_airdrop_addr: Optional[str]
52
52
 
53
53
 
@@ -64,8 +64,8 @@ class NadoContracts:
64
64
  clearinghouse: Optional[Contract]
65
65
  spot_engine: Optional[Contract]
66
66
  perp_engine: Optional[Contract]
67
- vrtx_airdrop: Optional[Contract]
68
- vrtx_staking: Optional[Contract]
67
+ airdrop: Optional[Contract]
68
+ staking: Optional[Contract]
69
69
  foundation_rewards_airdrop: Optional[Contract]
70
70
 
71
71
  def __init__(self, node_url: str, contracts_context: NadoContractsContext):
@@ -113,16 +113,16 @@ class NadoContracts:
113
113
  abi=load_abi(NadoAbiName.IPERP_ENGINE), # type: ignore
114
114
  )
115
115
 
116
- if self.contracts_context.vrtx_staking_addr:
117
- self.vrtx_staking: Contract = self.w3.eth.contract(
118
- address=self.contracts_context.vrtx_staking_addr,
116
+ if self.contracts_context.staking_addr:
117
+ self.staking: Contract = self.w3.eth.contract(
118
+ address=self.contracts_context.staking_addr,
119
119
  abi=load_abi(NadoAbiName.ISTAKING), # type: ignore
120
120
  )
121
121
 
122
- if self.contracts_context.vrtx_airdrop_addr:
123
- self.vrtx_airdrop: Contract = self.w3.eth.contract(
124
- address=self.contracts_context.vrtx_airdrop_addr,
125
- abi=load_abi(NadoAbiName.IVRTX_AIRDROP), # type: ignore
122
+ if self.contracts_context.airdrop_addr:
123
+ self.airdrop: Contract = self.w3.eth.contract(
124
+ address=self.contracts_context.airdrop_addr,
125
+ abi=load_abi(NadoAbiName.IAIRDROP), # type: ignore
126
126
  )
127
127
 
128
128
  if self.contracts_context.foundation_rewards_airdrop_addr:
@@ -191,7 +191,8 @@ class NadoContracts:
191
191
  to = to or self.endpoint.address
192
192
  return self.execute(erc20.functions.approve(to, amount), signer)
193
193
 
194
- def claim_vrtx(
194
+ # TODO: revise once airdrop contract is deployed
195
+ def claim(
195
196
  self,
196
197
  epoch: int,
197
198
  amount_to_claim: int,
@@ -199,15 +200,16 @@ class NadoContracts:
199
200
  merkle_proof: list[str],
200
201
  signer: LocalAccount,
201
202
  ) -> str:
202
- assert self.vrtx_airdrop is not None
203
+ assert self.airdrop is not None
203
204
  return self.execute(
204
- self.vrtx_airdrop.functions.claim(
205
+ self.airdrop.functions.claim(
205
206
  epoch, amount_to_claim, total_claimable_amount, merkle_proof
206
207
  ),
207
208
  signer,
208
209
  )
209
210
 
210
- def claim_and_stake_vrtx(
211
+ # TODO: revise once airdrop contract is deployed
212
+ def claim_and_stake(
211
213
  self,
212
214
  epoch: int,
213
215
  amount_to_claim: int,
@@ -215,66 +217,72 @@ class NadoContracts:
215
217
  merkle_proof: list[str],
216
218
  signer: LocalAccount,
217
219
  ) -> str:
218
- assert self.vrtx_airdrop is not None
220
+ assert self.airdrop is not None
219
221
  return self.execute(
220
- self.vrtx_airdrop.functions.claimAndStake(
222
+ self.airdrop.functions.claimAndStake(
221
223
  epoch, amount_to_claim, total_claimable_amount, merkle_proof
222
224
  ),
223
225
  signer,
224
226
  )
225
227
 
226
- def stake_vrtx(
228
+ # TODO: revise once staking contract is deployed
229
+ def stake(
227
230
  self,
228
231
  amount: int,
229
232
  signer: LocalAccount,
230
233
  ) -> str:
231
- assert self.vrtx_staking is not None
234
+ assert self.staking is not None
232
235
  return self.execute(
233
- self.vrtx_staking.functions.stake(amount),
236
+ self.staking.functions.stake(amount),
234
237
  signer,
235
238
  )
236
239
 
237
- def unstake_vrtx(
240
+ # TODO: revise once staking contract is deployed
241
+ def unstake(
238
242
  self,
239
243
  amount: int,
240
244
  signer: LocalAccount,
241
245
  ) -> str:
242
- assert self.vrtx_staking is not None
246
+ assert self.staking is not None
243
247
  return self.execute(
244
- self.vrtx_staking.functions.withdraw(amount),
248
+ self.staking.functions.withdraw(amount),
245
249
  signer,
246
250
  )
247
251
 
248
- def withdraw_unstaked_vrtx(
252
+ # TODO: revise once staking contract is deployed
253
+ def withdraw_unstaked(
249
254
  self,
250
255
  signer: LocalAccount,
251
256
  ) -> str:
252
- assert self.vrtx_staking is not None
257
+ assert self.staking is not None
253
258
  return self.execute(
254
- self.vrtx_staking.functions.claimVrtx(),
259
+ self.staking.functions.claim(),
255
260
  signer,
256
261
  )
257
262
 
263
+ # TODO: revise once staking contract is deployed
258
264
  def claim_usdc_rewards(
259
265
  self,
260
266
  signer: LocalAccount,
261
267
  ) -> str:
262
- assert self.vrtx_staking is not None
268
+ assert self.staking is not None
263
269
  return self.execute(
264
- self.vrtx_staking.functions.claimUsdc(),
270
+ self.staking.functions.claimUsdc(),
265
271
  signer,
266
272
  )
267
273
 
274
+ # TODO: revise once staking contract is deployed
268
275
  def claim_and_stake_usdc_rewards(
269
276
  self,
270
277
  signer: LocalAccount,
271
278
  ) -> str:
272
- assert self.vrtx_staking is not None
279
+ assert self.staking is not None
273
280
  return self.execute(
274
- self.vrtx_staking.functions.claimUsdcAndStake(),
281
+ self.staking.functions.claimUsdcAndStake(),
275
282
  signer,
276
283
  )
277
284
 
285
+ # TODO: revise once foundation rewards contract is deployed
278
286
  def claim_foundation_rewards(
279
287
  self,
280
288
  claim_proofs: list[ClaimFoundationRewardsProofStruct],