Lines
44.44 %
Functions
8.33 %
Branches
100 %
// Copyright (C) Moondance Labs Ltd.
// This file is part of Tanssi.
// Tanssi is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Tanssi is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Tanssi. If not, see <http://www.gnu.org/licenses/>.
use {
container_chain_template_frontier_runtime::{
genesis_config_presets::{development, local},
AccountId,
},
cumulus_primitives_core::ParaId,
hex_literal::hex,
node_common::chain_spec::Extensions,
sc_network::config::MultiaddrWithPeerId,
sc_service::ChainType,
};
/// Specialized `ChainSpec` for the normal parachain runtime.
pub type ChainSpec = sc_service::GenericChainSpec<Extensions>;
pub fn development_config(para_id: ParaId, boot_nodes: Vec<String>) -> ChainSpec {
// Give your base currency a unit name and decimal places
let mut properties = sc_chain_spec::Properties::new();
properties.insert("tokenSymbol".into(), "UNIT".into());
properties.insert("tokenDecimals".into(), 18.into());
properties.insert("ss58Format".into(), 42.into());
properties.insert("isEthereum".into(), true.into());
let mut default_funded_accounts =
container_chain_template_frontier_runtime::genesis_config_presets::pre_funded_accounts();
default_funded_accounts.sort();
default_funded_accounts.dedup();
let boot_nodes: Vec<MultiaddrWithPeerId> = boot_nodes
.into_iter()
.map(|x| {
x.parse::<MultiaddrWithPeerId>()
.unwrap_or_else(|e| panic!("invalid bootnode address format {:?}: {:?}", x, e))
})
.collect();
ChainSpec::builder(
container_chain_template_frontier_runtime::WASM_BINARY
.expect("WASM binary was not built, please build it!"),
Extensions {
relay_chain: "rococo-local".into(), // You MUST set this to the correct network!
para_id: para_id.into(),
)
.with_name("Development")
.with_id("dev")
.with_chain_type(ChainType::Development)
.with_genesis_config(development(
default_funded_accounts.clone(),
para_id,
AccountId::from(hex!("f24FF3a9CF04c71Dbc94D0b566f7A27B94566cac")), // Alith
))
.with_properties(properties)
.with_boot_nodes(boot_nodes)
.build()
}
pub fn local_testnet_config(para_id: ParaId, boot_nodes: Vec<String>) -> ChainSpec {
let protocol_id = format!("container-chain-{}", para_id);
.with_name(&format!("Frontier Container {}", para_id))
.with_id(&format!("frontier_container_{}", para_id))
.with_chain_type(ChainType::Local)
.with_genesis_config(local(
.with_protocol_id(&protocol_id)