1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- #![cfg(test)]
- use crate::*;
- use crate::{Module, Trait};
- use balances;
- use frame_support::{impl_outer_origin, parameter_types};
- use sp_core::H256;
- use sp_runtime::{
- testing::Header,
- traits::{BlakeTwo256, IdentityLookup},
- Perbill,
- };
- impl_outer_origin! {
- pub enum Origin for Test {}
- }
- #[derive(Clone, PartialEq, Eq, Debug)]
- pub struct Test;
- parameter_types! {
- pub const BlockHashCount: u64 = 250;
- pub const MaximumBlockWeight: u32 = 1024;
- pub const MaximumBlockLength: u32 = 2 * 1024;
- pub const AvailableBlockRatio: Perbill = Perbill::one();
- }
- impl system::Trait for Test {
- type BaseCallFilter = ();
- type Origin = Origin;
- type Call = ();
- type Index = u64;
- type BlockNumber = u64;
- type Hash = H256;
- type Hashing = BlakeTwo256;
- type AccountId = u64;
- type Lookup = IdentityLookup<Self::AccountId>;
- type Header = Header;
- type Event = ();
- type BlockHashCount = BlockHashCount;
- type MaximumBlockWeight = MaximumBlockWeight;
- type DbWeight = ();
- type BlockExecutionWeight = ();
- type ExtrinsicBaseWeight = ();
- type MaximumExtrinsicWeight = ();
- type MaximumBlockLength = MaximumBlockLength;
- type AvailableBlockRatio = AvailableBlockRatio;
- type Version = ();
- type ModuleToIndex = ();
- type AccountData = balances::AccountData<u64>;
- type OnNewAccount = ();
- type OnKilledAccount = ();
- }
- parameter_types! {
- pub const ExistentialDeposit: u32 = 500;
- pub const StakePoolId: [u8; 8] = *b"joystake";
- }
- impl balances::Trait for Test {
- type Balance = u64;
- type DustRemoval = ();
- type Event = ();
- type ExistentialDeposit = ExistentialDeposit;
- type AccountStore = System;
- }
- impl Trait for Test {
- type Currency = Balances;
- type StakePoolId = StakePoolId;
- type StakingEventsHandler = ();
- type StakeId = u64;
- type SlashId = u64;
- }
- pub fn build_test_externalities() -> sp_io::TestExternalities {
- let t = system::GenesisConfig::default()
- .build_storage::<Test>()
- .unwrap();
- t.into()
- }
- pub type System = system::Module<Test>;
- pub type Balances = balances::Module<Test>;
- pub type StakePool = Module<Test>;
- pub mod fixtures {
- use super::*;
- pub type OngoingSlashes = BTreeMap<
- <Test as Trait>::SlashId,
- Slash<<Test as system::Trait>::BlockNumber, BalanceOf<Test>>,
- >;
- }
|