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

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