Port lcli to stable futures

This commit is contained in:
pawan
2020-03-01 14:18:05 +05:30
committed by Age Manning
parent decd29adfb
commit 640251e7bc
6 changed files with 2876 additions and 2729 deletions

View File

@@ -1,12 +1,13 @@
use clap::ArgMatches;
use environment::Environment;
use eth1_test_rig::DepositContract;
use futures::compat::Future01CompatExt;
use std::fs::File;
use std::io::Read;
use types::EthSpec;
use web3::{transports::Http, Web3};
pub fn run<T: EthSpec>(mut env: Environment<T>, matches: &ArgMatches) -> Result<(), String> {
pub async fn run<T: EthSpec>(mut env: Environment<T>, matches: &ArgMatches) -> Result<(), String> {
let confirmations = matches
.value_of("confirmations")
.ok_or_else(|| "Confirmations not specified")?
@@ -32,9 +33,11 @@ pub fn run<T: EthSpec>(mut env: Environment<T>, matches: &ArgMatches) -> Result<
//
// We only need the deposit block to put a lower bound on the block number we need to search
// for deposit logs.
let deploy_block = env
.runtime()
.block_on(web3.eth().block_number())
let deploy_block = web3
.eth()
.block_number()
.compat()
.await
.map_err(|e| format!("Failed to get block number: {}", e))?;
info!("Present eth1 block number is {}", deploy_block);
@@ -46,13 +49,8 @@ pub fn run<T: EthSpec>(mut env: Environment<T>, matches: &ArgMatches) -> Result<
confirmations
);
let deposit_contract = env
.runtime()
.block_on(DepositContract::deploy_testnet(
web3,
confirmations,
password,
))
let deposit_contract = DepositContract::deploy_testnet(web3, confirmations, password)
.await
.map_err(|e| format!("Failed to deploy contract: {}", e))?;
info!(