async fn wait_for_eth_balance(
        &self,
        current_balance: BigUint,
        withdraw_amount: BigUint,
    ) -> Result<(), failure::Error> {
        log::info!("Awaiting for ETH funds to be received");

        let expected_balance = current_balance + withdraw_amount;

        let timeout_minutes = 10;
        let timeout = Duration::from_secs(timeout_minutes * 60);
        let start = Instant::now();

        let polling_interval = Duration::from_millis(250);
        let mut timer = time::interval(polling_interval);

        loop {
            let current_balance = self.main_account.eth_acc.eth_balance().await?;
            if current_balance == expected_balance {
                break;
            }
            if start.elapsed() > timeout {
                failure::bail!(
                    "ETH funds were not received for {} minutes",
                    timeout_minutes
                );
            }
            timer.tick().await;
        }

        log::info!("ETH funds received");
        Ok(())
    }
/// Waits for main ETH account to receive funds on its balance.
/// Returns an error if funds are not received within a reasonable amount of time.
Waits for main ETH account to receive funds on its balance.
Returns an error if funds are not received within a reasonable amount of time.
Waits for main ETH account to receive funds on its balance . Returns an error if funds are not received within a reasonable amount of time .
async fn wait_for_eth_balance(
        &self,
        current_balance: BigUint,
        withdraw_amount: BigUint,
    ) -> Result<(), failure::Error> {
        log::info!("Awaiting for ETH funds to be received");
        let expected_balance = current_balance + withdraw_amount;
        let timeout_minutes = 10;
        let timeout = Duration::from_secs(timeout_minutes * 60);
        let start = Instant::now();
        let polling_interval = Duration::from_millis(250);
        let mut timer = time::interval(polling_interval);
        loop {
            let current_balance = self.main_account.eth_acc.eth_balance().await?;
            if current_balance == expected_balance {
                break;
            }
            if start.elapsed() > timeout {
                failure::bail!(
                    "ETH funds were not received for {} minutes",
                    timeout_minutes
                );
            }
            timer.tick().await;
        }
        log::info!("ETH funds received");
        Ok(())
    }
async fn wait_for_eth_balance ( & self , current_balance : BigUint , withdraw_amount : BigUint , ) -> Result < ( ) , failure :: Error > { log :: info ! ( " " ) ; let expected_balance = current_balance + withdraw_amount ; let timeout_minutes = 10 ; let timeout = Duration :: from_secs ( timeout_minutes * 60 ) ; let start = Instant :: now ( ) ; let polling_interval = Duration :: from_millis ( 250 ) ; let mut timer = time :: interval ( polling_interval ) ; loop { let current_balance = self . main_account . eth_acc . eth_balance ( ) . await ? ; if current_balance == expected_balance { break ; } if start . elapsed ( ) > timeout { failure :: bail ! ( " " timeout_minutes ) ; } timer . tick ( ) . await ; } log :: info ! ( " " ) ; Ok ( ( ) ) }
Waits for main ETH account to receive funds on its balance.
Waits for main ETH account to receive funds on its balance .
&self
current_balance
BigUint
withdraw_amount
BigUint