Skip to content

Commit

Permalink
added token decimals and token name to chainspec (#131)
Browse files Browse the repository at this point in the history
* added decimals and token name to chainspec

* refactor

* linting

* more linting

* linting

* linting

* Update src/chain_spec.rs

Co-Authored-By: Mudit Gupta <guptamudit@ymail.com>
  • Loading branch information
JesseAbram and maxsam4 committed Nov 28, 2019
1 parent 7e3fb42 commit a210eb8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ futures = "0.1.29"
exit-future = "0.1.4"
slog = "2.5.2"
hex-literal = "0.2.1"
serde_json = '1.0.0'
polymesh-runtime = { path = "runtime" }
polymesh-primitives = { path = "primitives" }
sr-io = { git = "https://github.com/paritytech/substrate", rev = "7d7e74fb77b6bee2ce9d6ebafcae09caff2d0e50" }
Expand Down
15 changes: 12 additions & 3 deletions src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ use polymesh_runtime::{
StakerStatus, StakingConfig, SudoConfig, SystemConfig, WASM_BINARY,
};
use primitives::{Pair, Public};
use serde_json::json;
use substrate_service::Properties;

/// Specialized `ChainSpec`. This is a specialization of the general Substrate ChainSpec type.
pub type ChainSpec = substrate_service::ChainSpec<GenesisConfig>;
Expand Down Expand Up @@ -73,7 +75,7 @@ impl Alternative {
None,
None,
None,
None,
Some(polymath_props()),
),
Alternative::LocalTestnet => ChainSpec::from_genesis(
"Local Testnet",
Expand Down Expand Up @@ -108,7 +110,7 @@ impl Alternative {
None,
None,
None,
None,
Some(polymath_props()),
),
Alternative::StatsTestnet => ChainSpec::from_genesis(
"Stats Testnet",
Expand Down Expand Up @@ -142,7 +144,7 @@ impl Alternative {
None,
None,
None,
None,
Some(polymath_props()),
),
})
}
Expand All @@ -157,6 +159,13 @@ impl Alternative {
}
}

fn polymath_props() -> Properties {
json!({"tokenDecimals": 6, "tokenSymbol": "POLY" })
.as_object()
.unwrap()
.clone()
}

fn session_keys(grandpa: GrandpaId, babe: BabeId, im_online: ImOnlineId) -> SessionKeys {
SessionKeys {
babe,
Expand Down

0 comments on commit a210eb8

Please sign in to comment.