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 use sp_core::Get;
18
use {
19
    emulated_integration_tests_common::{
20
        impl_assert_events_helpers_for_parachain, xcm_emulator::decl_test_parachains,
21
    },
22
    frame_support::sp_runtime::DispatchResult,
23
    parity_scale_codec::Encode,
24
    sp_consensus_aura::AURA_ENGINE_ID,
25
    sp_runtime::generic::DigestItem,
26
    tanssi_emulated_integration_tests_common::TestDigestProvider,
27
    xcm_emulator::AdditionalInherentCode,
28
    xcm_emulator::OnInitialize,
29
    xcm_emulator::Parachain,
30
};
31

            
32
mod genesis;
33

            
34
pub struct OrchestratorAdditionalInherentCode;
35
impl AdditionalInherentCode for OrchestratorAdditionalInherentCode {
36
138
    fn on_new_block() -> DispatchResult {
37
138
        pallet_author_noting::DidSetContainerAuthorData::<dancebox_runtime::Runtime>::put(true);
38
138
        pallet_author_inherent::InherentIncluded::<dancebox_runtime::Runtime>::put(true);
39
138
        Ok(())
40
138
    }
41
}
42

            
43
decl_test_parachains! {
44
    // Parachains
45
    pub struct Dancebox {
46
        genesis = genesis::genesis(),
47
        on_init = {
48
            dancebox_runtime::System::deposit_log(DigestItem::PreRuntime(AURA_ENGINE_ID, 0u64.encode()));
49
        },
50
        runtime = dancebox_runtime,
51
        core = {
52
            XcmpMessageHandler: dancebox_runtime::XcmpQueue,
53
            LocationToAccountId: dancebox_runtime::xcm_config::LocationToAccountId,
54
            ParachainInfo: dancebox_runtime::ParachainInfo,
55
            MessageOrigin: cumulus_primitives_core::AggregateMessageOrigin,
56
            DigestProvider: TestDigestProvider<dancebox_runtime::Runtime, Self::Network>,
57
            AdditionalInherentCode: OrchestratorAdditionalInherentCode,
58
        },
59
        pallets = {
60
            System: dancebox_runtime::System,
61
            Balances: dancebox_runtime::Balances,
62
            ParachainSystem: dancebox_runtime::ParachainSystem,
63
            PolkadotXcm: dancebox_runtime::PolkadotXcm,
64
            ForeignAssets:  dancebox_runtime::ForeignAssets,
65
            AssetRate:  dancebox_runtime::AssetRate,
66
            ForeignAssetsCreator: dancebox_runtime::ForeignAssetsCreator,
67
        }
68
    }
69
}
70

            
71
impl_assert_events_helpers_for_parachain!(Dancebox);