pub struct Pallet<T>(_);

Implementations

Set the new runtime code.

  • O(C + S) where C length of code and S complexity of can_set_code
  • 1 storage write (codec O(C)).
  • 1 call to can_set_code: O(S) (calls sp_io::misc::runtime_version which is expensive).
  • 1 event. The weight of this function is dependent on the runtime, but generally this is very expensive. We will treat this as a full block.

Set the new runtime code without doing any checks of the given code.

  • O(C) where C length of code
  • 1 storage write (codec O(C)).
  • 1 event. The weight of this function is dependent on the runtime. We will treat this as a full block.

Set the new changes trie configuration.

  • O(1)
  • 1 storage write or delete (codec O(1)).
  • 1 call to deposit_log: Uses append API, so O(1)
  • Base Weight: 7.218 µs
  • DB Weight:
    • Writes: Changes Trie, System Digest

The full account information for a particular account ID.

The current weight for the block.

Map of block numbers to block hashes.

Extrinsics data for the current block (maps an extrinsic’s index to its data).

The current block number being processed. Set by execute_block.

Hash of the previous block.

Digest of the current block, also part of the block header.

Events deposited for the current block.

The number of events in the Events<T> list.

Mapping between a topic (represented by T::Hash) and a vector of indexes of events in the <Events<T>> list.

All topic vectors have deterministic storage locations depending on the topic. This allows light-clients to leverage the changes trie storage tracking mechanism and in case of changes fetch the list of events of interest.

The value has the type (T::BlockNumber, EventIndex) because if we used only just the EventIndex then in case if the topic has the same contents on the next block no notification will be triggered thus the event might be lost.

👎 Deprecated:

Use inc_consumers instead

Increment the reference counter on an account.

👎 Deprecated:

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.

👎 Deprecated:

Use consumers instead

The number of outstanding references for the account who.

👎 Deprecated:

Use !is_provider_required instead

True if the account has no outstanding references.

Increment the reference counter on an account.

The account who’s providers must be non-zero or this will return an error.

Decrement the reference counter on an account. This MUST only be done once for every time you called inc_consumers on who.

The number of outstanding references for the account who.

Increment the reference counter on an account.

The account who’s providers must be non-zero or this will return an error.

Decrement the reference counter on an account. This MUST only be done once for every time you called inc_consumers on who.

The number of outstanding references for the account who.

True if the account has some outstanding references.

Deposits an event into this block’s event record.

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.

Gets the index of extrinsic that is currently executing.

Gets extrinsics count.

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.

Start the execution of a particular block.

Remove temporary “environment” entries in storage, compute the storage root and return the resulting header for this block.

Deposits a log and ensures it matches the block’s log data.

  • O(1)
  • 1 storage write (codec O(1))

Get the basic externalities for this pallet, useful for tests.

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.

Sets the index of extrinsic that is currently executing.

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.

Set the current block weight. This should only be used in some integration tests.

Reset events. Can be used as an alternative to initialize for tests that don’t need to bother with the other environment entries.

Return the chain’s current runtime version.

Retrieve the account transaction counter from storage.

Increment a particular account’s nonce by 1.

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.

To be called immediately after an extrinsic has been applied.

To be called immediately after note_applied_extrinsic of the last extrinsic of the block has been called.

To be called immediately after finishing the initialization of the block (e.g., called on_initialize for all pallets).

An account is being created.

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.

Trait Implementations

Type of BlockNumber to provide.

Returns the current block number. Read more

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the current version of the pallet.

Returns the version of the pallet that is stored in storage. Read more

Perform a module upgrade. Read more

Run integrity test. Read more

The block is being finalized. Implement to have something happen.

The block is being initialized. Implement to have something happen. Read more

Implementing this function on a module allows you to perform long-running tasks that make (by default) validators generate transactions that feed results of those long-running computations back on chain. Read more

Run integrity test. Read more

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

The block is being finalized. Implement to have something happen. Read more

Something that should happen at genesis.

The block is being initialized. Implement to have something happen. Read more

Perform a module upgrade. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Implement StoredMap for a simple single-item, provide-when-not-default system. This works fine for storing a single item which allows the account to continue existing as long as it’s not empty/default.

Anything more complex will need more sophisticated logic.

Get the item, or its default if it doesn’t yet exist; we make no distinction between the two. Read more

Maybe mutate the item only if an Ok value is returned from f. Do nothing if an Err is returned. It is removed or reset to default value if it has been mutated to None Read more

Mutate the item.

Mutate the item, removing or resetting to default value if it has been mutated to None. Read more

Set the item to something new.

Remove the item or otherwise replace it with its default value; we don’t care which.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Convert from a value of T into an equivalent instance of Option<Self>. Read more

Consume self to return Some equivalent value of Option<T>. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Cast reference.

Cast reference.

Cast mutable reference.

Cast mutable reference.

Get a reference to the inner from the outer.

Get a mutable reference to the inner from the outer.

Should always be Self

Convert from a value of T into an equivalent instance of Self. Read more

Consume self to return an equivalent value of T. Read more

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The counterpart to unchecked_from.

Consume self to return an equivalent value of T.