async fn withdraw(&mut self) -> Result<(), failure::Error> {
        let current_balance = self.main_account.eth_acc.eth_balance().await?;

        let fee = self.withdraw_fee(&self.main_account.zk_acc).await;

        let comitted_account_state = self
            .rpc_client
            .account_state_info(self.main_account.zk_acc.address)
            .await?
            .committed;
        let account_balance = comitted_account_state.balances["ETH"].0.clone();
        let withdraw_amount = &account_balance - &fee;
        let withdraw_amount = closest_packable_token_amount(&withdraw_amount);

        log::info!(
            "Starting withdrawing phase. Withdrawing {} ETH back to the Ethereum",
            format_ether(&withdraw_amount)
        );

        let (tx, eth_sign) = self
            .main_account
            .sign_withdraw(withdraw_amount.clone(), fee);
        let tx_hash = self
            .rpc_client
            .send_tx(tx.clone(), eth_sign.clone())
            .await?;
        let mut sent_txs = SentTransactions::new();
        sent_txs.add_tx_hash(tx_hash);

        wait_for_verify(sent_txs, self.verify_timeout, &self.rpc_client).await?;

        log::info!("Withdrawing funds completed");

        self.wait_for_eth_balance(current_balance, withdraw_amount)
            .await?;

        Ok(())
    }
/// Withdraws the money from the main account back to the Ethereum.
Withdraws the money from the main account back to the Ethereum.
Withdraws the money from the main account back to the Ethereum .
async fn withdraw(&mut self) -> Result<(), failure::Error> {
        let current_balance = self.main_account.eth_acc.eth_balance().await?;
        let fee = self.withdraw_fee(&self.main_account.zk_acc).await;
        let comitted_account_state = self
            .rpc_client
            .account_state_info(self.main_account.zk_acc.address)
            .await?
            .committed;
        let account_balance = comitted_account_state.balances["ETH"].0.clone();
        let withdraw_amount = &account_balance - &fee;
        let withdraw_amount = closest_packable_token_amount(&withdraw_amount);
        log::info!(
            "Starting withdrawing phase. Withdrawing {} ETH back to the Ethereum",
            format_ether(&withdraw_amount)
        );
        let (tx, eth_sign) = self
            .main_account
            .sign_withdraw(withdraw_amount.clone(), fee);
        let tx_hash = self
            .rpc_client
            .send_tx(tx.clone(), eth_sign.clone())
            .await?;
        let mut sent_txs = SentTransactions::new();
        sent_txs.add_tx_hash(tx_hash);
        wait_for_verify(sent_txs, self.verify_timeout, &self.rpc_client).await?;
        log::info!("Withdrawing funds completed");
        self.wait_for_eth_balance(current_balance, withdraw_amount)
            .await?;
        Ok(())
    }
async fn withdraw ( & mut self ) -> Result < ( ) , failure :: Error > { let current_balance = self . main_account . eth_acc . eth_balance ( ) . await ? ; let fee = self . withdraw_fee ( & self . main_account . zk_acc ) . await ; let comitted_account_state = self . rpc_client . account_state_info ( self . main_account . zk_acc . address ) . await ? . committed ; let account_balance = comitted_account_state . balances [ " " ] . 0 . clone ( ) ; let withdraw_amount = & account_balance - & fee ; let withdraw_amount = closest_packable_token_amount ( & withdraw_amount ) ; log :: info ! ( " " format_ether ( withdraw_amount ) ) ; let ( tx , eth_sign ) = self . main_account . sign_withdraw ( withdraw_amount . clone ( ) , fee ) ; let tx_hash = self . rpc_client . send_tx ( tx . clone ( ) , eth_sign . clone ( ) ) . await ? ; let mut sent_txs = SentTransactions :: new ( ) ; sent_txs . add_tx_hash ( tx_hash ) ; wait_for_verify ( sent_txs , self . verify_timeout , & self . rpc_client ) . await ? ; log :: info ! ( " " ) ; self . wait_for_eth_balance ( current_balance , withdraw_amount ) . await ? ; Ok ( ( ) ) }
Withdraws the money from the main account back to the Ethereum.
Withdraws the money from the main account back to the Ethereum .
&mut self