@@ -87,7 +87,45 @@ def update_validator_set(self, args):
8787 self .ton .PoolUpdateValidatorSet (pool_addr , wallet )
8888 color_print ("UpdateValidatorSet - {green}OK{endc}" )
8989
90+ def do_deposit_to_pool (self , pool_addr , amount ):
91+ wallet = self .ton .GetValidatorWallet ()
92+ bocPath = self .ton .local .buffer .my_temp_dir + wallet .name + "validator-deposit-query.boc"
93+ fiftScript = self .ton .contractsDir + "nominator-pool/func/validator-deposit.fif"
94+ args = [fiftScript , bocPath ]
95+ result = self .ton .fift .Run (args )
96+ resultFilePath = self .ton .SignBocWithWallet (wallet , bocPath , pool_addr , amount )
97+ self .ton .SendFile (resultFilePath , wallet )
98+
99+ def deposit_to_pool (self , args ):
100+ try :
101+ poll_addr = args [0 ]
102+ amount = float (args [1 ])
103+ except :
104+ color_print ("{red}Bad args. Usage:{endc} deposit_to_pool <pool-addr> <amount>" )
105+ return
106+ self .do_deposit_to_pool (poll_addr , amount )
107+ color_print ("DepositToPool - {green}OK{endc}" )
108+
109+ def do_withdraw_from_pool (self , pool_addr , amount ):
110+ pool_data = self .ton .GetPoolData (pool_addr )
111+ if pool_data ["state" ] == 0 :
112+ self .ton .WithdrawFromPoolProcess (pool_addr , amount )
113+ else :
114+ self .ton .PendWithdrawFromPool (pool_addr , amount )
115+
116+ def withdraw_from_pool (self , args ):
117+ try :
118+ pool_addr = args [0 ]
119+ amount = float (args [1 ])
120+ except :
121+ color_print ("{red}Bad args. Usage:{endc} withdraw_from_pool <pool-addr> <amount>" )
122+ return
123+ self .do_withdraw_from_pool (pool_addr , amount )
124+ color_print ("WithdrawFromPool - {green}OK{endc}" )
125+
90126 def add_console_commands (self , console ):
91127 console .AddItem ("new_pool" , self .new_pool , self .local .translate ("new_pool_cmd" ))
92128 console .AddItem ("activate_pool" , self .activate_pool , self .local .translate ("activate_pool_cmd" ))
93129 console .AddItem ("update_validator_set" , self .update_validator_set , self .local .translate ("update_validator_set_cmd" ))
130+ console .AddItem ("withdraw_from_pool" , self .withdraw_from_pool , self .local .translate ("withdraw_from_pool_cmd" ))
131+ console .AddItem ("deposit_to_pool" , self .deposit_to_pool , self .local .translate ("deposit_to_pool_cmd" ))
0 commit comments