Skip to content

Commit

Permalink
Add Paseo config
Browse files Browse the repository at this point in the history
  • Loading branch information
vgantchev committed Aug 30, 2024
1 parent a1ed285 commit 64bd2ae
Show file tree
Hide file tree
Showing 6 changed files with 153 additions and 1 deletion.
17 changes: 17 additions & 0 deletions node/src/chain_spec/basilisk.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
// This file is part of pallet-asset-registry.

// Copyright (C) 2020-2022 Intergalactic, Limited (GIB).
// SPDX-License-Identifier: Apache-2.0

// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

use super::ChainSpec;

pub fn parachain_config() -> Result<ChainSpec, String> {
Expand Down
17 changes: 17 additions & 0 deletions node/src/chain_spec/local.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
// This file is part of pallet-asset-registry.

// Copyright (C) 2020-2022 Intergalactic, Limited (GIB).
// SPDX-License-Identifier: Apache-2.0

// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

use super::*;

const INITIAL_BALANCE: u128 = 10_000;
Expand Down
1 change: 1 addition & 0 deletions node/src/chain_spec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

pub mod basilisk;
pub mod local;
pub mod paseo;
pub mod rococo;

const PARA_ID: u32 = 2090;
Expand Down
98 changes: 98 additions & 0 deletions node/src/chain_spec/paseo.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
// This file is part of pallet-asset-registry.

// Copyright (C) 2020-2022 Intergalactic, Limited (GIB).
// SPDX-License-Identifier: Apache-2.0

// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

use super::*;

const INITIAL_BALANCE: u128 = 10_000;

pub fn parachain_config() -> Result<ChainSpec, String> {
let wasm_binary = WASM_BINARY.ok_or("Development wasm binary not available".to_string())?;

let mut properties = Map::new();
properties.insert("tokenDecimals".into(), TOKEN_DECIMALS.into());
properties.insert("tokenSymbol".into(), TOKEN_SYMBOL.into());

let genesis_json = parachain_genesis(
// initial_authorities
(
vec![
(
// 5CcMLZnK8RNMfurDsRXHwtabSKt8ZmG3ry5G3sAeRXfj4QK2
hex!["1822c7a002c35274bd5da15690e9d0027d9d189998990fcefd4458f768109a57"].into(),
hex!["1822c7a002c35274bd5da15690e9d0027d9d189998990fcefd4458f768109a57"].unchecked_into(),
),
(
// 5CfHZGU9iFpv2mRd9jBDu1VT6yNPFL3xsjnk971bsGBmuZ8x
hex!["1a5fc9b99feaac2b2dcb8473b1b8e5d641296394233685499b7222edceb40327"].into(),
hex!["1a5fc9b99feaac2b2dcb8473b1b8e5d641296394233685499b7222edceb40327"].unchecked_into(),
),
],
// candidacy bond
10_000 * UNITS,
),
// endowed_accounts
vec![
(
hex!["3418b257de81886bef265495f3609def9a083869f32ef5a03f7351956497d41a"].into(),
INITIAL_BALANCE,
), // sudo
(
hex!["1822c7a002c35274bd5da15690e9d0027d9d189998990fcefd4458f768109a57"].into(),
INITIAL_BALANCE,
), // collator-01
(
hex!["1a5fc9b99feaac2b2dcb8473b1b8e5d641296394233685499b7222edceb40327"].into(),
INITIAL_BALANCE,
), // collator-02
],
// council_members
vec![get_account_id_from_seed::<sr25519::Public>("Alice")],
// tech_committee_members
vec![hex!["3418b257de81886bef265495f3609def9a083869f32ef5a03f7351956497d41a"].into()], // same as sudo
// registered_assets
vec![
(b"KSM".to_vec(), 1_000u128, Some(1u32)),
(b"KUSD".to_vec(), 1_000u128, Some(2u32)),
],
// accepted_assets
vec![(1, Price::from_float(0.0000212)), (2, Price::from_float(0.000806))],
// token_balances
vec![],
// elections
vec![],
// parachain ID
PARA_ID.into(),
);

let chain_spec = ChainSpec::builder(
wasm_binary,
Extensions {
relay_chain: "rococo-local".into(),
para_id: PARA_ID,
},
)
.with_name("Basilisk Testnet (Rococo)")
.with_id("testnet_local")
.with_chain_type(ChainType::Local)
.with_boot_nodes(vec![])
.with_properties(properties)
.with_protocol_id(PROTOCOL_ID)
.with_genesis_config_patch(genesis_json)
.build();

Ok(chain_spec)
}
19 changes: 18 additions & 1 deletion node/src/chain_spec/rococo.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
// This file is part of pallet-asset-registry.

// Copyright (C) 2020-2022 Intergalactic, Limited (GIB).
// SPDX-License-Identifier: Apache-2.0

// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

use super::*;

const INITIAL_BALANCE: u128 = 10_000;
Expand Down Expand Up @@ -68,7 +85,7 @@ pub fn parachain_config() -> Result<ChainSpec, String> {
para_id: PARA_ID,
},
)
.with_name("Basilisk Testnet (Rococo)")
.with_name("Basilisk Testnet (Paseo)")
.with_id("testnet_local")
.with_chain_type(ChainType::Local)
.with_boot_nodes(vec![])
Expand Down
2 changes: 2 additions & 0 deletions node/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ fn load_spec(id: &str) -> std::result::Result<Box<dyn sc_service::ChainSpec>, St
Ok(match id {
"" => Box::new(chain_spec::basilisk::parachain_config()?),
"local" | "dev" => Box::new(chain_spec::local::parachain_config()?),
"paseo" => Box::new(chain_spec::paseo::parachain_config()?),
"rococo" => Box::new(chain_spec::rococo::parachain_config()?),
path => Box::new(chain_spec::ChainSpec::from_json_file(std::path::PathBuf::from(path))?),
})
Expand Down Expand Up @@ -78,6 +79,7 @@ impl SubstrateCli for Cli {
Ok(match id {
"basilisk" => Box::new(chain_spec::basilisk::parachain_config()?),
"local" | "dev" => Box::new(chain_spec::local::parachain_config()?),
"paseo" => Box::new(chain_spec::paseo::parachain_config()?),
"rococo" => Box::new(chain_spec::rococo::parachain_config()?),
path => Box::new(chain_spec::ChainSpec::from_json_file(std::path::PathBuf::from(path))?),
})
Expand Down

0 comments on commit 64bd2ae

Please sign in to comment.