Skip to content
This repository has been archived by the owner on Jan 11, 2024. It is now read-only.

Commit

Permalink
fmt code
Browse files Browse the repository at this point in the history
  • Loading branch information
cryptoAtwill committed Nov 29, 2023
1 parent 6a0d12b commit 3ff5b3f
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions ipc/cli/src/commands/subnet/join.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
// SPDX-License-Identifier: MIT
//! Join subnet cli command handler.
use anyhow::anyhow;
use async_trait::async_trait;
use clap::Args;
use ipc_sdk::subnet_id::SubnetID;
use num_traits::Zero;
use std::{fmt::Debug, str::FromStr};

use crate::{
Expand All @@ -31,9 +33,19 @@ impl CommandLineHandler for JoinSubnet {
let public_key = hex::decode(&arguments.public_key)?;
if let Some(initial_balance) = arguments.initial_balance {
log::info!("pre-funding address with {initial_balance}");
provider
.pre_fund(subnet.clone(), from, f64_to_token_amount(initial_balance)?)
.await?;
if initial_balance.is_zero() {
return Err(anyhow!("not enough balance"));
}
let amount = f64_to_token_amount(initial_balance)?;
if let Err(e) = provider
.pre_fund(subnet.clone(), from, amount.clone())
.await
{
log::info!("pre fund failed with: {}, attend to fund to self", e);
provider
.fund(subnet.clone(), None, from, from, amount)
.await?;
}
}
let epoch = provider
.join_subnet(
Expand Down

0 comments on commit 3ff5b3f

Please sign in to comment.