nado-protocol 0.1.1__py3-none-any.whl → 0.1.3__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/client/__init__.py +11 -2
- nado_protocol/client/apis/market/execute.py +10 -26
- nado_protocol/client/apis/market/query.py +2 -2
- nado_protocol/client/apis/rewards/execute.py +27 -27
- nado_protocol/client/apis/rewards/query.py +5 -4
- nado_protocol/client/apis/subaccount/query.py +1 -1
- nado_protocol/client/context.py +0 -2
- nado_protocol/contracts/__init__.py +41 -33
- nado_protocol/contracts/abis/Endpoint.json +151 -228
- nado_protocol/contracts/abis/FQuerier.json +91 -508
- nado_protocol/contracts/abis/IAirdrop.json +76 -0
- nado_protocol/contracts/abis/IClearinghouse.json +277 -390
- nado_protocol/contracts/abis/IEndpoint.json +42 -80
- nado_protocol/contracts/abis/IPerpEngine.json +69 -422
- nado_protocol/contracts/abis/IProductEngine.json +87 -205
- nado_protocol/contracts/abis/ISpotEngine.json +173 -362
- nado_protocol/contracts/abis/MockERC20.json +1 -1
- nado_protocol/contracts/deployments/{deployment.test.json → deployment.testing.json} +2 -5
- nado_protocol/contracts/deployments/deployment.testnet.json +15 -0
- nado_protocol/contracts/eip712/types.py +15 -20
- nado_protocol/contracts/types.py +15 -13
- nado_protocol/engine_client/execute.py +18 -39
- nado_protocol/engine_client/query.py +1 -1
- nado_protocol/engine_client/types/__init__.py +4 -8
- nado_protocol/engine_client/types/execute.py +37 -103
- nado_protocol/engine_client/types/models.py +3 -59
- nado_protocol/engine_client/types/query.py +3 -6
- nado_protocol/indexer_client/query.py +4 -9
- nado_protocol/indexer_client/types/__init__.py +4 -5
- nado_protocol/indexer_client/types/models.py +16 -23
- nado_protocol/indexer_client/types/query.py +12 -11
- nado_protocol/trigger_client/execute.py +1 -1
- nado_protocol/trigger_client/types/execute.py +3 -1
- nado_protocol/utils/__init__.py +18 -1
- nado_protocol/utils/backend.py +5 -2
- nado_protocol/utils/exceptions.py +3 -3
- nado_protocol/utils/execute.py +26 -67
- nado_protocol/utils/expiration.py +7 -28
- nado_protocol/utils/nonce.py +0 -4
- nado_protocol/utils/order.py +356 -0
- {nado_protocol-0.1.1.dist-info → nado_protocol-0.1.3.dist-info}/METADATA +4 -2
- nado_protocol-0.1.3.dist-info/RECORD +78 -0
- {nado_protocol-0.1.1.dist-info → nado_protocol-0.1.3.dist-info}/entry_points.txt +0 -1
- nado_protocol/contracts/abis/IERC20.json +0 -185
- nado_protocol/contracts/abis/IOffchainBook.json +0 -536
- nado_protocol/contracts/abis/IVrtxAirdrop.json +0 -138
- nado_protocol-0.1.1.dist-info/RECORD +0 -78
- {nado_protocol-0.1.1.dist-info → nado_protocol-0.1.3.dist-info}/WHEEL +0 -0
nado_protocol/client/__init__.py
CHANGED
|
@@ -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
|
-
|
|
129
|
-
|
|
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
|
-
|
|
2
|
+
BurnNlpParams,
|
|
3
3
|
CancelAndPlaceParams,
|
|
4
4
|
CancelOrdersParams,
|
|
5
5
|
CancelProductOrdersParams,
|
|
6
6
|
ExecuteResponse,
|
|
7
|
-
|
|
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
|
|
34
|
+
def mint_nlp(self, params: MintNlpParams) -> ExecuteResponse:
|
|
36
35
|
"""
|
|
37
|
-
Mint
|
|
36
|
+
Mint NLP tokens through the engine.
|
|
38
37
|
|
|
39
38
|
Args:
|
|
40
|
-
params (
|
|
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.
|
|
47
|
+
return self.context.engine_client.mint_nlp(params)
|
|
49
48
|
|
|
50
|
-
def
|
|
49
|
+
def burn_nlp(self, params: BurnNlpParams) -> ExecuteResponse:
|
|
51
50
|
"""
|
|
52
|
-
Burn
|
|
51
|
+
Burn NLP tokens through the engine.
|
|
53
52
|
|
|
54
53
|
Args:
|
|
55
|
-
params (
|
|
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.
|
|
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
|
|
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.
|
|
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
|
-
|
|
6
|
-
|
|
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
|
|
11
|
+
from nado_protocol.utils.exceptions import InvalidTokenClaimParams
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
class RewardsExecuteAPI(NadoBaseAPI):
|
|
15
|
-
def _validate_claim_params(self, params:
|
|
16
|
-
p =
|
|
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
|
|
18
|
+
raise InvalidTokenClaimParams()
|
|
19
19
|
|
|
20
|
-
def
|
|
21
|
-
self, params:
|
|
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.
|
|
26
|
-
return self.context.contracts.
|
|
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
|
|
35
|
-
self, params:
|
|
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.
|
|
40
|
-
return self.context.contracts.
|
|
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
|
|
48
|
+
def stake(self, amount: int, signer: Optional[LocalAccount] = None) -> str:
|
|
49
49
|
signer = self._get_signer(signer)
|
|
50
|
-
return self.context.contracts.
|
|
50
|
+
return self.context.contracts.stake(amount, signer)
|
|
51
51
|
|
|
52
|
-
def
|
|
52
|
+
def unstake(self, amount: int, signer: Optional[LocalAccount] = None) -> str:
|
|
53
53
|
signer = self._get_signer(signer)
|
|
54
|
-
return self.context.contracts.
|
|
54
|
+
return self.context.contracts.unstake(amount, signer)
|
|
55
55
|
|
|
56
|
-
def
|
|
56
|
+
def withdraw_unstaked(self, signer: Optional[LocalAccount] = None):
|
|
57
57
|
signer = self._get_signer(signer)
|
|
58
|
-
return self.context.contracts.
|
|
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
|
|
79
|
-
self, params:
|
|
80
|
-
) ->
|
|
81
|
-
epoch_merkle_proofs = self.context.indexer_client.
|
|
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.
|
|
89
|
-
amount_claimed = self.context.contracts.
|
|
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
|
|
93
|
+
return ClaimTokensContractParams(
|
|
94
94
|
epoch=params.epoch,
|
|
95
95
|
amount_to_claim=amount_to_claim,
|
|
96
96
|
total_claimable_amount=total_claimable_amount,
|
|
@@ -2,11 +2,12 @@ from nado_protocol.client.apis.base import NadoBaseAPI
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
class RewardsQueryAPI(NadoBaseAPI):
|
|
5
|
-
|
|
5
|
+
# TODO: revise once staking contract is deployed
|
|
6
|
+
def get_claim_and_stake_estimated_tokens(self, wallet: str) -> int:
|
|
6
7
|
"""
|
|
7
|
-
Estimates the amount of USDC ->
|
|
8
|
+
Estimates the amount of USDC -> TOKEN swap when claiming + staking USDC rewards
|
|
8
9
|
"""
|
|
9
|
-
assert self.context.contracts.
|
|
10
|
-
return self.context.contracts.
|
|
10
|
+
assert self.context.contracts.staking is not None
|
|
11
|
+
return self.context.contracts.staking.functions.getEstimatedTokensToStake(
|
|
11
12
|
wallet
|
|
12
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
|
|
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.
|
nado_protocol/client/context.py
CHANGED
|
@@ -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
|
-
|
|
36
|
+
airdrop_addr (Optional[str]): The airdrop address. This may be None.
|
|
37
37
|
|
|
38
|
-
|
|
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:
|
|
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
|
-
|
|
50
|
-
|
|
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
|
-
|
|
68
|
-
|
|
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.
|
|
117
|
-
self.
|
|
118
|
-
address=self.contracts_context.
|
|
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.
|
|
123
|
-
self.
|
|
124
|
-
address=self.contracts_context.
|
|
125
|
-
abi=load_abi(NadoAbiName.
|
|
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
|
-
|
|
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.
|
|
203
|
+
assert self.airdrop is not None
|
|
203
204
|
return self.execute(
|
|
204
|
-
self.
|
|
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
|
-
|
|
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.
|
|
220
|
+
assert self.airdrop is not None
|
|
219
221
|
return self.execute(
|
|
220
|
-
self.
|
|
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
|
-
|
|
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.
|
|
234
|
+
assert self.staking is not None
|
|
232
235
|
return self.execute(
|
|
233
|
-
self.
|
|
236
|
+
self.staking.functions.stake(amount),
|
|
234
237
|
signer,
|
|
235
238
|
)
|
|
236
239
|
|
|
237
|
-
|
|
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.
|
|
246
|
+
assert self.staking is not None
|
|
243
247
|
return self.execute(
|
|
244
|
-
self.
|
|
248
|
+
self.staking.functions.withdraw(amount),
|
|
245
249
|
signer,
|
|
246
250
|
)
|
|
247
251
|
|
|
248
|
-
|
|
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.
|
|
257
|
+
assert self.staking is not None
|
|
253
258
|
return self.execute(
|
|
254
|
-
self.
|
|
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.
|
|
268
|
+
assert self.staking is not None
|
|
263
269
|
return self.execute(
|
|
264
|
-
self.
|
|
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.
|
|
279
|
+
assert self.staking is not None
|
|
273
280
|
return self.execute(
|
|
274
|
-
self.
|
|
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],
|