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