Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
update & cargo +nightly fmt
  • Loading branch information
Doordashcon committed Nov 13, 2021
commit db949cb084048a538fbcde366c44271b5ff06034
46 changes: 33 additions & 13 deletions frame/recovery/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -263,17 +263,21 @@ pub mod pallet {
#[pallet::generate_deposit(pub(super) fn deposit_event)]
pub enum Event<T: Config> {
/// A recovery process has been set up for an account.
RecoveryCreated { account: T::AccountId },
RecoveryCreated { lost_account: T::AccountId },
/// A recovery process has been initiated for lost account by rescuer account.
RecoveryInitiated { lost: T::AccountId, rescuer: T::AccountId },
RecoveryInitiated { lost_account: T::AccountId, rescuer_account: T::AccountId },
/// A recovery process for lost account by rescuer account has been vouched for by sender.
RecoveryVouched { lost: T::AccountId, rescuer: T::AccountId, sender: T::AccountId },
RecoveryVouched {
lost_account: T::AccountId,
rescuer_account: T::AccountId,
sender: T::AccountId,
},
/// A recovery process for lost account by rescuer account has been closed.
RecoveryClosed { lost: T::AccountId, rescuer: T::AccountId },
RecoveryClosed { lost_account: T::AccountId, rescuer_account: T::AccountId },
/// Lost account has been successfully recovered by rescuer account.
AccountRecovered { lost: T::AccountId, rescuer: T::AccountId },
AccountRecovered { lost_account: T::AccountId, rescuer_account: T::AccountId },
/// A recovery process has been removed for an account.
RecoveryRemoved { account: T::AccountId },
RecoveryRemoved { lost_account: T::AccountId },
}

#[pallet::error]
Expand Down Expand Up @@ -405,7 +409,10 @@ pub mod pallet {
ensure_root(origin)?;
// Create the recovery storage item.
<Proxy<T>>::insert(&rescuer, &lost);
Self::deposit_event(Event::<T>::AccountRecovered { lost: lost, rescuer: rescuer });
Self::deposit_event(Event::<T>::AccountRecovered {
lost_account: lost,
rescuer_account: rescuer,
});
Ok(())
}

Expand Down Expand Up @@ -468,7 +475,7 @@ pub mod pallet {
// Create the recovery configuration storage item
<Recoverable<T>>::insert(&who, recovery_config);

Self::deposit_event(Event::<T>::RecoveryCreated { account: who });
Self::deposit_event(Event::<T>::RecoveryCreated { lost_account: who });
Ok(())
}

Expand Down Expand Up @@ -515,7 +522,10 @@ pub mod pallet {
};
// Create the active recovery storage item
<ActiveRecoveries<T>>::insert(&account, &who, recovery_status);
Self::deposit_event(Event::<T>::RecoveryInitiated { lost: account, rescuer: who });
Self::deposit_event(Event::<T>::RecoveryInitiated {
lost_account: account,
rescuer_account: who,
});
Ok(())
}

Expand Down Expand Up @@ -564,7 +574,11 @@ pub mod pallet {
}
// Update storage with the latest details
<ActiveRecoveries<T>>::insert(&lost, &rescuer, active_recovery);
Self::deposit_event(Event::<T>::RecoveryVouched { lost: lost, rescuer: rescuer, sender: who });
Self::deposit_event(Event::<T>::RecoveryVouched {
lost_account: lost,
rescuer_account: rescuer,
sender: who,
});
Ok(())
}

Expand Down Expand Up @@ -613,7 +627,10 @@ pub mod pallet {
frame_system::Pallet::<T>::inc_consumers(&who).map_err(|_| Error::<T>::BadState)?;
// Create the recovery storage item
Proxy::<T>::insert(&who, &account);
Self::deposit_event(Event::<T>::AccountRecovered { lost: account, rescuer: who });
Self::deposit_event(Event::<T>::AccountRecovered {
lost_account: account,
rescuer_account: who,
});
Ok(())
}

Expand Down Expand Up @@ -652,7 +669,10 @@ pub mod pallet {
BalanceStatus::Free,
);
debug_assert!(res.is_ok());
Self::deposit_event(Event::<T>::RecoveryClosed { lost: who, rescuer: rescuer });
Self::deposit_event(Event::<T>::RecoveryClosed {
lost_account: who,
rescuer_account: rescuer,
});
Ok(())
}

Expand Down Expand Up @@ -688,7 +708,7 @@ pub mod pallet {

// Unreserve the initial deposit for the recovery configuration.
T::Currency::unreserve(&who, recovery_config.deposit);
Self::deposit_event(Event::<T>::RecoveryRemoved { account: who });
Self::deposit_event(Event::<T>::RecoveryRemoved { lost_account: who });
Ok(())
}

Expand Down