pub fn new_contracts(contracts: &Vec<String>) -> errors::Result<()> {
    let config_path = "ebox.json";
    let config_exist = utils::file_exist(config_path);
    let contract_dir = "contracts";
    let contract_dir_exist = utils::dir_exist(contract_dir);

    if !config_exist {
        return Err("ebox.json not found, consider init this project first".into());
    }

    if !contract_dir_exist {
        let _ = utils::dir_new(contract_dir)?;
    }

    let conf_str = utils::file_read(config_path)?;
    let conf = config_decode(&conf_str)?;
    let license = conf.project.license.as_str();

    for contract in contracts {
        let contract_name = contract.as_str();
        let sol = format!("{}/{}.sol", contract_dir, contract_name);
        let _ = utils::file_new(&sol, &solidity_new(contract_name, license));
    }

    Ok(())
}
// actions for create new contracts.
actions for create new contracts.
actions for create new contracts .
pub fn new_contracts(contracts: &Vec<String>) -> errors::Result<()> {
    let config_path = "ebox.json";
    let config_exist = utils::file_exist(config_path);
    let contract_dir = "contracts";
    let contract_dir_exist = utils::dir_exist(contract_dir);
    if !config_exist {
        return Err("ebox.json not found, consider init this project first".into());
    }
    if !contract_dir_exist {
        let _ = utils::dir_new(contract_dir)?;
    }
    let conf_str = utils::file_read(config_path)?;
    let conf = config_decode(&conf_str)?;
    let license = conf.project.license.as_str();
    for contract in contracts {
        let contract_name = contract.as_str();
        let sol = format!("{}/{}.sol", contract_dir, contract_name);
        let _ = utils::file_new(&sol, &solidity_new(contract_name, license));
    }
    Ok(())
}
pub fn new_contracts ( contracts : & Vec < String > ) -> errors :: Result < ( ) > { let config_path = " " ; let config_exist = utils :: file_exist ( config_path ) ; let contract_dir = " " ; let contract_dir_exist = utils :: dir_exist ( contract_dir ) ; if ! config_exist { return Err ( " " . into ( ) ) ; } if ! contract_dir_exist { let _ = utils :: dir_new ( contract_dir ) ? ; } let conf_str = utils :: file_read ( config_path ) ? ; let conf = config_decode ( & conf_str ) ? ; let license = conf . project . license . as_str ( ) ; for contract in contracts { let contract_name = contract . as_str ( ) ; let sol = format ! ( " " contract_dir contract_name ) ; let _ = utils :: file_new ( & sol , & solidity_new ( contract_name , license ) ) ; } Ok ( ( ) ) }
actions for create new contracts.
actions for create new contracts .
contracts
&Vec<String>