Skip to content
tests.rs 70.1 KiB
Newer Older
		let _ = Balances::make_free_balance_be(&11, stake);
		<Stakers<Test>>::insert(&11, Exposure { total: stake, own: stake, others: vec![] });

		// Check reward
		Staking::reward_validator(&11, reward_slash);
		assert_eq!(Balances::total_balance(&11), stake * 2);

		// Set staker
		let _ = Balances::make_free_balance_be(&11, stake);
		let _ = Balances::make_free_balance_be(&2, stake);
		<Stakers<Test>>::insert(&11, Exposure { total: stake, own: 1, others: vec![
			IndividualExposure { who: 2, value: stake - 1 }
		]});

		// Check slashing
		Staking::slash_validator(&11, reward_slash);
		assert_eq!(Balances::total_balance(&11), stake - 1);
		assert_eq!(Balances::total_balance(&2), 1);
	})
}