mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 02:21:04 +00:00
Expose recovery module errors in metadata (#4727)
This commit is contained in:
committed by
Bastian Köcher
parent
ad9c75e4c4
commit
b89ac5d2ef
@@ -15,7 +15,7 @@
|
||||
// along with Substrate. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! # Recovery Pallet
|
||||
//!
|
||||
//!
|
||||
//! - [`recovery::Trait`](./trait.Trait.html)
|
||||
//! - [`Call`](./enum.Call.html)
|
||||
//!
|
||||
@@ -82,7 +82,7 @@
|
||||
//! permissionless. However, the recovery deposit is an economic deterrent that
|
||||
//! should disincentivize would-be attackers from trying to maliciously recover
|
||||
//! accounts.
|
||||
//!
|
||||
//!
|
||||
//! The recovery deposit can always be claimed by the account which is trying to
|
||||
//! to be recovered. In the case of a malicious recovery attempt, the account
|
||||
//! owner who still has access to their account can claim the deposit and
|
||||
@@ -121,14 +121,14 @@
|
||||
//! change as well.
|
||||
//!
|
||||
//! ## Interface
|
||||
//!
|
||||
//!
|
||||
//! ### Dispatchable Functions
|
||||
//!
|
||||
//!
|
||||
//! #### For General Users
|
||||
//!
|
||||
//!
|
||||
//! * `create_recovery` - Create a recovery configuration for your account and make it recoverable.
|
||||
//! * `initiate_recovery` - Start the recovery process for a recoverable account.
|
||||
//!
|
||||
//!
|
||||
//! #### For Friends of a Recoverable Account
|
||||
//! * `vouch_recovery` - As a `friend` of a recoverable account, vouch for a recovery attempt on the account.
|
||||
//!
|
||||
@@ -141,7 +141,7 @@
|
||||
//!
|
||||
//! * `close_recovery` - Close an active recovery process for your account and reclaim the recovery deposit.
|
||||
//! * `remove_recovery` - Remove the recovery configuration from the account, making it un-recoverable.
|
||||
//!
|
||||
//!
|
||||
//! #### For Super Users
|
||||
//!
|
||||
//! * `set_recovered` - The ROOT origin is able to skip the recovery process and directly allow
|
||||
@@ -314,9 +314,11 @@ decl_error! {
|
||||
|
||||
decl_module! {
|
||||
pub struct Module<T: Trait> for enum Call where origin: T::Origin {
|
||||
type Error = Error<T>;
|
||||
|
||||
/// Deposit one of this module's events by using the default implementation.
|
||||
fn deposit_event() = default;
|
||||
|
||||
|
||||
/// Send a call through a recovered account.
|
||||
///
|
||||
/// The dispatch origin for this call must be _Signed_ and registered to
|
||||
@@ -340,7 +342,7 @@ decl_module! {
|
||||
ensure!(Self::recovered_account(&account) == Some(who), Error::<T>::NotAllowed);
|
||||
call.dispatch(frame_system::RawOrigin::Signed(account).into())
|
||||
}
|
||||
|
||||
|
||||
/// Allow ROOT to bypass the recovery process and set an a rescuer account
|
||||
/// for a lost account directly.
|
||||
///
|
||||
@@ -361,7 +363,7 @@ decl_module! {
|
||||
<Recovered<T>>::insert(&lost, &rescuer);
|
||||
Self::deposit_event(RawEvent::AccountRecovered(lost, rescuer));
|
||||
}
|
||||
|
||||
|
||||
/// Create a recovery configuration for your account. This makes your account recoverable.
|
||||
///
|
||||
/// Payment: `ConfigDepositBase` + `FriendDepositFactor` * #_of_friends balance
|
||||
@@ -425,7 +427,7 @@ decl_module! {
|
||||
<Recoverable<T>>::insert(&who, recovery_config);
|
||||
Self::deposit_event(RawEvent::RecoveryCreated(who));
|
||||
}
|
||||
|
||||
|
||||
/// Initiate the process for recovering a recoverable account.
|
||||
///
|
||||
/// Payment: `RecoveryDeposit` balance will be reserved for initiating the
|
||||
@@ -468,7 +470,7 @@ decl_module! {
|
||||
<ActiveRecoveries<T>>::insert(&account, &who, recovery_status);
|
||||
Self::deposit_event(RawEvent::RecoveryInitiated(account, who));
|
||||
}
|
||||
|
||||
|
||||
/// Allow a "friend" of a recoverable account to vouch for an active recovery
|
||||
/// process for that account.
|
||||
///
|
||||
@@ -512,7 +514,7 @@ decl_module! {
|
||||
<ActiveRecoveries<T>>::insert(&lost, &rescuer, active_recovery);
|
||||
Self::deposit_event(RawEvent::RecoveryVouched(lost, rescuer, who));
|
||||
}
|
||||
|
||||
|
||||
/// Allow a successful rescuer to claim their recovered account.
|
||||
///
|
||||
/// The dispatch origin for this call must be _Signed_ and must be a "rescuer"
|
||||
@@ -555,7 +557,7 @@ decl_module! {
|
||||
<Recovered<T>>::insert(&account, &who);
|
||||
Self::deposit_event(RawEvent::AccountRecovered(account, who));
|
||||
}
|
||||
|
||||
|
||||
/// As the controller of a recoverable account, close an active recovery
|
||||
/// process for your account.
|
||||
///
|
||||
@@ -586,7 +588,7 @@ decl_module! {
|
||||
let _ = T::Currency::repatriate_reserved(&rescuer, &who, active_recovery.deposit);
|
||||
Self::deposit_event(RawEvent::RecoveryClosed(who, rescuer));
|
||||
}
|
||||
|
||||
|
||||
/// Remove the recovery process for your account.
|
||||
///
|
||||
/// NOTE: The user must make sure to call `close_recovery` on all active
|
||||
|
||||
Reference in New Issue
Block a user