git.delta.rocks / unique-network / refs/commits / 73f8e683417f

difftreelog

Merge pull request #45 from usetech-llc/feature/chain_spec_token_vesting

str-mv2020-12-22parents: #cf6c066 #0032fbb.patch.diff
in: master
Add chain spec entries for system properties and vesting

3 files changed

modifiedCargo.lockdiffbeforeafterboth
--- 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",
modifiednode/Cargo.tomldiffbeforeafterboth
58substrate-frame-rpc-system = {version = '2.0.0', git = 'https://github.com/usetech-llc/substrate.git', branch = 'release_flexi'}58substrate-frame-rpc-system = {version = '2.0.0', git = 'https://github.com/usetech-llc/substrate.git', branch = 'release_flexi'}
59pallet-contracts-rpc = {version = '0.8.0', git = 'https://github.com/usetech-llc/substrate.git', branch = 'release_flexi'} 59pallet-contracts-rpc = {version = '0.8.0', git = 'https://github.com/usetech-llc/substrate.git', branch = 'release_flexi'}
60
61serde = { version = "1.0.102", features = ["derive"] }
62serde_json = "1.0.41"
6063
61[features]64[features]
62default = []65default = []
modifiednode/src/chain_spec.rsdiffbeforeafterboth
--- 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<ChainSpec, String> {
 	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<AccountId>,
     enable_println: bool,
 ) -> GenesisConfig {
+
+	let vested_accounts = vec![
+		get_account_id_from_seed::<sr25519::Public>("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,