Trait frame_support::traits::tokens::fungible::Mutate[][src]

pub trait Mutate<AccountId>: Inspect<AccountId> {
    fn mint_into(who: &AccountId, amount: Self::Balance) -> DispatchResult;
fn burn_from(
        who: &AccountId,
        amount: Self::Balance
    ) -> Result<Self::Balance, DispatchError>; fn slash(
        who: &AccountId,
        amount: Self::Balance
    ) -> Result<Self::Balance, DispatchError> { ... }
fn teleport(
        source: &AccountId,
        dest: &AccountId,
        amount: Self::Balance
    ) -> Result<Self::Balance, DispatchError> { ... } }
Expand description

Trait for providing an ERC-20 style fungible asset.

Required methods

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.

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.

Provided methods

Attempt to reduce the balance of who by as much as possible up to amount, and possibly slightly more due to minimum_balance requirements. If no decrease is possible then an Err is returned and nothing is changed. If successful, the amount of tokens reduced is returned.

The default implementation just uses withdraw along with reducible_balance to ensure that is doesn’t fail.

Transfer funds from one account into another. The default implementation uses mint_into and burn_from and may generate unwanted events.

Implementors