Type Definition frame_system::pallet::Module
source · [−]pub type Module<T> = Pallet<T>;
Expand description
Type alias to Pallet
, to be used by construct_runtime
.
Generated by pallet
attribute macro.
Implementations
sourceimpl<T: Config> Module<T>
impl<T: Config> Module<T>
pub fn account_exists(who: &T::AccountId) -> bool
sourcepub fn inc_ref(who: &T::AccountId)
👎 Deprecated: Use inc_consumers
instead
pub fn inc_ref(who: &T::AccountId)
Use inc_consumers
instead
Increment the reference counter on an account.
sourcepub fn dec_ref(who: &T::AccountId)
👎 Deprecated: Use dec_consumers
instead
pub fn dec_ref(who: &T::AccountId)
Use dec_consumers
instead
Decrement the reference counter on an account. This MUST only be done once for every time
you called inc_consumers
on who
.
sourcepub fn refs(who: &T::AccountId) -> RefCount
👎 Deprecated: Use consumers
instead
pub fn refs(who: &T::AccountId) -> RefCount
Use consumers
instead
The number of outstanding references for the account who
.
sourcepub fn allow_death(who: &T::AccountId) -> bool
👎 Deprecated: Use !is_provider_required
instead
pub fn allow_death(who: &T::AccountId) -> bool
Use !is_provider_required
instead
True if the account has no outstanding references.
sourcepub fn inc_providers(who: &T::AccountId) -> IncRefStatus
pub fn inc_providers(who: &T::AccountId) -> IncRefStatus
Increment the reference counter on an account.
The account who
’s providers
must be non-zero or this will return an error.
sourcepub fn dec_providers(who: &T::AccountId) -> Result<DecRefStatus, DecRefError>
pub fn dec_providers(who: &T::AccountId) -> Result<DecRefStatus, DecRefError>
Decrement the reference counter on an account. This MUST only be done once for every time
you called inc_consumers
on who
.
sourcepub fn providers(who: &T::AccountId) -> RefCount
pub fn providers(who: &T::AccountId) -> RefCount
The number of outstanding references for the account who
.
sourcepub fn inc_consumers(who: &T::AccountId) -> Result<(), IncRefError>
pub fn inc_consumers(who: &T::AccountId) -> Result<(), IncRefError>
Increment the reference counter on an account.
The account who
’s providers
must be non-zero or this will return an error.
sourcepub fn dec_consumers(who: &T::AccountId)
pub fn dec_consumers(who: &T::AccountId)
Decrement the reference counter on an account. This MUST only be done once for every time
you called inc_consumers
on who
.
sourcepub fn consumers(who: &T::AccountId) -> RefCount
pub fn consumers(who: &T::AccountId) -> RefCount
The number of outstanding references for the account who
.
sourcepub fn is_provider_required(who: &T::AccountId) -> bool
pub fn is_provider_required(who: &T::AccountId) -> bool
True if the account has some outstanding references.
sourcepub fn deposit_event(event: impl Into<T::Event>)
pub fn deposit_event(event: impl Into<T::Event>)
Deposits an event into this block’s event record.
sourcepub fn deposit_event_indexed(topics: &[T::Hash], event: T::Event)
pub fn deposit_event_indexed(topics: &[T::Hash], event: T::Event)
Deposits an event into this block’s event record adding this event to the corresponding topic indexes.
This will update storage entries that correspond to the specified topics. It is expected that light-clients could subscribe to this topics.
sourcepub fn extrinsic_index() -> Option<u32>
pub fn extrinsic_index() -> Option<u32>
Gets the index of extrinsic that is currently executing.
sourcepub fn extrinsic_count() -> u32
pub fn extrinsic_count() -> u32
Gets extrinsics count.
pub fn all_extrinsics_len() -> u32
sourcepub fn register_extra_weight_unchecked(weight: Weight, class: DispatchClass)
pub fn register_extra_weight_unchecked(weight: Weight, class: DispatchClass)
Inform the system pallet of some additional weight that should be accounted for, in the current block.
NOTE: use with extra care; this function is made public only be used for certain pallets
that need it. A runtime that does not have dynamic calls should never need this and should
stick to static weights. A typical use case for this is inner calls or smart contract calls.
Furthermore, it only makes sense to use this when it is presumably cheap to provide the
argument weight
; In other words, if this function is to be used to account for some
unknown, user provided call’s weight, it would only make sense to use it if you are sure you
can rapidly compute the weight of the inner call.
Even more dangerous is to note that this function does NOT take any action, if the new sum of block weight is more than the block weight limit. This is what the unchecked.
Another potential use-case could be for the on_initialize
and on_finalize
hooks.
sourcepub fn initialize(
number: &T::BlockNumber,
parent_hash: &T::Hash,
digest: &DigestOf<T>,
kind: InitKind
)
pub fn initialize(
number: &T::BlockNumber,
parent_hash: &T::Hash,
digest: &DigestOf<T>,
kind: InitKind
)
Start the execution of a particular block.
sourcepub fn finalize() -> T::Header
pub fn finalize() -> T::Header
Remove temporary “environment” entries in storage, compute the storage root and return the resulting header for this block.
sourcepub fn deposit_log(item: DigestItemOf<T>)
pub fn deposit_log(item: DigestItemOf<T>)
sourcepub fn externalities() -> TestExternalities
pub fn externalities() -> TestExternalities
Get the basic externalities for this pallet, useful for tests.
sourcepub fn set_block_number(n: T::BlockNumber)
pub fn set_block_number(n: T::BlockNumber)
Set the block number to something in particular. Can be used as an alternative to
initialize
for tests that don’t need to bother with the other environment entries.
sourcepub fn set_extrinsic_index(extrinsic_index: u32)
pub fn set_extrinsic_index(extrinsic_index: u32)
Sets the index of extrinsic that is currently executing.
sourcepub fn set_parent_hash(n: T::Hash)
pub fn set_parent_hash(n: T::Hash)
Set the parent hash number to something in particular. Can be used as an alternative to
initialize
for tests that don’t need to bother with the other environment entries.
sourcepub fn set_block_consumed_resources(weight: Weight, len: usize)
pub fn set_block_consumed_resources(weight: Weight, len: usize)
Set the current block weight. This should only be used in some integration tests.
sourcepub fn reset_events()
pub fn reset_events()
Reset events. Can be used as an alternative to
initialize
for tests that don’t need to bother with the other environment entries.
sourcepub fn runtime_version() -> RuntimeVersion
pub fn runtime_version() -> RuntimeVersion
Return the chain’s current runtime version.
sourcepub fn account_nonce(who: impl EncodeLike<T::AccountId>) -> T::Index
pub fn account_nonce(who: impl EncodeLike<T::AccountId>) -> T::Index
Retrieve the account transaction counter from storage.
sourcepub fn inc_account_nonce(who: impl EncodeLike<T::AccountId>)
pub fn inc_account_nonce(who: impl EncodeLike<T::AccountId>)
Increment a particular account’s nonce by 1.
sourcepub fn note_extrinsic(encoded_xt: Vec<u8>)
pub fn note_extrinsic(encoded_xt: Vec<u8>)
Note what the extrinsic data of the current extrinsic index is.
This is required to be called before applying an extrinsic. The data will used
in Self::finalize
to calculate the correct extrinsics root.
sourcepub fn note_applied_extrinsic(
r: &DispatchResultWithPostInfo,
info: DispatchInfo
)
pub fn note_applied_extrinsic(
r: &DispatchResultWithPostInfo,
info: DispatchInfo
)
To be called immediately after an extrinsic has been applied.
sourcepub fn note_finished_extrinsics()
pub fn note_finished_extrinsics()
To be called immediately after note_applied_extrinsic
of the last extrinsic of the block
has been called.
sourcepub fn note_finished_initialize()
pub fn note_finished_initialize()
To be called immediately after finishing the initialization of the block
(e.g., called on_initialize
for all pallets).
sourcepub fn on_created_account(
who: T::AccountId,
_a: &mut AccountInfo<T::Index, T::AccountData>
)
pub fn on_created_account(
who: T::AccountId,
_a: &mut AccountInfo<T::Index, T::AccountData>
)
An account is being created.
sourcepub fn can_set_code(code: &[u8]) -> Result<(), DispatchError>
pub fn can_set_code(code: &[u8]) -> Result<(), DispatchError>
Determine whether or not it is possible to update the code.
Checks the given code if it is a valid runtime wasm blob by instantianting it and extracting the runtime version of it. It checks that the runtime version of the old and new runtime has the same spec name and that the spec version is increasing.