pallet_permission0/permission/
wallet.rs

1use codec::{Decode, Encode, MaxEncodedLen};
2use polkadot_sdk::frame_support::{CloneNoBound, DebugNoBound, EqNoBound, PartialEqNoBound};
3use scale_info::TypeInfo;
4
5use crate::Config;
6
7#[derive(CloneNoBound, DebugNoBound, Encode, Decode, MaxEncodedLen, TypeInfo)]
8#[scale_info(skip_type_params(T))]
9pub struct WalletScope<T: Config> {
10    pub recipient: T::AccountId,
11    pub r#type: WalletScopeType,
12}
13
14impl<T: Config> WalletScope<T> {
15    /// Cleanup operations when permission is revoked or expired
16    pub(crate) fn cleanup(
17        &self,
18        _permission_id: polkadot_sdk::sp_core::H256,
19        _last_execution: &Option<crate::BlockNumberFor<T>>,
20        _delegator: &T::AccountId,
21    ) {
22        // No actions to perform
23    }
24}
25
26#[derive(CloneNoBound, DebugNoBound, Encode, Decode, MaxEncodedLen, TypeInfo)]
27pub enum WalletScopeType {
28    Stake(WalletStake),
29}
30
31#[derive(
32    CloneNoBound, DebugNoBound, Encode, Decode, MaxEncodedLen, TypeInfo, PartialEqNoBound, EqNoBound,
33)]
34pub struct WalletStake {
35    /// If true, allows the recipient to perform transfer of stake between staked accounts.
36    pub can_transfer_stake: bool,
37    /// If true, this permission holds exclusive access to the delegator stake, meaning that
38    /// the delegator has no right to perform operations over stake (including unstaking)
39    /// while this permission is active.
40    pub exclusive_stake_access: bool,
41}