Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
resolve conflicts for bifrost-polkadot runtime
  • Loading branch information
herryho committed Dec 10, 2021
commit d82967a17ffb0c1e0fc89a5c463685ccc922266e
6 changes: 1 addition & 5 deletions node/service/res/asgard.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,15 @@
12,
12,
18,
12,
10,
12
],
"tokenSymbol": [
"BNC",
"ASG",
"KUSD",
"DOT",
"KSM",
"KAR",
"ZLK",
"KSM",
"DOT",
"PHA"
]
},
Expand Down
2 changes: 0 additions & 2 deletions node/service/res/bifrost-kusama.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
12,
18,
12,
10,
12
],
"tokenSymbol": [
Expand All @@ -36,7 +35,6 @@
"KAR",
"ZLK",
"KSM",
"DOT",
"PHA"
]
},
Expand Down
9 changes: 7 additions & 2 deletions node/service/res/bifrost-polkadot.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,13 @@
],
"protocolId": "bifrost_polkadot",
"properties": {
"tokenDecimals": 12,
"tokenSymbol": "BNC"
"ss58Format": 6,
"tokenDecimals": [
12
],
"tokenSymbol": [
"BNC"
]
},
"relay_chain": "polkadot",
"para_id": 2001,
Expand Down
8 changes: 4 additions & 4 deletions node/service/src/chain_spec/bifrost_kusama.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ pub fn ENDOWMENT() -> u128 {
1_000_000 * dollar(CurrencyId::Native(TokenSymbol::BNC))
}

fn bifrost_properties() -> Properties {
fn bifrost_kusama_properties() -> Properties {
let mut properties = sc_chain_spec::Properties::new();
let mut token_symbol: Vec<String> = vec![];
let mut token_decimals: Vec<u32> = vec![];
Expand Down Expand Up @@ -195,7 +195,7 @@ pub fn development_config(id: ParaId) -> Result<ChainSpec, String> {
vec![],
None,
Some(DEFAULT_PROTOCOL_ID),
Some(bifrost_properties()),
Some(bifrost_kusama_properties()),
RelayExtensions { relay_chain: "kusama-dev".into(), para_id: id.into() },
))
}
Expand Down Expand Up @@ -275,7 +275,7 @@ pub fn local_testnet_config(id: ParaId) -> Result<ChainSpec, String> {
vec![],
None,
Some(DEFAULT_PROTOCOL_ID),
Some(bifrost_properties()),
Some(bifrost_kusama_properties()),
RelayExtensions { relay_chain: "kusama-local".into(), para_id: id.into() },
))
}
Expand All @@ -289,7 +289,7 @@ pub fn chainspec_config(id: ParaId) -> ChainSpec {
vec![],
TelemetryEndpoints::new(vec![(TELEMETRY_URL.into(), 0)]).ok(),
Some(DEFAULT_PROTOCOL_ID),
Some(bifrost_properties()),
Some(bifrost_kusama_properties()),
RelayExtensions { relay_chain: "kusama".into(), para_id: id.into() },
)
}
Expand Down
49 changes: 36 additions & 13 deletions node/service/src/chain_spec/bifrost_polkadot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,14 @@
use bifrost_polkadot_runtime::{
constants::currency::DOLLARS, AccountId, AuraId, Balance, BalancesConfig, BlockNumber,
CollatorSelectionConfig, GenesisConfig, IndicesConfig, ParachainInfoConfig, PolkadotXcmConfig,
SessionConfig, SudoConfig, SystemConfig, VestingConfig, WASM_BINARY,
SS58Prefix, SessionConfig, SudoConfig, SystemConfig, VestingConfig, WASM_BINARY,
};
use bifrost_runtime_common::dollar;
use cumulus_primitives_core::ParaId;
use frame_benchmarking::{account, whitelisted_caller};
use hex_literal::hex;
use node_primitives::{CurrencyId, TokenInfo, TokenSymbol};
use sc_chain_spec::Properties;
use sc_service::ChainType;
use sc_telemetry::TelemetryEndpoints;
use sp_core::{crypto::UncheckedInto, sr25519};
Expand All @@ -37,7 +40,31 @@ const DEFAULT_PROTOCOL_ID: &str = "bifrost_polkadot";
/// Specialized `ChainSpec` for the bifrost-polkadot runtime.
pub type ChainSpec = sc_service::GenericChainSpec<GenesisConfig, RelayExtensions>;

const ENDOWMENT: u128 = 1_000_000 * DOLLARS;
#[allow(non_snake_case)]
pub fn ENDOWMENT() -> u128 {
1_000_000 * dollar(CurrencyId::Native(TokenSymbol::BNC))
}

fn bifrost_polkadot_properties() -> Properties {
let mut properties = sc_chain_spec::Properties::new();
let mut token_symbol: Vec<String> = vec![];
let mut token_decimals: Vec<u32> = vec![];
[
// native token
CurrencyId::Native(TokenSymbol::BNC),
]
.iter()
.for_each(|token| {
token_symbol.push(token.symbol().to_string());
token_decimals.push(token.decimals() as u32);
});

properties.insert("tokenSymbol".into(), token_symbol.into());
properties.insert("tokenDecimals".into(), token_decimals.into());
properties.insert("ss58Format".into(), SS58Prefix::get().into());

properties
}

pub fn bifrost_polkadot_genesis(
invulnerables: Vec<(AccountId, AuraId)>,
Expand Down Expand Up @@ -87,11 +114,11 @@ fn development_config_genesis(id: ParaId) -> GenesisConfig {
get_account_id_from_seed::<sr25519::Public>("Alice"),
whitelisted_caller(), // Benchmarking whitelist_account
];
let balances = endowed_accounts.iter().cloned().map(|x| (x, ENDOWMENT)).collect();
let balances = endowed_accounts.iter().cloned().map(|x| (x, ENDOWMENT())).collect();
let vestings = endowed_accounts
.iter()
.cloned()
.map(|x| (x.clone(), 0u32, 100u32, ENDOWMENT / 4))
.map(|x| (x.clone(), 0u32, 100u32, ENDOWMENT() / 4))
.collect();

bifrost_polkadot_genesis(
Expand All @@ -115,7 +142,7 @@ pub fn development_config(id: ParaId) -> Result<ChainSpec, String> {
vec![],
None,
Some(DEFAULT_PROTOCOL_ID),
None,
Some(bifrost_polkadot_properties()),
RelayExtensions { relay_chain: "polkadot-dev".into(), para_id: id.into() },
))
}
Expand All @@ -138,11 +165,11 @@ fn local_config_genesis(id: ParaId) -> GenesisConfig {
account("bechmarking_account_1", 0, 0), /* Benchmarking account_1, used for interacting
* with whitelistted_caller */
];
let balances = endowed_accounts.iter().cloned().map(|x| (x, ENDOWMENT)).collect();
let balances = endowed_accounts.iter().cloned().map(|x| (x, ENDOWMENT())).collect();
let vestings = endowed_accounts
.iter()
.cloned()
.map(|x| (x.clone(), 0u32, 100u32, ENDOWMENT / 4))
.map(|x| (x.clone(), 0u32, 100u32, ENDOWMENT() / 4))
.collect();

bifrost_polkadot_genesis(
Expand All @@ -169,16 +196,12 @@ pub fn local_testnet_config(id: ParaId) -> Result<ChainSpec, String> {
vec![],
None,
Some(DEFAULT_PROTOCOL_ID),
None,
Some(bifrost_polkadot_properties()),
RelayExtensions { relay_chain: "polkadot-local".into(), para_id: id.into() },
))
}

pub fn chainspec_config(id: ParaId) -> ChainSpec {
let mut properties = sc_chain_spec::Properties::new();
properties.insert("tokenSymbol".into(), "BNC".into());
properties.insert("tokenDecimals".into(), 12.into());

ChainSpec::from_genesis(
"Bifrost Polkadot",
"bifrost_polkadot",
Expand All @@ -187,7 +210,7 @@ pub fn chainspec_config(id: ParaId) -> ChainSpec {
vec![],
TelemetryEndpoints::new(vec![(TELEMETRY_URL.into(), 0)]).ok(),
Some(DEFAULT_PROTOCOL_ID),
Some(properties),
Some(bifrost_polkadot_properties()),
RelayExtensions { relay_chain: "polkadot".into(), para_id: id.into() },
)
}
Expand Down