Trait frame_support::traits::tokens::fungibles::Unbalanced[][src]

pub trait Unbalanced<AccountId>: Inspect<AccountId> {
    fn set_balance(
        asset: Self::AssetId,
        who: &AccountId,
        amount: Self::Balance
    ) -> DispatchResult;
fn set_total_issuance(asset: Self::AssetId, amount: Self::Balance); fn decrease_balance(
        asset: Self::AssetId,
        who: &AccountId,
        amount: Self::Balance
    ) -> Result<Self::Balance, DispatchError> { ... }
fn decrease_balance_at_most(
        asset: Self::AssetId,
        who: &AccountId,
        amount: Self::Balance
    ) -> Self::Balance { ... }
fn increase_balance(
        asset: Self::AssetId,
        who: &AccountId,
        amount: Self::Balance
    ) -> Result<Self::Balance, DispatchError> { ... }
fn increase_balance_at_most(
        asset: Self::AssetId,
        who: &AccountId,
        amount: Self::Balance
    ) -> Self::Balance { ... } }
Expand description

A fungible token class where the balance can be set arbitrarily.

WARNING Do not use this directly unless you want trouble, since it allows you to alter account balances without keeping the issuance up to date. It has no safeguards against accidentally creating token imbalances in your system leading to accidental imflation or deflation. It’s really just for the underlying datatype to implement so the user gets the much safer Balanced trait to use.

Required methods

Set the asset balance of who to amount. If this cannot be done for some reason (e.g. because the account cannot be created or an overflow) then an Err is returned.

Set the total issuance of asset to amount.

Provided methods

Reduce the asset balance of who by amount. If it cannot be reduced by that amount for some reason, return Err and don’t reduce it at all. If Ok, return the imbalance.

Minimum balance will be respected and the returned imbalance may be up to Self::minimum_balance() - 1 greater than amount.

Reduce the asset balance of who by the most that is possible, up to amount.

Minimum balance will be respected and the returned imbalance may be up to Self::minimum_balance() - 1 greater than amount.

Return the imbalance by which the account was reduced.

Increase the asset balance of who by amount. If it cannot be increased by that amount for some reason, return Err and don’t increase it at all. If Ok, return the imbalance.

Minimum balance will be respected and an error will be returned if amount < Self::minimum_balance() when the account of who is zero.

Increase the asset balance of who by the most that is possible, up to amount.

Minimum balance will be respected and the returned imbalance will be zero in the case that amount < Self::minimum_balance().

Return the imbalance by which the account was increased.

Implementors