referrerpolicy=no-referrer-when-downgrade
frame_support::traits::tokens::fungibles

Trait Destroy

Source
pub trait Destroy<AccountId>: Inspect<AccountId> {
    // Required methods
    fn start_destroy(
        id: Self::AssetId,
        maybe_check_owner: Option<AccountId>,
    ) -> DispatchResult;
    fn destroy_accounts(
        id: Self::AssetId,
        max_items: u32,
    ) -> Result<u32, DispatchError>;
    fn destroy_approvals(
        id: Self::AssetId,
        max_items: u32,
    ) -> Result<u32, DispatchError>;
    fn finish_destroy(id: Self::AssetId) -> DispatchResult;
}
Expand description

Trait for providing the ability to destroy existing fungible assets.

Required Methods§

Source

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

Start the destruction an existing fungible asset.

  • id: The AssetId to be destroyed. successfully.
  • maybe_check_owner: An optional account id that can be used to authorize the destroy command. If not provided, no authorization checks will be performed before destroying asset.
Source

fn destroy_accounts( id: Self::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

  • id: The identifier of the asset to be destroyed. This must identify an existing asset.
  • max_items: The maximum number of accounts to be destroyed for a given call of the function. This value should be small enough to allow the operation fit into a logical block.

Response:

  • u32: Total number of approvals which were actually destroyed

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

Source

fn destroy_approvals( id: Self::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

  • id: The identifier of the asset to be destroyed. This must identify an existing asset.
  • max_items: The maximum number of accounts to be destroyed for a given call of the function. This value should be small enough to allow the operation fit into a logical block.

Response:

  • u32: Total number of approvals which were actually destroyed

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

Source

fn finish_destroy(id: Self::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.

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

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

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