From 73f8e683417ffdfe460d39b9458f5ff9486e6651 Mon Sep 17 00:00:00 2001 From: str-mv <51784859+str-mv@users.noreply.github.com> Date: Tue, 22 Dec 2020 15:13:55 +0000 Subject: [PATCH] Merge pull request #45 from usetech-llc/feature/chain_spec_token_vesting Add chain spec entries for system properties and vesting --- --- a/Cargo.lock +++ b/Cargo.lock @@ -3522,6 +3522,8 @@ "sc-rpc-api", "sc-service", "sc-transaction-pool", + "serde", + "serde_json", "sp-api", "sp-block-builder", "sp-blockchain", --- a/node/Cargo.toml +++ b/node/Cargo.toml @@ -58,6 +58,9 @@ substrate-frame-rpc-system = {version = '2.0.0', git = 'https://github.com/usetech-llc/substrate.git', branch = 'release_flexi'} pallet-contracts-rpc = {version = '0.8.0', git = 'https://github.com/usetech-llc/substrate.git', branch = 'release_flexi'} +serde = { version = "1.0.102", features = ["derive"] } +serde_json = "1.0.41" + [features] default = [] runtime-benchmarks = ['nft-runtime/runtime-benchmarks'] --- a/node/src/chain_spec.rs +++ b/node/src/chain_spec.rs @@ -9,6 +9,7 @@ use sp_core::{sr25519, Pair, Public}; use sp_finality_grandpa::AuthorityId as GrandpaId; use sp_runtime::traits::{IdentifyAccount, Verify}; +use serde_json::map::Map; // Note this is the URL for the telemetry server //const STAGING_TELEMETRY_URL: &str = "wss://telemetry.polkadot.io/submit/"; @@ -41,6 +42,11 @@ pub fn development_config() -> Result { let wasm_binary = WASM_BINARY.ok_or("Development wasm binary not available".to_string())?; + let mut properties = Map::new(); + properties.insert("tokenSymbol".into(), "UniqueTest".into()); + properties.insert("tokenDecimals".into(), 15.into()); + properties.insert("ss58Format".into(), 0.into()); + Ok(ChainSpec::from_genesis( // Name "Development", @@ -71,7 +77,7 @@ // Protocol ID None, // Properties - None, + Some(properties), // Extensions None, )) @@ -132,6 +138,11 @@ endowed_accounts: Vec, enable_println: bool, ) -> GenesisConfig { + + let vested_accounts = vec![ + get_account_id_from_seed::("Bob"), + ]; + GenesisConfig { system: Some(SystemConfig { code: wasm_binary.to_vec(), @@ -155,7 +166,13 @@ }), pallet_treasury: Some(Default::default()), pallet_sudo: Some(SudoConfig { key: root_key }), - pallet_vesting: Some(Default::default()), + pallet_vesting: Some(VestingConfig { + vesting: vested_accounts + .iter() + .cloned() + .map(|k| (k, 1000, 100, 1 << 98)) + .collect(), + }), pallet_nft: Some(NftConfig { collection: vec![( 1, -- gitstuff