Replace bitmask with bitflags (#7159)

Signed-off-by: koushiro <koushiro.cqx@gmail.com>
This commit is contained in:
Qinxuan Chen
2020-10-29 20:19:59 +08:00
committed by GitHub
parent c8a245e5e0
commit bd450c24ff
15 changed files with 67 additions and 80 deletions
+1 -1
View File
@@ -35,7 +35,7 @@ fn add_locks<T: Trait>(who: &T::AccountId, n: u8) {
for id in 0..n {
let lock_id = [id; 8];
let locked = 100u32;
let reasons = WithdrawReason::Transfer | WithdrawReason::Reserve;
let reasons = WithdrawReasons::TRANSFER | WithdrawReasons::RESERVE;
T::Currency::set_lock(lock_id, who, locked.into(), reasons);
}
}
+3 -3
View File
@@ -58,7 +58,7 @@ use sp_runtime::{DispatchResult, RuntimeDebug, traits::{
}};
use frame_support::{decl_module, decl_event, decl_storage, decl_error, ensure};
use frame_support::traits::{
Currency, LockableCurrency, VestingSchedule, WithdrawReason, LockIdentifier,
Currency, LockableCurrency, VestingSchedule, WithdrawReasons, LockIdentifier,
ExistenceRequirement, Get,
};
use frame_system::{ensure_signed, ensure_root};
@@ -148,7 +148,7 @@ decl_storage! {
per_block: per_block,
starting_block: begin
});
let reasons = WithdrawReason::Transfer | WithdrawReason::Reserve;
let reasons = WithdrawReasons::TRANSFER | WithdrawReasons::RESERVE;
T::Currency::set_lock(VESTING_ID, who, locked, reasons);
}
})
@@ -322,7 +322,7 @@ impl<T: Trait> Module<T> {
Vesting::<T>::remove(&who);
Self::deposit_event(RawEvent::VestingCompleted(who));
} else {
let reasons = WithdrawReason::Transfer | WithdrawReason::Reserve;
let reasons = WithdrawReasons::TRANSFER | WithdrawReasons::RESERVE;
T::Currency::set_lock(VESTING_ID, &who, locked_now, reasons);
Self::deposit_event(RawEvent::VestingUpdated(who, locked_now));
}