-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
96 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Copyright (c) RoochNetwork | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
use crate::{cli_types::WalletContextOptions, commands::statedb::commands::init_statedb}; | ||
use clap::Parser; | ||
use rooch_genesis::RoochGenesis; | ||
use rooch_types::{chain_id::RoochChainID, error::RoochResult}; | ||
use std::path::PathBuf; | ||
|
||
/// Init genesis statedb | ||
#[derive(Debug, Parser)] | ||
pub struct InitCommand { | ||
#[clap(long = "data-dir", short = 'd')] | ||
/// Path to data dir, this dir is base dir, the final data_dir is base_dir/chain_network_name | ||
pub base_data_dir: Option<PathBuf>, | ||
|
||
/// If local chainid, start the service with a temporary data store. | ||
/// All data will be deleted when the service is stopped. | ||
#[clap(long, short = 'n', help = R_OPT_NET_HELP)] | ||
pub chain_id: Option<RoochChainID>, | ||
|
||
#[clap(flatten)] | ||
pub context_options: WalletContextOptions, | ||
} | ||
|
||
impl InitCommand { | ||
pub async fn execute(self) -> RoochResult<()> { | ||
let mut _context = self.context_options.build()?; | ||
let (root, statedb) = init_statedb(self.base_data_dir.clone(), self.chain_id.clone())?; | ||
//RoochGenesis::build(genesis_ctx, bitcoin_genesis_ctx) | ||
todo!() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// Copyright (c) RoochNetwork | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
pub mod init; | ||
pub mod rebase; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Copyright (c) RoochNetwork | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
use crate::{cli_types::WalletContextOptions, commands::statedb::commands::init_statedb}; | ||
use clap::Parser; | ||
use rooch_genesis::RoochGenesis; | ||
use rooch_types::{chain_id::RoochChainID, error::RoochResult}; | ||
use std::path::PathBuf; | ||
|
||
/// Rebase the genesis | ||
#[derive(Debug, Parser)] | ||
pub struct RebaseCommand { | ||
#[clap(long = "data-dir", short = 'd')] | ||
/// Path to data dir, this dir is base dir, the final data_dir is base_dir/chain_network_name | ||
pub base_data_dir: Option<PathBuf>, | ||
|
||
/// If local chainid, start the service with a temporary data store. | ||
/// All data will be deleted when the service is stopped. | ||
#[clap(long, short = 'n', help = R_OPT_NET_HELP)] | ||
pub chain_id: Option<RoochChainID>, | ||
|
||
#[clap(flatten)] | ||
pub context_options: WalletContextOptions, | ||
} | ||
|
||
impl RebaseCommand { | ||
pub async fn execute(self) -> RoochResult<()> { | ||
let mut _context = self.context_options.build()?; | ||
let (root, statedb) = init_statedb(self.base_data_dir.clone(), self.chain_id.clone())?; | ||
//RoochGenesis::build(genesis_ctx, bitcoin_genesis_ctx) | ||
todo!() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Copyright (c) RoochNetwork | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
use self::commands::init::InitCommand; | ||
use self::commands::rebase::RebaseCommand; | ||
use crate::cli_types::CommandAction; | ||
use async_trait::async_trait; | ||
use clap::Parser; | ||
|
||
pub mod commands; | ||
|
||
/// Statedb Commands | ||
#[derive(Parser)] | ||
pub struct Genesis { | ||
#[clap(subcommand)] | ||
cmd: GenesisCommand, | ||
} | ||
|
||
#[derive(clap::Subcommand)] | ||
#[clap(name = "genesis")] | ||
pub enum GenesisCommand { | ||
Init(InitCommand), | ||
Rebase(RebaseCommand), | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters