use construct_runtime for more pallet (#7974)

This commit is contained in:
Guillaume Thiolliere
2021-01-25 16:24:38 +01:00
committed by GitHub
parent 62d551a063
commit 681f8408ce
6 changed files with 81 additions and 54 deletions
+21 -14
View File
@@ -1,20 +1,30 @@
#![cfg(test)]
use super::*;
use crate as pallet_atomic_swap;
use frame_support::{impl_outer_origin, parameter_types};
use frame_support::parameter_types;
use sp_core::H256;
use sp_runtime::{
testing::Header,
traits::{BlakeTwo256, IdentityLookup},
};
impl_outer_origin! {
pub enum Origin for Test where system = frame_system {}
}
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
type Block = frame_system::mocking::MockBlock<Test>;
frame_support::construct_runtime!(
pub enum Test where
Block = Block,
NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic,
{
System: frame_system::{Module, Call, Config, Storage, Event<T>},
Balances: pallet_balances::{Module, Call, Storage, Config<T>, Event<T>},
AtomicSwap: pallet_atomic_swap::{Module, Call, Event<T>},
}
);
#[derive(Clone, Eq, Debug, PartialEq)]
pub struct Test;
parameter_types! {
pub const BlockHashCount: u64 = 250;
pub BlockWeights: frame_system::limits::BlockWeights =
@@ -29,15 +39,15 @@ impl frame_system::Config for Test {
type Index = u64;
type BlockNumber = u64;
type Hash = H256;
type Call = ();
type Call = Call;
type Hashing = BlakeTwo256;
type AccountId = u64;
type Lookup = IdentityLookup<Self::AccountId>;
type Header = Header;
type Event = ();
type Event = Event;
type BlockHashCount = BlockHashCount;
type Version = ();
type PalletInfo = ();
type PalletInfo = PalletInfo;
type AccountData = pallet_balances::AccountData<u64>;
type OnNewAccount = ();
type OnKilledAccount = ();
@@ -51,7 +61,7 @@ impl pallet_balances::Config for Test {
type MaxLocks = ();
type Balance = u64;
type DustRemoval = ();
type Event = ();
type Event = Event;
type ExistentialDeposit = ExistentialDeposit;
type AccountStore = System;
type WeightInfo = ();
@@ -61,13 +71,10 @@ parameter_types! {
pub const ExpireDuration: u64 = 100;
}
impl Config for Test {
type Event = ();
type Event = Event;
type SwapAction = BalanceSwapAction<u64, Balances>;
type ProofLimit = ProofLimit;
}
type System = frame_system::Module<Test>;
type Balances = pallet_balances::Module<Test>;
type AtomicSwap = Module<Test>;
const A: u64 = 1;
const B: u64 = 2;