Rename StorageMap::exists to ::contains_key (Resolves #4839) (#4847)

* rename StorageMap::exists(key) to ::contains_key(key)

* bump impl_version
This commit is contained in:
Alexander Popiak
2020-02-08 20:31:35 +01:00
committed by GitHub
parent 503bfc9da9
commit cb567d6b8b
26 changed files with 100 additions and 100 deletions
+3 -3
View File
@@ -401,7 +401,7 @@ decl_module! {
) {
let who = ensure_signed(origin)?;
// Check account is not already set up for recovery
ensure!(!<Recoverable<T>>::exists(&who), Error::<T>::AlreadyRecoverable);
ensure!(!<Recoverable<T>>::contains_key(&who), Error::<T>::AlreadyRecoverable);
// Check user input is valid
ensure!(threshold >= 1, Error::<T>::ZeroThreshold);
ensure!(!friends.is_empty(), Error::<T>::NotEnoughFriends);
@@ -456,9 +456,9 @@ decl_module! {
fn initiate_recovery(origin, account: T::AccountId) {
let who = ensure_signed(origin)?;
// Check that the account is recoverable
ensure!(<Recoverable<T>>::exists(&account), Error::<T>::NotRecoverable);
ensure!(<Recoverable<T>>::contains_key(&account), Error::<T>::NotRecoverable);
// Check that the recovery process has not already been started
ensure!(!<ActiveRecoveries<T>>::exists(&account, &who), Error::<T>::AlreadyStarted);
ensure!(!<ActiveRecoveries<T>>::contains_key(&account, &who), Error::<T>::AlreadyStarted);
// Take recovery deposit
let recovery_deposit = T::RecoveryDeposit::get();
T::Currency::reserve(&who, recovery_deposit)?;
+3 -3
View File
@@ -92,9 +92,9 @@ fn recovery_lifecycle_works() {
assert_eq!(Balances::free_balance(1), 200);
assert_eq!(Balances::free_balance(5), 0);
// All storage items are removed from the module
assert!(!<ActiveRecoveries<Test>>::exists(&5, &1));
assert!(!<Recoverable<Test>>::exists(&5));
assert!(!<Recovered<Test>>::exists(&5));
assert!(!<ActiveRecoveries<Test>>::contains_key(&5, &1));
assert!(!<Recoverable<Test>>::contains_key(&5));
assert!(!<Recovered<Test>>::contains_key(&5));
});
}