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
pub mod genesis;
18

            
19
use {
20
    container_chain_template_frontier_runtime::{
21
        xcm_config::LocationToAccountId, AccountId, AssetRate, Balances, ForeignAssets,
22
        ForeignAssetsCreator, ParachainInfo, ParachainSystem, PolkadotXcm, System, XcmpQueue,
23
    },
24
    emulated_integration_tests_common::{
25
        impl_assert_events_helpers_for_parachain, xcm_emulator::decl_test_parachains,
26
    },
27
    frame_support::parameter_types,
28
    frame_support::sp_runtime::DispatchResult,
29
    tanssi_emulated_integration_tests_common::TestDigestProvider,
30
    xcm_emulator::AdditionalInherentCode,
31
    xcm_emulator::OnInitialize,
32
    xcm_emulator::Parachain,
33
};
34

            
35
pub struct TemplateAdditionalInherentCode;
36
impl AdditionalInherentCode for TemplateAdditionalInherentCode {
37
594
    fn on_new_block() -> DispatchResult {
38
594
        pallet_cc_authorities_noting::DidSetOrchestratorAuthorityData::<
39
594
            container_chain_template_frontier_runtime::Runtime,
40
594
        >::put(true);
41
594
        pallet_author_inherent::InherentIncluded::<
42
594
            container_chain_template_frontier_runtime::Runtime,
43
594
        >::put(true);
44
594
        Ok(())
45
594
    }
46
}
47

            
48
decl_test_parachains! {
49
    // Dancelight parachains
50
    pub struct FrontierTemplate {
51
        genesis = genesis::genesis(),
52
        on_init = (),
53
        runtime = container_chain_template_frontier_runtime,
54
        core = {
55
            XcmpMessageHandler: XcmpQueue,
56
            LocationToAccountId: LocationToAccountId,
57
            ParachainInfo: ParachainInfo,
58
            MessageOrigin: cumulus_primitives_core::AggregateMessageOrigin,
59
            DigestProvider: TestDigestProvider<container_chain_template_frontier_runtime::Runtime, Self::Network>,
60
            AdditionalInherentCode: TemplateAdditionalInherentCode,
61
        },
62
        pallets = {
63
            System: System,
64
            Balances: Balances,
65
            ParachainSystem: ParachainSystem,
66
            PolkadotXcm: PolkadotXcm,
67
            ForeignAssets:  ForeignAssets,
68
            AssetRate:  AssetRate,
69
            ForeignAssetsCreator: ForeignAssetsCreator,
70
        }
71
    },
72
}
73

            
74
parameter_types! {
75
    pub EthereumSender: AccountId = genesis::pre_funded_accounts()[0];
76
    pub EthereumReceiver: AccountId = genesis::pre_funded_accounts()[1];
77
    pub EthereumEmptyReceiver: AccountId = [1u8; 20].into();
78
}
79

            
80
impl_assert_events_helpers_for_parachain!(FrontierTemplate);