Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

62 changes: 36 additions & 26 deletions node/src/chainspec/mainnet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ use crate::{
mainnet_fixtures::{get_bootnodes, get_initial_authorities, get_root_key},
};
use core::marker::PhantomData;
use hex_literal::hex;
use pallet_airdrop_claims::MultiAddress;
use pallet_im_online::sr25519::AuthorityId as ImOnlineId;
use sc_consensus_grandpa::AuthorityId as GrandpaId;
Expand All @@ -35,10 +36,10 @@ use sp_runtime::{
};
use tangle_primitives::types::{BlockNumber, Signature};
use tangle_runtime::{
AccountId, BabeConfig, Balance, BalancesConfig, ClaimsConfig, EVMChainIdConfig,
Eth2ClientConfig, ImOnlineConfig, MaxVestingSchedules, Perbill, RuntimeGenesisConfig,
SessionConfig, StakerStatus, StakingConfig, SudoConfig, SystemConfig, TreasuryPalletId,
VestingConfig, UNIT, WASM_BINARY,
AccountId, BabeConfig, Balance, BalancesConfig, ClaimsConfig, CouncilConfig, EVMChainIdConfig,
Eth2ClientConfig, ImOnlineConfig, MaxVestingSchedules, Perbill, RoleKeyId,
RuntimeGenesisConfig, SessionConfig, StakerStatus, StakingConfig, SudoConfig, SystemConfig,
TreasuryPalletId, VestingConfig, UNIT, WASM_BINARY,
};
use webb_consensus_types::network_config::{Network, NetworkConfig};

Expand All @@ -64,14 +65,14 @@ where

/// Generate an babe authority key.
pub fn authority_keys_from_seed(
controller: &str,
stash: &str,
) -> (AccountId, BabeId, GrandpaId, ImOnlineId) {
) -> (AccountId, BabeId, GrandpaId, ImOnlineId, RoleKeyId) {
(
get_account_id_from_seed::<sr25519::Public>(stash),
get_from_seed::<BabeId>(controller),
get_from_seed::<GrandpaId>(controller),
get_from_seed::<BabeId>(stash),
get_from_seed::<GrandpaId>(stash),
get_from_seed::<ImOnlineId>(stash),
get_from_seed::<RoleKeyId>(stash),
)
}

Expand All @@ -83,8 +84,9 @@ fn generate_session_keys(
babe: BabeId,
grandpa: GrandpaId,
im_online: ImOnlineId,
role: RoleKeyId,
) -> tangle_runtime::opaque::SessionKeys {
tangle_runtime::opaque::SessionKeys { babe, grandpa, im_online }
tangle_runtime::opaque::SessionKeys { babe, grandpa, im_online, role }
}

pub fn local_mainnet_config(chain_id: u64) -> Result<ChainSpec, String> {
Expand All @@ -94,6 +96,8 @@ pub fn local_mainnet_config(chain_id: u64) -> Result<ChainSpec, String> {
properties.insert("tokenDecimals".into(), 18u32.into());
properties.insert("ss58Format".into(), tangle_primitives::MAINNET_SS58_PREFIX.into());

let endowment: Balance = 10_000_000 * UNIT;

Ok(ChainSpec::from_genesis(
"Local Tangle Mainnet",
"local-tangle-mainnet",
Expand All @@ -103,18 +107,15 @@ pub fn local_mainnet_config(chain_id: u64) -> Result<ChainSpec, String> {
// Wasm binary
wasm_binary,
// Initial validators
vec![
authority_keys_from_seed("Alice", "Alice//stash"),
authority_keys_from_seed("Bob", "Bob//stash"),
],
vec![authority_keys_from_seed("Alice"), authority_keys_from_seed("Bob")],
// Endowed accounts
vec![
get_account_id_from_seed::<sr25519::Public>("Alice"),
get_account_id_from_seed::<sr25519::Public>("Bob"),
get_account_id_from_seed::<sr25519::Public>("Charlie"),
get_account_id_from_seed::<sr25519::Public>("Alice//stash"),
get_account_id_from_seed::<sr25519::Public>("Bob//stash"),
get_account_id_from_seed::<sr25519::Public>("Charlie//stash"),
(get_account_id_from_seed::<sr25519::Public>("Alice"), endowment),
(get_account_id_from_seed::<sr25519::Public>("Bob"), endowment),
(get_account_id_from_seed::<sr25519::Public>("Charlie"), endowment),
(get_account_id_from_seed::<sr25519::Public>("Alice//stash"), endowment),
(get_account_id_from_seed::<sr25519::Public>("Bob//stash"), endowment),
(get_account_id_from_seed::<sr25519::Public>("Charlie//stash"), endowment),
],
// Sudo account
get_account_id_from_seed::<sr25519::Public>("Alice"),
Expand Down Expand Up @@ -166,7 +167,7 @@ pub fn tangle_mainnet_config(chain_id: u64) -> Result<ChainSpec, String> {
// Initial validators
get_initial_authorities(),
// Endowed accounts
vec![],
vec![mainnet::get_treasury_balance()],
// Sudo account
get_root_key(),
// EVM chain ID
Expand All @@ -181,6 +182,7 @@ pub fn tangle_mainnet_config(chain_id: u64) -> Result<ChainSpec, String> {
combine_distributions(vec![
mainnet::get_team_balance_distribution(),
mainnet::get_investor_balance_distribution(),
mainnet::get_foundation_balance_distribution(),
]),
)
},
Expand All @@ -203,14 +205,13 @@ pub fn tangle_mainnet_config(chain_id: u64) -> Result<ChainSpec, String> {
#[allow(clippy::too_many_arguments)]
fn mainnet_genesis(
wasm_binary: &[u8],
initial_authorities: Vec<(AccountId, BabeId, GrandpaId, ImOnlineId)>,
endowed_accounts: Vec<AccountId>,
initial_authorities: Vec<(AccountId, BabeId, GrandpaId, ImOnlineId, RoleKeyId)>,
endowed_accounts: Vec<(AccountId, Balance)>,
root_key: AccountId,
chain_id: u64,
genesis_airdrop: DistributionResult,
genesis_non_airdrop: Vec<(MultiAddress, u128, u64, u64, u128)>,
) -> RuntimeGenesisConfig {
const ENDOWMENT: Balance = 10_000_000 * UNIT;
// stakers: all validators and nominators.
let stakers = initial_authorities
.iter()
Expand Down Expand Up @@ -242,7 +243,7 @@ fn mainnet_genesis(
balances: genesis_non_airdrop
.iter()
.map(|(x, y, _, _, _)| (x.clone().to_account_id_32(), *y))
.chain(endowed_accounts.iter().map(|k| (k.clone(), ENDOWMENT)))
.chain(endowed_accounts)
.collect(),
},
vesting: VestingConfig {
Expand All @@ -259,7 +260,7 @@ fn mainnet_genesis(
(
x.0.clone(),
x.0.clone(),
generate_session_keys(x.1.clone(), x.2.clone(), x.3.clone()),
generate_session_keys(x.1.clone(), x.2.clone(), x.3.clone(), x.4.clone()),
)
})
.collect::<Vec<_>>(),
Expand All @@ -273,7 +274,16 @@ fn mainnet_genesis(
..Default::default()
},
democracy: Default::default(),
council: Default::default(),
council: CouncilConfig {
members: vec![
hex!["483b466832e094f01b1779a7ed07025df319c492dac5160aca89a3be117a7b6d"].into(),
hex!["86d08e7bbe77bc74e3d88ee22edc53368bc13d619e05b66fe6c4b8e2d5c7015a"].into(),
hex!["e421301e5aa5dddee51f0d8c73e794df16673e53157c5ea657be742e35b1793f"].into(),
hex!["4ce3a4da3a7c1ce65f7edeff864dc3dd42e8f47eecc2726d99a0a80124698217"].into(),
hex!["dcd9b70a0409b7626cba1a4016d8da19f4df5ce9fc5e8d16b789e71bb1161d73"].into(),
],
..Default::default()
},
elections: Default::default(),
treasury: Default::default(),
babe: BabeConfig {
Expand Down
17 changes: 17 additions & 0 deletions node/src/distributions/data/webb_investor_distributions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"5FCviiKcJzVfdwqv451JRQc93ZTSbbC9YfgKMkN3LpNMBjS3": 100000000000000000000000,
"5HACeo1RgsWydRP3CaFRZfrd56KAYQbAFasLaWZ8fsF1NzxA": 150000000000000000000000,
"5HBKM8XL7sr7S7qx6ukugDJUBhm16Ubnz1KuJCdHmHQvtc7Z": 400000000000000000000000,
"5Dx1xiArcKt7CbB1yzMVM6VJHzuF3Tezj3R9opMzpEHAt1mC": 100000000000000000000000,
"5H3GqqyhvvYfQdbMbRZfkkuBKrGSv9i2NPktxJrYSGWjQSNV": 7000000000000000000000000,
"5H3GqqyhvvYfQdbMbRZfkkuBKrGSv9i2NPktxJrYSGWjQSNV": 5500000000000000000000000,
"5H3GqqyhvvYfQdbMbRZfkkuBKrGSv9i2NPktxJrYSGWjQSNV": 1000000000000000000000000,
"5H3GqqyhvvYfQdbMbRZfkkuBKrGSv9i2NPktxJrYSGWjQSNV": 200000000000000000000000,
"5H3GqqyhvvYfQdbMbRZfkkuBKrGSv9i2NPktxJrYSGWjQSNV": 100000000000000000000000,
"5FerzxKQZoP9wxjRhS1PHA4v27aPQMoZpXmufcQk1JYE5xU8": 100000000000000000000000,
"5H3GqqyhvvYfQdbMbRZfkkuBKrGSv9i2NPktxJrYSGWjQSNV": 150000000000000000000000,
"5H3GqqyhvvYfQdbMbRZfkkuBKrGSv9i2NPktxJrYSGWjQSNV": 1000000000000000000000000,
"5H3GqqyhvvYfQdbMbRZfkkuBKrGSv9i2NPktxJrYSGWjQSNV": 20000000000000000000000,
"5CXgx89yUwPLjEzsABzieLbS8HuRUTTVT13hqhmAbaackjPb": 20000000000000000000000,
"5DDTvr7P2MaUirj3rSvpcF5DLxECiAqpQegdVCzAuwxingVC": 50000000000000000000000
}
Loading