1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
use super::{get_account_id_from_seed, get_collator_keys_from_seed, Extensions};
use cumulus_primitives_core::ParaId;
use dev_runtime::*;
use frame_support::PalletId;
use runtime_common::traits::XcmRuntimeCallWeights;
use sc_service::ChainType;
use sp_core::sr25519;
use sp_runtime::traits::{AccountIdConversion, Zero};
use xcm_calls::{
proxy::{ProxyConfig, ProxyWeights},
staking::{RewardDestination, StakingConfig, StakingWeights},
};
pub type ChainSpec = sc_service::GenericChainSpec<GenesisConfig, Extensions>;
pub fn pint_development_config(id: ParaId) -> ChainSpec {
ChainSpec::from_genesis(
"PINT Development",
"dev",
ChainType::Local,
move || {
pint_testnet_genesis(
get_account_id_from_seed::<sr25519::Public>("Alice"),
vec![(get_account_id_from_seed::<sr25519::Public>("Alice"), get_collator_keys_from_seed("Alice"))],
vec![
PalletId(*b"Treasury").into_account(),
get_account_id_from_seed::<sr25519::Public>("Alice"),
get_account_id_from_seed::<sr25519::Public>("Bob"),
get_account_id_from_seed::<sr25519::Public>("Alice//stash"),
get_account_id_from_seed::<sr25519::Public>("Bob//stash"),
],
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>("Dave"),
],
id,
)
},
vec![],
None,
None,
None,
Extensions { relay_chain: "rococo-local".into(), para_id: id.into() },
)
}
pub fn pint_local_config(id: ParaId) -> ChainSpec {
ChainSpec::from_genesis(
"Local Testnet",
"dev_local_testnet",
ChainType::Local,
move || {
pint_testnet_genesis(
get_account_id_from_seed::<sr25519::Public>("Alice"),
vec![
(get_account_id_from_seed::<sr25519::Public>("Alice"), get_collator_keys_from_seed("Alice")),
(get_account_id_from_seed::<sr25519::Public>("Bob"), get_collator_keys_from_seed("Bob")),
],
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>("Dave"),
get_account_id_from_seed::<sr25519::Public>("Eve"),
get_account_id_from_seed::<sr25519::Public>("Ferdie"),
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>("Dave//stash"),
get_account_id_from_seed::<sr25519::Public>("Eve//stash"),
get_account_id_from_seed::<sr25519::Public>("Ferdie//stash"),
],
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>("Dave"),
],
id,
)
},
vec![],
None,
None,
None,
Extensions { relay_chain: "rococo-local".into(), para_id: id.into() },
)
}
fn pint_testnet_genesis(
root_key: AccountId,
initial_authorities: Vec<(AccountId, AuraId)>,
endowed_accounts: Vec<AccountId>,
council_members: Vec<AccountId>,
id: ParaId,
) -> GenesisConfig {
GenesisConfig {
system: SystemConfig { code: WASM_BINARY.expect("WASM binary was not build, please build it!").to_vec() },
balances: BalancesConfig { balances: vec![(root_key.clone(), 1 << 60)] },
treasury: Default::default(),
committee: CommitteeConfig { council_members: council_members.clone(), ..Default::default() },
chainlink_feed: ChainlinkFeedConfig {
feeds: Default::default(),
pallet_admin: Some(root_key.clone()),
feed_creators: council_members,
},
sudo: SudoConfig { key: root_key },
parachain_info: ParachainInfoConfig { parachain_id: id },
collator_selection: CollatorSelectionConfig {
invulnerables: initial_authorities.iter().cloned().map(|(acc, _)| acc).collect(),
candidacy_bond: Zero::zero(),
..Default::default()
},
session: SessionConfig {
keys: initial_authorities
.iter()
.cloned()
.map(|(acc, aura)| {
(
acc.clone(),
acc,
opaque::SessionKeys { aura },
)
})
.collect(),
},
tokens: TokensConfig {
balances: vec![
endowed_accounts.iter().cloned().map(|k| (k, 2, 1 << 12)).collect::<Vec<_>>(),
endowed_accounts.iter().cloned().map(|k| (k, 3, 1 << 12)).collect::<Vec<_>>(),
]
.concat(),
},
aura: Default::default(),
aura_ext: Default::default(),
parachain_system: Default::default(),
remote_asset_manager: RemoteAssetManagerConfig {
staking_configs: vec![(
42,
StakingConfig {
pallet_index: 7,
reward_destination: RewardDestination::Staked,
minimum_balance: 0,
weights: StakingWeights::polkadot(),
bonding_duration: POLKADOT_BONDING_DURATION_IN_BLOCKS,
is_frozen: true,
},
)],
proxy_configs: vec![(42, ProxyConfig { pallet_index: 29, weights: ProxyWeights::polkadot() })],
statemint_config: None,
},
polkadot_xcm: PolkadotXcmConfig { safe_xcm_version: Some(2) },
}
}