33#![ cfg( test) ]
44
55use super :: * ;
6- use frame_support:: { impl_outer_event , impl_outer_origin , parameter_types, traits:: GenesisBuild } ;
6+ use frame_support:: { construct_runtime , parameter_types, traits:: GenesisBuild } ;
77use orml_traits:: parameter_type_with_key;
88use sp_core:: H256 ;
99use sp_runtime:: {
@@ -12,47 +12,29 @@ use sp_runtime::{
1212 AccountId32 , ModuleId ,
1313} ;
1414
15- mod currencies {
16- pub use crate :: Event ;
17- }
18-
19- impl_outer_event ! {
20- pub enum TestEvent for Runtime {
21- frame_system<T >,
22- currencies<T >,
23- orml_tokens<T >,
24- pallet_balances<T >,
25- }
26- }
27-
28- impl_outer_origin ! {
29- pub enum Origin for Runtime { }
30- }
15+ use crate as currencies;
3116
32- // Workaround for https://github.com/rust-lang/rust/issues/26925 . Remove when sorted.
33- #[ derive( Clone , PartialEq , Eq , Debug ) ]
34- pub struct Runtime ;
3517parameter_types ! {
3618 pub const BlockHashCount : u64 = 250 ;
3719}
3820
3921pub type AccountId = AccountId32 ;
4022impl frame_system:: Config for Runtime {
4123 type Origin = Origin ;
42- type Call = ( ) ;
24+ type Call = Call ;
4325 type Index = u64 ;
4426 type BlockNumber = u64 ;
4527 type Hash = H256 ;
4628 type Hashing = :: sp_runtime:: traits:: BlakeTwo256 ;
4729 type AccountId = AccountId ;
4830 type Lookup = IdentityLookup < Self :: AccountId > ;
4931 type Header = Header ;
50- type Event = TestEvent ;
32+ type Event = Event ;
5133 type BlockHashCount = BlockHashCount ;
5234 type BlockWeights = ( ) ;
5335 type BlockLength = ( ) ;
5436 type Version = ( ) ;
55- type PalletInfo = ( ) ;
37+ type PalletInfo = PalletInfo ;
5638 type AccountData = pallet_balances:: AccountData < u64 > ;
5739 type OnNewAccount = ( ) ;
5840 type OnKilledAccount = ( ) ;
@@ -61,7 +43,6 @@ impl frame_system::Config for Runtime {
6143 type SystemWeightInfo = ( ) ;
6244 type SS58Prefix = ( ) ;
6345}
64- pub type System = frame_system:: Module < Runtime > ;
6546
6647type CurrencyId = u32 ;
6748type Balance = u64 ;
@@ -73,13 +54,12 @@ parameter_types! {
7354impl pallet_balances:: Config for Runtime {
7455 type Balance = Balance ;
7556 type DustRemoval = ( ) ;
76- type Event = TestEvent ;
57+ type Event = Event ;
7758 type ExistentialDeposit = ExistentialDeposit ;
7859 type AccountStore = frame_system:: Module < Runtime > ;
7960 type MaxLocks = ( ) ;
8061 type WeightInfo = ( ) ;
8162}
82- pub type PalletBalances = pallet_balances:: Module < Runtime > ;
8363
8464parameter_type_with_key ! {
8565 pub ExistentialDeposits : |currency_id: CurrencyId | -> Balance {
@@ -92,15 +72,14 @@ parameter_types! {
9272}
9373
9474impl orml_tokens:: Config for Runtime {
95- type Event = TestEvent ;
75+ type Event = Event ;
9676 type Balance = Balance ;
9777 type Amount = i64 ;
9878 type CurrencyId = CurrencyId ;
9979 type WeightInfo = ( ) ;
10080 type ExistentialDeposits = ExistentialDeposits ;
10181 type OnDust = orml_tokens:: TransferDust < Runtime , DustAccount > ;
10282}
103- pub type Tokens = orml_tokens:: Module < Runtime > ;
10483
10584pub const NATIVE_CURRENCY_ID : CurrencyId = 1 ;
10685pub const X_TOKEN_ID : CurrencyId = 2 ;
@@ -110,16 +89,32 @@ parameter_types! {
11089}
11190
11291impl Config for Runtime {
113- type Event = TestEvent ;
92+ type Event = Event ;
11493 type MultiCurrency = Tokens ;
11594 type NativeCurrency = AdaptedBasicCurrency ;
11695 type GetNativeCurrencyId = GetNativeCurrencyId ;
11796 type WeightInfo = ( ) ;
11897}
119- pub type Currencies = Module < Runtime > ;
12098pub type NativeCurrency = NativeCurrencyOf < Runtime > ;
12199pub type AdaptedBasicCurrency = BasicCurrencyAdapter < Runtime , PalletBalances , i64 , u64 > ;
122100
101+ pub type Block = sp_runtime:: generic:: Block < Header , UncheckedExtrinsic > ;
102+ pub type UncheckedExtrinsic = sp_runtime:: generic:: UncheckedExtrinsic < u32 , Call , u32 , ( ) > ;
103+
104+ construct_runtime ! (
105+ pub enum Runtime where
106+ Block = Block ,
107+ NodeBlock = Block ,
108+ UncheckedExtrinsic = UncheckedExtrinsic ,
109+ {
110+ System : frame_system:: { Module , Call , Storage , Config , Event <T >} ,
111+ Currencies : currencies:: { Module , Call , Event <T >} ,
112+ Tokens : orml_tokens:: { Module , Storage , Event <T >, Config <T >} ,
113+ PalletBalances : pallet_balances:: { Module , Call , Storage , Config <T >, Event <T >} ,
114+
115+ }
116+ ) ;
117+
123118pub const ALICE : AccountId = AccountId32 :: new ( [ 1u8 ; 32 ] ) ;
124119pub const BOB : AccountId = AccountId32 :: new ( [ 2u8 ; 32 ] ) ;
125120pub const EVA : AccountId = AccountId32 :: new ( [ 5u8 ; 32 ] ) ;
0 commit comments