@@ -33,6 +33,7 @@ use sr_primitives::{
33
33
traits:: { IdentifyAccount , Verify } ,
34
34
Perbill ,
35
35
} ;
36
+ use std:: env;
36
37
use substrate_service:: Properties ;
37
38
use substrate_telemetry:: TelemetryEndpoints ;
38
39
@@ -58,6 +59,65 @@ pub fn icefrog_testnet_config() -> Result<ChainSpec, String> {
58
59
ChainSpec :: from_json_bytes ( & include_bytes ! ( "../res/icefrog.json" ) [ ..] )
59
60
}
60
61
62
+ /// IceFrog testnet config generator
63
+ pub fn gen_icefrog_testnet_config ( ) -> ChainSpec {
64
+ fn icefrog_config_genesis ( ) -> GenesisConfig {
65
+ darwinia_genesis (
66
+ vec ! [
67
+ (
68
+ hex![ "be3fd892bf0e2b33dbfcf298c99a9f71e631a57af6c017dc5ac078c5d5b3494b" ] . into( ) , //stash
69
+ hex![ "70bf51d123581d6e51af70b342cac75ae0a0fc71d1a8d388719139af9c042b18" ] . into( ) ,
70
+ get_from_seed:: <GrandpaId >( & env:: var( "ALICE_SECRET" ) . expect( "Alice secret key missing" ) ) ,
71
+ get_from_seed:: <BabeId >( "Alice" ) ,
72
+ get_from_seed:: <ImOnlineId >( "Alice" ) ,
73
+ ) ,
74
+ (
75
+ hex![ "e2f560c01a2d8e98d313d6799185c28a39e10896332b56304ff46392f585024c" ] . into( ) , //stash
76
+ hex![ "94c51178449c09eec77918ea951fa3244f7b841eea1dd1489d2b5f2a53f8840f" ] . into( ) ,
77
+ get_from_seed:: <GrandpaId >( & env:: var( "BOB_SECRET" ) . expect( "Bob secret key missing" ) ) ,
78
+ get_from_seed:: <BabeId >( "Bob" ) ,
79
+ get_from_seed:: <ImOnlineId >( "Bob" ) ,
80
+ ) ,
81
+ ] ,
82
+ hex ! [ "a60837b2782f7ffd23e95cd26d1aa8d493b8badc6636234ccd44db03c41fcc6c" ] . into ( ) ,
83
+ Some ( vec ! [
84
+ hex![ "a60837b2782f7ffd23e95cd26d1aa8d493b8badc6636234ccd44db03c41fcc6c" ] . into( ) ,
85
+ hex![ "f29311a581558ded67b8bfd097e614ce8135f777e29777d07ec501adb0ddab08" ] . into( ) ,
86
+ hex![ "1098e3bf7b351d6210c61b05edefb3a2b88c9611db26fbed2c7136b6d8f9c90f" ] . into( ) ,
87
+ hex![ "f252bc67e45acc9b3852a0ef84ddfce6c9cef25193617ef1421c460ecc2c746f" ] . into( ) ,
88
+ hex![ "90ce56f84328b180fc55146709aa7038c18efd58f1f247410be0b1ddc612df27" ] . into( ) ,
89
+ hex![ "4ca516c4b95488d0e6e9810a429a010b5716168d777c6b1399d3ed61cce1715c" ] . into( ) ,
90
+ hex![ "e28573bb4d9233c799defe8f85fa80a66b43d47f4c1aef64bb8fffde1ecf8606" ] . into( ) ,
91
+ hex![ "20e2455350cbe36631e82ce9b12152f98a3738cb763e46e65d1a253806a26d1a" ] . into( ) ,
92
+ hex![ "9eccaca8a35f0659aed4df45455a855bcb3e7bff7bfc9d672b676bbb78988f0d" ] . into( ) ,
93
+ hex![ "98dba2d3252825f4cd1141ca4f41ea201a22b4e129a6c7253cea546dbb20e442" ] . into( ) ,
94
+ ] ) ,
95
+ true ,
96
+ )
97
+ }
98
+
99
+ ChainSpec :: from_genesis (
100
+ "Darwinia IceFrog Testnet" ,
101
+ "icefrog_testnet" ,
102
+ icefrog_config_genesis,
103
+ vec ! [ ] ,
104
+ Some ( TelemetryEndpoints :: new ( vec ! [ ( STAGING_TELEMETRY_URL . to_string( ) , 0 ) ] ) ) ,
105
+ Some ( "DAR" ) ,
106
+ {
107
+ let mut properties = Properties :: new ( ) ;
108
+
109
+ properties. insert ( "ss58Format" . into ( ) , 42 . into ( ) ) ;
110
+ properties. insert ( "tokenDecimals" . into ( ) , 9 . into ( ) ) ;
111
+ properties. insert ( "tokenSymbol" . into ( ) , "IRING" . into ( ) ) ;
112
+ properties. insert ( "ktonTokenDecimals" . into ( ) , 9 . into ( ) ) ;
113
+ properties. insert ( "ktonTokenSymbol" . into ( ) , "IKTON" . into ( ) ) ;
114
+
115
+ Some ( properties)
116
+ } ,
117
+ Default :: default ( ) ,
118
+ )
119
+ }
120
+
61
121
fn session_keys ( grandpa : GrandpaId , babe : BabeId , im_online : ImOnlineId ) -> SessionKeys {
62
122
SessionKeys {
63
123
grandpa,
@@ -152,9 +212,12 @@ pub fn staging_testnet_config() -> ChainSpec {
152
212
}
153
213
/// Helper function to generate a crypto pair from seed
154
214
pub fn get_from_seed < TPublic : Public > ( seed : & str ) -> <TPublic :: Pair as Pair >:: Public {
155
- TPublic :: Pair :: from_string ( & format ! ( "//{}" , seed) , None )
156
- . expect ( "static values are valid; qed" )
157
- . public ( )
215
+ let pair = if seed. starts_with ( "0x" ) {
216
+ TPublic :: Pair :: from_string ( seed, None )
217
+ } else {
218
+ TPublic :: Pair :: from_string ( & format ! ( "//{}" , seed) , None )
219
+ } ;
220
+ pair. expect ( "static values are valid; qed" ) . public ( )
158
221
}
159
222
160
223
/// Helper function to generate an account ID from seed
@@ -185,25 +248,23 @@ pub fn darwinia_genesis(
185
248
) -> GenesisConfig {
186
249
let endowed_accounts: Vec < AccountId > = endowed_accounts. unwrap_or_else ( || {
187
250
vec ! [
188
- get_account_id_from_seed :: <sr25519 :: Public > ( "Alice" ) ,
189
- get_account_id_from_seed :: <sr25519 :: Public > ( "Bob" ) ,
251
+ initial_authorities [ 0 ] . clone ( ) . 1 ,
252
+ initial_authorities [ 1 ] . clone ( ) . 1 ,
190
253
get_account_id_from_seed:: <sr25519:: Public >( "Charlie" ) ,
191
254
get_account_id_from_seed:: <sr25519:: Public >( "Dave" ) ,
192
255
get_account_id_from_seed:: <sr25519:: Public >( "Eve" ) ,
193
256
get_account_id_from_seed:: <sr25519:: Public >( "Ferdie" ) ,
194
- get_account_id_from_seed :: <sr25519 :: Public > ( "Alice//stash" ) ,
195
- get_account_id_from_seed :: <sr25519 :: Public > ( "Bob//stash" ) ,
257
+ initial_authorities [ 0 ] . clone ( ) . 0 ,
258
+ initial_authorities [ 1 ] . clone ( ) . 0 ,
196
259
get_account_id_from_seed:: <sr25519:: Public >( "Charlie//stash" ) ,
197
260
get_account_id_from_seed:: <sr25519:: Public >( "Dave//stash" ) ,
198
261
get_account_id_from_seed:: <sr25519:: Public >( "Eve//stash" ) ,
199
262
get_account_id_from_seed:: <sr25519:: Public >( "Ferdie//stash" ) ,
200
263
]
201
264
} ) ;
202
265
203
- let eth_relay_authorities: Vec < AccountId > = vec ! [
204
- get_account_id_from_seed:: <sr25519:: Public >( "Alice" ) ,
205
- get_account_id_from_seed:: <sr25519:: Public >( "Bob" ) ,
206
- ] ;
266
+ let eth_relay_authorities: Vec < AccountId > =
267
+ vec ! [ initial_authorities[ 0 ] . clone( ) . 1 , initial_authorities[ 1 ] . clone( ) . 1 ] ;
207
268
208
269
const RING_ENDOWMENT : Balance = 20_000_000 * COIN ;
209
270
const KTON_ENDOWMENT : Balance = 10 * COIN ;
0 commit comments