Type Alias moonbeam_runtime::Identity

source ·
pub type Identity = Pallet<Runtime>;

Aliased Type§

struct Identity(/* private fields */);

Implementations

§

impl<T> Pallet<T>
where T: Config,

Identity pallet declaration.

pub fn add_registrar( origin: <T as Config>::RuntimeOrigin, account: <<T as Config>::Lookup as StaticLookup>::Source, ) -> Result<PostDispatchInfo, DispatchErrorWithPostInfo<PostDispatchInfo>>

Add a registrar to the system.

The dispatch origin for this call must be T::RegistrarOrigin.

  • account: the account of the registrar.

Emits RegistrarAdded if successful.

pub fn set_identity( origin: <T as Config>::RuntimeOrigin, info: Box<<T as Config>::IdentityInformation>, ) -> Result<PostDispatchInfo, DispatchErrorWithPostInfo<PostDispatchInfo>>

Set an account’s identity information and reserve the appropriate deposit.

If the account already has identity information, the deposit is taken as part payment for the new deposit.

The dispatch origin for this call must be Signed.

  • info: The identity information.

Emits IdentitySet if successful.

pub fn set_subs( origin: <T as Config>::RuntimeOrigin, subs: Vec<(<T as Config>::AccountId, Data)>, ) -> Result<PostDispatchInfo, DispatchErrorWithPostInfo<PostDispatchInfo>>

Set the sub-accounts of the sender.

Payment: Any aggregate balance reserved by previous set_subs calls will be returned and an amount SubAccountDeposit will be reserved for each item in subs.

The dispatch origin for this call must be Signed and the sender must have a registered identity.

  • subs: The identity’s (new) sub-accounts.

pub fn clear_identity( origin: <T as Config>::RuntimeOrigin, ) -> Result<PostDispatchInfo, DispatchErrorWithPostInfo<PostDispatchInfo>>

Clear an account’s identity info and all sub-accounts and return all deposits.

Payment: All reserved balances on the account are returned.

The dispatch origin for this call must be Signed and the sender must have a registered identity.

Emits IdentityCleared if successful.

pub fn request_judgement( origin: <T as Config>::RuntimeOrigin, reg_index: u32, max_fee: <<T as Config>::Currency as Currency<<T as Config>::AccountId>>::Balance, ) -> Result<PostDispatchInfo, DispatchErrorWithPostInfo<PostDispatchInfo>>

Request a judgement from a registrar.

Payment: At most max_fee will be reserved for payment to the registrar if judgement given.

The dispatch origin for this call must be Signed and the sender must have a registered identity.

  • reg_index: The index of the registrar whose judgement is requested.
  • max_fee: The maximum fee that may be paid. This should just be auto-populated as:
Registrars::<T>::get().get(reg_index).unwrap().fee

Emits JudgementRequested if successful.

pub fn cancel_request( origin: <T as Config>::RuntimeOrigin, reg_index: u32, ) -> Result<PostDispatchInfo, DispatchErrorWithPostInfo<PostDispatchInfo>>

Cancel a previous request.

Payment: A previously reserved deposit is returned on success.

The dispatch origin for this call must be Signed and the sender must have a registered identity.

  • reg_index: The index of the registrar whose judgement is no longer requested.

Emits JudgementUnrequested if successful.

pub fn set_fee( origin: <T as Config>::RuntimeOrigin, index: u32, fee: <<T as Config>::Currency as Currency<<T as Config>::AccountId>>::Balance, ) -> Result<PostDispatchInfo, DispatchErrorWithPostInfo<PostDispatchInfo>>

Set the fee required for a judgement to be requested from a registrar.

The dispatch origin for this call must be Signed and the sender must be the account of the registrar whose index is index.

  • index: the index of the registrar whose fee is to be set.
  • fee: the new fee.

pub fn set_account_id( origin: <T as Config>::RuntimeOrigin, index: u32, new: <<T as Config>::Lookup as StaticLookup>::Source, ) -> Result<PostDispatchInfo, DispatchErrorWithPostInfo<PostDispatchInfo>>

Change the account associated with a registrar.

The dispatch origin for this call must be Signed and the sender must be the account of the registrar whose index is index.

  • index: the index of the registrar whose fee is to be set.
  • new: the new account ID.

pub fn set_fields( origin: <T as Config>::RuntimeOrigin, index: u32, fields: <<T as Config>::IdentityInformation as IdentityInformationProvider>::FieldsIdentifier, ) -> Result<PostDispatchInfo, DispatchErrorWithPostInfo<PostDispatchInfo>>

Set the field information for a registrar.

The dispatch origin for this call must be Signed and the sender must be the account of the registrar whose index is index.

  • index: the index of the registrar whose fee is to be set.
  • fields: the fields that the registrar concerns themselves with.

pub fn provide_judgement( origin: <T as Config>::RuntimeOrigin, reg_index: u32, target: <<T as Config>::Lookup as StaticLookup>::Source, judgement: Judgement<<<T as Config>::Currency as Currency<<T as Config>::AccountId>>::Balance>, identity: <T as Config>::Hash, ) -> Result<PostDispatchInfo, DispatchErrorWithPostInfo<PostDispatchInfo>>

Provide a judgement for an account’s identity.

The dispatch origin for this call must be Signed and the sender must be the account of the registrar whose index is reg_index.

  • reg_index: the index of the registrar whose judgement is being made.
  • target: the account whose identity the judgement is upon. This must be an account with a registered identity.
  • judgement: the judgement of the registrar of index reg_index about target.
  • identity: The hash of the [IdentityInformationProvider] for that the judgement is provided.

Note: Judgements do not apply to a username.

Emits JudgementGiven if successful.

pub fn kill_identity( origin: <T as Config>::RuntimeOrigin, target: <<T as Config>::Lookup as StaticLookup>::Source, ) -> Result<PostDispatchInfo, DispatchErrorWithPostInfo<PostDispatchInfo>>

Remove an account’s identity and sub-account information and slash the deposits.

Payment: Reserved balances from set_subs and set_identity are slashed and handled by Slash. Verification request deposits are not returned; they should be cancelled manually using cancel_request.

The dispatch origin for this call must match T::ForceOrigin.

  • target: the account whose identity the judgement is upon. This must be an account with a registered identity.

Emits IdentityKilled if successful.

pub fn add_sub( origin: <T as Config>::RuntimeOrigin, sub: <<T as Config>::Lookup as StaticLookup>::Source, data: Data, ) -> Result<(), DispatchError>

Add the given account to the sender’s subs.

Payment: Balance reserved by a previous set_subs call for one sub will be repatriated to the sender.

The dispatch origin for this call must be Signed and the sender must have a registered sub identity of sub.

pub fn rename_sub( origin: <T as Config>::RuntimeOrigin, sub: <<T as Config>::Lookup as StaticLookup>::Source, data: Data, ) -> Result<(), DispatchError>

Alter the associated name of the given sub-account.

The dispatch origin for this call must be Signed and the sender must have a registered sub identity of sub.

pub fn remove_sub( origin: <T as Config>::RuntimeOrigin, sub: <<T as Config>::Lookup as StaticLookup>::Source, ) -> Result<(), DispatchError>

Remove the given account from the sender’s subs.

Payment: Balance reserved by a previous set_subs call for one sub will be repatriated to the sender.

The dispatch origin for this call must be Signed and the sender must have a registered sub identity of sub.

pub fn quit_sub( origin: <T as Config>::RuntimeOrigin, ) -> Result<(), DispatchError>

Remove the sender as a sub-account.

Payment: Balance reserved by a previous set_subs call for one sub will be repatriated to the sender (not the original depositor).

The dispatch origin for this call must be Signed and the sender must have a registered super-identity.

NOTE: This should not normally be used, but is provided in the case that the non- controller of an account is maliciously registered as a sub-account.

pub fn add_username_authority( origin: <T as Config>::RuntimeOrigin, authority: <<T as Config>::Lookup as StaticLookup>::Source, suffix: Vec<u8>, allocation: u32, ) -> Result<(), DispatchError>

Add an AccountId with permission to grant usernames with a given suffix appended.

The authority can grant up to allocation usernames. To top up the allocation or change the account used to grant usernames, this call can be used with the updated parameters to overwrite the existing configuration.

pub fn remove_username_authority( origin: <T as Config>::RuntimeOrigin, suffix: Vec<u8>, authority: <<T as Config>::Lookup as StaticLookup>::Source, ) -> Result<(), DispatchError>

Remove authority from the username authorities.

pub fn set_username_for( origin: <T as Config>::RuntimeOrigin, who: <<T as Config>::Lookup as StaticLookup>::Source, username: Vec<u8>, signature: Option<<T as Config>::OffchainSignature>, use_allocation: bool, ) -> Result<(), DispatchError>

Set the username for who. Must be called by a username authority.

If use_allocation is set, the authority must have a username allocation available to spend. Otherwise, the authority will need to put up a deposit for registering the username.

Users can either pre-sign their usernames or accept them later.

Usernames must:

  • Only contain lowercase ASCII characters or digits.
  • When combined with the suffix of the issuing authority be less than the MaxUsernameLength.

pub fn accept_username( origin: <T as Config>::RuntimeOrigin, username: BoundedVec<u8, <T as Config>::MaxUsernameLength>, ) -> Result<PostDispatchInfo, DispatchErrorWithPostInfo<PostDispatchInfo>>

Accept a given username that an authority granted. The call must include the full username, as in username.suffix.

pub fn remove_expired_approval( origin: <T as Config>::RuntimeOrigin, username: BoundedVec<u8, <T as Config>::MaxUsernameLength>, ) -> Result<PostDispatchInfo, DispatchErrorWithPostInfo<PostDispatchInfo>>

Remove an expired username approval. The username was approved by an authority but never accepted by the user and must now be beyond its expiration. The call must include the full username, as in username.suffix.

pub fn set_primary_username( origin: <T as Config>::RuntimeOrigin, username: BoundedVec<u8, <T as Config>::MaxUsernameLength>, ) -> Result<(), DispatchError>

Set a given username as the primary. The username should include the suffix.

pub fn unbind_username( origin: <T as Config>::RuntimeOrigin, username: BoundedVec<u8, <T as Config>::MaxUsernameLength>, ) -> Result<(), DispatchError>

Start the process of removing a username by placing it in the unbinding usernames map. Once the grace period has passed, the username can be deleted by calling remove_username.

pub fn remove_username( origin: <T as Config>::RuntimeOrigin, username: BoundedVec<u8, <T as Config>::MaxUsernameLength>, ) -> Result<PostDispatchInfo, DispatchErrorWithPostInfo<PostDispatchInfo>>

Permanently delete a username which has been unbinding for longer than the grace period. Caller is refunded the fee if the username expired and the removal was successful.

pub fn kill_username( origin: <T as Config>::RuntimeOrigin, username: BoundedVec<u8, <T as Config>::MaxUsernameLength>, ) -> Result<PostDispatchInfo, DispatchErrorWithPostInfo<PostDispatchInfo>>

Call with ForceOrigin privileges which deletes a username and slashes any deposit associated with it.

§

impl<T> Pallet<T>
where T: Config,

pub fn subs( who: &<T as Config>::AccountId, ) -> Vec<(<T as Config>::AccountId, Data)>

Get the subs of an account.

pub fn has_identity( who: &<T as Config>::AccountId, fields: <<T as Config>::IdentityInformation as IdentityInformationProvider>::FieldsIdentifier, ) -> bool

Check if the account has corresponding identity information by the identity field.

pub fn validate_signature( data: &[u8], signature: &<T as Config>::OffchainSignature, signer: &<T as Config>::AccountId, ) -> Result<(), DispatchError>

Validate a signature. Supports signatures on raw data or data wrapped in HTML <Bytes>.

pub fn insert_username( who: &<T as Config>::AccountId, username: BoundedVec<u8, <T as Config>::MaxUsernameLength>, provider: Provider<<<T as Config>::Currency as Currency<<T as Config>::AccountId>>::Balance>, )

A username has met all conditions. Insert the relevant storage items.

pub fn queue_acceptance( who: &<T as Config>::AccountId, username: BoundedVec<u8, <T as Config>::MaxUsernameLength>, provider: Provider<<<T as Config>::Currency as Currency<<T as Config>::AccountId>>::Balance>, )

A username was granted by an authority, but must be accepted by who. Put the username into a queue for acceptance.

pub fn reap_identity( who: &<T as Config>::AccountId, ) -> Result<(u32, u32, u32), DispatchError>

Reap an identity, clearing associated storage items and refunding any deposits. This function is very similar to (a) clear_identity, but called on a target account instead of self; and (b) kill_identity, but without imposing a slash.

Parameters:

  • target: The account for which to reap identity state.

Return type is a tuple of the number of registrars, IdentityInfo bytes, and sub accounts, respectively.

NOTE: This function is here temporarily for migration of Identity info from the Polkadot Relay Chain into a system parachain. It will be removed after the migration.

pub fn poke_deposit( target: &<T as Config>::AccountId, ) -> Result<(<<T as Config>::Currency as Currency<<T as Config>::AccountId>>::Balance, <<T as Config>::Currency as Currency<<T as Config>::AccountId>>::Balance), DispatchError>

Update the deposits held by target for its identity info.

Parameters:

  • target: The account for which to update deposits.

Return type is a tuple of the new Identity and Subs deposits, respectively.

NOTE: This function is here temporarily for migration of Identity info from the Polkadot Relay Chain into a system parachain. It will be removed after the migration.

pub fn set_identity_no_deposit( who: &<T as Config>::AccountId, info: <T as Config>::IdentityInformation, ) -> Result<(), DispatchError>

Set an identity with zero deposit. Used for benchmarking and XCM emulator tests that involve rejig_deposit.

pub fn set_subs_no_deposit( who: &<T as Config>::AccountId, subs: Vec<(<T as Config>::AccountId, Data)>, ) -> Result<(), DispatchError>

Set subs with zero deposit and default name. Only used for benchmarks that involve rejig_deposit.

Trait Implementations

§

impl<T> BeforeAllRuntimeMigrations for Pallet<T>
where T: Config,

§

fn before_all_runtime_migrations() -> Weight

Something that should happen before runtime migrations are executed.
§

impl<T> Callable<T> for Pallet<T>
where T: Config,

§

type RuntimeCall = Call<T>

§

impl<T> Clone for Pallet<T>

§

fn clone(&self) -> Pallet<T>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl<T> Debug for Pallet<T>

§

fn fmt(&self, fmt: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl<T> GetStorageVersion for Pallet<T>
where T: Config,

§

type InCodeStorageVersion = StorageVersion

This type is generated by the pallet macro. Read more
§

fn in_code_storage_version() -> <Pallet<T> as GetStorageVersion>::InCodeStorageVersion

Returns the in-code storage version as specified in the storage_version attribute, or [NoStorageVersionSet] if the attribute is missing.
§

fn on_chain_storage_version() -> StorageVersion

Returns the storage version of the pallet as last set in the actual on-chain storage.
§

fn current_storage_version() -> Self::InCodeStorageVersion

👎Deprecated: This method has been renamed to in_code_storage_version and will be removed after March 2024.
DEPRECATED: Use [Self::current_storage_version] instead. Read more
§

impl<T> Hooks<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>
where T: Config,

§

fn on_initialize(_n: BlockNumber) -> Weight

Block initialization hook. This is called at the very beginning of block execution. Read more
§

fn on_finalize(_n: BlockNumber)

Block finalization hook. This is called at the very end of block execution. Read more
§

fn on_idle(_n: BlockNumber, _remaining_weight: Weight) -> Weight

Hook to consume a block’s idle time. This will run when the block is being finalized (before [Hooks::on_finalize]). Read more
§

fn on_poll(_n: BlockNumber, _weight: &mut WeightMeter)

A hook to run logic after inherent application. Read more
§

fn on_runtime_upgrade() -> Weight

Hook executed when a code change (aka. a “runtime upgrade”) is detected by the FRAME Executive pallet. Read more
§

fn offchain_worker(_n: BlockNumber)

Implementing this function on a pallet allows you to perform long-running tasks that are dispatched as separate threads, and entirely independent of the main blockchain execution. Read more
§

fn integrity_test()

Check the integrity of this pallet’s configuration. Read more
§

impl<T> IntegrityTest for Pallet<T>
where T: Config,

§

fn integrity_test()

See [Hooks::integrity_test].
§

impl<T> OffchainWorker<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>
where T: Config,

§

fn offchain_worker( n: <<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number, )

This function is being called after every block import (when fully synced). Read more
§

impl<T> OnFinalize<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>
where T: Config,

§

fn on_finalize( n: <<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number, )

See [Hooks::on_finalize].
§

impl<T> OnGenesis for Pallet<T>
where T: Config,

§

fn on_genesis()

Something that should happen at genesis.
§

impl<T> OnIdle<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>
where T: Config,

§

fn on_idle( n: <<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number, remaining_weight: Weight, ) -> Weight

See [Hooks::on_idle].
§

impl<T> OnInitialize<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>
where T: Config,

§

fn on_initialize( n: <<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number, ) -> Weight

See [Hooks::on_initialize].
§

impl<T> OnPoll<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>
where T: Config,

§

fn on_poll( n: <<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number, weight: &mut WeightMeter, )

Code to execute every now and then at the beginning of the block after inherent application. Read more
§

impl<T> OnRuntimeUpgrade for Pallet<T>
where T: Config,

§

fn on_runtime_upgrade() -> Weight

See [Hooks::on_runtime_upgrade].
§

impl<T> PalletInfoAccess for Pallet<T>
where T: Config,

§

fn index() -> usize

Index of the pallet as configured in the runtime.
§

fn name() -> &'static str

Name of the pallet as configured in the runtime.
§

fn name_hash() -> [u8; 16]

Two128 hash of name.
§

fn module_name() -> &'static str

Name of the Rust module containing the pallet.
§

fn crate_version() -> CrateVersion

Version of the crate containing the pallet.
§

impl<T> PalletsInfoAccess for Pallet<T>
where T: Config,

§

fn count() -> usize

The number of pallets’ information that this type represents. Read more
§

fn infos() -> Vec<PalletInfoData>

All of the pallets’ information that this type represents.
§

impl<T> PartialEq for Pallet<T>

§

fn eq(&self, other: &Pallet<T>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl<T> StorageInfoTrait for Pallet<T>
where T: Config,

§

fn storage_info() -> Vec<StorageInfo>

§

impl<T> WhitelistedStorageKeys for Pallet<T>
where T: Config,

§

fn whitelisted_storage_keys() -> Vec<TrackedStorageKey>

Returns a Vec<TrackedStorageKey> indicating the storage keys that should be whitelisted during benchmarking. This means that those keys will be excluded from the benchmarking performance calculation.
§

impl<T> Eq for Pallet<T>