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

Commit

Permalink
FM-347: expose pre-fund command
Browse files Browse the repository at this point in the history
  • Loading branch information
adlrocha committed Nov 2, 2023
1 parent 97d5e06 commit f2da320
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
4 changes: 2 additions & 2 deletions ipc/cli/src/commands/subnet/join.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,13 +179,13 @@ impl CommandLineHandler for PreFundSubnet {
#[derive(Debug, Args)]
#[command(
name = "pre-fund",
about = "Pre fund with some funds in genesis in a child-subnet"
about = "Add some funds in genesis to an address in a child-subnet"
)]
pub struct PreFundSubnetArgs {
#[arg(long, short, help = "The address funded in the subnet")]
pub from: Option<String>,
#[arg(long, short, help = "The subnet to add balance to")]
pub subnet: String,
#[arg(help = "Optionally add an initial balance to the validator in genesis in the subnet")]
#[arg(help = "Add an initial balance for the address in genesis in the subnet")]
pub initial_balance: f64,
}
7 changes: 6 additions & 1 deletion ipc/cli/src/commands/subnet/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ use crate::{CommandLineHandler, GlobalArguments};
use clap::{Args, Subcommand};

use self::bootstrap::{AddBootstrap, AddBootstrapArgs, ListBootstraps, ListBootstrapsArgs};
use self::join::{StakeSubnet, StakeSubnetArgs, UnstakeSubnet, UnstakeSubnetArgs};
use self::join::{
PreFundSubnet, PreFundSubnetArgs, StakeSubnet, StakeSubnetArgs, UnstakeSubnet,
UnstakeSubnetArgs,
};
use self::leave::{Claim, ClaimArgs};
use self::rpc::{ChainIdSubnet, ChainIdSubnetArgs};

Expand Down Expand Up @@ -55,6 +58,7 @@ impl SubnetCommandsArgs {
Commands::AddBootstrap(args) => AddBootstrap::handle(global, args).await,
Commands::ListBootstraps(args) => ListBootstraps::handle(global, args).await,
Commands::GenesisEpoch(args) => GenesisEpoch::handle(global, args).await,
Commands::PreFund(args) => PreFundSubnet::handle(global, args).await,
}
}
}
Expand All @@ -75,4 +79,5 @@ pub(crate) enum Commands {
AddBootstrap(AddBootstrapArgs),
ListBootstraps(ListBootstrapsArgs),
GenesisEpoch(GenesisEpochArgs),
PreFund(PreFundSubnetArgs),
}
2 changes: 1 addition & 1 deletion ipc/provider/src/manager/evm/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ impl SubnetManager for EthSubnetManager {
let balance = balance
.atto()
.to_u128()
.ok_or_else(|| anyhow!("invalid min validator stake"))?;
.ok_or_else(|| anyhow!("invalid initial balance"))?;

let address = contract_address_from_subnet(&subnet)?;
log::info!("interacting with evm subnet contract: {address:} with balance: {balance:}");
Expand Down

0 comments on commit f2da320

Please sign in to comment.