pub struct Pallet<T, I = ()>(_);
Expand description

The Pallet struct, the main type that implements traits and standalone functions within the pallet.

Implementations§

source§

impl<T: Config<I>, I: 'static> Pallet<T, I>

source

pub fn adjust_extra( id: T::AssetId, who: impl Borrow<T::AccountId> ) -> Option<ExtraMutator<T, I>>

Return the extra “sid-car” data for id/who, or None if the account doesn’t exist.

source

pub fn balance(id: T::AssetId, who: impl Borrow<T::AccountId>) -> T::Balance

Get the asset id balance of who, or zero if the asset-account doesn’t exist.

source

pub fn maybe_balance( id: T::AssetId, who: impl Borrow<T::AccountId> ) -> Option<T::Balance>

Get the asset id balance of who if the asset-account exists.

source

pub fn total_supply(id: T::AssetId) -> T::Balance

Get the total supply of an asset id.

source

pub fn maybe_total_supply(id: T::AssetId) -> Option<T::Balance>

Get the total supply of an asset id if the asset exists.

source

pub fn account_balances(account: T::AccountId) -> Vec<(T::AssetId, T::Balance)>

Returns all the non-zero balances for all assets of the given account.

source§

impl<T: Config<I>, I: 'static> Pallet<T, I>

source

pub fn create( origin: OriginFor<T>, id: T::AssetIdParameter, admin: <<T as Config>::Lookup as StaticLookup>::Source, min_balance: T::Balance ) -> DispatchResult

Issue a new class of fungible assets from a public origin.

This new asset class has no assets initially and its owner is the origin.

The origin must conform to the configured CreateOrigin and have sufficient funds free.

Funds of sender are reserved by AssetDeposit.

Parameters:

  • id: The identifier of the new asset. This must not be currently in use to identify an existing asset.
  • admin: The admin of this class of assets. The admin is the initial address of each member of the asset class’s admin team.
  • min_balance: The minimum balance of this new asset that any single account must have. If an account’s balance is reduced below this, then it collapses to zero.

Emits Created event when successful.

Weight: O(1)

source

pub fn force_create( origin: OriginFor<T>, id: T::AssetIdParameter, owner: <<T as Config>::Lookup as StaticLookup>::Source, is_sufficient: bool, min_balance: T::Balance ) -> DispatchResult

Issue a new class of fungible assets from a privileged origin.

This new asset class has no assets initially.

The origin must conform to ForceOrigin.

Unlike create, no funds are reserved.

  • id: The identifier of the new asset. This must not be currently in use to identify an existing asset.
  • owner: The owner of this class of assets. The owner has full superuser permissions over this asset, but may later change and configure the permissions using transfer_ownership and set_team.
  • min_balance: The minimum balance of this new asset that any single account must have. If an account’s balance is reduced below this, then it collapses to zero.

Emits ForceCreated event when successful.

Weight: O(1)

source

pub fn start_destroy( origin: OriginFor<T>, id: T::AssetIdParameter ) -> DispatchResult

Start the process of destroying a fungible asset class.

start_destroy is the first in a series of extrinsics that should be called, to allow destruction of an asset class.

The origin must conform to ForceOrigin or must be Signed by the asset’s owner.

  • id: The identifier of the asset to be destroyed. This must identify an existing asset.

The asset class must be frozen before calling start_destroy.

source

pub fn destroy_accounts( origin: OriginFor<T>, id: T::AssetIdParameter ) -> DispatchResultWithPostInfo

Destroy all accounts associated with a given asset.

destroy_accounts should only be called after start_destroy has been called, and the asset is in a Destroying state.

Due to weight restrictions, this function may need to be called multiple times to fully destroy all accounts. It will destroy RemoveItemsLimit accounts at a time.

  • id: The identifier of the asset to be destroyed. This must identify an existing asset.

Each call emits the Event::DestroyedAccounts event.

source

pub fn destroy_approvals( origin: OriginFor<T>, id: T::AssetIdParameter ) -> DispatchResultWithPostInfo

Destroy all approvals associated with a given asset up to the max (T::RemoveItemsLimit).

destroy_approvals should only be called after start_destroy has been called, and the asset is in a Destroying state.

Due to weight restrictions, this function may need to be called multiple times to fully destroy all approvals. It will destroy RemoveItemsLimit approvals at a time.

  • id: The identifier of the asset to be destroyed. This must identify an existing asset.

Each call emits the Event::DestroyedApprovals event.

source

pub fn finish_destroy( origin: OriginFor<T>, id: T::AssetIdParameter ) -> DispatchResult

Complete destroying asset and unreserve currency.

finish_destroy should only be called after start_destroy has been called, and the asset is in a Destroying state. All accounts or approvals should be destroyed before hand.

  • id: The identifier of the asset to be destroyed. This must identify an existing asset.

Each successful call emits the Event::Destroyed event.

source

pub fn mint( origin: OriginFor<T>, id: T::AssetIdParameter, beneficiary: <<T as Config>::Lookup as StaticLookup>::Source, amount: T::Balance ) -> DispatchResult

Mint assets of a particular class.

The origin must be Signed and the sender must be the Issuer of the asset id.

  • id: The identifier of the asset to have some amount minted.
  • beneficiary: The account to be credited with the minted assets.
  • amount: The amount of the asset to be minted.

Emits Issued event when successful.

Weight: O(1) Modes: Pre-existing balance of beneficiary; Account pre-existence of beneficiary.

source

pub fn burn( origin: OriginFor<T>, id: T::AssetIdParameter, who: <<T as Config>::Lookup as StaticLookup>::Source, amount: T::Balance ) -> DispatchResult

Reduce the balance of who by as much as possible up to amount assets of id.

Origin must be Signed and the sender should be the Manager of the asset id.

Bails with NoAccount if the who is already dead.

  • id: The identifier of the asset to have some amount burned.
  • who: The account to be debited from.
  • amount: The maximum amount by which who’s balance should be reduced.

Emits Burned with the actual amount burned. If this takes the balance to below the minimum for the asset, then the amount burned is increased to take it to zero.

Weight: O(1) Modes: Post-existence of who; Pre & post Zombie-status of who.

source

pub fn transfer( origin: OriginFor<T>, id: T::AssetIdParameter, target: <<T as Config>::Lookup as StaticLookup>::Source, amount: T::Balance ) -> DispatchResult

Move some assets from the sender account to another.

Origin must be Signed.

  • id: The identifier of the asset to have some amount transferred.
  • target: The account to be credited.
  • amount: The amount by which the sender’s balance of assets should be reduced and target’s balance increased. The amount actually transferred may be slightly greater in the case that the transfer would otherwise take the sender balance above zero but below the minimum balance. Must be greater than zero.

Emits Transferred with the actual amount transferred. If this takes the source balance to below the minimum for the asset, then the amount transferred is increased to take it to zero.

Weight: O(1) Modes: Pre-existence of target; Post-existence of sender; Account pre-existence of target.

source

pub fn transfer_keep_alive( origin: OriginFor<T>, id: T::AssetIdParameter, target: <<T as Config>::Lookup as StaticLookup>::Source, amount: T::Balance ) -> DispatchResult

Move some assets from the sender account to another, keeping the sender account alive.

Origin must be Signed.

  • id: The identifier of the asset to have some amount transferred.
  • target: The account to be credited.
  • amount: The amount by which the sender’s balance of assets should be reduced and target’s balance increased. The amount actually transferred may be slightly greater in the case that the transfer would otherwise take the sender balance above zero but below the minimum balance. Must be greater than zero.

Emits Transferred with the actual amount transferred. If this takes the source balance to below the minimum for the asset, then the amount transferred is increased to take it to zero.

Weight: O(1) Modes: Pre-existence of target; Post-existence of sender; Account pre-existence of target.

source

pub fn force_transfer( origin: OriginFor<T>, id: T::AssetIdParameter, source: <<T as Config>::Lookup as StaticLookup>::Source, dest: <<T as Config>::Lookup as StaticLookup>::Source, amount: T::Balance ) -> DispatchResult

Move some assets from one account to another.

Origin must be Signed and the sender should be the Admin of the asset id.

  • id: The identifier of the asset to have some amount transferred.
  • source: The account to be debited.
  • dest: The account to be credited.
  • amount: The amount by which the source’s balance of assets should be reduced and dest’s balance increased. The amount actually transferred may be slightly greater in the case that the transfer would otherwise take the source balance above zero but below the minimum balance. Must be greater than zero.

Emits Transferred with the actual amount transferred. If this takes the source balance to below the minimum for the asset, then the amount transferred is increased to take it to zero.

Weight: O(1) Modes: Pre-existence of dest; Post-existence of source; Account pre-existence of dest.

source

pub fn freeze( origin: OriginFor<T>, id: T::AssetIdParameter, who: <<T as Config>::Lookup as StaticLookup>::Source ) -> DispatchResult

Disallow further unprivileged transfers of an asset id from an account who. who must already exist as an entry in Accounts of the asset. If you want to freeze an account that does not have an entry, use touch_other first.

Origin must be Signed and the sender should be the Freezer of the asset id.

  • id: The identifier of the asset to be frozen.
  • who: The account to be frozen.

Emits Frozen.

Weight: O(1)

source

pub fn thaw( origin: OriginFor<T>, id: T::AssetIdParameter, who: <<T as Config>::Lookup as StaticLookup>::Source ) -> DispatchResult

Allow unprivileged transfers to and from an account again.

Origin must be Signed and the sender should be the Admin of the asset id.

  • id: The identifier of the asset to be frozen.
  • who: The account to be unfrozen.

Emits Thawed.

Weight: O(1)

source

pub fn freeze_asset( origin: OriginFor<T>, id: T::AssetIdParameter ) -> DispatchResult

Disallow further unprivileged transfers for the asset class.

Origin must be Signed and the sender should be the Freezer of the asset id.

  • id: The identifier of the asset to be frozen.

Emits Frozen.

Weight: O(1)

source

pub fn thaw_asset( origin: OriginFor<T>, id: T::AssetIdParameter ) -> DispatchResult

Allow unprivileged transfers for the asset again.

Origin must be Signed and the sender should be the Admin of the asset id.

  • id: The identifier of the asset to be thawed.

Emits Thawed.

Weight: O(1)

source

pub fn transfer_ownership( origin: OriginFor<T>, id: T::AssetIdParameter, owner: <<T as Config>::Lookup as StaticLookup>::Source ) -> DispatchResult

Change the Owner of an asset.

Origin must be Signed and the sender should be the Owner of the asset id.

  • id: The identifier of the asset.
  • owner: The new Owner of this asset.

Emits OwnerChanged.

Weight: O(1)

source

pub fn set_team( origin: OriginFor<T>, id: T::AssetIdParameter, issuer: <<T as Config>::Lookup as StaticLookup>::Source, admin: <<T as Config>::Lookup as StaticLookup>::Source, freezer: <<T as Config>::Lookup as StaticLookup>::Source ) -> DispatchResult

Change the Issuer, Admin and Freezer of an asset.

Origin must be Signed and the sender should be the Owner of the asset id.

  • id: The identifier of the asset to be frozen.
  • issuer: The new Issuer of this asset.
  • admin: The new Admin of this asset.
  • freezer: The new Freezer of this asset.

Emits TeamChanged.

Weight: O(1)

source

pub fn set_metadata( origin: OriginFor<T>, id: T::AssetIdParameter, name: Vec<u8>, symbol: Vec<u8>, decimals: u8 ) -> DispatchResult

Set the metadata for an asset.

Origin must be Signed and the sender should be the Owner of the asset id.

Funds of sender are reserved according to the formula: MetadataDepositBase + MetadataDepositPerByte * (name.len + symbol.len) taking into account any already reserved funds.

  • id: The identifier of the asset to update.
  • name: The user friendly name of this asset. Limited in length by StringLimit.
  • symbol: The exchange symbol for this asset. Limited in length by StringLimit.
  • decimals: The number of decimals this asset uses to represent one unit.

Emits MetadataSet.

Weight: O(1)

source

pub fn clear_metadata( origin: OriginFor<T>, id: T::AssetIdParameter ) -> DispatchResult

Clear the metadata for an asset.

Origin must be Signed and the sender should be the Owner of the asset id.

Any deposit is freed for the asset owner.

  • id: The identifier of the asset to clear.

Emits MetadataCleared.

Weight: O(1)

source

pub fn force_set_metadata( origin: OriginFor<T>, id: T::AssetIdParameter, name: Vec<u8>, symbol: Vec<u8>, decimals: u8, is_frozen: bool ) -> DispatchResult

Force the metadata for an asset to some value.

Origin must be ForceOrigin.

Any deposit is left alone.

  • id: The identifier of the asset to update.
  • name: The user friendly name of this asset. Limited in length by StringLimit.
  • symbol: The exchange symbol for this asset. Limited in length by StringLimit.
  • decimals: The number of decimals this asset uses to represent one unit.

Emits MetadataSet.

Weight: O(N + S) where N and S are the length of the name and symbol respectively.

source

pub fn force_clear_metadata( origin: OriginFor<T>, id: T::AssetIdParameter ) -> DispatchResult

Clear the metadata for an asset.

Origin must be ForceOrigin.

Any deposit is returned.

  • id: The identifier of the asset to clear.

Emits MetadataCleared.

Weight: O(1)

source

pub fn force_asset_status( origin: OriginFor<T>, id: T::AssetIdParameter, owner: <<T as Config>::Lookup as StaticLookup>::Source, issuer: <<T as Config>::Lookup as StaticLookup>::Source, admin: <<T as Config>::Lookup as StaticLookup>::Source, freezer: <<T as Config>::Lookup as StaticLookup>::Source, min_balance: T::Balance, is_sufficient: bool, is_frozen: bool ) -> DispatchResult

Alter the attributes of a given asset.

Origin must be ForceOrigin.

  • id: The identifier of the asset.
  • owner: The new Owner of this asset.
  • issuer: The new Issuer of this asset.
  • admin: The new Admin of this asset.
  • freezer: The new Freezer of this asset.
  • min_balance: The minimum balance of this new asset that any single account must have. If an account’s balance is reduced below this, then it collapses to zero.
  • is_sufficient: Whether a non-zero balance of this asset is deposit of sufficient value to account for the state bloat associated with its balance storage. If set to true, then non-zero balances may be stored without a consumer reference (and thus an ED in the Balances pallet or whatever else is used to control user-account state growth).
  • is_frozen: Whether this asset class is frozen except for permissioned/admin instructions.

Emits AssetStatusChanged with the identity of the asset.

Weight: O(1)

source

pub fn approve_transfer( origin: OriginFor<T>, id: T::AssetIdParameter, delegate: <<T as Config>::Lookup as StaticLookup>::Source, amount: T::Balance ) -> DispatchResult

Approve an amount of asset for transfer by a delegated third-party account.

Origin must be Signed.

Ensures that ApprovalDeposit worth of Currency is reserved from signing account for the purpose of holding the approval. If some non-zero amount of assets is already approved from signing account to delegate, then it is topped up or unreserved to meet the right value.

NOTE: The signing account does not need to own amount of assets at the point of making this call.

  • id: The identifier of the asset.
  • delegate: The account to delegate permission to transfer asset.
  • amount: The amount of asset that may be transferred by delegate. If there is already an approval in place, then this acts additively.

Emits ApprovedTransfer on success.

Weight: O(1)

source

pub fn cancel_approval( origin: OriginFor<T>, id: T::AssetIdParameter, delegate: <<T as Config>::Lookup as StaticLookup>::Source ) -> DispatchResult

Cancel all of some asset approved for delegated transfer by a third-party account.

Origin must be Signed and there must be an approval in place between signer and delegate.

Unreserves any deposit previously reserved by approve_transfer for the approval.

  • id: The identifier of the asset.
  • delegate: The account delegated permission to transfer asset.

Emits ApprovalCancelled on success.

Weight: O(1)

source

pub fn force_cancel_approval( origin: OriginFor<T>, id: T::AssetIdParameter, owner: <<T as Config>::Lookup as StaticLookup>::Source, delegate: <<T as Config>::Lookup as StaticLookup>::Source ) -> DispatchResult

Cancel all of some asset approved for delegated transfer by a third-party account.

Origin must be either ForceOrigin or Signed origin with the signer being the Admin account of the asset id.

Unreserves any deposit previously reserved by approve_transfer for the approval.

  • id: The identifier of the asset.
  • delegate: The account delegated permission to transfer asset.

Emits ApprovalCancelled on success.

Weight: O(1)

source

pub fn transfer_approved( origin: OriginFor<T>, id: T::AssetIdParameter, owner: <<T as Config>::Lookup as StaticLookup>::Source, destination: <<T as Config>::Lookup as StaticLookup>::Source, amount: T::Balance ) -> DispatchResult

Transfer some asset balance from a previously delegated account to some third-party account.

Origin must be Signed and there must be an approval in place by the owner to the signer.

If the entire amount approved for transfer is transferred, then any deposit previously reserved by approve_transfer is unreserved.

  • id: The identifier of the asset.
  • owner: The account which previously approved for a transfer of at least amount and from which the asset balance will be withdrawn.
  • destination: The account to which the asset balance of amount will be transferred.
  • amount: The amount of assets to transfer.

Emits TransferredApproved on success.

Weight: O(1)

source

pub fn touch(origin: OriginFor<T>, id: T::AssetIdParameter) -> DispatchResult

Create an asset account for non-provider assets.

A deposit will be taken from the signer account.

  • origin: Must be Signed; the signer account must have sufficient funds for a deposit to be taken.
  • id: The identifier of the asset for the account to be created.

Emits Touched event when successful.

source

pub fn refund( origin: OriginFor<T>, id: T::AssetIdParameter, allow_burn: bool ) -> DispatchResult

Return the deposit (if any) of an asset account or a consumer reference (if any) of an account.

The origin must be Signed.

  • id: The identifier of the asset for which the caller would like the deposit refunded.
  • allow_burn: If true then assets may be destroyed in order to complete the refund.

Emits Refunded event when successful.

source

pub fn set_min_balance( origin: OriginFor<T>, id: T::AssetIdParameter, min_balance: T::Balance ) -> DispatchResult

Sets the minimum balance of an asset.

Only works if there aren’t any accounts that are holding the asset or if the new value of min_balance is less than the old one.

Origin must be Signed and the sender has to be the Owner of the asset id.

  • id: The identifier of the asset.
  • min_balance: The new value of min_balance.

Emits AssetMinBalanceChanged event when successful.

source

pub fn touch_other( origin: OriginFor<T>, id: T::AssetIdParameter, who: <<T as Config>::Lookup as StaticLookup>::Source ) -> DispatchResult

Create an asset account for who.

A deposit will be taken from the signer account.

  • origin: Must be Signed by Freezer or Admin of the asset id; the signer account must have sufficient funds for a deposit to be taken.
  • id: The identifier of the asset for the account to be created.
  • who: The account to be created.

Emits Touched event when successful.

source

pub fn refund_other( origin: OriginFor<T>, id: T::AssetIdParameter, who: <<T as Config>::Lookup as StaticLookup>::Source ) -> DispatchResult

Return the deposit (if any) of a target asset account. Useful if you are the depositor.

The origin must be Signed and either the account owner, depositor, or asset Admin. In order to burn a non-zero balance of the asset, the caller must be the account and should use refund.

  • id: The identifier of the asset for the account holding a deposit.
  • who: The account to refund.

Emits Refunded event when successful.

source

pub fn block( origin: OriginFor<T>, id: T::AssetIdParameter, who: <<T as Config>::Lookup as StaticLookup>::Source ) -> DispatchResult

Disallow further unprivileged transfers of an asset id to and from an account who.

Origin must be Signed and the sender should be the Freezer of the asset id.

  • id: The identifier of the account’s asset.
  • who: The account to be unblocked.

Emits Blocked.

Weight: O(1)

Trait Implementations§

source§

impl<T: Config<I>, I: 'static> AccountTouch<<T as Config<I>>::AssetId, <T as Config>::AccountId> for Pallet<T, I>

Implements AccountTouch trait. Note that a depositor can be any account, without any specific privilege. This implementation is supposed to be used only for creation of system accounts.

§

type Balance = <<T as Config<I>>::Currency as Currency<<T as Config>::AccountId>>::Balance

The type for currency units of the deposit.
source§

fn deposit_required(_: T::AssetId) -> Self::Balance

The deposit amount of a native currency required for creating an account of the asset.
source§

fn touch( asset: T::AssetId, who: T::AccountId, depositor: T::AccountId ) -> DispatchResult

Create an account for who of the asset with a deposit taken from the depositor.
source§

impl<T: Config<I>, I: 'static> Balanced<<T as Config>::AccountId> for Pallet<T, I>

§

type OnDropCredit = DecreaseIssuance<<T as Config>::AccountId, Pallet<T, I>>

The type for managing what happens when an instance of Credit is dropped without being used.
§

type OnDropDebt = IncreaseIssuance<<T as Config>::AccountId, Pallet<T, I>>

The type for managing what happens when an instance of Debt is dropped without being used.
source§

fn rescind( asset: Self::AssetId, amount: Self::Balance ) -> Imbalance<Self::AssetId, Self::Balance, Self::OnDropDebt, Self::OnDropCredit>

Reduce the total issuance by amount and return the according imbalance. The imbalance will typically be used to reduce an account by the same amount with e.g. settle. Read more
source§

fn issue( asset: Self::AssetId, amount: Self::Balance ) -> Imbalance<Self::AssetId, Self::Balance, Self::OnDropCredit, Self::OnDropDebt>

Increase the total issuance by amount and return the according imbalance. The imbalance will typically be used to increase an account by the same amount with e.g. resolve_into_existing or resolve_creating. Read more
source§

fn pair( asset: Self::AssetId, amount: Self::Balance ) -> (Imbalance<Self::AssetId, Self::Balance, Self::OnDropDebt, Self::OnDropCredit>, Imbalance<Self::AssetId, Self::Balance, Self::OnDropCredit, Self::OnDropDebt>)

Produce a pair of imbalances that cancel each other out exactly. Read more
source§

fn deposit( asset: Self::AssetId, who: &AccountId, value: Self::Balance, precision: Precision ) -> Result<Imbalance<Self::AssetId, Self::Balance, Self::OnDropDebt, Self::OnDropCredit>, DispatchError>

Mints value into the account of who, creating it as needed. Read more
source§

fn withdraw( asset: Self::AssetId, who: &AccountId, value: Self::Balance, precision: Precision, preservation: Preservation, force: Fortitude ) -> Result<Imbalance<Self::AssetId, Self::Balance, Self::OnDropCredit, Self::OnDropDebt>, DispatchError>

Removes value balance from who account if possible. Read more
source§

fn resolve( who: &AccountId, credit: Imbalance<Self::AssetId, Self::Balance, Self::OnDropCredit, Self::OnDropDebt> ) -> Result<(), Imbalance<Self::AssetId, Self::Balance, Self::OnDropCredit, Self::OnDropDebt>>

The balance of who is increased in order to counter credit. If the whole of credit cannot be countered, then nothing is changed and the original credit is returned in an Err. Read more
source§

fn settle( who: &AccountId, debt: Imbalance<Self::AssetId, Self::Balance, Self::OnDropDebt, Self::OnDropCredit>, preservation: Preservation ) -> Result<Imbalance<Self::AssetId, Self::Balance, Self::OnDropCredit, Self::OnDropDebt>, Imbalance<Self::AssetId, Self::Balance, Self::OnDropDebt, Self::OnDropCredit>>

The balance of who is decreased in order to counter debt. If the whole of debt cannot be countered, then nothing is changed and the original debt is returned in an Err.
source§

fn done_rescind(_asset: Self::AssetId, _amount: Self::Balance)

source§

fn done_issue(_asset: Self::AssetId, _amount: Self::Balance)

source§

fn done_deposit(_asset: Self::AssetId, _who: &AccountId, _amount: Self::Balance)

source§

fn done_withdraw( _asset: Self::AssetId, _who: &AccountId, _amount: Self::Balance )

source§

impl<T, I: 'static> Benchmarking for Pallet<T, I>where T: Config + Config<I>,

source§

fn benchmarks(extra: bool) -> Vec<BenchmarkMetadata>

Get the benchmarks available for this pallet. Generally there is one benchmark per extrinsic, so these are sometimes just called “extrinsics”. Read more
source§

fn run_benchmark( extrinsic: &[u8], c: &[(BenchmarkParameter, u32)], whitelist: &[TrackedStorageKey], verify: bool, internal_repeats: u32 ) -> Result<Vec<BenchmarkResult>, BenchmarkError>

Run the benchmarks for this pallet.
source§

impl<T: Config<I>, I: 'static> Callable<T> for Pallet<T, I>

§

type RuntimeCall = Call<T, I>

source§

impl<T, I> Clone for Pallet<T, I>

source§

fn clone(&self) -> Self

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
source§

impl<T: Config<I>, I: 'static> ContainsPair<<T as Config<I>>::AssetId, <T as Config>::AccountId> for Pallet<T, I>

Implements ContainsPair trait for a pair of asset and account IDs.

source§

fn contains(asset: &T::AssetId, who: &T::AccountId) -> bool

Check if an account with the given asset ID and account address exists.

source§

impl<T: Config<I>, I: 'static> Create<<T as Config>::AccountId> for Pallet<T, I>

source§

fn create( id: T::AssetId, admin: T::AccountId, is_sufficient: bool, min_balance: Self::Balance ) -> DispatchResult

Create a new fungible asset.
source§

impl<T, I> Debug for Pallet<T, I>

source§

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

Formats the value using the given formatter. Read more
source§

impl<T: Config<I>, I: 'static> Destroy<<T as Config>::AccountId> for Pallet<T, I>

source§

fn start_destroy( id: T::AssetId, maybe_check_owner: Option<T::AccountId> ) -> DispatchResult

Start the destruction an existing fungible asset. Read more
source§

fn destroy_accounts( id: T::AssetId, max_items: u32 ) -> Result<u32, DispatchError>

Destroy all accounts associated with a given asset. destroy_accounts should only be called after start_destroy has been called, and the asset is in a Destroying state Read more
source§

fn destroy_approvals( id: T::AssetId, max_items: u32 ) -> Result<u32, DispatchError>

Destroy all approvals associated with a given asset up to the max_items destroy_approvals should only be called after start_destroy has been called, and the asset is in a Destroying state Read more
source§

fn finish_destroy(id: T::AssetId) -> DispatchResult

Complete destroying asset and unreserve currency. finish_destroy should only be called after start_destroy has been called, and the asset is in a Destroying state. All accounts or approvals should be destroyed before hand. Read more
source§

impl<T: Config<I>, I: 'static> GetStorageVersion for Pallet<T, I>

§

type CurrentStorageVersion = StorageVersion

This will be filled out by the pallet macro. Read more
source§

fn current_storage_version() -> Self::CurrentStorageVersion

Returns the current storage version as supported by the pallet.
source§

fn on_chain_storage_version() -> StorageVersion

Returns the on-chain storage version of the pallet as stored in the storage.
source§

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

source§

fn on_initialize(_n: BlockNumber) -> Weight

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

fn on_finalize(_n: BlockNumber)

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

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
source§

fn on_runtime_upgrade() -> Weight

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

fn try_state(_n: BlockNumber) -> Result<(), DispatchError>

Execute the sanity checks of this pallet, per block. Read more
source§

fn pre_upgrade() -> Result<Vec<u8, Global>, DispatchError>

Execute some pre-checks prior to a runtime upgrade. Read more
source§

fn post_upgrade(_state: Vec<u8, Global>) -> Result<(), DispatchError>

Execute some post-checks after a runtime upgrade. Read more
source§

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 wasm runtime. Read more
source§

fn integrity_test()

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

impl<T: Config<I>, I: 'static> Inspect<<T as Config>::AccountId> for Pallet<T, I>

§

type AssetId = <T as Config<I>>::AssetId

Means of identifying one asset class from another.
§

type Balance = <T as Config<I>>::Balance

Scalar type for representing balance of an account.
source§

fn total_issuance(asset: Self::AssetId) -> Self::Balance

The total amount of issuance in the system.
source§

fn minimum_balance(asset: Self::AssetId) -> Self::Balance

The minimum balance any single account may have.
source§

fn balance( asset: Self::AssetId, who: &<T as SystemConfig>::AccountId ) -> Self::Balance

Get the balance of who which does not include funds which are exclusively allocated to subsystems of the chain (“on hold” or “reserved”). Read more
source§

fn total_balance( asset: Self::AssetId, who: &<T as SystemConfig>::AccountId ) -> Self::Balance

Get the total amount of funds whose ultimate beneficial ownership can be determined as who. Read more
source§

fn reducible_balance( asset: Self::AssetId, who: &<T as SystemConfig>::AccountId, preservation: Preservation, _: Fortitude ) -> Self::Balance

Get the maximum amount that who can withdraw/transfer successfully based on whether the account should be kept alive (preservation) or whether we are willing to force the transfer and potentially go below user-level restrictions on the minimum amount of the account. Read more
source§

fn can_deposit( asset: Self::AssetId, who: &<T as SystemConfig>::AccountId, amount: Self::Balance, provenance: Provenance ) -> DepositConsequence

Returns true if the asset balance of who may be increased by amount. Read more
source§

fn can_withdraw( asset: Self::AssetId, who: &<T as SystemConfig>::AccountId, amount: Self::Balance ) -> WithdrawConsequence<Self::Balance>

Returns Failed if the asset balance of who may not be decreased by amount, otherwise the consequence.
source§

fn asset_exists(asset: Self::AssetId) -> bool

Returns true if an asset exists.
source§

fn active_issuance(asset: Self::AssetId) -> Self::Balance

The total amount of issuance in the system excluding those which are controlled by the system.
source§

impl<T: Config<I>, I: 'static> Inspect<<T as Config>::AccountId> for Pallet<T, I>

source§

fn asset_ids() -> Self::AssetsIterator

Returns an iterator of the assets in existence.

NOTE: iterating this list invokes a storage read per item.

§

type AssetsIterator = KeyPrefixIterator<<T as Config<I>>::AssetId>

source§

impl<T: Config<I>, I: 'static> Inspect<<T as Config>::AccountId> for Pallet<T, I>

source§

impl<T: Config<I>, I: 'static> Inspect<<T as Config>::AccountId> for Pallet<T, I>

source§

fn name(asset: T::AssetId) -> Vec<u8>

source§

fn symbol(asset: T::AssetId) -> Vec<u8>

source§

fn decimals(asset: T::AssetId) -> u8

source§

impl<T: Config<I>, I: 'static> Inspect<<T as Config>::AccountId> for Pallet<T, I>

source§

fn allowance( asset: T::AssetId, owner: &<T as SystemConfig>::AccountId, delegate: &<T as SystemConfig>::AccountId ) -> T::Balance

source§

impl<T: Config<I>, I: 'static> IntegrityTest for Pallet<T, I>

source§

impl<T: Config<I>, I: 'static> MetadataDeposit<<<T as Config<I>>::Currency as Currency<<T as Config>::AccountId>>::Balance> for Pallet<T, I>

source§

fn calc_metadata_deposit( name: &[u8], symbol: &[u8] ) -> <T::Currency as Currency<<T as SystemConfig>::AccountId>>::Balance

source§

impl<T: Config<I>, I: 'static> Mutate<<T as Config>::AccountId> for Pallet<T, I>

source§

fn approve( asset: T::AssetId, owner: &<T as SystemConfig>::AccountId, delegate: &<T as SystemConfig>::AccountId, amount: T::Balance ) -> DispatchResult

source§

fn transfer_from( asset: T::AssetId, owner: &<T as SystemConfig>::AccountId, delegate: &<T as SystemConfig>::AccountId, dest: &<T as SystemConfig>::AccountId, amount: T::Balance ) -> DispatchResult

source§

impl<T: Config<I>, I: 'static> Mutate<<T as Config>::AccountId> for Pallet<T, I>

source§

fn done_mint_into( asset_id: Self::AssetId, beneficiary: &<T as SystemConfig>::AccountId, amount: Self::Balance )

source§

fn done_burn_from( asset_id: Self::AssetId, target: &<T as SystemConfig>::AccountId, balance: Self::Balance )

source§

fn done_transfer( asset_id: Self::AssetId, source: &<T as SystemConfig>::AccountId, dest: &<T as SystemConfig>::AccountId, amount: Self::Balance )

source§

fn mint_into( asset: Self::AssetId, who: &AccountId, amount: Self::Balance ) -> Result<Self::Balance, DispatchError>

Increase the balance of who by exactly amount, minting new tokens. If that isn’t possible then an Err is returned and nothing is changed.
source§

fn burn_from( asset: Self::AssetId, who: &AccountId, amount: Self::Balance, precision: Precision, force: Fortitude ) -> Result<Self::Balance, DispatchError>

Decrease the balance of who by at least amount, possibly slightly more in the case of minimum-balance requirements, burning the tokens. If that isn’t possible then an Err is returned and nothing is changed. If successful, the amount of tokens reduced is returned.
source§

fn shelve( asset: Self::AssetId, who: &AccountId, amount: Self::Balance ) -> Result<Self::Balance, DispatchError>

Attempt to decrease the asset balance of who by amount. Read more
source§

fn restore( asset: Self::AssetId, who: &AccountId, amount: Self::Balance ) -> Result<Self::Balance, DispatchError>

Attempt to increase the asset balance of who by amount. Read more
source§

fn transfer( asset: Self::AssetId, source: &AccountId, dest: &AccountId, amount: Self::Balance, preservation: Preservation ) -> Result<Self::Balance, DispatchError>

Transfer funds from one account into another.
source§

fn set_balance( asset: Self::AssetId, who: &AccountId, amount: Self::Balance ) -> Self::Balance

Simple infallible function to force an account to have a particular balance, good for use in tests and benchmarks but not recommended for production code owing to the lack of error reporting. Read more
source§

fn done_shelve(_asset: Self::AssetId, _who: &AccountId, _amount: Self::Balance)

source§

fn done_restore(_asset: Self::AssetId, _who: &AccountId, _amount: Self::Balance)

source§

impl<T: Config<I>, I: 'static> Mutate<<T as Config>::AccountId> for Pallet<T, I>

source§

fn set( asset: T::AssetId, from: &<T as SystemConfig>::AccountId, name: Vec<u8>, symbol: Vec<u8>, decimals: u8 ) -> DispatchResult

source§

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

source§

fn offchain_worker(n: BlockNumberFor<T>)

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

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

source§

impl<T: Config<I>, I: 'static> OnGenesis for Pallet<T, I>

source§

fn on_genesis()

Something that should happen at genesis.
source§

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

source§

fn on_idle(n: BlockNumberFor<T>, remaining_weight: Weight) -> Weight

source§

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

source§

impl<T: Config<I>, I: 'static> OnRuntimeUpgrade for Pallet<T, I>

source§

fn on_runtime_upgrade() -> Weight

source§

fn pre_upgrade() -> Result<Vec<u8>, TryRuntimeError>

source§

fn post_upgrade(state: Vec<u8>) -> Result<(), TryRuntimeError>

source§

fn try_on_runtime_upgrade(checks: bool) -> Result<Weight, DispatchError>

The expected and default behavior of this method is to handle executing pre_upgrade -> on_runtime_upgrade -> post_upgrade hooks for a migration. Read more
source§

impl<T: Config<I>, I: 'static> PalletInfoAccess for Pallet<T, I>

source§

fn index() -> usize

Index of the pallet as configured in the runtime.
source§

fn name() -> &'static str

Name of the pallet as configured in the runtime.
source§

fn module_name() -> &'static str

Name of the Rust module containing the pallet.
source§

fn crate_version() -> CrateVersion

Version of the crate containing the pallet.
source§

impl<T: Config<I>, I: 'static> PalletsInfoAccess for Pallet<T, I>

source§

fn count() -> usize

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

fn infos() -> Vec<PalletInfoData>

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

impl<T, I> PartialEq<Pallet<T, I>> for Pallet<T, I>

source§

fn eq(&self, other: &Self) -> 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.
source§

impl<T: Config<I>, I: 'static> StorageInfoTrait for Pallet<T, I>

source§

impl<T: Config<I>, I: 'static> StoredMap<(<T as Config<I>>::AssetId, <T as Config>::AccountId), <T as Config<I>>::Extra> for Pallet<T, I>

source§

fn get(id_who: &(T::AssetId, T::AccountId)) -> T::Extra

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

fn try_mutate_exists<R, E: From<DispatchError>>( id_who: &(T::AssetId, T::AccountId), f: impl FnOnce(&mut Option<T::Extra>) -> Result<R, E> ) -> Result<R, E>

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. f will always be called with an option representing if the storage item exists (Some<V>) or if the storage item does not exist (None), independent of the QueryType.
source§

fn mutate<R>(k: &K, f: impl FnOnce(&mut T) -> R) -> Result<R, DispatchError>

Mutate the item.
source§

fn mutate_exists<R>( k: &K, f: impl FnOnce(&mut Option<T>) -> R ) -> Result<R, DispatchError>

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

fn insert(k: &K, t: T) -> Result<(), DispatchError>

Set the item to something new.
source§

fn remove(k: &K) -> Result<(), DispatchError>

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

impl<T: Config<I>, I: 'static> TryState<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T, I>

source§

fn try_state( n: BlockNumberFor<T>, _s: TryStateSelect ) -> Result<(), TryRuntimeError>

Execute the state checks.
source§

impl<T: Config<I>, I: 'static> Unbalanced<<T as Config>::AccountId> for Pallet<T, I>

source§

fn handle_raw_dust(_: Self::AssetId, _: Self::Balance)

Create some dust and handle it with Self::handle_dust. This is an unbalanced operation and it must only be used when an account is modified in a raw fashion, outside of the entire fungibles API. The amount is capped at Self::minimum_balance() - 1. Read more
source§

fn handle_dust(_: Dust<T::AccountId, Self>)

Do something with the dust which has been destroyed from the system. Dust can be converted into a Credit with the Balanced trait impl.
source§

fn write_balance( _: Self::AssetId, _: &T::AccountId, _: Self::Balance ) -> Result<Option<Self::Balance>, DispatchError>

Forcefully set the balance of who to amount. Read more
source§

fn set_total_issuance(id: T::AssetId, amount: Self::Balance)

Set the total issuance to amount.
source§

fn decrease_balance( asset: T::AssetId, who: &T::AccountId, amount: Self::Balance, precision: Precision, preservation: Preservation, _: Fortitude ) -> Result<Self::Balance, DispatchError>

Reduce the balance of who by amount. Read more
source§

fn increase_balance( asset: T::AssetId, who: &T::AccountId, amount: Self::Balance, _: Precision ) -> Result<Self::Balance, DispatchError>

Increase the balance of who by amount. Read more
source§

fn deactivate(_asset: Self::AssetId, _: Self::Balance)

Reduce the active issuance by some amount.
source§

fn reactivate(_asset: Self::AssetId, _: Self::Balance)

Increase the active issuance by some amount, up to the outstanding amount reduced.
source§

impl<T: Config<I>, I: 'static> WhitelistedStorageKeys for Pallet<T, I>

source§

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.
source§

impl<T, I> Eq for Pallet<T, I>

Auto Trait Implementations§

§

impl<T, I> RefUnwindSafe for Pallet<T, I>where I: RefUnwindSafe, T: RefUnwindSafe,

§

impl<T, I> Send for Pallet<T, I>where I: Send, T: Send,

§

impl<T, I> Sync for Pallet<T, I>where I: Sync, T: Sync,

§

impl<T, I> Unpin for Pallet<T, I>where I: Unpin, T: Unpin,

§

impl<T, I> UnwindSafe for Pallet<T, I>where I: UnwindSafe, T: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CheckedConversion for T

source§

fn checked_from<T>(t: T) -> Option<Self>where Self: TryFrom<T>,

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

fn checked_into<T>(self) -> Option<T>where Self: TryInto<T>,

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

impl<T> DynClone for Twhere T: Clone,

source§

fn __clone_box(&self, _: Private) -> *mut ()

source§

impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

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

fn in_current_span(self) -> Instrumented<Self>

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

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T> IsType<T> for T

source§

fn from_ref(t: &T) -> &T

Cast reference.
source§

fn into_ref(&self) -> &T

Cast reference.
source§

fn from_mut(t: &mut T) -> &mut T

Cast mutable reference.
source§

fn into_mut(&mut self) -> &mut T

Cast mutable reference.
source§

impl<T, Outer> IsWrappedBy<Outer> for Twhere Outer: AsRef<T> + AsMut<T> + From<T>, T: From<Outer>,

source§

fn from_ref(outer: &Outer) -> &T

Get a reference to the inner from the outer.

source§

fn from_mut(outer: &mut Outer) -> &mut T

Get a mutable reference to the inner from the outer.

§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> SaturatedConversion for T

source§

fn saturated_from<T>(t: T) -> Selfwhere Self: UniqueSaturatedFrom<T>,

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

fn saturated_into<T>(self) -> Twhere Self: UniqueSaturatedInto<T>,

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

impl<SS, SP> SupersetOf<SS> for SPwhere SS: SubsetOf<SP>,

§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<S, T> UncheckedInto<T> for Swhere T: UncheckedFrom<S>,

source§

fn unchecked_into(self) -> T

The counterpart to unchecked_from.
source§

impl<T, S> UniqueSaturatedInto<T> for Swhere T: Bounded, S: TryInto<T>,

source§

fn unique_saturated_into(self) -> T

Consume self to return an equivalent value of T.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
§

impl<T> JsonSchemaMaybe for T

§

impl<T> MaybeDebug for Twhere T: Debug,

source§

impl<T> MaybeRefUnwindSafe for Twhere T: RefUnwindSafe,

source§

impl<T> Member for Twhere T: Send + Sync + Debug + Eq + PartialEq<T> + Clone + 'static,

source§

impl<T> Scalar for Twhere T: 'static + Clone + PartialEq<T> + Debug,