referrerpolicy=no-referrer-when-downgrade

Trait polkadot_sdk_frame::traits::tokens::fungibles::Mutate

pub trait Mutate<AccountId>: Inspect<AccountId> + Unbalanced<AccountId>
where AccountId: Eq,
{ // Provided methods fn mint_into( asset: Self::AssetId, who: &AccountId, amount: Self::Balance, ) -> Result<Self::Balance, DispatchError> { ... } fn burn_from( asset: Self::AssetId, who: &AccountId, amount: Self::Balance, preservation: Preservation, precision: Precision, force: Fortitude, ) -> Result<Self::Balance, DispatchError> { ... } fn shelve( asset: Self::AssetId, who: &AccountId, amount: Self::Balance, ) -> Result<Self::Balance, DispatchError> { ... } fn restore( asset: Self::AssetId, who: &AccountId, amount: Self::Balance, ) -> Result<Self::Balance, DispatchError> { ... } fn transfer( asset: Self::AssetId, source: &AccountId, dest: &AccountId, amount: Self::Balance, preservation: Preservation, ) -> Result<Self::Balance, DispatchError> { ... } fn set_balance( asset: Self::AssetId, who: &AccountId, amount: Self::Balance, ) -> Self::Balance { ... } fn done_mint_into( _asset: Self::AssetId, _who: &AccountId, _amount: Self::Balance, ) { ... } fn done_burn_from( _asset: Self::AssetId, _who: &AccountId, _amount: Self::Balance, ) { ... } fn done_shelve( _asset: Self::AssetId, _who: &AccountId, _amount: Self::Balance, ) { ... } fn done_restore( _asset: Self::AssetId, _who: &AccountId, _amount: Self::Balance, ) { ... } fn done_transfer( _asset: Self::AssetId, _source: &AccountId, _dest: &AccountId, _amount: Self::Balance, ) { ... } }
Expand description

Trait for providing a basic fungible asset.

Provided Methods§

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.

fn burn_from( asset: Self::AssetId, who: &AccountId, amount: Self::Balance, preservation: Preservation, 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.

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

Attempt to decrease the asset balance of who by amount.

Equivalent to burn_from, except with an expectation that within the bounds of some universal issuance, the total assets suspended and resumed will be equivalent. The implementation may be configured such that the total assets suspended may never be less than the total assets resumed (which is the invariant for an issuing system), or the reverse (which the invariant in a non-issuing system).

Because of this expectation, any metadata associated with the asset is expected to survive the suspect-resume cycle.

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

Attempt to increase the asset balance of who by amount.

Equivalent to mint_into, except with an expectation that within the bounds of some universal issuance, the total assets suspended and resumed will be equivalent. The implementation may be configured such that the total assets suspended may never be less than the total assets resumed (which is the invariant for an issuing system), or the reverse (which the invariant in a non-issuing system).

Because of this expectation, any metadata associated with the asset is expected to survive the suspect-resume cycle.

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.

A transfer where the source and destination account are identical is treated as No-OP after checking the preconditions.

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.

Returns the new balance.

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

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

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

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

fn done_transfer( _asset: Self::AssetId, _source: &AccountId, _dest: &AccountId, _amount: Self::Balance, )

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

§

impl<AccountId> Mutate<AccountId> for ()
where AccountId: Eq,

Dummy implementation of Mutate

Implementors§

§

impl<Left, Right, Criterion, AssetKind, AccountId> Mutate<AccountId> for polkadot_sdk_frame::traits::tokens::fungible::UnionOf<Left, Right, Criterion, AssetKind, AccountId>
where Left: Mutate<AccountId>, Right: Mutate<AccountId, Balance = <Left as Inspect<AccountId>>::Balance>, Criterion: Convert<AssetKind, Either<(), <Right as Inspect<AccountId>>::AssetId>>, AssetKind: AssetId, AccountId: Eq,

§

impl<Left, Right, Criterion, AssetKind, AccountId> Mutate<AccountId> for polkadot_sdk_frame::traits::tokens::fungibles::UnionOf<Left, Right, Criterion, AssetKind, AccountId>
where Left: Mutate<AccountId>, Right: Mutate<AccountId, Balance = <Left as Inspect<AccountId>>::Balance>, Criterion: Convert<AssetKind, Either<<Left as Inspect<AccountId>>::AssetId, <Right as Inspect<AccountId>>::AssetId>>, AssetKind: AssetId, AccountId: Eq,