Browse Source

runtime: proposals: Remove obsolete types.

Shamil Gadelshin 4 years ago
parent
commit
609d48106b

+ 0 - 1
Cargo.lock

@@ -3582,7 +3582,6 @@ dependencies = [
  "pallet-balances",
  "pallet-common",
  "pallet-membership",
- "pallet-stake",
  "pallet-timestamp",
  "parity-scale-codec",
  "serde",

+ 18 - 27
runtime-modules/proposals/codex/src/lib.rs

@@ -1,5 +1,5 @@
 //! # Proposals codex module
-//! Proposals `codex` module for the Joystream platform. Version 2.
+//! Proposals `codex` module for the Joystream platform. Version 3.
 //! Component of the proposals system. It contains preset proposal types.
 //!
 //! ## Overview
@@ -73,8 +73,9 @@ use system::ensure_root;
 use common::origin::ActorOriginValidator;
 use common::working_group::WorkingGroup;
 use governance::election_params::ElectionParameters;
-use proposals_engine::BalanceOfCurrency;
-use proposals_engine::{ProposalCreationParameters, ProposalObserver, ProposalParameters, Stake};
+use proposals_engine::{
+    BalanceOf, ProposalCreationParameters, ProposalObserver, ProposalParameters, Stake,
+};
 
 pub use crate::proposal_types::{
     AddOpeningParameters, FillOpeningParameters, ProposalsConfigParameters, TerminateRoleParameters,
@@ -95,9 +96,9 @@ struct CreateProposalParameters<T: Trait> {
     pub member_id: MemberId<T>,
     pub title: Vec<u8>,
     pub description: Vec<u8>,
-    pub stake: Option<Stake<T::AccountId, BalanceOfCurrency<T>>>,
+    pub stake: Option<Stake<T::AccountId, BalanceOf<T>>>,
     pub proposal_code: Vec<u8>,
-    pub proposal_parameters: ProposalParameters<T::BlockNumber, BalanceOfCurrency<T>>,
+    pub proposal_parameters: ProposalParameters<T::BlockNumber, BalanceOf<T>>,
     pub proposal_details: ProposalDetailsOf<T>,
     pub exact_execution_block: Option<T::BlockNumber>,
 }
@@ -129,12 +130,6 @@ pub trait Trait:
     type ProposalEncoder: ProposalEncoder<Self>;
 }
 
-/// Balance alias for staking.
-pub type BalanceOf<T> = <T as balances::Trait>::Balance;
-
-/// Currency alias for `stake` module
-pub type CurrencyOf<T> = <T as stake::Trait>::Currency;
-
 /// Balance alias for GovernanceCurrency from `common` module. TODO: replace with BalanceOf
 pub type BalanceOfGovernanceCurrency<T> =
     <<T as common::currency::GovernanceCurrency>::Currency as Currency<
@@ -145,10 +140,6 @@ pub type BalanceOfGovernanceCurrency<T> =
 pub type BalanceOfMint<T> =
     <<T as minting::Trait>::Currency as Currency<<T as system::Trait>::AccountId>>::Balance;
 
-/// Negative imbalance alias for staking
-pub type NegativeImbalance<T> =
-    <<T as stake::Trait>::Currency as Currency<<T as system::Trait>::AccountId>>::NegativeImbalance;
-
 type MemberId<T> = <T as membership::Trait>::MemberId;
 
 decl_error! {
@@ -334,7 +325,7 @@ decl_module! {
             member_id: MemberId<T>,
             title: Vec<u8>,
             description: Vec<u8>,
-            stake: Option<Stake<T::AccountId, BalanceOfCurrency<T>>>,
+            stake: Option<Stake<T::AccountId, BalanceOf<T>>>,
             text: Vec<u8>,
             exact_execution_block: Option<T::BlockNumber>,
         ) {
@@ -366,7 +357,7 @@ decl_module! {
             member_id: MemberId<T>,
             title: Vec<u8>,
             description: Vec<u8>,
-            stake: Option<Stake<T::AccountId, BalanceOfCurrency<T>>>,
+            stake: Option<Stake<T::AccountId, BalanceOf<T>>>,
             wasm: Vec<u8>,
             exact_execution_block: Option<T::BlockNumber>,
         ) {
@@ -398,7 +389,7 @@ decl_module! {
             member_id: MemberId<T>,
             title: Vec<u8>,
             description: Vec<u8>,
-            stake: Option<Stake<T::AccountId, BalanceOfCurrency<T>>>,
+            stake: Option<Stake<T::AccountId, BalanceOf<T>>>,
             balance: BalanceOfMint<T>,
             destination: T::AccountId,
             exact_execution_block: Option<T::BlockNumber>,
@@ -433,7 +424,7 @@ decl_module! {
             member_id: MemberId<T>,
             title: Vec<u8>,
             description: Vec<u8>,
-            stake: Option<Stake<T::AccountId, BalanceOfCurrency<T>>>,
+            stake: Option<Stake<T::AccountId, BalanceOf<T>>>,
             new_validator_count: u32,
             exact_execution_block: Option<T::BlockNumber>,
         ) {
@@ -471,7 +462,7 @@ decl_module! {
             member_id: MemberId<T>,
             title: Vec<u8>,
             description: Vec<u8>,
-            stake: Option<Stake<T::AccountId, BalanceOfCurrency<T>>>,
+            stake: Option<Stake<T::AccountId, BalanceOf<T>>>,
             add_opening_parameters: AddOpeningParameters<T::BlockNumber, BalanceOfGovernanceCurrency<T>>,
             exact_execution_block: Option<T::BlockNumber>,
         ) {
@@ -499,7 +490,7 @@ decl_module! {
             member_id: MemberId<T>,
             title: Vec<u8>,
             description: Vec<u8>,
-            stake: Option<Stake<T::AccountId, BalanceOfCurrency<T>>>,
+            stake: Option<Stake<T::AccountId, BalanceOf<T>>>,
             opening_id: working_group::OpeningId<T>,
             working_group: WorkingGroup,
             exact_execution_block: Option<T::BlockNumber>,
@@ -528,7 +519,7 @@ decl_module! {
             member_id: MemberId<T>,
             title: Vec<u8>,
             description: Vec<u8>,
-            stake: Option<Stake<T::AccountId, BalanceOfCurrency<T>>>,
+            stake: Option<Stake<T::AccountId, BalanceOf<T>>>,
             fill_opening_parameters: FillOpeningParameters<
                 T::BlockNumber,
                 BalanceOfMint<T>,
@@ -561,7 +552,7 @@ decl_module! {
             member_id: MemberId<T>,
             title: Vec<u8>,
             description: Vec<u8>,
-            stake: Option<Stake<T::AccountId, BalanceOfCurrency<T>>>,
+            stake: Option<Stake<T::AccountId, BalanceOf<T>>>,
             mint_balance: BalanceOfMint<T>,
             working_group: WorkingGroup,
             exact_execution_block: Option<T::BlockNumber>,
@@ -595,7 +586,7 @@ decl_module! {
             member_id: MemberId<T>,
             title: Vec<u8>,
             description: Vec<u8>,
-            stake: Option<Stake<T::AccountId, BalanceOfCurrency<T>>>,
+            stake: Option<Stake<T::AccountId, BalanceOf<T>>>,
             worker_id: working_group::WorkerId<T>,
             decreasing_stake: BalanceOf<T>,
             working_group: WorkingGroup,
@@ -632,7 +623,7 @@ decl_module! {
             member_id: MemberId<T>,
             title: Vec<u8>,
             description: Vec<u8>,
-            stake: Option<Stake<T::AccountId, BalanceOfCurrency<T>>>,
+            stake: Option<Stake<T::AccountId, BalanceOf<T>>>,
             worker_id: working_group::WorkerId<T>,
             slashing_stake: BalanceOf<T>,
             working_group: WorkingGroup,
@@ -669,7 +660,7 @@ decl_module! {
             member_id: MemberId<T>,
             title: Vec<u8>,
             description: Vec<u8>,
-            stake: Option<Stake<T::AccountId, BalanceOfCurrency<T>>>,
+            stake: Option<Stake<T::AccountId, BalanceOf<T>>>,
             worker_id: working_group::WorkerId<T>,
             reward_amount: BalanceOfMint<T>,
             working_group: WorkingGroup,
@@ -704,7 +695,7 @@ decl_module! {
             member_id: MemberId<T>,
             title: Vec<u8>,
             description: Vec<u8>,
-            stake: Option<Stake<T::AccountId, BalanceOfCurrency<T>>>,
+            stake: Option<Stake<T::AccountId, BalanceOf<T>>>,
             terminate_role_parameters: TerminateRoleParameters<working_group::WorkerId<T>>,
             exact_execution_block: Option<T::BlockNumber>,
         ) {

+ 25 - 26
runtime-modules/proposals/codex/src/proposal_types/parameters.rs

@@ -1,8 +1,8 @@
-use crate::{BalanceOfCurrency, Module, ProposalParameters};
+use crate::{BalanceOf, Module, ProposalParameters};
 
 // Proposal parameters for the 'Set validator count' proposal
 pub(crate) fn set_validator_count_proposal<T: crate::Trait>(
-) -> ProposalParameters<T::BlockNumber, BalanceOfCurrency<T>> {
+) -> ProposalParameters<T::BlockNumber, BalanceOf<T>> {
     ProposalParameters {
         voting_period: <Module<T>>::set_validator_count_proposal_voting_period(),
         grace_period: <Module<T>>::set_validator_count_proposal_grace_period(),
@@ -10,13 +10,13 @@ pub(crate) fn set_validator_count_proposal<T: crate::Trait>(
         approval_threshold_percentage: 80,
         slashing_quorum_percentage: 60,
         slashing_threshold_percentage: 80,
-        required_stake: Some(<BalanceOfCurrency<T>>::from(100_000_u32)),
+        required_stake: Some(<BalanceOf<T>>::from(100_000_u32)),
     }
 }
 
 // Proposal parameters for the upgrade runtime proposal
 pub(crate) fn runtime_upgrade_proposal<T: crate::Trait>(
-) -> ProposalParameters<T::BlockNumber, BalanceOfCurrency<T>> {
+) -> ProposalParameters<T::BlockNumber, BalanceOf<T>> {
     ProposalParameters {
         voting_period: <Module<T>>::runtime_upgrade_proposal_voting_period(),
         grace_period: <Module<T>>::runtime_upgrade_proposal_grace_period(),
@@ -24,13 +24,12 @@ pub(crate) fn runtime_upgrade_proposal<T: crate::Trait>(
         approval_threshold_percentage: 100,
         slashing_quorum_percentage: 60,
         slashing_threshold_percentage: 80,
-        required_stake: Some(<BalanceOfCurrency<T>>::from(1_000_000_u32)),
+        required_stake: Some(<BalanceOf<T>>::from(1_000_000_u32)),
     }
 }
 
 // Proposal parameters for the text proposal
-pub(crate) fn text_proposal<T: crate::Trait>(
-) -> ProposalParameters<T::BlockNumber, BalanceOfCurrency<T>> {
+pub(crate) fn text_proposal<T: crate::Trait>() -> ProposalParameters<T::BlockNumber, BalanceOf<T>> {
     ProposalParameters {
         voting_period: <Module<T>>::text_proposal_voting_period(),
         grace_period: <Module<T>>::text_proposal_grace_period(),
@@ -38,13 +37,13 @@ pub(crate) fn text_proposal<T: crate::Trait>(
         approval_threshold_percentage: 80,
         slashing_quorum_percentage: 60,
         slashing_threshold_percentage: 80,
-        required_stake: Some(<BalanceOfCurrency<T>>::from(25000u32)),
+        required_stake: Some(<BalanceOf<T>>::from(25000u32)),
     }
 }
 
 // Proposal parameters for the 'Spending' proposal
 pub(crate) fn spending_proposal<T: crate::Trait>(
-) -> ProposalParameters<T::BlockNumber, BalanceOfCurrency<T>> {
+) -> ProposalParameters<T::BlockNumber, BalanceOf<T>> {
     ProposalParameters {
         voting_period: <Module<T>>::spending_proposal_voting_period(),
         grace_period: <Module<T>>::spending_proposal_grace_period(),
@@ -52,13 +51,13 @@ pub(crate) fn spending_proposal<T: crate::Trait>(
         approval_threshold_percentage: 80,
         slashing_quorum_percentage: 60,
         slashing_threshold_percentage: 80,
-        required_stake: Some(<BalanceOfCurrency<T>>::from(25000u32)),
+        required_stake: Some(<BalanceOf<T>>::from(25000u32)),
     }
 }
 
 // Proposal parameters for the 'Add working group leader' proposal
 pub(crate) fn add_working_group_leader_opening_proposal<T: crate::Trait>(
-) -> ProposalParameters<T::BlockNumber, BalanceOfCurrency<T>> {
+) -> ProposalParameters<T::BlockNumber, BalanceOf<T>> {
     ProposalParameters {
         voting_period: <Module<T>>::add_working_group_opening_proposal_voting_period(),
         grace_period: <Module<T>>::add_working_group_opening_proposal_grace_period(),
@@ -66,13 +65,13 @@ pub(crate) fn add_working_group_leader_opening_proposal<T: crate::Trait>(
         approval_threshold_percentage: 80,
         slashing_quorum_percentage: 60,
         slashing_threshold_percentage: 80,
-        required_stake: Some(<BalanceOfCurrency<T>>::from(100_000_u32)),
+        required_stake: Some(<BalanceOf<T>>::from(100_000_u32)),
     }
 }
 
 // Proposal parameters for the 'Begin review working group leader applications' proposal
 pub(crate) fn begin_review_working_group_leader_applications_proposal<T: crate::Trait>(
-) -> ProposalParameters<T::BlockNumber, BalanceOfCurrency<T>> {
+) -> ProposalParameters<T::BlockNumber, BalanceOf<T>> {
     ProposalParameters {
         voting_period:
             <Module<T>>::begin_review_working_group_leader_applications_proposal_voting_period(),
@@ -82,13 +81,13 @@ pub(crate) fn begin_review_working_group_leader_applications_proposal<T: crate::
         approval_threshold_percentage: 75,
         slashing_quorum_percentage: 60,
         slashing_threshold_percentage: 80,
-        required_stake: Some(<BalanceOfCurrency<T>>::from(25000u32)),
+        required_stake: Some(<BalanceOf<T>>::from(25000u32)),
     }
 }
 
 // Proposal parameters for the 'Fill working group leader opening' proposal
 pub(crate) fn fill_working_group_leader_opening_proposal<T: crate::Trait>(
-) -> ProposalParameters<T::BlockNumber, BalanceOfCurrency<T>> {
+) -> ProposalParameters<T::BlockNumber, BalanceOf<T>> {
     ProposalParameters {
         voting_period: <Module<T>>::fill_working_group_leader_opening_proposal_voting_period(),
         grace_period: <Module<T>>::fill_working_group_leader_opening_proposal_grace_period(),
@@ -96,13 +95,13 @@ pub(crate) fn fill_working_group_leader_opening_proposal<T: crate::Trait>(
         approval_threshold_percentage: 75,
         slashing_quorum_percentage: 60,
         slashing_threshold_percentage: 80,
-        required_stake: Some(<BalanceOfCurrency<T>>::from(50000u32)),
+        required_stake: Some(<BalanceOf<T>>::from(50000u32)),
     }
 }
 
 // Proposal parameters for the 'Set working group mint capacity' proposal
 pub(crate) fn set_working_group_mint_capacity_proposal<T: crate::Trait>(
-) -> ProposalParameters<T::BlockNumber, BalanceOfCurrency<T>> {
+) -> ProposalParameters<T::BlockNumber, BalanceOf<T>> {
     ProposalParameters {
         voting_period: <Module<T>>::set_working_group_mint_capacity_proposal_voting_period(),
         grace_period: <Module<T>>::set_working_group_mint_capacity_proposal_grace_period(),
@@ -110,13 +109,13 @@ pub(crate) fn set_working_group_mint_capacity_proposal<T: crate::Trait>(
         approval_threshold_percentage: 75,
         slashing_quorum_percentage: 60,
         slashing_threshold_percentage: 80,
-        required_stake: Some(<BalanceOfCurrency<T>>::from(50000u32)),
+        required_stake: Some(<BalanceOf<T>>::from(50000u32)),
     }
 }
 
 // Proposal parameters for the 'Decrease working group leader stake' proposal
 pub(crate) fn decrease_working_group_leader_stake_proposal<T: crate::Trait>(
-) -> ProposalParameters<T::BlockNumber, BalanceOfCurrency<T>> {
+) -> ProposalParameters<T::BlockNumber, BalanceOf<T>> {
     ProposalParameters {
         voting_period: <Module<T>>::decrease_working_group_leader_stake_proposal_voting_period(),
         grace_period: <Module<T>>::decrease_working_group_leader_stake_proposal_grace_period(),
@@ -124,13 +123,13 @@ pub(crate) fn decrease_working_group_leader_stake_proposal<T: crate::Trait>(
         approval_threshold_percentage: 75,
         slashing_quorum_percentage: 60,
         slashing_threshold_percentage: 80,
-        required_stake: Some(<BalanceOfCurrency<T>>::from(50000u32)),
+        required_stake: Some(<BalanceOf<T>>::from(50000u32)),
     }
 }
 
 // Proposal parameters for the 'Slash working group leader stake' proposal
 pub(crate) fn slash_working_group_leader_stake_proposal<T: crate::Trait>(
-) -> ProposalParameters<T::BlockNumber, BalanceOfCurrency<T>> {
+) -> ProposalParameters<T::BlockNumber, BalanceOf<T>> {
     ProposalParameters {
         voting_period: <Module<T>>::slash_working_group_leader_stake_proposal_voting_period(),
         grace_period: <Module<T>>::slash_working_group_leader_stake_proposal_grace_period(),
@@ -138,13 +137,13 @@ pub(crate) fn slash_working_group_leader_stake_proposal<T: crate::Trait>(
         approval_threshold_percentage: 75,
         slashing_quorum_percentage: 60,
         slashing_threshold_percentage: 80,
-        required_stake: Some(<BalanceOfCurrency<T>>::from(50000u32)),
+        required_stake: Some(<BalanceOf<T>>::from(50000u32)),
     }
 }
 
 // Proposal parameters for the 'Set working group leader reward' proposal
 pub(crate) fn set_working_group_leader_reward_proposal<T: crate::Trait>(
-) -> ProposalParameters<T::BlockNumber, BalanceOfCurrency<T>> {
+) -> ProposalParameters<T::BlockNumber, BalanceOf<T>> {
     ProposalParameters {
         voting_period: <Module<T>>::set_working_group_leader_reward_proposal_voting_period(),
         grace_period: <Module<T>>::set_working_group_leader_reward_proposal_grace_period(),
@@ -152,13 +151,13 @@ pub(crate) fn set_working_group_leader_reward_proposal<T: crate::Trait>(
         approval_threshold_percentage: 75,
         slashing_quorum_percentage: 60,
         slashing_threshold_percentage: 80,
-        required_stake: Some(<BalanceOfCurrency<T>>::from(50000u32)),
+        required_stake: Some(<BalanceOf<T>>::from(50000u32)),
     }
 }
 
 // Proposal parameters for the 'Terminate working group leader role' proposal
 pub(crate) fn terminate_working_group_leader_role_proposal<T: crate::Trait>(
-) -> ProposalParameters<T::BlockNumber, BalanceOfCurrency<T>> {
+) -> ProposalParameters<T::BlockNumber, BalanceOf<T>> {
     ProposalParameters {
         voting_period: <Module<T>>::terminate_working_group_leader_role_proposal_voting_period(),
         grace_period: <Module<T>>::terminate_working_group_leader_role_proposal_grace_period(),
@@ -166,6 +165,6 @@ pub(crate) fn terminate_working_group_leader_role_proposal<T: crate::Trait>(
         approval_threshold_percentage: 80,
         slashing_quorum_percentage: 60,
         slashing_threshold_percentage: 80,
-        required_stake: Some(<BalanceOfCurrency<T>>::from(100_000_u32)),
+        required_stake: Some(<BalanceOf<T>>::from(100_000_u32)),
     }
 }

+ 2 - 2
runtime-modules/proposals/codex/src/tests/mod.rs

@@ -24,7 +24,7 @@ pub(crate) fn increase_total_balance_issuance(balance: u64) {
 pub(crate) fn increase_total_balance_issuance_using_account_id(account_id: u64, balance: u64) {
     let initial_balance = Balances::total_issuance();
     {
-        let _ = <Test as stake::Trait>::Currency::deposit_creating(&account_id, balance);
+        let _ = Balances::deposit_creating(&account_id, balance);
     }
     assert_eq!(Balances::total_issuance(), initial_balance + balance);
 }
@@ -73,7 +73,7 @@ where
 
     fn check_for_successful_call(&self) {
         let account_id = 1;
-        let _imbalance = <Test as stake::Trait>::Currency::deposit_creating(&account_id, 150000);
+        let _imbalance = Balances::deposit_creating(&account_id, 150000);
 
         assert_eq!((self.successful_call)(), Ok(()));
 

+ 1 - 1
runtime-modules/proposals/discussion/src/lib.rs

@@ -1,5 +1,5 @@
 //! # Proposals discussion module
-//! Proposals `discussion` module for the Joystream platform. Version 2.
+//! Proposals `discussion` module for the Joystream platform. Version 3.
 //! It contains discussion subsystem of the proposals.
 //!
 //! ## Overview

+ 0 - 2
runtime-modules/proposals/engine/Cargo.toml

@@ -15,7 +15,6 @@ sp-arithmetic = { package = 'sp-arithmetic', default-features = false, git = 'ht
 sp-runtime = { package = 'sp-runtime', default-features = false, git = 'https://github.com/paritytech/substrate.git', rev = '00768a1f21a579c478fe5d4f51e1fa71f7db9fd4'}
 balances = { package = 'pallet-balances', default-features = false, git = 'https://github.com/paritytech/substrate.git', rev = '00768a1f21a579c478fe5d4f51e1fa71f7db9fd4'}
 membership = { package = 'pallet-membership', default-features = false, path = '../../membership'}
-stake = { package = 'pallet-stake', default-features = false, path = '../../stake'}
 common = { package = 'pallet-common', default-features = false, path = '../../common'}
 
 [dev-dependencies]
@@ -35,6 +34,5 @@ std = [
 	'sp-runtime/std',
 	'balances/std',
     'membership/std',
-    'stake/std',
     'common/std',
 ]

+ 25 - 31
runtime-modules/proposals/engine/src/lib.rs

@@ -1,5 +1,5 @@
 //! # Proposals engine module
-//! Proposals `engine` module for the Joystream platform. Version 2.
+//! Proposals `engine` module for the Joystream platform. Version 3.
 //! The main component of the proposals system. Provides methods and extrinsics to create and
 //! vote for proposals, inspired by Parity **Democracy module**.
 //!
@@ -118,10 +118,10 @@
 use types::{ApprovedProposalData, FinalizedProposalData, MemberId};
 
 pub use types::{
-    ActiveStake, ApprovedProposalStatus, BalanceOf, BalanceOfCurrency, CurrencyOf,
-    FinalizationData, NegativeImbalance, Proposal, ProposalCodeDecoder, ProposalCreationParameters,
-    ProposalDecisionStatus, ProposalExecutable, ProposalParameters, ProposalStatus, Stake,
-    StakingHandler, VoteKind, VotersParameters, VotingResults,
+    ActiveStake, ApprovedProposalStatus, BalanceOf, FinalizationData, Proposal,
+    ProposalCodeDecoder, ProposalCreationParameters, ProposalDecisionStatus, ProposalExecutable,
+    ProposalParameters, ProposalStatus, Stake, StakingHandler, VoteKind, VotersParameters,
+    VotingResults,
 };
 
 pub(crate) mod types;
@@ -170,10 +170,10 @@ pub trait Trait:
     type StakingHandler: StakingHandler<Self>;
 
     /// The fee is applied when cancel the proposal. A fee would be slashed (burned).
-    type CancellationFee: Get<BalanceOfCurrency<Self>>;
+    type CancellationFee: Get<BalanceOf<Self>>;
 
     /// The fee is applied when the proposal gets rejected. A fee would be slashed (burned).
-    type RejectionFee: Get<BalanceOfCurrency<Self>>;
+    type RejectionFee: Get<BalanceOf<Self>>;
 
     /// Defines max allowed proposal title length.
     type TitleMaxLength: Get<u32>;
@@ -338,10 +338,10 @@ decl_module! {
         fn deposit_event() = default;
 
         /// Exports const - the fee is applied when cancel the proposal. A fee would be slashed (burned).
-        const CancellationFee: BalanceOfCurrency<T> = T::CancellationFee::get();
+        const CancellationFee: BalanceOf<T> = T::CancellationFee::get();
 
         /// Exports const -  the fee is applied when the proposal gets rejected. A fee would be slashed (burned).
-        const RejectionFee: BalanceOfCurrency<T> = T::RejectionFee::get();
+        const RejectionFee: BalanceOf<T> = T::RejectionFee::get();
 
         /// Exports const -  max allowed proposal title length.
         const TitleMaxLength: u32 = T::TitleMaxLength::get();
@@ -449,7 +449,7 @@ impl<T: Trait> Module<T> {
     pub fn create_proposal(
         creation_params: ProposalCreationParameters<
             T::BlockNumber,
-            BalanceOfCurrency<T>,
+            BalanceOf<T>,
             MemberId<T>,
             T::AccountId,
         >,
@@ -518,10 +518,10 @@ impl<T: Trait> Module<T> {
     /// - provided parameters: approval_threshold_percentage and slashing_threshold_percentage > 0
     /// - provided stake balance and parameters.required_stake are valid
     pub fn ensure_create_proposal_parameters_are_valid(
-        parameters: &ProposalParameters<T::BlockNumber, BalanceOfCurrency<T>>,
+        parameters: &ProposalParameters<T::BlockNumber, BalanceOf<T>>,
         title: &[u8],
         description: &[u8],
-        stake: Option<Stake<T::AccountId, BalanceOfCurrency<T>>>,
+        stake: Option<Stake<T::AccountId, BalanceOf<T>>>,
         exact_execution_block: Option<T::BlockNumber>,
     ) -> DispatchResult {
         ensure!(!title.is_empty(), Error::<T>::EmptyTitleProvided);
@@ -731,7 +731,7 @@ impl<T: Trait> Module<T> {
     // Slashes the stake and perform unstake only in case of existing stake
     fn slash_and_unstake(
         current_stake_data: Option<ActiveStake<T::AccountId>>,
-        slash_balance: BalanceOfCurrency<T>,
+        slash_balance: BalanceOf<T>,
     ) {
         // only if stake exists
         if let Some(stake_data) = current_stake_data {
@@ -747,20 +747,20 @@ impl<T: Trait> Module<T> {
     // Method visibility allows testing.
     pub(crate) fn calculate_slash_balance(
         decision_status: &ProposalDecisionStatus,
-        proposal_parameters: &ProposalParameters<T::BlockNumber, BalanceOfCurrency<T>>,
-    ) -> BalanceOfCurrency<T> {
+        proposal_parameters: &ProposalParameters<T::BlockNumber, BalanceOf<T>>,
+    ) -> BalanceOf<T> {
         match decision_status {
             ProposalDecisionStatus::Rejected | ProposalDecisionStatus::Expired => {
                 T::RejectionFee::get()
             }
             ProposalDecisionStatus::Approved { .. } | ProposalDecisionStatus::Vetoed => {
-                BalanceOfCurrency::<T>::zero()
+                BalanceOf::<T>::zero()
             }
             ProposalDecisionStatus::Canceled => T::CancellationFee::get(),
             ProposalDecisionStatus::Slashed => proposal_parameters
                 .required_stake
                 .clone()
-                .unwrap_or_else(BalanceOfCurrency::<T>::zero), // stake if set or zero
+                .unwrap_or_else(BalanceOf::<T>::zero), // stake if set or zero
         }
     }
 
@@ -836,7 +836,7 @@ type FinalizedProposal<T> = FinalizedProposalData<
     <T as Trait>::ProposalId,
     <T as system::Trait>::BlockNumber,
     MemberId<T>,
-    BalanceOfCurrency<T>,
+    BalanceOf<T>,
     <T as system::Trait>::AccountId,
 >;
 
@@ -845,7 +845,7 @@ type ApprovedProposal<T> = ApprovedProposalData<
     <T as Trait>::ProposalId,
     <T as system::Trait>::BlockNumber,
     MemberId<T>,
-    BalanceOfCurrency<T>,
+    BalanceOf<T>,
     <T as system::Trait>::AccountId,
 >;
 
@@ -853,7 +853,7 @@ type ApprovedProposal<T> = ApprovedProposalData<
 type ProposalOf<T> = Proposal<
     <T as system::Trait>::BlockNumber,
     MemberId<T>,
-    BalanceOfCurrency<T>,
+    BalanceOf<T>,
     <T as system::Trait>::AccountId,
 >;
 
@@ -863,7 +863,7 @@ pub struct StakingManager<T: Trait, LockId: Get<LockIdentifier>> {
 }
 
 impl<T: Trait, LockId: Get<LockIdentifier>> StakingHandler<T> for StakingManager<T, LockId> {
-    fn lock(account_id: &T::AccountId, amount: BalanceOfCurrency<T>) {
+    fn lock(account_id: &T::AccountId, amount: BalanceOf<T>) {
         <balances::Module<T>>::set_lock(LockId::get(), &account_id, amount, WithdrawReasons::all())
     }
 
@@ -871,10 +871,7 @@ impl<T: Trait, LockId: Get<LockIdentifier>> StakingHandler<T> for StakingManager
         T::Currency::remove_lock(LockId::get(), &account_id);
     }
 
-    fn slash(
-        account_id: &T::AccountId,
-        amount: Option<BalanceOfCurrency<T>>,
-    ) -> BalanceOfCurrency<T> {
+    fn slash(account_id: &T::AccountId, amount: Option<BalanceOf<T>>) -> BalanceOf<T> {
         let locks = <balances::Module<T>>::locks(&account_id);
 
         let existing_lock = locks.iter().find(|lock| lock.id == LockId::get());
@@ -901,7 +898,7 @@ impl<T: Trait, LockId: Get<LockIdentifier>> StakingHandler<T> for StakingManager
         actually_slashed_balance
     }
 
-    fn set_stake(account_id: &T::AccountId, new_stake: BalanceOfCurrency<T>) -> DispatchResult {
+    fn set_stake(account_id: &T::AccountId, new_stake: BalanceOf<T>) -> DispatchResult {
         let current_stake = Self::current_stake(account_id);
 
         //Unlock previous stake if its not zero.
@@ -934,14 +931,11 @@ impl<T: Trait, LockId: Get<LockIdentifier>> StakingHandler<T> for StakingManager
         existing_lock.is_none()
     }
 
-    fn is_enough_balance_for_stake(
-        account_id: &T::AccountId,
-        amount: BalanceOfCurrency<T>,
-    ) -> bool {
+    fn is_enough_balance_for_stake(account_id: &T::AccountId, amount: BalanceOf<T>) -> bool {
         <balances::Module<T>>::usable_balance(account_id) >= amount
     }
 
-    fn current_stake(account_id: &T::AccountId) -> BalanceOfCurrency<T> {
+    fn current_stake(account_id: &T::AccountId) -> BalanceOf<T> {
         let locks = <balances::Module<T>>::locks(&account_id);
 
         let existing_lock = locks.iter().find(|lock| lock.id == LockId::get());

+ 3 - 3
runtime-modules/proposals/engine/src/tests/mod.rs

@@ -26,7 +26,7 @@ struct ProposalParametersFixture {
 }
 
 impl ProposalParametersFixture {
-    fn with_required_stake(&self, required_stake: BalanceOfCurrency<Test>) -> Self {
+    fn with_required_stake(&self, required_stake: BalanceOf<Test>) -> Self {
         ProposalParametersFixture {
             parameters: ProposalParameters {
                 required_stake: Some(required_stake),
@@ -72,7 +72,7 @@ struct DummyProposalFixture {
     proposal_code: Vec<u8>,
     title: Vec<u8>,
     description: Vec<u8>,
-    stake: Option<Stake<u64, BalanceOfCurrency<Test>>>,
+    stake: Option<Stake<u64, BalanceOf<Test>>>,
     exact_execution_block: Option<u64>,
 }
 
@@ -128,7 +128,7 @@ impl DummyProposalFixture {
         }
     }
 
-    fn with_stake(self, account_id: u64, balance: BalanceOfCurrency<Test>) -> Self {
+    fn with_stake(self, account_id: u64, balance: BalanceOf<Test>) -> Self {
         DummyProposalFixture {
             stake: Some(Stake {
                 account_id,

+ 6 - 22
runtime-modules/proposals/engine/src/types/mod.rs

@@ -5,7 +5,6 @@
 
 use codec::{Decode, Encode};
 use frame_support::dispatch::DispatchResult;
-use frame_support::traits::Currency;
 #[cfg(feature = "std")]
 use serde::{Deserialize, Serialize};
 use sp_runtime::Perbill;
@@ -325,17 +324,6 @@ pub trait ProposalCodeDecoder<T: system::Trait> {
     ) -> Result<Box<dyn ProposalExecutable>, &'static str>;
 }
 
-/// Balance alias
-pub type BalanceOf<T> =
-    <<T as stake::Trait>::Currency as Currency<<T as system::Trait>::AccountId>>::Balance;
-
-/// Balance alias for staking
-pub type NegativeImbalance<T> =
-    <<T as stake::Trait>::Currency as Currency<<T as system::Trait>::AccountId>>::NegativeImbalance;
-
-/// Balance type of runtime
-pub type CurrencyOf<T> = <T as stake::Trait>::Currency;
-
 /// Data container for the finalized proposal results
 pub(crate) struct FinalizedProposalData<ProposalId, BlockNumber, ProposerId, Balance, AccountId> {
     /// Proposal id
@@ -406,14 +394,14 @@ pub struct Stake<AccountId, Balance> {
 pub(crate) type MemberId<T> = <T as membership::Trait>::MemberId;
 
 /// Balance alias for GovernanceCurrency from `common` module. TODO: replace with BalanceOf
-pub type BalanceOfCurrency<T> = <T as balances::Trait>::Balance;
+pub type BalanceOf<T> = <T as balances::Trait>::Balance;
 
 /// Defines abstract staking handler to manage user stakes for different activities
 /// like adding a proposal. Implementation should use built-in LockableCurrency
 /// and LockIdentifier to lock balance consistently with pallet_staking.
 pub trait StakingHandler<T: system::Trait + membership::Trait + balances::Trait> {
     /// Locks the specified balance on the account using specific lock identifier.
-    fn lock(account_id: &T::AccountId, amount: BalanceOfCurrency<T>);
+    fn lock(account_id: &T::AccountId, amount: BalanceOf<T>);
 
     /// Removes the specified lock on the account.
     fn unlock(account_id: &T::AccountId);
@@ -422,13 +410,10 @@ pub trait StakingHandler<T: system::Trait + membership::Trait + balances::Trait>
     /// No limits, no actions on zero stake.
     /// If slashing balance greater than the existing stake - stake is slashed to zero.
     /// Returns actually slashed balance.
-    fn slash(
-        account_id: &T::AccountId,
-        amount: Option<BalanceOfCurrency<T>>,
-    ) -> BalanceOfCurrency<T>;
+    fn slash(account_id: &T::AccountId, amount: Option<BalanceOf<T>>) -> BalanceOf<T>;
 
     /// Sets the new stake to a given amount.
-    fn set_stake(account_id: &T::AccountId, new_stake: BalanceOfCurrency<T>) -> DispatchResult;
+    fn set_stake(account_id: &T::AccountId, new_stake: BalanceOf<T>) -> DispatchResult;
 
     /// Verifies that staking account bound to the member.
     fn is_member_staking_account(member_id: &MemberId<T>, account_id: &T::AccountId) -> bool;
@@ -439,11 +424,10 @@ pub trait StakingHandler<T: system::Trait + membership::Trait + balances::Trait>
     /// Verifies that staking account balance is sufficient for staking.
     /// During the balance check we should consider already locked stake. Effective balance to check
     /// is 'already locked funds' + 'usable funds'.
-    fn is_enough_balance_for_stake(account_id: &T::AccountId, amount: BalanceOfCurrency<T>)
-        -> bool;
+    fn is_enough_balance_for_stake(account_id: &T::AccountId, amount: BalanceOf<T>) -> bool;
 
     /// Returns the current stake on the account.
-    fn current_stake(account_id: &T::AccountId) -> BalanceOfCurrency<T>;
+    fn current_stake(account_id: &T::AccountId) -> BalanceOf<T>;
 }
 
 #[cfg(test)]