1
// Copyright (C) Moondance Labs Ltd.
2
// This file is part of Tanssi.
3

            
4
// Tanssi is free software: you can redistribute it and/or modify
5
// it under the terms of the GNU General Public License as published by
6
// the Free Software Foundation, either version 3 of the License, or
7
// (at your option) any later version.
8

            
9
// Tanssi is distributed in the hope that it will be useful,
10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
// GNU General Public License for more details.
13

            
14
// You should have received a copy of the GNU General Public License
15
// along with Tanssi.  If not, see <http://www.gnu.org/licenses/>.
16

            
17
use {
18
    container_chain_template_frontier_runtime::AccountId,
19
    container_chain_template_frontier_runtime::{
20
        AuthoritiesNotingConfig, BalancesConfig, EVMChainIdConfig, ParachainInfoConfig,
21
        RuntimeGenesisConfig, SudoConfig, WASM_BINARY,
22
    },
23
    emulated_integration_tests_common::build_genesis_storage,
24
    hex_literal::hex,
25
};
26

            
27
pub const PARA_ID: u32 = 2001;
28
pub const ORCHESTRATOR: u32 = 2000;
29

            
30
1494
pub fn genesis() -> sp_core::storage::Storage {
31
1494
    let genesis_config = RuntimeGenesisConfig {
32
1494
        system: Default::default(),
33
        balances: BalancesConfig {
34
1494
            balances: pre_funded_accounts()
35
1494
                .iter()
36
1494
                .cloned()
37
5976
                .map(|k| (k, 1 << 80))
38
1494
                .collect(),
39
1494
            ..Default::default()
40
        },
41
1494
        parachain_info: ParachainInfoConfig {
42
1494
            parachain_id: PARA_ID.into(),
43
1494
            ..Default::default()
44
1494
        },
45
        // EVM compatibility
46
        // We should change this to something different than Moonbeam
47
        // For now moonwall is very tailored for moonbeam so we need it for tests
48
1494
        evm_chain_id: EVMChainIdConfig {
49
1494
            chain_id: 1281,
50
1494
            ..Default::default()
51
1494
        },
52
1494
        sudo: SudoConfig {
53
1494
            key: Some(pre_funded_accounts()[0]),
54
1494
        },
55
1494
        authorities_noting: AuthoritiesNotingConfig {
56
1494
            orchestrator_para_id: ORCHESTRATOR.into(),
57
1494
            ..Default::default()
58
1494
        },
59
1494
        ..Default::default()
60
    };
61

            
62
1494
    build_genesis_storage(&genesis_config, WASM_BINARY.unwrap())
63
1494
}
64
/// Get pre-funded accounts
65
3213
pub fn pre_funded_accounts() -> Vec<AccountId> {
66
    // These addresses are derived from Substrate's canonical mnemonic:
67
    // bottom drive obey lake curtain smoke basket hold race lonely fit walk
68
3213
    vec![
69
3213
        AccountId::from(hex!("f24FF3a9CF04c71Dbc94D0b566f7A27B94566cac")), // Alith
70
3213
        AccountId::from(hex!("3Cd0A705a2DC65e5b1E1205896BaA2be8A07c6e0")), // Baltathar
71
3213
        AccountId::from(hex!("798d4Ba9baf0064Ec19eB4F0a1a45785ae9D6DFc")), // Charleth
72
3213
        AccountId::from(hex!("773539d4Ac0e786233D90A233654ccEE26a613D9")), // Dorothy
73
    ]
74
3213
}